summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2015-05-28 17:22:48 +0200
committerAndras Timar <andras.timar@collabora.com>2015-05-28 21:57:09 +0200
commit03284f0ff98a02f8bdc85735cda67ca975a11034 (patch)
tree62c99cd41d4c353dfa795e36287ce1f7352a3d8e /oox
parentf8d738134d1cbbee775d68b33755239d750b5825 (diff)
DrawingML export crash fix
Change-Id: I777c6734a7f63240e9021152ecff0a86f530ff8f Reviewed-on: https://gerrit.libreoffice.org/15951 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit 62031cd02d1fbb27c2e5bc9eee2a8dd7c7c9e295)
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx34
1 files changed, 14 insertions, 20 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0600f60a65f1..0becb68bc500 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2222,18 +2222,6 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape )
}
- mpFS->startElementNS( XML_a, XML_custGeom, FSEND );
- mpFS->singleElementNS( XML_a, XML_avLst, FSEND );
- mpFS->singleElementNS( XML_a, XML_gdLst, FSEND );
- mpFS->singleElementNS( XML_a, XML_ahLst, FSEND );
- mpFS->singleElementNS( XML_a, XML_rect,
- XML_l, "l",
- XML_t, "t",
- XML_r, "r",
- XML_b, "b",
- FSEND );
-
- mpFS->startElementNS( XML_a, XML_pathLst, FSEND );
uno::Sequence< beans::PropertyValue > const * pGeometrySeq =
static_cast<uno::Sequence< beans::PropertyValue > const *>(aAny.getValue());
@@ -2251,7 +2239,6 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape )
uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aPairs;
uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
uno::Sequence<awt::Size> aPathSize;
- bool bHasSubViewSize = false;
for (int j = 0; j < aPathProp.getLength(); ++j )
{
const beans::PropertyValue& rPathProp = aPathProp[j];
@@ -2260,13 +2247,21 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape )
else if (rPathProp.Name == "Segments")
rPathProp.Value >>= aSegments;
else if (rPathProp.Name == "SubViewSize")
- {
rPathProp.Value >>= aPathSize;
- bHasSubViewSize = true;
- }
}
- if ( bHasSubViewSize )
+ if ( !aPairs.hasElements() || !aSegments.hasElements() )
+ return;
+
+ mpFS->startElementNS( XML_a, XML_custGeom, FSEND );
+ mpFS->singleElementNS( XML_a, XML_avLst, FSEND );
+ mpFS->singleElementNS( XML_a, XML_gdLst, FSEND );
+ mpFS->singleElementNS( XML_a, XML_ahLst, FSEND );
+ mpFS->singleElementNS( XML_a, XML_rect, XML_l, "l", XML_t, "t",
+ XML_r, "r", XML_b, "b", FSEND );
+ mpFS->startElementNS( XML_a, XML_pathLst, FSEND );
+
+ if ( aPathSize.hasElements() )
{
mpFS->startElementNS( XML_a, XML_path,
XML_w, I64S( aPathSize[0].Width ),
@@ -2395,13 +2390,12 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape )
}
}
mpFS->endElementNS( XML_a, XML_path );
+ mpFS->endElementNS( XML_a, XML_pathLst );
+ mpFS->endElementNS( XML_a, XML_custGeom );
}
}
}
- mpFS->endElementNS( XML_a, XML_pathLst );
-
- mpFS->endElementNS( XML_a, XML_custGeom );
}
void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon )