From bafe2852c3adddd17f7a274c4ebafaf290ba440c Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sat, 2 May 2015 12:01:36 +0200 Subject: writerfilter: avoid manual realloc in StyleSheetTable Change-Id: Iebfbeab422b7a0ef19981e146db0e7b7508e80c0 Reviewed-on: https://gerrit.libreoffice.org/15594 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- writerfilter/source/dmapper/StyleSheetTable.cxx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 21bb8f7a3ce0..7aba0f270003 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 xPropertySet(m_pImpl->m_xTextDocument, uno::UNO_QUERY); - uno::Sequence aGrabBag; - xPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag; - sal_Int32 nLength = aGrabBag.getLength(); - aGrabBag.realloc(nLength + 1); - aGrabBag[nLength].Name = "tableStyles"; - - uno::Sequence aTableStyles(aTableStylesVec.size()); - beans::PropertyValue* pTableStyles = aTableStyles.getArray(); - for (std::vector::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 >(aAny.get< uno::Sequence >()); + 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))); } } } -- cgit