- 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 class WPSEntry;
34 class WPSPosition;
35
36 typedef class WPSContentListener WPS8ContentListener;
37 typedef shared_ptr<WPS8ContentListener> WPS8ContentListenerPtr;
38
39 namespace WPS8Struct
40 {
41 struct FileData;
42 }
43
44 namespace WPS8TextInternal
45 {
46 struct State;
47 class SubDocument;
48 }
49
50 class WPS8Parser;
51 class WPS8TextStyle;
52
53 class WPS8Text : public WPSTextParser
54 {
55 friend class WPS8TextInternal::SubDocument;
56 friend class WPS8Parser;
57 friend class WPS8TextStyle;
58 public:
59 WPS8Text(WPS8Parser &parser);
60 ~WPS8Text();
61
63 void setListener(WPS8ContentListenerPtr &listen);
64
66 int numPages() const;
67
69 void flushExtra();
70
72 bool readStructures();
73
75 int getNumTextZones() const;
76
82 int getTextZoneType(int typeId) const;
83
85 WPSEntry getHeaderEntry() const;
86
88 WPSEntry getFooterEntry() const;
89
91 WPSEntry getTextEntry() const;
92
94 WPSEntry getEntry(int strsId) const;
95
97 void readText(WPSEntry const &entry);
98
100 void readTextInCell(int strsId, int cellId);
101
102 protected:
104 WPS8Parser &mainParser()
105 {
106 return reinterpret_cast<WPS8Parser &> (m_mainParser);
107 }
109 WPS8Parser const &mainParser() const
110 {
111 return reinterpret_cast<WPS8Parser const &> (m_mainParser);
112 }
113
114 //
115 // interface with WPS8TextStyle
116 //
118 bool readFont(long endPos, int &id, std::string &mess);
119
121 bool readParagraph(long endPos, int &id, std::string &mess);
122
123 //
124 // String+text functions
125 //
127 bool readString(WPXInputStreamPtr input, long page_size,
128 WPXString &res);
130 long readUTF16LE(WPXInputStreamPtr input, long endPos, uint16_t firstC);
131
135 bool readNotes(WPSEntry const &entry);
136
140 void createNotesCorrespondance();
141
142 //----------------------------------------
143 // PLC parsing, setting
144 //----------------------------------------
145
152 typedef bool (WPS8Text::* DataParser)
153 (long bot, long eot, int id, WPS8Struct::FileData const &data,
154 std::string &mess);
159 typedef bool (WPS8Text::* EndDataParser)
160 (long endPos, std::vector<long> const &textPtrs);
168 bool readPLC(WPSEntry const &entry,
169 std::vector<long> &textPtrs, std::vector<long> &listValues,
170 DataParser parser = &WPS8Text::defDataParser,
171 EndDataParser endParser = 0L);
173 bool defDataParser
174 (long , long , int , WPS8Struct::FileData const &data, std::string &mess);
176 bool textZonesDataParser(long bot, long eot, int nId,
177 WPS8Struct::FileData const &data,
178 std::string &mess);
179 // object
181 bool objectDataParser(long bot, long eot, int id,
182 WPS8Struct::FileData const &data, std::string &mess);
183 // field type
185 bool tokenEndDataParser(long endPage, std::vector<long> const &textPtrs);
188 bool bmktEndDataParser(long endPage, std::vector<long> const &textPtrs);
189
190 protected:
192 WPS8ContentListenerPtr m_listener;
194 shared_ptr<WPS8TextStyle> m_styleParser;
196 mutable shared_ptr<WPS8TextInternal::State> m_state;
197 protected:
198 };
199
200
201 #endif /* WPS8_TEXT_H */
202 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */