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:

Generated on Sat May 4 2013 20:11:09 for libmwaw by doxygen 1.8.3.1