Kaydet (Commit) 43724668 authored tarafından Eilidh McAdam's avatar Eilidh McAdam Kaydeden (comit) Miklos Vajna

Correctly import multiple-point curves from RTF document.

The RTF segment specifier seems to indicate the type of segment with
the first two bytes and how many points the specifier applies to with
the last two bytes. Note that without further test docs, this
hypothesis is yet to be thoroughly tested.

Change-Id: I6f85435f52ef244b9c417e67d54c236ef4c7f149
Reviewed-on: https://gerrit.libreoffice.org/646Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst eb98aa29
...@@ -224,6 +224,13 @@ void RTFSdrImport::resolve(RTFShape& rShape) ...@@ -224,6 +224,13 @@ void RTFSdrImport::resolve(RTFShape& rShape)
} }
else else
{ {
sal_Int32 nPoints = 1;
if (nSeg >= 0x2000 && nSeg < 0x20FF)
{
nPoints = nSeg & 0x0FFF;
nSeg &= 0xFF00;
}
switch (nSeg) switch (nSeg)
{ {
case 0x0001: // lineto case 0x0001: // lineto
...@@ -234,9 +241,9 @@ void RTFSdrImport::resolve(RTFShape& rShape) ...@@ -234,9 +241,9 @@ void RTFSdrImport::resolve(RTFShape& rShape)
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO; aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
aSegments[nIndex].Count = sal_Int32(1); aSegments[nIndex].Count = sal_Int32(1);
break; break;
case 0x2001: // curveto case 0x2000: // curveto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO; aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
aSegments[nIndex].Count = sal_Int32(1); aSegments[nIndex].Count = sal_Int32(nPoints);
break; break;
case 0xb300: // arcto case 0xb300: // arcto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO; aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
...@@ -311,6 +318,8 @@ void RTFSdrImport::resolve(RTFShape& rShape) ...@@ -311,6 +318,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
std::vector<beans::PropertyValue> aGeomPropVec; std::vector<beans::PropertyValue> aGeomPropVec;
if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height) if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height)
{ {
aViewBox.Width -= aViewBox.X;
aViewBox.Height -= aViewBox.Y;
aPropertyValue.Name = "ViewBox"; aPropertyValue.Name = "ViewBox";
aPropertyValue.Value <<= aViewBox; aPropertyValue.Value <<= aViewBox;
aGeomPropVec.push_back(aPropertyValue); aGeomPropVec.push_back(aPropertyValue);
......
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