libs/flake

KoShapeSavingContext Class Reference

The set of data for the ODF file format used during saving of a shape. More...

#include <KoShapeSavingContext.h>

List of all members.

Public Types

enum  SavingMode { Store, Flat }
enum  ShapeSavingOption { PresentationShape = 1, DrawId = 2, AutoStyleInStyleXml = 4, UniqueMasterPages = 8 }

Public Member Functions

 KoShapeSavingContext (KoXmlWriter &xmlWriter, KoGenStyles &mainStyles, KoEmbeddedDocumentSaver &embeddedSaver, SavingMode savingMode=Store)
virtual ~KoShapeSavingContext ()
void addDataCenter (KoDataCenter *dataCenter)
void addLayerForSaving (const KoShapeLayer *layer)
void addOption (ShapeSavingOption option)
void addShapeOffset (const KoShape *shape, const QMatrix &m)
void addSharedData (const QString &id, KoSharedSavingData *data)
void clearDrawIds ()
void clearLayers ()
const QString drawId (const KoShape *shape, bool insert=true)
KoEmbeddedDocumentSaver & embeddedSaver ()
QString imageHref (QImage &image)
QString imageHref (KoImageData *image)
QMap< qint64, QStringimagesToSave ()
bool isSet (ShapeSavingOption option) const
KoGenStyles & mainStyles ()
KoShapeSavingOptions options () const
void removeOption (ShapeSavingOption option)
void removeShapeOffset (const KoShape *shape)
bool saveDataCenter (KoStore *store, KoXmlWriter *manifestWriter)
void saveLayerSet (KoXmlWriter &xmlWriter) const
void setOptions (KoShapeSavingOptions options)
void setXmlWriter (KoXmlWriter &xmlWriter)
QMatrix shapeOffset (const KoShape *shape) const
KoSharedSavingDatasharedData (const QString &id) const
KoXmlWriter & xmlWriter ()

Detailed Description

The set of data for the ODF file format used during saving of a shape.

Definition at line 46 of file KoShapeSavingContext.h.


Member Enumeration Documentation

Enumerator:
Store 
Flat 

Definition at line 49 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.

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.

Definition at line 52 of file KoShapeSavingContext.h.


Constructor & Destructor Documentation

KoShapeSavingContext::KoShapeSavingContext ( KoXmlWriter &  xmlWriter,
KoGenStyles &  mainStyles,
KoEmbeddedDocumentSaver &  embeddedSaver,
SavingMode  savingMode = Store 
)

Constructor.

Parameters:
xmlWriter used for writing the xml
mainStyles for saving the styles
embeddedSaver for saving embedded documents
savingMode either Store (a KoStore will be used) or Flat (all data must be inline in the XML)

Definition at line 37 of file KoShapeSavingContext.cpp.

KoShapeSavingContext::~KoShapeSavingContext (  )  [virtual]

Definition at line 51 of file KoShapeSavingContext.cpp.


Member Function Documentation

void KoShapeSavingContext::addDataCenter ( KoDataCenter dataCenter  ) 

Add data center.

Definition at line 176 of file KoShapeSavingContext.cpp.

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.

Parameters:
layer the layer to save

Definition at line 120 of file KoShapeSavingContext.cpp.

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 90 of file KoShapeSavingContext.cpp.

void KoShapeSavingContext::addShapeOffset ( const KoShape shape,
const QMatrix m 
)

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.

Parameters:
shape The shape for which the offset should be added.
m The offset which should be applied on saving the position.

Definition at line 232 of file KoShapeSavingContext.cpp.

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.

See also:
KoSharedSavingData

Definition at line 210 of file KoShapeSavingContext.cpp.

void KoShapeSavingContext::clearDrawIds (  ) 

Clear out all given draw ids.

This is needed for checking if master pages are the same. In normal saving this should not be called.

See also:
KoPAPastePage::process

Definition at line 114 of file KoShapeSavingContext.cpp.

void KoShapeSavingContext::clearLayers (  ) 

remove all layers

This can be used for saving different layer sets per page.

Definition at line 141 of file KoShapeSavingContext.cpp.

