LCOV - code coverage report
Current view: top level - toolkit/source/controls - unocontrol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 607 784 77.4 %
Date: 2012-08-25 Functions: 55 81 67.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 801 1803 44.4 %

           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 <com/sun/star/awt/XControlContainer.hpp>
      30                 :            : #include <com/sun/star/awt/WindowAttribute.hpp>
      31                 :            : #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
      32                 :            : #include <com/sun/star/awt/PosSize.hpp>
      33                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      35                 :            : #include <com/sun/star/resource/XStringResourceResolver.hpp>
      36                 :            : #include <toolkit/controls/unocontrol.hxx>
      37                 :            : #include <toolkit/helper/vclunohelper.hxx>
      38                 :            : #include <cppuhelper/typeprovider.hxx>
      39                 :            : #include <rtl/memory.h>
      40                 :            : #include <rtl/uuid.h>
      41                 :            : #include <osl/mutex.hxx>
      42                 :            : #include <tools/date.hxx>
      43                 :            : #include <tools/debug.hxx>
      44                 :            : #include <tools/diagnose_ex.h>
      45                 :            : #include <vcl/svapp.hxx>
      46                 :            : #include <vcl/wrkwin.hxx>
      47                 :            : #include <comphelper/stl_types.hxx>
      48                 :            : #include <comphelper/processfactory.hxx>
      49                 :            : #include <toolkit/helper/property.hxx>
      50                 :            : #include <toolkit/helper/servicenames.hxx>
      51                 :            : #include <toolkit/helper/vclunohelper.hxx>
      52                 :            : #include <toolkit/awt/vclxwindow.hxx>
      53                 :            : #include <vcl/svapp.hxx>
      54                 :            : #include <osl/mutex.hxx>
      55                 :            : #include <toolkit/controls/accessiblecontrolcontext.hxx>
      56                 :            : #include <comphelper/container.hxx>
      57                 :            : 
      58                 :            : #include <algorithm>
      59                 :            : #include <set>
      60                 :            : 
      61                 :            : using namespace ::com::sun::star;
      62                 :            : using namespace ::com::sun::star::uno;
      63                 :            : using namespace ::com::sun::star::awt;
      64                 :            : using namespace ::com::sun::star::beans;
      65                 :            : using namespace ::com::sun::star::lang;
      66                 :            : using namespace ::com::sun::star::util;
      67                 :            : 
      68                 :            : using ::com::sun::star::accessibility::XAccessibleContext;
      69                 :            : using ::com::sun::star::accessibility::XAccessible;
      70                 :            : 
      71                 :            : struct LanguageDependentProp
      72                 :            : {
      73                 :            :     const char* pPropName;
      74                 :            :     sal_Int32   nPropNameLength;
      75                 :            : };
      76                 :            : 
      77                 :            : static const LanguageDependentProp aLanguageDependentProp[] =
      78                 :            : {
      79                 :            :     { "Text",            4 },
      80                 :            :     { "Label",           5 },
      81                 :            :     { "Title",           5 },
      82                 :            :     { "HelpText",        8 },
      83                 :            :     { "CurrencySymbol", 14 },
      84                 :            :     { "StringItemList", 14 },
      85                 :            :     { 0, 0                 }
      86                 :            : };
      87                 :            : 
      88                 :       1871 : static Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel )
      89                 :            : {
      90         [ +  - ]:       1871 :     Sequence< ::rtl::OUString> aNames;
      91 [ +  - ][ +  - ]:       1871 :     Reference< XPropertySetInfo >  xPSInf = rxModel->getPropertySetInfo();
      92                 :            :     DBG_ASSERT( xPSInf.is(), "UpdateFromModel: No PropertySetInfo!" );
      93         [ +  - ]:       1871 :     if ( xPSInf.is() )
      94                 :            :     {
      95 [ +  - ][ +  - ]:       1871 :         Sequence< Property> aProps = xPSInf->getProperties();
      96                 :       1871 :         sal_Int32 nLen = aProps.getLength();
      97 [ +  - ][ +  - ]:       1871 :         aNames = Sequence< ::rtl::OUString>( nLen );
                 [ +  - ]
      98         [ +  - ]:       1871 :         ::rtl::OUString* pNames = aNames.getArray();
      99                 :       1871 :         const Property* pProps = aProps.getConstArray();
     100         [ +  + ]:      89905 :         for ( sal_Int32 n = 0; n < nLen; ++n, ++pProps, ++pNames)
     101         [ +  - ]:      89905 :             *pNames = pProps->Name;
     102                 :            :     }
     103                 :       1871 :     return aNames;
     104                 :            : }
     105                 :            : 
     106                 :            : //  ====================================================
     107                 :            : class VclListenerLock
     108                 :            : {
     109                 :            : private:
     110                 :            :     VCLXWindow*  m_pLockWindow;
     111                 :            : 
     112                 :            : public:
     113                 :       9550 :     inline VclListenerLock( VCLXWindow* _pLockWindow )
     114                 :       9550 :         :m_pLockWindow( _pLockWindow )
     115                 :            :     {
     116         [ +  - ]:       9550 :         if ( m_pLockWindow )
     117                 :       9550 :             m_pLockWindow->suspendVclEventListening( );
     118                 :       9550 :     }
     119                 :       9550 :     inline ~VclListenerLock( )
     120                 :            :     {
     121         [ +  - ]:       9550 :         if ( m_pLockWindow )
     122                 :       9550 :             m_pLockWindow->resumeVclEventListening( );
     123                 :       9550 :     }
     124                 :            : 
     125                 :            : private:
     126                 :            :     VclListenerLock();                                      // never implemented
     127                 :            :     VclListenerLock( const VclListenerLock& );              // never implemented
     128                 :            :     VclListenerLock& operator=( const VclListenerLock& );   // never implemented
     129                 :            : };
     130                 :            : 
     131                 :            : typedef ::std::map< ::rtl::OUString, sal_Int32 >    MapString2Int;
     132                 :       1044 : struct UnoControl_Data
     133                 :            : {
     134                 :            :     MapString2Int   aSuspendedPropertyNotifications;
     135                 :            :     /// true if and only if our model has a property ResourceResolver
     136                 :            :     bool            bLocalizationSupport;
     137                 :            : 
     138                 :       1078 :     UnoControl_Data()
     139                 :            :         :aSuspendedPropertyNotifications()
     140                 :       1078 :         ,bLocalizationSupport( false )
     141                 :            :     {
     142                 :       1078 :     }
     143                 :            : };
     144                 :            : 
     145                 :            : //  ----------------------------------------------------
     146                 :            : //  class UnoControl
     147                 :            : //  ----------------------------------------------------
     148                 :            : DBG_NAME( UnoControl )
     149                 :          0 : UnoControl::UnoControl()
     150                 :            :     :maContext( ::comphelper::getProcessServiceFactory() )
     151                 :            :     ,maDisposeListeners( *this )
     152                 :            :     ,maWindowListeners( *this )
     153                 :            :     ,maFocusListeners( *this )
     154                 :            :     ,maKeyListeners( *this )
     155                 :            :     ,maMouseListeners( *this )
     156                 :            :     ,maMouseMotionListeners( *this )
     157                 :            :     ,maPaintListeners( *this )
     158                 :          0 :     ,maModeChangeListeners( GetMutex() )
     159 [ #  # ][ #  # ]:          0 :     ,mpData( new UnoControl_Data )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     160                 :            : {
     161                 :            :     DBG_CTOR( UnoControl, NULL );
     162                 :            :     OSL_ENSURE( false, "UnoControl::UnoControl: not implemented. Well, not really." );
     163                 :            :     // just implemented to let the various FooImplInheritanceHelper compile, you should use the
     164                 :            :     // version taking a service factory
     165                 :          0 : }
     166                 :            : 
     167                 :       1078 : UnoControl::UnoControl( const Reference< XMultiServiceFactory >& i_factory )
     168                 :            :     : maContext( i_factory )
     169                 :            :     , maDisposeListeners( *this )
     170                 :            :     , maWindowListeners( *this )
     171                 :            :     , maFocusListeners( *this )
     172                 :            :     , maKeyListeners( *this )
     173                 :            :     , maMouseListeners( *this )
     174                 :            :     , maMouseMotionListeners( *this )
     175                 :            :     , maPaintListeners( *this )
     176                 :       1078 :     , maModeChangeListeners( GetMutex() )
     177 [ +  - ][ +  - ]:       2156 :     , mpData( new UnoControl_Data )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  +  - ]
         [ +  - ][ +  - ]
     178                 :            : {
     179                 :            :     DBG_CTOR( UnoControl, NULL );
     180                 :       1078 :     mbDisposePeer = sal_True;
     181                 :       1078 :     mbRefeshingPeer = sal_False;
     182                 :       1078 :     mbCreatingPeer = sal_False;
     183                 :       1078 :     mbCreatingCompatiblePeer = sal_False;
     184                 :       1078 :     mbDesignMode = sal_False;
     185                 :       1078 : }
     186                 :            : 
     187 [ +  - ][ +  - ]:       1044 : UnoControl::~UnoControl()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     188                 :            : {
     189         [ +  - ]:       1044 :     DELETEZ( mpData );
     190                 :            :     DBG_DTOR( UnoControl, NULL );
     191         [ -  + ]:       1044 : }
     192                 :            : 
     193                 :          0 : ::rtl::OUString UnoControl::GetComponentServiceName()
     194                 :            : {
     195                 :          0 :     return ::rtl::OUString();
     196                 :            : }
     197                 :            : 
     198                 :       4368 : Reference< XWindowPeer >    UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer )
     199                 :            : {
     200                 :            :     DBG_ASSERT( !mbCreatingCompatiblePeer, "ImplGetCompatiblePeer - rekursive?" );
     201                 :            : 
     202                 :       4368 :     mbCreatingCompatiblePeer = sal_True;
     203                 :            : 
     204                 :       4368 :     Reference< XWindowPeer > xCompatiblePeer;
     205                 :            : 
     206         [ +  - ]:       4368 :     if ( bAcceptExistingPeer )
     207 [ +  - ][ +  - ]:       4368 :         xCompatiblePeer = getPeer();
     208                 :            : 
     209         [ +  + ]:       4368 :     if ( !xCompatiblePeer.is() )
     210                 :            :     {
     211                 :            :         // Create the pair as invisible
     212                 :         15 :         sal_Bool bVis = maComponentInfos.bVisible;
     213         [ +  - ]:         15 :         if( bVis )
     214                 :         15 :             maComponentInfos.bVisible = sal_False;
     215                 :            : 
     216         [ +  - ]:         15 :         Reference< XWindowPeer >    xCurrentPeer = getPeer();
     217 [ +  - ][ +  - ]:         15 :         setPeer( NULL );
     218                 :            : 
     219                 :            :         // queryInterface ourself, to allow aggregation
     220                 :         15 :         Reference< XControl > xMe;
     221 [ +  - ][ +  - ]:         15 :         OWeakAggObject::queryInterface( ::getCppuType( &xMe ) ) >>= xMe;
                 [ +  - ]
     222                 :            : 
     223                 :         15 :         Window* pParentWindow( NULL );
     224                 :            :         {
     225         [ +  - ]:         15 :             SolarMutexGuard aGuard;
     226 [ +  - ][ -  + ]:         15 :             pParentWindow = dynamic_cast< Window* >( Application::GetDefaultDevice() );
     227 [ -  + ][ #  # ]:         15 :             ENSURE_OR_THROW( pParentWindow != NULL, "could obtain a default parent window!" );
         [ #  # ][ #  # ]
                 [ +  - ]
     228                 :            :         }
     229                 :            :         try
     230                 :            :         {
     231 [ +  - ][ +  - ]:         15 :             xMe->createPeer( NULL, pParentWindow->GetComponentInterface( sal_True ) );
         [ +  - ][ +  - ]
     232                 :            :         }
     233         [ #  # ]:          0 :         catch( const Exception& )
     234                 :            :         {
     235                 :          0 :             mbCreatingCompatiblePeer = sal_False;
     236                 :          0 :             throw;
     237                 :            :         }
     238 [ +  - ][ +  - ]:         15 :         xCompatiblePeer = getPeer();
     239         [ +  - ]:         15 :         setPeer( xCurrentPeer );
     240                 :            : 
     241 [ +  - ][ +  - ]:         15 :         if ( xCompatiblePeer.is() && mxGraphics.is() )
                 [ +  - ]
     242                 :            :         {
     243         [ +  - ]:         15 :             Reference< XView > xPeerView( xCompatiblePeer, UNO_QUERY );
     244         [ +  - ]:         15 :             if ( xPeerView.is() )
     245 [ +  - ][ +  - ]:         15 :                 xPeerView->setGraphics( mxGraphics );
     246                 :            :         }
     247                 :            : 
     248         [ +  - ]:         15 :         if( bVis )
     249                 :         15 :             maComponentInfos.bVisible = sal_True;
     250                 :            :     }
     251                 :            : 
     252                 :       4368 :     mbCreatingCompatiblePeer = sal_False;
     253                 :            : 
     254                 :       4368 :     return xCompatiblePeer;
     255                 :            : }
     256                 :            : 
     257                 :        681 : bool UnoControl::ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable )
     258                 :            : {
     259   [ +  +  -  +  :        685 :     if  (   !mpData->bLocalizationSupport
           #  # ][ +  - ]
     260                 :          4 :         ||  ( _rPossiblyLocalizable.isEmpty() )
     261                 :          0 :         ||  ( _rPossiblyLocalizable[0] != '&' )
     262                 :            :             // TODO: make this reasonable. At the moment, everything which by accident starts with a & is considered
     263                 :            :             // localizable, which is probably wrong.
     264                 :            :         )
     265                 :        681 :         return false;
     266                 :            : 
     267                 :            :     try
     268                 :            :     {
     269         [ #  # ]:          0 :         Reference< XPropertySet > xPropSet( mxModel, UNO_QUERY_THROW );
     270                 :            :         Reference< resource::XStringResourceResolver > xStringResourceResolver(
     271         [ #  # ]:          0 :             xPropSet->getPropertyValue( ::rtl::OUString( "ResourceResolver" ) ),
     272                 :            :             UNO_QUERY
     273 [ #  # ][ #  # ]:          0 :         );
     274         [ #  # ]:          0 :         if ( xStringResourceResolver.is() )
     275                 :            :         {
     276                 :          0 :             ::rtl::OUString aLocalizationKey( _rPossiblyLocalizable.copy( 1 ) );
     277 [ #  # ][ #  # ]:          0 :             _rPossiblyLocalizable = xStringResourceResolver->resolveString( aLocalizationKey );
     278                 :          0 :             return true;
     279 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
     280                 :            :     }
     281                 :          0 :     catch( const Exception& )
     282                 :            :     {
     283                 :            :         DBG_UNHANDLED_EXCEPTION();
     284                 :            :     }
     285                 :        681 :     return false;
     286                 :            : }
     287                 :            : 
     288                 :      55942 : void UnoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal )
     289                 :            : {
     290                 :            :     // since a change made in propertiesChange, we can't be sure that this is called with an valid getPeer(),
     291                 :            :     // this assumption may be false in some (seldom) multi-threading scenarios (cause propertiesChange
     292                 :            :     // releases our mutex before calling here in)
     293                 :            :     // That's why this additional check
     294                 :            : 
     295         [ +  - ]:      55942 :     if ( mxVclWindowPeer.is() )
     296                 :            :     {
     297                 :      55942 :         Any aConvertedValue( rVal );
     298                 :            : 
     299         [ +  + ]:      55942 :         if ( mpData->bLocalizationSupport )
     300                 :            :         {
     301                 :            :             // We now support a mapping for language dependent properties. This is the
     302                 :            :             // central method to implement it.
     303   [ +  -  +  -  :        554 :             if (( rPropName.equalsAsciiL( "Text",            4 )) ||
          +  +  +  +  +  
                -  -  + ]
                 [ +  + ]
     304                 :         94 :                 ( rPropName.equalsAsciiL( "Label",           5 )) ||
     305                 :         94 :                 ( rPropName.equalsAsciiL( "Title",           5 )) ||
     306                 :         92 :                 ( rPropName.equalsAsciiL( "HelpText",        8 )) ||
     307                 :         90 :                 ( rPropName.equalsAsciiL( "CurrencySymbol", 14 )) ||
     308                 :         90 :                 ( rPropName.equalsAsciiL( "StringItemList", 14 )) )
     309                 :            :             {
     310                 :          4 :                 ::rtl::OUString aValue;
     311         [ +  - ]:          4 :                 uno::Sequence< rtl::OUString > aSeqValue;
     312         [ +  - ]:          4 :                 if ( aConvertedValue >>= aValue )
     313                 :            :                 {
     314 [ +  - ][ -  + ]:          4 :                     if ( ImplCheckLocalize( aValue ) )
     315         [ #  # ]:          0 :                         aConvertedValue <<= aValue;
     316                 :            :                 }
     317 [ #  # ][ #  # ]:          0 :                 else if ( aConvertedValue >>= aSeqValue )
     318                 :            :                 {
     319         [ #  # ]:          0 :                     for ( sal_Int32 i = 0; i < aSeqValue.getLength(); i++ )
     320 [ #  # ][ #  # ]:          0 :                         ImplCheckLocalize( aSeqValue[i] );
     321         [ #  # ]:          0 :                     aConvertedValue <<= aSeqValue;
     322         [ +  - ]:          4 :                 }
     323                 :            :             }
     324                 :            :         }
     325                 :            : 
     326 [ +  - ][ +  - ]:      55942 :         mxVclWindowPeer->setProperty( rPropName, aConvertedValue );
     327                 :            :     }
     328                 :      55942 : }
     329                 :            : 
     330                 :        555 : void UnoControl::PrepareWindowDescriptor( WindowDescriptor& )
     331                 :            : {
     332                 :        555 : }
     333                 :            : 
     334                 :       9550 : Reference< XWindow >    UnoControl::getParentPeer() const
     335                 :            : {
     336                 :       9550 :     Reference< XWindow > xPeer;
     337         [ +  + ]:       9550 :     if( mxContext.is() )
     338                 :            :     {
     339         [ +  - ]:       9541 :         Reference< XControl > xContComp( mxContext, UNO_QUERY );
     340         [ +  + ]:       9541 :         if ( xContComp.is() )
     341                 :            :         {
     342 [ +  - ][ +  - ]:       9162 :             Reference< XWindowPeer > xP = xContComp->getPeer();
     343         [ +  + ]:       9162 :             if ( xP.is() )
     344 [ +  - ][ +  - ]:       9162 :                 xP->queryInterface( ::getCppuType((const Reference< XWindow >*)0) ) >>= xPeer;
         [ +  - ][ +  - ]
     345                 :       9541 :         }
     346                 :            :     }
     347                 :       9550 :     return xPeer;
     348                 :            : }
     349                 :            : 
     350                 :        673 : void UnoControl::updateFromModel()
     351                 :            : {
     352                 :            :     // Read default properties and hand over to peer
     353         [ +  - ]:        673 :     if( getPeer().is() )
     354                 :            :     {
     355         [ +  - ]:        673 :         Reference< XMultiPropertySet >  xPropSet( mxModel, UNO_QUERY );
     356         [ +  - ]:        673 :         if( xPropSet.is() )
     357                 :            :         {
     358         [ +  - ]:        673 :             Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
     359 [ +  - ][ +  - ]:        673 :             xPropSet->firePropertiesChangeEvent( aNames, this );
         [ +  - ][ +  - ]
     360                 :        673 :         }
     361                 :            :     }
     362                 :        673 : }
     363                 :            : 
     364                 :            : 
     365                 :            : // XTypeProvider
     366 [ #  # ][ #  # ]:          0 : IMPL_IMPLEMENTATION_ID( UnoControl )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     367                 :            : 
     368                 :       1568 : void UnoControl::disposeAccessibleContext()
     369                 :            : {
     370 [ +  - ][ +  - ]:       1568 :     Reference< XComponent > xContextComp( maAccessibleContext.get(), UNO_QUERY );
     371         [ +  + ]:       1568 :     if ( xContextComp.is() )
     372                 :            :     {
     373 [ +  - ][ +  - ]:         60 :         maAccessibleContext = NULL;
     374                 :            :         try
     375                 :            :         {
     376 [ +  - ][ +  - ]:         60 :             xContextComp->removeEventListener( this );
         [ #  # ][ +  - ]
     377 [ +  - ][ +  - ]:         60 :             xContextComp->dispose();
     378                 :            :         }
     379         [ #  # ]:          0 :         catch( const Exception& )
     380                 :            :         {
     381                 :            :             OSL_FAIL( "UnoControl::disposeAccessibleContext: could not dispose my AccessibleContext!" );
     382                 :            :         }
     383                 :       1568 :     }
     384                 :       1568 : }
     385                 :            : 
     386                 :       1105 : void UnoControl::dispose(  ) throw(RuntimeException)
     387                 :            : {
     388                 :       1105 :     Reference< XWindowPeer > xPeer;
     389                 :            :     {
     390         [ +  - ]:       1105 :         ::osl::MutexGuard aGuard( GetMutex() );
     391         [ +  + ]:       1105 :         if( mbDisposePeer )
     392                 :            :         {
     393         [ +  - ]:        478 :             xPeer = mxPeer;
     394                 :            :         }
     395 [ +  - ][ +  - ]:       1105 :         setPeer( NULL );
                 [ +  - ]
     396                 :            :     }
     397         [ +  + ]:       1105 :     if( xPeer.is() )
     398                 :            :     {
     399 [ +  - ][ +  - ]:        341 :         xPeer->dispose();
     400                 :            :     }
     401                 :            : 
     402                 :            :     // dispose and release our AccessibleContext
     403         [ +  - ]:       1105 :     disposeAccessibleContext();
     404                 :            : 
     405         [ +  - ]:       1105 :     EventObject aDisposeEvent;
     406         [ +  - ]:       1105 :     aDisposeEvent.Source = static_cast< XAggregation* >( this );
     407                 :            : 
     408         [ +  - ]:       1105 :     maDisposeListeners.disposeAndClear( aDisposeEvent );
     409         [ +  - ]:       1105 :     maWindowListeners.disposeAndClear( aDisposeEvent );
     410         [ +  - ]:       1105 :     maFocusListeners.disposeAndClear( aDisposeEvent );
     411         [ +  - ]:       1105 :     maKeyListeners.disposeAndClear( aDisposeEvent );
     412         [ +  - ]:       1105 :     maMouseListeners.disposeAndClear( aDisposeEvent );
     413         [ +  - ]:       1105 :     maMouseMotionListeners.disposeAndClear( aDisposeEvent );
     414         [ +  - ]:       1105 :     maPaintListeners.disposeAndClear( aDisposeEvent );
     415         [ +  - ]:       1105 :     maModeChangeListeners.disposeAndClear( aDisposeEvent );
     416                 :            : 
     417                 :            :     // release Model again
     418         [ +  - ]:       1105 :     setModel( Reference< XControlModel > () );
     419 [ +  - ][ +  - ]:       1105 :     setContext( Reference< XInterface > () );
     420                 :       1105 : }
     421                 :            : 
     422                 :        106 : void UnoControl::addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException)
     423                 :            : {
     424         [ +  - ]:        106 :     ::osl::MutexGuard aGuard( GetMutex() );
     425                 :            : 
     426 [ +  - ][ +  - ]:        106 :     maDisposeListeners.addInterface( rxListener );
     427                 :        106 : }
     428                 :            : 
     429                 :         92 : void UnoControl::removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException)
     430                 :            : {
     431         [ +  - ]:         92 :     ::osl::MutexGuard aGuard( GetMutex() );
     432                 :            : 
     433 [ +  - ][ +  - ]:         92 :     maDisposeListeners.removeInterface( rxListener );
     434                 :         92 : }
     435                 :            : 
     436                 :       2014 : sal_Bool UnoControl::requiresNewPeer( const ::rtl::OUString& /* _rPropertyName */ ) const
     437                 :            : {
     438                 :       2014 :     return sal_False;
     439                 :            : }
     440                 :            : 
     441                 :            : // XPropertiesChangeListener
     442                 :      10076 : void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
     443                 :            : {
     444         [ +  - ]:      10076 :     Sequence< PropertyChangeEvent > aEvents( rEvents );
     445                 :            :     {
     446         [ +  - ]:      10076 :         ::osl::MutexGuard aGuard( GetMutex() );
     447                 :            : 
     448         [ +  + ]:      10076 :         if ( !mpData->aSuspendedPropertyNotifications.empty() )
     449                 :            :         {
     450                 :            :             // strip the property which we are currently updating (somewhere up the stack)
     451         [ +  - ]:        164 :             PropertyChangeEvent* pEvents = aEvents.getArray();
     452                 :        164 :             PropertyChangeEvent* pEventsEnd = pEvents + aEvents.getLength();
     453         [ +  + ]:        334 :             for ( ; pEvents < pEventsEnd; )
     454 [ +  - ][ +  - ]:        170 :                 if ( mpData->aSuspendedPropertyNotifications.find( pEvents->PropertyName ) != mpData->aSuspendedPropertyNotifications.end() )
     455                 :            :                 {
     456         [ +  - ]:        170 :                     if ( pEvents != pEventsEnd )
     457         [ +  - ]:        170 :                         ::std::copy( pEvents + 1, pEventsEnd, pEvents );
     458                 :        170 :                     --pEventsEnd;
     459                 :            :                 }
     460                 :            :                 else
     461                 :          0 :                     ++pEvents;
     462         [ +  - ]:        164 :             aEvents.realloc( pEventsEnd - aEvents.getConstArray() );
     463                 :            : 
     464         [ +  - ]:      10076 :             if ( !aEvents.getLength() )
     465                 :      10076 :                 return;
     466 [ +  - ][ +  + ]:      10076 :         }
     467                 :            :     }
     468                 :            : 
     469 [ +  - ][ +  - ]:      10076 :     ImplModelPropertiesChanged( aEvents );
                 [ +  + ]
     470                 :            : }
     471                 :            : 
     472                 :       1360 : void UnoControl::ImplLockPropertyChangeNotification( const ::rtl::OUString& rPropertyName, bool bLock )
     473                 :            : {
     474         [ +  - ]:       1360 :     MapString2Int::iterator pos = mpData->aSuspendedPropertyNotifications.find( rPropertyName );
     475         [ +  + ]:       1360 :     if ( bLock )
     476                 :            :     {
     477         [ +  - ]:        680 :         if ( pos == mpData->aSuspendedPropertyNotifications.end() )
     478 [ +  - ][ +  - ]:        680 :             pos = mpData->aSuspendedPropertyNotifications.insert( MapString2Int::value_type( rPropertyName, 0 ) ).first;
     479                 :        680 :         ++pos->second;
     480                 :            :     }
     481                 :            :     else
     482                 :            :     {
     483                 :            :         OSL_ENSURE( pos != mpData->aSuspendedPropertyNotifications.end(), "UnoControl::ImplLockPropertyChangeNotification: property not locked!" );
     484         [ +  - ]:        680 :         if ( pos != mpData->aSuspendedPropertyNotifications.end() )
     485                 :            :         {
     486                 :            :             OSL_ENSURE( pos->second > 0, "UnoControl::ImplLockPropertyChangeNotification: invalid suspension counter!" );
     487         [ +  - ]:        680 :             if ( 0 == --pos->second )
     488         [ +  - ]:        680 :                 mpData->aSuspendedPropertyNotifications.erase( pos );
     489                 :            :         }
     490                 :            :     }
     491                 :       1360 : }
     492                 :            : 
     493                 :         24 : void UnoControl::ImplLockPropertyChangeNotifications( const Sequence< ::rtl::OUString >& rPropertyNames, bool bLock )
     494                 :            : {
     495         [ +  + ]:        144 :     for (   const ::rtl::OUString* pPropertyName = rPropertyNames.getConstArray();
     496                 :         72 :             pPropertyName != rPropertyNames.getConstArray() + rPropertyNames.getLength();
     497                 :            :             ++pPropertyName
     498                 :            :         )
     499                 :         48 :         ImplLockPropertyChangeNotification( *pPropertyName, bLock );
     500                 :         24 : }
     501                 :            : 
     502                 :       9912 : void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents )
     503                 :            : {
     504         [ +  - ]:       9912 :     ::osl::ClearableGuard< ::osl::Mutex > aGuard( GetMutex() );
     505                 :            : 
     506 [ +  - ][ +  + ]:       9912 :     if( getPeer().is() )
     507                 :            :     {
     508                 :            :         DECLARE_STL_VECTOR( PropertyValue, PropertyValueVector);
     509         [ +  - ]:       9550 :         PropertyValueVector     aPeerPropertiesToSet;
     510                 :       9550 :         sal_Int32               nIndependentPos = 0;
     511                 :       9550 :         bool                    bResourceResolverSet( false );
     512                 :            :             // position where to insert the independent properties into aPeerPropertiesToSet,
     513                 :            :             // dependent ones are inserted at the end of the vector
     514                 :            : 
     515                 :       9550 :         sal_Bool bNeedNewPeer = sal_False;
     516                 :            :             // some properties require a re-creation of the peer, 'cause they can't be changed on the fly
     517                 :            : 
     518 [ +  - ][ +  - ]:       9550 :         Reference< XControlModel > xOwnModel( getModel(), UNO_QUERY );
     519                 :            :             // our own model for comparison
     520         [ +  - ]:       9550 :         Reference< XPropertySet > xPS( xOwnModel, UNO_QUERY );
     521 [ +  - ][ +  - ]:       9550 :         Reference< XPropertySetInfo > xPSI( xPS->getPropertySetInfo(), UNO_QUERY );
                 [ +  - ]
     522                 :            :         OSL_ENSURE( xPSI.is(), "UnoControl::ImplModelPropertiesChanged: should have property set meta data!" );
     523                 :            : 
     524                 :       9550 :         const PropertyChangeEvent* pEvents = rEvents.getConstArray();
     525                 :            : 
     526                 :       9550 :         sal_Int32 nLen = rEvents.getLength();
     527         [ +  - ]:       9550 :         aPeerPropertiesToSet.reserve(nLen);
     528                 :            : 
     529         [ +  + ]:      66653 :         for( sal_Int32 i = 0; i < nLen; ++i, ++pEvents )
     530                 :            :         {
     531         [ +  - ]:      57419 :             Reference< XControlModel > xModel( pEvents->Source, UNO_QUERY );
     532 [ +  - ][ +  - ]:      57419 :             sal_Bool bOwnModel = xModel.get() == xOwnModel.get();
     533         [ -  + ]:      57419 :             if ( !bOwnModel )
     534                 :          0 :                 continue;
     535                 :            : 
     536                 :            :             // Detect changes on our resource resolver which invalidates
     537                 :            :             // automatically some language dependent properties.
     538         [ +  + ]:      57419 :             if ( pEvents->PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
     539                 :            :             {
     540                 :          2 :                 Reference< resource::XStringResourceResolver > xStrResolver;
     541 [ +  - ][ +  - ]:          2 :                 if ( pEvents->NewValue >>= xStrResolver )
     542                 :          2 :                     bResourceResolverSet = xStrResolver.is();
     543                 :            :             }
     544                 :            : 
     545         [ +  - ]:      57419 :             sal_uInt16 nPType = GetPropertyId( pEvents->PropertyName );
     546 [ +  + ][ +  - ]:      57419 :             if ( mbDesignMode && mbDisposePeer && !mbRefeshingPeer && !mbCreatingPeer )
         [ +  + ][ +  + ]
     547                 :            :             {
     548                 :            :                 // if we're in design mode, then some properties can change which
     549                 :            :                 // require creating a *new* peer (since these properties cannot
     550                 :            :                 // be switched at existing peers)
     551         [ +  + ]:       9672 :                 if ( nPType )
     552                 :            :                     bNeedNewPeer = ( nPType == BASEPROPERTY_BORDER )
     553                 :            :                                 || ( nPType == BASEPROPERTY_MULTILINE )
     554                 :            :                                 || ( nPType == BASEPROPERTY_DROPDOWN )
     555                 :            :                                 || ( nPType == BASEPROPERTY_HSCROLL )
     556                 :            :                                 || ( nPType == BASEPROPERTY_VSCROLL )
     557                 :            :                                 || ( nPType == BASEPROPERTY_AUTOHSCROLL )
     558                 :            :                                 || ( nPType == BASEPROPERTY_AUTOVSCROLL )
     559                 :            :                                 || ( nPType == BASEPROPERTY_ORIENTATION )
     560                 :            :                                 || ( nPType == BASEPROPERTY_SPIN )
     561                 :            :                                 || ( nPType == BASEPROPERTY_ALIGN )
     562 [ +  + ][ +  + ]:       7658 :                                 || ( nPType == BASEPROPERTY_PAINTTRANSPARENT );
         [ +  + ][ +  + ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
                 [ -  + ]
     563                 :            :                 else
     564         [ +  - ]:       2014 :                     bNeedNewPeer = requiresNewPeer( pEvents->PropertyName );
     565                 :            : 
     566         [ +  + ]:       9672 :                 if ( bNeedNewPeer )
     567                 :            :                     break;
     568                 :            :             }
     569                 :            : 
     570 [ +  + ][ +  + ]:      57103 :             if ( nPType && ( nLen > 1 ) && DoesDependOnOthers( nPType ) )
         [ +  - ][ +  + ]
                 [ +  + ]
     571                 :            :             {
     572                 :            :                 // Add properties with dependencies on other properties last
     573                 :            :                 // since they're dependent on properties added later (such as
     574                 :            :                 // VALUE dependency on VALUEMIN/MAX)
     575         [ +  - ]:        851 :                 aPeerPropertiesToSet.push_back(PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
     576                 :            :             }
     577                 :            :             else
     578                 :            :             {
     579         [ -  + ]:      56252 :                 if ( bResourceResolverSet )
     580                 :            :                 {
     581                 :            :                     // The resource resolver property change should be one of the first ones.
     582                 :            :                     // All language dependent properties are dependent on this property.
     583                 :            :                     // As BASEPROPERTY_NATIVE_WIDGET_LOOK is not dependent on resource
     584                 :            :                     // resolver. We don't need to handle a special order for these two props.
     585                 :            :                     aPeerPropertiesToSet.insert(
     586                 :            :                         aPeerPropertiesToSet.begin(),
     587         [ #  # ]:          0 :                         PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) );
     588                 :          0 :                     ++nIndependentPos;
     589                 :            :                 }
     590         [ +  + ]:      56252 :                 else if ( nPType == BASEPROPERTY_NATIVE_WIDGET_LOOK )
     591                 :            :                 {
     592                 :            :                     // since *a lot* of other properties might be overruled by this one, we need
     593                 :            :                     // a special handling:
     594                 :            :                     // NativeWidgetLook needs to be set first: If it is set to ON, all other
     595                 :            :                     // properties describing the look (e.g. BackgroundColor) are ignored, anyway.
     596                 :            :                     // If it is switched OFF, then we need to do it first because else it will
     597                 :            :                     // overrule other look-related properties, and re-initialize them from system
     598                 :            :                     // defaults.
     599                 :            :                     aPeerPropertiesToSet.insert(
     600                 :            :                         aPeerPropertiesToSet.begin(),
     601         [ +  - ]:        858 :                         PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) );
     602                 :        858 :                     ++nIndependentPos;
     603                 :            :                 }
     604                 :            :                 else
     605                 :            :                 {
     606                 :            :                     aPeerPropertiesToSet.insert(aPeerPropertiesToSet.begin() + nIndependentPos,
     607 [ +  - ][ +  - ]:      55394 :                         PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
     608                 :      57103 :                     ++nIndependentPos;
     609                 :            :                 }
     610                 :            :             }
     611      [ +  -  + ]:      57419 :         }
     612                 :            : 
     613         [ +  - ]:       9550 :         Reference< XWindow >    xParent = getParentPeer();
     614         [ +  - ]:       9550 :         Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
     615                 :            :         // call createPeer via a interface got from queryInterface, so the aggregating class can intercept it
     616                 :            : 
     617                 :            :         DBG_ASSERT( !bNeedNewPeer || xParent.is(), "Need new peer, but don't have a parent!" );
     618                 :            : 
     619                 :            :         // Check if we have to update language dependent properties
     620 [ +  + ][ -  + ]:       9550 :         if ( !bNeedNewPeer && bResourceResolverSet )
     621                 :            :         {
     622                 :            :             // Add language dependent properties into the peer property set.
     623                 :            :             // Our resource resolver has been changed and we must be sure
     624                 :            :             // that language dependent props use the new resolver.
     625                 :          0 :             const LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
     626         [ #  # ]:          0 :             while ( pLangDepProp->pPropName != 0 )
     627                 :            :             {
     628                 :          0 :                 bool bMustBeInserted( true );
     629         [ #  # ]:          0 :                 for ( sal_uInt32 i = 0; i < aPeerPropertiesToSet.size(); i++ )
     630                 :            :                 {
     631         [ #  # ]:          0 :                     if ( aPeerPropertiesToSet[i].Name.equalsAsciiL(
     632                 :          0 :                             pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
     633                 :            :                     {
     634                 :          0 :                         bMustBeInserted = false;
     635                 :          0 :                         break;
     636                 :            :                     }
     637                 :            :                 }
     638                 :            : 
     639         [ #  # ]:          0 :                 if ( bMustBeInserted )
     640                 :            :                 {
     641                 :            :                     // Add language dependent props at the end
     642                 :          0 :                     ::rtl::OUString aPropName( ::rtl::OUString::createFromAscii( pLangDepProp->pPropName ));
     643 [ #  # ][ #  # ]:          0 :                     if ( xPSI.is() && xPSI->hasPropertyByName( aPropName ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     644                 :            :                     {
     645                 :            :                         aPeerPropertiesToSet.push_back(
     646 [ #  # ][ #  # ]:          0 :                             PropertyValue( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE ) );
                 [ #  # ]
     647                 :          0 :                     }
     648                 :            :                 }
     649                 :            : 
     650                 :          0 :                 ++pLangDepProp;
     651                 :            :             }
     652                 :            :         }
     653         [ +  - ]:       9550 :         aGuard.clear();
     654                 :            : 
     655                 :            :         // clear the guard before creating a new peer - as usual, our peer implementations use the SolarMutex
     656                 :            : 
     657 [ +  + ][ +  + ]:       9550 :         if (bNeedNewPeer && xParent.is())
                 [ +  + ]
     658                 :            :         {
     659         [ +  - ]:        314 :             SolarMutexGuard aVclGuard;
     660                 :            :                 // and now this is the final withdrawal:
     661                 :            :                 // I have no other idea than locking the SolarMutex here ....
     662                 :            :                 // I really hate the fact that VCL is not theadsafe ....
     663                 :            : 
     664                 :            :             // Doesn't work for Container!
     665 [ +  - ][ +  - ]:        314 :             getPeer()->dispose();
                 [ +  - ]
     666                 :        314 :             mxPeer.clear();
     667         [ +  - ]:        314 :             mxVclWindowPeer = NULL;
     668                 :        314 :             mbRefeshingPeer = sal_True;
     669         [ +  - ]:        314 :             Reference< XWindowPeer >    xP( xParent, UNO_QUERY );
     670 [ +  - ][ +  - ]:        314 :             xThis->createPeer( Reference< XToolkit > (), xP );
     671                 :        314 :             mbRefeshingPeer = sal_False;
     672         [ +  - ]:        314 :             aPeerPropertiesToSet.clear();
     673                 :            :         }
     674                 :            : 
     675                 :            :         // lock the multiplexing of VCL events to our UNO listeners
     676                 :            :         // this is for compatibility reasons: in OOo 1.0.x, changes which were done at the
     677                 :            :         // model did not cause the listeners of the controls/peers to be called
     678                 :            :         // Since the implementations for the listeners changed a lot towards 1.1, this
     679                 :            :         // would not be the case anymore, if we would not do this listener-lock below
     680                 :            :         // #i14703#
     681 [ +  - ][ +  - ]:       9550 :         Window* pVclPeer = VCLUnoHelper::GetWindow( getPeer() );
     682 [ +  - ][ +  - ]:       9550 :         VCLXWindow* pPeer = pVclPeer ? pVclPeer->GetWindowPeer() : NULL;
     683         [ +  - ]:       9550 :         VclListenerLock aNoVclEventMultiplexing( pPeer );
     684                 :            : 
     685                 :            :         // setting peer properties may result in an attemp to acquire the solar mutex, 'cause the peers
     686                 :            :         // usually don't have an own mutex but use the SolarMutex instead.
     687                 :            :         // To prevent deadlocks resulting from this, we do this without our own mutex locked
     688                 :       9550 :         PropertyValueVectorIterator aEnd = aPeerPropertiesToSet.end();
     689 [ +  - ][ +  + ]:      66341 :         for (   PropertyValueVectorIterator aLoop = aPeerPropertiesToSet.begin();
     690                 :            :                 aLoop != aEnd;
     691                 :            :                 ++aLoop
     692                 :            :             )
     693                 :            :         {
     694         [ +  - ]:      56791 :             ImplSetPeerProperty( aLoop->Name, aLoop->Value );
     695         [ +  - ]:       9550 :         }
     696         [ +  - ]:       9912 :     }
     697                 :       9912 : }
     698                 :            : 
     699                 :       1018 : void UnoControl::disposing( const EventObject& rEvt ) throw(RuntimeException)
     700                 :            : {
     701         [ +  - ]:       1018 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
     702                 :            :     // do not compare differing types in case of multible inheritance
     703                 :            : 
     704 [ +  - ][ +  - ]:       1018 :     if ( maAccessibleContext.get() == rEvt.Source )
                 [ +  + ]
     705                 :            :     {
     706                 :            :         // just in case the context is disposed, but not released - ensure that we do not re-use it in the future
     707 [ +  - ][ +  - ]:          6 :         maAccessibleContext = NULL;
     708                 :            :     }
     709 [ +  - ][ +  - ]:       1012 :     else if( mxModel.get() == Reference< XControlModel >(rEvt.Source,UNO_QUERY).get() )
         [ +  - ][ +  + ]
     710                 :            :     {
     711                 :            :         // #62337# if the model dies, it does not make sense for us to live ...
     712         [ +  - ]:         63 :         Reference< XControl >  xThis = this;
     713                 :            : 
     714         [ +  - ]:         63 :         aGuard.clear();
     715 [ +  - ][ +  - ]:         63 :         xThis->dispose();
     716                 :            : 
     717                 :            :         DBG_ASSERT( !mxModel.is(), "UnoControl::disposing: invalid dispose behaviour!" );
     718                 :         63 :         mxModel.clear();
     719         [ +  - ]:       1018 :     }
     720                 :       1018 : }
     721                 :            : 
     722                 :            : 
     723                 :          0 : void SAL_CALL UnoControl::setOutputSize( const awt::Size& aSize ) throw (RuntimeException)
     724                 :            : {
     725                 :          0 :     Reference< XWindow2 > xPeerWindow;
     726                 :            :     {
     727         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
     728 [ #  # ][ #  # ]:          0 :         xPeerWindow = xPeerWindow.query( getPeer() );
         [ #  # ][ #  # ]
     729                 :            :     }
     730                 :            : 
     731         [ #  # ]:          0 :     if ( xPeerWindow.is() )
     732 [ #  # ][ #  # ]:          0 :         xPeerWindow->setOutputSize( aSize );
     733                 :          0 : }
     734                 :            : 
     735                 :            : namespace
     736                 :            : {
     737                 :            :     template < typename RETVALTYPE >
     738                 :       5436 :     RETVALTYPE lcl_askPeer( const uno::Reference< awt::XWindowPeer >& _rxPeer, RETVALTYPE (SAL_CALL XWindow2::*_pMethod)(), RETVALTYPE _aDefault )
     739                 :            :     {
     740                 :       5436 :         RETVALTYPE aReturn( _aDefault );
     741                 :            : 
     742 [ +  - ][ #  # ]:       5436 :         Reference< XWindow2 > xPeerWindow( _rxPeer, UNO_QUERY );
     743 [ +  + ][ #  # ]:       5436 :         if ( xPeerWindow.is() )
     744 [ -  + ][ +  - ]:       5400 :             aReturn = (xPeerWindow.get()->*_pMethod)();
         [ #  # ][ #  # ]
     745                 :            : 
     746                 :       5436 :         return aReturn;
     747                 :            :     }
     748                 :            : }
     749                 :            : 
     750                 :          0 : awt::Size SAL_CALL UnoControl::getOutputSize(  ) throw (RuntimeException)
     751                 :            : {
     752 [ #  # ][ #  # ]:          0 :     return lcl_askPeer( getPeer(), &XWindow2::getOutputSize, awt::Size() );
     753                 :            : }
     754                 :            : 
     755                 :       5436 : ::sal_Bool SAL_CALL UnoControl::isVisible(  ) throw (RuntimeException)
     756                 :            : {
     757         [ +  - ]:       5436 :     return lcl_askPeer( getPeer(), &XWindow2::isVisible, maComponentInfos.bVisible );
     758                 :            : }
     759                 :            : 
     760                 :          0 : ::sal_Bool SAL_CALL UnoControl::isActive(  ) throw (RuntimeException)
     761                 :            : {
     762         [ #  # ]:          0 :     return lcl_askPeer( getPeer(), &XWindow2::isActive, sal_False );
     763                 :            : }
     764                 :            : 
     765                 :          0 : ::sal_Bool SAL_CALL UnoControl::isEnabled(  ) throw (RuntimeException)
     766                 :            : {
     767         [ #  # ]:          0 :     return lcl_askPeer( getPeer(), &XWindow2::isEnabled, maComponentInfos.bEnable );
     768                 :            : }
     769                 :            : 
     770                 :          0 : ::sal_Bool SAL_CALL UnoControl::hasFocus(  ) throw (RuntimeException)
     771                 :            : {
     772         [ #  # ]:          0 :     return lcl_askPeer( getPeer(), &XWindow2::hasFocus, sal_False );
     773                 :            : }
     774                 :            : 
     775                 :            : // XWindow
     776                 :       1205 : void UnoControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(RuntimeException)
     777                 :            : {
     778                 :       1205 :     Reference< XWindow > xWindow;
     779                 :            :     {
     780         [ +  - ]:       1205 :         ::osl::MutexGuard aGuard( GetMutex() );
     781                 :            : 
     782         [ +  + ]:       1205 :         if ( Flags & awt::PosSize::X )
     783                 :       1199 :             maComponentInfos.nX = X;
     784         [ +  + ]:       1205 :         if ( Flags & awt::PosSize::Y )
     785                 :       1199 :             maComponentInfos.nY = Y;
     786         [ +  + ]:       1205 :         if ( Flags & awt::PosSize::WIDTH )
     787                 :       1201 :             maComponentInfos.nWidth = Width;
     788         [ +  + ]:       1205 :         if ( Flags & awt::PosSize::HEIGHT )
     789                 :       1201 :             maComponentInfos.nHeight = Height;
     790                 :       1205 :         maComponentInfos.nFlags |= Flags;
     791                 :            : 
     792 [ +  - ][ +  - ]:       1205 :         xWindow = xWindow.query( getPeer() );
         [ +  - ][ +  - ]
     793                 :            :     }
     794                 :            : 
     795         [ +  + ]:       1205 :     if( xWindow.is() )
     796 [ +  - ][ +  - ]:       1205 :         xWindow->setPosSize( X, Y, Width, Height, Flags );
     797                 :       1205 : }
     798                 :            : 
     799                 :      20507 : awt::Rectangle UnoControl::getPosSize(  ) throw(RuntimeException)
     800                 :            : {
     801                 :      20507 :     awt::Rectangle aRect( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight);
     802                 :      20507 :     Reference< XWindow > xWindow;
     803                 :            : 
     804                 :            :     {
     805         [ +  - ]:      20507 :         ::osl::MutexGuard aGuard( GetMutex() );
     806 [ +  - ][ +  - ]:      20507 :         xWindow = xWindow.query( getPeer() );
         [ +  - ][ +  - ]
     807                 :            :     }
     808                 :            : 
     809         [ +  + ]:      20507 :     if( xWindow.is() )
     810 [ +  - ][ +  - ]:      19577 :         aRect = xWindow->getPosSize();
     811                 :      20507 :     return aRect;
     812                 :            : }
     813                 :            : 
     814                 :         29 : void UnoControl::setVisible( sal_Bool bVisible ) throw(RuntimeException)
     815                 :            : {
     816                 :         29 :     Reference< XWindow > xWindow;
     817                 :            :     {
     818         [ +  - ]:         29 :         ::osl::MutexGuard aGuard( GetMutex() );
     819                 :            : 
     820                 :            :         // Visible status is handled by View
     821                 :         29 :         maComponentInfos.bVisible = bVisible;
     822 [ +  - ][ +  - ]:         29 :         xWindow = xWindow.query( getPeer() );
         [ +  - ][ +  - ]
     823                 :            :     }
     824         [ +  + ]:         29 :     if ( xWindow.is() )
     825 [ +  - ][ +  - ]:         29 :         xWindow->setVisible( bVisible );
     826                 :         29 : }
     827                 :            : 
     828                 :         10 : void UnoControl::setEnable( sal_Bool bEnable ) throw(RuntimeException)
     829                 :            : {
     830                 :         10 :     Reference< XWindow > xWindow;
     831                 :            :     {
     832         [ +  - ]:         10 :         ::osl::MutexGuard aGuard( GetMutex() );
     833                 :            : 
     834                 :            :         // Enable status is handled by View
     835                 :         10 :         maComponentInfos.bEnable = bEnable;
     836 [ +  - ][ +  - ]:         10 :         xWindow = xWindow.query( getPeer() );
         [ +  - ][ +  - ]
     837                 :            :     }
     838         [ +  + ]:         10 :     if ( xWindow.is() )
     839 [ +  - ][ +  - ]:         10 :         xWindow->setEnable( bEnable );
     840                 :         10 : }
     841                 :            : 
     842                 :          2 : void UnoControl::setFocus(  ) throw(RuntimeException)
     843                 :            : {
     844                 :          2 :     Reference< XWindow > xWindow;
     845                 :            :     {
     846         [ +  - ]:          2 :         ::osl::MutexGuard aGuard( GetMutex() );
     847 [ +  - ][ +  - ]:          2 :         xWindow = xWindow.query( getPeer() );
         [ +  - ][ +  - ]
     848                 :            :     }
     849         [ +  - ]:          2 :     if ( xWindow.is() )
     850 [ +  - ][ +  - ]:          2 :         xWindow->setFocus();
     851                 :          2 : }
     852                 :            : 
     853                 :        352 : void UnoControl::addWindowListener( const Reference< XWindowListener >& rxListener ) throw(RuntimeException)
     854                 :            : {
     855                 :        352 :     Reference< XWindow > xPeerWindow;
     856                 :            :     {
     857         [ +  - ]:        352 :         ::osl::MutexGuard aGuard( GetMutex() );
     858         [ +  - ]:        352 :         maWindowListeners.addInterface( rxListener );
     859 [ +  - ][ +  - ]:        352 :         if ( maWindowListeners.getLength() == 1 )
     860 [ +  - ][ +  - ]:        352 :             xPeerWindow = xPeerWindow.query( getPeer() );
         [ +  - ][ +  - ]
     861                 :            :     }
     862         [ +  + ]:        352 :     if ( xPeerWindow.is() )
     863 [ +  - ][ +  - ]:        352 :         xPeerWindow->addWindowListener( &maWindowListeners );
                 [ +  - ]
     864                 :        352 : }
     865                 :            : 
     866                 :        347 : void UnoControl::removeWindowListener( const Reference< XWindowListener >& rxListener ) throw(RuntimeException)
     867                 :            : {
     868                 :        347 :     Reference< XWindow > xPeerWindow;
     869                 :            :     {
     870         [ +  - ]:        347 :         ::osl::MutexGuard aGuard( GetMutex() );
     871 [ +  - ][ +  + ]:        347 :         if ( maWindowListeners.getLength() == 1 )
     872 [ +  - ][ +  - ]:        345 :             xPeerWindow = xPeerWindow.query( getPeer() );
                 [ +  - ]
     873 [ +  - ][ +  - ]:        347 :         maWindowListeners.removeInterface( rxListener );
     874                 :            :     }
     875         [ +  + ]:        347 :     if ( xPeerWindow.is() )
     876 [ +  - ][ +  - ]:        347 :         xPeerWindow->removeWindowListener( &maWindowListeners );
                 [ +  - ]
     877                 :        347 : }
     878                 :            : 
     879                 :        137 : void UnoControl::addFocusListener( const Reference< XFocusListener >& rxListener ) throw(RuntimeException)
     880                 :            : {
     881                 :        137 :     Reference< XWindow > xPeerWindow;
     882                 :            :     {
     883         [ +  - ]:        137 :         ::osl::MutexGuard aGuard( GetMutex() );
     884         [ +  - ]:        137 :         maFocusListeners.addInterface( rxListener );
     885 [ +  - ][ +  + ]:        137 :         if ( maFocusListeners.getLength() == 1 )
     886 [ +  - ][ +  - ]:        137 :             xPeerWindow = xPeerWindow.query( getPeer() );
         [ +  - ][ +  - ]
     887                 :            :     }
     888         [ +  + ]:        137 :     if ( xPeerWindow.is() )
     889 [ +  - ][ +  - ]:        137 :         xPeerWindow->addFocusListener( &maFocusListeners );
                 [ +  - ]
     890                 :        137 : }
     891                 :            : 
     892                 :         42 : void UnoControl::removeFocusListener( const Reference< XFocusListener >& rxListener ) throw(RuntimeException)
     893                 :            : {
     894                 :         42 :     Reference< XWindow > xPeerWindow;
     895                 :            :     {
     896         [ +  - ]:         42 :         ::osl::MutexGuard aGuard( GetMutex() );
     897 [ +  - ][ +  + ]:         42 :         if ( maFocusListeners.getLength() == 1 )
     898 [ +  - ][ +  - ]:         22 :             xPeerWindow = xPeerWindow.query( getPeer() );
                 [ +  - ]
     899 [ +  - ][ +  - ]:         42 :         maFocusListeners.removeInterface( rxListener );
     900                 :            :     }
     901         [ +  + ]:         42 :     if ( xPeerWindow.is() )
     902 [ +  - ][ +  - ]:         42 :         xPeerWindow->removeFocusListener( &maFocusListeners );
                 [ +  - ]
     903                 :         42 : }
     904                 :            : 
     905                 :         82 : void UnoControl::addKeyListener( const Reference< XKeyListener >& rxListener ) throw(RuntimeException)
     906                 :            : {
     907                 :         82 :     Reference< XWindow > xPeerWindow;
     908                 :            :     {
     909         [ +  - ]:         82 :         ::osl::MutexGuard aGuard( GetMutex() );
     910         [ +  - ]:         82 :         maKeyListeners.addInterface( rxListener );
     911 [ +  - ][ +  - ]:         82 :         if ( maKeyListeners.getLength() == 1 )
     912 [ +  - ][ +  - ]:         82 :             xPeerWindow = xPeerWindow.query( getPeer() );
         [ +  - ][ +  - ]
     913                 :            :     }
     914         [ -  + ]:         82 :     if ( xPeerWindow.is() )
     915 [ #  # ][ #  # ]:         82 :         xPeerWindow->addKeyListener( &maKeyListeners);
                 [ #  # ]
     916                 :         82 : }
     917                 :            : 
     918                 :          0 : void UnoControl::removeKeyListener( const Reference< XKeyListener >& rxListener ) throw(RuntimeException)
     919                 :            : {
     920                 :          0 :     Reference< XWindow > xPeerWindow;
     921                 :            :     {
     922         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
     923 [ #  # ][ #  # ]:          0 :         if ( maKeyListeners.getLength() == 1 )
     924 [ #  # ][ #  # ]:          0 :             xPeerWindow = xPeerWindow.query( getPeer() );
                 [ #  # ]
     925 [ #  # ][ #  # ]:          0 :         maKeyListeners.removeInterface( rxListener );
     926                 :            :     }
     927         [ #  # ]:          0 :     if ( xPeerWindow.is() )
     928 [ #  # ][ #  # ]:          0 :         xPeerWindow->removeKeyListener( &maKeyListeners);
                 [ #  # ]
     929                 :          0 : }
     930                 :            : 
     931                 :         53 : void UnoControl::addMouseListener( const Reference< XMouseListener >& rxListener ) throw(RuntimeException)
     932                 :            : {
     933                 :         53 :     Reference< XWindow > xPeerWindow;
     934                 :            :     {
     935         [ +  - ]:         53 :         ::osl::MutexGuard aGuard( GetMutex() );
     936         [ +  - ]:         53 :         maMouseListeners.addInterface( rxListener );
     937 [ +  - ][ +  + ]:         53 :         if ( maMouseListeners.getLength() == 1 )
     938 [ +  - ][ +  - ]:         53 :             xPeerWindow = xPeerWindow.query( getPeer() );
         [ +  - ][ +  - ]
     939                 :            :     }
     940         [ +  + ]:         53 :     if ( xPeerWindow.is() )
     941 [ +  - ][ +  - ]:         53 :         xPeerWindow->addMouseListener( &maMouseListeners);
                 [ +  - ]
     942                 :         53 : }
     943                 :            : 
     944                 :         30 : void UnoControl::removeMouseListener( const Reference< XMouseListener >& rxListener ) throw(RuntimeException)
     945                 :            : {
     946                 :         30 :     Reference< XWindow > xPeerWindow;
     947                 :            :     {
     948         [ +  - ]:         30 :         ::osl::MutexGuard aGuard( GetMutex() );
     949 [ +  - ][ +  + ]:         30 :         if ( maMouseListeners.getLength() == 1 )
     950 [ +  - ][ +  - ]:         22 :             xPeerWindow = xPeerWindow.query( getPeer() );
                 [ +  - ]
     951 [ +  - ][ +  - ]:         30 :         maMouseListeners.removeInterface( rxListener );
     952                 :            :     }
     953         [ +  + ]:         30 :     if ( xPeerWindow.is() )
     954 [ +  - ][ +  - ]:         30 :         xPeerWindow->removeMouseListener( &maMouseListeners );
                 [ +  - ]
     955                 :         30 : }
     956                 :            : 
     957                 :          0 : void UnoControl::addMouseMotionListener( const Reference< XMouseMotionListener >& rxListener ) throw(RuntimeException)
     958                 :            : {
     959                 :          0 :     Reference< XWindow > xPeerWindow;
     960                 :            :     {
     961         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
     962         [ #  # ]:          0 :         maMouseMotionListeners.addInterface( rxListener );
     963 [ #  # ][ #  # ]:          0 :         if ( maMouseMotionListeners.getLength() == 1 )
     964 [ #  # ][ #  # ]:          0 :             xPeerWindow = xPeerWindow.query( getPeer() );
         [ #  # ][ #  # ]
     965                 :            :     }
     966         [ #  # ]:          0 :     if ( xPeerWindow.is() )
     967 [ #  # ][ #  # ]:          0 :         xPeerWindow->addMouseMotionListener( &maMouseMotionListeners);
                 [ #  # ]
     968                 :          0 : }
     969                 :            : 
     970                 :          0 : void UnoControl::removeMouseMotionListener( const Reference< XMouseMotionListener >& rxListener ) throw(RuntimeException)
     971                 :            : {
     972                 :          0 :     Reference< XWindow > xPeerWindow;
     973                 :            :     {
     974         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
     975 [ #  # ][ #  # ]:          0 :         if ( maMouseMotionListeners.getLength() == 1 )
     976 [ #  # ][ #  # ]:          0 :             xPeerWindow = xPeerWindow.query( getPeer() );
                 [ #  # ]
     977 [ #  # ][ #  # ]:          0 :         maMouseMotionListeners.removeInterface( rxListener );
     978                 :            :     }
     979         [ #  # ]:          0 :     if ( xPeerWindow.is() )
     980 [ #  # ][ #  # ]:          0 :         xPeerWindow->removeMouseMotionListener( &maMouseMotionListeners );
                 [ #  # ]
     981                 :          0 : }
     982                 :            : 
     983                 :          0 : void UnoControl::addPaintListener( const Reference< XPaintListener >& rxListener ) throw(RuntimeException)
     984                 :            : {
     985                 :          0 :     Reference< XWindow > xPeerWindow;
     986                 :            :     {
     987         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
     988         [ #  # ]:          0 :         maPaintListeners.addInterface( rxListener );
     989 [ #  # ][ #  # ]:          0 :         if ( maPaintListeners.getLength() == 1 )
     990 [ #  # ][ #  # ]:          0 :             xPeerWindow = xPeerWindow.query( getPeer() );
         [ #  # ][ #  # ]
     991                 :            :     }
     992         [ #  # ]:          0 :     if ( xPeerWindow.is() )
     993 [ #  # ][ #  # ]:          0 :         xPeerWindow->addPaintListener( &maPaintListeners);
                 [ #  # ]
     994                 :          0 : }
     995                 :            : 
     996                 :          0 : void UnoControl::removePaintListener( const Reference< XPaintListener >& rxListener ) throw(RuntimeException)
     997                 :            : {
     998                 :          0 :     Reference< XWindow > xPeerWindow;
     999                 :            :     {
    1000         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
    1001 [ #  # ][ #  # ]:          0 :         if ( maPaintListeners.getLength() == 1 )
    1002 [ #  # ][ #  # ]:          0 :             xPeerWindow = xPeerWindow.query( getPeer() );
                 [ #  # ]
    1003 [ #  # ][ #  # ]:          0 :         maPaintListeners.removeInterface( rxListener );
    1004                 :            :     }
    1005         [ #  # ]:          0 :     if ( xPeerWindow.is() )
    1006 [ #  # ][ #  # ]:          0 :         xPeerWindow->removePaintListener( &maPaintListeners );
                 [ #  # ]
    1007                 :          0 : }
    1008                 :            : 
    1009                 :            : // XView
    1010                 :       8554 : sal_Bool UnoControl::setGraphics( const Reference< XGraphics >& rDevice ) throw(RuntimeException)
    1011                 :            : {
    1012                 :       8554 :     Reference< XView > xView;
    1013                 :            :     {
    1014         [ +  - ]:       8554 :         ::osl::MutexGuard aGuard( GetMutex() );
    1015                 :            : 
    1016         [ +  - ]:       8554 :         mxGraphics = rDevice;
    1017 [ +  - ][ +  - ]:       8554 :         xView = xView.query( getPeer() );
         [ +  - ][ +  - ]
    1018                 :            :     }
    1019 [ +  + ][ +  - ]:       8554 :     return xView.is() ? xView->setGraphics( rDevice ) : sal_True;
                 [ +  - ]
    1020                 :            : }
    1021                 :            : 
    1022                 :       4276 : Reference< XGraphics > UnoControl::getGraphics(  ) throw(RuntimeException)
    1023                 :            : {
    1024                 :       4276 :     return mxGraphics;
    1025                 :            : }
    1026                 :            : 
    1027                 :          0 : awt::Size UnoControl::getSize(  ) throw(RuntimeException)
    1028                 :            : {
    1029         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( GetMutex() );
    1030         [ #  # ]:          0 :     return awt::Size( maComponentInfos.nWidth, maComponentInfos.nHeight );
    1031                 :            : }
    1032                 :            : 
    1033                 :       4148 : void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException)
    1034                 :            : {
    1035                 :       4148 :     Reference< XWindowPeer > xDrawPeer;
    1036                 :       4148 :     Reference< XView > xDrawPeerView;
    1037                 :            : 
    1038                 :       4148 :     bool bDisposeDrawPeer( false );
    1039                 :            :     {
    1040         [ +  - ]:       4148 :         ::osl::MutexGuard aGuard( GetMutex() );
    1041                 :            : 
    1042 [ +  - ][ +  - ]:       4148 :         xDrawPeer = ImplGetCompatiblePeer( sal_True );
    1043 [ +  - ][ +  - ]:       4148 :         bDisposeDrawPeer = xDrawPeer.is() && ( xDrawPeer != getPeer() );
         [ +  + ][ +  - ]
         [ #  # ][ +  - ]
    1044                 :            : 
    1045         [ +  - ]:       4148 :         xDrawPeerView.set( xDrawPeer, UNO_QUERY );
    1046         [ +  - ]:       4148 :         DBG_ASSERT( xDrawPeerView.is(), "UnoControl::draw: no peer!" );
    1047                 :            :     }
    1048                 :            : 
    1049         [ +  - ]:       4148 :     if ( xDrawPeerView.is() )
    1050                 :            :     {
    1051                 :       4148 :         Reference< XVclWindowPeer > xWindowPeer;
    1052         [ +  - ]:       4148 :         xWindowPeer.set( xDrawPeer, UNO_QUERY );
    1053         [ +  - ]:       4148 :         if ( xWindowPeer.is() )
    1054 [ +  - ][ +  - ]:       4148 :             xWindowPeer->setDesignMode( mbDesignMode );
    1055 [ +  - ][ +  - ]:       4148 :         xDrawPeerView->draw( x, y );
    1056                 :            :     }
    1057                 :            : 
    1058         [ +  + ]:       4148 :     if ( bDisposeDrawPeer )
    1059 [ +  - ][ +  - ]:       4148 :         xDrawPeer->dispose();
    1060                 :       4148 : }
    1061                 :            : 
    1062                 :      19938 : void UnoControl::setZoom( float fZoomX, float fZoomY ) throw(RuntimeException)
    1063                 :            : {
    1064                 :      19938 :     Reference< XView > xView;
    1065                 :            :     {
    1066         [ +  - ]:      19938 :         ::osl::MutexGuard aGuard( GetMutex() );
    1067                 :            : 
    1068                 :      19938 :         maComponentInfos.nZoomX = fZoomX;
    1069                 :      19938 :         maComponentInfos.nZoomY = fZoomY;
    1070                 :            : 
    1071 [ +  - ][ +  - ]:      19938 :         xView = xView.query( getPeer() );
         [ +  - ][ +  - ]
    1072                 :            :     }
    1073         [ +  + ]:      19938 :     if ( xView.is() )
    1074 [ +  - ][ +  - ]:      19938 :         xView->setZoom( fZoomX, fZoomY );
    1075                 :      19938 : }
    1076                 :            : 
    1077                 :            : // XControl
    1078                 :       1920 : void UnoControl::setContext( const Reference< XInterface >& rxContext ) throw(RuntimeException)
    1079                 :            : {
    1080         [ +  - ]:       1920 :     ::osl::MutexGuard aGuard( GetMutex() );
    1081                 :            : 
    1082 [ +  - ][ +  - ]:       1920 :     mxContext = rxContext;
    1083                 :       1920 : }
    1084                 :            : 
    1085                 :        698 : Reference< XInterface > UnoControl::getContext(  ) throw(RuntimeException)
    1086                 :            : {
    1087         [ +  - ]:        698 :     ::osl::MutexGuard aGuard( GetMutex() );
    1088                 :            : 
    1089         [ +  - ]:        698 :     return mxContext;
    1090                 :            : }
    1091                 :            : 
    1092                 :        633 : void UnoControl::peerCreated()
    1093                 :            : {
    1094 [ +  - ][ +  - ]:        633 :     Reference< XWindow > xWindow( getPeer(), UNO_QUERY );
    1095         [ -  + ]:        633 :     if ( !xWindow.is() )
    1096                 :        633 :         return;
    1097                 :            : 
    1098 [ +  - ][ +  + ]:        633 :     if ( maWindowListeners.getLength() )
    1099 [ +  - ][ +  - ]:        309 :         xWindow->addWindowListener( &maWindowListeners );
                 [ +  - ]
    1100                 :            : 
    1101 [ +  - ][ +  + ]:        633 :     if ( maFocusListeners.getLength() )
    1102 [ +  - ][ +  - ]:        203 :         xWindow->addFocusListener( &maFocusListeners );
                 [ +  - ]
    1103                 :            : 
    1104 [ +  - ][ +  + ]:        633 :     if ( maKeyListeners.getLength() )
    1105 [ +  - ][ +  - ]:        167 :         xWindow->addKeyListener( &maKeyListeners );
                 [ +  - ]
    1106                 :            : 
    1107 [ +  - ][ +  + ]:        633 :     if ( maMouseListeners.getLength() )
    1108 [ +  - ][ +  - ]:         20 :         xWindow->addMouseListener( &maMouseListeners );
                 [ +  - ]
    1109                 :            : 
    1110 [ +  - ][ -  + ]:        633 :     if ( maMouseMotionListeners.getLength() )
    1111 [ #  # ][ #  # ]:          0 :         xWindow->addMouseMotionListener( &maMouseMotionListeners );
                 [ #  # ]
    1112                 :            : 
    1113 [ +  - ][ -  + ]:        633 :     if ( maPaintListeners.getLength() )
    1114 [ #  # ][ #  # ]:        633 :         xWindow->addPaintListener( &maPaintListeners );
         [ #  # ][ +  - ]
    1115                 :            : }
    1116                 :            : 
    1117                 :        615 : void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Reference< XWindowPeer >& rParentPeer ) throw(RuntimeException)
    1118                 :            : {
    1119         [ +  - ]:        615 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    1120                 :            : 
    1121         [ -  + ]:        615 :     if ( !mxModel.is() )
    1122                 :            :     {
    1123         [ #  # ]:          0 :         RuntimeException aException;
    1124                 :          0 :         aException.Message = ::rtl::OUString("createPeer: no model!");
    1125         [ #  # ]:          0 :         aException.Context = (XAggregation*)(::cppu::OWeakAggObject*)this;
    1126         [ #  # ]:          0 :         throw( aException );
    1127                 :            :     }
    1128                 :            : 
    1129 [ +  - ][ +  + ]:        615 :     if( !getPeer().is() )
    1130                 :            :     {
    1131                 :        557 :         mbCreatingPeer = sal_True;
    1132                 :            : 
    1133                 :            :         WindowClass eType;
    1134                 :        557 :         Reference< XToolkit >  xToolkit = rxToolkit;
    1135 [ +  + ][ +  + ]:        557 :         if( rParentPeer.is() && mxContext.is() )
                 [ +  + ]
    1136                 :            :         {
    1137                 :            :             // kein TopWindow
    1138         [ +  - ]:        550 :             if ( !xToolkit.is() )
    1139 [ +  - ][ +  - ]:        550 :                 xToolkit = rParentPeer->getToolkit();
                 [ +  - ]
    1140 [ +  - ][ +  - ]:        550 :             Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const Reference< XControlContainer>*)0) );
    1141                 :        550 :             Reference< XControlContainer > xC;
    1142         [ +  - ]:        550 :             aAny >>= xC;
    1143         [ -  + ]:        550 :             if( xC.is() )
    1144                 :            :                 // It's a container
    1145                 :          0 :                 eType = WindowClass_CONTAINER;
    1146                 :            :             else
    1147                 :        550 :                 eType = WindowClass_SIMPLE;
    1148                 :            :         }
    1149                 :            :         else
    1150                 :            :         { // This is only correct for Top Window
    1151         [ +  + ]:          7 :             if( rParentPeer.is() )
    1152                 :            :             {
    1153         [ +  - ]:          5 :                 if ( !xToolkit.is() )
    1154 [ +  - ][ +  - ]:          5 :                     xToolkit = rParentPeer->getToolkit();
                 [ +  - ]
    1155                 :          5 :                 eType = WindowClass_CONTAINER;
    1156                 :            :             }
    1157                 :            :             else
    1158                 :            :             {
    1159         [ +  - ]:          2 :                 if ( !xToolkit.is() )
    1160 [ +  - ][ +  - ]:          2 :                     xToolkit = VCLUnoHelper::CreateToolkit();
    1161                 :          2 :                 eType = WindowClass_TOP;
    1162                 :            :             }
    1163                 :            :         }
    1164         [ +  - ]:        557 :         WindowDescriptor aDescr;
    1165                 :        557 :         aDescr.Type = eType;
    1166         [ +  - ]:        557 :         aDescr.WindowServiceName = GetComponentServiceName();
    1167         [ +  - ]:        557 :         aDescr.Parent = rParentPeer;
    1168         [ +  - ]:        557 :         aDescr.Bounds = getPosSize();
    1169                 :        557 :         aDescr.WindowAttributes = 0;
    1170                 :            : 
    1171                 :            :         // Border
    1172         [ +  - ]:        557 :         Reference< XPropertySet > xPSet( mxModel, UNO_QUERY );
    1173 [ +  - ][ +  - ]:        557 :         Reference< XPropertySetInfo >  xInfo = xPSet->getPropertySetInfo();
    1174                 :            : 
    1175                 :        557 :         Any aVal;
    1176         [ +  - ]:        557 :         ::rtl::OUString aPropName = GetPropertyName( BASEPROPERTY_BORDER );
    1177 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1178                 :            :         {
    1179 [ +  - ][ +  - ]:        409 :             aVal = xPSet->getPropertyValue( aPropName );
    1180                 :        409 :             sal_Int16 n = sal_Int16();
    1181         [ +  - ]:        409 :             if ( aVal >>= n )
    1182                 :            :             {
    1183         [ +  + ]:        409 :                 if ( n )
    1184                 :        403 :                     aDescr.WindowAttributes |= WindowAttribute::BORDER;
    1185                 :            :                 else
    1186                 :        409 :                     aDescr.WindowAttributes |= VclWindowPeerAttribute::NOBORDER;
    1187                 :            :             }
    1188                 :            :         }
    1189                 :            : 
    1190                 :            :         // DESKTOP_AS_PARENT
    1191         [ +  + ]:        557 :         if ( aDescr.Type == WindowClass_TOP )
    1192                 :            :         {
    1193         [ +  - ]:          2 :             aPropName = GetPropertyName( BASEPROPERTY_DESKTOP_AS_PARENT );
    1194 [ +  - ][ +  - ]:          2 :             if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1195                 :            :             {
    1196 [ +  - ][ +  - ]:          2 :                 aVal = xPSet->getPropertyValue( aPropName );
    1197                 :          2 :                 sal_Bool b = sal_Bool();
    1198 [ -  + ][ -  + ]:          2 :                 if ( ( aVal >>= b ) && b)
                 [ +  - ]
    1199                 :          2 :                     aDescr.ParentIndex = -1;
    1200                 :            :             }
    1201                 :            :         }
    1202                 :            :         // Moveable
    1203         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_MOVEABLE );
    1204 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1205                 :            :         {
    1206 [ +  - ][ +  - ]:          2 :             aVal = xPSet->getPropertyValue( aPropName );
    1207                 :          2 :             sal_Bool b = sal_Bool();
    1208 [ +  - ][ +  - ]:          2 :             if ( ( aVal >>= b ) && b)
                 [ +  - ]
    1209                 :          2 :                 aDescr.WindowAttributes |= WindowAttribute::MOVEABLE;
    1210                 :            :         }
    1211                 :            : 
    1212                 :            :         // Closeable
    1213         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_CLOSEABLE );
    1214 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1215                 :            :         {
    1216 [ +  - ][ +  - ]:          2 :             aVal = xPSet->getPropertyValue( aPropName );
    1217                 :          2 :             sal_Bool b = sal_Bool();
    1218 [ +  - ][ +  - ]:          2 :             if ( ( aVal >>= b ) && b)
                 [ +  - ]
    1219                 :          2 :                 aDescr.WindowAttributes |= WindowAttribute::CLOSEABLE;
    1220                 :            :         }
    1221                 :            : 
    1222                 :            :         // Dropdown
    1223         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_DROPDOWN );
    1224 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1225                 :            :         {
    1226 [ +  - ][ +  - ]:        132 :             aVal = xPSet->getPropertyValue( aPropName );
    1227                 :        132 :             sal_Bool b = sal_Bool();
    1228 [ +  + ][ +  + ]:        132 :             if ( ( aVal >>= b ) && b)
                 [ +  - ]
    1229                 :        132 :                 aDescr.WindowAttributes |= VclWindowPeerAttribute::DROPDOWN;
    1230                 :            :         }
    1231                 :            : 
    1232                 :            :         // Spin
    1233         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_SPIN );
    1234 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1235                 :            :         {
    1236 [ +  - ][ +  - ]:        158 :             aVal = xPSet->getPropertyValue( aPropName );
    1237                 :        158 :             sal_Bool b = sal_Bool();
    1238 [ +  + ][ +  + ]:        158 :             if ( ( aVal >>= b ) && b)
                 [ +  - ]
    1239                 :        158 :                 aDescr.WindowAttributes |= VclWindowPeerAttribute::SPIN;
    1240                 :            :         }
    1241                 :            : 
    1242                 :            :         // HScroll
    1243         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_HSCROLL );
    1244 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1245                 :            :         {
    1246 [ +  - ][ +  - ]:        127 :             aVal = xPSet->getPropertyValue( aPropName );
    1247                 :        127 :             sal_Bool b = sal_Bool();
    1248 [ +  + ][ +  + ]:        127 :             if ( ( aVal >>= b ) && b)
                 [ +  - ]
    1249                 :        127 :                 aDescr.WindowAttributes |= VclWindowPeerAttribute::HSCROLL;
    1250                 :            :         }
    1251                 :            : 
    1252                 :            :         // VScroll
    1253         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_VSCROLL );
    1254 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1255                 :            :         {
    1256 [ +  - ][ +  - ]:        127 :             aVal = xPSet->getPropertyValue( aPropName );
    1257                 :        127 :             sal_Bool b = sal_Bool();
    1258 [ +  + ][ +  + ]:        127 :             if ( ( aVal >>= b ) && b)
                 [ +  - ]
    1259                 :        127 :                 aDescr.WindowAttributes |= VclWindowPeerAttribute::VSCROLL;
    1260                 :            :         }
    1261                 :            : 
    1262                 :            :         // AutoHScroll
    1263         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_AUTOHSCROLL );
    1264 [ +  - ][ -  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1265                 :            :         {
    1266 [ #  # ][ #  # ]:          0 :             aVal = xPSet->getPropertyValue( aPropName );
    1267                 :          0 :             sal_Bool b = sal_Bool();
    1268 [ #  # ][ #  # ]:          0 :             if ( ( aVal >>= b ) && b)
                 [ #  # ]
    1269                 :          0 :                 aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOHSCROLL;
    1270                 :            :         }
    1271                 :            : 
    1272                 :            :         // AutoVScroll
    1273         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_AUTOVSCROLL );
    1274 [ +  - ][ -  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1275                 :            :         {
    1276 [ #  # ][ #  # ]:          0 :             aVal = xPSet->getPropertyValue( aPropName );
    1277                 :          0 :             sal_Bool b = sal_Bool();
    1278 [ #  # ][ #  # ]:          0 :             if ( ( aVal >>= b ) && b)
                 [ #  # ]
    1279                 :          0 :                 aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOVSCROLL;
    1280                 :            :         }
    1281                 :            : 
    1282                 :            :         //added for issue79712
    1283                 :            :         //NoLabel
    1284         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_NOLABEL );
    1285 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1286                 :            :         {
    1287 [ +  - ][ +  - ]:          4 :             aVal = xPSet->getPropertyValue( aPropName );
    1288                 :          4 :             sal_Bool b = sal_Bool();
    1289 [ -  + ][ -  + ]:          4 :             if ( ( aVal >>=b ) && b )
                 [ +  - ]
    1290                 :          4 :                 aDescr.WindowAttributes |= VclWindowPeerAttribute::NOLABEL;
    1291                 :            :         }
    1292                 :            :         //issue79712 ends
    1293                 :            : 
    1294                 :            :         // Align
    1295         [ +  - ]:        557 :         aPropName = GetPropertyName( BASEPROPERTY_ALIGN );
    1296 [ +  - ][ +  + ]:        557 :         if ( xInfo->hasPropertyByName( aPropName ) )
                 [ +  - ]
    1297                 :            :         {
    1298 [ +  - ][ +  - ]:        503 :             aVal = xPSet->getPropertyValue( aPropName );
    1299                 :        503 :             sal_Int16 n = sal_Int16();
    1300         [ +  - ]:        503 :             if ( aVal >>= n )
    1301                 :            :             {
    1302         [ +  + ]:        503 :                 if ( n == PROPERTY_ALIGN_LEFT )
    1303                 :        401 :                     aDescr.WindowAttributes |= VclWindowPeerAttribute::LEFT;
    1304         [ +  - ]:        102 :                 else if ( n == PROPERTY_ALIGN_CENTER )
    1305                 :        102 :                     aDescr.WindowAttributes |= VclWindowPeerAttribute::CENTER;
    1306                 :            :                 else
    1307                 :        503 :                     aDescr.WindowAttributes |= VclWindowPeerAttribute::RIGHT;
    1308                 :            :             }
    1309                 :            :         }
    1310                 :            : 
    1311                 :            :         // Allow derivates to manipulate attributes
    1312         [ +  - ]:        557 :         PrepareWindowDescriptor(aDescr);
    1313                 :            : 
    1314                 :            :         // create the peer
    1315 [ +  - ][ +  - ]:        557 :         setPeer( xToolkit->createWindow( aDescr ) );
                 [ +  - ]
    1316                 :            : 
    1317                 :            :         // release the mutex guard (and work with copies of our members)
    1318                 :            :         // this is necessary as our peer may lock the SolarMutex (actually, all currently known peers do), so calling
    1319                 :            :         // into the peer with our own mutex locked may cause deadlocks
    1320                 :            :         // (We _really_ need peers which do not use the SolarMutex. It's really pissing me off that from time to
    1321                 :            :         // time deadlocks pop up because the low-level components like our peers use a mutex which ususally
    1322                 :            :         // is locked at the top of the stack (it protects the global message looping). This is always dangerous, and
    1323                 :            :         // can not always be solved by tampering with other mutexes.
    1324                 :            :         // Unfortunately, the VCL used in the peers is not threadsafe, and by definition needs a locked SolarMutex.)
    1325                 :            :         // 82300 - 12/21/00 - FS
    1326                 :        557 :         UnoControlComponentInfos aComponentInfos(maComponentInfos);
    1327                 :        557 :         sal_Bool bDesignMode(mbDesignMode);
    1328                 :            : 
    1329                 :        557 :         Reference< XGraphics >  xGraphics( mxGraphics           );
    1330 [ +  - ][ +  - ]:        557 :         Reference< XView >      xView    ( getPeer(), UNO_QUERY_THROW );
    1331 [ +  - ][ +  - ]:        557 :         Reference< XWindow >    xWindow  ( getPeer(), UNO_QUERY_THROW );
    1332                 :            : 
    1333         [ +  - ]:        557 :         aGuard.clear();
    1334                 :            : 
    1335                 :            :         // the updateFromModel is done without a locked mutex, too.
    1336                 :            :         // The reason is that the only thing this method does  is firing property changes, and this in general has
    1337                 :            :         // to be done without locked mutexes (as every notification to external listeners).
    1338                 :            :         // 82300 - 12/21/00 - FS
    1339         [ +  - ]:        557 :         updateFromModel();
    1340                 :            : 
    1341 [ +  - ][ +  - ]:        557 :         xView->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );
    1342                 :            : 
    1343         [ +  - ]:        557 :         setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, aComponentInfos.nFlags );
    1344                 :            : 
    1345 [ +  + ][ +  + ]:        557 :         if( aComponentInfos.bVisible && !bDesignMode )
    1346                 :            :             // Show only after setting the data
    1347 [ +  - ][ +  - ]:         21 :             xWindow->setVisible( aComponentInfos.bVisible );
    1348                 :            : 
    1349         [ -  + ]:        557 :         if( !aComponentInfos.bEnable )
    1350 [ #  # ][ #  # ]:          0 :             xWindow->setEnable( aComponentInfos.bEnable );
    1351                 :            : 
    1352 [ +  - ][ +  - ]:        557 :         xView->setGraphics( xGraphics );
    1353                 :            : 
    1354         [ +  - ]:        557 :         peerCreated();
    1355                 :            : 
    1356         [ +  - ]:        557 :         mbCreatingPeer = sal_False;
    1357         [ +  - ]:        615 :     }
    1358                 :        615 : }
    1359                 :            : 
    1360                 :     109658 : Reference< XWindowPeer > UnoControl::getPeer() throw(RuntimeException)
    1361                 :            : {
    1362         [ +  - ]:     109658 :     ::osl::MutexGuard aGuard( GetMutex() );
    1363         [ +  - ]:     109658 :     return mxPeer;
    1364                 :            : }
    1365                 :            : 
    1366                 :       2303 : sal_Bool UnoControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
    1367                 :            : {
    1368         [ +  - ]:       2303 :     ::osl::MutexGuard aGuard( GetMutex() );
    1369                 :            : 
    1370         [ +  - ]:       2303 :     Reference< XMultiPropertySet > xPropSet( mxModel, UNO_QUERY );
    1371                 :            : 
    1372                 :            :     // query for the XPropertiesChangeListener - our delegator is allowed to overwrite this interface
    1373                 :       2303 :     Reference< XPropertiesChangeListener > xListener;
    1374 [ +  - ][ +  - ]:       2303 :     queryInterface( ::getCppuType( &xListener ) ) >>= xListener;
                 [ +  - ]
    1375                 :            : 
    1376         [ +  + ]:       2303 :     if( xPropSet.is() )
    1377 [ +  - ][ +  - ]:       1166 :         xPropSet->removePropertiesChangeListener( xListener );
    1378                 :            : 
    1379                 :       2303 :     mpData->bLocalizationSupport = false;
    1380         [ +  - ]:       2303 :     mxModel = rxModel;
    1381                 :            : 
    1382         [ +  + ]:       2303 :     if( mxModel.is() )
    1383                 :            :     {
    1384                 :            :         try
    1385                 :            :         {
    1386         [ +  - ]:       1198 :             xPropSet.set( mxModel, UNO_QUERY_THROW );
    1387 [ +  - ][ +  - ]:       1198 :             Reference< XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), UNO_SET_THROW );
                 [ +  - ]
    1388                 :            : 
    1389         [ +  - ]:       1198 :             Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
    1390 [ +  - ][ +  - ]:       1198 :             xPropSet->addPropertiesChangeListener( aNames, xListener );
    1391                 :            : 
    1392 [ +  - ][ +  - ]:       1198 :             mpData->bLocalizationSupport = xPSI->hasPropertyByName( ::rtl::OUString( "ResourceResolver" ) );
         [ +  - ][ #  # ]
    1393                 :            :         }
    1394         [ #  # ]:          0 :         catch( const Exception& )
    1395                 :            :         {
    1396                 :            :             DBG_UNHANDLED_EXCEPTION();
    1397                 :          0 :             mxModel.clear();
    1398                 :            :         }
    1399                 :            :     }
    1400                 :            : 
    1401         [ +  - ]:       2303 :     return mxModel.is();
    1402                 :            : }
    1403                 :            : 
    1404                 :      13775 : Reference< XControlModel > UnoControl::getModel(    ) throw(RuntimeException)
    1405                 :            : {
    1406                 :      13775 :     return mxModel;
    1407                 :            : }
    1408                 :            : 
    1409                 :         60 : Reference< XView > UnoControl::getView(  ) throw(RuntimeException)
    1410                 :            : {
    1411                 :         60 :     return  static_cast< XView* >( this );
    1412                 :            : }
    1413                 :            : 
    1414                 :        456 : void UnoControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
    1415                 :            : {
    1416         [ +  - ]:        456 :     ModeChangeEvent aModeChangeEvent;
    1417                 :            : 
    1418                 :        456 :     Reference< XWindow > xWindow;
    1419                 :            :     {
    1420         [ +  - ]:        456 :         ::osl::MutexGuard aGuard( GetMutex() );
    1421         [ +  + ]:        456 :         if ( bOn == mbDesignMode )
    1422                 :        456 :             return;
    1423                 :            : 
    1424                 :            :         // remember this
    1425                 :        437 :         mbDesignMode = bOn;
    1426 [ +  - ][ +  - ]:        437 :         xWindow = xWindow.query( getPeer() );
                 [ +  - ]
    1427                 :            :         // dispose our current AccessibleContext, if we have one
    1428                 :            :         // (changing the design mode implies having a new implementation for this context,
    1429                 :            :         // so the old one must be declared DEFUNC)
    1430         [ +  - ]:        437 :         disposeAccessibleContext();
    1431                 :            : 
    1432 [ +  - ][ +  - ]:        437 :         aModeChangeEvent.Source = *this;
    1433 [ +  + ][ +  + ]:        456 :         aModeChangeEvent.NewMode = mbDesignMode ? ::rtl::OUString("design") : ::rtl::OUString("alive" );
         [ +  - ][ +  + ]
                 [ +  + ]
    1434                 :            :     }
    1435                 :            : 
    1436                 :            :     // ajust the visibility of our window
    1437         [ +  + ]:        456 :     if ( xWindow.is() )
    1438 [ +  - ][ +  - ]:        126 :         xWindow->setVisible( !bOn );
    1439                 :            : 
    1440                 :            :     // and notify our mode listeners
    1441 [ +  - ][ +  + ]:        456 :     maModeChangeListeners.notifyEach( &XModeChangeListener::modeChanged, aModeChangeEvent );
         [ +  - ][ +  + ]
    1442                 :            : }
    1443                 :            : 
    1444                 :      21684 : sal_Bool UnoControl::isDesignMode(  ) throw(RuntimeException)
    1445                 :            : {
    1446                 :      21684 :     return mbDesignMode;
    1447                 :            : }
    1448                 :            : 
    1449                 :         42 : sal_Bool UnoControl::isTransparent(  ) throw(RuntimeException)
    1450                 :            : {
    1451                 :         42 :     return sal_False;
    1452                 :            : }
    1453                 :            : 
    1454                 :            : // XServiceInfo
    1455                 :          0 : ::rtl::OUString UnoControl::getImplementationName(  ) throw(RuntimeException)
    1456                 :            : {
    1457                 :            :     OSL_FAIL( "This method should be overloaded!" );
    1458                 :          0 :     return ::rtl::OUString();
    1459                 :            : }
    1460                 :            : 
    1461                 :          0 : sal_Bool UnoControl::supportsService( const ::rtl::OUString& rServiceName ) throw(RuntimeException)
    1462                 :            : {
    1463         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( GetMutex() );
    1464                 :            : 
    1465         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
    1466                 :          0 :     const ::rtl::OUString* pArray = aSNL.getConstArray();
    1467                 :          0 :     const ::rtl::OUString* pArrayEnd = aSNL.getConstArray() + aSNL.getLength();
    1468         [ #  # ]:          0 :     for (; pArray != pArrayEnd; ++pArray )
    1469         [ #  # ]:          0 :         if( *pArray == rServiceName )
    1470                 :          0 :             break;
    1471                 :            : 
    1472 [ #  # ][ #  # ]:          0 :     return pArray != pArrayEnd;
    1473                 :            : }
    1474                 :            : 
    1475                 :          0 : Sequence< ::rtl::OUString > UnoControl::getSupportedServiceNames(  ) throw(RuntimeException)
    1476                 :            : {
    1477                 :          0 :     ::rtl::OUString sName( "com.sun.star.awt.UnoControl" );
    1478         [ #  # ]:          0 :     return Sequence< ::rtl::OUString >( &sName, 1 );
    1479                 :            : }
    1480                 :            : 
    1481                 :            : // ------------------------------------------------------------------------
    1482                 :         66 : Reference< XAccessibleContext > SAL_CALL UnoControl::getAccessibleContext(  ) throw (RuntimeException)
    1483                 :            : {
    1484                 :            :     // creation of the context will certainly require the SolarMutex ...
    1485         [ +  - ]:         66 :     SolarMutexGuard aSolarGuard;
    1486         [ +  - ]:         66 :     ::osl::MutexGuard aGuard( GetMutex() );
    1487                 :            : 
    1488 [ +  - ][ +  - ]:         66 :     Reference< XAccessibleContext > xCurrentContext( maAccessibleContext.get(), UNO_QUERY );
    1489         [ +  - ]:         66 :     if ( !xCurrentContext.is() )
    1490                 :            :     {
    1491         [ +  + ]:         66 :         if ( !mbDesignMode )
    1492                 :            :         {   // in alive mode, use the AccessibleContext of the peer
    1493 [ +  - ][ +  - ]:          6 :             Reference< XAccessible > xPeerAcc( getPeer(), UNO_QUERY );
    1494         [ +  - ]:          6 :             if ( xPeerAcc.is() )
    1495 [ +  - ][ +  - ]:          6 :                 xCurrentContext = xPeerAcc->getAccessibleContext( );
                 [ +  - ]
    1496                 :            :         }
    1497                 :            :         else
    1498                 :            :             // in design mode, use a fallback
    1499 [ +  - ][ +  - ]:         60 :             xCurrentContext = ::toolkit::OAccessibleControlContext::create( this );
         [ +  - ][ +  - ]
    1500                 :            : 
    1501                 :            :         DBG_ASSERT( xCurrentContext.is(), "UnoControl::getAccessibleContext: invalid context (invalid peer?)!" );
    1502         [ +  - ]:         66 :         maAccessibleContext = xCurrentContext;
    1503                 :            : 
    1504                 :            :         // get notified when the context is disposed
    1505         [ +  - ]:         66 :         Reference< XComponent > xContextComp( xCurrentContext, UNO_QUERY );
    1506         [ +  - ]:         66 :         if ( xContextComp.is() )
    1507 [ +  - ][ +  - ]:         66 :             xContextComp->addEventListener( this );
                 [ +  - ]
    1508                 :            :         // In an ideal world, this is not necessary - there the object would be released as soon as it has been
    1509                 :            :         // disposed, and thus our weak reference would be empty, too.
    1510                 :            :         // But 'til this ideal world comes (means 'til we do never have any refcount/lifetime bugs anymore), we
    1511                 :            :         // need to listen for disposal and reset our weak reference then.
    1512                 :            :     }
    1513                 :            : 
    1514 [ +  - ][ +  - ]:         66 :     return xCurrentContext;
    1515                 :            : }
    1516                 :            : 
    1517                 :        350 : void SAL_CALL UnoControl::addModeChangeListener( const Reference< XModeChangeListener >& _rxListener ) throw (RuntimeException)
    1518                 :            : {
    1519         [ +  - ]:        350 :     ::osl::MutexGuard aGuard( GetMutex() );
    1520 [ +  - ][ +  - ]:        350 :     maModeChangeListeners.addInterface( _rxListener );
    1521                 :        350 : }
    1522                 :            : 
    1523                 :        347 : void SAL_CALL UnoControl::removeModeChangeListener( const Reference< XModeChangeListener >& _rxListener ) throw (RuntimeException)
    1524                 :            : {
    1525         [ +  - ]:        347 :     ::osl::MutexGuard aGuard( GetMutex() );
    1526 [ +  - ][ +  - ]:        347 :     maModeChangeListeners.removeInterface( _rxListener );
    1527                 :        347 : }
    1528                 :            : 
    1529                 :          0 : void SAL_CALL UnoControl::addModeChangeApproveListener( const Reference< XModeChangeApproveListener >& ) throw (NoSupportException, RuntimeException)
    1530                 :            : {
    1531         [ #  # ]:          0 :     throw NoSupportException( );
    1532                 :            : }
    1533                 :            : 
    1534                 :          0 : void SAL_CALL UnoControl::removeModeChangeApproveListener( const Reference< XModeChangeApproveListener >&  ) throw (NoSupportException, RuntimeException)
    1535                 :            : {
    1536         [ #  # ]:          0 :     throw NoSupportException( );
    1537                 :            : }
    1538                 :            : 
    1539                 :            : //----------------------------------------------------------------------------------------------------------------------
    1540                 :          0 : awt::Point SAL_CALL UnoControl::convertPointToLogic( const awt::Point& i_Point, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
    1541                 :            : {
    1542                 :          0 :     Reference< XUnitConversion > xPeerConversion;
    1543                 :            :     {
    1544         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
    1545 [ #  # ][ #  # ]:          0 :         xPeerConversion = xPeerConversion.query( getPeer() );
         [ #  # ][ #  # ]
    1546                 :            :     }
    1547         [ #  # ]:          0 :     if ( xPeerConversion.is() )
    1548 [ #  # ][ #  # ]:          0 :         return xPeerConversion->convertPointToLogic( i_Point, i_TargetUnit );
    1549                 :          0 :     return awt::Point( );
    1550                 :            : }
    1551                 :            : 
    1552                 :            : //----------------------------------------------------------------------------------------------------------------------
    1553                 :          0 : awt::Point SAL_CALL UnoControl::convertPointToPixel( const awt::Point& i_Point, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
    1554                 :            : {
    1555                 :          0 :     Reference< XUnitConversion > xPeerConversion;
    1556                 :            :     {
    1557         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
    1558 [ #  # ][ #  # ]:          0 :         xPeerConversion = xPeerConversion.query( getPeer() );
         [ #  # ][ #  # ]
    1559                 :            :     }
    1560         [ #  # ]:          0 :     if ( xPeerConversion.is() )
    1561 [ #  # ][ #  # ]:          0 :         return xPeerConversion->convertPointToPixel( i_Point, i_SourceUnit );
    1562                 :          0 :     return awt::Point( );
    1563                 :            : }
    1564                 :            : 
    1565                 :            : //----------------------------------------------------------------------------------------------------------------------
    1566                 :          0 : awt::Size SAL_CALL UnoControl::convertSizeToLogic( const awt::Size& i_Size, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
    1567                 :            : {
    1568                 :          0 :     Reference< XUnitConversion > xPeerConversion;
    1569                 :            :     {
    1570         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
    1571 [ #  # ][ #  # ]:          0 :         xPeerConversion = xPeerConversion.query( getPeer() );
         [ #  # ][ #  # ]
    1572                 :            :     }
    1573         [ #  # ]:          0 :     if ( xPeerConversion.is() )
    1574 [ #  # ][ #  # ]:          0 :         return xPeerConversion->convertSizeToLogic( i_Size, i_TargetUnit );
    1575                 :          0 :     return awt::Size( );
    1576                 :            : }
    1577                 :            : 
    1578                 :            : //----------------------------------------------------------------------------------------------------------------------
    1579                 :          0 : awt::Size SAL_CALL UnoControl::convertSizeToPixel( const awt::Size& i_Size, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
    1580                 :            : {
    1581                 :          0 :     Reference< XUnitConversion > xPeerConversion;
    1582                 :            :     {
    1583         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
    1584 [ #  # ][ #  # ]:          0 :         xPeerConversion = xPeerConversion.query( getPeer() );
         [ #  # ][ #  # ]
    1585                 :            :     }
    1586         [ #  # ]:          0 :     if ( xPeerConversion.is() )
    1587 [ #  # ][ #  # ]:          0 :         return xPeerConversion->convertSizeToPixel( i_Size, i_SourceUnit );
    1588                 :          0 :     return awt::Size( );
    1589                 :            : }
    1590                 :            : 
    1591                 :            : //----------------------------------------------------------------------------------------------------------------------
    1592                 :          0 : uno::Reference< awt::XStyleSettings > SAL_CALL UnoControl::getStyleSettings() throw (RuntimeException)
    1593                 :            : {
    1594                 :          0 :     Reference< awt::XStyleSettingsSupplier > xPeerSupplier;
    1595                 :            :     {
    1596         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( GetMutex() );
    1597 [ #  # ][ #  # ]:          0 :         xPeerSupplier = xPeerSupplier.query( getPeer() );
         [ #  # ][ #  # ]
    1598                 :            :     }
    1599         [ #  # ]:          0 :     if ( xPeerSupplier.is() )
    1600 [ #  # ][ #  # ]:          0 :         return xPeerSupplier->getStyleSettings();
    1601         [ #  # ]:          0 :     return NULL;
    1602                 :            : }
    1603                 :            : 
    1604                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10