diff options
Diffstat (limited to 'framework/source/uielement/uicommanddescription.cxx')
-rw-r--r-- | framework/source/uielement/uicommanddescription.cxx | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 0d50aa4c36d4..39b91a771228 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -144,6 +144,8 @@ class ConfigurationAccess_UICommand : // Order is neccessary for right initializ virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException); protected: + virtual ::com::sun::star::uno::Any SAL_CALL getByNameImpl( const ::rtl::OUString& aName ); + struct CmdToInfoMap { CmdToInfoMap() : bPopup( false ), @@ -253,9 +255,9 @@ ConfigurationAccess_UICommand::~ConfigurationAccess_UICommand() xContainer->removeContainerListener( this ); } + // XNameAccess -Any SAL_CALL ConfigurationAccess_UICommand::getByName( const ::rtl::OUString& rCommandURL ) -throw ( NoSuchElementException, WrappedTargetException, RuntimeException) +Any SAL_CALL ConfigurationAccess_UICommand::getByNameImpl( const ::rtl::OUString& rCommandURL ) { static sal_Int32 nRequests = 0; @@ -280,19 +282,24 @@ throw ( NoSuchElementException, WrappedTargetException, RuntimeException) else if ( rCommandURL.equalsIgnoreAsciiCaseAscii( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST )) return makeAny( m_aCommandMirrorImageList ); else - throw NoSuchElementException(); + return Any(); } else { // SAFE ++nRequests; - Any a = getInfoFromCommand( rCommandURL ); + return getInfoFromCommand( rCommandURL ); + } +} - if ( !a.hasValue() ) - throw NoSuchElementException(); +Any SAL_CALL ConfigurationAccess_UICommand::getByName( const ::rtl::OUString& rCommandURL ) +throw ( NoSuchElementException, WrappedTargetException, RuntimeException) +{ + Any aRet( getByNameImpl( rCommandURL ) ); + if( !aRet.hasValue() ) + throw NoSuchElementException(); - return a; - } + return aRet; } Sequence< ::rtl::OUString > SAL_CALL ConfigurationAccess_UICommand::getElementNames() @@ -304,7 +311,7 @@ throw ( RuntimeException ) sal_Bool SAL_CALL ConfigurationAccess_UICommand::hasByName( const ::rtl::OUString& rCommandURL ) throw (::com::sun::star::uno::RuntimeException) { - return getByName( rCommandURL ).hasValue(); + return getByNameImpl( rCommandURL ).hasValue(); } // XElementAccess @@ -470,7 +477,7 @@ Any ConfigurationAccess_UICommand::getInfoFromCommand( const rtl::OUString& rCom { // First try to ask our global commands configuration access. It also caches maybe // we find the entry in its cache first. - if ( m_xGenericUICommands.is() ) + if ( m_xGenericUICommands.is() && m_xGenericUICommands->hasByName( rCommandURL ) ) { try { |