WNText.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 /*
35  * Parser to WriteNow text document
36  *
37  */
38 #ifndef WN_TEXT
39 # define WN_TEXT
40 
41 #include <list>
42 #include <string>
43 #include <vector>
44 
45 #include "libmwaw_internal.hxx"
46 
47 #include "MWAWEntry.hxx"
48 #include "MWAWSubDocument.hxx"
49 
50 #include "MWAWDebug.hxx"
51 #include "MWAWInputStream.hxx"
52 
53 #include "MWAWParser.hxx"
54 
55 class MWAWFont;
57 typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
58 
59 namespace WNTextInternal
60 {
61 struct ContentZone;
62 struct ContentZones;
63 
64 struct Font;
65 struct Paragraph;
66 
67 struct TableData;
68 struct Token;
69 
70 struct Cell;
71 
72 struct State;
73 }
74 
75 struct WNEntry;
76 struct WNEntryManager;
77 
78 class WNParser;
79 
85 class WNText
86 {
87  friend class WNParser;
88  friend struct WNTextInternal::Cell;
89 public:
91  WNText(WNParser &parser);
93  virtual ~WNText();
94 
96  int version() const;
97 
99  int numPages() const;
100 
102  WNEntry getHeader() const;
103 
105  WNEntry getFooter() const;
106 
107 protected:
109  bool createZones();
110 
112  void flushExtra();
113 
116  bool parseZone(WNEntry const &entry, std::vector<WNEntry> &listData);
117 
119  shared_ptr<WNTextInternal::ContentZones> parseContent(WNEntry const &entry);
120 
124  void sendZone(int id);
125 
127  bool send(WNEntry const &entry);
128 
130  bool send(std::vector<WNTextInternal::ContentZone> &listZones,
131  std::vector<shared_ptr<WNTextInternal::ContentZones> > &footnoteList,
133 
135  void setProperty(WNTextInternal::Paragraph const &ruler);
136 
137  //
138  // low level
139  //
140 
142  bool readFontNames(WNEntry const &entry);
143 
145  bool readFont(MWAWInputStream &input, bool inStyle, WNTextInternal::Font &font);
146 
149 
151  bool readToken(MWAWInputStream &input, WNTextInternal::Token &token);
152 
155 
158 
160  bool readStyles(WNEntry const &entry);
161 
162 private:
163  WNText(WNText const &orig);
164  WNText &operator=(WNText const &orig);
165 
166 protected:
167  //
168  // data
169  //
172 
174  shared_ptr<WNTextInternal::State> m_state;
175 
177  shared_ptr<WNEntryManager> m_entryManager;
178 
181 };
182 #endif
183 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWParserStatePtr m_parserState
the parser state
Definition: WNText.hxx:171
WNText(WNParser &parser)
constructor
Definition: WNText.cxx:550
bool parseZone(WNEntry const &entry, std::vector< WNEntry > &listData)
try to read the text zone ( list of entries ) and to create the text data zone
Definition: WNText.cxx:888
shared_ptr< MWAWParserState > MWAWParserStatePtr
Definition: ACText.hxx:49
bool readToken(MWAWInputStream &input, WNTextInternal::Token &token)
read a token
Definition: WNText.cxx:1523
void sendZone(int id)
send all the content zone of a zone defined by id 0: main, 1 header/footer, 2: footnote ...
Definition: WNText.cxx:1954
shared_ptr< WNEntryManager > m_entryManager
the list of entry
Definition: WNText.hxx:177
WNEntry getFooter() const
returns the footer entry (if defined)
Definition: WNText.cxx:592
bool readParagraph(MWAWInputStream &input, WNTextInternal::Paragraph &ruler)
read a paragraph format
Definition: WNText.cxx:1223
void setProperty(WNTextInternal::Paragraph const &ruler)
sends a paragraph property to the listener
Definition: WNText.cxx:1323
Internal: the token of a WNText.
Definition: WNText.cxx:153
bool readTokenV2(MWAWInputStream &input, WNTextInternal::Token &token)
read a token (v2)
Definition: WNText.cxx:1564
bool readFontNames(WNEntry const &entry)
try to read the fonts zone
Definition: WNText.cxx:1012
bool readFont(MWAWInputStream &input, bool inStyle, WNTextInternal::Font &font)
read a font
Definition: WNText.cxx:1134
Internal class used to read the file stream Internal class used to read the file stream, this class adds some usefull functions to the basic WPXInputStream:
Definition: MWAWInputStream.hxx:59
Class to store font.
Definition: MWAWFont.hxx:47
a class to define the parser state
Definition: MWAWParser.hxx:60
bool readStyles(WNEntry const &entry)
try to read the styles zone
Definition: WNText.cxx:1333
shared_ptr< WNTextInternal::ContentZones > parseContent(WNEntry const &entry)
parse a text data zone ( and create the associated structure )
Definition: WNText.cxx:740
Internal: the cell of a WNText.
Definition: WNText.cxx:402
Internal: class to store the paragraph properties.
Definition: WNText.cxx:90
bool createZones()
finds the different text zones
Definition: WNText.cxx:605
Internal: the table of a WNText.
Definition: WNText.cxx:196
Internal: the fonts.
Definition: WNText.cxx:62
int version() const
returns the file version
Definition: WNText.cxx:559
bool send(WNEntry const &entry)
send the text to the listener
Definition: WNText.cxx:1655
Definition: WNEntry.hxx:47
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: WNText.cxx:1991
virtual ~WNText()
destructor
Definition: WNText.cxx:556
the main class to read a WriteNow file
Definition: WNParser.hxx:68
WNEntry getHeader() const
returns the header entry (if defined)
Definition: WNText.cxx:585
shared_ptr< WNTextInternal::State > m_state
the state
Definition: WNText.hxx:174
bool readTable(MWAWInputStream &input, WNTextInternal::TableData &table)
read a table frame (checkme)
Definition: WNText.cxx:1608
WNText & operator=(WNText const &orig)
int numPages() const
returns the number of pages
Definition: WNText.cxx:566
the main class to read the text part of writenow file
Definition: WNText.hxx:85
WNParser * m_mainParser
the main parser;
Definition: WNText.hxx:180
the manager of the entries
Definition: WNEntry.hxx:93

Generated for libmwaw by doxygen 1.8.5