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 
46 #include "FWStruct.hxx"
47 
48 namespace FWTextInternal
49 {
50 struct Font;
51 struct Paragraph;
52 
53 struct LineHeader;
54 struct Zone;
55 
56 struct State;
57 }
58 
59 class FWParser;
60 
66 class FWText
67 {
68  friend class FWParser;
69 public:
71  FWText(FWParser &parser);
73  virtual ~FWText();
74 
76  int version() const;
77 
79  int numPages() const;
80 
81 protected:
82 
84  void flushExtra();
85 
87  bool sendMainText();
88 
90  bool send(int zId);
91 
92  //
93  // intermediate level
94  //
95 
98 
100  bool send(shared_ptr<FWTextInternal::Zone> zone);
101 
103  void send(shared_ptr<FWTextInternal::Zone> zone, int numChar,
105  std::string &str);
106 
108  bool sendTable(shared_ptr<FWTextInternal::Zone> zone,
109  FWTextInternal::LineHeader const &lHeader,
111  std::string &str);
114 
116  void prepareData() {
117  sortZones();
119  }
120 
122  void sortZones();
124  void createItemStructures();
125 
126  //
127  // low level
128  //
129 
131  bool readLineHeader(shared_ptr<FWTextInternal::Zone> zone, FWTextInternal::LineHeader &lHeader);
132 
134  bool readItem(FWStruct::EntryPtr zone, int id=-1, bool hidden=false);
135 
137  bool readParagraphTabs(FWStruct::EntryPtr zone, int id=-1);
140 
142  bool readStyle(FWStruct::EntryPtr zone);
143 
145  bool readDataMod(FWStruct::EntryPtr zone, int id);
146 
148  bool readColumns(FWStruct::EntryPtr zone);
149 
150 private:
151  FWText(FWText const &orig);
152  FWText &operator=(FWText const &orig);
153 
154 protected:
155  //
156  // data
157  //
160 
162  shared_ptr<FWTextInternal::State> m_state;
163 
166 };
167 #endif
168 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool readStyle(FWStruct::EntryPtr zone)
try to read a style
Definition: FWText.cxx:1956
bool readItem(FWStruct::EntryPtr 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:1833
shared_ptr< Entry > EntryPtr
Definition: FWStruct.hxx:135
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:1115
the main class to read a FullWrite file
Definition: FWParser.hxx:66
bool readParaModDocInfo(FWStruct::EntryPtr zone)
try to read the paragraph modifier (at the end of doc info)
Definition: FWText.cxx:2216
void createItemStructures()
create the item structures
Definition: FWText.cxx:2419
bool sendHiddenItem(int id, FWTextInternal::Font &font, FWTextInternal::Paragraph &ruler)
send a hidden item
Definition: FWText.cxx:1452
void prepareData()
prepare the different data (called sortZones and createItemStructures)
Definition: FWText.hxx:116
shared_ptr< FWTextInternal::State > m_state
the state
Definition: FWText.hxx:162
int version() const
returns the file version
Definition: FWText.cxx:621
FWParser * m_mainParser
the main parser;
Definition: FWText.hxx:165
Internal: class to store the paragraph properties.
Definition: FWText.cxx:415
bool sendMainText()
send a main zone
Definition: FWText.cxx:2332
FWText(FWParser &parser)
constructor
Definition: FWText.cxx:612
bool readTextData(FWStruct::EntryPtr zone)
check if a zone is a text zone, if so read it...
Definition: FWText.cxx:1539
int numPages() const
returns the number of pages
Definition: FWText.cxx:628
void sortZones()
sort the different zones, finding the main zone, ...
Definition: FWText.cxx:2376
FWText & operator=(FWText const &orig)
the main class to read the text part of writenow file
Definition: FWText.hxx:66
Internal: class to store the LineHeader.
Definition: FWText.cxx:235
MWAWParserStatePtr m_parserState
the parser state
Definition: FWText.hxx:159
virtual ~FWText()
destructor
Definition: FWText.cxx:618
bool send(int zId)
send a id zone
Definition: FWText.cxx:2353
bool readDataMod(FWStruct::EntryPtr zone, int id)
try to read the font/paragraph modifier zone (Zone1f)
Definition: FWText.cxx:2180
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: FWText.cxx:2365
bool readLineHeader(shared_ptr< FWTextInternal::Zone > zone, FWTextInternal::LineHeader &lHeader)
try to read the header of a line
Definition: FWText.cxx:1216
bool readColumns(FWStruct::EntryPtr zone)
check if the input of the zone points to the columns definition, ...
Definition: FWText.cxx:2285
Internal: class to store a font and it state.
Definition: FWText.cxx:185
bool readParagraphTabs(FWStruct::EntryPtr zone, int id=-1)
check if the input of the zone points to a paragraph zone in DataStruct Zone
Definition: FWText.cxx:2008

Generated on Wed Jun 11 2014 01:30:57 for libmwaw by doxygen 1.8.5