GreatWksDocument.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

GreatWksDocument.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 #ifndef GREAT_WKS_DOCUMENT
35 # define GREAT_WKS_DOCUMENT
36
37 #include <string>
38 #include <vector>
39
40 #include <librevenge/librevenge.h>
41
42 #include "MWAWCell.hxx"
43 #include "MWAWDebug.hxx"
44
45 namespace GreatWksDocumentInternal
46 {
47 struct State;
48 }
49
50 class GreatWksGraph;
51 class GreatWksParser;
52 class GreatWksDBParser;
53 class GreatWksDRParser;
54 class GreatWksSSParser;
55 class GreatWksText;
56
59 class GreatWksDocument
60 {
61 friend class GreatWksParser;
62 friend class GreatWksDBParser;
63 friend class GreatWksDRParser;
64 friend class GreatWksSSParser;
65 public:
67 GreatWksDocument(MWAWParser &parser);
69 virtual ~GreatWksDocument();
70
72 bool checkHeader(MWAWHeader *header, bool strict=false);
73
75 MWAWParser &getMainParser()
76 {
77 return *m_parser;
78 }
80 shared_ptr<GreatWksGraph> getGraphParser()
81 {
82 return m_graphParser;
83 }
85 shared_ptr<GreatWksText> getTextParser()
86 {
87 return m_textParser;
88 }
89
91 MWAWSection getMainSection() const;
93 void newPage(int page);
95 bool sendPicture(MWAWEntry const &entry, MWAWPosition pos);
96
97 // interface with the graph parser
98
100 bool canSendTextboxAsGraphic(MWAWEntry const &entry);
102 bool sendTextbox(MWAWEntry const &entry, MWAWListenerPtr listener);
103
104 protected:
105
107 bool readRSRCZones();
108
109 // formula function
110
112 bool readCellInFormula(MWAWVec2i const &pos, MWAWCellContent::FormulaInstruction &instr);
114 bool readString(long endPos, std::string &res);
116 bool readNumber(long endPos, double &res, bool &isNan);
118 bool readFormula(MWAWVec2i const &cPos, long endPos,
119 std::vector<MWAWCellContent::FormulaInstruction> &formula, std::string &error);
120
121 //
122 // low level
123 //
124
126 bool readPrintInfo(MWAWEntry const &entry);
127
129 bool readWPSN(MWAWEntry const &entry);
130
132 bool readARRs(MWAWEntry const &entry);
134 bool readDaHS(MWAWEntry const &entry);
136 bool readGrDS(MWAWEntry const &entry);
138 bool readNxEd(MWAWEntry const &entry);
139
141 MWAWInputStreamPtr rsrcInput();
142
144 libmwaw::DebugFile &rsrcAscii();
145
146 private:
147 GreatWksDocument(GreatWksDocument const &orig);
148 GreatWksDocument &operator=(GreatWksDocument const &orig);
149
150 //
151 // data
152 //
153
154 protected:
156 shared_ptr<GreatWksDocumentInternal::State> m_state;
157 public:
159 shared_ptr<MWAWParserState> m_parserState;
160
161 protected:
163 MWAWParser *m_parser;
165 shared_ptr<GreatWksGraph> m_graphParser;
167 shared_ptr<GreatWksText> m_textParser;
168
170 typedef MWAWSection(MWAWParser::* GetMainSection)() const;
172 typedef void (MWAWParser::* NewPage)(int page);
173
175 GetMainSection m_getMainSection;
177 NewPage m_newPage;
178 };
179 #endif
180 // 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:491
MWAWCellContent::FormulaInstruction
small class use to define a formula instruction
Definition: MWAWCell.hxx:360
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
GreatWksDocument::readNumber
bool readNumber(long endPos, double &res, bool &isNan)
try to read a number
Definition: GreatWksDocument.cxx:583
GreatWksDocument::GreatWksDocument
GreatWksDocument(MWAWParser &parser)
constructor
Definition: GreatWksDocument.cxx:79
GreatWksDBParser
the main class to read a GreatWorks database file
Definition: GreatWksDBParser.hxx:61
GreatWksDocument::m_parserState
shared_ptr< MWAWParserState > m_parserState
the parser state
Definition: GreatWksDocument.hxx:159
GreatWksDocument::NewPage
void(MWAWParser::* NewPage)(int page)
callback used to send a page break
Definition: GreatWksDocument.hxx:172
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:65
GreatWksDocument
the main class to read/store generic data of a GreatWorks document
Definition: GreatWksDocument.hxx:59
GreatWksDocument::canSendTextboxAsGraphic
bool canSendTextboxAsGraphic(MWAWEntry const &entry)
check if a textbox can be send in a graphic zone, ie. does not contains any graphic ...
Definition: GreatWksDocument.cxx:138
GreatWksDocument::newPage
void newPage(int page)
send a page break
Definition: GreatWksDocument.cxx:116
GreatWksDocument::readWPSN
bool readWPSN(MWAWEntry const &entry)
read the windows positions ( WPSN resource block )
Definition: GreatWksDocument.cxx:223
GreatWksDocument::m_parser
MWAWParser * m_parser
the main parser
Definition: GreatWksDocument.hxx:163
GreatWksDocument::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo block ( PRNT resource block )
Definition: GreatWksDocument.cxx:279
GreatWksDocument::m_newPage
NewPage m_newPage
the new page callback
Definition: GreatWksDocument.hxx:177
GreatWksDocument::m_graphParser
shared_ptr< GreatWksGraph > m_graphParser
the graph document
Definition: GreatWksDocument.hxx:165
GreatWksDocument::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: GreatWksDocument.cxx:474
GreatWksDocument::sendPicture
bool sendPicture(MWAWEntry const &entry, MWAWPosition pos)
send a picture
Definition: GreatWksDocument.cxx:150
GreatWksDocument::readFormula
bool readFormula(MWAWVec2i const &cPos, long endPos, std::vector< MWAWCellContent::FormulaInstruction > &formula, std::string &error)
read to read a formula
Definition: GreatWksDocument.cxx:625
GreatWksDocument::GetMainSection
MWAWSection(MWAWParser::* GetMainSection)() const
callback used to return the main section
Definition: GreatWksDocument.hxx:170
GreatWksDocument::m_getMainSection
GetMainSection m_getMainSection
the getMainSection callback
Definition: GreatWksDocument.hxx:175
GreatWksDocument::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: GreatWksDocument.cxx:99
GreatWksText
the main class to read the text part of GreatWorks Text file
Definition: GreatWksText.hxx:62
GreatWksDocument::m_textParser
shared_ptr< GreatWksText > m_textParser
the text document
Definition: GreatWksDocument.hxx:167
GreatWksDocument::readCellInFormula
bool readCellInFormula(MWAWVec2i const &pos, MWAWCellContent::FormulaInstruction &instr)
reads a cell
Definition: GreatWksDocument.cxx:539
GreatWksDocument::getGraphParser
shared_ptr< GreatWksGraph > getGraphParser()
returns the graph parser
Definition: GreatWksDocument.hxx:80
GreatWksDocument::readRSRCZones
bool readRSRCZones()
read the resource fork zone
Definition: GreatWksDocument.cxx:164
GreatWksDocument::~GreatWksDocument
virtual ~GreatWksDocument()
destructor
Definition: GreatWksDocument.cxx:90
GreatWksDRParser
the main class to read a GreatWorks graphic file
Definition: GreatWksDRParser.hxx:55
GreatWksDocument::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: GreatWksDocument.cxx:94
GreatWksParser
the main class to read a GreatWorks text file
Definition: GreatWksParser.hxx:56
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:45
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:489
MWAWDebug.hxx
GreatWksDocument::m_state
shared_ptr< GreatWksDocumentInternal::State > m_state
the state
Definition: GreatWksDocument.hxx:156
GreatWksDocument::readDaHS
bool readDaHS(MWAWEntry const &entry)
read a unknown zone ( DaHS resource block: v2 )
Definition: GreatWksDocument.cxx:360
GreatWksGraph
the main class to read the graphic part of a HanMac Word-J file
Definition: GreatWksGraph.hxx:75
GreatWksDocument::getTextParser
shared_ptr< GreatWksText > getTextParser()
returns the text parser
Definition: GreatWksDocument.hxx:85
GreatWksDocument::readARRs
bool readARRs(MWAWEntry const &entry)
read a unknown zone ( ARRs resource block: v2 )
Definition: GreatWksDocument.cxx:333
GreatWksDocument::readNxEd
bool readNxEd(MWAWEntry const &entry)
read a unknown zone ( NxED resource block: v2 )
Definition: GreatWksDocument.cxx:442
MWAWCell.hxx
Defines MWAWCell (cell content and format)
GreatWksDocument::readGrDS
bool readGrDS(MWAWEntry const &entry)
read a unknown zone ( GrDS resource block: v2 )
Definition: GreatWksDocument.cxx:401
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:97
GreatWksDocument::getMainParser
MWAWParser & getMainParser()
returns the main parser
Definition: GreatWksDocument.hxx:75
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
GreatWksDocument::sendTextbox
bool sendTextbox(MWAWEntry const &entry, MWAWListenerPtr listener)
try to send textbox
Definition: GreatWksDocument.cxx:129
GreatWksSSParser
the main class to read a GreatWorks spreadsheet file
Definition: GreatWksSSParser.hxx:58
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
GreatWksDocument::readString
bool readString(long endPos, std::string &res)
try to read a string
Definition: GreatWksDocument.cxx:568
GreatWksDocument::operator=
GreatWksDocument & operator=(GreatWksDocument const &orig)
GreatWksDocument::getMainSection
MWAWSection getMainSection() const
return the main section
Definition: GreatWksDocument.cxx:107
MWAWVec2< int >
GreatWksDocumentInternal
Internal: the structures of a GreatWksDocument.
Definition: GreatWksDocument.cxx:57