ClarisWksDocument.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

ClarisWksDocument.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 * Document data used by the Claris Works parser
36 *
37 */
38 #ifndef CLARIS_WKS_DOCUMENT
39 # define CLARIS_WKS_DOCUMENT
40
41 #include <vector>
42
43 #include "libmwaw_internal.hxx"
44
45 #include "MWAWParser.hxx"
46 #include "MWAWPosition.hxx"
47
48 #include "ClarisWksStruct.hxx"
49
50 class MWAWSection;
51
52 namespace ClarisWksDocumentInternal
53 {
54 class SubDocument;
55
56 struct State;
57 }
58
59 class ClarisWksParser;
60 class ClarisWksBMParser;
61 class ClarisWksPRParser;
62 class ClarisWksSSParser;
63
64 class ClarisWksDatabase;
65 class ClarisWksGraph;
66 class ClarisWksStyleManager;
67 class ClarisWksPresentation;
68 class ClarisWksSpreadsheet;
69 class ClarisWksTable;
70 class ClarisWksText;
71
73 class ClarisWksDocument
74 {
75 public:
76 friend class ClarisWksParser;
77 friend class ClarisWksBMParser;
78 friend class ClarisWksPRParser;
79 friend class ClarisWksSSParser;
80 friend class ClarisWksDocumentInternal::SubDocument;
82 explicit ClarisWksDocument(MWAWParser &parser);
84 ~ClarisWksDocument();
85
87 bool checkHeader(MWAWHeader *header, bool strict=false);
88
90 bool createZones();
91
93 int numPages() const;
95 MWAWVec2i getDocumentPages();
97 librevenge::RVNGPropertyList const &getDocumentMetaData() const;
99 double getTextHeight() const;
101 MWAWVec2f getPageLeftTop() const;
103 void updatePageSpanList(std::vector<MWAWPageSpan> &spanList);
105 void updatePageSpanList(std::vector<MWAWPageSpan> &spanList, MWAWPageSpan &master);
106
108 MWAWSection getMainSection() const;
110 shared_ptr<ClarisWksStruct::DSET> getZone(int zId) const;
112 void updateChildPositions();
114 void newPage(int page, bool softBreak=false);
116 std::vector<int> const &getMainZonesList() const;
118 void forceParsed(int zoneId);
120 bool canSendZoneAsGraphic(int number) const;
122 bool sendZone(int zoneId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition());
124 void sendFootnote(int zoneId);
125
127 MWAWParser &getMainParser()
128 {
129 return *m_parser;
130 }
132 shared_ptr<ClarisWksStyleManager> getStyleManager()
133 {
134 return m_styleManager;
135 }
137 shared_ptr<ClarisWksDatabase> getDatabaseParser()
138 {
139 return m_databaseParser;
140 }
142 shared_ptr<ClarisWksGraph> getGraphParser()
143 {
144 return m_graphParser;
145 }
147 shared_ptr<ClarisWksPresentation> getPresentationParser()
148 {
149 return m_presentationParser;
150 }
152 shared_ptr<ClarisWksSpreadsheet> getSpreadsheetParser()
153 {
154 return m_spreadsheetParser;
155 }
157 shared_ptr<ClarisWksTable> getTableParser()
158 {
159 return m_tableParser;
160 }
162 shared_ptr<ClarisWksText> getTextParser()
163 {
164 return m_textParser;
165 }
166
168 bool readZone();
170 bool readDocHeader();
172 bool readDocInfo();
174 bool readPrintInfo();
175
176 // THE NAMED ENTRY
177
179 bool readEndTable(long &eof);
180
181 /* sequence of plist of printer : in v6 */
182 bool readCPRT(MWAWEntry const &entry);
183
184 /* read the list of mark */
185 bool readMARKList(MWAWEntry const &entry);
186 /* read a URL mark */
187 bool readURL(long endPos);
188 /* read a bookmark mark */
189 bool readBookmark(long endPos);
190 /* read a document mark */
191 bool readDocumentMark(long endPos);
192 /* read a end mark */
193 bool readEndMark(long endPos);
194
195 /* read the document summary */
196 bool readDSUM(MWAWEntry const &entry, bool inHeader);
197 /* SNAP (in v6) : size[4]/size[2] picture... */
198 bool readSNAP(MWAWEntry const &entry);
199 /* read the temporary file name ? */
200 bool readTNAM(MWAWEntry const &entry);
201
202 //
203 // low level
204 //
205
209 shared_ptr<ClarisWksStruct::DSET> readDSET(bool &complete);
211 void typeMainZones();
213 int typeMainZonesRec(int zId, ClarisWksStruct::DSET::Position type, int maxHeight);
215 bool exploreZonesGraph();
217 bool exploreZonesGraphRec(int zId, std::set<int> &notDoneList);
219 void cleanZonesGraph();
220
222 bool readStructCellZone(char const *zoneName, bool hasEntete, std::vector<MWAWVec2i> &res);
223 /* read a list of string zone */
224 bool readStringList(char const *zoneName, bool hasEntete, std::vector<std::string> &res);
225
227 bool readZoneA();
229 void checkOrdering(std::vector<int16_t> &vec16, std::vector<int32_t> &vec32) const;
230
231
232 protected:
234 MWAWPageSpan getFinalPageSpan() const;
236 shared_ptr<ClarisWksDocumentInternal::State> m_state;
237 public:
239 shared_ptr<MWAWParserState> m_parserState;
240
241 protected:
243 MWAWParser *m_parser;
245 shared_ptr<ClarisWksStyleManager> m_styleManager;
246
248 shared_ptr<ClarisWksDatabase> m_databaseParser;
250 shared_ptr<ClarisWksGraph> m_graphParser;
252 shared_ptr<ClarisWksPresentation> m_presentationParser;
254 shared_ptr<ClarisWksSpreadsheet> m_spreadsheetParser;
256 shared_ptr<ClarisWksTable> m_tableParser;
258 shared_ptr<ClarisWksText> m_textParser;
259
260 //
261 // the callback
262 //
263
265 typedef void (MWAWParser::* NewPage)(int page, bool softBreak);
267 typedef void (MWAWParser::* SendFootnote)(int zoneId);
268
270 NewPage m_newPage;
272 SendFootnote m_sendFootnote;
273
274 private:
275 ClarisWksDocument(ClarisWksDocument const &orig);
276 ClarisWksDocument operator=(ClarisWksDocument const &orig);
277 };
278
279 #endif
280 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWListenerPtr
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:502
ClarisWksSpreadsheet
the main class to read the text part of Claris Works file
Definition: ClarisWksSpreadsheet.hxx:70
ClarisWksDocument::getStyleManager
shared_ptr< ClarisWksStyleManager > getStyleManager()
returns the style manager
Definition: ClarisWksDocument.hxx:132
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
ClarisWksSSParser
the main class to read a AppleWorks/ClarisWorks spreadsheet file
Definition: ClarisWksSSParser.hxx:67
ClarisWksTable
the main class to read the text part of Claris Works file
Definition: ClarisWksTable.hxx:69
ClarisWksDocument::m_presentationParser
shared_ptr< ClarisWksPresentation > m_presentationParser
the spreadsheet parser
Definition: ClarisWksDocument.hxx:252
ClarisWksDocument::m_databaseParser
shared_ptr< ClarisWksDatabase > m_databaseParser
the database parser
Definition: ClarisWksDocument.hxx:248
ClarisWksDocument::m_textParser
shared_ptr< ClarisWksText > m_textParser
the text parser
Definition: ClarisWksDocument.hxx:258
ClarisWksDatabase
the main class to read the text part of Claris Works file
Definition: ClarisWksDatabase.hxx:71
MWAWParser.hxx
ClarisWksText
the main class to read the text part of Claris Works file
Definition: ClarisWksText.hxx:75
MWAWPageSpan
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:95
libmwaw_internal.hxx
ClarisWksDocument::getGraphParser
shared_ptr< ClarisWksGraph > getGraphParser()
returns the graph parser
Definition: ClarisWksDocument.hxx:142
ClarisWksDocument::m_graphParser
shared_ptr< ClarisWksGraph > m_graphParser
the graph parser
Definition: ClarisWksDocument.hxx:250
ClarisWksDocument::m_parserState
shared_ptr< MWAWParserState > m_parserState
the parser state
Definition: ClarisWksDocument.hxx:239
ClarisWksDocument::m_newPage
NewPage m_newPage
the new page callback
Definition: ClarisWksDocument.hxx:270
ClarisWksStruct.hxx
ClarisWksDocument::getTableParser
shared_ptr< ClarisWksTable > getTableParser()
returns the table parser
Definition: ClarisWksDocument.hxx:157
ClarisWksDocumentInternal::SubDocument
Internal: the subdocument of a ClarisWksDocument.
Definition: ClarisWksDocument.cxx:124
ClarisWksDocument::m_spreadsheetParser
shared_ptr< ClarisWksSpreadsheet > m_spreadsheetParser
the spreadsheet parser
Definition: ClarisWksDocument.hxx:254
ClarisWksGraph
the main class to read the graphic part of Claris Works file
Definition: ClarisWksGraph.hxx:77
ClarisWksStyleManager
a structure to store the style list and the lookup zone
Definition: ClarisWksStyleManager.hxx:60
ClarisWksDocument::m_tableParser
shared_ptr< ClarisWksTable > m_tableParser
the table parser
Definition: ClarisWksDocument.hxx:256
ClarisWksBMParser
the main class to read a bitmap AppleWorks/ClarisWorks file
Definition: ClarisWksBMParser.hxx:65
ClarisWksDocument::getMainParser
MWAWParser & getMainParser()
returns the main parser
Definition: ClarisWksDocument.hxx:127
ClarisWksDocument::m_styleManager
shared_ptr< ClarisWksStyleManager > m_styleManager
the style manager
Definition: ClarisWksDocument.hxx:245
ClarisWksDocument
main document information used to create a ClarisWorks file
Definition: ClarisWksDocument.hxx:73
MWAWSubDocument::m_parser
MWAWParser * m_parser
the main zone parser
Definition: MWAWSubDocument.hxx:75
MWAWSubDocument::operator=
MWAWSubDocument & operator=(MWAWSubDocument const &doc)
copy operator
Definition: MWAWSubDocument.cxx:52
ClarisWksDocument::getDatabaseParser
shared_ptr< ClarisWksDatabase > getDatabaseParser()
returns the database parser
Definition: ClarisWksDocument.hxx:137
ClarisWksParser
the main class to read a Claris Works file
Definition: ClarisWksParser.hxx:67
ClarisWksDocument::getTextParser
shared_ptr< ClarisWksText > getTextParser()
returns the text parser
Definition: ClarisWksDocument.hxx:162
ClarisWksDocument::getSpreadsheetParser
shared_ptr< ClarisWksSpreadsheet > getSpreadsheetParser()
returns the spreadsheet parser
Definition: ClarisWksDocument.hxx:152
ClarisWksDocumentInternal
Internal: the structures of a ClarisWksDocument.
Definition: ClarisWksDocument.cxx:67
ClarisWksPRParser
the main class to create presentation Claris Works file
Definition: ClarisWksPRParser.hxx:67
ClarisWksPresentation
the main class to read the text part of Claris Works file
Definition: ClarisWksPresentation.hxx:70
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:45
ClarisWksStruct::DSET::Position
Position
the zone position
Definition: ClarisWksStruct.hxx:62
ClarisWksDocument::m_sendFootnote
SendFootnote m_sendFootnote
the send footnote callback
Definition: ClarisWksDocument.hxx:272
ClarisWksDocument::m_state
shared_ptr< ClarisWksDocumentInternal::State > m_state
the state
Definition: ClarisWksDocument.hxx:236
ClarisWksDocument::m_parser
MWAWParser * m_parser
the main parser
Definition: ClarisWksDocument.hxx:243
MWAWPosition.hxx
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:97
ClarisWksDocument::getPresentationParser
shared_ptr< ClarisWksPresentation > getPresentationParser()
returns the presentation parser
Definition: ClarisWksDocument.hxx:147
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MWAWVec2< int >