Warning, file /office/calligra/filters/karbon/xfig/XFigOdgWriter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the Calligra project, made within the KDE community.
0002 
0003    SPDX-FileCopyrightText: 2012 Friedrich W. H. Kossebau <kossebau@kde.org>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef XFIGODGWRITER_H
0009 #define XFIGODGWRITER_H
0010 
0011 // Calligra
0012 #include <KoOdfWriteStore.h>
0013 #include <KoGenStyles.h>
0014 // Qt
0015 #include <QLocale>
0016 
0017 class XFigDocument;
0018 class XFigPage;
0019 class XFigCompoundObject;
0020 class XFigEllipseObject;
0021 class XFigPolylineObject;
0022 class XFigPolygonObject;
0023 class XFigBoxObject;
0024 class XFigPictureBoxObject;
0025 class XFigSplineObject;
0026 class XFigArcObject;
0027 class XFigTextObject;
0028 class XFigAbstractGraphObject;
0029 class XFigAbstractObject;
0030 class XFigLineable;
0031 class XFigLineEndable;
0032 class XFigFillable;
0033 class XFigArrowHead;
0034 struct XFigPoint;
0035 
0036 class KoXmlWriter;
0037 class KoStore;
0038 class KoGenStyle;
0039 
0040 template<typename T> class QVector;
0041 
0042 
0043 class XFigOdgWriter
0044 {
0045 public:
0046     explicit XFigOdgWriter( KoStore* outputStore );
0047     ~XFigOdgWriter();
0048 
0049     bool write( XFigDocument* document );
0050 
0051 private:
0052     enum LineEndType { LineStart, LineEnd };
0053 
0054     void storePixelImageFiles();
0055     void storeMetaXml();
0056     void storeContentXml();
0057 
0058     void writeMasterPage();
0059 
0060     void writePage( const XFigPage* page );
0061     void writeObject( const XFigAbstractObject* object );
0062     void writeCompoundObject( const XFigCompoundObject* groupObject );
0063     void writeEllipseObject( const XFigEllipseObject* object );
0064     void writePolylineObject( const XFigPolylineObject* object );
0065     void writePolygonObject( const XFigPolygonObject* object );
0066     void writeBoxObject( const XFigBoxObject* object );
0067     void writePictureBoxObject( const XFigPictureBoxObject* object );
0068     void writeSplineObject( const XFigSplineObject* pathObject );
0069     void writeArcObject( const XFigArcObject* pathObject );
0070     void writeTextObject( const XFigTextObject* object );
0071 
0072     void writeParagraphStyle( KoGenStyle& odfStyle, const XFigTextObject* textObject );
0073     void writeFont( KoGenStyle& odfStyle, const XFigTextObject* textObject );
0074     void writeFill( KoGenStyle& odfStyle, const XFigFillable* fillable, qint32 penColorId );
0075     void writeStroke( KoGenStyle& odfStyle, const XFigLineable* lineable );
0076     void writeDotDash( KoGenStyle& odfStyle, int lineType, double distance );
0077     void writeJoinType(KoGenStyle& odfStyle, int joinType);
0078     void writeCapType( KoGenStyle& odfStyle, const XFigLineEndable* lineEndable );
0079     void writeArrow(KoGenStyle& odfStyle, const XFigArrowHead* arrow, LineEndType lineEndType);
0080     void writeHatch(KoGenStyle& odfStyle, int patternType, const QString& colorString);
0081 
0082     void writeComment(const XFigAbstractObject* object);
0083     void writePoints( const QVector<XFigPoint>& points );
0084     /// Writes z-index and sets layer name
0085     void writeZIndex( const XFigAbstractGraphObject* graphObject );
0086 
0087     /// Returns the XFig x coord as ODF x coord (in pt)
0088     double odfXCoord( qint32 x ) const;
0089     /// Returns the XFig y coord as ODF y coord (in pt)
0090     double odfYCoord( qint32 y ) const;
0091     /// Returns the XFig length as ODF length (in pt)
0092     double odfLength( qint32 length ) const;
0093     double odfLength( double length ) const;
0094 
0095 private:
0096     QLocale m_CLocale;
0097     KoOdfWriteStore m_OdfWriteStore;
0098     KoStore* m_OutputStore;
0099     KoXmlWriter* m_ManifestWriter;
0100     KoXmlWriter* m_BodyWriter;
0101 
0102     KoGenStyles m_StyleCollector;
0103     QString m_MasterPageStyleName;
0104     int m_PageCount;
0105 
0106     XFigDocument* m_Document;
0107 };
0108 
0109 #endif