Kaydet (Commit) bafe2852 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: avoid manual realloc in StyleSheetTable

Change-Id: Iebfbeab422b7a0ef19981e146db0e7b7508e80c0
Reviewed-on: https://gerrit.libreoffice.org/15594Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 62eebc07
......@@ -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)));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment