FWText.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 FullWrite text document
36  *
37  */
38 #ifndef FW_TEXT
39 # define FW_TEXT
40 
41 #include "libmwaw_internal.hxx"
42 
43 
44 #include "MWAWDebug.hxx"
45 
47 typedef shared_ptr<MWAWInputStream> MWAWInputStreamPtr;
48 
49 class MWAWFont;
51 typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
52 
53 namespace FWTextInternal
54 {
55 struct Border;
56 struct Font;
57 struct Paragraph;
58 
59 struct LineHeader;
60 struct Zone;
61 
62 struct State;
63 }
64 
65 struct FWEntry;
66 struct FWEntryManager;
67 
68 class FWParser;
69 
75 class FWText
76 {
77  friend class FWParser;
78 public:
80  FWText(FWParser &parser);
82  virtual ~FWText();
83 
85  int version() const;
86 
88  int numPages() const;
89 
90 protected:
91 
93  void flushExtra();
94 
96  bool sendMainText();
97 
99  bool send(int zId);
100 
101  //
102  // intermediate level
103  //
104 
106  bool readTextData(shared_ptr<FWEntry> zone);
107 
109  bool send(shared_ptr<FWTextInternal::Zone> zone);
110 
112  void send(shared_ptr<FWTextInternal::Zone> zone, int numChar,
114  std::string &str);
117 
119  void prepareData() {
120  sortZones();
122  }
123 
125  void sortZones();
127  void createItemStructures();
128 
129  //
130  // low level
131  //
132 
134  void setProperty(FWTextInternal::Paragraph const &para);
135 
137  bool readLineHeader(shared_ptr<FWTextInternal::Zone> zone, FWTextInternal::LineHeader &lHeader);
138 
140  bool readItem(shared_ptr<FWEntry> zone, int id=-1, bool hidden=false);
141 
143  bool readParagraphTabs(shared_ptr<FWEntry> zone, int id=-1);
145  bool readParaModDocInfo(shared_ptr<FWEntry> zone);
146 
148  bool readBorderDocInfo(shared_ptr<FWEntry> zone);
150  bool readBorder(shared_ptr<FWEntry> zone, FWTextInternal::Border &border, int fSz);
151 
153  bool readDataMod(shared_ptr<FWEntry> zone, int id);
154 
156  bool readColumns(shared_ptr<FWEntry> zone);
157 
159  bool getColor(int color, MWAWColor &col) const;
160 
161 private:
162  FWText(FWText const &orig);
163  FWText &operator=(FWText const &orig);
164 
165 protected:
166  //
167  // data
168  //
171 
173  shared_ptr<FWTextInternal::State> m_state;
174 
177 };
178 #endif
179 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

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