WPS4Text.h Source File documentation

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 "libwps_internal.h"
32#include "libwps_tools_win.h"
33
34#include "WPSEntry.h"
35#include "WPSDebug.h"
36#include "WPSTextParser.h"
37
38class WPS4Parser;
39namespace WPS4TextInternal
40{
41struct Font;
42struct Paragraph;
43struct State;
44}
45
65 class WPS4Text : public WPSTextParser
66{
67 friend class WPS4Parser;
68
69public:
71 WPS4Text(WPS4Parser &parser, RVNGInputStreamPtr &input);
72
74 ~WPS4Text();
75
77 void setListener(WPSContentListenerPtr &listen)
78 {
79 m_listener = listen;
80 }
81
83 int numPages() const;
84
86 void flushExtra();
87
91 void sendObjects(int page);
92protected:
94 WPS4Parser &mainParser()
95 {
96 return reinterpret_cast<WPS4Parser &>(m_mainParser);
97 }
98
99 WPS4Parser const &mainParser() const
100 {
101 return reinterpret_cast<WPS4Parser const &>(m_mainParser);
102 }
103
105 WPS4TextInternal::Font getDefaultFont() const;
106
108 WPSEntry getHeaderEntry() const;
109
111 WPSEntry getFooterEntry() const;
112
114 WPSEntry getMainTextEntry() const;
115
117 bool readText(WPSEntry const &entry);
118
120 bool readEntries();
122 bool readStructures();
123
124protected:
125 //----------------------------------------
126 // FDP parsing
127 //----------------------------------------
128
131 bool findFDPStructures(int which);
134 bool findFDPStructuresByHand(int which);
135
136 //----------------------------------------
137 // PLC parsing, setting
138 //----------------------------------------
139
147 typedef bool (WPS4Text::* DataParser)
148 (long bot, long eot, int id, long endPos, std::string &mess);
149
156 bool readPLC(WPSEntry const &zone,
157 std::vector<long> &textPtrs, std::vector<long> &listValues,
158 DataParser parser = 0L);
159
161 bool defDataParser(long bot, long eot, int id, long endPos, std::string &mess);
162
164 bool readFontNames(WPSEntry const &entry);
165
167 bool readFont(long endPos, int &id, std::string &mess);
168
170 bool readParagraph(long endPos, int &id, std::string &mess);
171
173 bool readDosLink(WPSEntry const &entry);
174
176 bool objectDataParser(long bot, long eot, int id,
177 long endPos, std::string &mess);
178
180 bool readFootNotes(WPSEntry const &ftnD, WPSEntry const &ftnP);
181
183 bool footNotesDataParser(long bot, long eot, int id, long endPos, std::string &mess);
184
186 bool bkmkDataParser(long bot, long eot, int id, long endPos, std::string &mess);
187
189 bool dttmDataParser(long bot, long eot, int id, long endPos, std::string &mess);
190
191protected:
193 WPSContentListenerPtr m_listener;
194
196 mutable shared_ptr<WPS4TextInternal::State> m_state;
197};
198#endif
199/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSDebug.h
WPSEntry.h
WPSTextParser.h
WPS4Parser
This class parses Works version 2 through 4.
Definition WPS4.h:49
WPS4Text::readEntries
bool readEntries()
finds all text entries (TEXT, SHdr, SFtr, BTEC, BTEP, FTNp, FTNp, BKMK, FONT, CHRT)
Definition WPS4Text.cpp:944
WPS4Text::footNotesDataParser
bool footNotesDataParser(long bot, long eot, int id, long endPos, std::string &mess)
reads a book mark property ( string)
Definition WPS4Text.cpp:2154
WPS4Text::setListener
void setListener(WPSContentListenerPtr &listen)
sets the listener
Definition WPS4Text.h:77
WPS4Text::getFooterEntry
WPSEntry getFooterEntry() const
returns the footer entry (if such entry exists, if not returns an invalid entry)
Definition WPS4Text.cpp:542
WPS4Text::sendObjects
void sendObjects(int page)
send all the objects with page anchor corresponding given page
Definition WPS4Text.cpp:512
WPS4Text::readFontNames
bool readFontNames(WPSEntry const &entry)
reads the font names
Definition WPS4Text.cpp:1332
WPS4Text::readDosLink
bool readDosLink(WPSEntry const &entry)
reads the ZZDLink ( a list of filename )
Definition WPS4Text.cpp:1548
WPS4Text::getDefaultFont
WPS4TextInternal::Font getDefaultFont() const
returns the default font to use for the document
Definition WPS4Text.cpp:560
WPS4Text::mainParser
WPS4Parser & mainParser()
return the main parser
Definition WPS4Text.h:94
WPS4Text::bkmkDataParser
bool bkmkDataParser(long bot, long eot, int id, long endPos, std::string &mess)
reads a book mark property ( string)
Definition WPS4Text.cpp:2204
WPS4Text::mainParser
WPS4Parser const & mainParser() const
return the main parser
Definition WPS4Text.h:99
WPS4Text::getMainTextEntry
WPSEntry getMainTextEntry() const
returns the main text entry (if such entry exists, if not returns an invalid entry)
Definition WPS4Text.cpp:555
WPS4Text::~WPS4Text
~WPS4Text()
destructor
Definition WPS4Text.cpp:484
WPS4Text::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition WPS4Text.cpp:568
WPS4Text::getHeaderEntry
WPSEntry getHeaderEntry() const
returns the header entry (if such entry exists, if not returns an invalid entry)
Definition WPS4Text.cpp:529
WPS4Text::readFont
bool readFont(long endPos, int &id, std::string &mess)
reads a font properties
Definition WPS4Text.cpp:1406
WPS4Text::m_listener
WPSContentListenerPtr m_listener
the listener
Definition WPS4Text.h:193
WPS4Text::readParagraph
bool readParagraph(long endPos, int &id, std::string &mess)
reads a paragraph properties
Definition WPS4Text.cpp:1636
WPS4Text::objectDataParser
bool objectDataParser(long bot, long eot, int id, long endPos, std::string &mess)
reads a object properties ( position in text, size and definition in file)
Definition WPS4Text.cpp:2240
WPS4Text::findFDPStructures
bool findFDPStructures(int which)
Definition WPS4Text.cpp:1181
WPS4Text::defDataParser
bool defDataParser(long bot, long eot, int id, long endPos, std::string &mess)
default plc reader
Definition WPS4Text.cpp:1297
WPS4Text::readPLC
bool readPLC(WPSEntry const &zone, std::vector< long > &textPtrs, std::vector< long > &listValues, DataParser parser=0L)
reads a PLC (Pointer List Composant ?) in zone entry
Definition WPS4Text.cpp:2447
WPS4Text::dttmDataParser
bool dttmDataParser(long bot, long eot, int id, long endPos, std::string &mess)
reads a date time property
Definition WPS4Text.cpp:2327
WPS4Text::WPS4Text
WPS4Text(WPS4Parser &parser, RVNGInputStreamPtr &input)
contructor
Definition WPS4Text.cpp:478
WPS4Text::DataParser
bool(WPS4Text::* DataParser)(long bot, long eot, int id, long endPos, std::string &mess)
definition of the plc data parser (low level)
Definition WPS4Text.h:148
WPS4Text::findFDPStructuresByHand
bool findFDPStructuresByHand(int which)
Definition WPS4Text.cpp:1217
WPS4Text::WPS4Parser
friend class WPS4Parser
Definition WPS4Text.h:67
WPS4Text::numPages
int numPages() const
returns the number of pages
Definition WPS4Text.cpp:489
WPS4Text::m_state
shared_ptr< WPS4TextInternal::State > m_state
the internal state
Definition WPS4Text.h:196
WPS4Text::readStructures
bool readStructures()
parsed all the text entries
Definition WPS4Text.cpp:1064
WPS4Text::readText
bool readText(WPSEntry const &entry)
reads a text section and sends it to a listener
Definition WPS4Text.cpp:589
WPS4Text::readFootNotes
bool readFootNotes(WPSEntry const &ftnD, WPSEntry const &ftnP)
reads the footnotes positions and definitions ( zones FTNd and FTNp)
Definition WPS4Text.cpp:2069
WPSEntry
basic class to store an entry in a file This contained :
Definition WPSEntry.h:39
WPSTextParser::WPSTextParser
WPSTextParser(WPSParser &parser, RVNGInputStreamPtr &input)
constructor
Definition WPSTextParser.cpp:38
WPSTextParser::m_mainParser
WPSParser & m_mainParser
pointer to the main zone parser;
Definition WPSTextParser.h:126
libwps_internal.h
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition libwps_internal.h:88
WPSContentListenerPtr
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition libwps_internal.h:108
libwps_tools_win.h
WPS4TextInternal
Definition WPS4Text.cpp:83
WPS4TextInternal::Font
Internal: class to store font properties.
Definition WPS4Text.cpp:143
WPS4TextInternal::Paragraph
Internal: class to store paragraph properties.
Definition WPS4Text.cpp:193
WPS4TextInternal::State
Internal: the state of a WPS4Text.
Definition WPS4Text.cpp:426