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 namespace WNTextInternal
56 {
57 struct ContentZone;
58 struct ContentZones;
59 
60 struct Font;
61 struct Paragraph;
62 
63 struct TableData;
64 struct Token;
65 
66 struct Cell;
67 
68 struct State;
69 }
70 
71 struct WNEntry;
72 struct WNEntryManager;
73 
74 class WNParser;
75 
81 class WNText
82 {
83  friend class WNParser;
84  friend struct WNTextInternal::Cell;
85 public:
87  WNText(WNParser &parser);
89  virtual ~WNText();
90 
92  int version() const;
93 
95  int numPages() const;
96 
98  WNEntry getHeader() const;
99 
101  WNEntry getFooter() const;
102 
103 protected:
105  bool createZones();
106 
108  void flushExtra();
109 
112  bool parseZone(WNEntry const &entry, std::vector<WNEntry> &listData);
113 
115  shared_ptr<WNTextInternal::ContentZones> parseContent(WNEntry const &entry);
116 
120  void sendZone(int id);
121 
123  bool send(WNEntry const &entry);
124 
126  bool send(std::vector<WNTextInternal::ContentZone> &listZones,
127  std::vector<shared_ptr<WNTextInternal::ContentZones> > &footnoteList,
129 
131  void setProperty(WNTextInternal::Paragraph const &ruler);
132 
133  //
134  // low level
135  //
136 
138  bool readFontNames(WNEntry const &entry);
139 
141  bool readFont(MWAWInputStream &input, bool inStyle, WNTextInternal::Font &font);
142 
145 
147  bool readToken(MWAWInputStream &input, WNTextInternal::Token &token);
148 
151 
154 
156  bool readStyles(WNEntry const &entry);
157 
158 private:
159  WNText(WNText const &orig);
160  WNText &operator=(WNText const &orig);
161 
162 protected:
163  //
164  // data
165  //
168 
170  shared_ptr<WNTextInternal::State> m_state;
171 
173  shared_ptr<WNEntryManager> m_entryManager;
174 
177 };
178 #endif
179 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWParserStatePtr m_parserState
the parser state
Definition: WNText.hxx:167
WNText(WNParser &parser)
constructor
Definition: WNText.cxx:582
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:920
bool readToken(MWAWInputStream &input, WNTextInternal::Token &token)
read a token
Definition: WNText.cxx:1555
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:1983
shared_ptr< WNEntryManager > m_entryManager
the list of entry
Definition: WNText.hxx:173
WNEntry getFooter() const
returns the footer entry (if defined)
Definition: WNText.cxx:624
bool readParagraph(MWAWInputStream &input, WNTextInternal::Paragraph &ruler)
read a paragraph format
Definition: WNText.cxx:1255
void setProperty(WNTextInternal::Paragraph const &ruler)
sends a paragraph property to the listener
Definition: WNText.cxx:1355
Internal: the token of a WNText.
Definition: WNText.cxx:152
bool readTokenV2(MWAWInputStream &input, WNTextInternal::Token &token)
read a token (v2)
Definition: WNText.cxx:1596
bool readFontNames(WNEntry const &entry)
try to read the fonts zone
Definition: WNText.cxx:1044
bool readFont(MWAWInputStream &input, bool inStyle, WNTextInternal::Font &font)
read a font
Definition: WNText.cxx:1166
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:60
bool readStyles(WNEntry const &entry)
try to read the styles zone
Definition: WNText.cxx:1365
shared_ptr< WNTextInternal::ContentZones > parseContent(WNEntry const &entry)
parse a text data zone ( and create the associated structure )
Definition: WNText.cxx:772
Internal: the cell of a WNText.
Definition: WNText.cxx:456
Internal: class to store the paragraph properties.
Definition: WNText.cxx:90
bool createZones()
finds the different text zones
Definition: WNText.cxx:637
Internal: the table of a WNText.
Definition: WNText.cxx:195
Internal: the fonts.
Definition: WNText.cxx:62
int version() const
returns the file version
Definition: WNText.cxx:591
bool send(WNEntry const &entry)
send the text to the listener
Definition: WNText.cxx:1687
Definition: WNEntry.hxx:47
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: WNText.cxx:2020
virtual ~WNText()
destructor
Definition: WNText.cxx:588
the main class to read a WriteNow file
Definition: WNParser.hxx:68
WNEntry getHeader() const
returns the header entry (if defined)
Definition: WNText.cxx:617
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:356
shared_ptr< WNTextInternal::State > m_state
the state
Definition: WNText.hxx:170
bool readTable(MWAWInputStream &input, WNTextInternal::TableData &table)
read a table frame (checkme)
Definition: WNText.cxx:1640
WNText & operator=(WNText const &orig)
int numPages() const
returns the number of pages
Definition: WNText.cxx:598
the main class to read the text part of writenow file
Definition: WNText.hxx:81
WNParser * m_mainParser
the main parser;
Definition: WNText.hxx:176
the manager of the entries
Definition: WNEntry.hxx:93

Generated on Tue Mar 10 2015 17:32:09 for libmwaw by doxygen 1.8.5