libs/flake
KoShapeSavingContext.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KOSHAPESAVINGCONTEXT_H
00023 #define KOSHAPESAVINGCONTEXT_H
00024
00025 #include "flake_export.h"
00026
00027 #include <QFlags>
00028 #include <QMap>
00029 #include <QSet>
00030 #include <QString>
00031 #include <QPixmap>
00032
00033 class KoShape;
00034 class KoXmlWriter;
00035 class KoGenStyles;
00036 class KoDataCenter;
00037 class KoEmbeddedDocumentSaver;
00038 class KoImageData;
00039 class KoShapeLayer;
00040 class KoStore;
00041 class KoSharedSavingData;
00042
00046 class FLAKE_EXPORT KoShapeSavingContext
00047 {
00048 public:
00049 enum SavingMode { Store, Flat };
00050
00052 enum ShapeSavingOption {
00058 PresentationShape = 1,
00063 DrawId = 2,
00067 AutoStyleInStyleXml = 4,
00071 UniqueMasterPages = 8
00072 };
00073 Q_DECLARE_FLAGS(KoShapeSavingOptions, ShapeSavingOption)
00074
00075
00082 KoShapeSavingContext(KoXmlWriter &xmlWriter, KoGenStyles& mainStyles,
00083 KoEmbeddedDocumentSaver& embeddedSaver, SavingMode savingMode = Store);
00084 virtual ~KoShapeSavingContext();
00085
00091 KoXmlWriter & xmlWriter();
00092
00101 void setXmlWriter(KoXmlWriter & xmlWriter);
00102
00108 KoGenStyles & mainStyles();
00109
00115 KoEmbeddedDocumentSaver & embeddedSaver();
00116
00122 bool isSet(ShapeSavingOption option) const;
00123
00129 void setOptions(KoShapeSavingOptions options);
00130
00132 void addOption(ShapeSavingOption option);
00133
00135 void removeOption(ShapeSavingOption option);
00136
00142 KoShapeSavingOptions options() const;
00143
00154 const QString drawId(const KoShape * shape, bool insert = true);
00155
00164 void clearDrawIds();
00165
00170 void addLayerForSaving(const KoShapeLayer * layer);
00171
00175 void saveLayerSet(KoXmlWriter & xmlWriter) const;
00176
00182 void clearLayers();
00183
00187 QString imageHref(KoImageData * image);
00188
00195 QString imageHref(QImage & image);
00196
00200 QMap<qint64, QString> imagesToSave();
00201
00205 void addDataCenter(KoDataCenter * dataCenter);
00206
00213 bool saveDataCenter(KoStore *store, KoXmlWriter* manifestWriter);
00214
00232 void addSharedData(const QString & id, KoSharedSavingData * data);
00233
00242 KoSharedSavingData * sharedData(const QString & id) const;
00243
00253 void addShapeOffset(const KoShape * shape, const QMatrix & m);
00254
00260 void removeShapeOffset(const KoShape * shape);
00261
00268 QMatrix shapeOffset(const KoShape * shape) const;
00269
00270 private:
00271 KoXmlWriter *m_xmlWriter;
00272 KoShapeSavingOptions m_savingOptions;
00273 QMap<const KoShape *, QString> m_drawIds;
00274 QList<const KoShapeLayer*> m_layers;
00275 QSet<KoDataCenter *> m_dataCenter;
00276 int m_drawId;
00277 QMap<QString, KoSharedSavingData*> m_sharedData;
00278 QMap<qint64, QString> m_imageNames;
00279 int m_imageId;
00280 QMap<QString, QImage> m_images;
00281 QHash<const KoShape *, QMatrix> m_shapeOffsets;
00282
00283 KoGenStyles& m_mainStyles;
00284 KoEmbeddedDocumentSaver& m_embeddedSaver;
00285 SavingMode m_savingMode;
00286 };
00287
00288 Q_DECLARE_OPERATORS_FOR_FLAGS(KoShapeSavingContext::KoShapeSavingOptions)
00289
00290 #endif // KOSHAPESAVINGCONTEXT_H
|