MacDrawProParser.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MacDrawProParser.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 MACDRAWPRO_PARSER
35 # define MACDRAWPRO_PARSER
36
37 #include <map>
38 #include <string>
39 #include <vector>
40
41 #include <librevenge/librevenge.h>
42
43 #include "MWAWDebug.hxx"
44 #include "MWAWInputStream.hxx"
45
46 #include "MWAWParser.hxx"
47
48 namespace MacDrawProParserInternal
49 {
50 struct Layer;
51 struct Library;
52 struct Shape;
53 struct State;
54
55 class SubDocument;
56 }
57
58 class MacDrawProStyleManager;
59
63 class MacDrawProParser : public MWAWGraphicParser
64 {
65 friend class MacDrawProStyleManager;
66 friend class MacDrawProParserInternal::SubDocument;
67 public:
69 MacDrawProParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
71 virtual ~MacDrawProParser();
72
74 bool checkHeader(MWAWHeader *header, bool strict=false);
75
76 // the main parse function
77 void parse(librevenge::RVNGDrawingInterface *documentInterface);
78
79 protected:
81 void init();
82
84 void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
85
86 protected:
88 bool createZones();
89
90 // Intermediate level
91
93 bool readPrintInfo();
95 bool readHeaderInfo();
97 bool readLayersInfo();
99 bool readLayerLibraryCorrespondance();
101 bool readLibrariesInfo();
103 bool findObjectPositions(bool dataZone);
105 bool computeLayersAndLibrariesBoundingBox();
106
108 bool readStructuredHeaderZone(MWAWEntry const &entry, std::map<int, long> &idToDeltaPosMap);
109
110 //
111 // low level
112 //
113
115 int readObject();
117 bool readObjectData(MacDrawProParserInternal::Shape &shape, int zId);
119 bool readRotationInObjectData(MacDrawProParserInternal::Shape &shape, long endPos, std::string &extra);
121 bool updateGeometryShape(MacDrawProParserInternal::Shape &shape, float cornerWidth);
123 bool readBitmap(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
125 bool readTextII(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
127 bool readTextPro(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
129 bool readGeometryShapeData(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
130
131 // send functions
132
134 bool sendMasterPage();
136 bool sendPage(int page);
138 bool send(MacDrawProParserInternal::Library const &library);
140 bool send(MacDrawProParserInternal::Layer const &layer);
142 bool send(MacDrawProParserInternal::Shape const &shape, Vec2f const &orig);
144 bool sendBitmap(MacDrawProParserInternal::Shape const &shape, MWAWPosition const &pos);
146 bool sendText(int zoneId);
148 bool sendLabel(MWAWEntry const &entry);
150 void flushExtra();
151
152 //
153 // data
154 //
156 shared_ptr<MacDrawProParserInternal::State> m_state;
157
159 shared_ptr<MacDrawProStyleManager> m_styleManager;
160 };
161 #endif
162 // 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
MacDrawProParser::computeLayersAndLibrariesBoundingBox
bool computeLayersAndLibrariesBoundingBox()
computes the layers and libraries bounding box
Definition: MacDrawProParser.cxx:1052
MacDrawProParser::readStructuredHeaderZone
bool readStructuredHeaderZone(MWAWEntry const &entry, std::map< int, long > &idToDeltaPosMap)
tries to read a structured zone header
Definition: MacDrawProParser.cxx:914
MacDrawProParserInternal::Library
Definition: MacDrawProParser.cxx:88
MacDrawProParserInternal::Layer
Definition: MacDrawProParser.cxx:65
MacDrawProParser::createZones
bool createZones()
finds the different objects zones
Definition: MacDrawProParser.cxx:508
MWAWParser.hxx
MacDrawProParser::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: MacDrawProParser.cxx:3143
MacDrawProParser::~MacDrawProParser
virtual ~MacDrawProParser()
destructor
Definition: MacDrawProParser.cxx:384
MacDrawProParser::readPrintInfo
bool readPrintInfo()
tries to read the print info zone
Definition: MacDrawProParser.cxx:2638
MacDrawProParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MacDrawProParser.cxx:437
MacDrawProParser::readHeaderInfo
bool readHeaderInfo()
tries to the header info zone ( print info + some information about content + prefs ...
Definition: MacDrawProParser.cxx:2489
MacDrawProParser::sendBitmap
bool sendBitmap(MacDrawProParserInternal::Shape const &shape, MWAWPosition const &pos)
tries to send a bitmap to the listener
Definition: MacDrawProParser.cxx:2889
MacDrawProParser::findObjectPositions
bool findObjectPositions(bool dataZone)
finds the objet's data/text positions
Definition: MacDrawProParser.cxx:967
MacDrawProParser::readObjectData
bool readObjectData(MacDrawProParserInternal::Shape &shape, int zId)
tries to read an object data
Definition: MacDrawProParser.cxx:1560
MacDrawProParser::readObject
int readObject()
tries to read an object and returns the object id (-1 if error )
Definition: MacDrawProParser.cxx:1185
MacDrawProParserInternal::SubDocument
Internal: the subdocument of a MacDrawProParser.
Definition: MacDrawProParser.cxx:314
MacDrawProParserInternal
Internal: the structures of a MacDrawProParser.
Definition: MacDrawProParser.cxx:62
MacDrawProParser::readTextPro
bool readTextPro(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw pro file
Definition: MacDrawProParser.cxx:1867
MacDrawProParser::sendPage
bool sendPage(int page)
tries to send the layer corresponding a page
Definition: MacDrawProParser.cxx:2727
MacDrawProParser::init
void init()
inits all internal variables
Definition: MacDrawProParser.cxx:388
MacDrawProParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MacDrawProParser.cxx:2405
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:439
MacDrawProParser::MacDrawProParser
MacDrawProParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MacDrawProParser.cxx:378
MacDrawProParser::readTextII
bool readTextII(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw II file
Definition: MacDrawProParser.cxx:1698
MacDrawProParser::updateGeometryShape
bool updateGeometryShape(MacDrawProParserInternal::Shape &shape, float cornerWidth)
tries to update the basic geometric data
Definition: MacDrawProParser.cxx:1657
MacDrawProParser::readGeometryShapeData
bool readGeometryShapeData(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a basic geometric object data ( line, rect, arc,... )
Definition: MacDrawProParser.cxx:1990
MacDrawProParser
the main class to read a MacDraw II file
Definition: MacDrawProParser.hxx:63
MacDrawProStyleManager
the main class to read a MacDraw II file
Definition: MacDrawProStyleManager.hxx:59
MacDrawProParser::readRotationInObjectData
bool readRotationInObjectData(MacDrawProParserInternal::Shape &shape, long endPos, std::string &extra)
tries to read the rotation
Definition: MacDrawProParser.cxx:1626
MacDrawProParser::m_state
shared_ptr< MacDrawProParserInternal::State > m_state
the state
Definition: MacDrawProParser.hxx:156
MacDrawProParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface)
virtual function used to parse the input
Definition: MacDrawProParser.cxx:402
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:429
MacDrawProParser::sendLabel
bool sendLabel(MWAWEntry const &entry)
tries to send a line label to the listener
Definition: MacDrawProParser.cxx:3104
MWAWGraphicParser
virtual class which defines the ancestor of all graphic zone parser
Definition: MWAWParser.hxx:245
MWAWInputStream.hxx
MWAWDebug.hxx
MacDrawProParser::readLayerLibraryCorrespondance
bool readLayerLibraryCorrespondance()
tries to the layer library correspondance zone
Definition: MacDrawProParser.cxx:718
MacDrawProParser::readLibrariesInfo
bool readLibrariesInfo()
tries to read the library name info zone
Definition: MacDrawProParser.cxx:820
MacDrawProParser::readBitmap
bool readBitmap(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a bitmap data
Definition: MacDrawProParser.cxx:2298
MacDrawProParser::readLayersInfo
bool readLayersInfo()
tries to the layer info zone
Definition: MacDrawProParser.cxx:577
MacDrawProParserInternal::Shape
Definition: MacDrawProParser.cxx:104
MacDrawProParser::m_styleManager
shared_ptr< MacDrawProStyleManager > m_styleManager
the style manager state
Definition: MacDrawProParser.hxx:159
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
MacDrawProParser::send
bool send(MacDrawProParserInternal::Library const &library)
tries to send a library (not functionnal)
Definition: MacDrawProParser.cxx:2756
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
Vec2< float >
MacDrawProParser::sendText
bool sendText(int zoneId)
tries to send a text zone to the listener
Definition: MacDrawProParser.cxx:3015
MacDrawProParser::sendMasterPage
bool sendMasterPage()
tries to create a master page if needed
Definition: MacDrawProParser.cxx:2700