RagTimeParser.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

RagTimeParser.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 RAG_TIME_PARSER
35 # define RAG_TIME_PARSER
36
37 #include <set>
38 #include <vector>
39
40 #include "MWAWDebug.hxx"
41 #include "MWAWInputStream.hxx"
42
43 #include "MWAWParser.hxx"
44
45 namespace RagTimeParserInternal
46 {
47 struct Picture;
48 struct State;
49 class SubDocument;
50 }
51
52 class RagTimeText;
53 class RagTimeSpreadsheet;
54
60 class RagTimeParser : public MWAWTextParser
61 {
62 friend class RagTimeParserInternal::SubDocument;
63 friend class RagTimeText;
64 friend class RagTimeSpreadsheet;
65
66 public:
68 RagTimeParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
70 virtual ~RagTimeParser();
71
73 bool checkHeader(MWAWHeader *header, bool strict=false);
74
75 // the main parse function
76 void parse(librevenge::RVNGTextInterface *documentInterface);
77
78 protected:
80 void init();
81
82 //
83 // interface
84 //
85
87 bool getColor(int colId, MWAWColor &color, int listId=-1) const;
89 bool getDateTimeFormat(int dtId, std::string &dtFormat) const;
91 int getZoneDataFieldSize(int zId) const;
93 int getNewZoneId();
94
95 //
96 // interface with text parser
97 //
98
100 int getFontId(int localId) const;
102 bool getCharStyle(int charId, MWAWFont &font) const;
104 bool readTextZone(MWAWEntry &entry, int width, MWAWColor const &fontColor=MWAWColor::black());
105
107 void createDocument(librevenge::RVNGTextInterface *documentInterface);
109 bool sendZones();
110
112 void newPage(int number);
113
115 bool createZones();
116
118 bool findDataZones();
120 bool readDataZoneHeader(int id, long endPos);
122 bool findPagesZones();
123
125 bool findRsrcZones();
126
128 bool sendPageZone(int page);
130 bool send(int zId);
132 bool sendText(int zId, MWAWListenerPtr listener);
133
135 bool sendPicture(int zId, MWAWPosition const &pos);
137 bool sendBitmap(RagTimeParserInternal::Picture const &pict, MWAWPosition const &pos);
139 bool sendBasicPicture(int zId, MWAWPosition const &pos);
141 void flushExtra();
142
145 bool readPageZone(MWAWEntry &entry);
146
148 bool readPictZone(MWAWEntry &entry);
149
151 bool readPictZoneV2(MWAWEntry &entry);
152
153 // some rsrc zone
154
156 bool readColorMapV2(MWAWEntry &entry);
158 bool readColorsMap();
160 bool readPrintInfo(MWAWEntry &entry, bool inRSRCFork=false);
162 bool readLinks(MWAWEntry &entry);
164 bool readFormatsMap();
166 bool readMacroFormats(MWAWEntry &entry);
168 bool readColorTable(MWAWEntry &entry);
169
170 // unknown data fork zone
171
173 bool readZone6(MWAWEntry &entry);
174
175 // unknown rsrc fork zone
177 bool readRsrcBeDc(MWAWEntry &entry);
178
180 bool readRsrcStructured(MWAWEntry &entry);
181
183 bool readRsrcBtch(MWAWEntry &entry);
185 bool readRsrcCalc(MWAWEntry &entry);
187 bool readRsrcfppr(MWAWEntry &entry);
189 bool readRsrcSele(MWAWEntry &entry);
190 // maybe FH=footer/header zone
192 bool readRsrcFHwl(MWAWEntry &entry);
193 protected:
194 //
195 // data
196 //
198 shared_ptr<RagTimeParserInternal::State> m_state;
200 shared_ptr<RagTimeSpreadsheet> m_spreadsheetParser;
202 shared_ptr<RagTimeText> m_textParser;
203 };
204 #endif
205 // 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:431
RagTimeParser::m_state
shared_ptr< RagTimeParserInternal::State > m_state
the state
Definition: RagTimeParser.hxx:198
RagTimeParser::getColor
bool getColor(int colId, MWAWColor &color, int listId=-1) const
returns the ith color ( if possible)
Definition: RagTimeParser.cxx:389
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
RagTimeParser::m_textParser
shared_ptr< RagTimeText > m_textParser
the text parser
Definition: RagTimeParser.hxx:202
RagTimeParser::getNewZoneId
int getNewZoneId()
returns a new unique zone id
Definition: RagTimeParser.cxx:414
MWAWParser.hxx
RagTimeParser::readRsrcfppr
bool readRsrcfppr(MWAWEntry &entry)
try to read the fppr zone (zone with id=0)
Definition: RagTimeParser.cxx:2151
RagTimeParser::RagTimeParser
RagTimeParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: RagTimeParser.cxx:355
RagTimeParser::init
void init()
inits all internal variables
Definition: RagTimeParser.cxx:365
RagTimeParser::sendPicture
bool sendPicture(int zId, MWAWPosition const &pos)
sends the picture
Definition: RagTimeParser.cxx:2361
RagTimeParser::readColorTable
bool readColorTable(MWAWEntry &entry)
try to read the color table zone: CHTa zones
Definition: RagTimeParser.cxx:1802
RagTimeParser::findPagesZones
bool findPagesZones()
try to sort the zone on each page
Definition: RagTimeParser.cxx:727
RagTimeParser::sendZones
bool sendZones()
try to send the different zones
Definition: RagTimeParser.cxx:2550
RagTimeParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: RagTimeParser.cxx:489
RagTimeParserInternal::SubDocument
Internal: the subdocument of a RagTimeParser.
Definition: RagTimeParser.cxx:302
RagTimeParser::sendBasicPicture
bool sendBasicPicture(int zId, MWAWPosition const &pos)
sends a basic shape
Definition: RagTimeParser.cxx:2514
RagTimeParserInternal::Picture
Internal: a picture of a RagTimeParser.
Definition: RagTimeParser.cxx:97
RagTimeText
the main class to read the text part of ragTime file
Definition: RagTimeText.hxx:70
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:211
RagTimeParser::readRsrcSele
bool readRsrcSele(MWAWEntry &entry)
try to read the Sele zone (zone with id=0), maybe related to selection
Definition: RagTimeParser.cxx:2187
RagTimeParser::readRsrcFHwl
bool readRsrcFHwl(MWAWEntry &entry)
try to read the FHwl zone ( one by file with id=0), maybe width length?
Definition: RagTimeParser.cxx:2019
RagTimeParser::readLinks
bool readLinks(MWAWEntry &entry)
try to read the File Link zone: FLink
Definition: RagTimeParser.cxx:1716
RagTimeParser::readColorsMap
bool readColorsMap()
try to read the color map:v3
Definition: RagTimeParser.cxx:1391
RagTimeParser::flushExtra
void flushExtra()
flush unsent zone (debugging function)
Definition: RagTimeParser.cxx:2619
RagTimeParser::findRsrcZones
bool findRsrcZones()
try to create the resource zones list
Definition: RagTimeParser.cxx:1047
RagTimeParser::sendBitmap
bool sendBitmap(RagTimeParserInternal::Picture const &pict, MWAWPosition const &pos)
sends a bitmap
Definition: RagTimeParser.cxx:2455
RagTimeParser::readFormatsMap
bool readFormatsMap()
try to read the format map:v3
Definition: RagTimeParser.cxx:1789
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:167
RagTimeParser
the main class to read a RagTime v2-3 file
Definition: RagTimeParser.hxx:60
RagTimeParser::readPictZone
bool readPictZone(MWAWEntry &entry)
try to read pictZone ( a big zone)
Definition: RagTimeParser.cxx:1151
RagTimeParser::newPage
void newPage(int number)
adds a new page
Definition: RagTimeParser.cxx:437
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
RagTimeParser::createZones
bool createZones()
finds the different objects zones
Definition: RagTimeParser.cxx:527
RagTimeParser::~RagTimeParser
virtual ~RagTimeParser()
destructor
Definition: RagTimeParser.cxx:361
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:439
RagTimeParser::send
bool send(int zId)
try to send a zone
Definition: RagTimeParser.cxx:2557
RagTimeParser::readZone6
bool readZone6(MWAWEntry &entry)
try to read zone6 ( a big zone)
Definition: RagTimeParser.cxx:1573
RagTimeParser::findDataZones
bool findDataZones()
try to create the main data zones list
Definition: RagTimeParser.cxx:674
RagTimeSpreadsheet
the main class to read the spreadsheet part of ragTime file
Definition: RagTimeSpreadsheet.hxx:71
RagTimeParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: RagTimeParser.cxx:2282
RagTimeParser::readRsrcCalc
bool readRsrcCalc(MWAWEntry &entry)
try to read the Calc zone (zone with id=0)
Definition: RagTimeParser.cxx:1976
MWAWTextParser
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:284
RagTimeParser::readRsrcBtch
bool readRsrcBtch(MWAWEntry &entry)
try to read the Btch zone (zone with id=0)
Definition: RagTimeParser.cxx:2119
RagTimeParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: RagTimeParser.cxx:453
RagTimeParser::readPrintInfo
bool readPrintInfo(MWAWEntry &entry, bool inRSRCFork=false)
read a printInfo block (a PREC rsrc)
Definition: RagTimeParser.cxx:1504
RagTimeParser::getDateTimeFormat
bool getDateTimeFormat(int dtId, std::string &dtFormat) const
returns the ith date format or ""
Definition: RagTimeParser.cxx:424
RagTimeParser::readTextZone
bool readTextZone(MWAWEntry &entry, int width, MWAWColor const &fontColor=MWAWColor::black())
try to read a text zone (knowing the zone width in point and the font color)
Definition: RagTimeParser.cxx:419
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:429
RagTimeParserInternal
Internal: the structures of a RagTimeParser.
Definition: RagTimeParser.cxx:62
MWAWInputStream.hxx
MWAWDebug.hxx
RagTimeParser::readRsrcStructured
bool readRsrcStructured(MWAWEntry &entry)
try to read a structured zone
Definition: RagTimeParser.cxx:2232
RagTimeParser::readColorMapV2
bool readColorMapV2(MWAWEntry &entry)
try to read the color map:v2
Definition: RagTimeParser.cxx:1406
RagTimeParser::getZoneDataFieldSize
int getZoneDataFieldSize(int zId) const
returns the size of a zone data field
Definition: RagTimeParser.cxx:405
RagTimeParser::readMacroFormats
bool readMacroFormats(MWAWEntry &entry)
try to read the macro format zone: RTml zones
Definition: RagTimeParser.cxx:1909
RagTimeParser::readRsrcBeDc
bool readRsrcBeDc(MWAWEntry &entry)
try to read the BeDc zone ( zone of size 52, one by file with id=0);
Definition: RagTimeParser.cxx:2074
RagTimeParser::readDataZoneHeader
bool readDataZoneHeader(int id, long endPos)
try to read a data zone header
Definition: RagTimeParser.cxx:767
RagTimeParser::sendText
bool sendText(int zId, MWAWListenerPtr listener)
try to send the text zone (interface of RagTimeText)
Definition: RagTimeParser.cxx:429
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
RagTimeParser::getFontId
int getFontId(int localId) const
returns a mac font id corresponding to a local id
Definition: RagTimeParser.cxx:379
RagTimeParser::getCharStyle
bool getCharStyle(int charId, MWAWFont &font) const
returns font style corresponding to a char style id
Definition: RagTimeParser.cxx:384
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
RagTimeParser::readPageZone
bool readPageZone(MWAWEntry &entry)
try to read page zone ( unknown content of size 40).
Definition: RagTimeParser.cxx:1671
RagTimeParser::sendPageZone
bool sendPageZone(int page)
try to send the different zones of a page
Definition: RagTimeParser.cxx:2540
RagTimeParser::readPictZoneV2
bool readPictZoneV2(MWAWEntry &entry)
try to read pictZone ( a big zone):v2
Definition: RagTimeParser.cxx:1272
RagTimeParser::m_spreadsheetParser
shared_ptr< RagTimeSpreadsheet > m_spreadsheetParser
the spreadsheet parser
Definition: RagTimeParser.hxx:200