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

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 27 01:05:32 PDT 2015


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

New commits:
commit 25b6499d1f7638cf270da98b5bdfcfc7266283ce
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 27 09:02:02 2015 +0100

    writerfilter: avoid manual realloc in StyleSheetTable
    
    Change-Id: I4dfc27cb4567146a20a4de50a04831fcd6863935

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index f50b2e8..6e8c51b 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -854,13 +854,12 @@ void StyleSheetTable::lcl_entry(int /*pos*/, writerfilter::Reference<Properties>
         // grab bag, as we can be sure that only a single style entry has
         // latent style info.
         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 = "latentStyles";
-        aGrabBag[nLength].Value = uno::makeAny(aLatentStyles);
-        xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag));
+        auto aGrabBag = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(xPropertySet->getPropertyValue("InteropGrabBag").get< uno::Sequence<beans::PropertyValue> >());
+        beans::PropertyValue aValue;
+        aValue.Name = "latentStyles";
+        aValue.Value = uno::makeAny(aLatentStyles);
+        aGrabBag.push_back(aValue);
+        xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(comphelper::containerToSequence(aGrabBag)));
     }
 
     StyleSheetEntryPtr pEmptyEntry;


More information about the Libreoffice-commits mailing list