From e26a95360e60e0c17e70e72f36fb988bb664ddb5 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Tue, 6 Feb 2018 17:46:28 -0500 Subject: oox: move putPropertiesToDocumentGrabBag to XmlFilterBase Change-Id: Ic3cbabc420c7856682b889528043563622997c14 Reviewed-on: https://gerrit.libreoffice.org/49235 Tested-by: Jenkins Reviewed-by: Ashod Nakashian --- oox/source/core/xmlfilterbase.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'oox') diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 7f20d13b8200..15f253c734c7 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -234,6 +234,36 @@ void XmlFilterBase::checkDocumentProperties(const Reference mbMSO2007 = true; } +void XmlFilterBase::putPropertiesToDocumentGrabBag(const css::uno::Reference& xDstDoc, + const comphelper::SequenceAsHashMap& rProperties) +{ + try + { + uno::Reference xDocProps(xDstDoc, uno::UNO_QUERY); + if (xDocProps.is()) + { + uno::Reference xPropsInfo = xDocProps->getPropertySetInfo(); + + static const OUString aGrabBagPropName = "InteropGrabBag"; + if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(aGrabBagPropName)) + { + // get existing grab bag + comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue(aGrabBagPropName)); + + // put the new items + aGrabBag.update(rProperties); + + // put it back to the document + xDocProps->setPropertyValue(aGrabBagPropName, uno::Any(aGrabBag.getAsConstPropertyValueList())); + } + } + } + catch (const uno::Exception&) + { + SAL_WARN("oox","Failed to save documents grab bag"); + } +} + void XmlFilterBase::importDocumentProperties() { MediaDescriptor aMediaDesc( getMediaDescriptor() ); -- cgit