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.grandin@collabora.co.uk>
This commit is contained in:
parent
3f8fc1a384
commit
276a90c6b3
3 changed files with 11 additions and 38 deletions
|
@ -66,7 +66,7 @@ public:
|
|||
bool isExportVba() const;
|
||||
|
||||
private:
|
||||
css::uno::Reference< css::uno::XInterface >
|
||||
css::uno::Reference< css::uno::XComponentContext >
|
||||
mxConfigAccess;
|
||||
};
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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 ) :
|
||||
|
|
Loading…
Reference in a new issue