RagTime5Parser.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

RagTime5Parser.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_5_PARSER
35 # define RAG_TIME_5_PARSER
36
37 #include <string>
38
39 #include "MWAWDebug.hxx"
40 #include "MWAWInputStream.hxx"
41
42 #include "MWAWParser.hxx"
43
44 namespace RagTime5ParserInternal
45 {
46 struct State;
47 struct Zone;
48 class SubDocument;
49 }
50
56 class RagTime5Parser : public MWAWTextParser
57 {
58 friend class RagTime5ParserInternal::SubDocument;
59
60 public:
62 enum PictureType { P_Pict, P_Tiff, P_Epsf, P_Jpeg, P_PNG, P_ScreenRep, P_WMF, P_Unknown };
63
65 RagTime5Parser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
67 virtual ~RagTime5Parser();
68
70 bool checkHeader(MWAWHeader *header, bool strict=false);
71
72 // the main parse function
73 void parse(librevenge::RVNGTextInterface *documentInterface);
74
75 protected:
77 void init();
78
79 //
80 // interface
81 //
82
84 bool getColor(int colId, MWAWColor &color, int listId=-1) const;
85
87 void createDocument(librevenge::RVNGTextInterface *documentInterface);
89 bool sendZones();
90
92 void newPage(int number);
93
95 bool createZones();
97 bool findDataZones(MWAWEntry const &entry);
99 bool update(RagTime5ParserInternal::Zone &zone);
100
102 bool unpackZone(RagTime5ParserInternal::Zone &zone, MWAWEntry const &entry, std::vector<unsigned char> &data);
104 bool unpackZone(RagTime5ParserInternal::Zone &zone);
105
107 bool readCompressedLong(MWAWInputStreamPtr &input, long endPos, long &val);
109 bool readString(RagTime5ParserInternal::Zone &zone, std::string &string);
111 bool readUnicodeString(RagTime5ParserInternal::Zone &zone);
113 bool readItemCluster(RagTime5ParserInternal::Zone &zone);
115 bool readListZone(RagTime5ParserInternal::Zone &zone);
116
118 bool readDocumentVersion(RagTime5ParserInternal::Zone &zone);
120 bool readPicture(RagTime5ParserInternal::Zone &zone, MWAWEntry &entry, PictureType type);
122 bool readPictureList(RagTime5ParserInternal::Zone &zone, std::vector<int> &listIds);
124 bool readPictureMatch(RagTime5ParserInternal::Zone &zone, bool color);
125
127 void flushExtra();
128
129 protected:
130 //
131 // data
132 //
134 shared_ptr<RagTime5ParserInternal::State> m_state;
135 };
136 #endif
137 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
RagTime5Parser::readPictureMatch
bool readPictureMatch(RagTime5ParserInternal::Zone &zone, bool color)
try to read a picture match zone
Definition: RagTime5Parser.cxx:1307
RagTime5Parser::parse
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: RagTime5Parser.cxx:464
MWAWParser.hxx
RagTime5Parser::init
void init()
inits all internal variables
Definition: RagTime5Parser.cxx:418
RagTime5Parser::P_PNG
Definition: RagTime5Parser.hxx:62
RagTime5Parser::RagTime5Parser
RagTime5Parser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: RagTime5Parser.cxx:408
RagTime5Parser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: RagTime5Parser.cxx:500
RagTime5Parser::getColor
bool getColor(int colId, MWAWColor &color, int listId=-1) const
returns the ith color ( if possible)
Definition: RagTime5Parser.cxx:429
RagTime5Parser::PictureType
PictureType
enum used to defined list of classical pict
Definition: RagTime5Parser.hxx:62
RagTime5Parser::readPictureList
bool readPictureList(RagTime5ParserInternal::Zone &zone, std::vector< int > &listIds)
try to read a picture list
Definition: RagTime5Parser.cxx:1266
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:167
RagTime5Parser::readListZone
bool readListZone(RagTime5ParserInternal::Zone &zone)
try to read a list of unknown zone
Definition: RagTime5Parser.cxx:943
RagTime5ParserInternal
Internal: the structures of a RagTime5Parser.
Definition: RagTime5Parser.cxx:64
RagTime5ParserInternal::SubDocument
Internal: the subdocument of a RagTime5Parser.
Definition: RagTime5Parser.cxx:355
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:439
RagTime5Parser::readItemCluster
bool readItemCluster(RagTime5ParserInternal::Zone &zone)
try to read a cluster of item
Definition: RagTime5Parser.cxx:817
RagTime5Parser::findDataZones
bool findDataZones(MWAWEntry const &entry)
try to create the main data zones list
Definition: RagTime5Parser.cxx:1486
RagTime5Parser::P_Unknown
Definition: RagTime5Parser.hxx:62
RagTime5Parser::readUnicodeString
bool readUnicodeString(RagTime5ParserInternal::Zone &zone)
try to read a unicode string zone
Definition: RagTime5Parser.cxx:785
RagTime5Parser::P_ScreenRep
Definition: RagTime5Parser.hxx:62
RagTime5Parser::newPage
void newPage(int number)
adds a new page
Definition: RagTime5Parser.cxx:448
MWAWTextParser
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:284
RagTime5Parser
the main class to read a RagTime v5 file
Definition: RagTime5Parser.hxx:56
RagTime5Parser::readDocumentVersion
bool readDocumentVersion(RagTime5ParserInternal::Zone &zone)
try to read the document version zone
Definition: RagTime5Parser.cxx:1217
RagTime5Parser::P_Epsf
Definition: RagTime5Parser.hxx:62
RagTime5Parser::P_Pict
Definition: RagTime5Parser.hxx:62
RagTime5Parser::readCompressedLong
bool readCompressedLong(MWAWInputStreamPtr &input, long endPos, long &val)
try to read a compressed long
Definition: RagTime5Parser.cxx:739
RagTime5Parser::readPicture
bool readPicture(RagTime5ParserInternal::Zone &zone, MWAWEntry &entry, PictureType type)
try to read a picture zone
Definition: RagTime5Parser.cxx:1370
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:429
RagTime5Parser::unpackZone
bool unpackZone(RagTime5ParserInternal::Zone &zone, MWAWEntry const &entry, std::vector< unsigned char > &data)
try to unpack a zone
Definition: RagTime5Parser.cxx:1074
MWAWInputStream.hxx
MWAWDebug.hxx
RagTime5Parser::createZones
bool createZones()
finds the different objects zones
Definition: RagTime5Parser.cxx:532
RagTime5Parser::P_WMF
Definition: RagTime5Parser.hxx:62
RagTime5Parser::P_Jpeg
Definition: RagTime5Parser.hxx:62
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
RagTime5Parser::update
bool update(RagTime5ParserInternal::Zone &zone)
try to update a zone: create a new input if the zone is stored in different positions, ...
Definition: RagTime5Parser.cxx:1004
RagTime5ParserInternal::Zone
Internal: a zone of a RagTime5Parser.
Definition: RagTime5Parser.cxx:118
RagTime5Parser::~RagTime5Parser
virtual ~RagTime5Parser()
destructor
Definition: RagTime5Parser.cxx:414
RagTime5Parser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: RagTime5Parser.cxx:1643
RagTime5Parser::readString
bool readString(RagTime5ParserInternal::Zone &zone, std::string &string)
try to read a string zone ( zone with id1=21,id2=23:24)
Definition: RagTime5Parser.cxx:755
RagTime5Parser::flushExtra
void flushExtra()
flush unsent zone (debugging function)
Definition: RagTime5Parser.cxx:1714
RagTime5Parser::sendZones
bool sendZones()
try to send the different zones
RagTime5Parser::m_state
shared_ptr< RagTime5ParserInternal::State > m_state
the state
Definition: RagTime5Parser.hxx:134
RagTime5Parser::P_Tiff
Definition: RagTime5Parser.hxx:62