FreeHandParser.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 FREEHAND_PARSER
# define FREEHAND_PARSER
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace FreeHandParserInternal
{
struct Shape;
struct ShapeHeader;
struct StyleHeader;
struct ScreenMode;
struct Textbox;
struct State;
class SubDocument;
}
class FreeHandParser final : public MWAWGraphicParser
{
friend class FreeHandParserInternal::SubDocument;
public:
FreeHandParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~FreeHandParser() 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();
bool readZoneV1(int zId);
bool readZoneV2(int zId);
bool readScreenMode(FreeHandParserInternal::ScreenMode &screen);
bool readStyleHeader(FreeHandParserInternal::StyleHeader &style);
bool readColor(int zId);
bool readDash(int zId);
bool readFillStyle(int zId);
bool readLineStyle(int zId);
bool readPostscriptStyle(int zId);
bool readRootGroup(int zId);
bool readStyleGroup(int zId);
bool readGroupV1(int zId);
bool readGroupV2(int zId);
bool readJoinGroup(int zId);
bool readTransformGroup(int zId);
bool readStringZone(int zId);
bool readShapeHeader(FreeHandParserInternal::ShapeHeader &shape);
bool readDataZone(int zId);
bool readBackgroundPicture(int zId);
bool readPictureZone(int zId);
bool readShape(int zId);
bool readTextboxV1(int zId);
bool readTextboxV2(int zId);
bool sendZone(int zId, MWAWTransformation const &transform);
bool sendGroup(FreeHandParserInternal::Shape const &group, MWAWTransformation const &transform);
bool sendBackgroundPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform);
bool sendPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform);
bool sendShape(FreeHandParserInternal::Shape const &shape, MWAWTransformation const &transform);
bool sendTextbox(FreeHandParserInternal::Textbox const &textbox, MWAWTransformation const &transform);
bool sendText(int zId);
bool openLayer(int zId);
void closeLayer();
void flushExtra();
static bool decomposeMatrix(MWAWTransformation const &matrix, float &rotation, MWAWTransformation &transform, MWAWVec2f const &center);
std::shared_ptr<FreeHandParserInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWParser.hxx
FreeHandParserInternal::SubDocument
Internal: the subdocument of a FreeHandParser.
Definition FreeHandParser.cxx:653
FreeHandParser::readStyleGroup
bool readStyleGroup(int zId)
try to read a style group zone
Definition FreeHandParser.cxx:1562
FreeHandParser::closeLayer
void closeLayer()
try to close a layer
Definition FreeHandParser.cxx:3303
FreeHandParser::readShapeHeader
bool readShapeHeader(FreeHandParserInternal::ShapeHeader &shape)
try to read a shape header
Definition FreeHandParser.cxx:1675
FreeHandParser::readTransformGroup
bool readTransformGroup(int zId)
try to read a node which contain the group transformation
Definition FreeHandParser.cxx:1498
FreeHandParser::readRootGroup
bool readRootGroup(int zId)
try to read the list of group
Definition FreeHandParser.cxx:1226
FreeHandParser::sendGroup
bool sendGroup(FreeHandParserInternal::Shape const &group, MWAWTransformation const &transform)
try to send a group shape
Definition FreeHandParser.cxx:3337
FreeHandParser::readLineStyle
bool readLineStyle(int zId)
try to read a line style zone
Definition FreeHandParser.cxx:2187
FreeHandParser::readTextboxV1
bool readTextboxV1(int zId)
try to read a textbox zone: version 1
Definition FreeHandParser.cxx:2731
FreeHandParser::sendText
bool sendText(int zId)
try to send the text of a text box
Definition FreeHandParser.cxx:3523
FreeHandParser::m_state
std::shared_ptr< FreeHandParserInternal::State > m_state
the state
Definition FreeHandParser.hxx:165
FreeHandParser::sendShape
bool sendShape(FreeHandParserInternal::Shape const &shape, MWAWTransformation const &transform)
try to send a basic shape
Definition FreeHandParser.cxx:3468
FreeHandParser::readFillStyle
bool readFillStyle(int zId)
try to read a fill zone
Definition FreeHandParser.cxx:2003
FreeHandParser::init
void init()
inits all internal variables
Definition FreeHandParser.cxx:715
FreeHandParser::readBackgroundPicture
bool readBackgroundPicture(int zId)
try to read a background picture zone
Definition FreeHandParser.cxx:2404
FreeHandParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition FreeHandParser.cxx:1015
FreeHandParser::readPictureZone
bool readPictureZone(int zId)
try to read a picture node
Definition FreeHandParser.cxx:2443
FreeHandParser::sendBackgroundPicture
bool sendBackgroundPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform)
try to send a background picture
Definition FreeHandParser.cxx:3387
FreeHandParser::readGroupV1
bool readGroupV1(int zId)
try to read a group zone: version 1
Definition FreeHandParser.cxx:1309
FreeHandParser::openLayer
bool openLayer(int zId)
try to open a layer
Definition FreeHandParser.cxx:3286
FreeHandParser::readGroupV2
bool readGroupV2(int zId)
try to read a group zone: version 2
Definition FreeHandParser.cxx:1364
FreeHandParser::readShape
bool readShape(int zId)
try to read a shape
Definition FreeHandParser.cxx:2525
FreeHandParser::createZones
bool createZones()
finds the different objects zones
Definition FreeHandParser.cxx:781
FreeHandParser::FreeHandParser
FreeHandParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition FreeHandParser.cxx:704
FreeHandParser::readTextboxV2
bool readTextboxV2(int zId)
try to read a textbox zone: version 2
Definition FreeHandParser.cxx:2946
FreeHandParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition FreeHandParser.cxx:728
FreeHandParser::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition FreeHandParser.cxx:3597
FreeHandParser::~FreeHandParser
~FreeHandParser() final
destructor
Definition FreeHandParser.cxx:711
FreeHandParser::decomposeMatrix
static bool decomposeMatrix(MWAWTransformation const &matrix, float &rotation, MWAWTransformation &transform, MWAWVec2f const &center)
try to decompose the matrix in a rotation + scaling/translation matrix.
Definition FreeHandParser.cxx:3619
FreeHandParser::readPostscriptStyle
bool readPostscriptStyle(int zId)
try to read a postscript zone
Definition FreeHandParser.cxx:2332
FreeHandParser::sendTextbox
bool sendTextbox(FreeHandParserInternal::Textbox const &textbox, MWAWTransformation const &transform)
try to send a basic textbox
Definition FreeHandParser.cxx:3493
FreeHandParser::readZoneV2
bool readZoneV2(int zId)
try to read a zone: version 2
Definition FreeHandParser.cxx:943
FreeHandParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition FreeHandParser.cxx:759
FreeHandParser::readStyleHeader
bool readStyleHeader(FreeHandParserInternal::StyleHeader &style)
try to read a style header
Definition FreeHandParser.cxx:1764
FreeHandParser::readDataZone
bool readDataZone(int zId)
try to read a data zone
Definition FreeHandParser.cxx:3203
FreeHandParser::readScreenMode
bool readScreenMode(FreeHandParserInternal::ScreenMode &screen)
try to read a special scren mode
Definition FreeHandParser.cxx:1752
FreeHandParser::readStringZone
bool readStringZone(int zId)
try to read a label/font name zone
Definition FreeHandParser.cxx:1633
FreeHandParser::sendZone
bool sendZone(int zId, MWAWTransformation const &transform)
try to send a zone
Definition FreeHandParser.cxx:3311
FreeHandParser::readJoinGroup
bool readJoinGroup(int zId)
try to read a join zone (used to put text around path)
Definition FreeHandParser.cxx:1439
FreeHandParser::readZoneV1
bool readZoneV1(int zId)
try to read a zone: version 1
Definition FreeHandParser.cxx:871
FreeHandParser::readDash
bool readDash(int zId)
try to read the dash zone
Definition FreeHandParser.cxx:1946
FreeHandParser::readColor
bool readColor(int zId)
try to read a color zone
Definition FreeHandParser.cxx:1804
FreeHandParser::sendPicture
bool sendPicture(FreeHandParserInternal::Shape const &picture, MWAWTransformation const &transform)
try to send a picture
Definition FreeHandParser.cxx:3420
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
MWAWTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition libmwaw_internal.hxx:1199
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
FreeHandParserInternal
Internal: the structures of a FreeHandParser.
Definition FreeHandParser.cxx:63
librevenge
Definition MWAWDocument.hxx:57
FreeHandParserInternal::ScreenMode
struct which defines the screen parameters in FreeHandParserInternal
Definition FreeHandParser.cxx:70
FreeHandParserInternal::ShapeHeader
small structure of FreeHandParserInternal used to stored a shape header
Definition FreeHandParser.cxx:121
FreeHandParserInternal::Shape
small structure of FreeHandParserInternal used to stored a shape
Definition FreeHandParser.cxx:270
FreeHandParserInternal::State
Internal: the state of a FreeHandParser.
Definition FreeHandParser.cxx:456
FreeHandParserInternal::StyleHeader
small structure of FreeHandParserInternal used to stored a style header
Definition FreeHandParser.cxx:233
FreeHandParserInternal::Textbox
structure of FreeHandParserInternal used to stored a textbox
Definition FreeHandParser.cxx:414