[Libreoffice-commits] core.git: writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Jun 30 09:45:28 PDT 2014


 writerfilter/source/rtftok/rtfsdrimport.cxx |   40 ++++++++++++++--------------
 1 file changed, 21 insertions(+), 19 deletions(-)

New commits:
commit c64a54bc3eb15809bc56c19c1f013954d9bfde7a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 30 18:38:09 2014 +0200

    Use comphelper::SequenceAsVector
    
    Change-Id: I8c0328b1bae3d2c3f327d241acf3df0c078ea4cf

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index c26999b..59fa698 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -390,21 +390,17 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         }
         else if (i->first == "pSegmentInfo")
         {
-            uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
+            comphelper::SequenceAsVector<drawing::EnhancedCustomShapeSegment> aSegments;
             sal_Int32 nSize = 0;
             sal_Int32 nCount = 0;
             sal_Int32 nCharIndex = 0;
-            sal_Int32 nIndex = 0;
             do
             {
                 sal_Int32 nSeg = i->second.getToken(0, ';', nCharIndex).toInt32();
                 if (!nSize)
                     nSize = nSeg;
                 else if (!nCount)
-                {
                     nCount = nSeg;
-                    aSegments.realloc(nCount);
-                }
                 else
                 {
                     sal_Int32 nPoints = 1;
@@ -414,23 +410,28 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
                         nSeg &= 0xFF00;
                     }
 
+                    drawing::EnhancedCustomShapeSegment aSegment;
                     switch (nSeg)
                     {
                     case 0x0001: // lineto
-                        aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO;
-                        aSegments[nIndex].Count = sal_Int32(1);
+                        aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+                        aSegment.Count = sal_Int32(1);
+                        aSegments.push_back(aSegment);
                         break;
                     case 0x4000: // moveto
-                        aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
-                        aSegments[nIndex].Count = sal_Int32(1);
+                        aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
+                        aSegment.Count = sal_Int32(1);
+                        aSegments.push_back(aSegment);
                         break;
                     case 0x2000: // curveto
-                        aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
-                        aSegments[nIndex].Count = sal_Int32(nPoints);
+                        aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
+                        aSegment.Count = sal_Int32(nPoints);
+                        aSegments.push_back(aSegment);
                         break;
                     case 0xb300: // arcto
-                        aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
-                        aSegments[nIndex].Count = sal_Int32(0);
+                        aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
+                        aSegment.Count = sal_Int32(0);
+                        aSegments.push_back(aSegment);
                         break;
                     case 0xac00:
                     case 0xaa00: // nofill
@@ -438,20 +439,21 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
                     case 0x6001: // close
                         break;
                     case 0x8000: // end
-                        aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
-                        aSegments[nIndex].Count = sal_Int32(0);
+                        aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
+                        aSegment.Count = sal_Int32(0);
+                        aSegments.push_back(aSegment);
                         break;
                     default: // given number of lineto elements
-                        aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO;
-                        aSegments[nIndex].Count = nSeg;
+                        aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO;
+                        aSegment.Count = nSeg;
+                        aSegments.push_back(aSegment);
                         break;
                     }
-                    nIndex++;
                 }
             }
             while (nCharIndex >= 0);
             aPropertyValue.Name = "Segments";
-            aPropertyValue.Value <<= aSegments;
+            aPropertyValue.Value <<= aSegments.getAsConstList();
             aPath.push_back(aPropertyValue);
         }
         else if (i->first == "geoLeft")


More information about the Libreoffice-commits mailing list