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

Miklos Vajna vmiklos at collabora.co.uk
Fri May 15 00:35:00 PDT 2015


 writerfilter/source/dmapper/StyleSheetTable.cxx |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 08a2c8516bc47db322e7449fc841f3fcc5487d7e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri May 15 09:34:31 2015 +0200

    Use comphelper::sequenceToContainer
    
    Change-Id: I9df4b1e04178b99d40aa3e08297b5bc5a30a9bce

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 7aba0f2..50e9fa9 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1083,7 +1083,7 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
                         pEntry->pProperties->Insert(PROP_PARA_ADJUST, uno::makeAny( sal_Int16(style::ParagraphAdjust_LEFT) ), false);
                     }
 
-                    uno::Sequence< beans::PropertyValue > aPropValues = pEntry->pProperties->GetPropertyValues();
+                    auto aPropValues = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pEntry->pProperties->GetPropertyValues());
                     bool bAddFollowStyle = false;
                     if(bParaStyle && !pEntry->sNextStyleIdentifier.isEmpty() )
                     {
@@ -1097,12 +1097,10 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
                         const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : nullptr);
                         if ( pStyleSheetProperties )
                         {
-                            aPropValues.realloc( aPropValues.getLength( ) + 1 );
-
                             beans::PropertyValue aLvlVal( rPropNameSupplier.GetName( PROP_OUTLINE_LEVEL ), 0,
                                     uno::makeAny( sal_Int16( pStyleSheetProperties->GetOutlineLevel( ) + 1 ) ),
                                     beans::PropertyState_DIRECT_VALUE );
-                            aPropValues[ aPropValues.getLength( ) - 1 ] = aLvlVal;
+                            aPropValues.push_back(aLvlVal);
                         }
 
                         uno::Reference< beans::XPropertyState >xState( xStyle, uno::UNO_QUERY_THROW );
@@ -1139,17 +1137,17 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
                         }
                     }
 
-                    if(bAddFollowStyle || aPropValues.getLength())
+                    if(bAddFollowStyle || !aPropValues.empty())
                     {
                         PropValVector aSortedPropVals;
-                        for( sal_Int32 nProp = 0; nProp < aPropValues.getLength(); ++nProp)
+                        for (const beans::PropertyValue& rValue : aPropValues)
                         {
                             // Don't add the style name properties
-                            bool bIsParaStyleName = aPropValues[nProp].Name == "ParaStyleName";
-                            bool bIsCharStyleName = aPropValues[nProp].Name == "CharStyleName";
+                            bool bIsParaStyleName = rValue.Name == "ParaStyleName";
+                            bool bIsCharStyleName = rValue.Name == "CharStyleName";
                             if ( !bIsParaStyleName && !bIsCharStyleName )
                             {
-                                aSortedPropVals.Insert( aPropValues[nProp] );
+                                aSortedPropVals.Insert(rValue);
                             }
                         }
                         if(bAddFollowStyle)


More information about the Libreoffice-commits mailing list