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);
115 
117  bool sendTable(shared_ptr<FWTextInternal::Zone> zone,
118  FWTextInternal::LineHeader const &lHeader,
120  std::string &str);
123 
125  void prepareData() {
126  sortZones();
128  }
129 
131  void sortZones();
133  void createItemStructures();
134 
135  //
136  // low level
137  //
138 
140  bool readLineHeader(shared_ptr<FWTextInternal::Zone> zone, FWTextInternal::LineHeader &lHeader);
141 
143  bool readItem(shared_ptr<FWEntry> zone, int id=-1, bool hidden=false);
144 
146  bool readParagraphTabs(shared_ptr<FWEntry> zone, int id=-1);
148  bool readParaModDocInfo(shared_ptr<FWEntry> zone);
149 
151  bool readBorderDocInfo(shared_ptr<FWEntry> zone);
153  bool readBorder(shared_ptr<FWEntry> zone, FWTextInternal::Border &border, int fSz);
154 
156  bool readDataMod(shared_ptr<FWEntry> zone, int id);
157 
159  bool readColumns(shared_ptr<FWEntry> zone);
160 
162  bool getColor(int color, MWAWColor &col) const;
163 
164 private:
165  FWText(FWText const &orig);
166  FWText &operator=(FWText const &orig);
167 
168 protected:
169  //
170  // data
171  //
174 
176  shared_ptr<FWTextInternal::State> m_state;
177 
180 };
181 #endif
182 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Internal: class to store a border which appear in docInfo.
Definition: FWText.cxx:58
bool readBorder(shared_ptr< FWEntry > zone, FWTextInternal::Border &border, int fSz)
try to read a border definiton
Definition: FWText.cxx:2391
bool sendTable(shared_ptr< FWTextInternal::Zone > zone, FWTextInternal::LineHeader const &lHeader, FWTextInternal::Font &font, FWTextInternal::Paragraph &ruler, std::string &str)
try send a table row
Definition: FWText.cxx:1234
bool readDataMod(shared_ptr< FWEntry > zone, int id)
try to read the font/paragraph modifier zone (Zone1f)
Definition: FWText.cxx:2237
bool readParagraphTabs(shared_ptr< FWEntry > zone, int id=-1)
check if the input of the zone points to a paragraph zone in DataStruct Zone
Definition: FWText.cxx:2077
the main class to read a FullWrite file
Definition: FWParser.hxx:108
shared_ptr< MWAWParserState > MWAWParserStatePtr
Definition: ACText.hxx:49
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
Definition: ACText.hxx:44
bool readBorderDocInfo(shared_ptr< FWEntry > zone)
try to read the border definiton (at the end of doc info)
Definition: FWText.cxx:2341
void createItemStructures()
create the item structures
Definition: FWText.cxx:2590
bool sendHiddenItem(int id, FWTextInternal::Font &font, FWTextInternal::Paragraph &ruler)
send a hidden item
Definition: FWText.cxx:1576
void prepareData()
prepare the different data (called sortZones and createItemStructures)
Definition: FWText.hxx:125
bool readColumns(shared_ptr< FWEntry > zone)
check if the input of the zone points to the columns definition, ...
Definition: FWText.cxx:2455
shared_ptr< FWTextInternal::State > m_state
the state
Definition: FWText.hxx:176
int version() const
returns the file version
Definition: FWText.cxx:721
bool readTextData(shared_ptr< FWEntry > zone)
check if a zone is a text zone, if so read it...
Definition: FWText.cxx:1664
the class to store a color
Definition: libmwaw_internal.hxx:161
FWParser * m_mainParser
the main parser;
Definition: FWText.hxx:179
Internal: class to store the paragraph properties.
Definition: FWText.cxx:516
bool readParaModDocInfo(shared_ptr< FWEntry > zone)
try to read the paragraph modifier (at the end of doc info)
Definition: FWText.cxx:2273
bool sendMainText()
send a main zone
Definition: FWText.cxx:2503
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
bool readItem(shared_ptr< FWEntry > zone, int id=-1, bool hidden=false)
check if the input of the zone points to a item zone in DataStruct Zone
Definition: FWText.cxx:1954
FWText(FWParser &parser)
constructor
Definition: FWText.cxx:712
Class to store font.
Definition: MWAWFont.hxx:47
a class to define the parser state
Definition: MWAWParser.hxx:60
int numPages() const
returns the number of pages
Definition: FWText.cxx:728
void sortZones()
sort the different zones, finding the main zone, ...
Definition: FWText.cxx:2547
FWText & operator=(FWText const &orig)
the definition of a zone in the file
Definition: FWParser.hxx:54
the main class to read the text part of writenow file
Definition: FWText.hxx:75
Internal: class to store the LineHeader.
Definition: FWText.cxx:336
MWAWParserStatePtr m_parserState
the parser state
Definition: FWText.hxx:173
virtual ~FWText()
destructor
Definition: FWText.cxx:718
bool send(int zId)
send a id zone
Definition: FWText.cxx:2524
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: FWText.cxx:2536
bool readLineHeader(shared_ptr< FWTextInternal::Zone > zone, FWTextInternal::LineHeader &lHeader)
try to read the header of a line
Definition: FWText.cxx:1319
Internal: class to store a font and it state.
Definition: FWText.cxx:286
bool getColor(int color, MWAWColor &col) const
try to convert a file data to a color
Definition: FWText.cxx:733

Generated for libmwaw by doxygen 1.8.5