summaryrefslogtreecommitdiffstats
path: root/writerfilter
diff options
context:
space:
mode:
authorEilidh McAdam <eilidh@lanedo.com>2012-09-19 09:30:47 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-09-19 12:51:00 +0000
commit43724668d6a31a73a2847918f740f99d59ced305 (patch)
treea62da50c895b36633458b9e31d25028b7b243ce6 /writerfilter
parentofficecfg: oops, create directory first... (diff)
downloadcore-43724668d6a31a73a2847918f740f99d59ced305.tar.gz
core-43724668d6a31a73a2847918f740f99d59ced305.zip
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/646 Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 4eea20b44811..956ada1ef413 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -224,6 +224,13 @@ void RTFSdrImport::resolve(RTFShape& rShape)
}
else
{
+ sal_Int32 nPoints = 1;
+ if (nSeg >= 0x2000 && nSeg < 0x20FF)
+ {
+ nPoints = nSeg & 0x0FFF;
+ nSeg &= 0xFF00;
+ }
+
switch (nSeg)
{
case 0x0001: // lineto
@@ -234,9 +241,9 @@ void RTFSdrImport::resolve(RTFShape& rShape)
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
aSegments[nIndex].Count = sal_Int32(1);
break;
- case 0x2001: // curveto
+ case 0x2000: // curveto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
- aSegments[nIndex].Count = sal_Int32(1);
+ aSegments[nIndex].Count = sal_Int32(nPoints);
break;
case 0xb300: // arcto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
@@ -311,6 +318,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
std::vector<beans::PropertyValue> aGeomPropVec;
if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height)
{
+ aViewBox.Width -= aViewBox.X;
+ aViewBox.Height -= aViewBox.Y;
aPropertyValue.Name = "ViewBox";
aPropertyValue.Value <<= aViewBox;
aGeomPropVec.push_back(aPropertyValue);