diff options
-rw-r--r-- | include/oox/export/drawingml.hxx | 2 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 15 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf103389.docx | bin | 0 -> 13983 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 11 |
5 files changed, 23 insertions, 9 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index a880cd23d6c3..e9dc0a33c3fa 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -204,7 +204,7 @@ public: void WritePresetShape( const char* pShape , std::vector< std::pair<sal_Int32,sal_Int32>> & rAvList ); void WritePresetShape( const char* pShape ); void WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const css::beans::PropertyValue& rProp ); - void WriteCustomGeometry( const css::uno::Reference<css::drawing::XShape>& rXShape ); + bool WriteCustomGeometry( const css::uno::Reference<css::drawing::XShape>& rXShape ); void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon ); void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a70b8d6f1dcf..292564649e3c 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2298,23 +2298,23 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool b mpFS->endElementNS( XML_a, XML_prstGeom ); } -void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) +bool DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) { uno::Reference< beans::XPropertySet > aXPropSet; uno::Any aAny( rXShape->queryInterface(cppu::UnoType<beans::XPropertySet>::get())); if ( ! (aAny >>= aXPropSet) ) - return; + return false; try { aAny = aXPropSet->getPropertyValue( "CustomShapeGeometry" ); if ( !aAny.hasValue() ) - return; + return false; } catch( const ::uno::Exception& ) { - return; + return false; } @@ -2345,7 +2345,7 @@ void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) } if ( !aPairs.hasElements() ) - return; + return false; if ( !aSegments.hasElements() ) { @@ -2369,7 +2369,7 @@ void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) if ( nExpectedPairCount > aPairs.getLength() ) { SAL_WARN("oox", "Segments need " << nExpectedPairCount << " coordinates, but Coordinates have only " << aPairs.getLength() << " pairs."); - return; + return false; } mpFS->startElementNS( XML_a, XML_custGeom, FSEND ); @@ -2531,10 +2531,11 @@ void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) mpFS->endElementNS( XML_a, XML_path ); mpFS->endElementNS( XML_a, XML_pathLst ); mpFS->endElementNS( XML_a, XML_custGeom ); + return true; } } } - + return false; } void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon ) diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 62b8b34aa2c7..a44f2ee25b40 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -834,7 +834,9 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) else if (bCustGeom) { WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV ); - WriteCustomGeometry( xShape ); + bool bSuccess = WriteCustomGeometry( xShape ); + if (!bSuccess) + WritePresetShape( sPresetShape ); } else if (bOnBlacklist && bHasHandles && nAdjustmentValuesIndex !=-1 && !sShapeType.startsWith("mso-spt")) { diff --git a/sw/qa/extras/ooxmlexport/data/tdf103389.docx b/sw/qa/extras/ooxmlexport/data/tdf103389.docx Binary files differnew file mode 100644 index 000000000000..0ef80e6a1814 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf103389.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 18ab97e5a406..95b1c2dbf44f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -52,6 +52,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.d CPPUNIT_ASSERT_EQUAL( 3, getPages() ); } +DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + // No geometry was exported for the second canvas + // Check both canvases' geometry + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp/wps:spPr/a:prstGeom", "prst", "rect"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp/wps:spPr/a:prstGeom", "prst", "rect"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |