summaryrefslogtreecommitdiff
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
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
-rw-r--r--include/xmloff/shapeexport.hxx4
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx4
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx8
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx4
-rw-r--r--xmloff/source/draw/shapeexport.cxx27
-rw-r--r--xmloff/source/text/txtparae.cxx2
6 files changed, 30 insertions, 19 deletions
diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx
index 134b15f52f84..71e1683c5493 100644
--- a/include/xmloff/shapeexport.hxx
+++ b/include/xmloff/shapeexport.hxx
@@ -247,11 +247,13 @@ public:
// This method collects all automatic styles for the given XShape
void collectShapeAutoStyles(
- const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape);
+ const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape,
+ sal_Int32 nShapeId = -1);
// This method exports the given XShape
void exportShape(
const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape,
+ sal_Int32 nShapeId = -1,
sal_Int32 nFeatures = SEF_DEFAULT,
com::sun::star::awt::Point* pRefPoint = NULL,
SvXMLAttributeList* pAttrList = NULL
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 27fca7f39cff..227b9d84e983 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -674,7 +674,7 @@ void ORptExport::exportReportComponentAutoStyles(const Reference<XSection>& _xPr
rtl::Reference< XMLShapeExport > xShapeExport = GetShapeExport();
xShapeExport->seekShapes(_xProp.get());
SolarMutexGuard aGuard;
- xShapeExport->collectShapeAutoStyles(xShape.get());
+ xShapeExport->collectShapeAutoStyles(xShape.get(), i);
}
else
{
@@ -1501,7 +1501,7 @@ void ORptExport::exportShapes(const Reference< XSection>& _xSection,bool _bAddPa
}
AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, XML_PARAGRAPH );
- xShapeExport->exportShape(xShape.get(),SEF_DEFAULT|SEF_EXPORT_NO_WS,&aRefPoint);
+ xShapeExport->exportShape(xShape.get(), i, SEF_DEFAULT|SEF_EXPORT_NO_WS,&aRefPoint);
}
}
}
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 22f71c99bcae..f468fca847b2 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3471,7 +3471,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
pAttrList->AddAttribute(
GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, GetXMLToken( XML_NOTIFY_ON_UPDATE_OF_RANGES ) ), sRanges );
}
- GetShapeExport()->exportShape( xShape, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList );
+ GetShapeExport()->exportShape( xShape, -1, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList );
}
}
}
@@ -3505,7 +3505,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
pAttrList->AddAttribute(
GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, GetXMLToken(XML_NOTIFY_ON_UPDATE_OF_RANGES) ), sRanges );
}
- GetShapeExport()->exportShape(xShape, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList);
+ GetShapeExport()->exportShape(xShape, -1, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList);
}
}
}
@@ -3547,7 +3547,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
// re-add pre-loaded attributes
AddAttributeList( xSaveAttribs );
}
- GetShapeExport()->exportShape(xShape, SEF_DEFAULT, pPoint);
+ GetShapeExport()->exportShape(xShape, -1, SEF_DEFAULT, pPoint);
}
IncrementProgressBar(false);
}
@@ -3717,7 +3717,7 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell)
SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress);
Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
- GetShapeExport()->exportShape(xShape, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL);
+ GetShapeExport()->exportShape(xShape, -1, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL);
pCurrentCell = NULL;
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;
}