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
49{
50struct Layer;
51struct Library;
52struct Shape;
53struct State;
54
55class SubDocument;
56}
57
59
64{
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();
101 bool readLibrariesInfo();
103 bool findObjectPositions(bool dataZone);
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, MWAWVec2f const &orig);
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
160};
161#endif
162// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
virtual class which defines the ancestor of all graphic zone parser
Definition: MWAWParser.hxx:251
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:57
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
Internal: the subdocument of a MacDrawProParser.
Definition: MacDrawProParser.cxx:369
the main class to read a MacDraw II file
Definition: MacDrawProParser.hxx:64
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: MacDrawProParser.cxx:2465
bool readRotationInObjectData(MacDrawProParserInternal::Shape &shape, long endPos, std::string &extra)
tries to read the rotation
Definition: MacDrawProParser.cxx:1686
bool sendBitmap(MacDrawProParserInternal::Shape const &shape, MWAWPosition const &pos)
tries to send a bitmap to the listener
Definition: MacDrawProParser.cxx:2946
bool computeLayersAndLibrariesBoundingBox()
computes the layers and libraries bounding box
Definition: MacDrawProParser.cxx:1112
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: MacDrawProParser.cxx:3201
bool createZones()
finds the different objects zones
Definition: MacDrawProParser.cxx:564
std::shared_ptr< MacDrawProParserInternal::State > m_state
the state
Definition: MacDrawProParser.hxx:156
std::shared_ptr< MacDrawProStyleManager > m_styleManager
the style manager state
Definition: MacDrawProParser.hxx:159
bool readLibrariesInfo()
tries to read the library name info zone
Definition: MacDrawProParser.cxx:880
bool sendText(int zoneId)
tries to send a text zone to the listener
Definition: MacDrawProParser.cxx:3073
bool findObjectPositions(bool dataZone)
finds the objet's data/text positions
Definition: MacDrawProParser.cxx:1027
bool sendMeasure(MWAWEntry const &entry)
tries to send a line measure to the listener
Definition: MacDrawProParser.cxx:3162
void init()
inits all internal variables
Definition: MacDrawProParser.cxx:449
bool readLayerLibraryCorrespondance()
tries to the layer library correspondance zone
Definition: MacDrawProParser.cxx:778
bool readGeometryShapeData(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a basic geometric object data ( line, rect, arc,... )
Definition: MacDrawProParser.cxx:2050
bool readLayersInfo()
tries to the layer info zone
Definition: MacDrawProParser.cxx:634
bool readTextII(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw II file
Definition: MacDrawProParser.cxx:1758
bool readHeaderInfo()
tries to the header info zone ( print info + some information about content + prefs ?...
Definition: MacDrawProParser.cxx:2549
bool sendPage(int page)
tries to send the layer corresponding a page
Definition: MacDrawProParser.cxx:2784
bool send(MacDrawProParserInternal::Library const &library)
tries to send a library (not functionnal)
Definition: MacDrawProParser.cxx:2812
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MacDrawProParser.cxx:496
bool updateGeometryShape(MacDrawProParserInternal::Shape &shape, float cornerWidth)
tries to update the basic geometric data
Definition: MacDrawProParser.cxx:1717
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition: MacDrawProParser.cxx:463
bool readPrintInfo()
tries to read the print info zone
Definition: MacDrawProParser.cxx:2696
bool readBitmap(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a bitmap data
Definition: MacDrawProParser.cxx:2358
int readObject()
tries to read an object and returns the object id (-1 if error )
Definition: MacDrawProParser.cxx:1245
bool readStructuredHeaderZone(MWAWEntry const &entry, std::map< int, long > &idToDeltaPosMap)
tries to read a structured zone header
Definition: MacDrawProParser.cxx:974
~MacDrawProParser() final
destructor
Definition: MacDrawProParser.cxx:445
bool sendMasterPage()
tries to create a master page if needed
Definition: MacDrawProParser.cxx:2758
bool readTextPro(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw pro file
Definition: MacDrawProParser.cxx:1927
bool readObjectData(MacDrawProParserInternal::Shape &shape, int zId)
tries to read an object data
Definition: MacDrawProParser.cxx:1620
the main class to read a MacDraw II file
Definition: MacDrawProStyleManager.hxx:60
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
Internal: the structures of a MacDrawProParser.
Definition: MacDrawProParser.cxx:63
Definition: MWAWDocument.hxx:57

Generated on Wed May 3 2023 07:18:29 for libmwaw by doxygen 1.9.6