LCOV - code coverage report
Current view: top level - framework/source/helper - uiconfigelementwrapperbase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 81 197 41.1 %
Date: 2012-08-25 Functions: 11 28 39.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 80 363 22.0 %

           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 <helper/uiconfigelementwrapperbase.hxx>
      30                 :            : #include <general.h>
      31                 :            : #include <properties.h>
      32                 :            : #include <threadhelp/resetableguard.hxx>
      33                 :            : #include <uielement/constitemcontainer.hxx>
      34                 :            : #include <uielement/rootitemcontainer.hxx>
      35                 :            : 
      36                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      37                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      38                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      39                 :            : #include <com/sun/star/ui/XUIConfiguration.hpp>
      40                 :            : 
      41                 :            : #include <vcl/svapp.hxx>
      42                 :            : #include <rtl/logfile.hxx>
      43                 :            : 
      44                 :            : const int UIELEMENT_PROPHANDLE_CONFIGSOURCE     = 1;
      45                 :            : const int UIELEMENT_PROPHANDLE_FRAME            = 2;
      46                 :            : const int UIELEMENT_PROPHANDLE_PERSISTENT       = 3;
      47                 :            : const int UIELEMENT_PROPHANDLE_RESOURCEURL      = 4;
      48                 :            : const int UIELEMENT_PROPHANDLE_TYPE             = 5;
      49                 :            : const int UIELEMENT_PROPHANDLE_XMENUBAR         = 6;
      50                 :            : const int UIELEMENT_PROPHANDLE_CONFIGLISTENER   = 7;
      51                 :            : const int UIELEMENT_PROPHANDLE_NOCLOSE          = 8;
      52                 :            : const int UIELEMENT_PROPCOUNT                   = 8;
      53                 :            : const char UIELEMENT_PROPNAME_CONFIGLISTENER[] = "ConfigListener";
      54                 :            : const char UIELEMENT_PROPNAME_CONFIGSOURCE[] = "ConfigurationSource";
      55                 :            : const char UIELEMENT_PROPNAME_FRAME[] = "Frame";
      56                 :            : const char UIELEMENT_PROPNAME_PERSISTENT[] = "Persistent";
      57                 :            : const char UIELEMENT_PROPNAME_RESOURCEURL[] = "ResourceURL";
      58                 :            : const char UIELEMENT_PROPNAME_TYPE[] = "Type";
      59                 :            : const char UIELEMENT_PROPNAME_XMENUBAR[] = "XMenuBar";
      60                 :            : const char UIELEMENT_PROPNAME_NOCLOSE[] = "NoClose";
      61                 :            : using ::rtl::OUString;
      62                 :            : using namespace com::sun::star::beans;
      63                 :            : using namespace com::sun::star::uno;
      64                 :            : using namespace com::sun::star::frame;
      65                 :            : using namespace com::sun::star::lang;
      66                 :            : using namespace com::sun::star::container;
      67                 :            : using namespace ::com::sun::star::ui;
      68                 :            : 
      69                 :            : namespace framework
      70                 :            : {
      71                 :            : 
      72                 :            : //*****************************************************************************************************************
      73                 :            : //  XInterface, XTypeProvider
      74                 :            : //*****************************************************************************************************************
      75 [ +  + ][ +  - ]:     473922 : DEFINE_XINTERFACE_10    (   UIConfigElementWrapperBase                                               ,
      76                 :            :                             OWeakObject                                                              ,
      77                 :            :                             DIRECT_INTERFACE( ::com::sun::star::lang::XTypeProvider                  ),
      78                 :            :                             DIRECT_INTERFACE( ::com::sun::star::ui::XUIElement               ),
      79                 :            :                             DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementSettings       ),
      80                 :            :                             DIRECT_INTERFACE( ::com::sun::star::beans::XMultiPropertySet             ),
      81                 :            :                             DIRECT_INTERFACE( ::com::sun::star::beans::XFastPropertySet              ),
      82                 :            :                             DIRECT_INTERFACE( ::com::sun::star::beans::XPropertySet                  ),
      83                 :            :                             DIRECT_INTERFACE( ::com::sun::star::lang::XInitialization                ),
      84                 :            :                             DIRECT_INTERFACE( ::com::sun::star::lang::XComponent                     ),
      85                 :            :                             DIRECT_INTERFACE( ::com::sun::star::util::XUpdatable                     ),
      86                 :            :                             DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationListener )
      87                 :            :                         )
      88                 :            : 
      89 [ #  # ][ #  # ]:          0 : DEFINE_XTYPEPROVIDER_10 (   UIConfigElementWrapperBase                              ,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      90                 :            :                             ::com::sun::star::lang::XTypeProvider                   ,
      91                 :            :                             ::com::sun::star::ui::XUIElement                ,
      92                 :            :                             ::com::sun::star::ui::XUIElementSettings        ,
      93                 :            :                             ::com::sun::star::beans::XMultiPropertySet              ,
      94                 :            :                             ::com::sun::star::beans::XFastPropertySet               ,
      95                 :            :                             ::com::sun::star::beans::XPropertySet                   ,
      96                 :            :                             ::com::sun::star::lang::XInitialization                 ,
      97                 :            :                             ::com::sun::star::lang::XComponent                      ,
      98                 :            :                             ::com::sun::star::util::XUpdatable                      ,
      99                 :            :                             ::com::sun::star::ui::XUIConfigurationListener
     100                 :            :                         )
     101                 :            : 
     102                 :       7163 : UIConfigElementWrapperBase::UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory )
     103         [ +  - ]:       7163 :     :   ThreadHelpBase              ( &Application::GetSolarMutex()                      )
     104         [ +  - ]:       7163 :     ,   ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() )
     105                 :            :     ,   ::cppu::OPropertySetHelper  ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) )
     106                 :            :     ,   ::cppu::OWeakObject         (                                                   )
     107                 :            :     ,   m_nType                     ( nType                                             )
     108                 :            :     ,   m_bPersistent               ( sal_True                                          )
     109                 :            :     ,   m_bInitialized              ( sal_False                                         )
     110                 :            :     ,   m_bConfigListener           ( sal_False                                         )
     111                 :            :     ,   m_bConfigListening          ( sal_False                                         )
     112                 :            :     ,   m_bDisposed                 ( sal_False                                         )
     113                 :            :     ,   m_bNoClose                  ( sal_False                                         )
     114                 :            :     ,   m_xServiceFactory           ( _xServiceFactory                                  )
     115 [ +  - ][ +  - ]:      21489 :     ,   m_aListenerContainer        ( m_aLock.getShareableOslMutex()                    )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     116                 :            : {
     117                 :       7163 : }
     118                 :            : 
     119 [ +  - ][ +  - ]:       6799 : UIConfigElementWrapperBase::~UIConfigElementWrapperBase()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     120                 :            : {
     121         [ -  + ]:       6799 : }
     122                 :            : 
     123                 :            : // XComponent
     124                 :          0 : void SAL_CALL UIConfigElementWrapperBase::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
     125                 :            : {
     126                 :          0 :     m_aListenerContainer.addInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener );
     127                 :          0 : }
     128                 :            : 
     129                 :          0 : void SAL_CALL UIConfigElementWrapperBase::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException)
     130                 :            : {
     131                 :          0 :     m_aListenerContainer.removeInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), aListener );
     132                 :          0 : }
     133                 :            : 
     134                 :            : // XEventListener
     135                 :          0 : void SAL_CALL UIConfigElementWrapperBase::disposing( const EventObject& )
     136                 :            : throw( RuntimeException )
     137                 :            : {
     138         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     139         [ #  # ]:          0 :     m_xConfigSource.clear();
     140                 :          0 : }
     141                 :            : 
     142                 :       7163 : void SAL_CALL UIConfigElementWrapperBase::initialize( const Sequence< Any >& aArguments )
     143                 :            : throw ( Exception, RuntimeException )
     144                 :            : {
     145         [ +  - ]:       7163 :     ResetableGuard aLock( m_aLock );
     146                 :            : 
     147         [ +  - ]:       7163 :     if ( !m_bInitialized )
     148                 :            :     {
     149         [ +  + ]:      41237 :         for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
     150                 :            :         {
     151                 :      34074 :             PropertyValue aPropValue;
     152 [ +  - ][ +  - ]:      34074 :             if ( aArguments[n] >>= aPropValue )
     153                 :            :             {
     154         [ +  + ]:      34074 :                 if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGSOURCE )
     155         [ +  - ]:       7163 :                     setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGSOURCE, aPropValue.Value );
     156         [ +  + ]:      26911 :                 else if ( aPropValue.Name == UIELEMENT_PROPNAME_FRAME )
     157         [ +  - ]:       7163 :                     setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_FRAME, aPropValue.Value );
     158         [ +  + ]:      19748 :                 else if ( aPropValue.Name == UIELEMENT_PROPNAME_PERSISTENT )
     159         [ +  - ]:       7163 :                     setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_PERSISTENT, aPropValue.Value );
     160         [ +  + ]:      12585 :                 else if ( aPropValue.Name == UIELEMENT_PROPNAME_RESOURCEURL )
     161         [ +  - ]:       7163 :                     setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_RESOURCEURL, aPropValue.Value );
     162         [ -  + ]:       5422 :                 else if ( aPropValue.Name == UIELEMENT_PROPNAME_TYPE )
     163         [ #  # ]:          0 :                     setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_TYPE, aPropValue.Value );
     164         [ -  + ]:       5422 :                 else if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGLISTENER )
     165         [ #  # ]:          0 :                     setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGLISTENER, aPropValue.Value );
     166         [ -  + ]:       5422 :                 else if ( aPropValue.Name == UIELEMENT_PROPNAME_NOCLOSE )
     167         [ #  # ]:          0 :                     setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_NOCLOSE, aPropValue.Value );
     168                 :            :             }
     169                 :      34074 :         }
     170                 :            : 
     171                 :       7163 :         m_bInitialized = sal_True;
     172         [ +  - ]:       7163 :     }
     173                 :       7163 : }
     174                 :            : 
     175                 :            : // XUpdatable
     176                 :          0 : void SAL_CALL UIConfigElementWrapperBase::update() throw (::com::sun::star::uno::RuntimeException)
     177                 :            : {
     178                 :            :     // can be implemented by derived class
     179                 :          0 : }
     180                 :            : 
     181                 :          0 : void SAL_CALL UIConfigElementWrapperBase::elementInserted( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException)
     182                 :            : {
     183                 :            :     // can be implemented by derived class
     184                 :          0 : }
     185                 :            : 
     186                 :          0 : void SAL_CALL UIConfigElementWrapperBase::elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException)
     187                 :            : {
     188                 :            :     // can be implemented by derived class
     189                 :          0 : }
     190                 :            : 
     191                 :          0 : void SAL_CALL UIConfigElementWrapperBase::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException)
     192                 :            : {
     193                 :            :     // can be implemented by derived class
     194                 :          0 : }
     195                 :            : 
     196                 :            : // XPropertySet helper
     197                 :          0 : sal_Bool SAL_CALL UIConfigElementWrapperBase::convertFastPropertyValue( Any&       aConvertedValue ,
     198                 :            :                                                                         Any&       aOldValue       ,
     199                 :            :                                                                         sal_Int32  nHandle         ,
     200                 :            :                                                                         const Any& aValue             ) throw( com::sun::star::lang::IllegalArgumentException )
     201                 :            : {
     202                 :            :     //  Initialize state with sal_False !!!
     203                 :            :     //  (Handle can be invalid)
     204                 :          0 :     sal_Bool bReturn = sal_False;
     205                 :            : 
     206   [ #  #  #  #  :          0 :     switch( nHandle )
             #  #  #  #  
                      # ]
     207                 :            :     {
     208                 :            :         case UIELEMENT_PROPHANDLE_CONFIGLISTENER:
     209                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     210                 :            :                         com::sun::star::uno::makeAny(m_bConfigListener),
     211                 :            :                         aValue,
     212                 :            :                         aOldValue,
     213         [ #  # ]:          0 :                         aConvertedValue);
     214                 :          0 :             break;
     215                 :            : 
     216                 :            :         case UIELEMENT_PROPHANDLE_CONFIGSOURCE:
     217                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     218                 :            :                         com::sun::star::uno::makeAny(m_xConfigSource),
     219                 :            :                         aValue,
     220                 :            :                         aOldValue,
     221                 :          0 :                         aConvertedValue);
     222                 :          0 :             break;
     223                 :            : 
     224                 :            :         case UIELEMENT_PROPHANDLE_FRAME:
     225                 :            :         {
     226         [ #  # ]:          0 :             Reference< XFrame > xFrame( m_xWeakFrame );
     227                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     228                 :            :                         com::sun::star::uno::makeAny(xFrame),
     229                 :            :                         aValue,
     230                 :            :                         aOldValue,
     231         [ #  # ]:          0 :                         aConvertedValue);
     232                 :            :         }
     233                 :          0 :         break;
     234                 :            : 
     235                 :            :         case UIELEMENT_PROPHANDLE_PERSISTENT:
     236                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     237                 :            :                         com::sun::star::uno::makeAny(m_bPersistent),
     238                 :            :                         aValue,
     239                 :            :                         aOldValue,
     240         [ #  # ]:          0 :                         aConvertedValue);
     241                 :          0 :             break;
     242                 :            : 
     243                 :            :         case UIELEMENT_PROPHANDLE_RESOURCEURL:
     244                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     245                 :            :                         com::sun::star::uno::makeAny(m_aResourceURL),
     246                 :            :                         aValue,
     247                 :            :                         aOldValue,
     248                 :          0 :                         aConvertedValue);
     249                 :          0 :             break;
     250                 :            : 
     251                 :            :         case UIELEMENT_PROPHANDLE_TYPE :
     252                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     253                 :            :                         com::sun::star::uno::makeAny(m_nType),
     254                 :            :                         aValue,
     255                 :            :                         aOldValue,
     256                 :          0 :                         aConvertedValue);
     257                 :          0 :                 break;
     258                 :            : 
     259                 :            :         case UIELEMENT_PROPHANDLE_XMENUBAR :
     260                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     261                 :            :                         com::sun::star::uno::makeAny(m_xMenuBar),
     262                 :            :                         aValue,
     263                 :            :                         aOldValue,
     264                 :          0 :                         aConvertedValue);
     265                 :          0 :                 break;
     266                 :            : 
     267                 :            :         case UIELEMENT_PROPHANDLE_NOCLOSE:
     268                 :            :             bReturn = PropHelper::willPropertyBeChanged(
     269                 :            :                         com::sun::star::uno::makeAny(m_bNoClose),
     270                 :            :                         aValue,
     271                 :            :                         aOldValue,
     272         [ #  # ]:          0 :                         aConvertedValue);
     273                 :          0 :                 break;
     274                 :            :     }
     275                 :            : 
     276                 :            :     // Return state of operation.
     277                 :          0 :     return bReturn ;
     278                 :            : }
     279                 :            : 
     280                 :      28652 : void SAL_CALL UIConfigElementWrapperBase::setFastPropertyValue_NoBroadcast(   sal_Int32               nHandle ,
     281                 :            :                                                                         const com::sun::star::uno::Any&    aValue  ) throw( com::sun::star::uno::Exception )
     282                 :            : {
     283   [ -  +  +  +  :      28652 :     switch( nHandle )
             +  -  -  -  
                      - ]
     284                 :            :     {
     285                 :            :         case UIELEMENT_PROPHANDLE_CONFIGLISTENER:
     286                 :            :         {
     287                 :          0 :             bool bBool( m_bConfigListener );
     288                 :          0 :             aValue >>= bBool;
     289         [ #  # ]:          0 :             if ( m_bConfigListener != bBool )
     290                 :            :             {
     291         [ #  # ]:          0 :                 if ( m_bConfigListening )
     292                 :            :                 {
     293 [ #  # ][ #  # ]:          0 :                     if ( m_xConfigSource.is() && !bBool )
                 [ #  # ]
     294                 :            :                     {
     295                 :            :                         try
     296                 :            :                         {
     297         [ #  # ]:          0 :                             Reference< XUIConfiguration > xUIConfig( m_xConfigSource, UNO_QUERY );
     298         [ #  # ]:          0 :                             if ( xUIConfig.is() )
     299                 :            :                             {
     300 [ #  # ][ #  # ]:          0 :                                 xUIConfig->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY ));
                 [ #  # ]
     301                 :          0 :                                 m_bConfigListening = sal_False;
     302         [ #  # ]:          0 :                             }
     303                 :            :                         }
     304         [ #  # ]:          0 :                         catch ( const Exception& )
     305                 :            :                         {
     306                 :            :                         }
     307                 :            :                     }
     308                 :            :                 }
     309                 :            :                 else
     310                 :            :                 {
     311 [ #  # ][ #  # ]:          0 :                     if ( m_xConfigSource.is() && bBool )
                 [ #  # ]
     312                 :            :                     {
     313                 :            :                         try
     314                 :            :                         {
     315         [ #  # ]:          0 :                             Reference< XUIConfiguration > xUIConfig( m_xConfigSource, UNO_QUERY );
     316         [ #  # ]:          0 :                             if ( xUIConfig.is() )
     317                 :            :                             {
     318 [ #  # ][ #  # ]:          0 :                                 xUIConfig->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY ));
                 [ #  # ]
     319                 :          0 :                                 m_bConfigListening = sal_True;
     320         [ #  # ]:          0 :                             }
     321                 :            :                         }
     322         [ #  # ]:          0 :                         catch ( const Exception& )
     323                 :            :                         {
     324                 :            :                         }
     325                 :            :                     }
     326                 :            :                 }
     327                 :            : 
     328                 :          0 :                 m_bConfigListener = bBool;
     329                 :            :             }
     330                 :            :         }
     331                 :          0 :         break;
     332                 :            :         case UIELEMENT_PROPHANDLE_CONFIGSOURCE:
     333                 :       7163 :             aValue >>= m_xConfigSource;
     334                 :       7163 :             break;
     335                 :            :         case UIELEMENT_PROPHANDLE_FRAME:
     336                 :            :         {
     337                 :       7163 :             Reference< XFrame > xFrame;
     338                 :            : 
     339         [ +  - ]:       7163 :             aValue >>= xFrame;
     340         [ +  - ]:       7163 :             m_xWeakFrame = xFrame;
     341                 :       7163 :             break;
     342                 :            :         }
     343                 :            :         case UIELEMENT_PROPHANDLE_PERSISTENT:
     344                 :            :         {
     345                 :       7163 :             sal_Bool bBool( m_bPersistent );
     346                 :       7163 :             aValue >>= bBool;
     347                 :       7163 :             m_bPersistent = bBool;
     348                 :            :             break;
     349                 :            :         }
     350                 :            :         case UIELEMENT_PROPHANDLE_RESOURCEURL:
     351                 :       7163 :             aValue >>= m_aResourceURL;
     352                 :       7163 :             break;
     353                 :            :         case UIELEMENT_PROPHANDLE_TYPE:
     354                 :          0 :             aValue >>= m_nType;
     355                 :          0 :             break;
     356                 :            :         case UIELEMENT_PROPHANDLE_XMENUBAR:
     357                 :          0 :             aValue >>= m_xMenuBar;
     358                 :          0 :             break;
     359                 :            :         case UIELEMENT_PROPHANDLE_NOCLOSE:
     360                 :            :         {
     361                 :          0 :             sal_Bool bBool( m_bNoClose );
     362                 :          0 :             aValue >>= bBool;
     363                 :          0 :             m_bNoClose = bBool;
     364                 :            :             break;
     365                 :            :         }
     366                 :            :     }
     367                 :      28652 : }
     368                 :            : 
     369                 :       7780 : void SAL_CALL UIConfigElementWrapperBase::getFastPropertyValue( com::sun::star::uno::Any& aValue  ,
     370                 :            :                                                                 sal_Int32                 nHandle   ) const
     371                 :            : {
     372   [ -  +  -  +  :       7780 :     switch( nHandle )
             +  +  +  -  
                      - ]
     373                 :            :     {
     374                 :            :         case UIELEMENT_PROPHANDLE_CONFIGLISTENER:
     375         [ #  # ]:          0 :             aValue <<= m_bConfigListener;
     376                 :          0 :             break;
     377                 :            :         case UIELEMENT_PROPHANDLE_CONFIGSOURCE:
     378                 :         12 :             aValue <<= m_xConfigSource;
     379                 :         12 :             break;
     380                 :            :         case UIELEMENT_PROPHANDLE_FRAME:
     381                 :            :         {
     382         [ #  # ]:          0 :             Reference< XFrame > xFrame( m_xWeakFrame );
     383         [ #  # ]:          0 :             aValue <<= xFrame;
     384                 :          0 :             break;
     385                 :            :         }
     386                 :            :         case UIELEMENT_PROPHANDLE_PERSISTENT:
     387         [ +  - ]:       4425 :             aValue <<= m_bPersistent;
     388                 :       4425 :             break;
     389                 :            :         case UIELEMENT_PROPHANDLE_RESOURCEURL:
     390                 :          8 :             aValue <<= m_aResourceURL;
     391                 :          8 :             break;
     392                 :            :         case UIELEMENT_PROPHANDLE_TYPE:
     393                 :          8 :             aValue <<= m_nType;
     394                 :          8 :             break;
     395                 :            :         case UIELEMENT_PROPHANDLE_XMENUBAR:
     396                 :       3327 :             aValue <<= m_xMenuBar;
     397                 :       3327 :             break;
     398                 :            :         case UIELEMENT_PROPHANDLE_NOCLOSE:
     399         [ #  # ]:          0 :             aValue <<= m_bNoClose;
     400                 :          0 :             break;
     401                 :            :     }
     402                 :       7780 : }
     403                 :            : 
     404                 :      15560 : ::cppu::IPropertyArrayHelper& SAL_CALL UIConfigElementWrapperBase::getInfoHelper()
     405                 :            : {
     406                 :            :     // Optimize this method !
     407                 :            :     // We initialize a static variable only one time. And we don't must use a mutex at every call!
     408                 :            :     // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
     409                 :            :     static ::cppu::OPropertyArrayHelper* pInfoHelper = NULL;
     410                 :            : 
     411         [ +  + ]:      15560 :     if( pInfoHelper == NULL )
     412                 :            :     {
     413                 :            :         // Ready for multithreading
     414 [ +  - ][ +  - ]:        111 :         osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
     415                 :            : 
     416                 :            :         // Control this pointer again, another instance can be faster then these!
     417         [ +  - ]:        111 :         if( pInfoHelper == NULL )
     418                 :            :         {
     419                 :            :             // Define static member to give structure of properties to baseclass "OPropertySetHelper".
     420                 :            :             // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable.
     421                 :            :             // "sal_True" say: Table is sorted by name.
     422 [ +  - ][ +  - ]:        111 :             static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True );
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
     423                 :        111 :             pInfoHelper = &aInfoHelper;
     424         [ +  - ]:        111 :         }
     425                 :            :     }
     426                 :            : 
     427                 :      15560 :     return(*pInfoHelper);
     428                 :            : }
     429                 :            : 
     430                 :          0 : com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL UIConfigElementWrapperBase::getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException)
     431                 :            : {
     432                 :            :     // Optimize this method !
     433                 :            :     // We initialize a static variable only one time. And we don't must use a mutex at every call!
     434                 :            :     // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
     435                 :            :     static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >* pInfo = NULL;
     436                 :            : 
     437         [ #  # ]:          0 :     if( pInfo == NULL )
     438                 :            :     {
     439                 :            :         // Ready for multithreading
     440 [ #  # ][ #  # ]:          0 :         osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
     441                 :            :         // Control this pointer again, another instance can be faster then these!
     442         [ #  # ]:          0 :         if( pInfo == NULL )
     443                 :            :         {
     444                 :            :             // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
     445                 :            :             // (Use method "getInfoHelper()".)
     446 [ #  # ][ #  # ]:          0 :             static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     447                 :          0 :             pInfo = &xInfo;
     448         [ #  # ]:          0 :         }
     449                 :            :     }
     450                 :            : 
     451                 :          0 :     return (*pInfo);
     452                 :            : }
     453                 :            : 
     454                 :        111 : const com::sun::star::uno::Sequence< com::sun::star::beans::Property > UIConfigElementWrapperBase::impl_getStaticPropertyDescriptor()
     455                 :            : {
     456                 :            :     // Create property array to initialize sequence!
     457                 :            :     // Table of all predefined properties of this class. Its used from OPropertySetHelper-class!
     458                 :            :     // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!!
     459                 :            :     // It's necessary for methods of OPropertySetHelper.
     460                 :            :     // ATTENTION:
     461                 :            :     //      YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!!
     462                 :            : 
     463                 :            :     const com::sun::star::beans::Property pProperties[] =
     464                 :            :     {
     465         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_CONFIGLISTENER), UIELEMENT_PROPHANDLE_CONFIGLISTENER , ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT  ),
     466         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_CONFIGSOURCE), UIELEMENT_PROPHANDLE_CONFIGSOURCE   , ::getCppuType((const Reference< ::com::sun::star::ui::XUIConfigurationManager >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT  ),
     467         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_FRAME), UIELEMENT_PROPHANDLE_FRAME          , ::getCppuType((const Reference< com::sun::star::frame::XFrame >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ),
     468         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_NOCLOSE), UIELEMENT_PROPHANDLE_NOCLOSE        , ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ),
     469         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_PERSISTENT), UIELEMENT_PROPHANDLE_PERSISTENT     , ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT  ),
     470         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_RESOURCEURL), UIELEMENT_PROPHANDLE_RESOURCEURL    , ::getCppuType((const ::rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ),
     471         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_TYPE), UIELEMENT_PROPHANDLE_TYPE           , ::getCppuType((const ::rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ),
     472         [ +  - ]:        111 :         com::sun::star::beans::Property( rtl::OUString(UIELEMENT_PROPNAME_XMENUBAR), UIELEMENT_PROPHANDLE_XMENUBAR       , ::getCppuType((const Reference< com::sun::star::awt::XMenuBar >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY )
     473   [ #  #  #  # ]:       1776 :     };
     474                 :            :     // Use it to initialize sequence!
     475         [ +  - ]:        111 :     const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, UIELEMENT_PROPCOUNT );
     476                 :            :     // Return "PropertyDescriptor"
     477 [ +  + ][ #  # ]:        999 :     return lPropertyDescriptor;
     478                 :            : }
     479                 :          0 : void SAL_CALL UIConfigElementWrapperBase::setSettings( const Reference< XIndexAccess >& xSettings ) throw ( RuntimeException )
     480                 :            : {
     481         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     482                 :            : 
     483                 :            : 
     484         [ #  # ]:          0 :     if ( xSettings.is() )
     485                 :            :     {
     486                 :            :         // Create a copy of the data if the container is not const
     487         [ #  # ]:          0 :         Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY );
     488         [ #  # ]:          0 :         if ( xReplace.is() )
     489 [ #  # ][ #  # ]:          0 :             m_xConfigData = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
     490                 :            :         else
     491         [ #  # ]:          0 :             m_xConfigData = xSettings;
     492                 :            : 
     493 [ #  # ][ #  # ]:          0 :         if ( m_xConfigSource.is() && m_bPersistent )
                 [ #  # ]
     494                 :            :         {
     495                 :          0 :             ::rtl::OUString aResourceURL( m_aResourceURL );
     496                 :          0 :             Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource );
     497                 :            : 
     498         [ #  # ]:          0 :             aLock.unlock();
     499                 :            : 
     500                 :            :             try
     501                 :            :             {
     502 [ #  # ][ #  # ]:          0 :                 xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData );
     503                 :            :             }
     504         [ #  # ]:          0 :             catch( const NoSuchElementException& )
     505                 :            :             {
     506                 :          0 :             }
     507                 :            :         }
     508         [ #  # ]:          0 :         else if ( !m_bPersistent )
     509                 :            :         {
     510                 :            :             // Transient menubar => Fill menubar with new data
     511         [ #  # ]:          0 :             impl_fillNewData();
     512                 :          0 :         }
     513         [ #  # ]:          0 :     }
     514                 :          0 : }
     515                 :          0 : void UIConfigElementWrapperBase::impl_fillNewData()
     516                 :            : {
     517                 :          0 : }
     518                 :          2 : Reference< XIndexAccess > SAL_CALL UIConfigElementWrapperBase::getSettings( sal_Bool bWriteable ) throw ( RuntimeException )
     519                 :            : {
     520         [ +  - ]:          2 :     ResetableGuard aLock( m_aLock );
     521                 :            : 
     522                 :            : 
     523         [ +  - ]:          2 :     if ( bWriteable )
     524 [ +  - ][ +  - ]:          2 :         return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( m_xConfigData ) ), UNO_QUERY );
                 [ +  - ]
     525                 :            : 
     526         [ +  - ]:          2 :     return m_xConfigData;
     527                 :            : }
     528                 :            : 
     529                 :          0 : Reference< XFrame > SAL_CALL UIConfigElementWrapperBase::getFrame() throw (RuntimeException)
     530                 :            : {
     531         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     532         [ #  # ]:          0 :     Reference< XFrame > xFrame( m_xWeakFrame );
     533         [ #  # ]:          0 :     return xFrame;
     534                 :            : }
     535                 :            : 
     536                 :          0 : ::rtl::OUString SAL_CALL UIConfigElementWrapperBase::getResourceURL() throw (RuntimeException)
     537                 :            : {
     538         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     539         [ #  # ]:          0 :     return m_aResourceURL;
     540                 :            : }
     541                 :            : 
     542                 :          0 : ::sal_Int16 SAL_CALL UIConfigElementWrapperBase::getType() throw (RuntimeException)
     543                 :            : {
     544         [ #  # ]:          0 :     ResetableGuard aLock( m_aLock );
     545         [ #  # ]:          0 :     return m_nType;
     546                 :            : }
     547                 :            : 
     548                 :            : }
     549                 :            : 
     550                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10