const QString KoShapeSavingContext::drawId ( const KoShape shape,
bool  insert = true 
)

Get the draw id for a shape.

The draw:id is unique for all shapes.

Parameters:
shape for which the draw id should be returned
insert if true a new draw id will be generated if there is non yet
Returns:
the draw id for the shape or and empty string if it was not found

Definition at line 101 of file KoShapeSavingContext.cpp.

KoEmbeddedDocumentSaver & KoShapeSavingContext::embeddedSaver (  ) 

Get the embedded document saver.

Returns:
embedded document saver

Definition at line 70 of file KoShapeSavingContext.cpp.

QString KoShapeSavingContext::imageHref ( QImage image  ) 

Get the image href under which the image will be save in the store.

This should only be used for temporary images that are onle there during saving, e.g. a pixmap representation of a draw:frame

Definition at line 161 of file KoShapeSavingContext.cpp.

QString KoShapeSavingContext::imageHref ( KoImageData image  ) 

Get the image href under which the image will be saved in the store.

Definition at line 146 of file KoShapeSavingContext.cpp.

QMap< qint64, QString > KoShapeSavingContext::imagesToSave (  ) 

Get the images that needs to be saved to the store.

Definition at line 171 of file KoShapeSavingContext.cpp.

bool KoShapeSavingContext::isSet ( ShapeSavingOption  option  )  const

Check if an option is set.

Returns:
ture if the option is set, false otherwise

Definition at line 75 of file KoShapeSavingContext.cpp.

KoGenStyles & KoShapeSavingContext::mainStyles (  ) 

Get the main styles.

Returns:
main styles

Definition at line 65 of file KoShapeSavingContext.cpp.

KoShapeSavingContext::KoShapeSavingOptions KoShapeSavingContext::options (  )  const

Get the options used.

Returns:
options used

Definition at line 85 of file KoShapeSavingContext.cpp.

void KoShapeSavingContext::removeOption ( ShapeSavingOption  option  ) 

remove an option, will leave the other options intact.

Definition at line 95 of file KoShapeSavingContext.cpp.

void KoShapeSavingContext::removeShapeOffset ( const KoShape shape  ) 

Remove an offset from the saved offset list.

Parameters:
shape The shape for which the offset should be removed.

Definition at line 237 of file KoShapeSavingContext.cpp.

bool KoShapeSavingContext::saveDataCenter ( KoStore *  store,
KoXmlWriter *  manifestWriter 
)

Save the data centers.

This calls KoDataCenter::completeSaving()

Returns:
false if an error occurred, which typically cancels the save.

Definition at line 181 of file KoShapeSavingContext.cpp.

void KoShapeSavingContext::saveLayerSet ( KoXmlWriter &  xmlWriter  )  const

Saves the layers added with addLayerForSaving to the xml writer.

Definition at line 126 of file KoShapeSavingContext.cpp.

void KoShapeSavingContext::setOptions ( KoShapeSavingOptions  options  ) 

Set the options to use.

Parameters:
options to use

Definition at line 80 of file KoShapeSavingContext.cpp.

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

Parameters:
xmlWriter to use

Definition at line 60 of file KoShapeSavingContext.cpp.

QMatrix KoShapeSavingContext::shapeOffset ( const KoShape shape  )  const

Get the offest that will be applied to the shape position when saved.

Parameters:
shape The shape for which the offset should be get.
Returns:
the saved offset or QMatrix() when offset is not set.

Definition at line 242 of file KoShapeSavingContext.cpp.

KoSharedSavingData * KoShapeSavingContext::sharedData ( const QString id  )  const

Get the shared data.

See also:
KoSharedLoadingData
Parameters:
id The id used to identify the shared data.
Returns:
The shared data for the id or 0 if there is no shared data for the id.

Definition at line 222 of file KoShapeSavingContext.cpp.

KoXmlWriter & KoShapeSavingContext::xmlWriter (  ) 

Get the xml writer.

Returns:
xmlWriter

Definition at line 55 of file KoShapeSavingContext.cpp.


The documentation for this class was generated from the following files: