summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2014-12-19 21:38:35 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2014-12-19 23:33:33 +0100
commit66c7dbbf7dfba8cfab63f8d1df72ace87e5bf7ca (patch)
tree817845a86fd2960e070be26dd02ec3779688c587 /xmloff
parent1cdb723b27d7359097891c7c370264c9974079db (diff)
Don't assume that the ZOrder property of shapes is an enumeration
...at least when we can easily not assume it. shapes = shapes of the same XShapes an enumeration = it is the sequence 0, 1, 2, 3, ..., XShapes->getCount()-1 We replace the ZOrder property by the index of the XShape in the XShapes (the same XShapes that is passed to seekShapes()... when that is easy to find. Else, use ZOrder and hope for the best. ZOrders are not always an enumeration. For example, in documents (forms) created by the Base forms wizard, it is not the case. The wrong assumptions was leading to the following bugs in the Base form wizard: - Only the first two controls in the form were successfully saved. The others were just dropped. - Whereas the labels had the proper style (background and text colour) applied while creating the document, these were not saved successfully Change-Id: I15b9a3ef3b16eafa9698332e35d82d51d51627f8
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx4
-rw-r--r--xmloff/source/draw/shapeexport.cxx27
-rw-r--r--xmloff/source/text/txtparae.cxx2
3 files changed, 21 insertions, 12 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 97687107705b..74ea3ba16914 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -1487,7 +1487,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >&
if( ! xShape.is())
continue;
- rShapeExport->exportShape( xShape );
+ rShapeExport->exportShape( xShape, nShapeId );
}
// this would be the easier way if it worked:
//mrExport.GetShapeExport()->exportShapes( mxAdditionalShapes );
@@ -1536,7 +1536,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >&
if( ! xShape.is())
continue;
- rShapeExport->collectShapeAutoStyles( xShape );
+ rShapeExport->collectShapeAutoStyles( xShape, nShapeId );
}
}
}
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index d13062996cad..5276afb81bd6 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -235,17 +235,21 @@ uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement
}
// This method collects all automatic styles for the given XShape
-void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape )
+void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape, sal_Int32 nZIndex)
{
if( maCurrentShapesIter == maShapesInfos.end() )
{
OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
return;
}
- sal_Int32 nZIndex = 0;
uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if( xPropSet.is() )
- xPropSet->getPropertyValue(msZIndex) >>= nZIndex;
+ if( nZIndex == -1 )
+ {
+ if( xPropSet.is() )
+ xPropSet->getPropertyValue(msZIndex) >>= nZIndex;
+ else
+ nZindex = 0;
+ }
ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
@@ -563,6 +567,7 @@ namespace
}
// This method exports the given XShape
void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape,
+ sal_Int32 nZIndex,
sal_Int32 nFeatures /* = SEF_DEFAULT */,
com::sun::star::awt::Point* pRefPoint /* = NULL */,
SvXMLAttributeList* pAttrList /* = NULL */ )
@@ -573,7 +578,6 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape
SAL_WARN( "xmloff", "XMLShapeExport::exportShape(): no auto styles where collected before export" );
return;
}
- sal_Int32 nZIndex = 0;
uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
boost::scoped_ptr< SvXMLElementExport > mpHyperlinkElement;
@@ -605,8 +609,13 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape
SAL_WARN("xmloff", "XMLShapeExport::exportShape(): exception during hyperlink export");
}
- if( xSet.is() )
- xSet->getPropertyValue(msZIndex) >>= nZIndex;
+ if( nZIndex == -1 )
+ {
+ if( xSet.is() )
+ xSet->getPropertyValue(msZIndex) >>= nZIndex;
+ else
+ nZindex = 0;
+ }
ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
@@ -953,7 +962,7 @@ void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XS
if(!xShape.is())
continue;
- collectShapeAutoStyles( xShape );
+ collectShapeAutoStyles( xShape, nShapeId );
}
maCurrentShapesIter = aOldCurrentShapesIter;
@@ -974,7 +983,7 @@ void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xS
if(!xShape.is())
continue;
- exportShape( xShape, nFeatures, pRefPoint );
+ exportShape( xShape, nShapeId, nFeatures, pRefPoint );
}
maCurrentShapesIter = aOldCurrentShapesIter;
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index b2b6772d9293..9ad98920a93a 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2874,7 +2874,7 @@ void XMLTextParagraphExport::exportAnyTextFrame(
sal_Int32 nFeatures =
addTextFrameAttributes( xPropSet, true );
GetExport().GetShapeExport()
- ->exportShape( xShape, nFeatures );
+ ->exportShape( xShape, -1, nFeatures );
}
break;
}