FullWrtText.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 FULL_WRT_TEXT
39 # define FULL_WRT_TEXT
40
41 #include "libmwaw_internal.hxx"
42
43
44 #include "MWAWDebug.hxx"
45
46 #include "FullWrtStruct.hxx"
47
48 namespace FullWrtTextInternal
49 {
50 struct Font;
51 struct Paragraph;
52
53 struct LineHeader;
54 struct Zone;
55
56 struct State;
57 }
58
59 class FullWrtParser;
60
66 class FullWrtText
67 {
68 friend class FullWrtParser;
69 public:
71 explicit FullWrtText(FullWrtParser &parser);
73 virtual ~FullWrtText();
74
76 int version() const;
77
79 int numPages() const;
80
81 protected:
82
84 void flushExtra();
85
87 bool sendMainText();
89 int getHeaderFooterId(bool header, int page, int &numSimillar) const;
90
92 bool send(int zId, MWAWColor fontColor=MWAWColor::black());
93
94 //
95 // intermediate level
96 //
97
99 bool readTextData(FullWrtStruct::EntryPtr zone);
100
102 bool send(std::shared_ptr<FullWrtTextInternal::Zone> zone, MWAWColor fontColor=MWAWColor::black());
103
105 void send(std::shared_ptr<FullWrtTextInternal::Zone> zone, int numChar,
106 FullWrtTextInternal::Font &font, FullWrtTextInternal::Paragraph &ruler,
107 std::string &str);
108
110 bool sendTable(std::shared_ptr<FullWrtTextInternal::Zone> zone,
111 FullWrtTextInternal::LineHeader const &lHeader,
112 FullWrtTextInternal::Font &font, FullWrtTextInternal::Paragraph &ruler,
113 std::string &str);
115 bool sendHiddenItem(int id, FullWrtTextInternal::Font &font, FullWrtTextInternal::Paragraph &ruler);
116
118 void prepareData()
119 {
120 sortZones();
121 createItemStructures();
122 }
123
125 void sortZones();
127 void createItemStructures();
128
129 //
130 // low level
131 //
132
134 bool readLineHeader(std::shared_ptr<FullWrtTextInternal::Zone> zone, FullWrtTextInternal::LineHeader &lHeader);
135
137 bool readItem(FullWrtStruct::EntryPtr zone, int id=-1, bool hidden=false);
138
140 bool readParagraphTabs(FullWrtStruct::EntryPtr zone, int id=-1);
142 bool readParaModDocInfo(FullWrtStruct::EntryPtr zone);
143
145 bool readStyle(FullWrtStruct::EntryPtr zone);
146
148 bool readDataMod(FullWrtStruct::EntryPtr zone, int id);
149
151 bool readColumns(FullWrtStruct::EntryPtr zone);
152
153 private:
154 FullWrtText(FullWrtText const &orig) = delete;
155 FullWrtText &operator=(FullWrtText const &orig) = delete;
156
157 protected:
158 //
159 // data
160 //
162 MWAWParserStatePtr m_parserState;
163
165 std::shared_ptr<FullWrtTextInternal::State> m_state;
166
168 FullWrtParser *m_mainParser;
169 };
170 #endif
171 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:553
FullWrtParser
the main class to read a FullWrite file
Definition: FullWrtParser.hxx:66
libmwaw_internal.hxx
FullWrtParser::FullWrtText
friend class FullWrtText
Definition: FullWrtParser.hxx:69
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
FullWrtText::m_mainParser
FullWrtParser * m_mainParser
the main parser;
Definition: FullWrtText.hxx:168
FullWrtText::prepareData
void prepareData()
prepare the different data (called sortZones and createItemStructures)
Definition: FullWrtText.hxx:118
FullWrtParser::send
bool send(int fileId, MWAWColor fontColor=MWAWColor::black())
ask the text parser to send a zone
Definition: FullWrtParser.cxx:387
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
FullWrtText::m_state
std::shared_ptr< FullWrtTextInternal::State > m_state
the state
Definition: FullWrtText.hxx:165
MWAWParser::version
int version() const
returns the works version
Definition: MWAWParser.hxx:108
MWAWParser::operator=
MWAWParser & operator=(const MWAWParser &)=delete
private operator=: forbidden
FullWrtTextInternal::Font
Internal: class to store a font and it state.
Definition: FullWrtText.cxx:210
MWAWDebug.hxx
FullWrtText
the main class to read the text part of writenow file
Definition: FullWrtText.hxx:66
FullWrtTextInternal::LineHeader
Internal: class to store the LineHeader.
Definition: FullWrtText.cxx:267
FullWrtStruct::EntryPtr
std::shared_ptr< Entry > EntryPtr
Definition: FullWrtStruct.hxx:153
FullWrtTextInternal::Paragraph
Internal: class to store the paragraph properties.
Definition: FullWrtText.cxx:476
FullWrtText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: FullWrtText.hxx:162
FullWrtTextInternal
Internal: the structures of a FullWrtText.
Definition: FullWrtText.cxx:59
FullWrtStruct.hxx