- 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 "MWAWPosition.hxx"
46
47 #include "ClarisWksStruct.hxx"
48
49 class MWAWSection;
50
51 namespace ClarisWksDocumentInternal
52 {
53 class SubDocument;
54
55 struct State;
56 }
57
58 class ClarisWksParser;
59 class ClarisWksBMParser;
60 class ClarisWksPRParser;
61 class ClarisWksSSParser;
62
63 class ClarisWksDatabase;
64 class ClarisWksGraph;
65 class ClarisWksStyleManager;
66 class ClarisWksPresentation;
67 class ClarisWksSpreadsheet;
68 class ClarisWksTable;
69 class ClarisWksText;
70
72 class ClarisWksDocument
73 {
74 public:
75 friend class ClarisWksParser;
76 friend class ClarisWksBMParser;
77 friend class ClarisWksPRParser;
78 friend class ClarisWksSSParser;
79 friend class ClarisWksDocumentInternal::SubDocument;
81 ClarisWksDocument(MWAWParser &parser);
83 ~ClarisWksDocument();
84
86 bool checkHeader(MWAWHeader *header, bool strict=false);
87
89 bool createZones();
90
92 int numPages() const;
94 MWAWVec2i getDocumentPages();
96 double getTextHeight() const;
98 MWAWVec2f getPageLeftTop() const;
100 void updatePageSpanList(std::vector<MWAWPageSpan> &spanList);
102 void updatePageSpanList(std::vector<MWAWPageSpan> &spanList, MWAWPageSpan &master);
103
105 MWAWSection getMainSection() const;
107 shared_ptr<ClarisWksStruct::DSET> getZone(int zId) const;
109 void updateChildPositions();
111 void newPage(int page, bool softBreak=false);
113 std::vector<int> const &getMainZonesList() const;
115 void forceParsed(int zoneId);
117 bool canSendZoneAsGraphic(int number) const;
119 bool sendZone(int zoneId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition());
121 void sendFootnote(int zoneId);
122
124 MWAWParser &getMainParser()
125 {
126 return *m_parser;
127 }
129 shared_ptr<ClarisWksStyleManager> getStyleManager()
130 {
131 return m_styleManager;
132 }
134 shared_ptr<ClarisWksDatabase> getDatabaseParser()
135 {
136 return m_databaseParser;
137 }
139 shared_ptr<ClarisWksGraph> getGraphParser()
140 {
141 return m_graphParser;
142 }
144 shared_ptr<ClarisWksPresentation> getPresentationParser()
145 {
146 return m_presentationParser;
147 }
149 shared_ptr<ClarisWksSpreadsheet> getSpreadsheetParser()
150 {
151 return m_spreadsheetParser;
152 }
154 shared_ptr<ClarisWksTable> getTableParser()
155 {
156 return m_tableParser;
157 }
159 shared_ptr<ClarisWksText> getTextParser()
160 {
161 return m_textParser;
162 }
163
165 bool readZone();
167 bool readDocHeader();
169 bool readDocInfo();
171 bool readPrintInfo();
172
173 // THE NAMED ENTRY
174
176 bool readEndTable(long &eof);
177
178 /* sequence of plist of printer : in v6 */
179 bool readCPRT(MWAWEntry const &entry);
180
181 /* read the list of mark */
182 bool readMARKList(MWAWEntry const &entry);
183 /* read a URL mark */
184 bool readURL(long endPos);
185 /* read a bookmark mark */
186 bool readBookmark(long endPos);
187 /* read a document mark */
188 bool readDocumentMark(long endPos);
189 /* read a end mark */
190 bool readEndMark(long endPos);
191
192 /* read the document summary */
193 bool readDSUM(MWAWEntry const &entry, bool inHeader);
194 /* SNAP (in v6) : size[4]/size[2] picture... */
195 bool readSNAP(MWAWEntry const &entry);
196 /* read the temporary file name ? */
197 bool readTNAM(MWAWEntry const &entry);
198
199 //
200 // low level
201 //
202
206 shared_ptr<ClarisWksStruct::DSET> readDSET(bool &complete);
208 void typeMainZones();
210 int typeMainZonesRec(int zId, ClarisWksStruct::DSET::Position type, int maxHeight);
212 bool exploreZonesGraph();
214 bool exploreZonesGraphRec(int zId, std::set<int> &notDoneList);
216 void cleanZonesGraph();
217
219 bool readStructCellZone(char const *zoneName, bool hasEntete, std::vector<MWAWVec2i> &res);
220 /* read a list of string zone */
221 bool readStringList(char const *zoneName, bool hasEntete, std::vector<std::string> &res);
222
224 bool readZoneA();
226 void checkOrdering(std::vector<int16_t> &vec16, std::vector<int32_t> &vec32) const;
227
228
229 protected:
231 MWAWPageSpan getFinalPageSpan() const;
233 shared_ptr<ClarisWksDocumentInternal::State> m_state;
234 public:
236 shared_ptr<MWAWParserState> m_parserState;
237
238 protected:
240 MWAWParser *m_parser;
242 shared_ptr<ClarisWksStyleManager> m_styleManager;
243
245 shared_ptr<ClarisWksDatabase> m_databaseParser;
247 shared_ptr<ClarisWksGraph> m_graphParser;
249 shared_ptr<ClarisWksPresentation> m_presentationParser;
251 shared_ptr<ClarisWksSpreadsheet> m_spreadsheetParser;
253 shared_ptr<ClarisWksTable> m_tableParser;
255 shared_ptr<ClarisWksText> m_textParser;
256
257 //
258 // the callback
259 //
260
262 typedef void (MWAWParser::* NewPage)(int page, bool softBreak);
264 typedef void (MWAWParser::* SendFootnote)(int zoneId);
265
267 NewPage m_newPage;
269 SendFootnote m_sendFootnote;
270
271 private:
272 ClarisWksDocument(ClarisWksDocument const &orig);
273 ClarisWksDocument operator=(ClarisWksDocument const &orig);
274 };
275
276 #endif
277 // 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:441
ClarisWksDocument::canSendZoneAsGraphic
bool canSendZoneAsGraphic(int number) const
check if we can send a zone as a graphic
Definition: ClarisWksDocument.cxx:390
ClarisWksSpreadsheet
the main class to read the text part of Claris Works file
Definition: ClarisWksSpreadsheet.hxx:70
ClarisWksDocument::getMainZonesList
std::vector< int > const & getMainZonesList() const
returns the list of the main zones
Definition: ClarisWksDocument.cxx:377
ClarisWksDocument::readDSET
shared_ptr< ClarisWksStruct::DSET > readDSET(bool &complete)
reads the zone DSET
Definition: ClarisWksDocument.cxx:790
ClarisWksDocument::getStyleManager
shared_ptr< ClarisWksStyleManager > getStyleManager()
returns the style manager
Definition: ClarisWksDocument.hxx:129
ClarisWksDocument::readBookmark
bool readBookmark(long endPos)
Definition: ClarisWksDocument.cxx:1829
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
ClarisWksDocument::readStringList
bool readStringList(char const *zoneName, bool hasEntete, std::vector< std::string > &res)
Definition: ClarisWksDocument.cxx:2019
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:249
ClarisWksDocument::m_databaseParser
shared_ptr< ClarisWksDatabase > m_databaseParser
the database parser
Definition: ClarisWksDocument.hxx:245
ClarisWksDocument::m_textParser
shared_ptr< ClarisWksText > m_textParser
the text parser
Definition: ClarisWksDocument.hxx:255
ClarisWksDatabase
the main class to read the text part of Claris Works file
Definition: ClarisWksDatabase.hxx:71
ClarisWksDocument::updatePageSpanList
void updatePageSpanList(std::vector< MWAWPageSpan > &spanList)
updates the page span list
Definition: ClarisWksDocument.cxx:235
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:139
ClarisWksDocument::m_graphParser
shared_ptr< ClarisWksGraph > m_graphParser
the graph parser
Definition: ClarisWksDocument.hxx:247
ClarisWksDocument::readCPRT
bool readCPRT(MWAWEntry const &entry)
Definition: ClarisWksDocument.cxx:1497
ClarisWksDocument::forceParsed
void forceParsed(int zoneId)
indicates that a zone is parser
Definition: ClarisWksDocument.cxx:2444
ClarisWksDocument::readTNAM
bool readTNAM(MWAWEntry const &entry)
Definition: ClarisWksDocument.cxx:1924
ClarisWksDocument::newPage
void newPage(int page, bool softBreak=false)
send a page break
Definition: ClarisWksDocument.cxx:293
ClarisWksDocument::m_parserState
shared_ptr< MWAWParserState > m_parserState
the parser state
Definition: ClarisWksDocument.hxx:236
ClarisWksDocument::m_newPage
NewPage m_newPage
the new page callback
Definition: ClarisWksDocument.hxx:267
ClarisWksDocument::getMainSection
MWAWSection getMainSection() const
returns the main document section
Definition: ClarisWksDocument.cxx:302
ClarisWksDocument::checkOrdering
void checkOrdering(std::vector< int16_t > &vec16, std::vector< int32_t > &vec32) const
small fonction used to check unusual endian ordering of a list of int16_t, int32_t ...
Definition: ClarisWksDocument.cxx:343
ClarisWksStruct.hxx
ClarisWksDocument::getTableParser
shared_ptr< ClarisWksTable > getTableParser()
returns the table parser
Definition: ClarisWksDocument.hxx:154
ClarisWksDocument::getTextHeight
double getTextHeight() const
returns the page height, ie. paper size less margin (in inches) less header/footer size ...
Definition: ClarisWksDocument.cxx:279
ClarisWksDocument::readPrintInfo
bool readPrintInfo()
read the print info zone
Definition: ClarisWksDocument.cxx:2129
ClarisWksDocumentInternal::SubDocument
Internal: the subdocument of a ClarisWksDocument.
Definition: ClarisWksDocument.cxx:116
ClarisWksDocument::m_spreadsheetParser
shared_ptr< ClarisWksSpreadsheet > m_spreadsheetParser
the spreadsheet parser
Definition: ClarisWksDocument.hxx:251
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:253
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:124
ClarisWksDocument::getDocumentPages
MWAWVec2i getDocumentPages()
returns the number of expected pages ( accross pages x down page)
Definition: ClarisWksDocument.cxx:193
ClarisWksDocument::sendZone
bool sendZone(int zoneId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition())
try to send a zone
Definition: ClarisWksDocument.cxx:411
ClarisWksDocument::m_styleManager
shared_ptr< ClarisWksStyleManager > m_styleManager
the style manager
Definition: ClarisWksDocument.hxx:242
ClarisWksDocument::SendFootnote
void(MWAWParser::* SendFootnote)(int zoneId)
callback used to send a footnote
Definition: ClarisWksDocument.hxx:264
ClarisWksDocument
main document information used to create a ClarisWorks file
Definition: ClarisWksDocument.hxx:72
ClarisWksDocument::sendFootnote
void sendFootnote(int zoneId)
ask the main parser to create a document to send a footnote
Definition: ClarisWksDocument.cxx:334
ClarisWksDocument::readEndTable
bool readEndTable(long &eof)
reads the end table ( appears in v3.0 : file version ? )
Definition: ClarisWksDocument.cxx:1391
ClarisWksDocument::updateChildPositions
void updateChildPositions()
try to update the child page of each zone
Definition: ClarisWksDocument.cxx:2386
ClarisWksDocument::ClarisWksDocument
ClarisWksDocument(MWAWParser &parser)
constructor
Definition: ClarisWksDocument.cxx:170
ClarisWksDocument::readURL
bool readURL(long endPos)
Definition: ClarisWksDocument.cxx:1713
ClarisWksDocument::getDatabaseParser
shared_ptr< ClarisWksDatabase > getDatabaseParser()
returns the database parser
Definition: ClarisWksDocument.hxx:134
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:159
ClarisWksDocument::readZone
bool readZone()
read a zone
Definition: ClarisWksDocument.cxx:682
ClarisWksDocument::getSpreadsheetParser
shared_ptr< ClarisWksSpreadsheet > getSpreadsheetParser()
returns the spreadsheet parser
Definition: ClarisWksDocument.hxx:149
ClarisWksDocument::~ClarisWksDocument
~ClarisWksDocument()
virtual destructor
Definition: ClarisWksDocument.cxx:186
ClarisWksDocument::readSNAP
bool readSNAP(MWAWEntry const &entry)
Definition: ClarisWksDocument.cxx:2073
ClarisWksDocument::readDocHeader
bool readDocHeader()
reads the document header
Definition: ClarisWksDocument.cxx:1000
ClarisWksDocument::typeMainZones
void typeMainZones()
try to type the main zones
Definition: ClarisWksDocument.cxx:2572
ClarisWksDocument::exploreZonesGraph
bool exploreZonesGraph()
try to find the zone dags structure...
Definition: ClarisWksDocument.cxx:2450
ClarisWksDocument::exploreZonesGraphRec
bool exploreZonesGraphRec(int zId, std::set< int > &notDoneList)
try to find the zone tree graph ( DSF) function
Definition: ClarisWksDocument.cxx:2521
ClarisWksDocument::typeMainZonesRec
int typeMainZonesRec(int zId, ClarisWksStruct::DSET::Position type, int maxHeight)
try to type the main zones recursif, returns the father id
Definition: ClarisWksDocument.cxx:2656
ClarisWksDocumentInternal
Internal: the structures of a ClarisWksDocument.
Definition: ClarisWksDocument.cxx:65
ClarisWksPRParser
the main class to create presentation Claris Works file
Definition: ClarisWksPRParser.hxx:67
ClarisWksDocument::createZones
bool createZones()
finds the different objects zones
Definition: ClarisWksDocument.cxx:460
ClarisWksPresentation
the main class to read the text part of Claris Works file
Definition: ClarisWksPresentation.hxx:70
ClarisWksDocument::readDocInfo
bool readDocInfo()
reads the document info part ( end of the header)
Definition: ClarisWksDocument.cxx:926
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:45
ClarisWksDocument::readZoneA
bool readZoneA()
try to read a unknown zone which appear to be filled at least in some v2 database file ...
Definition: ClarisWksDocument.cxx:2274
ClarisWksStruct::DSET::Position
Position
the zone position
Definition: ClarisWksStruct.hxx:62
ClarisWksDocument::m_sendFootnote
SendFootnote m_sendFootnote
the send footnote callback
Definition: ClarisWksDocument.hxx:269
ClarisWksDocument::readStructCellZone
bool readStructCellZone(char const *zoneName, bool hasEntete, std::vector< MWAWVec2i > &res)
try to read a structured zone list of cells
Definition: ClarisWksDocument.cxx:2199
ClarisWksDocument::NewPage
void(MWAWParser::* NewPage)(int page, bool softBreak)
callback used to send a page break
Definition: ClarisWksDocument.hxx:262
ClarisWksDocument::m_state
shared_ptr< ClarisWksDocumentInternal::State > m_state
the state
Definition: ClarisWksDocument.hxx:233
ClarisWksDocument::getFinalPageSpan
MWAWPageSpan getFinalPageSpan() const
returns the final page span to use for the document
Definition: ClarisWksDocument.cxx:264
ClarisWksDocument::readDSUM
bool readDSUM(MWAWEntry const &entry, bool inHeader)
Definition: ClarisWksDocument.cxx:1969
ClarisWksDocument::m_parser
MWAWParser * m_parser
the main parser
Definition: ClarisWksDocument.hxx:240
ClarisWksDocument::readMARKList
bool readMARKList(MWAWEntry const &entry)
Definition: ClarisWksDocument.cxx:1550
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:144
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
ClarisWksDocument::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: ClarisWksDocument.cxx:578
ClarisWksDocument::getZone
shared_ptr< ClarisWksStruct::DSET > getZone(int zId) const
return the zone corresponding to an id ( low level)
Definition: ClarisWksDocument.cxx:382
ClarisWksDocument::numPages
int numPages() const
returns the document number of page
Definition: ClarisWksDocument.cxx:217
ClarisWksDocument::readEndMark
bool readEndMark(long endPos)
Definition: ClarisWksDocument.cxx:1882
ClarisWksDocument::readDocumentMark
bool readDocumentMark(long endPos)
Definition: ClarisWksDocument.cxx:1768
ClarisWksDocument::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: ClarisWksDocument.cxx:284
ClarisWksDocument::operator=
ClarisWksDocument operator=(ClarisWksDocument const &orig)
ClarisWksDocument::cleanZonesGraph
void cleanZonesGraph()
remove uneeded edge (mainly header/footer edges in main graph)
Definition: ClarisWksDocument.cxx:2681
MWAWVec2< int >