LCOV - code coverage report
Current view: top level - framework/source/uielement - uicommanddescription.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 222 296 75.0 %
Date: 2012-08-25 Functions: 32 43 74.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 313 703 44.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "uielement/uicommanddescription.hxx"
      30                 :            : #include <threadhelp/resetableguard.hxx>
      31                 :            : #include "services.h"
      32                 :            : 
      33                 :            : #include "properties.h"
      34                 :            : 
      35                 :            : #include "helper/mischelper.hxx"
      36                 :            : 
      37                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      38                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      39                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      40                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      41                 :            : #include <com/sun/star/container/XContainer.hpp>
      42                 :            : 
      43                 :            : #include <rtl/ustrbuf.hxx>
      44                 :            : #include <cppuhelper/implbase2.hxx>
      45                 :            : #include <unotools/configmgr.hxx>
      46                 :            : #include <tools/string.hxx>
      47                 :            : 
      48                 :            : #include <vcl/mnemonic.hxx>
      49                 :            : #include <comphelper/sequence.hxx>
      50                 :            : #include <comphelper/string.hxx>
      51                 :            : #include <rtl/logfile.hxx>
      52                 :            : 
      53                 :            : //_________________________________________________________________________________________________________________
      54                 :            : //  Defines
      55                 :            : //_________________________________________________________________________________________________________________
      56                 :            : 
      57                 :            : using namespace com::sun::star::uno;
      58                 :            : using namespace com::sun::star::lang;
      59                 :            : using namespace com::sun::star::beans;
      60                 :            : using namespace com::sun::star::container;
      61                 :            : using namespace ::com::sun::star::frame;
      62                 :            : 
      63                 :            : //_________________________________________________________________________________________________________________
      64                 :            : //  Namespace
      65                 :            : //_________________________________________________________________________________________________________________
      66                 :            : 
      67                 :            : struct ModuleToCommands
      68                 :            : {
      69                 :            :     const char* pModuleId;
      70                 :            :     const char* pCommands;
      71                 :            : };
      72                 :            : 
      73                 :            : static const char CONFIGURATION_ROOT_ACCESS[]           = "/org.openoffice.Office.UI.";
      74                 :            : static const char CONFIGURATION_CMD_ELEMENT_ACCESS[]    = "/UserInterface/Commands";
      75                 :            : static const char CONFIGURATION_POP_ELEMENT_ACCESS[]    = "/UserInterface/Popups";
      76                 :            : static const char CONFIGURATION_PROPERTY_LABEL[]        = "Label";
      77                 :            : static const char CONFIGURATION_PROPERTY_CONTEXT_LABEL[] = "ContextLabel";
      78                 :            : 
      79                 :            : // Property names of the resulting Property Set
      80                 :            : static const char PROPSET_LABEL[]                       = "Label";
      81                 :            : static const char PROPSET_NAME[]                        = "Name";
      82                 :            : static const char PROPSET_POPUP[]                       = "Popup";
      83                 :            : static const char PROPSET_PROPERTIES[]                  = "Properties";
      84                 :            : 
      85                 :            : // Special resource URLs to retrieve additional information
      86                 :            : static const char PRIVATE_RESOURCE_URL[]                = "private:";
      87                 :            : 
      88                 :            : const sal_Int32   COMMAND_PROPERTY_IMAGE                = 1;
      89                 :            : const sal_Int32   COMMAND_PROPERTY_ROTATE               = 2;
      90                 :            : const sal_Int32   COMMAND_PROPERTY_MIRROR               = 4;
      91                 :            : 
      92                 :            : namespace framework
      93                 :            : {
      94                 :            : 
      95                 :            : //*****************************************************************************************************************
      96                 :            : //  Configuration access class for PopupMenuControllerFactory implementation
      97                 :            : //*****************************************************************************************************************
      98                 :            : 
      99                 :            : class ConfigurationAccess_UICommand : // Order is neccessary for right initialization!
     100                 :            :                                         private ThreadHelpBase                           ,
     101                 :            :                                         public  ::cppu::WeakImplHelper2<XNameAccess,XContainerListener>
     102                 :            : {
     103                 :            :     public:
     104                 :            :                                   ConfigurationAccess_UICommand( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager );
     105                 :            :         virtual                   ~ConfigurationAccess_UICommand();
     106                 :            : 
     107                 :            :         // XNameAccess
     108                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
     109                 :            :             throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     110                 :            : 
     111                 :            :         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
     112                 :            :             throw (::com::sun::star::uno::RuntimeException);
     113                 :            : 
     114                 :            :         virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
     115                 :            :             throw (::com::sun::star::uno::RuntimeException);
     116                 :            : 
     117                 :            :         // XElementAccess
     118                 :            :         virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
     119                 :            :             throw (::com::sun::star::uno::RuntimeException);
     120                 :            : 
     121                 :            :         virtual sal_Bool SAL_CALL hasElements()
     122                 :            :             throw (::com::sun::star::uno::RuntimeException);
     123                 :            : 
     124                 :            :         // container.XContainerListener
     125                 :            :         virtual void SAL_CALL     elementInserted( const ContainerEvent& aEvent ) throw(RuntimeException);
     126                 :            :         virtual void SAL_CALL     elementRemoved ( const ContainerEvent& aEvent ) throw(RuntimeException);
     127                 :            :         virtual void SAL_CALL     elementReplaced( const ContainerEvent& aEvent ) throw(RuntimeException);
     128                 :            : 
     129                 :            :         // lang.XEventListener
     130                 :            :         virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException);
     131                 :            : 
     132                 :            :     protected:
     133                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL getByNameImpl( const ::rtl::OUString& aName );
     134                 :            : 
     135                 :     350720 :         struct CmdToInfoMap
     136                 :            :         {
     137                 :      70144 :             CmdToInfoMap() : bPopup( false ),
     138                 :            :                              bCommandNameCreated( false ),
     139                 :      70144 :                              nProperties( 0 ) {}
     140                 :            : 
     141                 :            :             rtl::OUString       aLabel;
     142                 :            :             rtl::OUString       aContextLabel;
     143                 :            :             rtl::OUString       aCommandName;
     144                 :            :             bool                bPopup : 1,
     145                 :            :                                 bCommandNameCreated : 1;
     146                 :            :             sal_Int32           nProperties;
     147                 :            :         };
     148                 :            : 
     149                 :            :         Any                       getSequenceFromCache( const rtl::OUString& aCommandURL );
     150                 :            :         Any                       getInfoFromCommand( const rtl::OUString& rCommandURL );
     151                 :            :         void                      fillInfoFromResult( CmdToInfoMap& rCmdInfo, const rtl::OUString& aLabel );
     152                 :            :         Any                       getUILabelFromCommand( const rtl::OUString& rCommandURL );
     153                 :            :         Sequence< rtl::OUString > getAllCommands();
     154                 :            :         sal_Bool                  fillCache();
     155                 :            :         sal_Bool                  addGenericInfoToCache();
     156                 :            :         void                      impl_fill(const Reference< XNameAccess >& _xConfigAccess,sal_Bool _bPopup,
     157                 :            :                                                 std::vector< ::rtl::OUString >& aImageCommandVector,
     158                 :            :                                                 std::vector< ::rtl::OUString >& aImageRotateVector,
     159                 :            :                                                 std::vector< ::rtl::OUString >& aImageMirrorVector);
     160                 :            : 
     161                 :            :     private:
     162                 :            :         typedef ::boost::unordered_map< ::rtl::OUString,
     163                 :            :                                  CmdToInfoMap,
     164                 :            :                                  OUStringHashCode,
     165                 :            :                                  ::std::equal_to< ::rtl::OUString > > CommandToInfoCache;
     166                 :            : 
     167                 :            :         sal_Bool initializeConfigAccess();
     168                 :            : 
     169                 :            :         rtl::OUString                     m_aConfigCmdAccess;
     170                 :            :         rtl::OUString                     m_aConfigPopupAccess;
     171                 :            :         rtl::OUString                     m_aPropUILabel;
     172                 :            :         rtl::OUString                     m_aPropUIContextLabel;
     173                 :            :         rtl::OUString                     m_aPropLabel;
     174                 :            :         rtl::OUString                     m_aPropName;
     175                 :            :         rtl::OUString                     m_aPropPopup;
     176                 :            :         rtl::OUString                     m_aPropProperties;
     177                 :            :         rtl::OUString                     m_aXMLFileFormatVersion;
     178                 :            :         rtl::OUString                     m_aVersion;
     179                 :            :         rtl::OUString                     m_aExtension;
     180                 :            :         rtl::OUString                     m_aPrivateResourceURL;
     181                 :            :         Reference< XNameAccess >          m_xGenericUICommands;
     182                 :            :         Reference< XMultiServiceFactory > m_xServiceManager;
     183                 :            :         Reference< XMultiServiceFactory > m_xConfigProvider;
     184                 :            :         Reference< XNameAccess >          m_xConfigAccess;
     185                 :            :         Reference< XContainerListener >   m_xConfigListener;
     186                 :            :         Reference< XNameAccess >          m_xConfigAccessPopups;
     187                 :            :         Reference< XContainerListener >   m_xConfigAccessListener;
     188                 :            :         Sequence< rtl::OUString >         m_aCommandImageList;
     189                 :            :         Sequence< rtl::OUString >         m_aCommandRotateImageList;
     190                 :            :         Sequence< rtl::OUString >         m_aCommandMirrorImageList;
     191                 :            :         CommandToInfoCache                m_aCmdInfoCache;
     192                 :            :         sal_Bool                          m_bConfigAccessInitialized;
     193                 :            :         sal_Bool                          m_bCacheFilled;
     194                 :            :         sal_Bool                          m_bGenericDataRetrieved;
     195                 :            : };
     196                 :            : 
     197                 :            : //*****************************************************************************************************************
     198                 :            : //  XInterface, XTypeProvider
     199                 :            : //*****************************************************************************************************************
     200                 :        148 : ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager ) :
     201                 :            :     ThreadHelpBase(),
     202                 :            :     m_aConfigCmdAccess( CONFIGURATION_ROOT_ACCESS ),
     203                 :            :     m_aConfigPopupAccess( CONFIGURATION_ROOT_ACCESS ),
     204                 :            :     m_aPropUILabel( CONFIGURATION_PROPERTY_LABEL ),
     205                 :            :     m_aPropUIContextLabel( CONFIGURATION_PROPERTY_CONTEXT_LABEL ),
     206                 :            :     m_aPropLabel( PROPSET_LABEL ),
     207                 :            :     m_aPropName( PROPSET_NAME ),
     208                 :            :     m_aPropPopup( PROPSET_POPUP ),
     209                 :            :     m_aPropProperties( PROPSET_PROPERTIES ),
     210                 :            :     m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ),
     211                 :            :     m_xGenericUICommands( rGenericUICommands ),
     212                 :            :     m_xServiceManager( rServiceManager ),
     213                 :            :     m_bConfigAccessInitialized( sal_False ),
     214                 :            :     m_bCacheFilled( sal_False ),
     215 [ +  - ][ +  - ]:        148 :     m_bGenericDataRetrieved( sal_False )
         [ +  - ][ +  - ]
                 [ +  - ]
     216                 :            : {
     217                 :            :     // Create configuration hierachical access name
     218                 :        148 :     m_aConfigCmdAccess += aModuleName;
     219                 :        148 :     m_aConfigCmdAccess += rtl::OUString( CONFIGURATION_CMD_ELEMENT_ACCESS );
     220                 :            : 
     221 [ +  - ][ +  - ]:        148 :     m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY );
         [ +  - ][ +  - ]
                 [ +  - ]
     222                 :            : 
     223                 :        148 :     m_aConfigPopupAccess += aModuleName;
     224                 :        148 :     m_aConfigPopupAccess += rtl::OUString( CONFIGURATION_POP_ELEMENT_ACCESS );
     225                 :        148 : }
     226                 :            : 
     227 [ +  - ][ +  - ]:        148 : ConfigurationAccess_UICommand::~ConfigurationAccess_UICommand()
         [ +  - ][ +  - ]
                 [ +  - ]
     228                 :            : {
     229                 :            :     // SAFE
     230         [ +  - ]:        148 :     ResetableGuard aLock( m_aLock );
     231         [ +  - ]:        148 :     Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
     232         [ +  + ]:        148 :     if ( xContainer.is() )
     233 [ +  - ][ +  - ]:        144 :         xContainer->removeContainerListener(m_xConfigListener);
     234 [ +  - ][ +  - ]:        148 :     xContainer = Reference< XContainer >( m_xConfigAccessPopups, UNO_QUERY );
     235         [ +  + ]:        148 :     if ( xContainer.is() )
     236 [ +  - ][ +  - ]:        148 :         xContainer->removeContainerListener(m_xConfigAccessListener);
                 [ +  - ]
     237         [ -  + ]:        296 : }
     238                 :            : 
     239                 :            : 
     240                 :            : // XNameAccess
     241                 :     447424 : Any SAL_CALL ConfigurationAccess_UICommand::getByNameImpl( const ::rtl::OUString& rCommandURL )
     242                 :            : {
     243                 :            :     static sal_Int32 nRequests  = 0;
     244                 :            : 
     245         [ +  - ]:     447424 :     ResetableGuard aLock( m_aLock );
     246         [ +  + ]:     447424 :     if ( !m_bConfigAccessInitialized )
     247                 :            :     {
     248         [ +  - ]:        144 :         initializeConfigAccess();
     249                 :        144 :         m_bConfigAccessInitialized = sal_True;
     250         [ +  - ]:        144 :         fillCache();
     251                 :            :     }
     252                 :            : 
     253         [ +  + ]:     447424 :     if ( rCommandURL.indexOf( m_aPrivateResourceURL ) == 0 )
     254                 :            :     {
     255                 :            :         // special keys to retrieve information about a set of commands
     256                 :            :         // SAFE
     257         [ +  - ]:       8738 :         addGenericInfoToCache();
     258                 :            : 
     259         [ +  + ]:       8738 :         if ( rCommandURL.equalsIgnoreAsciiCaseAscii( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST ))
     260         [ +  - ]:        244 :             return makeAny( m_aCommandImageList );
     261         [ +  + ]:       8494 :         else if ( rCommandURL.equalsIgnoreAsciiCaseAscii( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST ))
     262         [ +  - ]:       4247 :             return makeAny( m_aCommandRotateImageList );
     263         [ +  - ]:       4247 :         else if ( rCommandURL.equalsIgnoreAsciiCaseAscii( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST ))
     264         [ +  - ]:       4247 :             return makeAny( m_aCommandMirrorImageList );
     265                 :            :         else
     266                 :          0 :             return Any();
     267                 :            :     }
     268                 :            :     else
     269                 :            :     {
     270                 :            :         // SAFE
     271                 :     438686 :         ++nRequests;
     272         [ +  - ]:     438686 :         return getInfoFromCommand( rCommandURL );
     273         [ +  - ]:     447424 :     }
     274                 :            : }
     275                 :            : 
     276                 :     289168 : Any SAL_CALL ConfigurationAccess_UICommand::getByName( const ::rtl::OUString& rCommandURL )
     277                 :            : throw ( NoSuchElementException, WrappedTargetException, RuntimeException)
     278                 :            : {
     279                 :     289168 :     Any aRet( getByNameImpl( rCommandURL ) );
     280         [ -  + ]:     289168 :     if( !aRet.hasValue() )
     281         [ #  # ]:          0 :         throw NoSuchElementException();
     282                 :            : 
     283                 :     289168 :     return aRet;
     284                 :            : }
     285                 :            : 
     286                 :          0 : Sequence< ::rtl::OUString > SAL_CALL ConfigurationAccess_UICommand::getElementNames()
     287                 :            : throw ( RuntimeException )
     288                 :            : {
     289                 :          0 :     return getAllCommands();
     290                 :            : }
     291                 :            : 
     292                 :     158256 : sal_Bool SAL_CALL ConfigurationAccess_UICommand::hasByName( const ::rtl::OUString& rCommandURL )
     293                 :            : throw (::com::sun::star::uno::RuntimeException)
     294                 :            : {
     295                 :     158256 :     return getByNameImpl( rCommandURL ).hasValue();
     296                 :            : }
     297                 :            : 
     298                 :            : // XElementAccess
     299                 :          0 : Type SAL_CALL ConfigurationAccess_UICommand::getElementType()
     300                 :            : throw ( RuntimeException )
     301                 :            : {
     302                 :          0 :     return( ::getCppuType( (const Sequence< PropertyValue >*)NULL ) );
     303                 :            : }
     304                 :            : 
     305                 :          0 : sal_Bool SAL_CALL ConfigurationAccess_UICommand::hasElements()
     306                 :            : throw ( RuntimeException )
     307                 :            : {
     308                 :            :     // There must are global commands!
     309                 :          0 :     return sal_True;
     310                 :            : }
     311                 :            : 
     312                 :       5814 : void ConfigurationAccess_UICommand::fillInfoFromResult( CmdToInfoMap& rCmdInfo, const rtl::OUString& aLabel )
     313                 :            : {
     314         [ +  - ]:       5814 :     String rStr( aLabel );
     315                 :            :     rStr.SearchAndReplaceAllAscii(
     316 [ +  - ][ +  - ]:       5814 :         "%PRODUCTNAME", utl::ConfigManager::getProductName() );
         [ +  - ][ +  - ]
     317         [ +  - ]:       5814 :     rCmdInfo.aLabel       = ::rtl::OUString( rStr );
     318 [ +  - ][ +  - ]:       5814 :     rStr = comphelper::string::stripEnd(rStr, '.'); // Remove "..." from string
                 [ +  - ]
     319 [ +  - ][ +  - ]:       5814 :     rCmdInfo.aCommandName = ::rtl::OUString( MnemonicGenerator::EraseAllMnemonicChars( rStr ));
                 [ +  - ]
     320         [ +  - ]:       5814 :     rCmdInfo.bCommandNameCreated = sal_True;
     321                 :       5814 : }
     322                 :            : 
     323                 :     438686 : Any ConfigurationAccess_UICommand::getSequenceFromCache( const ::rtl::OUString& aCommandURL )
     324                 :            : {
     325         [ +  - ]:     438686 :     CommandToInfoCache::iterator pIter = m_aCmdInfoCache.find( aCommandURL );
     326 [ +  - ][ +  + ]:     438686 :     if ( pIter != m_aCmdInfoCache.end() )
     327                 :            :     {
     328 [ +  - ][ +  + ]:     300629 :         if ( !pIter->second.bCommandNameCreated )
     329 [ +  - ][ +  - ]:       5814 :             fillInfoFromResult( pIter->second, pIter->second.aLabel );
                 [ +  - ]
     330                 :            : 
     331         [ +  - ]:     300629 :         Sequence< PropertyValue > aPropSeq( 4 );
     332         [ +  - ]:     300629 :         aPropSeq[0].Name  = m_aPropLabel;
     333 [ +  - ][ +  - ]:     601258 :         aPropSeq[0].Value = !pIter->second.aContextLabel.isEmpty() ?
     334 [ +  - ][ +  - ]:     601258 :                 makeAny( pIter->second.aContextLabel ): makeAny( pIter->second.aLabel );
         [ +  - ][ +  - ]
                 [ +  + ]
     335         [ +  - ]:     300629 :         aPropSeq[1].Name  = m_aPropName;
     336 [ +  - ][ +  - ]:     300629 :         aPropSeq[1].Value <<= pIter->second.aCommandName;
                 [ +  - ]
     337         [ +  - ]:     300629 :         aPropSeq[2].Name  = m_aPropPopup;
     338 [ +  - ][ +  - ]:     300629 :         aPropSeq[2].Value <<= pIter->second.bPopup;
                 [ +  - ]
     339         [ +  - ]:     300629 :         aPropSeq[3].Name  = m_aPropProperties;
     340 [ +  - ][ +  - ]:     300629 :         aPropSeq[3].Value <<= pIter->second.nProperties;
                 [ +  - ]
     341 [ +  - ][ +  - ]:     300629 :         return makeAny( aPropSeq );
     342                 :            :     }
     343                 :            : 
     344                 :     438686 :     return Any();
     345                 :            : }
     346                 :        288 : void ConfigurationAccess_UICommand::impl_fill(const Reference< XNameAccess >& _xConfigAccess,sal_Bool _bPopup,
     347                 :            :                                                 std::vector< ::rtl::OUString >& aImageCommandVector,
     348                 :            :                                                 std::vector< ::rtl::OUString >& aImageRotateVector,
     349                 :            :                                                 std::vector< ::rtl::OUString >& aImageMirrorVector)
     350                 :            : {
     351         [ +  - ]:        288 :     if ( _xConfigAccess.is() )
     352                 :            :     {
     353 [ +  - ][ +  - ]:        288 :         Sequence< ::rtl::OUString> aNameSeq = _xConfigAccess->getElementNames();
     354                 :        288 :         const sal_Int32 nCount = aNameSeq.getLength();
     355         [ +  + ]:      70432 :         for ( sal_Int32 i = 0; i < nCount; i++ )
     356                 :            :         {
     357                 :            :             try
     358                 :            :             {
     359 [ +  - ][ +  - ]:      70144 :                 Reference< XNameAccess > xNameAccess(_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY);
         [ +  - ][ +  - ]
     360         [ +  - ]:      70144 :                 if ( xNameAccess.is() )
     361                 :            :                 {
     362                 :      70144 :                     CmdToInfoMap aCmdToInfo;
     363                 :            : 
     364                 :      70144 :                     aCmdToInfo.bPopup = _bPopup;
     365 [ +  - ][ +  - ]:      70144 :                     xNameAccess->getByName( m_aPropUILabel )        >>= aCmdToInfo.aLabel;
     366 [ +  - ][ +  - ]:      70144 :                     xNameAccess->getByName( m_aPropUIContextLabel ) >>= aCmdToInfo.aContextLabel;
     367 [ +  - ][ +  - ]:      70144 :                     xNameAccess->getByName( m_aPropProperties )     >>= aCmdToInfo.nProperties;
     368                 :            : 
     369 [ +  - ][ +  - ]:      70144 :                     m_aCmdInfoCache.insert( CommandToInfoCache::value_type( aNameSeq[i], aCmdToInfo ));
     370                 :            : 
     371         [ +  + ]:      70144 :                     if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_IMAGE )
     372 [ +  - ][ +  - ]:      39806 :                         aImageCommandVector.push_back( aNameSeq[i] );
     373         [ +  + ]:      70144 :                     if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_ROTATE )
     374 [ +  - ][ +  - ]:       1486 :                         aImageRotateVector.push_back( aNameSeq[i] );
     375         [ +  + ]:      70144 :                     if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_MIRROR )
     376 [ +  - ][ +  - ]:      70144 :                         aImageMirrorVector.push_back( aNameSeq[i] );
     377      [ #  #  # ]:      70144 :                 }
     378                 :            :             }
     379         [ #  # ]:          0 :             catch (const com::sun::star::lang::WrappedTargetException&)
     380                 :            :             {
     381                 :            :             }
     382         [ #  # ]:          0 :             catch (const com::sun::star::container::NoSuchElementException&)
     383                 :            :             {
     384                 :            :             }
     385         [ +  - ]:        288 :         }
     386                 :            :     }
     387                 :        288 : }
     388                 :        144 : sal_Bool ConfigurationAccess_UICommand::fillCache()
     389                 :            : {
     390                 :            :     RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ConfigurationAccess_UICommand::fillCache" );
     391                 :            : 
     392         [ -  + ]:        144 :     if ( m_bCacheFilled )
     393                 :          0 :         return sal_True;
     394                 :            : 
     395         [ +  - ]:        144 :     std::vector< ::rtl::OUString > aImageCommandVector;
     396         [ +  - ]:        144 :     std::vector< ::rtl::OUString > aImageRotateVector;
     397         [ +  - ]:        144 :     std::vector< ::rtl::OUString > aImageMirrorVector;
     398                 :            : 
     399         [ +  - ]:        144 :     impl_fill(m_xConfigAccess,sal_False,aImageCommandVector,aImageRotateVector,aImageMirrorVector);
     400         [ +  - ]:        144 :     impl_fill(m_xConfigAccessPopups,sal_True,aImageCommandVector,aImageRotateVector,aImageMirrorVector);
     401                 :            :     // Create cached sequences for fast retrieving
     402 [ +  - ][ +  - ]:        144 :     m_aCommandImageList       = comphelper::containerToSequence( aImageCommandVector );
                 [ +  - ]
     403 [ +  - ][ +  - ]:        144 :     m_aCommandRotateImageList = comphelper::containerToSequence( aImageRotateVector );
                 [ +  - ]
     404 [ +  - ][ +  - ]:        144 :     m_aCommandMirrorImageList = comphelper::containerToSequence( aImageMirrorVector );
                 [ +  - ]
     405                 :            : 
     406                 :        144 :     m_bCacheFilled = sal_True;
     407                 :            : 
     408                 :        144 :     return sal_True;
     409                 :            : }
     410                 :            : 
     411                 :       8738 : sal_Bool ConfigurationAccess_UICommand::addGenericInfoToCache()
     412                 :            : {
     413 [ +  + ][ +  + ]:       8738 :     if ( m_xGenericUICommands.is() && !m_bGenericDataRetrieved )
                 [ +  + ]
     414                 :            :     {
     415         [ +  - ]:         82 :         Sequence< rtl::OUString > aCommandNameSeq;
     416                 :            :         try
     417                 :            :         {
     418   [ +  -  +  - ]:        164 :             if ( m_xGenericUICommands->getByName(
     419 [ +  - ][ +  - ]:         82 :                     rtl::OUString( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST )) >>= aCommandNameSeq )
     420 [ +  - ][ +  - ]:         82 :                 m_aCommandRotateImageList = comphelper::concatSequences< rtl::OUString >( m_aCommandRotateImageList, aCommandNameSeq );
                 [ +  - ]
     421                 :            :         }
     422      [ #  #  # ]:          0 :         catch (const RuntimeException&)
     423                 :            :         {
     424                 :          0 :             throw;
     425                 :            :         }
     426         [ #  # ]:          0 :         catch (const Exception&)
     427                 :            :         {
     428                 :            :         }
     429                 :            : 
     430                 :            :         try
     431                 :            :         {
     432   [ +  -  +  - ]:        164 :             if ( m_xGenericUICommands->getByName(
     433 [ +  - ][ +  - ]:         82 :                     rtl::OUString( UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST )) >>= aCommandNameSeq )
     434 [ +  - ][ +  - ]:         82 :                 m_aCommandMirrorImageList = comphelper::concatSequences< rtl::OUString >( m_aCommandMirrorImageList, aCommandNameSeq );
                 [ +  - ]
     435                 :            :         }
     436      [ #  #  # ]:          0 :         catch (const RuntimeException&)
     437                 :            :         {
     438                 :          0 :             throw;
     439                 :            :         }
     440         [ #  # ]:          0 :         catch (const Exception&)
     441                 :            :         {
     442                 :            :         }
     443                 :            : 
     444         [ +  - ]:         82 :         m_bGenericDataRetrieved = sal_True;
     445                 :            :     }
     446                 :            : 
     447                 :       8738 :     return sal_True;
     448                 :            : }
     449                 :            : 
     450                 :     438686 : Any ConfigurationAccess_UICommand::getInfoFromCommand( const rtl::OUString& rCommandURL )
     451                 :            : {
     452                 :     438686 :     Any a;
     453                 :            : 
     454                 :            :     try
     455                 :            :     {
     456         [ +  - ]:     438686 :         a = getSequenceFromCache( rCommandURL );
     457         [ +  + ]:     438686 :         if ( !a.hasValue() )
     458                 :            :         {
     459                 :            :             // First try to ask our global commands configuration access. It also caches maybe
     460                 :            :             // we find the entry in its cache first.
     461 [ +  + ][ +  - ]:     138057 :             if ( m_xGenericUICommands.is() && m_xGenericUICommands->hasByName( rCommandURL ) )
         [ +  - ][ +  + ]
                 [ +  + ]
     462                 :            :             {
     463                 :            :                 try
     464                 :            :                 {
     465 [ +  - ][ +  - ]:     132799 :                     return m_xGenericUICommands->getByName( rCommandURL );
     466                 :            :                 }
     467         [ #  # ]:          0 :                 catch (const com::sun::star::lang::WrappedTargetException&)
     468                 :            :                 {
     469                 :            :                 }
     470   [ #  #  #  #  :          0 :                 catch (const com::sun::star::container::NoSuchElementException&)
                      # ]
     471                 :            :                 {
     472                 :            :                 }
     473                 :            :             }
     474                 :            :         }
     475                 :            :     }
     476         [ #  # ]:          0 :     catch (const com::sun::star::container::NoSuchElementException&)
     477                 :            :     {
     478                 :            :     }
     479         [ #  # ]:          0 :     catch (const com::sun::star::lang::WrappedTargetException&)
     480                 :            :     {
     481                 :            :     }
     482                 :            : 
     483      [ #  #  # ]:     438686 :     return a;
     484                 :            : }
     485                 :            : 
     486                 :          0 : Sequence< rtl::OUString > ConfigurationAccess_UICommand::getAllCommands()
     487                 :            : {
     488                 :            :     // SAFE
     489         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     490                 :            : 
     491         [ #  # ]:          0 :     if ( !m_bConfigAccessInitialized )
     492                 :            :     {
     493         [ #  # ]:          0 :         initializeConfigAccess();
     494                 :          0 :         m_bConfigAccessInitialized = sal_True;
     495         [ #  # ]:          0 :         fillCache();
     496                 :            :     }
     497                 :            : 
     498         [ #  # ]:          0 :     if ( m_xConfigAccess.is() )
     499                 :            :     {
     500                 :          0 :         Reference< XNameAccess > xNameAccess;
     501                 :            : 
     502                 :            :         try
     503                 :            :         {
     504 [ #  # ][ #  # ]:          0 :             Sequence< ::rtl::OUString > aNameSeq = m_xConfigAccess->getElementNames();
     505                 :            : 
     506         [ #  # ]:          0 :             if ( m_xGenericUICommands.is() )
     507                 :            :             {
     508                 :            :                 // Create concat list of supported user interface commands of the module
     509 [ #  # ][ #  # ]:          0 :                 Sequence< ::rtl::OUString > aGenericNameSeq = m_xGenericUICommands->getElementNames();
     510                 :          0 :                 sal_uInt32 nCount1 = aNameSeq.getLength();
     511                 :          0 :                 sal_uInt32 nCount2 = aGenericNameSeq.getLength();
     512                 :            : 
     513         [ #  # ]:          0 :                 aNameSeq.realloc( nCount1 + nCount2 );
     514         [ #  # ]:          0 :                 ::rtl::OUString* pNameSeq = aNameSeq.getArray();
     515                 :          0 :                 const ::rtl::OUString* pGenericSeq = aGenericNameSeq.getConstArray();
     516         [ #  # ]:          0 :                 for ( sal_uInt32 i = 0; i < nCount2; i++ )
     517         [ #  # ]:          0 :                     pNameSeq[nCount1+i] = pGenericSeq[i];
     518                 :            :             }
     519                 :            : 
     520 [ #  # ][ #  # ]:          0 :             return aNameSeq;
              [ #  #  # ]
     521                 :            :         }
     522         [ #  # ]:          0 :         catch (const com::sun::star::container::NoSuchElementException&)
     523                 :            :         {
     524                 :            :         }
     525         [ #  # ]:          0 :         catch (const com::sun::star::lang::WrappedTargetException&)
     526                 :            :         {
     527         [ #  # ]:          0 :         }
     528                 :            :     }
     529                 :            : 
     530 [ #  # ][ #  # ]:          0 :     return Sequence< rtl::OUString >();
     531                 :            : }
     532                 :            : 
     533                 :        144 : sal_Bool ConfigurationAccess_UICommand::initializeConfigAccess()
     534                 :            : {
     535         [ +  - ]:        144 :     Sequence< Any > aArgs( 1 );
     536                 :        144 :     PropertyValue   aPropValue;
     537                 :            : 
     538                 :            :     try
     539                 :            :     {
     540                 :        144 :         aPropValue.Name  = rtl::OUString( "nodepath" );
     541         [ +  - ]:        144 :         aPropValue.Value <<= m_aConfigCmdAccess;
     542 [ +  - ][ +  - ]:        144 :         aArgs[0] <<= aPropValue;
     543                 :            : 
     544 [ +  - ][ +  - ]:        144 :         m_xConfigAccess = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ),UNO_QUERY );
         [ +  - ][ +  - ]
                 [ +  - ]
     545         [ +  - ]:        144 :         if ( m_xConfigAccess.is() )
     546                 :            :         {
     547                 :            :             // Add as container listener
     548         [ +  - ]:        144 :             Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
     549         [ +  - ]:        144 :             if ( xContainer.is() )
     550                 :            :             {
     551 [ +  - ][ +  - ]:        144 :                 m_xConfigListener = new WeakContainerListener(this);
         [ +  - ][ +  - ]
     552 [ +  - ][ +  - ]:        144 :                 xContainer->addContainerListener(m_xConfigListener);
     553                 :        144 :             }
     554                 :            :         }
     555                 :            : 
     556         [ +  - ]:        144 :         aPropValue.Value <<= m_aConfigPopupAccess;
     557 [ +  - ][ +  - ]:        144 :         aArgs[0] <<= aPropValue;
     558 [ +  - ][ +  - ]:        144 :         m_xConfigAccessPopups = Reference< XNameAccess >( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ),UNO_QUERY );
         [ +  - ][ +  - ]
                 [ +  - ]
     559         [ +  - ]:        144 :         if ( m_xConfigAccessPopups.is() )
     560                 :            :         {
     561                 :            :             // Add as container listener
     562         [ +  - ]:        144 :             Reference< XContainer > xContainer( m_xConfigAccessPopups, UNO_QUERY );
     563         [ +  - ]:        144 :             if ( xContainer.is() )
     564                 :            :             {
     565 [ +  - ][ +  - ]:        144 :                 m_xConfigAccessListener = new WeakContainerListener(this);
         [ +  - ][ +  - ]
     566 [ +  - ][ +  - ]:        144 :                 xContainer->addContainerListener(m_xConfigAccessListener);
     567      [ #  #  # ]:        144 :             }
     568                 :            :         }
     569                 :            : 
     570                 :        144 :         return sal_True;
     571                 :            :     }
     572         [ #  # ]:          0 :     catch (const WrappedTargetException&)
     573                 :            :     {
     574                 :            :     }
     575         [ #  # ]:          0 :     catch (const Exception&)
     576                 :            :     {
     577                 :            :     }
     578                 :            : 
     579         [ +  - ]:        144 :     return sal_False;
     580                 :            : }
     581                 :            : 
     582                 :            : // container.XContainerListener
     583                 :          0 : void SAL_CALL ConfigurationAccess_UICommand::elementInserted( const ContainerEvent& ) throw(RuntimeException)
     584                 :            : {
     585         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     586                 :          0 :     m_bCacheFilled = sal_False;
     587 [ #  # ][ #  # ]:          0 :     fillCache();
     588                 :          0 : }
     589                 :            : 
     590                 :          0 : void SAL_CALL ConfigurationAccess_UICommand::elementRemoved( const ContainerEvent& ) throw(RuntimeException)
     591                 :            : {
     592         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     593                 :          0 :     m_bCacheFilled = sal_False;
     594 [ #  # ][ #  # ]:          0 :     fillCache();
     595                 :          0 : }
     596                 :            : 
     597                 :          0 : void SAL_CALL ConfigurationAccess_UICommand::elementReplaced( const ContainerEvent& ) throw(RuntimeException)
     598                 :            : {
     599         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     600                 :          0 :     m_bCacheFilled = sal_False;
     601 [ #  # ][ #  # ]:          0 :     fillCache();
     602                 :          0 : }
     603                 :            : 
     604                 :            : // lang.XEventListener
     605                 :          0 : void SAL_CALL ConfigurationAccess_UICommand::disposing( const EventObject& aEvent ) throw(RuntimeException)
     606                 :            : {
     607                 :            :     // SAFE
     608                 :            :     // remove our reference to the config access
     609         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     610                 :            : 
     611         [ #  # ]:          0 :     Reference< XInterface > xIfac1( aEvent.Source, UNO_QUERY );
     612         [ #  # ]:          0 :     Reference< XInterface > xIfac2( m_xConfigAccess, UNO_QUERY );
     613 [ #  # ][ #  # ]:          0 :     if ( xIfac1 == xIfac2 )
     614                 :          0 :         m_xConfigAccess.clear();
     615                 :            :     else
     616                 :            :     {
     617 [ #  # ][ #  # ]:          0 :         xIfac2 = Reference< XInterface >( m_xConfigAccessPopups, UNO_QUERY );
     618 [ #  # ][ #  # ]:          0 :         if ( xIfac1 == xIfac2 )
     619                 :          0 :             m_xConfigAccessPopups.clear();
     620         [ #  # ]:          0 :     }
     621                 :          0 : }
     622                 :            : 
     623                 :            : //*****************************************************************************************************************
     624                 :            : //  XInterface, XTypeProvider, XServiceInfo
     625                 :            : //*****************************************************************************************************************
     626 [ +  - ][ +  - ]:       2549 : DEFINE_XSERVICEINFO_ONEINSTANCESERVICE  (   UICommandDescription                    ,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
                 [ #  # ]
     627                 :            :                                             ::cppu::OWeakObject                     ,
     628                 :            :                                             SERVICENAME_UICOMMANDDESCRIPTION        ,
     629                 :            :                                             IMPLEMENTATIONNAME_UICOMMANDDESCRIPTION
     630                 :            :                                         )
     631                 :            : 
     632                 :         60 : DEFINE_INIT_SERVICE                     (   UICommandDescription, {} )
     633                 :            : 
     634                 :         60 : UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactory >& xServiceManager ) :
     635                 :            :     ThreadHelpBase(),
     636                 :            :     m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ),
     637 [ +  - ][ +  - ]:         60 :     m_xServiceManager( xServiceManager )
                 [ +  - ]
     638                 :            : {
     639                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::UICommandDescription" );
     640                 :         60 :     Reference< XNameAccess > xEmpty;
     641                 :         60 :     rtl::OUString aGenericUICommand( "GenericCommands" );
     642 [ +  - ][ +  - ]:         60 :     m_xGenericUICommands = new ConfigurationAccess_UICommand( aGenericUICommand, xEmpty, xServiceManager );
                 [ +  - ]
     643                 :            : 
     644         [ +  - ]:         60 :     impl_fillElements("ooSetupFactoryCommandConfigRef");
     645                 :            : 
     646                 :            :     // insert generic commands
     647         [ +  - ]:         60 :     UICommandsHashMap::iterator pIter = m_aUICommandsHashMap.find( aGenericUICommand );
     648 [ +  - ][ -  + ]:         60 :     if ( pIter != m_aUICommandsHashMap.end() )
     649 [ #  # ][ #  # ]:         60 :         pIter->second = m_xGenericUICommands;
     650                 :         60 : }
     651                 :          2 : UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactory >& xServiceManager,bool ) :
     652                 :            :     ThreadHelpBase(),
     653 [ +  - ][ +  - ]:          2 :     m_xServiceManager( xServiceManager )
                 [ +  - ]
     654                 :            : {
     655                 :          2 : }
     656 [ +  - ][ +  - ]:         62 : UICommandDescription::~UICommandDescription()
                 [ +  - ]
     657                 :            : {
     658         [ +  - ]:         62 :     ResetableGuard aLock( m_aLock );
     659         [ +  - ]:         62 :     m_aModuleToCommandFileMap.clear();
     660         [ +  - ]:         62 :     m_aUICommandsHashMap.clear();
     661         [ +  - ]:         62 :     m_xGenericUICommands.clear();
     662         [ -  + ]:        122 : }
     663                 :         62 : void UICommandDescription::impl_fillElements(const sal_Char* _pName)
     664                 :            : {
     665 [ +  - ][ +  - ]:         62 :     m_xModuleManager.set( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY );
         [ +  - ][ +  - ]
     666         [ +  - ]:         62 :     Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW );
     667 [ +  - ][ +  - ]:         62 :     Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames();
     668         [ +  - ]:         62 :     Sequence< PropertyValue > aSeq;
     669                 :         62 :     ::rtl::OUString                  aModuleIdentifier;
     670                 :            : 
     671         [ +  + ]:       1426 :     for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
     672                 :            :     {
     673         [ +  - ]:       1364 :         aModuleIdentifier = aElementNames[i];
     674 [ +  - ][ +  - ]:       1364 :         if ( xNameAccess->getByName( aModuleIdentifier ) >>= aSeq )
         [ +  - ][ +  - ]
     675                 :            :         {
     676                 :       1364 :             ::rtl::OUString aCommandStr;
     677         [ +  - ]:      17776 :             for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
     678                 :            :             {
     679 [ +  - ][ +  + ]:      17776 :                 if ( aSeq[y].Name.equalsAscii(_pName) )
     680                 :            :                 {
     681         [ +  - ]:       1364 :                     aSeq[y].Value >>= aCommandStr;
     682                 :       1364 :                     break;
     683                 :            :                 }
     684                 :            :             }
     685                 :            : 
     686                 :            :             // Create first mapping ModuleIdentifier ==> Command File
     687         [ +  - ]:       1364 :             m_aModuleToCommandFileMap.insert( ModuleToCommandFileMap::value_type( aModuleIdentifier, aCommandStr ));
     688                 :            : 
     689                 :            :             // Create second mapping Command File ==> commands instance
     690         [ +  - ]:       1364 :             UICommandsHashMap::iterator pIter = m_aUICommandsHashMap.find( aCommandStr );
     691 [ +  - ][ +  + ]:       1364 :             if ( pIter == m_aUICommandsHashMap.end() )
     692 [ +  - ][ +  - ]:       1364 :                 m_aUICommandsHashMap.insert( UICommandsHashMap::value_type( aCommandStr, Reference< XNameAccess >() ));
                 [ +  - ]
     693                 :            :         }
     694 [ +  - ][ +  - ]:         62 :     } // for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
     695                 :         62 : }
     696                 :          0 : Reference< XNameAccess > UICommandDescription::impl_createConfigAccess(const ::rtl::OUString& _sName)
     697                 :            : {
     698 [ #  # ][ #  # ]:          0 :     return new ConfigurationAccess_UICommand( _sName,m_xGenericUICommands,m_xServiceManager );
     699                 :            : }
     700                 :            : 
     701                 :       8462 : Any SAL_CALL UICommandDescription::getByName( const ::rtl::OUString& aName )
     702                 :            : throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     703                 :            : {
     704                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::getByName" );
     705                 :       8462 :     Any a;
     706                 :            : 
     707         [ +  - ]:       8462 :     ResetableGuard aLock( m_aLock );
     708                 :            : 
     709         [ +  - ]:       8462 :     ModuleToCommandFileMap::const_iterator pM2CIter = m_aModuleToCommandFileMap.find( aName );
     710 [ +  + ][ +  - ]:       8462 :     if ( pM2CIter != m_aModuleToCommandFileMap.end() )
     711                 :            :     {
     712         [ +  - ]:       8398 :         ::rtl::OUString aCommandFile( pM2CIter->second );
     713         [ +  - ]:       8398 :         UICommandsHashMap::iterator pIter = m_aUICommandsHashMap.find( aCommandFile );
     714 [ +  - ][ +  - ]:       8398 :         if ( pIter != m_aUICommandsHashMap.end() )
     715                 :            :         {
     716 [ +  - ][ +  + ]:       8398 :             if ( pIter->second.is() )
     717 [ +  - ][ +  - ]:       8310 :                 a <<= pIter->second;
     718                 :            :             else
     719                 :            :             {
     720                 :         88 :                 Reference< XNameAccess > xUICommands;
     721                 :            :                 ConfigurationAccess_UICommand* pUICommands = new ConfigurationAccess_UICommand( aCommandFile,
     722                 :            :                                                                                                m_xGenericUICommands,
     723         [ +  - ]:         88 :                                                                                                m_xServiceManager );
     724 [ +  - ][ +  - ]:         88 :                 xUICommands = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pUICommands ),UNO_QUERY );
     725 [ +  - ][ +  - ]:         88 :                 pIter->second = xUICommands;
     726         [ +  - ]:         88 :                 a <<= xUICommands;
     727                 :            :             }
     728                 :       8398 :         }
     729                 :            :     }
     730 [ +  + ][ +  + ]:         64 :     else if ( !m_aPrivateResourceURL.isEmpty() && aName.indexOf( m_aPrivateResourceURL ) == 0 )
                 [ +  + ]
     731                 :            :     {
     732                 :            :         // special keys to retrieve information about a set of commands
     733 [ +  - ][ +  - ]:         60 :         return m_xGenericUICommands->getByName( aName );
     734                 :            :     }
     735                 :            :     else
     736                 :            :     {
     737         [ +  - ]:          4 :         throw NoSuchElementException();
     738                 :            :     }
     739                 :            : 
     740         [ +  - ]:       8462 :     return a;
     741                 :            : }
     742                 :            : 
     743                 :          4 : Sequence< ::rtl::OUString > SAL_CALL UICommandDescription::getElementNames()
     744                 :            : throw (::com::sun::star::uno::RuntimeException)
     745                 :            : {
     746                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::getElementNames" );
     747         [ +  - ]:          4 :     ResetableGuard aLock( m_aLock );
     748                 :            : 
     749         [ +  - ]:          4 :     Sequence< rtl::OUString > aSeq( m_aModuleToCommandFileMap.size() );
     750                 :            : 
     751                 :          4 :     sal_Int32 n = 0;
     752         [ +  - ]:          4 :     ModuleToCommandFileMap::const_iterator pIter = m_aModuleToCommandFileMap.begin();
     753 [ +  - ][ +  + ]:         94 :     while ( pIter != m_aModuleToCommandFileMap.end() )
     754                 :            :     {
     755 [ +  - ][ +  - ]:         90 :         aSeq[n] = pIter->first;
     756                 :         90 :         ++pIter;
     757                 :            :     }
     758                 :            : 
     759         [ +  - ]:          4 :     return aSeq;
     760                 :            : }
     761                 :            : 
     762                 :          8 : sal_Bool SAL_CALL UICommandDescription::hasByName( const ::rtl::OUString& aName )
     763                 :            : throw (::com::sun::star::uno::RuntimeException)
     764                 :            : {
     765                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::hasByName" );
     766         [ +  - ]:          8 :     ResetableGuard aLock( m_aLock );
     767                 :            : 
     768         [ +  - ]:          8 :     ModuleToCommandFileMap::const_iterator pIter = m_aModuleToCommandFileMap.find( aName );
     769 [ +  - ][ +  - ]:          8 :     return ( pIter != m_aModuleToCommandFileMap.end() );
     770                 :            : }
     771                 :            : 
     772                 :            : // XElementAccess
     773                 :          4 : Type SAL_CALL UICommandDescription::getElementType()
     774                 :            : throw (::com::sun::star::uno::RuntimeException)
     775                 :            : {
     776                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::getElementType" );
     777                 :          4 :     return( ::getCppuType( (const Reference< XNameAccess >*)NULL ) );
     778                 :            : }
     779                 :            : 
     780                 :          4 : sal_Bool SAL_CALL UICommandDescription::hasElements()
     781                 :            : throw (::com::sun::star::uno::RuntimeException)
     782                 :            : {
     783                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::hasElements" );
     784                 :            :     // generic UI commands are always available!
     785                 :          4 :     return sal_True;
     786                 :            : }
     787                 :            : 
     788                 :            : } // namespace framework
     789                 :            : 
     790                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10