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

Generated for libmwaw by doxygen 1.8.14