Commit c474ba34 authored by Thorsten Zachmann's avatar Thorsten Zachmann

o save shapes in order of the z-index instead using the z-index


svn path=/trunk/koffice/; revision=740859
parent f304355b
......@@ -677,16 +677,13 @@ bool KoShape::loadOdfAttributes( const KoXmlElement & element, KoShapeLoadingCon
}
}
if ( element.hasAttributeNS( KoXmlNS::draw, "z-index" ) ) {
// TODO what do we do in case of copy/paste
setZIndex( element.attributeNS( KoXmlNS::draw, "z-index" ).toInt() );
}
else {
// TODO what do we do in the case the z-index is not there then the order in the doc
// is the the order of the z-index
context.addShapeZIndex( this, element.attributeNS( KoXmlNS::draw, "z-index" ).toInt() );
}
setZIndex( context.zIndex() );
if( element.hasAttributeNS( KoXmlNS::draw, "name" ) )
if( element.hasAttributeNS( KoXmlNS::draw, "name" ) ) {
setName( element.attributeNS( KoXmlNS::draw, "name" ) );
}
loadStyle( element, context );
}
......@@ -878,10 +875,6 @@ void KoShape::saveOdfAttributes(KoShapeSavingContext &context, int attributes) c
context.xmlWriter().addAttributePt( "svg:y", 0.0 );
}
if(attributes & OdfMandatories) {
context.xmlWriter().addAttribute("draw:z-index", d->zIndex);
}
if(attributes & OdfTransformation) {
// 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.
......
......@@ -56,8 +56,12 @@ void KoShapeGroup::saveOdf( KoShapeSavingContext & context ) const {
saveOdfAttributes(context, OdfMandatories);
context.xmlWriter().addAttributePt( "svg:y", position().y() );
foreach(KoShape* shape, iterator()) // store children.
QList<KoShape*> shapes = iterator();
qSort( shapes.begin(), shapes.end(), KoShape::compareShapeZIndex );
foreach(KoShape* shape, shapes ) {
shape->saveOdf(context);
}
saveOdfConnections(context);
context.xmlWriter().endElement();
......
......@@ -58,8 +58,12 @@ void KoShapeLayer::saveOdf( KoShapeSavingContext & context ) const {
// save later according to parag 9.1.3
context.addLayerForSaving( this );
foreach(KoShape* shape, iterator())
QList<KoShape*> shapes = iterator();
qSort( shapes.begin(), shapes.end(), KoShape::compareShapeZIndex );
foreach(KoShape* shape, shapes ) {
shape->saveOdf(context);
}
}
bool KoShapeLayer::loadOdf( const KoXmlElement & element, KoShapeLoadingContext &context ) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment