diff options
author | Noel Power <noel.power@novell.com> | 2012-03-05 20:14:13 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-03-05 20:15:16 +0000 |
commit | 14620c3b33cf0315a9b746a0a2418b78d6154821 (patch) | |
tree | 0671d08a2e8fc2395442aac9a3e7acbbf7154fa5 /vbahelper | |
parent | be5567d9e36ad40deb3e5c6ed219265cddc944c0 (diff) |
support import of key shortcut for macro ( Excel only )
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbaapplicationbase.cxx | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index f1ec673e8270..05f2fcf4ddca 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -42,10 +42,7 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> #include <com/sun/star/awt/XWindow2.hpp> -#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/ui/XUIConfigurationManager.hpp> -#include <svtools/acceleratorexecute.hxx> #include <boost/unordered_map.hpp> #include <filter/msfilter/msvbahelper.hxx> #include <tools/datetime.hxx> @@ -300,30 +297,7 @@ VbaApplicationBase::OnKey( const ::rtl::OUString& Key, const uno::Any& Procedure if ( !xModel.is() ) xModel = getCurrentDocument(); - if ( !MacroName.isEmpty() ) - { - ::rtl::OUString sSeparator(RTL_CONSTASCII_USTRINGPARAM("/")); - ::rtl::OUString sMacroSeparator(RTL_CONSTASCII_USTRINGPARAM("!")); - ::rtl::OUString aMacroName = MacroName.trim(); - if (0 == aMacroName.indexOf('!')) - MacroName = aMacroName.copy(1).trim(); - - MacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( xModel ), aMacroName ); - if( !aMacroInfo.mbFound ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The procedure doesn't exist") ), uno::Reference< uno::XInterface >() ); - MacroName = aMacroInfo.msResolvedMacro; - } - uno::Reference< ui::XUIConfigurationManagerSupplier > xCfgSupplier(xModel, uno::UNO_QUERY_THROW); - uno::Reference< ui::XUIConfigurationManager > xCfgMgr = xCfgSupplier->getUIConfigurationManager(); - - uno::Reference< ui::XAcceleratorConfiguration > xAcc( xCfgMgr->getShortCutManager(), uno::UNO_QUERY_THROW ); - if ( MacroName.isEmpty() ) - // I believe this should really restore the [application] default. Since - // afaik we don't actually setup application default bindings on import - // we don't even know what the 'default' would be for this key - xAcc->removeKeyEvent( aKeyEvent ); - else - xAcc->setKeyEvent( aKeyEvent, ooo::vba::makeMacroURL( MacroName ) ); + applyShortCutKeyBinding( xModel, aKeyEvent, MacroName ); } uno::Any SAL_CALL |