From 276a90c6b3fb046df13ae85dcdec5f28f23ee527 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sun, 22 Dec 2019 20:21:31 +0100 Subject: tdf#46037: remove configurationhelper in oox/vbaproject Change-Id: I431216749e70f531a26432cb25909ff3c7fb3de5 Reviewed-on: https://gerrit.libreoffice.org/85715 Tested-by: Jenkins Reviewed-by: Noel Grandin --- oox/Library_oox.mk | 5 ++++- oox/source/ole/vbaproject.cxx | 42 ++++++------------------------------------ 2 files changed, 10 insertions(+), 37 deletions(-) (limited to 'oox') 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 #include #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -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 ) : -- cgit