|
Krita Source Code Documentation
|
#include <KoShapeSavingContext.h>
Public Types | |
| enum | ShapeSavingOption { PresentationShape = 1 , DrawId = 2 , AutoStyleInStyleXml = 4 , UniqueMasterPages = 8 , ZIndex = 16 } |
| The Style used for saving the shape. More... | |
Public Member Functions | |
| void | addLayerForSaving (const KoShapeLayer *layer) |
| void | addOption (ShapeSavingOption option) |
| add an option to the set of options stored on this context, will leave the other options intact. | |
| void | addShapeOffset (const KoShape *shape, const QTransform &matrix) |
| void | addSharedData (const QString &id, KoSharedSavingData *data) |
| void | clearLayers () |
| QMap< qint64, QString > | imagesToSave () |
| bool | isSet (ShapeSavingOption option) const |
| Check if an option is set. | |
| KoShapeSavingContext (KoXmlWriter &xmlWriter) | |
| Constructor. | |
| QString | markerRef (const KoMarker *marker) |
| ShapeSavingOptions | options () const |
| Get the options used. | |
| void | removeOption (ShapeSavingOption option) |
| remove an option, will leave the other options intact. | |
| void | removeShapeOffset (const KoShape *shape) |
| void | saveLayerSet (KoXmlWriter &xmlWriter) const |
| void | setOptions (ShapeSavingOptions options) |
| Set the options to use. | |
| void | setXmlWriter (KoXmlWriter &xmlWriter) |
| Set the xml writer. | |
| QTransform | shapeOffset (const KoShape *shape) const |
| KoSharedSavingData * | sharedData (const QString &id) const |
| KoXmlWriter & | xmlWriter () |
| Get the xml writer. | |
| virtual | ~KoShapeSavingContext () |
Private Attributes | |
| KoShapeSavingContextPrivate *const | d |
The set of data for the ODF file format used during saving of a shape.
Definition at line 31 of file KoShapeSavingContext.h.
The Style used for saving the shape.
| Enumerator | |
|---|---|
| PresentationShape | If set the style of family presentation is used, when not set the family graphic is used. See OpenDocument 9.2.15 Common Drawing Shape Attributes / Style |
| DrawId | Save the draw:id used for referencing the shape. If draw:id is saved, xml:id is also saved. See OpenDocument 9.2.15 Common Drawing Shape Attributes / ID |
| AutoStyleInStyleXml | If set the automatic style will be marked as being needed in styles.xml |
| UniqueMasterPages | If set duplicate master pages will be merged to one |
| ZIndex | If set the z-index is saved in the shape |
Definition at line 35 of file KoShapeSavingContext.h.
| KoShapeSavingContext::KoShapeSavingContext | ( | KoXmlWriter & | xmlWriter | ) |
Constructor.
| xmlWriter | used for writing the xml |
| mainStyles | for saving the styles |
| embeddedSaver | for saving embedded documents |
Definition at line 61 of file KoShapeSavingContext.cpp.
References addOption(), and DrawId.
|
virtual |
| void KoShapeSavingContext::addLayerForSaving | ( | const KoShapeLayer * | layer | ) |
Adds a layer to save into a layer-set in styles.xml according to 9.1.2/9.1.3 odf spec
| layer | the layer to save |
Definition at line 109 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::layers.
| void KoShapeSavingContext::addOption | ( | ShapeSavingOption | option | ) |
add an option to the set of options stored on this context, will leave the other options intact.
Definition at line 98 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::savingOptions.
Add an offset that will be applied to the shape position when saved
This is needed e.g. for shapes anchored to a text shape as the position is saved as offset to the anchor.
| shape | The shape for which the offset should be added. |
| matrix | The offset which should be applied on saving the position. |
Definition at line 167 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::shapeOffsets.
| void KoShapeSavingContext::addSharedData | ( | const QString & | id, |
| KoSharedSavingData * | data ) |
Add shared data
This can be use to pass data between shapes on saving. E.g. The presentation page layout styles. With that e.g. the styles only need to be saved once and can be used everywhere without creating them again.
The ownership of the added data is passed to the context. The KoShapeSavingContext will delete the added data when it is destroyed.
Data inserted for a specific id will not be overwritten by calling addSharedData with the same id again.
You get an assertion when the id is already existing.
Definition at line 145 of file KoShapeSavingContext.cpp.
References d, KoShapeSavingContextPrivate::sharedData, and warnFlake.
| void KoShapeSavingContext::clearLayers | ( | ) |
remove all layers
This can be used for saving different layer sets per page.
Definition at line 130 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::layers.
| QMap< qint64, QString > KoShapeSavingContext::imagesToSave | ( | ) |
Get the images that needs to be saved to the store
Definition at line 135 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::imageNames.
| bool KoShapeSavingContext::isSet | ( | ShapeSavingOption | option | ) | const |
Check if an option is set.
Definition at line 83 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::savingOptions.
| QString KoShapeSavingContext::markerRef | ( | const KoMarker * | marker | ) |
Get the reference to use for the marker lookup
Definition at line 140 of file KoShapeSavingContext.cpp.
| KoShapeSavingContext::ShapeSavingOptions KoShapeSavingContext::options | ( | ) | const |
Get the options used.
Definition at line 93 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::savingOptions.
| void KoShapeSavingContext::removeOption | ( | ShapeSavingOption | option | ) |
remove an option, will leave the other options intact.
Definition at line 103 of file KoShapeSavingContext.cpp.
References d, isSet(), and KoShapeSavingContextPrivate::savingOptions.
Remove an offset from the saved offset list
| shape | The shape for which the offset should be removed. |
Definition at line 172 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::shapeOffsets.
| void KoShapeSavingContext::saveLayerSet | ( | KoXmlWriter & | xmlWriter | ) | const |
Saves the layers added with addLayerForSaving to the xml writer
Definition at line 115 of file KoShapeSavingContext.cpp.
References KoXmlWriter::addAttribute(), d, KoXmlWriter::endElement(), KoShape::isGeometryProtected(), KoShape::isVisible(), KoShapeSavingContextPrivate::layers, KoShape::name(), KoXmlWriter::startElement(), and xmlWriter().
| void KoShapeSavingContext::setOptions | ( | ShapeSavingOptions | options | ) |
Set the options to use.
| options | to use |
Definition at line 88 of file KoShapeSavingContext.cpp.
References d, options(), and KoShapeSavingContextPrivate::savingOptions.
| void KoShapeSavingContext::setXmlWriter | ( | KoXmlWriter & | xmlWriter | ) |
Set the xml writer.
Change the xmlWriter that is used in the Context e.g. for saving to styles.xml instead of content.xml
| xmlWriter | to use |
Definition at line 78 of file KoShapeSavingContext.cpp.
References d, KoShapeSavingContextPrivate::xmlWriter, and xmlWriter().
| QTransform KoShapeSavingContext::shapeOffset | ( | const KoShape * | shape | ) | const |
Get the offset that will be applied to the shape position when saved.
| shape | The shape for which the offset should be get. |
Definition at line 177 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::shapeOffsets.
| KoSharedSavingData * KoShapeSavingContext::sharedData | ( | const QString & | id | ) | const |
Get the shared data.
| id | The id used to identify the shared data. |
Definition at line 157 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::sharedData.
| KoXmlWriter & KoShapeSavingContext::xmlWriter | ( | ) |
Get the xml writer.
Definition at line 73 of file KoShapeSavingContext.cpp.
References d, and KoShapeSavingContextPrivate::xmlWriter.
|
private |
Definition at line 200 of file KoShapeSavingContext.h.