include/oox/ole/vbaproject.hxx | 2 - oox/Library_oox.mk | 5 +++- oox/source/ole/vbaproject.cxx | 42 +++++------------------------------------ 3 files changed, 11 insertions(+), 38 deletions(-)
New commits: commit 276a90c6b3fb046df13ae85dcdec5f28f23ee527 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Sun Dec 22 20:21:31 2019 +0100 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Dec 23 07:41:13 2019 +0100 tdf#46037: remove configurationhelper in oox/vbaproject Change-Id: I431216749e70f531a26432cb25909ff3c7fb3de5 Reviewed-on: https://gerrit.libreoffice.org/85715 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/oox/ole/vbaproject.hxx b/include/oox/ole/vbaproject.hxx index e72c356f1864..d158819a06ef 100644 --- a/include/oox/ole/vbaproject.hxx +++ b/include/oox/ole/vbaproject.hxx @@ -66,7 +66,7 @@ public: bool isExportVba() const; private: - css::uno::Reference< css::uno::XInterface > + css::uno::Reference< css::uno::XComponentContext > mxConfigAccess; }; diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index cc235b87e360..543907996687 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -11,7 +11,10 @@ $(eval $(call gb_Library_Library,oox)) $(eval $(call gb_Library_set_precompiled_header,oox,oox/inc/pch/precompiled_oox)) -$(eval $(call gb_Library_use_custom_headers,oox,oox/generated)) +$(eval $(call gb_Library_use_custom_headers,oox,\ + oox/generated \ + officecfg/registry \ +)) $(eval $(call gb_Library_set_include,oox,\ $$(INCLUDE) \ diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index bf31f2a2350f..afc787cba19d 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -30,13 +30,13 @@ #include <com/sun/star/script/vba/XVBACompatibility.hpp> #include <com/sun/star/script/vba/XVBAMacroResolver.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <comphelper/configurationhelper.hxx> #include <comphelper/documentinfo.hxx> #include <comphelper/storagehelper.hxx> #include <osl/diagnose.h> #include <rtl/tencinfo.h> #include <rtl/ustrbuf.h> #include <sal/log.hxx> +#include <officecfg/Office/Calc.hxx> #include <oox/helper/binaryinputstream.hxx> #include <oox/helper/containerhelper.hxx> #include <oox/helper/propertyset.hxx> @@ -62,39 +62,9 @@ using namespace ::com::sun::star::script; using namespace ::com::sun::star::script::vba; using namespace ::com::sun::star::uno; -using ::comphelper::ConfigurationHelper; - -namespace { - -bool lclReadConfigItem( const Reference< XInterface >& rxConfigAccess, const OUString& rItemName ) +VbaFilterConfig::VbaFilterConfig( const Reference< XComponentContext >& rxContext, const OUString& /* rConfigCompName */) + : mxConfigAccess(rxContext) { - // some applications do not support all configuration items, assume 'false' in this case - try - { - Any aItem = ConfigurationHelper::readRelativeKey( rxConfigAccess, "Filter/Import/VBA", rItemName ); - return aItem.has< bool >() && aItem.get< bool >(); - } - catch(const Exception& ) - { - } - return false; -} - -} // namespace - -VbaFilterConfig::VbaFilterConfig( const Reference< XComponentContext >& rxContext, const OUString& rConfigCompName ) -{ - OSL_ENSURE( rxContext.is(), "VbaFilterConfig::VbaFilterConfig - missing component context" ); - if( rxContext.is() ) try - { - OSL_ENSURE( !rConfigCompName.isEmpty(), "VbaFilterConfig::VbaFilterConfig - invalid configuration component name" ); - OUString aConfigPackage = "org.openoffice.Office." + rConfigCompName; - mxConfigAccess = ConfigurationHelper::openConfig( rxContext, aConfigPackage, comphelper::EConfigurationModes::ReadOnly ); - } - catch(const Exception& ) - { - } - OSL_ENSURE( mxConfigAccess.is(), "VbaFilterConfig::VbaFilterConfig - cannot open configuration" ); } VbaFilterConfig::~VbaFilterConfig() @@ -103,17 +73,17 @@ VbaFilterConfig::~VbaFilterConfig() bool VbaFilterConfig::isImportVba() const { - return lclReadConfigItem( mxConfigAccess, "Load" ); + return officecfg::Office::Calc::Filter::Import::VBA::Load::get(mxConfigAccess); } bool VbaFilterConfig::isImportVbaExecutable() const { - return lclReadConfigItem( mxConfigAccess, "Executable" ); + return officecfg::Office::Calc::Filter::Import::VBA::Executable::get(mxConfigAccess); } bool VbaFilterConfig::isExportVba() const { - return lclReadConfigItem( mxConfigAccess, "Save" ); + return officecfg::Office::Calc::Filter::Import::VBA::Save::get(mxConfigAccess); } VbaMacroAttacherBase::VbaMacroAttacherBase( const OUString& rMacroName ) : _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits