WPS8Text.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WPS8Text.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2006, 2007 Andrew Ziem
11 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
12 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
13 *
14 * For minor contributions see the git repository.
15 *
16 * Alternatively, the contents of this file may be used under the terms
17 * of the GNU Lesser General Public License Version 2.1 or later
18 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19 * applicable instead of those above.
20 */
21
22 #ifndef WPS8_TEXT_H
23 #define WPS8_TEXT_H
24
25 #include <vector>
26
27 #include "libwps_internal.h"
28
29 #include "WPSDebug.h"
30
31 #include "WPSTextParser.h"
32
33 namespace WPS8Struct
34 {
35 struct FileData;
36 }
37
38 namespace WPS8TextInternal
39 {
40 struct State;
41 class SubDocument;
42 }
43
44 class WPS8Parser;
45 class WPS8TextStyle;
46
47 class WPS8Text : public WPSTextParser
48 {
49 friend class WPS8TextInternal::SubDocument;
50 friend class WPS8Parser;
51 friend class WPS8TextStyle;
52 public:
53 WPS8Text(WPS8Parser &parser);
54 ~WPS8Text();
55
57 void setListener(WPSContentListenerPtr &listen);
58
60 int numPages() const;
61
63 void flushExtra();
64
66 bool readStructures();
67
69 int getNumTextZones() const;
70
76 int getTextZoneType(int typeId) const;
77
79 WPSEntry getHeaderEntry() const;
80
82 WPSEntry getFooterEntry() const;
83
85 WPSEntry getTextEntry() const;
86
88 WPSEntry getEntry(int strsId) const;
89
91 void readText(WPSEntry const &entry);
92
94 void readTextInCell(int strsId, int cellId);
95
96 protected:
98 WPS8Parser &mainParser()
99 {
100 return reinterpret_cast<WPS8Parser &>(m_mainParser);
101 }
103 WPS8Parser const &mainParser() const
104 {
105 return reinterpret_cast<WPS8Parser const &>(m_mainParser);
106 }
107
108 //
109 // interface with WPS8TextStyle
110 //
112 bool readFont(long endPos, int &id, std::string &mess);
113
115 bool readParagraph(long endPos, int &id, std::string &mess);
116
117 //
118 // String+text functions
119 //
121 bool readString(RVNGInputStreamPtr input, long page_size,
122 librevenge::RVNGString &res);
124 long readUTF16LE(RVNGInputStreamPtr input, long endPos, uint16_t firstC);
125
129 bool readNotes(WPSEntry const &entry);
130
134 void createNotesCorrespondance();
135
136 //----------------------------------------
137 // PLC parsing, setting
138 //----------------------------------------
139
146 typedef bool (WPS8Text::* DataParser)
147 (long bot, long eot, int id, WPS8Struct::FileData const &data,
148 std::string &mess);
153 typedef bool (WPS8Text::* EndDataParser)
154 (long endPos, std::vector<long> const &textPtrs);
162 bool readPLC(WPSEntry const &entry,
163 std::vector<long> &textPtrs, std::vector<long> &listValues,
164 DataParser parser = &WPS8Text::defDataParser,
165 EndDataParser endParser = 0L);
167 bool defDataParser
168 (long , long , int , WPS8Struct::FileData const &data, std::string &mess);
170 bool textZonesDataParser(long bot, long eot, int nId,
171 WPS8Struct::FileData const &data,
172 std::string &mess);
173 // object
175 bool objectDataParser(long bot, long eot, int id,
176 WPS8Struct::FileData const &data, std::string &mess);
177 // field type
179 bool tokenEndDataParser(long endPage, std::vector<long> const &textPtrs);
182 bool bmktEndDataParser(long endPage, std::vector<long> const &textPtrs);
183
184 protected:
186 WPSContentListenerPtr m_listener;
188 shared_ptr<WPS8TextStyle> m_styleParser;
190 mutable shared_ptr<WPS8TextInternal::State> m_state;
191 protected:
192 };
193
194
195 #endif /* WPS8_TEXT_H */
196 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPS8Text::defDataParser
bool defDataParser(long, long, int, WPS8Struct::FileData const &data, std::string &mess)
default parser
Definition: WPS8Text.cpp:1328
WPS8Text::tokenEndDataParser
bool tokenEndDataParser(long endPage, std::vector< long > const &textPtrs)
reads a field type : TOKN zone
Definition: WPS8Text.cpp:1642
WPSContentListenerPtr
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:100
WPS8TextStyle
Definition: WPS8TextStyle.h:45
WPS8Text::DataParser
bool(WPS8Text::* DataParser)(long bot, long eot, int id, WPS8Struct::FileData const &data, std::string &mess)
definition of the plc data parser (low level)
Definition: WPS8Text.h:147
WPS8Text::mainParser
WPS8Parser const & mainParser() const
return the main parser
Definition: WPS8Text.h:103
WPS8Text::EndDataParser
bool(WPS8Text::* EndDataParser)(long endPos, std::vector< long > const &textPtrs)
definition of the last part of plc data parser (low level)
Definition: WPS8Text.h:154
WPS8Parser
This class parses Works version 2000 through 8.
Definition: WPS8.h:48
WPS8Text::readPLC
bool readPLC(WPSEntry const &entry, std::vector< long > &textPtrs, std::vector< long > &listValues, DataParser parser=&WPS8Text::defDataParser, EndDataParser endParser=0L)
reads a PLC (Pointer List Composant ?) in zone entry
Definition: WPS8Text.cpp:1965
WPS8Text::bmktEndDataParser
bool bmktEndDataParser(long endPage, std::vector< long > const &textPtrs)
reads a field type : BMKT zone
Definition: WPS8Text.cpp:1419
WPS8Text::~WPS8Text
~WPS8Text()
Definition: WPS8Text.cpp:521
WPS8Text
Definition: WPS8Text.h:47
WPS8Text::m_styleParser
shared_ptr< WPS8TextStyle > m_styleParser
the graph parser
Definition: WPS8Text.h:188
WPS8Text::m_listener
WPSContentListenerPtr m_listener
the listener
Definition: WPS8Text.h:186
WPS8Text::WPS8Text
WPS8Text(WPS8Parser &parser)
Definition: WPS8Text.cpp:514
WPS8TextInternal::SubDocument
Internal: the subdocument of a WPS8Text.
Definition: WPS8Text.cpp:430
WPS8Text::getEntry
WPSEntry getEntry(int strsId) const
returns ith zone entry (if such entry exists, if not returns an invalid entry)
Definition: WPS8Text.cpp:562
WPSTextParser.h
WPS8Text::readParagraph
bool readParagraph(long endPos, int &id, std::string &mess)
the paragraph
Definition: WPS8Text.cpp:554
WPS8Text::createNotesCorrespondance
void createNotesCorrespondance()
creates the notes association : text and notes positions
Definition: WPS8Text.cpp:1244
WPS8Text::readTextInCell
void readTextInCell(int strsId, int cellId)
reads a cell section and sends it to a listener
Definition: WPS8Text.cpp:619
libwps_internal.h
WPSTextParser::m_mainParser
WPSParser & m_mainParser
pointer to the main zone parser;
Definition: WPSTextParser.h:126
WPS8Text::getTextEntry
WPSEntry getTextEntry() const
returns the main zone entry (if such entry exists, if not returns an invalid entry) ...
Definition: WPS8Text.cpp:604
WPS8Text::readText
void readText(WPSEntry const &entry)
reads a text section and sends it to a listener
Definition: WPS8Text.cpp:636
WPS8Text::getHeaderEntry
WPSEntry getHeaderEntry() const
returns the header entry (if such entry exists, if not returns an invalid entry)
Definition: WPS8Text.cpp:568
WPS8Text::m_state
shared_ptr< WPS8TextInternal::State > m_state
the internal state
Definition: WPS8Text.h:190
WPS8Struct
namespace used to read the structures stored in a WPS8 files
Definition: WPS8Struct.cpp:30
WPS8Text::numPages
int numPages() const
returns the number of pages
Definition: WPS8Text.cpp:534
WPS8TextInternal
Definition: WPS8Text.cpp:65
WPS8Text::objectDataParser
bool objectDataParser(long bot, long eot, int id, WPS8Struct::FileData const &data, std::string &mess)
reads a EOBJ properties: an object id and its size, ...
Definition: WPS8Text.cpp:1568
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:81
WPS8Text::readNotes
bool readNotes(WPSEntry const &entry)
the footnote ( FTN or EDN )
Definition: WPS8Text.cpp:1112
WPS8Text::setListener
void setListener(WPSContentListenerPtr &listen)
sets the listener
Definition: WPS8Text.cpp:526
WPS8Text::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: WPS8Text.cpp:899
WPS8Text::readFont
bool readFont(long endPos, int &id, std::string &mess)
reads a font properties
Definition: WPS8Text.cpp:549
WPS8Text::getTextZoneType
int getTextZoneType(int typeId) const
returns the type of a text zone
Definition: WPS8Text.cpp:613
WPS8Text::textZonesDataParser
bool textZonesDataParser(long bot, long eot, int nId, WPS8Struct::FileData const &data, std::string &mess)
the text zones parser: STRS
Definition: WPS8Text.cpp:1355
WPS8Text::readUTF16LE
long readUTF16LE(RVNGInputStreamPtr input, long endPos, uint16_t firstC)
reads a utf16 character,
Definition: WPS8Text.cpp:1058
WPS8Text::getNumTextZones
int getNumTextZones() const
returns the number of different text zones
Definition: WPS8Text.cpp:609
WPS8Text::readString
bool readString(RVNGInputStreamPtr input, long page_size, librevenge::RVNGString &res)
reads a string
Definition: WPS8Text.cpp:1091
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:37
WPSTextParser
class used to defined the ancestor of parser which manages the text data
Definition: WPSTextParser.h:39
WPSDebug.h
WPS8Text::readStructures
bool readStructures()
finds all entries which correspond to the text data, parses them and stores data
Definition: WPS8Text.cpp:915
WPS8Text::getFooterEntry
WPSEntry getFooterEntry() const
returns the footer entry (if such entry exists, if not returns an invalid entry)
Definition: WPS8Text.cpp:586
WPS8Struct::FileData
A recursif structure which seems generally used to store complex memory structures in a file...
Definition: WPS8Struct.h:63
WPS8Text::mainParser
WPS8Parser & mainParser()
return the main parser
Definition: WPS8Text.h:98