MacDrawProParser.hxx Source File documentation

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
48namespace MacDrawProParserInternal
49{
50struct Layer;
51struct Library;
52struct Shape;
53struct State;
54
55class SubDocument;
56}
57
58class MacDrawProStyleManager;
59
63 class MacDrawProParser final : public MWAWGraphicParser
64{
65 friend class MacDrawProStyleManager;
66 friend class MacDrawProParserInternal::SubDocument;
67public:
69 MacDrawProParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
71 ~MacDrawProParser() final;
72
74 bool checkHeader(MWAWHeader *header, bool strict=false) final;
75
76 // the main parse function
77 void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
78
79protected:
81 void init();
82
84 void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
85
86protected:
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(int depth=0);
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, MWAWVec2f const &orig, int depth=0);
144 bool sendBitmap(MacDrawProParserInternal::Shape const &shape, MWAWPosition const &pos);
146 bool sendText(int zoneId);
148 bool sendMeasure(MWAWEntry const &entry);
150 void flushExtra();
151
152 //
153 // data
154 //
156 std::shared_ptr<MacDrawProParserInternal::State> m_state;
157
159 std::shared_ptr<MacDrawProStyleManager> m_styleManager;
160};
161#endif
162// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWGraphicParser::MWAWGraphicParser
MWAWGraphicParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:259
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
MacDrawProParserInternal::SubDocument
Internal: the subdocument of a MacDrawProParser.
Definition MacDrawProParser.cxx:372
MacDrawProParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition MacDrawProParser.cxx:2472
MacDrawProParser::readRotationInObjectData
bool readRotationInObjectData(MacDrawProParserInternal::Shape &shape, long endPos, std::string &extra)
tries to read the rotation
Definition MacDrawProParser.cxx:1693
MacDrawProParser::sendBitmap
bool sendBitmap(MacDrawProParserInternal::Shape const &shape, MWAWPosition const &pos)
tries to send a bitmap to the listener
Definition MacDrawProParser.cxx:2957
MacDrawProParser::computeLayersAndLibrariesBoundingBox
bool computeLayersAndLibrariesBoundingBox()
computes the layers and libraries bounding box
Definition MacDrawProParser.cxx:1115
MacDrawProParser::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition MacDrawProParser.cxx:3212
MacDrawProParser::createZones
bool createZones()
finds the different objects zones
Definition MacDrawProParser.cxx:567
MacDrawProParser::m_state
std::shared_ptr< MacDrawProParserInternal::State > m_state
the state
Definition MacDrawProParser.hxx:156
MacDrawProParser::MacDrawProStyleManager
friend class MacDrawProStyleManager
Definition MacDrawProParser.hxx:65
MacDrawProParser::m_styleManager
std::shared_ptr< MacDrawProStyleManager > m_styleManager
the style manager state
Definition MacDrawProParser.hxx:159
MacDrawProParser::readLibrariesInfo
bool readLibrariesInfo()
tries to read the library name info zone
Definition MacDrawProParser.cxx:883
MacDrawProParser::MacDrawProParser
MacDrawProParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition MacDrawProParser.cxx:440
MacDrawProParser::sendText
bool sendText(int zoneId)
tries to send a text zone to the listener
Definition MacDrawProParser.cxx:3084
MacDrawProParser::findObjectPositions
bool findObjectPositions(bool dataZone)
finds the objet's data/text positions
Definition MacDrawProParser.cxx:1030
MacDrawProParser::sendMeasure
bool sendMeasure(MWAWEntry const &entry)
tries to send a line measure to the listener
Definition MacDrawProParser.cxx:3173
MacDrawProParser::init
void init()
inits all internal variables
Definition MacDrawProParser.cxx:452
MacDrawProParser::readLayerLibraryCorrespondance
bool readLayerLibraryCorrespondance()
tries to the layer library correspondance zone
Definition MacDrawProParser.cxx:781
MacDrawProParser::readGeometryShapeData
bool readGeometryShapeData(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a basic geometric object data ( line, rect, arc,... )
Definition MacDrawProParser.cxx:2057
MacDrawProParser::readLayersInfo
bool readLayersInfo()
tries to the layer info zone
Definition MacDrawProParser.cxx:637
MacDrawProParser::readTextII
bool readTextII(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw II file
Definition MacDrawProParser.cxx:1765
MacDrawProParser::readHeaderInfo
bool readHeaderInfo()
tries to the header info zone ( print info + some information about content + prefs ?...
Definition MacDrawProParser.cxx:2556
MacDrawProParser::sendPage
bool sendPage(int page)
tries to send the layer corresponding a page
Definition MacDrawProParser.cxx:2791
MacDrawProParser::readObject
int readObject(int depth=0)
tries to read an object and returns the object id (-1 if error )
Definition MacDrawProParser.cxx:1248
MacDrawProParser::send
bool send(MacDrawProParserInternal::Library const &library)
tries to send a library (not functionnal)
Definition MacDrawProParser.cxx:2819
MacDrawProParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition MacDrawProParser.cxx:499
MacDrawProParser::updateGeometryShape
bool updateGeometryShape(MacDrawProParserInternal::Shape &shape, float cornerWidth)
tries to update the basic geometric data
Definition MacDrawProParser.cxx:1724
MacDrawProParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition MacDrawProParser.cxx:466
MacDrawProParser::readPrintInfo
bool readPrintInfo()
tries to read the print info zone
Definition MacDrawProParser.cxx:2703
MacDrawProParser::readBitmap
bool readBitmap(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a bitmap data
Definition MacDrawProParser.cxx:2365
MacDrawProParser::readStructuredHeaderZone
bool readStructuredHeaderZone(MWAWEntry const &entry, std::map< int, long > &idToDeltaPosMap)
tries to read a structured zone header
Definition MacDrawProParser.cxx:977
MacDrawProParser::~MacDrawProParser
~MacDrawProParser() final
destructor
Definition MacDrawProParser.cxx:448
MacDrawProParser::sendMasterPage
bool sendMasterPage()
tries to create a master page if needed
Definition MacDrawProParser.cxx:2765
MacDrawProParser::readTextPro
bool readTextPro(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw pro file
Definition MacDrawProParser.cxx:1934
MacDrawProParser::readObjectData
bool readObjectData(MacDrawProParserInternal::Shape &shape, int zId)
tries to read an object data
Definition MacDrawProParser.cxx:1627
MacDrawProStyleManager
the main class to read a MacDraw II file
Definition MacDrawProStyleManager.hxx:60
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
MacDrawProParserInternal
Internal: the structures of a MacDrawProParser.
Definition MacDrawProParser.cxx:63
librevenge
Definition MWAWDocument.hxx:57
MacDrawProParserInternal::Layer
Definition MacDrawProParser.cxx:68
MacDrawProParserInternal::Library
Definition MacDrawProParser.cxx:97
MacDrawProParserInternal::Shape
Definition MacDrawProParser.cxx:117
MacDrawProParserInternal::State
Internal: the state of a MacDrawProParser.
Definition MacDrawProParser.cxx:302