[Libreoffice-commits] .: writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 19 05:51:19 PDT 2012


 writerfilter/source/rtftok/rtfsdrimport.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 43724668d6a31a73a2847918f740f99d59ced305
Author: Eilidh McAdam <eilidh at lanedo.com>
Date:   Wed Sep 19 09:30:47 2012 +0100

    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 at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 4eea20b..956ada1 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);


More information about the Libreoffice-commits mailing list