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  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
4  * Copyright (C) 2006, 2007 Andrew Ziem
5  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
6  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
7  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  *
23  * For further information visit http://libwps.sourceforge.net
24  */
25 
26 /* "This product is not manufactured, approved, or supported by
27  * Corel Corporation or Corel Corporation Limited."
28  */
29 
30 #ifndef WPS4_TEXT_H
31 #define WPS4_TEXT_H
32 
33 #include <ostream>
34 #include <vector>
35 
36 #include "WPSEntry.h"
37 #include "WPSDebug.h"
38 
39 class WPS4Parser;
40 namespace WPS4TextInternal
41 {
42 struct DataFOD;
43 struct Font;
44 struct Paragraph;
45 struct State;
46 }
47 
49 typedef shared_ptr<WPS4ContentListener> WPS4ContentListenerPtr;
50 
70 class WPS4Text
71 {
72  friend class WPS4Parser;
73 
74 public:
76  WPS4Text(WPS4Parser &parser, WPXInputStreamPtr &input);
77 
79  ~WPS4Text();
80 
83  {
84  m_listener = listen;
85  }
86 
88  int numPages() const;
89 
90 
92  void flushExtra();
93 
94 protected:
96  WPSEntry getHeaderEntry() const;
97 
99  WPSEntry getFooterEntry() const;
100 
102  WPSEntry getMainTextEntry() const;
103 
105  WPSEntry getAllTextEntry() const;
106 
108  bool readText(WPSEntry const &entry);
109 
111  bool readEntries();
113  bool readStructures();
114 
115 protected:
116  //----------------------------------------
117  // FDP parsing
118  //----------------------------------------
119 
122  bool findFDPStructures(int which);
125  bool findFDPStructuresByHand(int which);
126 
127  //----------------------------------------
128  // PLC parsing, setting
129  //----------------------------------------
130 
135  typedef bool (WPS4Text::* FDPParser) (long endPos, int &id, std::string &mess);
136 
142  bool readFDP(WPSEntry const &entry,
143  std::vector<WPS4TextInternal::DataFOD> &fods, FDPParser parser);
144 
152  typedef bool (WPS4Text::* DataParser)
153  (long bot, long eot, int id, long endPos, std::string &mess);
154 
161  bool readPLC(WPSEntry const &zone,
162  std::vector<long> &textPtrs, std::vector<long> &listValues,
163  DataParser parser = 0L);
164 
166  bool defDataParser (long bot, long eot, int id, long endPos, std::string &mess);
167 
169  bool readFontNames(WPSEntry const &entry);
170 
172  bool readFont(long endPos, int &id, std::string &mess);
176  void setProperty(WPS4TextInternal::Font const &font);
177 
179  bool readParagraph(long endPos, int &id, std::string &mess);
183  void setProperty(WPS4TextInternal::Paragraph const &para);
184 
186  bool readDosLink(WPSEntry const &entry);
187 
189  bool objectDataParser (long bot, long eot, int id,
190  long endPos, std::string &mess);
191 
193  bool readFootNotes(WPSEntry const &ftnD, WPSEntry const &ftnP);
194 
196  bool footNotesDataParser (long bot, long eot, int id, long endPos, std::string &mess);
197 
199  bool bkmkDataParser (long bot, long eot, int id, long endPos, std::string &mess);
200 
202  bool dttmDataParser (long bot, long eot, int id, long endPos, std::string &mess);
203 
204 protected:
206  int version() const;
207 
210  {
211  return m_asciiFile;
212  }
213 protected:
216 
219 
222 
224  mutable shared_ptr<WPS4TextInternal::State> m_state;
225 
228 };
229 #endif
230 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */

Generated on Wed Aug 8 2012 16:07:55 for libwps by doxygen 1.8.1.2