summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2016-07-01 14:30:00 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2016-07-07 22:32:38 +0200
commitde7d596d116b5231bff000a57be3fae481744bab (patch)
treeba4d061f8d0263cca2339d2f7eee91d19cec091c /xmloff
parent64e1113916a6b19b30f95b454018528571ac84df (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
Diffstat (limited to 'xmloff')
-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);
}