From 0932e4bb9a4e4a25be092dcf87a0119d1894ac30 Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Tue, 11 Dec 2018 19:47:25 +0300 Subject: sw: support for saving into .dotx file Template format now supported not only for import, but for export too. Change-Id: I9fb9da14c4d6466b6979fa37fb2c0359ce5 Reviewed-on: https://gerrit.libreoffice.org/64947 Tested-by: Jenkins Reviewed-by: Katarina Behrens --- oox/source/core/filterbase.cxx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'oox') diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index c19905417114..9b52bff85f84 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -150,6 +151,8 @@ struct FilterBaseImpl bool mbExportVBA; + bool mbExportTemplate; + /// @throws RuntimeException explicit FilterBaseImpl( const Reference< XComponentContext >& rxContext ); @@ -163,7 +166,8 @@ FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext meDirection( FILTERDIRECTION_UNKNOWN ), meVersion( ECMA_DIALECT ), mxComponentContext( rxContext, UNO_SET_THROW ), - mbExportVBA(false) + mbExportVBA(false), + mbExportTemplate(false) { } @@ -421,10 +425,8 @@ void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) { Sequence aSeq; rArgs[0] >>= aSeq; - sal_Int32 nLen = aSeq.getLength(); - for (sal_Int32 i = 0; i < nLen; ++i) + for (const auto& rVal : aSeq) { - css::beans::PropertyValue& rVal = aSeq[i]; if (rVal.Name == "UserData") { css::uno::Sequence aUserDataSeq; @@ -438,6 +440,12 @@ void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) } } } + else if (rVal.Name == "Flags") + { + sal_Int32 nFlags; + rVal.Value >>= nFlags; + mxImpl->mbExportTemplate = bool(static_cast(nFlags) & SfxFilterFlags::TEMPLATE); + } } } } @@ -581,6 +589,11 @@ bool FilterBase::exportVBA() const return mxImpl->mbExportVBA; } +bool FilterBase::isExportTemplate() const +{ + return mxImpl->mbExportTemplate; +} + } // namespace core } // namespace oox -- cgit