Kaydet (Commit) de7d596d authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Thorsten Behrens

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
üst 64e11139
...@@ -2055,6 +2055,56 @@ void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XA ...@@ -2055,6 +2055,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 ) if ( bApplySVGD )
{ {
assert(maPath.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get()); assert(maPath.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment