MacDrawProParser.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
#ifndef MACDRAWPRO_PARSER
# define MACDRAWPRO_PARSER
#include <map>
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace MacDrawProParserInternal
{
struct Layer;
struct Library;
struct Shape;
struct State;
class SubDocument;
}
class MacDrawProStyleManager;
class MacDrawProParser final : public MWAWGraphicParser
{
friend class MacDrawProStyleManager;
friend class MacDrawProParserInternal::SubDocument;
public:
MacDrawProParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~MacDrawProParser() final;
bool checkHeader(MWAWHeader *header, bool strict=false) final;
// the main parse function
void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
protected:
void init();
void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
protected:
bool createZones();
// Intermediate level
bool readPrintInfo();
bool readHeaderInfo();
bool readLayersInfo();
bool readLayerLibraryCorrespondance();
bool readLibrariesInfo();
bool findObjectPositions(bool dataZone);
bool computeLayersAndLibrariesBoundingBox();
bool readStructuredHeaderZone(MWAWEntry const &entry, std::map<int, long> &idToDeltaPosMap);
//
// low level
//
int readObject();
bool readObjectData(MacDrawProParserInternal::Shape &shape, int zId);
bool readRotationInObjectData(MacDrawProParserInternal::Shape &shape, long endPos, std::string &extra);
bool updateGeometryShape(MacDrawProParserInternal::Shape &shape, float cornerWidth);
bool readBitmap(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
bool readTextII(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
bool readTextPro(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
bool readGeometryShapeData(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry);
// send functions
bool sendMasterPage();
bool sendPage(int page);
bool send(MacDrawProParserInternal::Library const &library);
bool send(MacDrawProParserInternal::Layer const &layer);
bool send(MacDrawProParserInternal::Shape const &shape, MWAWVec2f const &orig);
bool sendBitmap(MacDrawProParserInternal::Shape const &shape, MWAWPosition const &pos);
bool sendText(int zoneId);
bool sendMeasure(MWAWEntry const &entry);
void flushExtra();
//
// data
//
std::shared_ptr<MacDrawProParserInternal::State> m_state;
std::shared_ptr<MacDrawProStyleManager> m_styleManager;
};
#endif
// 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:369
MacDrawProParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition MacDrawProParser.cxx:2465
MacDrawProParser::readRotationInObjectData
bool readRotationInObjectData(MacDrawProParserInternal::Shape &shape, long endPos, std::string &extra)
tries to read the rotation
Definition MacDrawProParser.cxx:1686
MacDrawProParser::sendBitmap
bool sendBitmap(MacDrawProParserInternal::Shape const &shape, MWAWPosition const &pos)
tries to send a bitmap to the listener
Definition MacDrawProParser.cxx:2946
MacDrawProParser::computeLayersAndLibrariesBoundingBox
bool computeLayersAndLibrariesBoundingBox()
computes the layers and libraries bounding box
Definition MacDrawProParser.cxx:1112
MacDrawProParser::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition MacDrawProParser.cxx:3201
MacDrawProParser::createZones
bool createZones()
finds the different objects zones
Definition MacDrawProParser.cxx:564
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:880
MacDrawProParser::MacDrawProParser
MacDrawProParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition MacDrawProParser.cxx:437
MacDrawProParser::sendText
bool sendText(int zoneId)
tries to send a text zone to the listener
Definition MacDrawProParser.cxx:3073
MacDrawProParser::findObjectPositions
bool findObjectPositions(bool dataZone)
finds the objet's data/text positions
Definition MacDrawProParser.cxx:1027
MacDrawProParser::sendMeasure
bool sendMeasure(MWAWEntry const &entry)
tries to send a line measure to the listener
Definition MacDrawProParser.cxx:3162
MacDrawProParser::init
void init()
inits all internal variables
Definition MacDrawProParser.cxx:449
MacDrawProParser::readLayerLibraryCorrespondance
bool readLayerLibraryCorrespondance()
tries to the layer library correspondance zone
Definition MacDrawProParser.cxx:778
MacDrawProParser::readGeometryShapeData
bool readGeometryShapeData(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a basic geometric object data ( line, rect, arc,... )
Definition MacDrawProParser.cxx:2050
MacDrawProParser::readLayersInfo
bool readLayersInfo()
tries to the layer info zone
Definition MacDrawProParser.cxx:634
MacDrawProParser::readTextII
bool readTextII(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw II file
Definition MacDrawProParser.cxx:1758
MacDrawProParser::readHeaderInfo
bool readHeaderInfo()
tries to the header info zone ( print info + some information about content + prefs ?...
Definition MacDrawProParser.cxx:2549
MacDrawProParser::sendPage
bool sendPage(int page)
tries to send the layer corresponding a page
Definition MacDrawProParser.cxx:2784
MacDrawProParser::send
bool send(MacDrawProParserInternal::Library const &library)
tries to send a library (not functionnal)
Definition MacDrawProParser.cxx:2812
MacDrawProParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition MacDrawProParser.cxx:496
MacDrawProParser::updateGeometryShape
bool updateGeometryShape(MacDrawProParserInternal::Shape &shape, float cornerWidth)
tries to update the basic geometric data
Definition MacDrawProParser.cxx:1717
MacDrawProParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition MacDrawProParser.cxx:463
MacDrawProParser::readPrintInfo
bool readPrintInfo()
tries to read the print info zone
Definition MacDrawProParser.cxx:2696
MacDrawProParser::readBitmap
bool readBitmap(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a bitmap data
Definition MacDrawProParser.cxx:2358
MacDrawProParser::readObject
int readObject()
tries to read an object and returns the object id (-1 if error )
Definition MacDrawProParser.cxx:1245
MacDrawProParser::readStructuredHeaderZone
bool readStructuredHeaderZone(MWAWEntry const &entry, std::map< int, long > &idToDeltaPosMap)
tries to read a structured zone header
Definition MacDrawProParser.cxx:974
MacDrawProParser::~MacDrawProParser
~MacDrawProParser() final
destructor
Definition MacDrawProParser.cxx:445
MacDrawProParser::sendMasterPage
bool sendMasterPage()
tries to create a master page if needed
Definition MacDrawProParser.cxx:2758
MacDrawProParser::readTextPro
bool readTextPro(MacDrawProParserInternal::Shape &shape, MWAWEntry const &entry)
tries to read a text object data in MacDraw pro file
Definition MacDrawProParser.cxx:1927
MacDrawProParser::readObjectData
bool readObjectData(MacDrawProParserInternal::Shape &shape, int zId)
tries to read an object data
Definition MacDrawProParser.cxx:1620
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:65
MacDrawProParserInternal::Library
Definition MacDrawProParser.cxx:94
MacDrawProParserInternal::Shape
Definition MacDrawProParser.cxx:114
MacDrawProParserInternal::State
Internal: the state of a MacDrawProParser.
Definition MacDrawProParser.cxx:299