FreeHandParser.hxx Source File documentation

FreeHandParser.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 FREEHAND_PARSER
35 # define FREEHAND_PARSER
36
37 #include <string>
38 #include <vector>
39
40 #include <librevenge/librevenge.h>
41
42 #include "MWAWDebug.hxx"
43 #include "MWAWInputStream.hxx"
44
45 #include "MWAWParser.hxx"
46
47 namespace FreeHandParserInternal
48 {
49 struct Shape;
50 struct ShapeHeader;
51 struct StyleHeader;
52 struct ScreenMode;
53 struct Textbox;
54 struct State;
55
56 class SubDocument;
57 }
58
62 class FreeHandParser final : public MWAWGraphicParser
63 {
64 friend class FreeHandParserInternal::SubDocument;
65 public:
67 FreeHandParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
69 ~FreeHandParser() final;
70
72 bool checkHeader(MWAWHeader *header, bool strict=false) final;
73
74 // the main parse function
75 void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
76
77 protected:
79 void init();
80
82 void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
83
84 protected:
86 bool createZones();
88 bool readZoneV1(int zId);
90 bool readZoneV2(int zId);
91
93 bool readScreenMode(FreeHandParserInternal::ScreenMode &screen);
95 bool readStyleHeader(FreeHandParserInternal::StyleHeader &style);
97 bool readColor(int zId);
99 bool readDash(int zId);
101 bool readFillStyle(int zId);
103 bool readLineStyle(int zId);
105 bool readPostscriptStyle(int zId);
106
108 bool readRootGroup(int zId);
110 bool readStyleGroup(int zId);
112 bool readGroupV1(int zId);
114 bool readGroupV2(int zId);
116 bool readJoinGroup(int zId);
118 bool readTransformGroup(int zId);
120 bool readStringZone(int zId);
121
123 bool readShapeHeader(FreeHandParserInternal::ShapeHeader &shape);
125 bool readDataZone(int zId);
126
128 bool readBackgroundPicture(int zId);
130 bool readPictureZone(int zId);
132 bool readShape(int zId);
134 bool readTextboxV1(int zId);
136 bool readTextboxV2(int zId);
137
139 bool sendZone(int zId, MWAWTransformation const &transform);
141 bool sendGroup(FreeHandParserInternal::Shape const &group, MWAWTransformation const &transform);
143 bool sendBackgroundPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform);
145 bool sendPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform);
147 bool sendShape(FreeHandParserInternal::Shape const &shape, MWAWTransformation const &transform);
149 bool sendTextbox(FreeHandParserInternal::Textbox const &textbox, MWAWTransformation const &transform);
151 bool sendText(int zId);
153 bool openLayer(int zId);
155 void closeLayer();
157 void flushExtra();
158
162 static bool decomposeMatrix(MWAWTransformation const &matrix, float &rotation, MWAWTransformation &transform, MWAWVec2f const &center);
163
165 std::shared_ptr<FreeHandParserInternal::State> m_state;
166 };
167 #endif
168 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
FreeHandParser::readGroupV1
bool readGroupV1(int zId)
try to read a group zone: version 1
Definition: FreeHandParser.cxx:1309
FreeHandParser
the main class to read a FreeHand v0,v1 file
Definition: FreeHandParser.hxx:62
FreeHandParser::init
void init()
inits all internal variables
Definition: FreeHandParser.cxx:714
FreeHandParser::sendGroup
bool sendGroup(FreeHandParserInternal::Shape const &group, MWAWTransformation const &transform)
try to send a group shape
Definition: FreeHandParser.cxx:3337
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
FreeHandParser::openLayer
bool openLayer(int zId)
try to open a layer
Definition: FreeHandParser.cxx:3286
FreeHandParser::~FreeHandParser
~FreeHandParser() final
destructor
Definition: FreeHandParser.cxx:710
FreeHandParser::sendBackgroundPicture
bool sendBackgroundPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform)
try to send a background picture
Definition: FreeHandParser.cxx:3387
MWAWParser.hxx
librevenge
Definition: MWAWDocument.hxx:56
FreeHandParser::closeLayer
void closeLayer()
try to close a layer
Definition: FreeHandParser.cxx:3303
FreeHandParser::readDataZone
bool readDataZone(int zId)
try to read a data zone
Definition: FreeHandParser.cxx:3203
FreeHandParser::sendTextbox
bool sendTextbox(FreeHandParserInternal::Textbox const &textbox, MWAWTransformation const &transform)
try to send a basic textbox
Definition: FreeHandParser.cxx:3493
FreeHandParserInternal::SubDocument
Internal: the subdocument of a FreeHandParser.
Definition: FreeHandParser.cxx:651
FreeHandParser::sendShape
bool sendShape(FreeHandParserInternal::Shape const &shape, MWAWTransformation const &transform)
try to send a basic shape
Definition: FreeHandParser.cxx:3468
FreeHandParser::sendText
bool sendText(int zId)
try to send the text of a text box
Definition: FreeHandParser.cxx:3523
FreeHandParser::readDash
bool readDash(int zId)
try to read the dash zone
Definition: FreeHandParser.cxx:1946
FreeHandParser::readRootGroup
bool readRootGroup(int zId)
try to read the list of group
Definition: FreeHandParser.cxx:1226
FreeHandParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition: FreeHandParser.cxx:758
FreeHandParser::sendZone
bool sendZone(int zId, MWAWTransformation const &transform)
try to send a zone
Definition: FreeHandParser.cxx:3311
FreeHandParser::decomposeMatrix
static bool decomposeMatrix(MWAWTransformation const &matrix, float &rotation, MWAWTransformation &transform, MWAWVec2f const &center)
try to decompose the matrix in a rotation + scaling/translation matrix.
Definition: FreeHandParser.cxx:3619
FreeHandParser::readGroupV2
bool readGroupV2(int zId)
try to read a group zone: version 2
Definition: FreeHandParser.cxx:1364
FreeHandParser::readColor
bool readColor(int zId)
try to read a color zone
Definition: FreeHandParser.cxx:1804
FreeHandParser::readZoneV2
bool readZoneV2(int zId)
try to read a zone: version 2
Definition: FreeHandParser.cxx:943
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:559
FreeHandParser::m_state
std::shared_ptr< FreeHandParserInternal::State > m_state
the state
Definition: FreeHandParser.hxx:165
FreeHandParser::readShape
bool readShape(int zId)
try to read a shape
Definition: FreeHandParser.cxx:2525
FreeHandParserInternal
Internal: the structures of a FreeHandParser.
Definition: FreeHandParser.cxx:62
FreeHandParser::sendPicture
bool sendPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform)
try to send a picture
Definition: FreeHandParser.cxx:3420
FreeHandParser::readShapeHeader
bool readShapeHeader(FreeHandParserInternal::ShapeHeader &shape)
try to read a shape header
Definition: FreeHandParser.cxx:1675
FreeHandParser::readStringZone
bool readStringZone(int zId)
try to read a label/font name zone
Definition: FreeHandParser.cxx:1633
FreeHandParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition: FreeHandParser.cxx:727
FreeHandParser::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: FreeHandParser.cxx:3597
FreeHandParser::readStyleGroup
bool readStyleGroup(int zId)
try to read a style group zone
Definition: FreeHandParser.cxx:1562
FreeHandParser::readZoneV1
bool readZoneV1(int zId)
try to read a zone: version 1
Definition: FreeHandParser.cxx:871
FreeHandParser::readPictureZone
bool readPictureZone(int zId)
try to read a picture node
Definition: FreeHandParser.cxx:2443
FreeHandParser::readScreenMode
bool readScreenMode(FreeHandParserInternal::ScreenMode &screen)
try to read a special scren mode
Definition: FreeHandParser.cxx:1752
FreeHandParser::readLineStyle
bool readLineStyle(int zId)
try to read a line style zone
Definition: FreeHandParser.cxx:2187
MWAWGraphicParser
virtual class which defines the ancestor of all graphic zone parser
Definition: MWAWParser.hxx:250
MWAWInputStream.hxx
MWAWDebug.hxx
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:549
FreeHandParser::readBackgroundPicture
bool readBackgroundPicture(int zId)
try to read a background picture zone
Definition: FreeHandParser.cxx:2404
FreeHandParser::readFillStyle
bool readFillStyle(int zId)
try to read a fill zone
Definition: FreeHandParser.cxx:2003
FreeHandParser::createZones
bool createZones()
finds the different objects zones
Definition: FreeHandParser.cxx:780
FreeHandParser::readStyleHeader
bool readStyleHeader(FreeHandParserInternal::StyleHeader &style)
try to read a style header
Definition: FreeHandParser.cxx:1764
FreeHandParser::readTextboxV2
bool readTextboxV2(int zId)
try to read a textbox zone: version 2
Definition: FreeHandParser.cxx:2946
FreeHandParser::FreeHandParser
FreeHandParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition: FreeHandParser.cxx:703
FreeHandParser::readTransformGroup
bool readTransformGroup(int zId)
try to read a node which contain the group transformation
Definition: FreeHandParser.cxx:1498
FreeHandParser::readPostscriptStyle
bool readPostscriptStyle(int zId)
try to read a postscript zone
Definition: FreeHandParser.cxx:2332
FreeHandParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: FreeHandParser.cxx:1015
FreeHandParser::readTextboxV1
bool readTextboxV1(int zId)
try to read a textbox zone: version 1
Definition: FreeHandParser.cxx:2731
FreeHandParser::readJoinGroup
bool readJoinGroup(int zId)
try to read a join zone (used to put text around path)
Definition: FreeHandParser.cxx:1439
MWAWTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1196
MWAWVec2< float >