include/oox/core/xmlfilterbase.hxx | 2 + oox/source/core/xmlfilterbase.cxx | 30 +++++++++++++++++++++++ writerfilter/source/filter/WriterFilter.cxx | 36 +--------------------------- 3 files changed, 34 insertions(+), 34 deletions(-)
New commits: commit f2ca825e4f76ae728d2ea9d8c2b7897174305667 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Tue Feb 6 17:46:28 2018 -0500 oox: move putPropertiesToDocumentGrabBag to XmlFilterBase Reviewed-on: https://gerrit.libreoffice.org/49235 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> (cherry picked from commit e26a95360e60e0c17e70e72f36fb988bb664ddb5) Change-Id: Ic3cbabc420c7856682b889528043563622997c14 Reviewed-on: https://gerrit.libreoffice.org/50150 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index 83d8ff1585e4..b351b614cde4 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -228,6 +228,8 @@ public: void exportDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xProperties ); void importDocumentProperties(); + static void putPropertiesToDocumentGrabBag(const css::uno::Reference<css::lang::XComponent>& xDstDoc, + const comphelper::SequenceAsHashMap& rProperties); FastParser* createParser() const; 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 ); diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 206640bda607..9fad4ef79fbb 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -34,6 +34,7 @@ #include <cppuhelper/supportsservice.hxx> #include <dmapper/DomainMapperFactory.hxx> #include <oox/core/filterdetect.hxx> +#include <oox/core/xmlfilterbase.hxx> #include <oox/helper/graphichelper.hxx> #include <oox/ole/olestorage.hxx> #include <oox/ole/vbaproject.hxx> @@ -117,10 +118,6 @@ public: OUString SAL_CALL getImplementationName() throw (uno::RuntimeException, std::exception) override; sal_Bool SAL_CALL supportsService(const OUString& rServiceName) throw (uno::RuntimeException, std::exception) override; uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException, std::exception) override; - -private: - void putPropertiesToDocumentGrabBag(const comphelper::SequenceAsHashMap& rProperties); - }; sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescriptor) throw (uno::RuntimeException, std::exception) @@ -232,7 +229,7 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& aDesc // Adding the saved embedding document to document's grab bag aGrabBagProperties["OOXEmbeddings"] = uno::makeAny(pDocument->getEmbeddingsList()); - putPropertiesToDocumentGrabBag(aGrabBagProperties); + oox::core::XmlFilterBase::putPropertiesToDocumentGrabBag(m_xDstDoc, aGrabBagProperties); writerfilter::ooxml::OOXMLStream::Pointer_t pVBAProjectStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream(pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT)); oox::StorageRef xVbaPrjStrg(new ::oox::ole::OleStorage(m_xContext, pVBAProjectStream->getDocumentStream(), false)); @@ -338,35 +335,6 @@ uno::Sequence<OUString> WriterFilter::getSupportedServiceNames() throw (uno::Run return aRet; } -void WriterFilter::putPropertiesToDocumentGrabBag(const comphelper::SequenceAsHashMap& rProperties) -{ - try - { - uno::Reference<beans::XPropertySet> xDocProps(m_xDstDoc, uno::UNO_QUERY); - if (xDocProps.is()) - { - uno::Reference<beans::XPropertySetInfo> xPropsInfo = xDocProps->getPropertySetInfo(); - - 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("writerfilter","Failed to save documents grab bag"); - } -} - extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL com_sun_star_comp_Writer_WriterFilter_get_implementation(uno::XComponentContext* component, uno::Sequence<uno::Any> const&) { return cppu::acquire(new WriterFilter(component)); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits