diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-02-06 17:46:28 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-02-22 11:14:07 +0100 |
commit | f2ca825e4f76ae728d2ea9d8c2b7897174305667 (patch) | |
tree | 71073e2d1b9a0cb1876cbae0f64465e716476eb6 /oox | |
parent | 274c86af3ce7e665aee232e4e9fee76fe22af0bd (diff) |
oox: move putPropertiesToDocumentGrabBag to XmlFilterBase
Reviewed-on: https://gerrit.libreoffice.org/49235
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit e26a95360e60e0c17e70e72f36fb988bb664ddb5)
Change-Id: Ic3cbabc420c7856682b889528043563622997c14
Reviewed-on: https://gerrit.libreoffice.org/50150
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index c5eb5d3d7c7f..093bfae42ff6 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -244,6 +244,36 @@ void XmlFilterBase::checkDocumentProperties(const Reference<XDocumentProperties> mbMSO2007 = true; } +void XmlFilterBase::putPropertiesToDocumentGrabBag(const css::uno::Reference<css::lang::XComponent>& xDstDoc, + const comphelper::SequenceAsHashMap& rProperties) +{ + try + { + uno::Reference<beans::XPropertySet> xDocProps(xDstDoc, uno::UNO_QUERY); + if (xDocProps.is()) + { + uno::Reference<beans::XPropertySetInfo> 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() { Reference< XMultiServiceFactory > xFactory( getComponentContext()->getServiceManager(), UNO_QUERY ); |