- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WPS4Text.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) 2009, 2011 Alonso Laurent (alonso@loria.fr)
11 * Copyright (C) 2006, 2007 Andrew Ziem
12 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
14 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
15 *
16 * For minor contributions see the git repository.
17 *
18 * Alternatively, the contents of this file may be used under the terms
19 * of the GNU Lesser General Public License Version 2.1 or later
20 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
21 * applicable instead of those above.
22 *
23 * For further information visit http://libwps.sourceforge.net
24 */
25
26 #ifndef WPS4_TEXT_H
27 #define WPS4_TEXT_H
28
29 #include <vector>
30
31 #include "WPSEntry.h"
32 #include "WPSDebug.h"
33 #include "WPSTextParser.h"
34
35 class WPS4Parser;
36 namespace WPS4TextInternal
37 {
38 struct Font;
39 struct Paragraph;
40 struct State;
41 }
42
43 typedef class WPSContentListener WPS4ContentListener;
44 typedef shared_ptr<WPS4ContentListener> WPS4ContentListenerPtr;
45
65 class WPS4Text : public WPSTextParser
66 {
67 friend class WPS4Parser;
68
69 public:
71 WPS4Text(WPS4Parser &parser, WPXInputStreamPtr &input);
72
74 ~WPS4Text();
75
77 void setListener(WPS4ContentListenerPtr &listen)
78 {
79 m_listener = listen;
80 }
81
83 int numPages() const;
84
86 void flushExtra();
87
88 protected:
90 WPS4Parser &mainParser()
91 {
92 return reinterpret_cast<WPS4Parser &> (m_mainParser);
93 }
95 WPS4Parser const &mainParser() const
96 {
97 return reinterpret_cast<WPS4Parser const &> (m_mainParser);
98 }
99
101 WPSEntry getHeaderEntry() const;
102
104 WPSEntry getFooterEntry() const;
105
107 WPSEntry getMainTextEntry() const;
108
110 WPSEntry getAllTextEntry() const;
111
113 bool readText(WPSEntry const &entry);
114
116 bool readEntries();
118 bool readStructures();
119
120 protected:
121 //----------------------------------------
122 // FDP parsing
123 //----------------------------------------
124
127 bool findFDPStructures(int which);
130 bool findFDPStructuresByHand(int which);
131
132 //----------------------------------------
133 // PLC parsing, setting
134 //----------------------------------------
135
143 typedef bool (WPS4Text::* DataParser)
144 (long bot, long eot, int id, long endPos, std::string &mess);
145
152 bool readPLC(WPSEntry const &zone,
153 std::vector<long> &textPtrs, std::vector<long> &listValues,
154 DataParser parser = 0L);
155
157 bool defDataParser (long bot, long eot, int id, long endPos, std::string &mess);
158
160 bool readFontNames(WPSEntry const &entry);
161
163 bool readFont(long endPos, int &id, std::string &mess);
167 void setProperty(WPS4TextInternal::Font const &font);
168
170 bool readParagraph(long endPos, int &id, std::string &mess);
174 void setProperty(WPS4TextInternal::Paragraph const &para);
175
177 bool readDosLink(WPSEntry const &entry);
178
180 bool objectDataParser (long bot, long eot, int id,
181 long endPos, std::string &mess);
182
184 bool readFootNotes(WPSEntry const &ftnD, WPSEntry const &ftnP);
185
187 bool footNotesDataParser (long bot, long eot, int id, long endPos, std::string &mess);
188
190 bool bkmkDataParser (long bot, long eot, int id, long endPos, std::string &mess);
191
193 bool dttmDataParser (long bot, long eot, int id, long endPos, std::string &mess);
194
195 protected:
197 WPS4ContentListenerPtr m_listener;
198
200 mutable shared_ptr<WPS4TextInternal::State> m_state;
201 };
202 #endif
203 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */