/* libvisio * Copyright (C) 2011 Fridrich Strba * Copyright (C) 2011 Eilidh McAdam * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA */ #ifndef VSDXCONTENTCOLLECTOR_H #define VSDXCONTENTCOLLECTOR_H #include #include #include #include #include #include #include #include #include "libvisio_utils.h" #include "VSDXCollector.h" #include "VSDXParser.h" #include "VSDXOutputElementList.h" namespace libvisio { class VSDXContentCollector : public VSDXCollector { public: VSDXContentCollector( libwpg::WPGPaintInterface *painter, std::vector > &groupXFormsSequence, std::vector > &groupMembershipsSequence, std::vector > &documentPageShapeOrders ); virtual ~VSDXContentCollector() {}; void collectEllipticalArcTo(unsigned id, unsigned level, double x3, double y3, double x2, double y2, double angle, double ecc); void collectForeignData(unsigned id, unsigned level, const WPXBinaryData &binaryData); void collectEllipse(unsigned id, unsigned level, double cx, double cy, double xleft, double yleft, double xtop, double ytop); void collectLine(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned linePattern, unsigned lineCap); void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG, unsigned fillPattern, unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc, double shadowOffsetX, double shadowOffsetY); void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG, unsigned fillPattern, unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc); void collectGeomList(unsigned id, unsigned level); void collectGeometry(unsigned id, unsigned level, unsigned geomFlags); void collectMoveTo(unsigned id, unsigned level, double x, double y); void collectLineTo(unsigned id, unsigned level, double x, double y); void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow); void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned xType, unsigned yType, unsigned degree, std::vector > controlPoints, std::vector knotVector, std::vector weights); void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID); void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned xType, unsigned yType, std::vector > &points); void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned dataID); void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, unsigned degree, double lastKnot, std::vector > controlPoints, std::vector knotVector, std::vector weights); void collectShapeData(unsigned id, unsigned level, unsigned xType, unsigned yType, std::vector > points); void collectXFormData(unsigned id, unsigned level, const XForm &xform); void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform); void collectShapeId(unsigned id, unsigned level, unsigned shapeId); void collectShapeList(unsigned id, unsigned level); void collectForeignDataType(unsigned id, unsigned level, unsigned foreignType, unsigned foreignFormat); void collectPageProps(unsigned id, unsigned level, double pageWidth, double pageHeight, double shadowOffsetX, double shadowOffsetY); void collectShape(unsigned id, unsigned level); void collectUnhandledChunk(unsigned id, unsigned level); void collectColours(const std::vector &colours); void collectCharList(unsigned id, unsigned level); void collectText(unsigned id, unsigned level, const WPXString &text); void startPage(); void endPage(); private: VSDXContentCollector(const VSDXContentCollector&); VSDXContentCollector& operator=(const VSDXContentCollector&); libwpg::WPGPaintInterface *m_painter; void transformPoint(double &x, double &y); void transformAngle(double &angle); double _NURBSBasis(unsigned knot, unsigned degree, double point, const std::vector &knotVector); void _flushCurrentPath(); void _flushCurrentForeignData(); void _flushCurrentPage(); const ::WPXString getColourString(const Colour& c) const; void _handleLevelChange(unsigned level); bool m_isPageStarted; double m_pageWidth; double m_pageHeight; double m_shadowOffsetX; double m_shadowOffsetY; double m_scale; double m_x; double m_y; double m_originalX; double m_originalY; XForm m_xform; XForm m_txtxform; std::vector m_currentGeometry; std::map &m_groupXForms; WPXBinaryData m_currentForeignData; WPXPropertyList m_currentForeignProps; unsigned m_currentShapeId; unsigned m_foreignType; unsigned m_foreignFormat; WPXPropertyList m_styleProps; ::WPXString m_lineColour; ::WPXString m_fillType; unsigned m_linePattern; unsigned m_fillPattern; unsigned m_fillFGTransparency; unsigned m_fillBGTransparency; bool m_noLine; bool m_noFill; bool m_noShow; std::vector m_colours; unsigned m_currentLevel; bool m_isShapeStarted; std::map &m_groupMemberships; std::vector > &m_groupXFormsSequence; std::vector > &m_groupMembershipsSequence; unsigned m_currentPageNumber; std::vector m_shapeList; VSDXOutputElementList *m_shapeOutput; std::map m_pageOutput; std::vector > &m_documentPageShapeOrders; std::list &m_pageShapeOrder; bool m_isFirstGeometry; std::map m_NURBSData; std::map m_polylineData; }; } // namespace libvisio #endif /* VSDXCONTENTCOLLECTOR_H */