LCOV - code coverage report
Current view: top level - framework/source/helper - uiconfigelementwrapperbase.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 84 203 41.4 %
Date: 2014-11-03 Functions: 11 27 40.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10