Commit e9b4011f authored by Thomas Zander's avatar Thomas Zander

Refactor saving to account for text frames and groups/layers inheritance.

This merges the design from many months ago with what was in svn.
I also added rudementary saving in kword for testing purposes as well as a silly
tag in the TextShape.
Fixed various bugs in the saving of shape data as well.

svn path=/trunk/koffice/; revision=652406
parent d20c6305
......@@ -59,7 +59,7 @@ KoLineBorder::~KoLineBorder() {
delete d;
}
void KoLineBorder::fillStyle( KoGenStyle &style, KoShapeSavingContext &context )
void KoLineBorder::fillStyle( KoGenStyle &style, KoShapeSavingContext *context )
{
Q_UNUSED( context );
// TODO implement all possibilities
......
......@@ -80,7 +80,7 @@ public:
/// Stes the color
void setColor( const QColor & color );
virtual void fillStyle( KoGenStyle &style, KoShapeSavingContext &context );
virtual void fillStyle( KoGenStyle &style, KoShapeSavingContext *context );
virtual void borderInsets(const KoShape *shape, KoInsets &insets);
virtual bool hasTransparency();
virtual void paintBorder(KoShape *shape, QPainter &painter, const KoViewConverter &converter);
......
......@@ -587,7 +587,7 @@ public:
/**
* @brief Creates separate path shapes, one for each existing subpath.
* @param separatedPaths the list which contains the separated path shapes
* @return true if separating the path was successful, else false
* @return true if separating the path was successful, false otherwise
*/
bool separate( QList<KoPathShape*> & separatedPaths );
......
......@@ -145,92 +145,6 @@ void KoShape::paintDecorations(QPainter &painter, const KoViewConverter &convert
}*/
}
bool KoShape::saveOdf( KoShapeSavingContext & context )
{
const char * tag = odfTagName();
if ( tag[0] == '\0' )
{
kWarning(30006) << "No support for shape yet. Not saving!" << endl;
}
else
{
context.xmlWriter().startElement( tag );
context.xmlWriter().addAttribute( context.isSet( KoShapeSavingContext::PresentationShape ) ?
"presentation:style-name": "draw:style-name",
getStyle( context ) );
if ( context.isSet( KoShapeSavingContext::DrawId ) )
{
context.xmlWriter().addAttribute( "draw:id", context.drawId( this ) );
}
saveOdfData( context );
context.xmlWriter().endElement();
}
return true;
}
void KoShape::saveOdfSizeAndPosition( KoShapeSavingContext &context ) const
{
QSizeF s( size() );
context.xmlWriter().addAttributePt( "svg:width", s.width() );
context.xmlWriter().addAttributePt( "svg:height", s.height() );
if ( d->scaleX == 1 and d->scaleY == 1 && d->angle == 0 && d->shearX == 0 && d->shearY == 0 )
{
QPointF pos( position() );
context.xmlWriter().addAttributePt( "svg:x", pos.x() );
context.xmlWriter().addAttributePt( "svg:y", pos.y() );
}
else
{
// looks like position is not needed it would be svg:x="0" and svg:y="0"
// looks like OO 2.0 can not load the translation in the matrix
QString m = QString( "matrix(%1 %2 %3 %4 %5 %6)" ).arg( d->matrix.m11() ).arg( d->matrix.m12() )
.arg( d->matrix.m21() ).arg( d->matrix.m22() )
.arg( d->matrix.dx() ) .arg( d->matrix.dy() );
context.xmlWriter().addAttribute( "draw:transform", m );
}
}
QString KoShape::getStyle( KoShapeSavingContext &context )
{
KoGenStyle style;
if ( context.isSet( KoShapeSavingContext::PresentationShape ) ) {
style = KoGenStyle( KoGenStyle::STYLE_PRESENTATIONAUTO, "presentation" );
}
else {
style = KoGenStyle( KoGenStyle::STYLE_GRAPHICAUTO, "graphic" );
}
fillStyle( style, context );
if ( context.isSet( KoShapeSavingContext::AutoStyleInStyleXml ) ) {
style.setAutoStyleInStylesDotXml( true );
}
return context.mainStyles().lookup( style, context.isSet( KoShapeSavingContext::PresentationShape ) ? "pr" : "gr" );
}
void KoShape::fillStyle( KoGenStyle &style, KoShapeSavingContext &context )
{
KoShapeBorderModel * b = border();
if ( b )
{
b->fillStyle( style, context );
}
QBrush bg( background() );
switch ( bg.style() )
{
case Qt::NoBrush:
style.addProperty( "draw:fill","none" );
break;
default:
//KoOasisStyles::saveOasisFillStyle( style, context.mainStyles(), bg );
break;
}
}
void KoShape::scale( double sx, double sy )
{
if(d->scaleX == sx && d->scaleY == sy)
......@@ -591,7 +505,7 @@ void KoShape::setBackground ( const QBrush & brush ) {
d->backgroundBrush = brush;
}
const QBrush& KoShape::background () {
QBrush KoShape::background() const {
return d->backgroundBrush;
}
......@@ -686,14 +600,6 @@ QList<KoShapeConnection*> KoShape::connections() const {
return d->connections;
}
// static
void KoShape::applyConversion(QPainter &painter, const KoViewConverter &converter) {
double zoomX, zoomY;
converter.zoom(&zoomX, &zoomY);
painter.scale(zoomX, zoomY);
}
QString KoShape::name() const {
return d->name;
}
......@@ -701,3 +607,131 @@ QString KoShape::name() const {
void KoShape::setName( const QString & name ) {
d->name = name;
}
// loading & saving methods
QString KoShape::style( KoShapeSavingContext *context ) const
{
KoGenStyle style;
if ( context->isSet( KoShapeSavingContext::PresentationShape ) ) {
style = KoGenStyle( KoGenStyle::STYLE_PRESENTATIONAUTO, "presentation" );
}
else {
style = KoGenStyle( KoGenStyle::STYLE_GRAPHICAUTO, "graphic" );
}
// and fill the style
KoShapeBorderModel * b = border();
if ( b )
{
b->fillStyle( style, context );
}
QBrush bg( background() );
switch ( bg.style() )
{
case Qt::NoBrush:
style.addProperty( "draw:fill","none" );
break;
default: // TODO all the other ones.
//KoOasisStyles::saveOasisFillStyle( style, context->mainStyles(), bg );
break;
}
if ( context->isSet( KoShapeSavingContext::AutoStyleInStyleXml ) ) {
style.setAutoStyleInStylesDotXml( true );
}
return context->mainStyles().lookup( style, context->isSet( KoShapeSavingContext::PresentationShape ) ? "pr" : "gr" );
}
void KoShape::saveOdfTransformationAttributes(KoShapeSavingContext *context) const {
// just like in shapes; ODF allows you to manipulate the 'matrix' after setting an
// ofset on the shape (using the x and y positions). Lets save them here.
bool rotate = qAbs(d->angle) > 1E-6;
bool skew = qAbs(d->shearX) > 1E-6 || qAbs(d->shearY) > 1E-6;
bool scale = qAbs(d->scaleX - 1) > 1E-6 || qAbs(d->scaleY -1) > 1E-6;
if(rotate && (skew || scale)) {
QMatrix matrix; // can't use transformationMatrix() as that includes transformation of the container as well.
QSizeF size(this->size());
if ( d->angle != 0 )
{
matrix.translate( size.width() / 2.0 * d->scaleX, size.height() / 2.0 * d->scaleY );
matrix.translate( size.height() / 2.0 * d->shearX, size.width() / 2.0 * d->shearY );
matrix.rotate( d->angle );
matrix.translate( -size.width() / 2.0 * d->scaleX, -size.height() / 2.0 * d->scaleY );
matrix.translate( -size.height() / 2.0 * d->shearX, -size.width() / 2.0 * d->shearY );
}
matrix.shear( d->shearX, d->shearY );
matrix.scale( d->scaleX, d->scaleY );
QString m = QString( "matrix(0 0 %3 %4 %5pt %6pt)" ).arg( matrix.m11() ).arg( matrix.m12() )
.arg( matrix.m21() ).arg( matrix.m22() )
.arg( matrix.dx() ) .arg( matrix.dy() );
context->xmlWriter().addAttribute( "draw:transform", m );
}
else {
QString transform;
if(rotate)
transform = "rotate("+ QString::number(d->angle) +')';
if(skew)
transform = "skewX("+ QString::number(d->shearX) +") skewY("+ QString::number(d->shearY) +')';
if(scale) {
transform += "scale("+ QString::number(d->scaleX);
if(d->scaleX != d->scaleY)
transform += ','+ QString::number(d->scaleY);
transform += ')';
}
context->xmlWriter().addAttribute( "draw:transform", transform );
}
}
void KoShape::saveOdfMandatoryAttributes(KoShapeSavingContext *context) const {
context->xmlWriter().addAttribute( context->isSet( KoShapeSavingContext::PresentationShape ) ?
"presentation:style-name": "draw:style-name",
style( context ) );
if ( context->isSet( KoShapeSavingContext::DrawId ) )
{
context->xmlWriter().addAttribute( "draw:id", context->drawId( this ) );
}
QList<const char*> tags = context->xmlWriter().tagHierarchy();
tags.removeAt(tags.count()-1); // remove the last; as its the current open tag.
foreach(const char* tag, tags) {
if(QString(tag) == QString("draw:frame"))
return; // we don't store those.
}
context->xmlWriter().addAttribute("draw:z-index", zIndex());
}
void KoShape::saveOdfSizePositionAttributes(KoShapeSavingContext *context) const {
QList<const char*> tags = context->xmlWriter().tagHierarchy();
tags.removeAt(tags.count()-1); // remove the last; as its the current open tag.
foreach(const char* tag, tags) {
if(QString(tag) == QString("draw:frame"))
return; // we don't store those.
}
QSizeF s( size() );
context->xmlWriter().addAttributePt( "svg:width", s.width() );
context->xmlWriter().addAttributePt( "svg:height", s.height() );
context->xmlWriter().addAttributePt( "svg:x", d->pos.x() );
context->xmlWriter().addAttributePt( "svg:y", d->pos.y() );
}
void KoShape::saveOdfConnections(KoShapeSavingContext *context) const {
// TODO save "draw-glue-point" elements (9.2.19)
}
// end loading & saving methods
// static
void KoShape::applyConversion(QPainter &painter, const KoViewConverter &converter) {
double zoomX, zoomY;
converter.zoom(&zoomX, &zoomY);
painter.scale(zoomX, zoomY);
}
......@@ -133,29 +133,23 @@ public:
virtual void paintDecorations(QPainter &painter, const KoViewConverter &converter, const KoCanvasBase *canvas);
/**
* @brief Save the shape
*
* This is the method that will be called when saving a shape as a described in
* OpenDocument 9.2 Drawing Shapes. This method saves the common attributes of the
* drawing shapes.
* The special data for every shape is saved in @see saveOdfData().
*
* Please don't use yet as the design is not yet finished.
*
* @see saveOdfContent
* @brief store the shape data as ODF XML.
* This is the method that will be called when saving a shape as a described in¬
* OpenDocument 9.2 Drawing Shapes.
* @see saveOdfSizePositionAttributes(), saveOdfMandatoryAttributes(), saveOdfTransformationAttributes()
*/
bool saveOdf( KoShapeSavingContext & context );
virtual void saveOdf( KoShapeSavingContext * context ) { Q_UNUSED(context); } ; // = 0;
/**
* @brief Save the shape
* This method can be used while saving the shape as ODF to add the size and
* the position of a shape attributes to the current element.
*
* This is used to save a shape that is not used as a Drawing Shape, e.g.
* a text shape that is used as main part of the document as described in
* OpenDocument 2.3.1 Text Documents.
*
* Please don't use yet as the design is not yet finished.
* This also takes the transformation into account. Use in shapes which have
* Size, Position and transformation as defined in ODF 9.2.15 Common Drawing
* Shape Attributes.
* @see saveOdf()
*/
virtual bool saveOdfContext( KoShapeSavingContext & context ) { Q_UNUSED( context ); return true; }
void saveOdfSizePositionAttributes(KoShapeSavingContext *context) const;
/**
* @brief Scale the shape using the zero-point which is the top-left corner.
......@@ -298,7 +292,7 @@ public:
* will be able to tell if its transparent or not.
* @return the background-brush
*/
const QBrush& background ();
QBrush background() const;
/**
* Returns true if there is some transparency, false if the shape is fully opaque.
......@@ -569,49 +563,50 @@ public:
*/
void setName( const QString & name );
protected:
/* ** loading saving helper methods */
/**
* @brief Get the tag name used for saving
*
* Get the name of the tag used for saving drawing shape
* This method can be used while saving the shape as ODF to add the size and
* the position of a shape attributes to the current element.
*
* This will be a pure virtual function once all shapes implemented it.
*
* @return the name of the tag
*
* @see saveOdf()
* This also takes the transformation into account. Use in shapes which have
* Size & Position as defined in ODF 9.2.15 Common Drawing
* Shape Attributes.
* @see saveOdf, saveOdfMandatoryAttributes(), style(), saveOdfSizePositionAttributes()
*/
virtual const char * odfTagName() const { return ""; }
void saveOdfTransformationAttributes(KoShapeSavingContext *context) const;
/**
* @brief Save the data that is special by each shape
* This method can be used while saving the shape as ODF to add the mandatory
* attributes to the current element.
*
* This will be a pure virtual function once all shapes implemented it.
*
* @return true if successful, false otherwise
*
* @see saveOdf()
* The following attributes will be added; ID, Z-Index, Layer and Style
* as defined in ODF 9.2.15 Common Drawing Shape Attributes.
* @see saveOdf, saveOdfTransformationAttributes(), style(), saveOdfSizePositionAttributes()
*/
virtual bool saveOdfData( KoShapeSavingContext &context ) const { Q_UNUSED( context ); return true; }
void saveOdfMandatoryAttributes(KoShapeSavingContext *context) const;
/**
* @brief Save the size and the position of a shape
*
* This also takes the transformation into account. Use in shapes which have
* Size, Position and transformation as defined in ODF 9.2.15 Common Drawing
* Shape Attributes.
* Add a new draw-glue-point element for each connections() present on this shape.
*/
void saveOdfSizeAndPosition( KoShapeSavingContext &context ) const;
void saveOdfConnections(KoShapeSavingContext *context) const;
/**
* @brief Fill the style object
* @brief Get the style used for the shape
*
* @param style object
* @param context used for saving
* This method calls fillStyle and add then the style to the context
*
* @see saveOdf()
* @param context used for saving
* @return the name of the style
* @see saveOdf
*/
void fillStyle( KoGenStyle &style, KoShapeSavingContext &context );
QString style( KoShapeSavingContext *context ) const;
/* ** end loading saving */
/**
* Update the position of the shape in the tree of the KoShapeManager.
......@@ -654,16 +649,6 @@ protected:
void removeConnection(KoShapeConnection *connection);
private:
/**
* @brief Get the style used for the shape
*
* This method calls fillStyle and add then the style to the context
*
* @param context used for saving
* @return the name of the style
*/
QString getStyle( KoShapeSavingContext &context );
friend class KoShapeManager;
void addShapeManager( KoShapeManager * manager );
void removeShapeManager( KoShapeManager * manager );
......
......@@ -51,7 +51,7 @@ public:
* @param style object
* @param context used for saving
*/
virtual void fillStyle( KoGenStyle &style, KoShapeSavingContext &context ) = 0;
virtual void fillStyle( KoGenStyle &style, KoShapeSavingContext *context ) = 0;
/**
* Return a new borderInsets object filled with the size around the shape that this
......
......@@ -20,6 +20,8 @@
#include "KoShapeGroup.h"
#include "KoShapeContainerModel.h"
#include "SimpleShapeContainerModel.h"
#include "KoShapeSavingContext.h"
#include "KoXmlWriter.h"
KoShapeGroup::KoShapeGroup()
: KoShapeContainer(new SimpleShapeContainerModel())
......@@ -41,3 +43,15 @@ void KoShapeGroup::childCountChanged() {
setPosition( br.topLeft() );
resize( br.size() );
}
void KoShapeGroup::saveOdf( KoShapeSavingContext * context ) {
context->xmlWriter().startElement( "draw:g" );
saveOdfMandatoryAttributes(context);
context->xmlWriter().addAttributePt( "svg:y", position().y() );
foreach(KoShape* shape, iterator()) // store children.
shape->saveOdf(context);
saveOdfConnections(context);
context->xmlWriter().endElement();
}
......@@ -47,6 +47,8 @@ public:
void paintComponent(QPainter &painter, const KoViewConverter &converter);
/// always returns false since the group itself can't be selected or hit
bool hitTest( const QPointF &position ) const;
/// reimplemented from KoShape
virtual void saveOdf( KoShapeSavingContext * context );
private:
......
......@@ -19,6 +19,8 @@
#include "KoShapeLayer.h"
#include "SimpleShapeContainerModel.h"
#include "KoShapeSavingContext.h"
#include "KoXmlWriter.h"
KoShapeLayer::KoShapeLayer()
: KoShapeContainer(new SimpleShapeContainerModel())
......@@ -46,3 +48,15 @@ QRectF KoShapeLayer::boundingRect() const
return bb;
}
void KoShapeLayer::saveOdf( KoShapeSavingContext * context ) {
// save according to parag 9.1.3
context->xmlWriter().startElement( "draw:layer" );
context->xmlWriter().startElement( "svg:title" );
context->xmlWriter().addTextNode(name());
context->xmlWriter().endElement();
context->xmlWriter().endElement();
foreach(KoShape* shape, iterator())
shape->saveOdf(context);
}
......@@ -40,6 +40,8 @@ public:
virtual void paintComponent(QPainter &, const KoViewConverter &) {}
bool hitTest( const QPointF &position ) const;
virtual QRectF boundingRect() const;
/// reimplemented from KoShape
virtual void saveOdf( KoShapeSavingContext * context );
};
#endif // __KOSHAPELAYER_H__
......
......@@ -65,9 +65,9 @@ KoShapeSavingContext::KoShapeSavingOptions KoShapeSavingContext::options() const
return m_savingOptions;
}
const QString KoShapeSavingContext::drawId( KoShape * shape, bool insert )
const QString KoShapeSavingContext::drawId( const KoShape * shape, bool insert )
{
QMap<KoShape *, QString>::const_iterator it( m_drawIds.find( shape ) );
QMap<const KoShape *, QString>::const_iterator it( m_drawIds.find( shape ) );
if ( it == m_drawIds.constEnd() && insert == true )
{
it = m_drawIds.insert( shape, QString( "shape" ).arg( ++m_drawId ) );
......
......@@ -18,8 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPESAVEINGCONTEXT_H
#define KOSHAPESAVEINGCONTEXT_H
#ifndef KOSHAPESAVINGCONTEXT_H
#define KOSHAPESAVINGCONTEXT_H
#include <flake_export.h>
......@@ -41,13 +41,13 @@ public:
/// The Style used for saving the shape
enum KoShapeSavingOption
{
/**
* If set the style of family peresentation is used, when not set the
/**
* 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
*/
PresentationShape = 1,
/**
PresentationShape = 1,
/**
* Save the draw:id used for referencing the shape.
* See OpenDocument 9.2.15 Common Drawing Shape Attributes / ID
*/
......@@ -122,19 +122,19 @@ public:
*
* @return the draw id for the shape or and empty string if it was not found
*/
const QString drawId( KoShape * shape, bool insert = true );
const QString drawId( const KoShape * shape, bool insert = true );
protected:
protected:
KoXmlWriter *m_xmlWriter;
KoSavingContext &m_context;
KoShapeSavingOptions m_savingOptions;
QMap<KoShape *, QString> m_drawIds;
QMap<const KoShape *, QString> m_drawIds;
int m_drawId;
// TODO handle realtive positions
// TODO handle relative positions
};
Q_DECLARE_OPERATORS_FOR_FLAGS( KoShapeSavingContext::KoShapeSavingOptions )
#endif // KOSHAPESAVEINGCONTEXT_H
#endif // KOSHAPESAVINGCONTEXT_H
......@@ -2,7 +2,7 @@
*
* Copyright (c) 2005-2006 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......
......@@ -114,7 +114,7 @@ bool KoPADocument::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
// save master pages
foreach( KoPAPageBase *page, m_masterPages )
{
page->saveOdf( paContext );
page->saveOdf( &paContext );
}
masterStylesTmpWriter.endElement();
......@@ -134,7 +134,7 @@ bool KoPADocument::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
// save pages
foreach ( KoPAPageBase *page, m_pages )
{
page->saveOdf( paContext );
page->saveOdf( &paContext );
paContext.incrementPage();
}
......
......@@ -34,15 +34,15 @@ KoPAMasterPage::~KoPAMasterPage()
{
}
void KoPAMasterPage::createOdfPageTag( KoPASavingContext &paContext ) const
void KoPAMasterPage::createOdfPageTag( KoPASavingContext *paContext ) const
{
KoGenStyle pageLayoutStyle = pageLayout().saveOasis();
pageLayoutStyle.setAutoStyleInStylesDotXml( true );
pageLayoutStyle.addAttribute( "style:page-usage", "all" );
QString pageLayoutName( paContext.mainStyles().lookup( pageLayoutStyle, "pm" ) );
QString pageLayoutName( paContext->mainStyles().lookup( pageLayoutStyle, "pm" ) );
paContext.xmlWriter().startElement( "style:master-page" );
paContext.xmlWriter().addAttribute( "style:name", "Standard" ); //TODO
paContext.addMasterPage( this, "Standard" );
paContext.xmlWriter().addAttribute( "style:page-layout-name", pageLayoutName );
paContext->xmlWriter().startElement( "style:master-page" );
paContext->xmlWriter().addAttribute( "style:name", "Standard" ); //TODO
paContext->addMasterPage( this, "Standard" );
paContext->xmlWriter().addAttribute( "style:page-layout-name", pageLayoutName );
}
......@@ -40,7 +40,7 @@ public:
void setPageLayout(const KoPageLayout& layout) { m_pageLayout = layout; }
protected:
virtual void createOdfPageTag( KoPASavingContext &paContext ) const;
virtual void createOdfPageTag( KoPASavingContext *paContext ) const;
KoPageLayout m_pageLayout;
};
......
......@@ -41,9 +41,9 @@ KoPageLayout & KoPAPage::pageLayout()
return m_masterPage->pageLayout();
}
void KoPAPage::createOdfPageTag( KoPASavingContext &paContext ) const
void KoPAPage::createOdfPageTag( KoPASavingContext *paContext ) const
{
paContext.xmlWriter().startElement( "draw:page" );
paContext.xmlWriter().addAttribute( "draw:id", "page" + QString::number( paContext.page() ) );
paContext.xmlWriter().addAttribute( "draw:master-page-name", paContext.masterPageName( m_masterPage ) );
paContext->xmlWriter().startElement( "draw:page" );
paContext->xmlWriter().addAttribute( "draw:id", "page" + QString::number( paContext->page() ) );
paContext->xmlWriter().addAttribute( "draw:master-page-name", paContext->masterPageName( m_masterPage ) );
}
......@@ -42,7 +42,7 @@ public:
/// @return the masterpage of this page
KoPAMasterPage * masterPage() { return m_masterPage; }
protected:
virtual void createOdfPageTag( KoPASavingContext &paContext ) const;
virtual void createOdfPageTag( KoPASavingContext *paContext ) const;
KoPAMasterPage * m_masterPage;
};
......
......@@ -18,11 +18,12 @@
*/
#include "KoPAPageBase.h"
#include "KoPASavingContext.h"
#include <QDebug>
#include <KoShapeLayer.h>
#include <KoShapeSavingContext.h>
#include <KoShapeLayer.h>
#include <KoGenStyle.h>
#include <KoGenStyles.h>
#include <KoOasisStyles.h>
......@@ -60,21 +61,21 @@ void KoPAPageBase::paintComponent(QPainter& painter, const KoViewConverter& conv
Q_UNUSED(converter);
}
bool KoPAPageBase::saveOdf( KoPASavingContext &paContext ) const
void KoPAPageBase::saveOdf( KoShapeSavingContext * context )
{
KoPASavingContext *paContext = static_cast<KoPASavingContext*>(context);
createOdfPageTag( paContext );
paContext.xmlWriter().addAttribute( "draw:style-name", saveOdfPageStyle( paContext ) );
paContext->xmlWriter().addAttribute( "draw:style-name", saveOdfPageStyle( paContext ) );
saveOdfShapes( paContext );
saveOdfAnimations( paContext );
saveOdfPresentationNotes();
paContext.xmlWriter().endElement(); //draw:page
return true;
paContext->xmlWriter().endElement(); //draw:page
}
bool KoPAPageBase::saveOdfShapes( KoPASavingContext &paContext ) const
void KoPAPageBase::saveOdfShapes( KoPASavingContext *paContext ) const
{
QList<KoShape*> shapes( iterator() );
QList<KoShape*> tlshapes;
......@@ -96,28 +97,26 @@ bool KoPAPageBase::saveOdfShapes( KoPASavingContext &paContext ) const
foreach( KoShape *shape, tlshapes ) {
shape->saveOdf( paContext );
}
return true;
}
QString KoPAPageBase::saveOdfPageStyle( KoPASavingContext &paContext ) const
QString KoPAPageBase::saveOdfPageStyle( KoPASavingContext *paContext ) const
{
KoGenStyle style( KoPAStyles::STYLE_PAGE, "drawing-page" );