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

Miklos Vajna vmiklos at collabora.co.uk
Sat May 2 05:40:01 PDT 2015


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

New commits:
commit bafe2852c3adddd17f7a274c4ebafaf290ba440c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat May 2 12:01:36 2015 +0200

    writerfilter: avoid manual realloc in StyleSheetTable
    
    Change-Id: Iebfbeab422b7a0ef19981e146db0e7b7508e80c0
    Reviewed-on: https://gerrit.libreoffice.org/15594
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 21bb8f7..7aba0f2 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1222,19 +1222,13 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
             {
                 // If we had any table styles, add a new document-level InteropGrabBag entry for them.
                 uno::Reference<beans::XPropertySet> xPropertySet(m_pImpl->m_xTextDocument, uno::UNO_QUERY);
-                uno::Sequence<beans::PropertyValue> aGrabBag;
-                xPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
-                sal_Int32 nLength = aGrabBag.getLength();
-                aGrabBag.realloc(nLength + 1);
-                aGrabBag[nLength].Name = "tableStyles";
-
-                uno::Sequence<beans::PropertyValue> aTableStyles(aTableStylesVec.size());
-                beans::PropertyValue* pTableStyles = aTableStyles.getArray();
-                for (std::vector<beans::PropertyValue>::iterator i = aTableStylesVec.begin(); i != aTableStylesVec.end(); ++i)
-                    *pTableStyles++ = *i;
-
-                aGrabBag[nLength].Value = uno::makeAny(aTableStyles);
-                xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag));
+                uno::Any aAny = xPropertySet->getPropertyValue("InteropGrabBag");
+                auto aGrabBag = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aAny.get< uno::Sequence<beans::PropertyValue> >());
+                beans::PropertyValue aValue;
+                aValue.Name = "tableStyles";
+                aValue.Value = uno::makeAny(comphelper::containerToSequence(aTableStylesVec));
+                aGrabBag.push_back(aValue);
+                xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(comphelper::containerToSequence(aGrabBag)));
             }
         }
     }


More information about the Libreoffice-commits mailing list