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

Miklos Vajna vmiklos at collabora.co.uk
Sun Apr 26 05:31:23 PDT 2015


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 6cc9f9106ddea2c1e69ee6a1f7a1b64a19a0d0ba
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Apr 26 11:13:50 2015 +0200

    DomainMapper_Impl::finishParagraph: refactor to avoid manual realloc
    
    Change-Id: Ia52a2e3d6d98cfcc33a307ddcfc218a8426058dd
    Reviewed-on: https://gerrit.libreoffice.org/15538
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 48ad8a2..5188ca4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1118,24 +1118,22 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
                     lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap, rAppendContext);
                 }
             }
-            uno::Sequence< beans::PropertyValue > aProperties;
-            if( pPropertyMap.get() )
-            {
-                aProperties = pPropertyMap->GetPropertyValues();
-            }
+            std::vector<beans::PropertyValue> aProperties;
+            if (pPropertyMap.get())
+                aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues());
             if( !bIsDropCap )
             {
                 if( aDrop.Lines > 1 )
                 {
-                    sal_uInt32 nLength = aProperties.getLength();
-                    aProperties.realloc(  nLength + 1 );
-                    aProperties[nLength].Value <<= aDrop;
-                    aProperties[nLength].Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT);
+                    beans::PropertyValue aValue;
+                    aValue.Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT);
+                    aValue.Value <<= aDrop;
+                    aProperties.push_back(aValue);
                 }
                 uno::Reference< text::XTextRange > xTextRange;
                 if (rAppendContext.xInsertPosition.is())
                 {
-                    xTextRange = xTextAppend->finishParagraphInsert( aProperties, rAppendContext.xInsertPosition );
+                    xTextRange = xTextAppend->finishParagraphInsert( comphelper::containerToSequence(aProperties), rAppendContext.xInsertPosition );
                     rAppendContext.xCursor->gotoNextParagraph(false);
                     if (rAppendContext.pLastParagraphProperties.get())
                         rAppendContext.pLastParagraphProperties->SetEndingRange(xTextRange->getEnd());
@@ -1154,7 +1152,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
                         appendTextPortion(sMarker, pEmpty);
                     }
 
-                    xTextRange = xTextAppend->finishParagraph( aProperties );
+                    xTextRange = xTextAppend->finishParagraph( comphelper::containerToSequence(aProperties) );
 
                     if (xCursor.is())
                     {


More information about the Libreoffice-commits mailing list