summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2016-07-01 14:30:00 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2016-07-07 15:08:11 +0200
commit0053e78907f90351b8d2cf75f9d6e2fab9184a01 (patch)
tree0f19fb4c5718ec48d41bce0e91660aa4cafd5e69
parent94a71e84ae39019daf786e8aa33cc41a2c239b99 (diff)
tdf#83360 avoid inconsistent connector path data
When loading/importing connectors from ODF format, use the available path data _only_ if the redundant data of start and end point coordinates of path start/end and connector start/end is equal. This is to avoid using errorneous or inconsistent path data at import of foreign formats. LibO itself always writes out a consistent data set. Not using it when there is inconsistency is okay since the path data is completely redundant, just to avoid recalculation of the connector's layout at load time, no real information would be lost. A 'connected' end has prio to direct coordinate data in Start/EndPosition to the path data. Change-Id: Id5aff0889e1e61112b6185f2384b7922f90a16a9
-rw-r--r--xmloff/source/draw/ximpshap.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 575ed11ae0be..96a64c666282 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2057,6 +2057,56 @@ void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XA
if ( bApplySVGD )
{
+ // tdf#83360 use path data only when redundant data of start and end point coordinates of
+ // path start/end and connector start/end is equal. This is to avoid using erraneous
+ // or inconsistent path data at import of foreign formats. Office itself always
+ // writes out a consistent data set. Not using it when there is inconsistency
+ // is okay since the path data is redundant, buffered data just to avoid recalculation
+ // of the connector's layout at load time, no real information would be lost.
+ // A 'connected' end has prio to direct coordinate data in Start/EndPosition
+ // to the path data (which should have the start/end redundant in the path)
+ const drawing::PolyPolygonBezierCoords* pSource = static_cast< const drawing::PolyPolygonBezierCoords* >(maPath.getValue());
+ const sal_uInt32 nSequenceCount(pSource->Coordinates.getLength());
+ bool bStartEqual(false);
+ bool bEndEqual(false);
+
+ if(nSequenceCount)
+ {
+ const drawing::PointSequence& rStartSeq = pSource->Coordinates[0];
+ const sal_uInt32 nStartCount = rStartSeq.getLength();
+
+ if(nStartCount)
+ {
+ const awt::Point& rStartPoint = rStartSeq.getConstArray()[0];
+
+ if(rStartPoint.X == maStart.X && rStartPoint.Y == maStart.Y)
+ {
+ bStartEqual = true;
+ }
+ }
+
+ const drawing::PointSequence& rEndSeq = pSource->Coordinates[nSequenceCount - 1];
+ const sal_uInt32 nEndCount = rEndSeq.getLength();
+
+ if(nEndCount)
+ {
+ const awt::Point& rEndPoint = rEndSeq.getConstArray()[nEndCount - 1];
+
+ if(rEndPoint.X == maEnd.X && rEndPoint.Y == maEnd.Y)
+ {
+ bEndEqual = true;
+ }
+ }
+ }
+
+ if(!bStartEqual || !bEndEqual)
+ {
+ bApplySVGD = false;
+ }
+ }
+
+ if ( bApplySVGD )
+ {
assert(maPath.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get());
xProps->setPropertyValue("PolyPolygonBezier", maPath);
}