summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-05-02 12:01:36 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-05-02 12:39:39 +0000
commitbafe2852c3adddd17f7a274c4ebafaf290ba440c (patch)
treec9ccff7e95111dc2da2100b580108e59bb8cb8c5 /writerfilter
parent62eebc07e443fff02388539e26f583bc45c81ba3 (diff)
writerfilter: avoid manual realloc in StyleSheetTable
Change-Id: Iebfbeab422b7a0ef19981e146db0e7b7508e80c0 Reviewed-on: https://gerrit.libreoffice.org/15594 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx20
1 files changed, 7 insertions, 13 deletions
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<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)));
}
}
}