LCOV - code coverage report
Current view: top level - toolkit/source/awt - vclxwindow.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 725 1234 58.8 %
Date: 2014-04-11 Functions: 91 122 74.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <com/sun/star/awt/WindowEvent.hpp>
      22             : #include <com/sun/star/awt/KeyEvent.hpp>
      23             : #include <com/sun/star/awt/KeyModifier.hpp>
      24             : #include <com/sun/star/awt/MouseEvent.hpp>
      25             : #include <com/sun/star/awt/MouseButton.hpp>
      26             : #include <com/sun/star/awt/MouseWheelBehavior.hpp>
      27             : #include <com/sun/star/awt/XTopWindow.hpp>
      28             : #include <com/sun/star/awt/Style.hpp>
      29             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      30             : #include <com/sun/star/awt/DockingEvent.hpp>
      31             : #include <com/sun/star/awt/EndDockingEvent.hpp>
      32             : #include <com/sun/star/awt/EndPopupModeEvent.hpp>
      33             : #include <com/sun/star/awt/XWindowListener2.hpp>
      34             : #include <com/sun/star/style/VerticalAlignment.hpp>
      35             : #include <com/sun/star/lang/DisposedException.hpp>
      36             : #include <com/sun/star/text/WritingMode2.hpp>
      37             : #include <toolkit/awt/vclxwindow.hxx>
      38             : #include <toolkit/awt/vclxpointer.hxx>
      39             : #include <toolkit/awt/vclxwindows.hxx>
      40             : #include <toolkit/helper/macros.hxx>
      41             : #include <toolkit/helper/vclunohelper.hxx>
      42             : #include <toolkit/helper/convert.hxx>
      43             : #include <toolkit/helper/property.hxx>
      44             : #include <toolkit/helper/accessibilityclient.hxx>
      45             : #include <cppuhelper/typeprovider.hxx>
      46             : #include <rtl/uuid.h>
      47             : #include <rtl/ustrbuf.hxx>
      48             : #include <vcl/svapp.hxx>
      49             : #include <vcl/window.hxx>
      50             : #include <tools/color.hxx>
      51             : #include <vcl/dockwin.hxx>
      52             : #include <vcl/pdfextoutdevdata.hxx>
      53             : #include <vcl/tabpage.hxx>
      54             : #include <vcl/button.hxx>
      55             : #include <vcl/settings.hxx>
      56             : #include <comphelper/asyncnotification.hxx>
      57             : #include <comphelper/flagguard.hxx>
      58             : #include "stylesettings.hxx"
      59             : #include <tools/urlobj.hxx>
      60             : #include <toolkit/helper/unopropertyarrayhelper.hxx>
      61             : 
      62             : #include <boost/bind.hpp>
      63             : #include <boost/noncopyable.hpp>
      64             : 
      65             : using namespace ::com::sun::star;
      66             : 
      67             : using ::com::sun::star::uno::Reference;
      68             : using ::com::sun::star::uno::UNO_QUERY;
      69             : using ::com::sun::star::uno::RuntimeException;
      70             : using ::com::sun::star::lang::EventObject;
      71             : using ::com::sun::star::awt::XWindowListener2;
      72             : using ::com::sun::star::awt::XDockableWindowListener;
      73             : using ::com::sun::star::awt::XDevice;
      74             : using ::com::sun::star::awt::XStyleSettings;
      75             : using ::com::sun::star::lang::DisposedException;
      76             : using ::com::sun::star::style::VerticalAlignment;
      77             : using ::com::sun::star::style::VerticalAlignment_TOP;
      78             : using ::com::sun::star::style::VerticalAlignment_MIDDLE;
      79             : using ::com::sun::star::style::VerticalAlignment_BOTTOM;
      80             : using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE;
      81             : 
      82             : namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
      83             : namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
      84             : 
      85             : 
      86             : //= VCLXWindowImpl
      87             : 
      88             : class VCLXWindowImpl: private boost::noncopyable
      89             : {
      90             : private:
      91             :     typedef ::std::vector< VCLXWindow::Callback >                       CallbackArray;
      92             : 
      93             : private:
      94             :     VCLXWindow&                         mrAntiImpl;
      95             :     ::toolkit::AccessibilityClient      maAccFactory;
      96             :     bool                                mbDisposed;
      97             :     bool                                mbDrawingOntoParent;    // no bit mask, is passed around  by reference
      98             :     bool                            mbEnableVisible;
      99             :     bool                            mbDirectVisible;
     100             : 
     101             :     ::osl::Mutex                        maListenerContainerMutex;
     102             :     ::cppu::OInterfaceContainerHelper   maWindow2Listeners;
     103             :     ::cppu::OInterfaceContainerHelper   maDockableWindowListeners;
     104             :     EventListenerMultiplexer            maEventListeners;
     105             :     FocusListenerMultiplexer            maFocusListeners;
     106             :     WindowListenerMultiplexer           maWindowListeners;
     107             :     KeyListenerMultiplexer              maKeyListeners;
     108             :     MouseListenerMultiplexer            maMouseListeners;
     109             :     MouseMotionListenerMultiplexer      maMouseMotionListeners;
     110             :     PaintListenerMultiplexer            maPaintListeners;
     111             :     VclContainerListenerMultiplexer     maContainerListeners;
     112             :     TopWindowListenerMultiplexer        maTopWindowListeners;
     113             : 
     114             :     CallbackArray                       maCallbackEvents;
     115             :     sal_uLong                               mnCallbackEventId;
     116             : 
     117             : public:
     118             :     bool                                mbDisposing             : 1;
     119             :     bool                                mbDesignMode            : 1;
     120             :     bool                                mbSynthesizingVCLEvent  : 1;
     121             :     bool                                mbWithDefaultProps      : 1;
     122             : 
     123             :     sal_uLong                               mnListenerLockLevel;
     124             :     sal_Int16                           mnWritingMode;
     125             :     sal_Int16                           mnContextWritingMode;
     126             : 
     127             :     UnoPropertyArrayHelper*             mpPropHelper;
     128             : 
     129             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >
     130             :                                         mxPointer;
     131             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
     132             :                                         mxAccessibleContext;
     133             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >
     134             :                                         mxViewGraphics;
     135             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings >
     136             :                                         mxWindowStyleSettings;
     137             : 
     138             : public:
     139           0 :     bool&   getDrawingOntoParent_ref()  { return mbDrawingOntoParent; }
     140             : 
     141             : public:
     142             :     /** ctor
     143             :     @param _pAntiImpl
     144             :         the <type>VCLXWindow</type> instance which the object belongs to. Must
     145             :         live longer then the object just being constructed.
     146             :     */
     147             :     VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps );
     148             : 
     149             :     /** synchronously mbEnableVisible
     150             :     */
     151         173 :     void    setEnableVisible( bool bEnableVisible ) { mbEnableVisible = bEnableVisible; }
     152       28159 :     bool    isEnableVisible() { return mbEnableVisible; }
     153             :     /** synchronously mbDirectVisible;
     154             :     */
     155       70659 :     void    setDirectVisible( bool bDirectVisible ) { mbDirectVisible = bDirectVisible; }
     156          56 :     bool    isDirectVisible() { return mbDirectVisible; }
     157             : 
     158             :     /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock
     159             :     */
     160             :     void    callBackAsync( const VCLXWindow::Callback& i_callback );
     161             : 
     162             :     /** notifies the object that its VCLXWindow is being disposed
     163             :     */
     164             :     void    disposing();
     165             : 
     166         211 :     inline ::toolkit::AccessibilityClient& getAccessibleFactory()
     167             :     {
     168         211 :         return maAccFactory;
     169             :     }
     170             : 
     171             :     Reference< XStyleSettings > getStyleSettings();
     172             : 
     173             :     /** returns the container of registered XWindowListener2 listeners
     174             :     */
     175       11882 :     inline ::cppu::OInterfaceContainerHelper&   getWindow2Listeners()       { return maWindow2Listeners; }
     176        6103 :     inline ::cppu::OInterfaceContainerHelper&   getDockableWindowListeners(){ return maDockableWindowListeners; }
     177         121 :     inline EventListenerMultiplexer&            getEventListeners()         { return maEventListeners; }
     178       27108 :     inline FocusListenerMultiplexer&            getFocusListeners()         { return maFocusListeners; }
     179      242259 :     inline WindowListenerMultiplexer&           getWindowListeners()        { return maWindowListeners; }
     180          95 :     inline KeyListenerMultiplexer&              getKeyListeners()           { return maKeyListeners; }
     181         100 :     inline MouseListenerMultiplexer&            getMouseListeners()         { return maMouseListeners; }
     182          10 :     inline MouseMotionListenerMultiplexer&      getMouseMotionListeners()   { return maMouseMotionListeners; }
     183        2236 :     inline PaintListenerMultiplexer&            getPaintListeners()         { return maPaintListeners; }
     184       75905 :     inline VclContainerListenerMultiplexer&     getContainerListeners()     { return maContainerListeners; }
     185       89197 :     inline TopWindowListenerMultiplexer&        getTopWindowListeners()     { return maTopWindowListeners; }
     186             : 
     187             :     ~VCLXWindowImpl();
     188             : 
     189             : private:
     190             :     DECL_LINK( OnProcessCallbacks, void* );
     191             : };
     192             : 
     193             : 
     194       40843 : VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps )
     195             :     :mrAntiImpl( _rAntiImpl )
     196             :     ,mbDisposed( false )
     197             :     ,mbDrawingOntoParent( false )
     198             :     ,mbEnableVisible(true)
     199             :     ,mbDirectVisible(true)
     200             :     ,maListenerContainerMutex( )
     201             :     ,maWindow2Listeners( maListenerContainerMutex )
     202             :     ,maDockableWindowListeners( maListenerContainerMutex )
     203             :     ,maEventListeners( _rAntiImpl )
     204             :     ,maFocusListeners( _rAntiImpl )
     205             :     ,maWindowListeners( _rAntiImpl )
     206             :     ,maKeyListeners( _rAntiImpl )
     207             :     ,maMouseListeners( _rAntiImpl )
     208             :     ,maMouseMotionListeners( _rAntiImpl )
     209             :     ,maPaintListeners( _rAntiImpl )
     210             :     ,maContainerListeners( _rAntiImpl )
     211             :     ,maTopWindowListeners( _rAntiImpl )
     212             :     ,mnCallbackEventId( 0 )
     213             :     ,mbDisposing( false )
     214             :     ,mbDesignMode( false )
     215             :     ,mbSynthesizingVCLEvent( false )
     216             :     ,mbWithDefaultProps( _bWithDefaultProps )
     217             :     ,mnListenerLockLevel( 0 )
     218             :     ,mnWritingMode( WritingMode2::CONTEXT )
     219             :     ,mnContextWritingMode( WritingMode2::CONTEXT )
     220       40843 :     ,mpPropHelper( NULL )
     221             : {
     222       40843 : }
     223             : 
     224       70114 : VCLXWindowImpl::~VCLXWindowImpl()
     225             : {
     226       35057 :     delete mpPropHelper;
     227       35057 : }
     228             : 
     229             : 
     230       42819 : void VCLXWindowImpl::disposing()
     231             : {
     232       42819 :     SolarMutexGuard aGuard;
     233       42819 :     if ( mnCallbackEventId )
     234        5535 :         Application::RemoveUserEvent( mnCallbackEventId );
     235       42819 :     mnCallbackEventId = 0;
     236             : 
     237       42819 :     mbDisposed= true;
     238             : 
     239       85638 :     ::com::sun::star::lang::EventObject aEvent;
     240       42819 :     aEvent.Source = mrAntiImpl;
     241             : 
     242       42819 :     maDockableWindowListeners.disposeAndClear( aEvent );
     243       42819 :     maEventListeners.disposeAndClear( aEvent );
     244       42819 :     maFocusListeners.disposeAndClear( aEvent );
     245       42819 :     maWindowListeners.disposeAndClear( aEvent );
     246       42819 :     maKeyListeners.disposeAndClear( aEvent );
     247       42819 :     maMouseListeners.disposeAndClear( aEvent );
     248       42819 :     maMouseMotionListeners.disposeAndClear( aEvent );
     249       42819 :     maPaintListeners.disposeAndClear( aEvent );
     250       42819 :     maContainerListeners.disposeAndClear( aEvent );
     251       42819 :     maTopWindowListeners.disposeAndClear( aEvent );
     252             : 
     253       42819 :     ::toolkit::WindowStyleSettings* pStyleSettings = static_cast< ::toolkit::WindowStyleSettings* >( mxWindowStyleSettings.get() );
     254       42819 :     if ( pStyleSettings != NULL )
     255           0 :         pStyleSettings->dispose();
     256       85638 :     mxWindowStyleSettings.clear();
     257       42819 : }
     258             : 
     259             : 
     260       11177 : void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback )
     261             : {
     262             :     DBG_TESTSOLARMUTEX();
     263       11177 :     maCallbackEvents.push_back( i_callback );
     264       11177 :     if ( !mnCallbackEventId )
     265             :     {
     266             :         // ensure our VCLXWindow is not destroyed while the event is underway
     267        5606 :         mrAntiImpl.acquire();
     268        5606 :         mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) );
     269             :     }
     270       11177 : }
     271             : 
     272             : 
     273         142 : IMPL_LINK_NOARG(VCLXWindowImpl, OnProcessCallbacks)
     274             : {
     275          71 :     const Reference< uno::XInterface > xKeepAlive( mrAntiImpl );
     276             : 
     277             :     // work on a copy of the callback array
     278         142 :     CallbackArray aCallbacksCopy;
     279             :     {
     280          71 :         SolarMutexGuard aGuard;
     281          71 :         aCallbacksCopy = maCallbackEvents;
     282          71 :         maCallbackEvents.clear();
     283             : 
     284             :         // we acquired our VCLXWindow once before posting the event, release this one ref now
     285          71 :         mrAntiImpl.release();
     286             : 
     287          71 :         if ( !mnCallbackEventId )
     288             :             // we were disposed while waiting for the mutex to lock
     289           0 :             return 1L;
     290             : 
     291          71 :         mnCallbackEventId = 0;
     292             :     }
     293             : 
     294             :     {
     295          71 :         SolarMutexReleaser aReleaseSolar;
     296         534 :         for (   CallbackArray::const_iterator loop = aCallbacksCopy.begin();
     297         356 :                 loop != aCallbacksCopy.end();
     298             :                 ++loop
     299             :             )
     300             :         {
     301         107 :             (*loop)();
     302          71 :         }
     303             :     }
     304             : 
     305         142 :     return 0L;
     306             : }
     307             : 
     308           0 : Reference< XStyleSettings > VCLXWindowImpl::getStyleSettings()
     309             : {
     310           0 :     SolarMutexGuard aGuard;
     311           0 :     if ( mbDisposed )
     312           0 :         throw DisposedException( OUString(), mrAntiImpl );
     313           0 :     if ( !mxWindowStyleSettings.is() )
     314           0 :         mxWindowStyleSettings = new ::toolkit::WindowStyleSettings( maListenerContainerMutex, mrAntiImpl );
     315           0 :     return mxWindowStyleSettings;
     316             : }
     317             : 
     318             : 
     319             : 
     320             : 
     321             : // Uses an out-parameter instead of return value, due to the object reference
     322             : 
     323       43352 : void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pWindow )
     324             : {
     325       43352 :     Point aPos = pWindow->GetPosPixel();
     326       43352 :     Size aSz = pWindow->GetSizePixel();
     327             : 
     328       43352 :     rEvent.X = aPos.X();
     329       43352 :     rEvent.Y = aPos.Y();
     330             : 
     331       43352 :     rEvent.Width = aSz.Width();
     332       43352 :     rEvent.Height = aSz.Height();
     333             : 
     334       43352 :     pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset );
     335       43352 : }
     336             : 
     337       40843 : VCLXWindow::VCLXWindow( bool _bWithDefaultProps )
     338       40843 :     :mpImpl( NULL )
     339             : {
     340       40843 :     mpImpl = new VCLXWindowImpl( *this, _bWithDefaultProps );
     341       40843 : }
     342             : 
     343       91589 : VCLXWindow::~VCLXWindow()
     344             : {
     345       35057 :     delete mpImpl;
     346             : 
     347       35057 :     if ( GetWindow() )
     348             :     {
     349           0 :         GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
     350           0 :         GetWindow()->SetWindowPeer( NULL, NULL );
     351           0 :         GetWindow()->SetAccessible( NULL );
     352             :     }
     353       56532 : }
     354             : 
     355             : 
     356       11177 : void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
     357             : {
     358       11177 :     mpImpl->callBackAsync( i_callback );
     359       11177 : }
     360             : 
     361             : 
     362         211 : ::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory()
     363             : {
     364         211 :     return mpImpl->getAccessibleFactory().getFactory();
     365             : }
     366             : 
     367      108554 : void VCLXWindow::SetWindow( Window* pWindow )
     368             : {
     369      108554 :     if ( GetWindow() )
     370             :     {
     371       67711 :         GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
     372             : //        GetWindow()->DbgAssertNoEventListeners();
     373             :     }
     374             : 
     375      108554 :     SetOutputDevice( pWindow );
     376             : 
     377      108554 :     if ( GetWindow() )
     378             :     {
     379       40844 :         GetWindow()->AddEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
     380       40844 :         bool bDirectVisible = pWindow ? pWindow->IsVisible() : false;
     381       40844 :         mpImpl->setDirectVisible( bDirectVisible );
     382             :     }
     383      108554 : }
     384             : 
     385        5027 : void VCLXWindow::suspendVclEventListening( )
     386             : {
     387        5027 :     ++mpImpl->mnListenerLockLevel;
     388        5027 : }
     389             : 
     390        5027 : void VCLXWindow::resumeVclEventListening( )
     391             : {
     392             :     DBG_ASSERT( mpImpl->mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" );
     393        5027 :     --mpImpl->mnListenerLockLevel;
     394        5027 : }
     395             : 
     396       75905 : void VCLXWindow::notifyWindowRemoved( Window& _rWindow )
     397             : {
     398       75905 :     if ( mpImpl->getContainerListeners().getLength() )
     399             :     {
     400           0 :         awt::VclContainerEvent aEvent;
     401           0 :         aEvent.Source = *this;
     402           0 :         aEvent.Child = static_cast< XWindow* >( _rWindow.GetWindowPeer() );
     403           0 :         mpImpl->getContainerListeners().windowRemoved( aEvent );
     404             :     }
     405       75905 : }
     406             : 
     407     1329372 : IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent )
     408             : {
     409      664686 :     if ( mpImpl->mnListenerLockLevel )
     410        1566 :         return 0L;
     411             : 
     412             :     DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
     413      663120 :     if ( pEvent && pEvent->ISA( VclWindowEvent ) )
     414             :     {
     415             :         DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow() && GetWindow(), "Window???" );
     416      663120 :         ProcessWindowEvent( *(VclWindowEvent*)pEvent );
     417             :     }
     418      663120 :     return 0;
     419             : }
     420             : 
     421             : namespace
     422             : {
     423      145572 :     struct CallWindow2Listener
     424             :     {
     425       11176 :         CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent )
     426             :             :m_rWindow2Listeners( i_rWindow2Listeners )
     427             :             ,m_bEnabled( i_bEnabled )
     428       11176 :             ,m_aEvent( i_rEvent )
     429             :         {
     430       11176 :         }
     431             : 
     432         106 :         void operator()()
     433             :         {
     434         106 :             m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent );
     435         106 :         }
     436             : 
     437             :         ::cppu::OInterfaceContainerHelper&  m_rWindow2Listeners;
     438             :         const bool                          m_bEnabled;
     439             :         const EventObject                   m_aEvent;
     440             :     };
     441             : }
     442             : 
     443      662802 : void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
     444             : {
     445      662802 :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this );
     446             : 
     447      662802 :     switch ( rVclWindowEvent.GetId() )
     448             :     {
     449             :         case VCLEVENT_WINDOW_ENABLED:
     450             :         case VCLEVENT_WINDOW_DISABLED:
     451             :         {
     452             :             Callback aCallback = CallWindow2Listener(
     453       11176 :                 mpImpl->getWindow2Listeners(),
     454       11176 :                 ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ),
     455             :                 EventObject( *this )
     456       33528 :             );
     457       11176 :             ImplExecuteAsyncWithoutSolarLock( aCallback );
     458             :         }
     459       11176 :         break;
     460             : 
     461             :         case VCLEVENT_WINDOW_PAINT:
     462             :         {
     463        2236 :             if ( mpImpl->getPaintListeners().getLength() )
     464             :             {
     465           0 :                 ::com::sun::star::awt::PaintEvent aEvent;
     466           0 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     467           0 :                 aEvent.UpdateRect = AWTRectangle( *(Rectangle*)rVclWindowEvent.GetData() );
     468           0 :                 aEvent.Count = 0;
     469           0 :                 mpImpl->getPaintListeners().windowPaint( aEvent );
     470             :             }
     471             :         }
     472        2236 :         break;
     473             :         case VCLEVENT_WINDOW_MOVE:
     474             :         {
     475       62983 :             if ( mpImpl->getWindowListeners().getLength() )
     476             :             {
     477       11391 :                 ::com::sun::star::awt::WindowEvent aEvent;
     478       11391 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     479       11391 :                 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
     480       11391 :                 mpImpl->getWindowListeners().windowMoved( aEvent );
     481             :             }
     482             :         }
     483       62983 :         break;
     484             :         case VCLEVENT_WINDOW_RESIZE:
     485             :         {
     486       55682 :             if ( mpImpl->getWindowListeners().getLength() )
     487             :             {
     488       11996 :                 ::com::sun::star::awt::WindowEvent aEvent;
     489       11996 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     490       11996 :                 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
     491       11996 :                 mpImpl->getWindowListeners().windowResized( aEvent );
     492             :             }
     493             :         }
     494       55682 :         break;
     495             :         case VCLEVENT_WINDOW_SHOW:
     496             :         {
     497       33369 :             if ( mpImpl->getWindowListeners().getLength() )
     498             :             {
     499       12836 :                 ::com::sun::star::awt::WindowEvent aEvent;
     500       12836 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     501       12836 :                 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
     502       12836 :                 mpImpl->getWindowListeners().windowShown( aEvent );
     503             :             }
     504             : 
     505             :             // For TopWindows this means opened...
     506       33369 :             if ( mpImpl->getTopWindowListeners().getLength() )
     507             :             {
     508        4100 :                 ::com::sun::star::lang::EventObject aEvent;
     509        4100 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     510        4100 :                 mpImpl->getTopWindowListeners().windowOpened( aEvent );
     511             :             }
     512             :         }
     513       33369 :         break;
     514             :         case VCLEVENT_WINDOW_HIDE:
     515             :         {
     516       22531 :             if ( mpImpl->getWindowListeners().getLength() )
     517             :             {
     518        7129 :                 ::com::sun::star::awt::WindowEvent aEvent;
     519        7129 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     520        7129 :                 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
     521        7129 :                 mpImpl->getWindowListeners().windowHidden( aEvent );
     522             :             }
     523             : 
     524             :             // For TopWindows this means closed...
     525       22531 :             if ( mpImpl->getTopWindowListeners().getLength() )
     526             :             {
     527           5 :                 ::com::sun::star::lang::EventObject aEvent;
     528           5 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     529           5 :                 mpImpl->getTopWindowListeners().windowClosed( aEvent );
     530             :             }
     531             :         }
     532       22531 :         break;
     533             :         case VCLEVENT_WINDOW_ACTIVATE:
     534             :         {
     535        9721 :             if ( mpImpl->getTopWindowListeners().getLength() )
     536             :             {
     537        2528 :                 ::com::sun::star::lang::EventObject aEvent;
     538        2528 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     539        2528 :                 mpImpl->getTopWindowListeners().windowActivated( aEvent );
     540             :             }
     541             :         }
     542        9721 :         break;
     543             :         case VCLEVENT_WINDOW_DEACTIVATE:
     544             :         {
     545        4267 :             if ( mpImpl->getTopWindowListeners().getLength() )
     546             :             {
     547          89 :                 ::com::sun::star::lang::EventObject aEvent;
     548          89 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     549          89 :                 mpImpl->getTopWindowListeners().windowDeactivated( aEvent );
     550             :             }
     551             :         }
     552        4267 :         break;
     553             :         case VCLEVENT_WINDOW_CLOSE:
     554             :         {
     555           0 :             if ( mpImpl->getDockableWindowListeners().getLength() )
     556             :             {
     557           0 :                 ::com::sun::star::lang::EventObject aEvent;
     558           0 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     559           0 :                 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed, aEvent );
     560             :             }
     561           0 :             if ( mpImpl->getTopWindowListeners().getLength() )
     562             :             {
     563           0 :                 ::com::sun::star::lang::EventObject aEvent;
     564           0 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     565           0 :                 mpImpl->getTopWindowListeners().windowClosing( aEvent );
     566             :             }
     567             :         }
     568           0 :         break;
     569             :         case VCLEVENT_CONTROL_GETFOCUS:
     570             :         case VCLEVENT_WINDOW_GETFOCUS:
     571             :         {
     572       15528 :             if  (   (   rVclWindowEvent.GetWindow()->IsCompoundControl()
     573           6 :                     &&  rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS
     574             :                     )
     575       23284 :                 ||  (   !rVclWindowEvent.GetWindow()->IsCompoundControl()
     576        7758 :                     &&  rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS
     577             :                     )
     578             :                 )
     579             :             {
     580        7758 :                 if ( mpImpl->getFocusListeners().getLength() )
     581             :                 {
     582        1904 :                     ::com::sun::star::awt::FocusEvent aEvent;
     583        1904 :                     aEvent.Source = (::cppu::OWeakObject*)this;
     584        1904 :                     aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
     585        1904 :                     aEvent.Temporary = sal_False;
     586        1904 :                     mpImpl->getFocusListeners().focusGained( aEvent );
     587             :                 }
     588             :             }
     589             :         }
     590        7764 :         break;
     591             :         case VCLEVENT_CONTROL_LOSEFOCUS:
     592             :         case VCLEVENT_WINDOW_LOSEFOCUS:
     593             :         {
     594        8328 :             if  (   (   rVclWindowEvent.GetWindow()->IsCompoundControl()
     595           0 :                     &&  rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS
     596             :                     )
     597       12489 :                 ||  (   !rVclWindowEvent.GetWindow()->IsCompoundControl()
     598        4164 :                     &&  rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS
     599             :                     )
     600             :                 )
     601             :             {
     602        4161 :                 if ( mpImpl->getFocusListeners().getLength() )
     603             :                 {
     604         654 :                     ::com::sun::star::awt::FocusEvent aEvent;
     605         654 :                     aEvent.Source = (::cppu::OWeakObject*)this;
     606         654 :                     aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
     607         654 :                     aEvent.Temporary = sal_False;
     608             : 
     609         654 :                     Window* pNext = Application::GetFocusWindow();
     610         654 :                     if ( pNext )
     611             :                     {
     612             :                         // Don't care about internals if this control is compound
     613         653 :                         Window* pNextC = pNext;
     614        3270 :                         while ( pNextC && !pNextC->IsCompoundControl() )
     615        1964 :                             pNextC = pNextC->GetParent();
     616         653 :                         if ( pNextC )
     617           0 :                             pNext = pNextC;
     618             : 
     619         653 :                         pNext->GetComponentInterface( sal_True );
     620         653 :                         aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer();
     621             :                     }
     622         654 :                     mpImpl->getFocusListeners().focusLost( aEvent );
     623             :                 }
     624             :             }
     625             :         }
     626        4164 :         break;
     627             :         case VCLEVENT_WINDOW_MINIMIZE:
     628             :         {
     629          53 :             if ( mpImpl->getTopWindowListeners().getLength() )
     630             :             {
     631           1 :                 ::com::sun::star::lang::EventObject aEvent;
     632           1 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     633           1 :                 mpImpl->getTopWindowListeners().windowMinimized( aEvent );
     634             :             }
     635             :         }
     636          53 :         break;
     637             :         case VCLEVENT_WINDOW_NORMALIZE:
     638             :         {
     639          33 :             if ( mpImpl->getTopWindowListeners().getLength() )
     640             :             {
     641           1 :                 ::com::sun::star::lang::EventObject aEvent;
     642           1 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     643           1 :                 mpImpl->getTopWindowListeners().windowNormalized( aEvent );
     644             :             }
     645             :         }
     646          33 :         break;
     647             :         case VCLEVENT_WINDOW_KEYINPUT:
     648             :         {
     649           0 :             if ( mpImpl->getKeyListeners().getLength() )
     650             :             {
     651             :                 ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
     652           0 :                     *(KeyEvent*)rVclWindowEvent.GetData(), *this
     653           0 :                 ) );
     654           0 :                 mpImpl->getKeyListeners().keyPressed( aEvent );
     655             :             }
     656             :         }
     657           0 :         break;
     658             :         case VCLEVENT_WINDOW_KEYUP:
     659             :         {
     660           0 :             if ( mpImpl->getKeyListeners().getLength() )
     661             :             {
     662             :                 ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
     663           0 :                     *(KeyEvent*)rVclWindowEvent.GetData(), *this
     664           0 :                 ) );
     665           0 :                 mpImpl->getKeyListeners().keyReleased( aEvent );
     666             :             }
     667             :         }
     668           0 :         break;
     669             :         case VCLEVENT_WINDOW_COMMAND:
     670             :         {
     671           0 :             CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData();
     672           0 :             if ( mpImpl->getMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) )
     673             :             {
     674             :                 // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
     675           0 :                 Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel();
     676           0 :                 if ( !pCmdEvt->IsMouseEvent() )
     677             :                 {   // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
     678             :                     // handles a context menu command as special case of a mouse event, which is simply wrong.
     679             :                     // Without extending the API, we would not have another chance to notify listeners of a
     680             :                     // keyboard-triggered context menu request
     681           0 :                     aWhere = Point( -1, -1 );
     682             :                 }
     683             : 
     684           0 :                 MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
     685           0 :                 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) );
     686           0 :                 aEvent.PopupTrigger = sal_True;
     687             : 
     688             :                 Callback aCallback = ::boost::bind(
     689             :                     &MouseListenerMultiplexer::mousePressed,
     690           0 :                     &mpImpl->getMouseListeners(),
     691             :                     aEvent
     692           0 :                 );
     693           0 :                 ImplExecuteAsyncWithoutSolarLock( aCallback );
     694             :             }
     695             :         }
     696           0 :         break;
     697             :         case VCLEVENT_WINDOW_MOUSEMOVE:
     698             :         {
     699           0 :             MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData();
     700           0 :             if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
     701             :             {
     702           0 :                 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
     703             : 
     704             :                 Callback aCallback = ::boost::bind(
     705           0 :                     pMouseEvt->IsEnterWindow() ? &MouseListenerMultiplexer::mouseEntered : &MouseListenerMultiplexer::mouseExited,
     706           0 :                     &mpImpl->getMouseListeners(),
     707             :                     aEvent
     708           0 :                 );
     709           0 :                 ImplExecuteAsyncWithoutSolarLock( aCallback );
     710             :             }
     711             : 
     712           0 :             if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
     713             :             {
     714           0 :                 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
     715           0 :                 aEvent.ClickCount = 0;  // #92138#
     716           0 :                 if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE )
     717           0 :                     mpImpl->getMouseMotionListeners().mouseMoved( aEvent );
     718             :                 else
     719           0 :                     mpImpl->getMouseMotionListeners().mouseDragged( aEvent );
     720             :             }
     721             :         }
     722           0 :         break;
     723             :         case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
     724             :         {
     725           0 :             if ( mpImpl->getMouseListeners().getLength() )
     726             :             {
     727           0 :                 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
     728             :                 Callback aCallback = ::boost::bind(
     729             :                     &MouseListenerMultiplexer::mousePressed,
     730           0 :                     &mpImpl->getMouseListeners(),
     731             :                     aEvent
     732           0 :                 );
     733           0 :                 ImplExecuteAsyncWithoutSolarLock( aCallback );
     734             :             }
     735             :         }
     736           0 :         break;
     737             :         case VCLEVENT_WINDOW_MOUSEBUTTONUP:
     738             :         {
     739           0 :             if ( mpImpl->getMouseListeners().getLength() )
     740             :             {
     741           0 :                 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
     742             :                 Callback aCallback = ::boost::bind(
     743             :                     &MouseListenerMultiplexer::mouseReleased,
     744           0 :                     &mpImpl->getMouseListeners(),
     745             :                     aEvent
     746           0 :                 );
     747           0 :                 ImplExecuteAsyncWithoutSolarLock( aCallback );
     748             :             }
     749             :         }
     750           0 :         break;
     751             :         case VCLEVENT_WINDOW_STARTDOCKING:
     752             :         {
     753           0 :             if ( mpImpl->getDockableWindowListeners().getLength() )
     754             :             {
     755           0 :                 DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
     756             : 
     757           0 :                 if( pData )
     758             :                 {
     759           0 :                     ::com::sun::star::awt::DockingEvent aEvent;
     760           0 :                     aEvent.Source = (::cppu::OWeakObject*)this;
     761           0 :                     aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
     762           0 :                     aEvent.MousePos.X = pData->maMousePos.X();
     763           0 :                     aEvent.MousePos.Y = pData->maMousePos.Y();
     764           0 :                     aEvent.bLiveMode = pData->mbLivemode;
     765           0 :                     aEvent.bInteractive = pData->mbInteractive;
     766             : 
     767           0 :                     mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking, aEvent );
     768             :                 }
     769             :             }
     770             :         }
     771           0 :         break;
     772             :         case VCLEVENT_WINDOW_DOCKING:
     773             :         {
     774           0 :             if ( mpImpl->getDockableWindowListeners().getLength() )
     775             :             {
     776           0 :                 DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
     777             : 
     778           0 :                 if( pData )
     779             :                 {
     780           0 :                     ::com::sun::star::awt::DockingEvent aEvent;
     781           0 :                     aEvent.Source = (::cppu::OWeakObject*)this;
     782           0 :                     aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
     783           0 :                     aEvent.MousePos.X = pData->maMousePos.X();
     784           0 :                     aEvent.MousePos.Y = pData->maMousePos.Y();
     785           0 :                     aEvent.bLiveMode = pData->mbLivemode;
     786           0 :                     aEvent.bInteractive = pData->mbInteractive;
     787             : 
     788           0 :                     Reference< XDockableWindowListener > xFirstListener;
     789           0 :                     ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() );
     790           0 :                     while ( aIter.hasMoreElements() && !xFirstListener.is() )
     791             :                     {
     792           0 :                         xFirstListener.set( aIter.next(), UNO_QUERY );
     793             :                     }
     794             : 
     795             :                     ::com::sun::star::awt::DockingData aDockingData =
     796           0 :                         xFirstListener->docking( aEvent );
     797           0 :                     pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle );
     798           0 :                     pData->mbFloating = aDockingData.bFloating;
     799             :                 }
     800             :             }
     801             :         }
     802           0 :         break;
     803             :         case VCLEVENT_WINDOW_ENDDOCKING:
     804             :         {
     805           0 :             if ( mpImpl->getDockableWindowListeners().getLength() )
     806             :             {
     807           0 :                 EndDockingData *pData = (EndDockingData*)rVclWindowEvent.GetData();
     808             : 
     809           0 :                 if( pData )
     810             :                 {
     811           0 :                     ::com::sun::star::awt::EndDockingEvent aEvent;
     812           0 :                     aEvent.Source = (::cppu::OWeakObject*)this;
     813           0 :                     aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect );
     814           0 :                     aEvent.bFloating = pData->mbFloating;
     815           0 :                     aEvent.bCancelled = pData->mbCancelled;
     816           0 :                     mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent );
     817             :                 }
     818             :             }
     819             :         }
     820           0 :         break;
     821             :         case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING:
     822             :         {
     823           0 :             if ( mpImpl->getDockableWindowListeners().getLength() )
     824             :             {
     825           0 :                 sal_Bool *p_bFloating = (sal_Bool*)rVclWindowEvent.GetData();
     826             : 
     827           0 :                 ::com::sun::star::lang::EventObject aEvent;
     828           0 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     829             : 
     830           0 :                 Reference< XDockableWindowListener > xFirstListener;
     831           0 :                 ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() );
     832           0 :                 while ( aIter.hasMoreElements() && !xFirstListener.is() )
     833             :                 {
     834           0 :                     xFirstListener.set( aIter.next(), UNO_QUERY );
     835             :                 }
     836             : 
     837           0 :                 *p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent );
     838             :             }
     839             :         }
     840           0 :         break;
     841             :         case VCLEVENT_WINDOW_TOGGLEFLOATING:
     842             :         {
     843           0 :             if ( mpImpl->getDockableWindowListeners().getLength() )
     844             :             {
     845           0 :                 ::com::sun::star::lang::EventObject aEvent;
     846           0 :                 aEvent.Source = (::cppu::OWeakObject*)this;
     847           0 :                 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode, aEvent );
     848             :             }
     849             :        }
     850           0 :         break;
     851             :         case VCLEVENT_WINDOW_ENDPOPUPMODE:
     852             :         {
     853           0 :             if ( mpImpl->getDockableWindowListeners().getLength() )
     854             :             {
     855           0 :                 EndPopupModeData *pData = (EndPopupModeData*)rVclWindowEvent.GetData();
     856             : 
     857           0 :                 if( pData )
     858             :                 {
     859           0 :                     ::com::sun::star::awt::EndPopupModeEvent aEvent;
     860           0 :                     aEvent.Source = (::cppu::OWeakObject*)this;
     861           0 :                     aEvent.FloatingPosition.X = pData->maFloatingPos.X();
     862           0 :                     aEvent.FloatingPosition.Y = pData->maFloatingPos.Y();
     863           0 :                     aEvent.bTearoff = pData->mbTearoff;
     864           0 :                     mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode, aEvent );
     865             :                 }
     866             :             }
     867             :         }
     868           0 :         break;
     869             : 
     870      662802 :     }
     871      662802 : }
     872             : 
     873         163 : uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext()
     874             : {
     875         163 :     SolarMutexGuard aGuard;
     876         163 :     return getAccessibleFactory().createAccessibleContext( this );
     877             : }
     878             : 
     879         852 : void VCLXWindow::SetSynthesizingVCLEvent( bool _b )
     880             : {
     881         852 :     mpImpl->mbSynthesizingVCLEvent = _b;
     882         852 : }
     883             : 
     884          87 : bool VCLXWindow::IsSynthesizingVCLEvent() const
     885             : {
     886          87 :     return mpImpl->mbSynthesizingVCLEvent;
     887             : }
     888             : 
     889           9 : Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const
     890             : {
     891           9 :     Size aSz = rOutSz;
     892             : 
     893           9 :     Window* pWindow = GetWindow();
     894           9 :     if ( pWindow )
     895             :     {
     896             :         sal_Int32 nLeft, nTop, nRight, nBottom;
     897           9 :         pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
     898           9 :         aSz.Width() += nLeft+nRight;
     899           9 :         aSz.Height() += nTop+nBottom;
     900             :     }
     901           9 :     return aSz;
     902             : }
     903             : 
     904             : 
     905             : // ::com::sun::star::lang::XUnoTunnel
     906     1612962 : IMPL_XUNOTUNNEL2( VCLXWindow, VCLXDevice )
     907             : 
     908             : // ::com::sun::star::lang::Component
     909       69978 : void VCLXWindow::dispose(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     910             : {
     911       69978 :     SolarMutexGuard aGuard;
     912             : 
     913       69978 :     mpImpl->mxViewGraphics = NULL;
     914             : 
     915       69978 :     if ( !mpImpl->mbDisposing )
     916             :     {
     917       42819 :         mpImpl->mbDisposing = true;
     918             : 
     919       42819 :         mpImpl->disposing();
     920             : 
     921       42819 :         if ( GetWindow() )
     922             :         {
     923       27098 :             OutputDevice* pOutDev = GetOutputDevice();
     924       27098 :             SetWindow( NULL );  // so that handlers are logged off, if necessary (virtual)
     925       27098 :             SetOutputDevice( pOutDev );
     926       27098 :             DestroyOutputDevice();
     927             :         }
     928             : 
     929             :         // #i14103# dispose the accessible context after the window has been destroyed,
     930             :         // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
     931             :         // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object
     932             :         try
     933             :         {
     934       42819 :             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY );
     935       42819 :             if ( xComponent.is() )
     936         211 :                 xComponent->dispose();
     937             :         }
     938           0 :         catch ( const ::com::sun::star::uno::Exception& )
     939             :         {
     940             :             OSL_FAIL( "VCLXWindow::dispose: could not dispose the accessible context!" );
     941             :         }
     942       42819 :         mpImpl->mxAccessibleContext.clear();
     943             : 
     944       42819 :         mpImpl->mbDisposing = false;
     945       69978 :     }
     946       69978 : }
     947             : 
     948          96 : void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     949             : {
     950          96 :     SolarMutexGuard aGuard;
     951             : 
     952          96 :     mpImpl->getEventListeners().addInterface( rxListener );
     953          96 : }
     954             : 
     955          25 : void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     956             : {
     957          25 :     SolarMutexGuard aGuard;
     958             : 
     959          25 :     mpImpl->getEventListeners().removeInterface( rxListener );
     960          25 : }
     961             : 
     962             : 
     963             : // ::com::sun::star::awt::XWindow
     964       74183 : void VCLXWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     965             : {
     966       74183 :     SolarMutexGuard aGuard;
     967             : 
     968       74183 :     if ( GetWindow() )
     969             :     {
     970       74183 :         if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
     971        6103 :             Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X, Y, Width, Height, Flags );
     972             :         else
     973       68080 :             GetWindow()->setPosSizePixel( X, Y, Width, Height, Flags );
     974       74183 :     }
     975       74183 : }
     976             : 
     977      116996 : ::com::sun::star::awt::Rectangle VCLXWindow::getPosSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     978             : {
     979      116996 :     SolarMutexGuard aGuard;
     980             : 
     981      116996 :     ::com::sun::star::awt::Rectangle aBounds;
     982      116996 :     if ( GetWindow() )
     983             :     {
     984      116996 :         if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
     985       14352 :             aBounds = AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
     986             :         else
     987      102644 :             aBounds = AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
     988             :     }
     989             : 
     990      116996 :     return aBounds;
     991             : }
     992             : 
     993       29816 : void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     994             : {
     995       29816 :     SolarMutexGuard aGuard;
     996             : 
     997       29816 :     Window* pWindow = GetWindow();
     998       29816 :     if ( pWindow )
     999             :     {
    1000       29815 :         mpImpl->setDirectVisible( bVisible );
    1001       29815 :         pWindow->Show( bVisible &&  mpImpl->isEnableVisible() );
    1002       29816 :     }
    1003       29816 : }
    1004             : 
    1005         545 : void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1006             : {
    1007         545 :     SolarMutexGuard aGuard;
    1008             : 
    1009         545 :     Window* pWindow = GetWindow();
    1010         545 :     if ( pWindow )
    1011             :     {
    1012         545 :         pWindow->Enable( bEnable, false ); // #95824# without children!
    1013         545 :         pWindow->EnableInput( bEnable );
    1014         545 :     }
    1015         545 : }
    1016             : 
    1017        1970 : void VCLXWindow::setFocus(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1018             : {
    1019        1970 :     SolarMutexGuard aGuard;
    1020             : 
    1021        1970 :     if ( GetWindow() )
    1022        1970 :         GetWindow()->GrabFocus();
    1023        1970 : }
    1024             : 
    1025       15350 : void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1026             : {
    1027       15350 :     SolarMutexGuard aGuard;
    1028             : 
    1029       15350 :     mpImpl->getWindowListeners().addInterface( rxListener );
    1030             : 
    1031       30700 :     Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
    1032       15350 :     if ( xListener2.is() )
    1033         353 :         mpImpl->getWindow2Listeners().addInterface( xListener2 );
    1034             : 
    1035             :     // #100119# Get all resize events, even if height or width 0, or invisible
    1036       15350 :     if ( GetWindow() )
    1037       30700 :         GetWindow()->EnableAllResize( true );
    1038       15350 : }
    1039             : 
    1040        8992 : void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1041             : {
    1042        8992 :     SolarMutexGuard aGuard;
    1043             : 
    1044       17984 :     Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
    1045        8992 :     if ( xListener2.is() )
    1046         353 :         mpImpl->getWindow2Listeners().removeInterface( xListener2 );
    1047             : 
    1048       17984 :     mpImpl->getWindowListeners().removeInterface( rxListener );
    1049        8992 : }
    1050             : 
    1051        6375 : void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1052             : {
    1053        6375 :     SolarMutexGuard aGuard;
    1054        6375 :     mpImpl->getFocusListeners().addInterface( rxListener );
    1055        6375 : }
    1056             : 
    1057        6256 : void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1058             : {
    1059        6256 :     SolarMutexGuard aGuard;
    1060        6256 :     mpImpl->getFocusListeners().removeInterface( rxListener );
    1061        6256 : }
    1062             : 
    1063          93 : void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1064             : {
    1065          93 :     SolarMutexGuard aGuard;
    1066          93 :     mpImpl->getKeyListeners().addInterface( rxListener );
    1067          93 : }
    1068             : 
    1069           2 : void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1070             : {
    1071           2 :     SolarMutexGuard aGuard;
    1072           2 :     mpImpl->getKeyListeners().removeInterface( rxListener );
    1073           2 : }
    1074             : 
    1075          59 : void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1076             : {
    1077          59 :     SolarMutexGuard aGuard;
    1078          59 :     mpImpl->getMouseListeners().addInterface( rxListener );
    1079          59 : }
    1080             : 
    1081          41 : void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1082             : {
    1083          41 :     SolarMutexGuard aGuard;
    1084          41 :     mpImpl->getMouseListeners().removeInterface( rxListener );
    1085          41 : }
    1086             : 
    1087           9 : void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1088             : {
    1089           9 :     SolarMutexGuard aGuard;
    1090           9 :     mpImpl->getMouseMotionListeners().addInterface( rxListener );
    1091           9 : }
    1092             : 
    1093           1 : void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1094             : {
    1095           1 :     SolarMutexGuard aGuard;
    1096           1 :     mpImpl->getMouseMotionListeners().removeInterface( rxListener );
    1097           1 : }
    1098             : 
    1099           0 : void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1100             : {
    1101           0 :     SolarMutexGuard aGuard;
    1102           0 :     mpImpl->getPaintListeners().addInterface( rxListener );
    1103           0 : }
    1104             : 
    1105           0 : void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1106             : {
    1107           0 :     SolarMutexGuard aGuard;
    1108           0 :     mpImpl->getPaintListeners().removeInterface( rxListener );
    1109           0 : }
    1110             : 
    1111             : // ::com::sun::star::awt::XWindowPeer
    1112         341 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > VCLXWindow::getToolkit(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1113             : {
    1114             :     // no guard. nothing to guard here.
    1115             :     // 82463 - 12/21/00 - fs
    1116         341 :     return Application::GetVCLToolkit();
    1117             : }
    1118             : 
    1119           0 : void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& rxPointer ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1120             : {
    1121           0 :     SolarMutexGuard aGuard;
    1122             : 
    1123           0 :     VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer );
    1124           0 :     if ( pPointer )
    1125             :     {
    1126           0 :         mpImpl->mxPointer = rxPointer;
    1127           0 :         if ( GetWindow() )
    1128           0 :             GetWindow()->SetPointer( pPointer->GetPointer() );
    1129           0 :     }
    1130           0 : }
    1131             : 
    1132        2073 : void VCLXWindow::setBackground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1133             : {
    1134        2073 :     SolarMutexGuard aGuard;
    1135             : 
    1136        2073 :     if ( GetWindow() )
    1137             :     {
    1138        2073 :         Color aColor( (sal_uInt32)nColor );
    1139        2073 :         GetWindow()->SetBackground( aColor );
    1140        2073 :         GetWindow()->SetControlBackground( aColor );
    1141             : 
    1142        2073 :         WindowType eWinType = GetWindow()->GetType();
    1143        2073 :         if ( ( eWinType == WINDOW_WINDOW ) ||
    1144           0 :              ( eWinType == WINDOW_WORKWINDOW ) ||
    1145             :              ( eWinType == WINDOW_FLOATINGWINDOW ) )
    1146             :         {
    1147        2073 :             GetWindow()->Invalidate();
    1148             :         }
    1149        2073 :     }
    1150        2073 : }
    1151             : 
    1152           0 : void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1153             : {
    1154           0 :     SolarMutexGuard aGuard;
    1155             : 
    1156           0 :     if ( GetWindow() )
    1157           0 :         GetWindow()->Invalidate( (sal_uInt16) nInvalidateFlags );
    1158           0 : }
    1159             : 
    1160           0 : void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle& rRect, sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1161             : {
    1162           0 :     SolarMutexGuard aGuard;
    1163             : 
    1164           0 :     if ( GetWindow() )
    1165           0 :         GetWindow()->Invalidate( VCLRectangle(rRect), (sal_uInt16) nInvalidateFlags );
    1166           0 : }
    1167             : 
    1168             : 
    1169             : // ::com::sun::star::awt::XVclWindowPeer
    1170           0 : sal_Bool VCLXWindow::isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxPeer ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1171             : {
    1172           0 :     SolarMutexGuard aGuard;
    1173             : 
    1174           0 :     bool bIsChild = false;
    1175           0 :     Window* pWindow = GetWindow();
    1176           0 :     if ( pWindow )
    1177             :     {
    1178           0 :         Window* pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
    1179           0 :         bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow );
    1180             :     }
    1181             : 
    1182           0 :     return bIsChild;
    1183             : }
    1184             : 
    1185        2820 : void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1186             : {
    1187        2820 :     SolarMutexGuard aGuard;
    1188             : 
    1189        2820 :     mpImpl->mbDesignMode = bOn;
    1190        2820 : }
    1191             : 
    1192        9079 : sal_Bool VCLXWindow::isDesignMode(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1193             : {
    1194        9079 :     SolarMutexGuard aGuard;
    1195        9079 :     return mpImpl->mbDesignMode;
    1196             : }
    1197             : 
    1198           0 : void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1199             : {
    1200           0 :     SolarMutexGuard aGuard;
    1201             : 
    1202           0 :     if ( GetWindow() )
    1203           0 :         GetWindow()->EnableClipSiblings( bClip );
    1204           0 : }
    1205             : 
    1206           0 : void VCLXWindow::setForeground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1207             : {
    1208           0 :     SolarMutexGuard aGuard;
    1209             : 
    1210           0 :     if ( GetWindow() )
    1211             :     {
    1212           0 :         Color aColor( (sal_uInt32)nColor );
    1213           0 :         GetWindow()->SetControlForeground( aColor );
    1214           0 :     }
    1215           0 : }
    1216             : 
    1217           0 : void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor& rFont ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1218             : {
    1219           0 :     SolarMutexGuard aGuard;
    1220             : 
    1221           0 :     if ( GetWindow() )
    1222           0 :         GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont, GetWindow()->GetControlFont() ) );
    1223           0 : }
    1224             : 
    1225           0 : void VCLXWindow::getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1226             : {
    1227           0 :     SolarMutexGuard aGuard;
    1228             : 
    1229           0 :     if ( GetWindow() )
    1230             :     {
    1231           0 :         const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
    1232             : 
    1233           0 :         switch ( nType )
    1234             :         {
    1235             :             case ::com::sun::star::awt::Style::FRAME:
    1236             :             {
    1237           0 :                 Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
    1238           0 :                 ForegroundColor = rStyleSettings.GetWindowTextColor().GetColor();
    1239           0 :                 BackgroundColor = rStyleSettings.GetWindowColor().GetColor();
    1240             :             }
    1241           0 :             break;
    1242             :             case ::com::sun::star::awt::Style::DIALOG:
    1243             :             {
    1244           0 :                 Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
    1245           0 :                 ForegroundColor = rStyleSettings.GetDialogTextColor().GetColor();
    1246           0 :                 BackgroundColor = rStyleSettings.GetDialogColor().GetColor();
    1247             :             }
    1248           0 :             break;
    1249             :             default: OSL_FAIL( "VCLWindow::getStyles() - unknown Type" );
    1250             :         }
    1251             : 
    1252           0 :     }
    1253           0 : }
    1254             : 
    1255             : namespace toolkit
    1256             : {
    1257         255 :     static void setColorSettings( Window* _pWindow, const ::com::sun::star::uno::Any& _rValue,
    1258             :         void (StyleSettings::*pSetter)( const Color& ), const Color& (StyleSettings::*pGetter)( ) const )
    1259             :     {
    1260         255 :         sal_Int32 nColor = 0;
    1261         255 :         if ( !( _rValue >>= nColor ) )
    1262         251 :             nColor = (Application::GetSettings().GetStyleSettings().*pGetter)().GetColor();
    1263             : 
    1264         255 :         AllSettings aSettings = _pWindow->GetSettings();
    1265         510 :         StyleSettings aStyleSettings = aSettings.GetStyleSettings();
    1266             : 
    1267         255 :         (aStyleSettings.*pSetter)( Color( nColor ) );
    1268             : 
    1269         255 :         aSettings.SetStyleSettings( aStyleSettings );
    1270         510 :         _pWindow->SetSettings( aSettings, true );
    1271         255 :     }
    1272             : }
    1273             : 
    1274             : // Terminated by BASEPROPERTY_NOTFOUND (or 0)
    1275         352 : void VCLXWindow::PushPropertyIds( std::list< sal_uInt16 > &rIds,
    1276             :                                   int nFirstId, ...)
    1277             : {
    1278             :     va_list pVarArgs;
    1279         352 :     va_start( pVarArgs, nFirstId );
    1280             : 
    1281        8712 :     for ( int nId = nFirstId; nId != BASEPROPERTY_NOTFOUND;
    1282        8360 :           nId = va_arg( pVarArgs, int ) )
    1283        8360 :         rIds.push_back( (sal_uInt16) nId );
    1284             : 
    1285         352 :     va_end( pVarArgs );
    1286         352 : }
    1287             : 
    1288         352 : void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDefaults )
    1289             : {
    1290             :     // These are common across ~all VCLXWindow derived classes
    1291         352 :     if( bWithDefaults )
    1292             :         PushPropertyIds( rIds,
    1293             :                          BASEPROPERTY_ALIGN,
    1294             :                          BASEPROPERTY_BACKGROUNDCOLOR,
    1295             :                          BASEPROPERTY_BORDER,
    1296             :                          BASEPROPERTY_BORDERCOLOR,
    1297             :                          BASEPROPERTY_DEFAULTCONTROL,
    1298             :                          BASEPROPERTY_ENABLED,
    1299             :                          BASEPROPERTY_FONTDESCRIPTOR,
    1300             :                          BASEPROPERTY_HELPTEXT,
    1301             :                          BASEPROPERTY_HELPURL,
    1302             :                          BASEPROPERTY_TEXT,
    1303             :                          BASEPROPERTY_PRINTABLE,
    1304             :                          BASEPROPERTY_ENABLEVISIBLE, // for visibility
    1305             :                          BASEPROPERTY_TABSTOP,
    1306           0 :                          0);
    1307             : 
    1308             :     // lovely hack from:
    1309             :     // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
    1310         352 :     std::list< sal_uInt16 >::const_iterator iter;
    1311        3171 :     for( iter = rIds.begin(); iter != rIds.end(); ++iter) {
    1312        3137 :         if( *iter == BASEPROPERTY_FONTDESCRIPTOR )
    1313             :         {
    1314             :             // some properties are not included in the FontDescriptor, but everytime
    1315             :             // when we have a FontDescriptor we want to have these properties too.
    1316             :             // => Easier to register the here, istead everywhere where I register the FontDescriptor...
    1317             : 
    1318         318 :             rIds.push_back( BASEPROPERTY_TEXTCOLOR );
    1319         318 :             rIds.push_back( BASEPROPERTY_TEXTLINECOLOR );
    1320         318 :             rIds.push_back( BASEPROPERTY_FONTRELIEF );
    1321         318 :             rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK );
    1322         318 :             break;
    1323             :         }
    1324             :     }
    1325         352 : }
    1326             : 
    1327           0 : void VCLXWindow::GetPropertyIds( std::list< sal_uInt16 >& _out_rIds )
    1328             : {
    1329           0 :     return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps );
    1330             : }
    1331             : 
    1332           0 : ::cppu::OInterfaceContainerHelper& VCLXWindow::GetContainerListeners()
    1333             : {
    1334           0 :     return mpImpl->getContainerListeners();
    1335             : }
    1336             : 
    1337       12499 : ::cppu::OInterfaceContainerHelper& VCLXWindow::GetTopWindowListeners()
    1338             : {
    1339       12499 :     return mpImpl->getTopWindowListeners();
    1340             : }
    1341             : 
    1342             : namespace
    1343             : {
    1344         880 :     void    lcl_updateWritingMode( Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode )
    1345             :     {
    1346         880 :         bool bEnableRTL = false;
    1347         880 :         switch ( _nWritingMode )
    1348             :         {
    1349           2 :         case WritingMode2::LR_TB:   bEnableRTL = false; break;
    1350           0 :         case WritingMode2::RL_TB:   bEnableRTL = true; break;
    1351             :         case WritingMode2::CONTEXT:
    1352             :         {
    1353             :             // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use
    1354             :             // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our
    1355             :             // own window for its RTL mode
    1356         658 :             switch ( _nContextWritingMode )
    1357             :             {
    1358         380 :                 case WritingMode2::LR_TB:   bEnableRTL = false; break;
    1359          87 :                 case WritingMode2::RL_TB:   bEnableRTL = true; break;
    1360             :                 case WritingMode2::CONTEXT:
    1361             :                 {
    1362         127 :                     const Window* pParent = _rWindow.GetParent();
    1363             :                     OSL_ENSURE( pParent, "lcl_updateWritingMode: cannot determine context's writing mode!" );
    1364         127 :                     if ( pParent )
    1365         127 :                         bEnableRTL = pParent->IsRTLEnabled();
    1366             :                 }
    1367         127 :                 break;
    1368             :             }
    1369             :         }
    1370         658 :         break;
    1371             :         default:
    1372             :             OSL_FAIL( "lcl_updateWritingMode: unsupported WritingMode!" );
    1373             :         }   // switch ( nWritingMode )
    1374             : 
    1375         880 :         _rWindow.EnableRTL( bEnableRTL );
    1376         880 :     }
    1377             : }
    1378             : 
    1379       28342 : void VCLXWindow::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value )
    1380             :     throw(::com::sun::star::uno::RuntimeException,
    1381             :           std::exception)
    1382             : {
    1383       28342 :     SolarMutexGuard aGuard;
    1384             : 
    1385       28342 :     Window* pWindow = GetWindow();
    1386       28342 :     if ( !pWindow )
    1387       28342 :         return;
    1388             : 
    1389       28342 :     bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
    1390             : 
    1391       28342 :     WindowType eWinType = pWindow->GetType();
    1392       28342 :     sal_uInt16 nPropType = GetPropertyId( PropertyName );
    1393       28342 :     switch ( nPropType )
    1394             :     {
    1395             :         case BASEPROPERTY_REFERENCE_DEVICE:
    1396             :         {
    1397         219 :             Control* pControl = dynamic_cast< Control* >( pWindow );
    1398             :             OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
    1399         219 :             if ( !pControl )
    1400           0 :                 break;
    1401         219 :             Reference< XDevice > xDevice( Value, UNO_QUERY );
    1402         219 :             OutputDevice* pDevice = VCLUnoHelper::GetOutputDevice( xDevice );
    1403         219 :             pControl->SetReferenceDevice( pDevice );
    1404             :         }
    1405         219 :         break;
    1406             : 
    1407             :         case BASEPROPERTY_CONTEXT_WRITING_MODE:
    1408             :         {
    1409         477 :             OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode );
    1410         477 :             if ( mpImpl->mnWritingMode == WritingMode2::CONTEXT )
    1411         398 :                 lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
    1412             :         }
    1413         477 :         break;
    1414             : 
    1415             :         case BASEPROPERTY_WRITING_MODE:
    1416             :         {
    1417         482 :             bool bProperType = ( Value >>= mpImpl->mnWritingMode );
    1418             :             OSL_ENSURE( bProperType, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" );
    1419         482 :             if ( bProperType )
    1420         482 :                 lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
    1421             :         }
    1422         482 :         break;
    1423             : 
    1424             :         case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:
    1425             :         {
    1426         182 :             sal_uInt16 nWheelBehavior( MouseWheelBehavior::SCROLL_FOCUS_ONLY );
    1427         182 :             OSL_VERIFY( Value >>= nWheelBehavior );
    1428             : 
    1429         182 :             AllSettings aSettings = pWindow->GetSettings();
    1430         364 :             MouseSettings aMouseSettings = aSettings.GetMouseSettings();
    1431             : 
    1432         182 :             sal_uInt16 nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY );
    1433         182 :             switch ( nWheelBehavior )
    1434             :             {
    1435           0 :             case MouseWheelBehavior::SCROLL_DISABLED:   nVclBehavior = MOUSE_WHEEL_DISABLE;     break;
    1436          73 :             case MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclBehavior = MOUSE_WHEEL_FOCUS_ONLY;  break;
    1437          35 :             case MouseWheelBehavior::SCROLL_ALWAYS:     nVclBehavior = MOUSE_WHEEL_ALWAYS;      break;
    1438             :             default:
    1439             :                 OSL_FAIL( "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" );
    1440             :             }
    1441             : 
    1442         182 :             aMouseSettings.SetWheelBehavior( nVclBehavior );
    1443         182 :             aSettings.SetMouseSettings( aMouseSettings );
    1444         364 :             pWindow->SetSettings( aSettings, true );
    1445             :         }
    1446         182 :         break;
    1447             : 
    1448             :         case BASEPROPERTY_NATIVE_WIDGET_LOOK:
    1449             :         {
    1450         463 :             bool bEnable( true );
    1451         463 :             OSL_VERIFY( Value >>= bEnable );
    1452         463 :             pWindow->EnableNativeWidget( bEnable );
    1453             :         }
    1454         463 :         break;
    1455             : 
    1456             :         case BASEPROPERTY_PLUGINPARENT:
    1457             :         {
    1458             :             // set parent handle
    1459           0 :             SetSystemParent_Impl( Value );
    1460             :         }
    1461           0 :         break;
    1462             : 
    1463             :         case BASEPROPERTY_ENABLED:
    1464             :         {
    1465         463 :             bool b = bool();
    1466         463 :             if ( Value >>= b )
    1467         463 :                 setEnable( b );
    1468             :         }
    1469         463 :         break;
    1470             :         case BASEPROPERTY_ENABLEVISIBLE:
    1471             :         {
    1472         475 :             bool b = false;
    1473         475 :             if ( Value >>= b )
    1474             :             {
    1475         475 :                 if( b != mpImpl->isEnableVisible() )
    1476             :                 {
    1477         173 :                     mpImpl->setEnableVisible( b );
    1478         173 :                     pWindow->Show( b && mpImpl->isDirectVisible() );
    1479             :                 }
    1480             :             }
    1481             :         }
    1482         475 :         break;
    1483             :         case BASEPROPERTY_TEXT:
    1484             :         case BASEPROPERTY_LABEL:
    1485             :         case BASEPROPERTY_TITLE:
    1486             :         {
    1487         165 :             OUString aText;
    1488         165 :             if ( Value >>= aText )
    1489             :             {
    1490         165 :                 switch (eWinType)
    1491             :                 {
    1492             :                     case WINDOW_OKBUTTON:
    1493             :                     case WINDOW_CANCELBUTTON:
    1494             :                     case WINDOW_HELPBUTTON:
    1495             :                         // Standard Button: overwrite only if not empty.
    1496           0 :                         if (!aText.isEmpty())
    1497           0 :                             pWindow->SetText( aText );
    1498           0 :                         break;
    1499             : 
    1500             :                     default:
    1501         165 :                         pWindow->SetText( aText );
    1502         165 :                         break;
    1503             :                 }
    1504         165 :             }
    1505             :         }
    1506         165 :         break;
    1507             :         case BASEPROPERTY_ACCESSIBLENAME:
    1508             :         {
    1509           0 :             OUString aText;
    1510           0 :             if ( Value >>= aText )
    1511           0 :                 pWindow->SetAccessibleName( aText );
    1512             :         }
    1513           0 :         break;
    1514             :         case BASEPROPERTY_HELPURL:
    1515             :         {
    1516         410 :             OUString aURL;
    1517         410 :             if ( Value >>= aURL )
    1518             :             {
    1519         410 :                 INetURLObject aHelpURL( aURL );
    1520         410 :                 if ( aHelpURL.GetProtocol() == INET_PROT_HID )
    1521           0 :                     pWindow->SetHelpId( OUStringToOString( aHelpURL.GetURLPath(), RTL_TEXTENCODING_UTF8 ) );
    1522             :                 else
    1523         410 :                     pWindow->SetHelpId( OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ) );
    1524         410 :             }
    1525             :         }
    1526         410 :         break;
    1527             :         case BASEPROPERTY_HELPTEXT:
    1528             :         {
    1529         504 :             OUString aHelpText;
    1530         504 :             if ( Value >>= aHelpText )
    1531             :             {
    1532         504 :                 pWindow->SetQuickHelpText( aHelpText );
    1533         504 :             }
    1534             :         }
    1535         504 :         break;
    1536             :         case BASEPROPERTY_FONTDESCRIPTOR:
    1537             :         {
    1538        1406 :             if ( bVoid )
    1539           0 :                 pWindow->SetControlFont( Font() );
    1540             :             else
    1541             :             {
    1542        1406 :                 ::com::sun::star::awt::FontDescriptor aFont;
    1543        1406 :                 if ( Value >>= aFont )
    1544        1406 :                     pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) );
    1545             :             }
    1546             :         }
    1547        1406 :         break;
    1548             :         case BASEPROPERTY_FONTRELIEF:
    1549             :         {
    1550         394 :             sal_Int16 n = sal_Int16();
    1551         394 :             if ( Value >>= n )
    1552             :             {
    1553         394 :                 Font aFont = pWindow->GetControlFont();
    1554         394 :                 aFont.SetRelief( (FontRelief)n );
    1555         394 :                 pWindow->SetControlFont( aFont );
    1556             :             }
    1557             :         }
    1558         394 :         break;
    1559             :         case BASEPROPERTY_FONTEMPHASISMARK:
    1560             :         {
    1561         395 :             sal_Int16 n = sal_Int16();
    1562         395 :             if ( Value >>= n )
    1563             :             {
    1564         395 :                 Font aFont = pWindow->GetControlFont();
    1565         395 :                 aFont.SetEmphasisMark( n );
    1566         395 :                 pWindow->SetControlFont( aFont );
    1567             :             }
    1568             :         }
    1569         395 :         break;
    1570             :         case BASEPROPERTY_BACKGROUNDCOLOR:
    1571         305 :             if ( bVoid )
    1572             :             {
    1573         269 :                 switch ( eWinType )
    1574             :                 {
    1575             :                     // set dialog color for default
    1576             :                     case WINDOW_DIALOG:
    1577             :                     case WINDOW_MESSBOX:
    1578             :                     case WINDOW_INFOBOX:
    1579             :                     case WINDOW_WARNINGBOX:
    1580             :                     case WINDOW_ERRORBOX:
    1581             :                     case WINDOW_QUERYBOX:
    1582             :                     case WINDOW_TABPAGE:
    1583             :                     {
    1584           2 :                         Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor();
    1585           2 :                         pWindow->SetBackground( aColor );
    1586           2 :                         pWindow->SetControlBackground( aColor );
    1587           2 :                         break;
    1588             :                     }
    1589             : 
    1590             :                     case WINDOW_FIXEDTEXT:
    1591             :                     case WINDOW_CHECKBOX:
    1592             :                     case WINDOW_RADIOBUTTON:
    1593             :                     case WINDOW_GROUPBOX:
    1594             :                     case WINDOW_FIXEDLINE:
    1595             :                     {
    1596             :                         // support transparency only for special controls
    1597          36 :                         pWindow->SetBackground();
    1598          36 :                         pWindow->SetControlBackground();
    1599          36 :                         pWindow->SetPaintTransparent( true );
    1600          36 :                         break;
    1601             :                     }
    1602             : 
    1603             :                     default:
    1604             :                     {
    1605             :                         // default code which enables transparency for
    1606             :                         // compound controls. It's not real transparency
    1607             :                         // as most of these controls repaint their client
    1608             :                         // area completely new.
    1609         231 :                         if ( pWindow->IsCompoundControl() )
    1610          82 :                             pWindow->SetBackground();
    1611         231 :                         pWindow->SetControlBackground();
    1612         231 :                         break;
    1613             :                     }
    1614             :                 }
    1615             :             }
    1616             :             else
    1617             :             {
    1618          36 :                 sal_Int32 nColor = 0;
    1619          36 :                 if ( Value >>= nColor )
    1620             :                 {
    1621          36 :                     Color aColor( nColor );
    1622          36 :                     pWindow->SetControlBackground( aColor );
    1623          36 :                     pWindow->SetBackground( aColor );
    1624          36 :                     switch ( eWinType )
    1625             :                     {
    1626             :                         // reset paint transparent mode
    1627             :                         case WINDOW_FIXEDTEXT:
    1628             :                         case WINDOW_CHECKBOX:
    1629             :                         case WINDOW_RADIOBUTTON:
    1630             :                         case WINDOW_GROUPBOX:
    1631             :                         case WINDOW_FIXEDLINE:
    1632           4 :                             pWindow->SetPaintTransparent( false );
    1633             :                         default: ;
    1634             :                     }
    1635          36 :                     pWindow->Invalidate();  // Invalidate if control does not respond to it
    1636             :                 }
    1637             :             }
    1638         305 :         break;
    1639             :         case BASEPROPERTY_TEXTCOLOR:
    1640         344 :             if ( bVoid )
    1641             :             {
    1642         309 :                 pWindow->SetControlForeground();
    1643             :             }
    1644             :             else
    1645             :             {
    1646          35 :                 sal_Int32 nColor = 0;
    1647          35 :                 if ( Value >>= nColor )
    1648             :                 {
    1649          35 :                     Color aColor( nColor );
    1650          35 :                     pWindow->SetTextColor( aColor );
    1651          35 :                     pWindow->SetControlForeground( aColor );
    1652             :                 }
    1653             :             }
    1654         344 :         break;
    1655             :         case BASEPROPERTY_TEXTLINECOLOR:
    1656         326 :             if ( bVoid )
    1657             :             {
    1658         326 :                 pWindow->SetTextLineColor();
    1659             :             }
    1660             :             else
    1661             :             {
    1662           0 :                 sal_Int32 nColor = 0;
    1663           0 :                 if ( Value >>= nColor )
    1664             :                 {
    1665           0 :                     Color aColor( nColor );
    1666           0 :                     pWindow->SetTextLineColor( aColor );
    1667             :                 }
    1668             :             }
    1669         326 :         break;
    1670             :         case BASEPROPERTY_FILLCOLOR:
    1671           1 :             if ( bVoid )
    1672           1 :                 pWindow->SetFillColor();
    1673             :             else
    1674             :             {
    1675           0 :                 sal_Int32 nColor = 0;
    1676           0 :                 if ( Value >>= nColor )
    1677             :                 {
    1678           0 :                     Color aColor( nColor );
    1679           0 :                     pWindow->SetFillColor( aColor );
    1680             :                 }
    1681             :             }
    1682           1 :         break;
    1683             :         case BASEPROPERTY_LINECOLOR:
    1684           0 :             if ( bVoid )
    1685           0 :                 pWindow->SetLineColor();
    1686             :             else
    1687             :             {
    1688           0 :                 sal_Int32 nColor = 0;
    1689           0 :                 if ( Value >>= nColor )
    1690             :                 {
    1691           0 :                     Color aColor( nColor );
    1692           0 :                     pWindow->SetLineColor( aColor );
    1693             :                 }
    1694             :             }
    1695           0 :         break;
    1696             :         case BASEPROPERTY_BORDER:
    1697             :         {
    1698         271 :             WinBits nStyle = pWindow->GetStyle();
    1699         271 :             sal_uInt16 nBorder = 0;
    1700         271 :             Value >>= nBorder;
    1701         271 :             if ( !nBorder )
    1702             :             {
    1703          12 :                 pWindow->SetStyle( nStyle & ~WB_BORDER );
    1704             :             }
    1705             :             else
    1706             :             {
    1707         259 :                 pWindow->SetStyle( nStyle | WB_BORDER );
    1708         259 :                 pWindow->SetBorderStyle( nBorder );
    1709             :             }
    1710             :         }
    1711         271 :         break;
    1712             :         case BASEPROPERTY_TABSTOP:
    1713             :         {
    1714         360 :             WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP;
    1715         360 :             if ( !bVoid )
    1716             :             {
    1717           6 :                 bool bTab = false;
    1718           6 :                 Value >>= bTab;
    1719           6 :                 if ( bTab )
    1720           6 :                     nStyle |= WB_TABSTOP;
    1721             :                 else
    1722           0 :                     nStyle |= WB_NOTABSTOP;
    1723             :             }
    1724         360 :             pWindow->SetStyle( nStyle );
    1725             :         }
    1726         360 :         break;
    1727             :         case BASEPROPERTY_VERTICALALIGN:
    1728             :         {
    1729         266 :             VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE;
    1730         266 :             WinBits nStyle = pWindow->GetStyle();
    1731         266 :             nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM);
    1732         266 :             if ( !bVoid )
    1733          28 :                 Value >>= eAlign;
    1734         266 :             switch ( eAlign )
    1735             :             {
    1736             :             case VerticalAlignment_TOP:
    1737           0 :                 nStyle |= WB_TOP;
    1738           0 :                 break;
    1739             :             case VerticalAlignment_MIDDLE:
    1740          28 :                 nStyle |= WB_VCENTER;
    1741          28 :                 break;
    1742             :             case VerticalAlignment_BOTTOM:
    1743           0 :                 nStyle |= WB_BOTTOM;
    1744           0 :                 break;
    1745             :             default: ; // for warning free code, MAKE_FIXED_SIZE
    1746             :             }
    1747         266 :             pWindow->SetStyle( nStyle );
    1748             :         }
    1749         266 :         break;
    1750             :         case BASEPROPERTY_ALIGN:
    1751             :         {
    1752         309 :             sal_Int16 nAlign = PROPERTY_ALIGN_LEFT;
    1753         309 :             switch ( eWinType )
    1754             :             {
    1755             :                 case WINDOW_COMBOBOX:
    1756             :                 case WINDOW_BUTTON:
    1757             :                 case WINDOW_PUSHBUTTON:
    1758             :                 case WINDOW_OKBUTTON:
    1759             :                 case WINDOW_CANCELBUTTON:
    1760             :                 case WINDOW_HELPBUTTON:
    1761          75 :                     nAlign = PROPERTY_ALIGN_CENTER;
    1762             :                     // no break here!
    1763             :                 case WINDOW_FIXEDTEXT:
    1764             :                 case WINDOW_EDIT:
    1765             :                 case WINDOW_MULTILINEEDIT:
    1766             :                 case WINDOW_CHECKBOX:
    1767             :                 case WINDOW_RADIOBUTTON:
    1768             :                 case WINDOW_LISTBOX:
    1769             :                 {
    1770         200 :                     WinBits nStyle = pWindow->GetStyle();
    1771         200 :                     nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
    1772         200 :                     if ( !bVoid )
    1773         200 :                         Value >>= nAlign;
    1774         200 :                     if ( nAlign == PROPERTY_ALIGN_LEFT )
    1775         123 :                         nStyle |= WB_LEFT;
    1776          77 :                     else if ( nAlign == PROPERTY_ALIGN_CENTER )
    1777          77 :                         nStyle |= WB_CENTER;
    1778             :                     else
    1779           0 :                         nStyle |= WB_RIGHT;
    1780         200 :                     pWindow->SetStyle( nStyle );
    1781             :                 }
    1782         200 :                 break;
    1783             :             }
    1784             :         }
    1785         309 :         break;
    1786             :         case BASEPROPERTY_MULTILINE:
    1787             :         {
    1788         181 :             if  (  ( eWinType == WINDOW_FIXEDTEXT )
    1789         179 :                 || ( eWinType == WINDOW_CHECKBOX )
    1790         160 :                 || ( eWinType == WINDOW_RADIOBUTTON )
    1791         141 :                 || ( eWinType == WINDOW_BUTTON )
    1792         141 :                 || ( eWinType == WINDOW_PUSHBUTTON )
    1793          89 :                 || ( eWinType == WINDOW_OKBUTTON )
    1794          89 :                 || ( eWinType == WINDOW_CANCELBUTTON )
    1795          89 :                 || ( eWinType == WINDOW_HELPBUTTON )
    1796             :                 )
    1797             :             {
    1798          92 :                 WinBits nStyle = pWindow->GetStyle();
    1799          92 :                 bool bMulti = false;
    1800          92 :                 Value >>= bMulti;
    1801          92 :                 if ( bMulti )
    1802          17 :                     nStyle |= WB_WORDBREAK;
    1803             :                 else
    1804          75 :                     nStyle &= ~WB_WORDBREAK;
    1805          92 :                 pWindow->SetStyle( nStyle );
    1806             :             }
    1807             :         }
    1808         181 :         break;
    1809             :         case BASEPROPERTY_ORIENTATION:
    1810             :         {
    1811           0 :             switch ( eWinType )
    1812             :             {
    1813             :                 case WINDOW_FIXEDLINE:
    1814             :                 {
    1815           0 :                     sal_Int32 nOrientation = 0;
    1816           0 :                     if ( Value >>= nOrientation )
    1817             :                     {
    1818           0 :                         WinBits nStyle = pWindow->GetStyle();
    1819           0 :                         nStyle &= ~(WB_HORZ|WB_VERT);
    1820           0 :                         if ( nOrientation == 0 )
    1821           0 :                             nStyle |= WB_HORZ;
    1822             :                         else
    1823           0 :                             nStyle |= WB_VERT;
    1824             : 
    1825           0 :                         pWindow->SetStyle( nStyle );
    1826             :                     }
    1827             :                 }
    1828           0 :                 break;
    1829             :             }
    1830             :         }
    1831           0 :         break;
    1832             :         case BASEPROPERTY_AUTOMNEMONICS:
    1833             :         {
    1834           0 :             bool bAutoMnemonics = false;
    1835           0 :             Value >>= bAutoMnemonics;
    1836           0 :             AllSettings aSettings = pWindow->GetSettings();
    1837           0 :             StyleSettings aStyleSettings = aSettings.GetStyleSettings();
    1838           0 :             if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics )
    1839             :             {
    1840           0 :                 aStyleSettings.SetAutoMnemonic( bAutoMnemonics );
    1841           0 :                 aSettings.SetStyleSettings( aStyleSettings );
    1842           0 :                 pWindow->SetSettings( aSettings );
    1843           0 :             }
    1844             :         }
    1845           0 :         break;
    1846             :         case BASEPROPERTY_MOUSETRANSPARENT:
    1847             :         {
    1848           0 :             bool bMouseTransparent = false;
    1849           0 :             Value >>= bMouseTransparent;
    1850           0 :             pWindow->SetMouseTransparent( bMouseTransparent );
    1851             :         }
    1852           0 :         break;
    1853             :         case BASEPROPERTY_PAINTTRANSPARENT:
    1854             :         {
    1855           1 :             bool bPaintTransparent = false;
    1856           1 :             Value >>= bPaintTransparent;
    1857           1 :             pWindow->SetPaintTransparent( bPaintTransparent );
    1858             : //                pWindow->SetBackground();
    1859             :         }
    1860           1 :         break;
    1861             : 
    1862             :         case BASEPROPERTY_REPEAT:
    1863             :         {
    1864         166 :             bool bRepeat( false );
    1865         166 :             Value >>= bRepeat;
    1866             : 
    1867         166 :             WinBits nStyle = pWindow->GetStyle();
    1868         166 :             if ( bRepeat )
    1869          44 :                 nStyle |= WB_REPEAT;
    1870             :             else
    1871         122 :                 nStyle &= ~WB_REPEAT;
    1872         166 :             pWindow->SetStyle( nStyle );
    1873             :         }
    1874         166 :         break;
    1875             : 
    1876             :         case BASEPROPERTY_REPEAT_DELAY:
    1877             :         {
    1878         193 :             sal_Int32 nRepeatDelay = 0;
    1879         193 :             if ( Value >>= nRepeatDelay )
    1880             :             {
    1881         193 :                 AllSettings aSettings = pWindow->GetSettings();
    1882         386 :                 MouseSettings aMouseSettings = aSettings.GetMouseSettings();
    1883             : 
    1884         193 :                 aMouseSettings.SetButtonRepeat( nRepeatDelay );
    1885         193 :                 aSettings.SetMouseSettings( aMouseSettings );
    1886             : 
    1887         386 :                 pWindow->SetSettings( aSettings, true );
    1888             :             }
    1889             :         }
    1890         193 :         break;
    1891             : 
    1892             :         case BASEPROPERTY_SYMBOL_COLOR:
    1893           2 :             ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor );
    1894           2 :             break;
    1895             : 
    1896             :         case BASEPROPERTY_BORDERCOLOR:
    1897         253 :             ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor);
    1898         253 :             break;
    1899             :         case BASEPROPERTY_DEFAULTCONTROL:
    1900             :         {
    1901         494 :             OUString aName;
    1902         494 :             Value >>= aName;
    1903         494 :             break;
    1904             :         }
    1905       28342 :     }
    1906             : }
    1907             : 
    1908          52 : ::com::sun::star::uno::Any VCLXWindow::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1909             : {
    1910          52 :     SolarMutexGuard aGuard;
    1911             : 
    1912          52 :     ::com::sun::star::uno::Any aProp;
    1913          52 :     if ( GetWindow() )
    1914             :     {
    1915          52 :         WindowType eWinType = GetWindow()->GetType();
    1916          52 :         sal_uInt16 nPropType = GetPropertyId( PropertyName );
    1917          52 :         switch ( nPropType )
    1918             :         {
    1919             :             case BASEPROPERTY_REFERENCE_DEVICE:
    1920             :             {
    1921           0 :                 Control* pControl = dynamic_cast< Control* >( GetWindow() );
    1922             :                 OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
    1923           0 :                 if ( !pControl )
    1924           0 :                     break;
    1925             : 
    1926           0 :                 VCLXDevice* pDevice = new VCLXDevice;
    1927           0 :                 pDevice->SetOutputDevice( pControl->GetReferenceDevice() );
    1928           0 :                 aProp <<= Reference< XDevice >( pDevice );
    1929             :             }
    1930           0 :             break;
    1931             : 
    1932             :             case BASEPROPERTY_CONTEXT_WRITING_MODE:
    1933           0 :                 aProp <<= mpImpl->mnContextWritingMode;
    1934           0 :                 break;
    1935             : 
    1936             :             case BASEPROPERTY_WRITING_MODE:
    1937           0 :                 aProp <<= mpImpl->mnWritingMode;
    1938           0 :                 break;
    1939             : 
    1940             :             case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:
    1941             :             {
    1942           0 :                 sal_uInt16 nVclBehavior = GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior();
    1943           0 :                 sal_Int16 nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY;
    1944           0 :                 switch ( nVclBehavior )
    1945             :                 {
    1946           0 :                 case MOUSE_WHEEL_DISABLE:       nBehavior = MouseWheelBehavior::SCROLL_DISABLED;    break;
    1947           0 :                 case MOUSE_WHEEL_FOCUS_ONLY:    nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY;  break;
    1948           0 :                 case MOUSE_WHEEL_ALWAYS:        nBehavior = MouseWheelBehavior::SCROLL_ALWAYS;      break;
    1949             :                 default:
    1950             :                     OSL_FAIL( "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" );
    1951             :                 }
    1952           0 :                 aProp <<= nBehavior;
    1953             :             }
    1954           0 :             break;
    1955             : 
    1956             :             case BASEPROPERTY_NATIVE_WIDGET_LOOK:
    1957           0 :                 aProp <<= GetWindow()->IsNativeWidgetEnabled();
    1958           0 :                 break;
    1959             : 
    1960             :             case BASEPROPERTY_ENABLED:
    1961           0 :                 aProp <<= GetWindow()->IsEnabled();
    1962           0 :                 break;
    1963             : 
    1964             :             case BASEPROPERTY_ENABLEVISIBLE:
    1965           0 :                 aProp <<= mpImpl->isEnableVisible();
    1966           0 :                 break;
    1967             : 
    1968             :             case BASEPROPERTY_HIGHCONTRASTMODE:
    1969           0 :                 aProp <<= GetWindow()->GetSettings().GetStyleSettings().GetHighContrastMode();
    1970           0 :                 break;
    1971             : 
    1972             :             case BASEPROPERTY_TEXT:
    1973             :             case BASEPROPERTY_LABEL:
    1974             :             case BASEPROPERTY_TITLE:
    1975             :             {
    1976          52 :                 OUString aText = GetWindow()->GetText();
    1977          52 :                 aProp <<= aText;
    1978             :             }
    1979          52 :             break;
    1980             :             case BASEPROPERTY_ACCESSIBLENAME:
    1981             :             {
    1982           0 :                 OUString aText = GetWindow()->GetAccessibleName();
    1983           0 :                 aProp <<= aText;
    1984             :             }
    1985           0 :             break;
    1986             :             case BASEPROPERTY_HELPTEXT:
    1987             :             {
    1988           0 :                 OUString aText = GetWindow()->GetQuickHelpText();
    1989           0 :                 aProp <<= aText;
    1990             :             }
    1991           0 :             break;
    1992             :             case BASEPROPERTY_HELPURL:
    1993             :             {
    1994           0 :                 OUString aHelpId( OStringToOUString( GetWindow()->GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
    1995           0 :                 aProp <<= OUString( aHelpId );
    1996             :             }
    1997           0 :             break;
    1998             :             case BASEPROPERTY_FONTDESCRIPTOR:
    1999             :             {
    2000           0 :                 Font aFont = GetWindow()->GetControlFont();
    2001           0 :                 ::com::sun::star::awt::FontDescriptor aFD = VCLUnoHelper::CreateFontDescriptor( aFont );
    2002           0 :                 aProp <<= aFD;
    2003             :             }
    2004           0 :             break;
    2005             :             case BASEPROPERTY_BACKGROUNDCOLOR:
    2006           0 :                 aProp <<= (sal_Int32) GetWindow()->GetControlBackground().GetColor();
    2007           0 :             break;
    2008             :             case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR:
    2009           0 :                 aProp <<= (sal_Int32) GetWindow()->GetDisplayBackground().GetColor().GetColor();
    2010           0 :             break;
    2011             :             case BASEPROPERTY_FONTRELIEF:
    2012           0 :                 aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetRelief();
    2013           0 :             break;
    2014             :             case BASEPROPERTY_FONTEMPHASISMARK:
    2015           0 :                 aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetEmphasisMark();
    2016           0 :             break;
    2017             :             case BASEPROPERTY_TEXTCOLOR:
    2018           0 :                 aProp <<= (sal_Int32) GetWindow()->GetControlForeground().GetColor();
    2019           0 :             break;
    2020             :             case BASEPROPERTY_TEXTLINECOLOR:
    2021           0 :                 aProp <<= (sal_Int32) GetWindow()->GetTextLineColor().GetColor();
    2022           0 :             break;
    2023             :             case BASEPROPERTY_FILLCOLOR:
    2024           0 :                 aProp <<= (sal_Int32) GetWindow()->GetFillColor().GetColor();
    2025           0 :             break;
    2026             :             case BASEPROPERTY_LINECOLOR:
    2027           0 :                 aProp <<= (sal_Int32) GetWindow()->GetLineColor().GetColor();
    2028           0 :             break;
    2029             :             case BASEPROPERTY_BORDER:
    2030             :             {
    2031           0 :                 sal_Int16 nBorder = 0;
    2032           0 :                 if ( GetWindow()->GetStyle() & WB_BORDER )
    2033           0 :                     nBorder = GetWindow()->GetBorderStyle();
    2034           0 :                 aProp <<= nBorder;
    2035             :             }
    2036           0 :             break;
    2037             :             case BASEPROPERTY_TABSTOP:
    2038           0 :                 aProp <<= ( GetWindow()->GetStyle() & WB_TABSTOP ) != 0;
    2039           0 :             break;
    2040             :             case BASEPROPERTY_VERTICALALIGN:
    2041             :             {
    2042           0 :                 WinBits nStyle = GetWindow()->GetStyle();
    2043           0 :                 if ( nStyle & WB_TOP )
    2044           0 :                     aProp <<= VerticalAlignment_TOP;
    2045           0 :                 else if ( nStyle & WB_VCENTER )
    2046           0 :                     aProp <<= VerticalAlignment_MIDDLE;
    2047           0 :                 else if ( nStyle & WB_BOTTOM )
    2048           0 :                     aProp <<= VerticalAlignment_BOTTOM;
    2049             :             }
    2050           0 :             break;
    2051             :             case BASEPROPERTY_ALIGN:
    2052             :             {
    2053           0 :                 switch ( eWinType )
    2054             :                 {
    2055             :                     case WINDOW_FIXEDTEXT:
    2056             :                     case WINDOW_EDIT:
    2057             :                     case WINDOW_MULTILINEEDIT:
    2058             :                     case WINDOW_CHECKBOX:
    2059             :                     case WINDOW_RADIOBUTTON:
    2060             :                     case WINDOW_LISTBOX:
    2061             :                     case WINDOW_COMBOBOX:
    2062             :                     case WINDOW_BUTTON:
    2063             :                     case WINDOW_PUSHBUTTON:
    2064             :                     case WINDOW_OKBUTTON:
    2065             :                     case WINDOW_CANCELBUTTON:
    2066             :                     case WINDOW_HELPBUTTON:
    2067             :                     {
    2068           0 :                         WinBits nStyle = GetWindow()->GetStyle();
    2069           0 :                         if ( nStyle & WB_LEFT )
    2070           0 :                             aProp <<= (sal_Int16) PROPERTY_ALIGN_LEFT;
    2071           0 :                         else if ( nStyle & WB_CENTER )
    2072           0 :                             aProp <<= (sal_Int16) PROPERTY_ALIGN_CENTER;
    2073           0 :                         else if ( nStyle & WB_RIGHT )
    2074           0 :                             aProp <<= (sal_Int16) PROPERTY_ALIGN_RIGHT;
    2075             :                     }
    2076           0 :                     break;
    2077             :                 }
    2078             :             }
    2079             :             case BASEPROPERTY_MULTILINE:
    2080             :             {
    2081           0 :                 if  (  ( eWinType == WINDOW_FIXEDTEXT )
    2082           0 :                     || ( eWinType == WINDOW_CHECKBOX )
    2083           0 :                     || ( eWinType == WINDOW_RADIOBUTTON )
    2084           0 :                     || ( eWinType == WINDOW_BUTTON )
    2085           0 :                     || ( eWinType == WINDOW_PUSHBUTTON )
    2086           0 :                     || ( eWinType == WINDOW_OKBUTTON )
    2087           0 :                     || ( eWinType == WINDOW_CANCELBUTTON )
    2088           0 :                     || ( eWinType == WINDOW_HELPBUTTON )
    2089             :                     )
    2090           0 :                     aProp <<= ( GetWindow()->GetStyle() & WB_WORDBREAK ) != 0;
    2091             :             }
    2092           0 :             break;
    2093             :             case BASEPROPERTY_AUTOMNEMONICS:
    2094             :             {
    2095           0 :                 bool bAutoMnemonics = GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
    2096           0 :                 aProp <<= bAutoMnemonics;
    2097             :             }
    2098           0 :             break;
    2099             :             case BASEPROPERTY_MOUSETRANSPARENT:
    2100             :             {
    2101           0 :                 bool bMouseTransparent = GetWindow()->IsMouseTransparent();
    2102           0 :                 aProp <<= bMouseTransparent;
    2103             :             }
    2104           0 :             break;
    2105             :             case BASEPROPERTY_PAINTTRANSPARENT:
    2106             :             {
    2107           0 :                 bool bPaintTransparent = GetWindow()->IsPaintTransparent();
    2108           0 :                 aProp <<= bPaintTransparent;
    2109             :             }
    2110           0 :             break;
    2111             : 
    2112             :             case BASEPROPERTY_REPEAT:
    2113           0 :                 aProp <<= ( 0 != ( GetWindow()->GetStyle() & WB_REPEAT ) );
    2114           0 :                 break;
    2115             : 
    2116             :             case BASEPROPERTY_REPEAT_DELAY:
    2117             :             {
    2118           0 :                 sal_Int32 nButtonRepeat = GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
    2119           0 :                 aProp <<= (sal_Int32)nButtonRepeat;
    2120             :             }
    2121           0 :             break;
    2122             : 
    2123             :             case BASEPROPERTY_SYMBOL_COLOR:
    2124           0 :                 aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
    2125           0 :                 break;
    2126             : 
    2127             :             case BASEPROPERTY_BORDERCOLOR:
    2128           0 :                 aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor();
    2129           0 :                 break;
    2130             :         }
    2131             :     }
    2132          52 :     return aProp;
    2133             : }
    2134             : 
    2135             : 
    2136             : // ::com::sun::star::awt::XLayoutConstrains
    2137           0 : ::com::sun::star::awt::Size VCLXWindow::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2138             : {
    2139           0 :     SolarMutexGuard aGuard;
    2140             : 
    2141             :     // Use this method only for those components which can be created through
    2142             :     // ::com::sun::star::awt::Toolkit , but do not have an interface
    2143             : 
    2144           0 :     Size aSz;
    2145           0 :     if ( GetWindow() )
    2146             :     {
    2147           0 :         WindowType nWinType = GetWindow()->GetType();
    2148           0 :         switch ( nWinType )
    2149             :         {
    2150             :             case WINDOW_CONTROL:
    2151           0 :                 aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
    2152           0 :                 aSz.Height() = GetWindow()->GetTextHeight()+2*6;
    2153           0 :             break;
    2154             : 
    2155             :             case WINDOW_PATTERNBOX:
    2156             :             case WINDOW_NUMERICBOX:
    2157             :             case WINDOW_METRICBOX:
    2158             :             case WINDOW_CURRENCYBOX:
    2159             :             case WINDOW_DATEBOX:
    2160             :             case WINDOW_TIMEBOX:
    2161             :             case WINDOW_LONGCURRENCYBOX:
    2162           0 :                 aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
    2163           0 :                 aSz.Height() = GetWindow()->GetTextHeight()+2*2;
    2164           0 :             break;
    2165             :             case WINDOW_SCROLLBARBOX:
    2166           0 :                 return VCLXScrollBar::implGetMinimumSize( GetWindow() );
    2167             :             default:
    2168           0 :                 aSz = GetWindow()->GetOptimalSize();
    2169             :         }
    2170             :     }
    2171             : 
    2172           0 :     return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
    2173             : }
    2174             : 
    2175           0 : ::com::sun::star::awt::Size VCLXWindow::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2176             : {
    2177           0 :     return getMinimumSize();
    2178             : }
    2179             : 
    2180           0 : ::com::sun::star::awt::Size VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2181             : {
    2182           0 :     SolarMutexGuard aGuard;
    2183             : 
    2184           0 :     ::com::sun::star::awt::Size aNewSize( rNewSize );
    2185           0 :     ::com::sun::star::awt::Size aMinSize = getMinimumSize();
    2186             : 
    2187           0 :     if ( aNewSize.Width < aMinSize.Width )
    2188           0 :         aNewSize.Width = aMinSize.Width;
    2189           0 :     if ( aNewSize.Height < aMinSize.Height )
    2190           0 :         aNewSize.Height = aMinSize.Height;
    2191             : 
    2192           0 :     return aNewSize;
    2193             : }
    2194             : 
    2195             : 
    2196             : // ::com::sun::star::awt::XView
    2197        6158 : sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rxDevice ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2198             : {
    2199        6158 :     SolarMutexGuard aGuard;
    2200             : 
    2201        6158 :     if ( VCLUnoHelper::GetOutputDevice( rxDevice ) )
    2202        2899 :         mpImpl->mxViewGraphics = rxDevice;
    2203             :     else
    2204        3259 :         mpImpl->mxViewGraphics = NULL;
    2205             : 
    2206        6158 :     return mpImpl->mxViewGraphics.is();
    2207             : }
    2208             : 
    2209          88 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2210             : {
    2211          88 :     SolarMutexGuard aGuard;
    2212             : 
    2213          88 :     return mpImpl->mxViewGraphics;
    2214             : }
    2215             : 
    2216           0 : ::com::sun::star::awt::Size VCLXWindow::getSize(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2217             : {
    2218           0 :     SolarMutexGuard aGuard;
    2219             : 
    2220           0 :     Size aSz;
    2221           0 :     if ( GetWindow() )
    2222           0 :         aSz = GetWindow()->GetSizePixel();
    2223           0 :     return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
    2224             : }
    2225             : 
    2226        2729 : void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2227             : {
    2228        2729 :     SolarMutexGuard aGuard;
    2229             : 
    2230        2729 :     Window* pWindow = GetWindow();
    2231        2729 :     if ( !pWindow )
    2232           0 :         return;
    2233             : 
    2234        2729 :     if ( isDesignMode() || mpImpl->isEnableVisible() )
    2235             :     {
    2236        2729 :         OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
    2237        2729 :         if (!pDev)
    2238           0 :             pDev = pWindow->GetParent();
    2239        2729 :         TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow );
    2240        2729 :         if ( pTabPage )
    2241             :         {
    2242           0 :             Point aPos( nX, nY );
    2243           0 :             Size  aSize = pWindow->GetSizePixel();
    2244             : 
    2245           0 :             aPos  = pDev->PixelToLogic( aPos );
    2246           0 :             aSize = pDev->PixelToLogic( aSize );
    2247             : 
    2248           0 :             pTabPage->Draw( pDev, aPos, aSize, 0 );
    2249           0 :             return;
    2250             :         }
    2251             : 
    2252        2729 :         Point aPos( nX, nY );
    2253             : 
    2254        2729 :         if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) )
    2255             :         {
    2256             :             // #i40647# don't draw here if this is a recursive call
    2257             :             // sometimes this is called recursively, because the Update call on the parent
    2258             :             // (strangely) triggers another paint. Prevent a stack overflow here
    2259             :             // Yes, this is only fixing symptoms for the moment ....
    2260             :             // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
    2261           0 :             if ( !mpImpl->getDrawingOntoParent_ref() )
    2262             :             {
    2263           0 :                 ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
    2264             : 
    2265           0 :                 bool bWasVisible = pWindow->IsVisible();
    2266           0 :                 Point aOldPos( pWindow->GetPosPixel() );
    2267             : 
    2268           0 :                 if ( bWasVisible && aOldPos == aPos )
    2269             :                 {
    2270           0 :                     pWindow->Update();
    2271           0 :                     return;
    2272             :                 }
    2273             : 
    2274           0 :                 pWindow->SetPosPixel( aPos );
    2275             : 
    2276             :                 // Update parent first to avoid painting the parent upon the update
    2277             :                 // of this window, as it may otherwise cause the parent
    2278             :                 // to hide this window again
    2279           0 :                 if( pWindow->GetParent() )
    2280           0 :                     pWindow->GetParent()->Update();
    2281             : 
    2282           0 :                 pWindow->Show();
    2283           0 :                 pWindow->Update();
    2284           0 :                 pWindow->SetParentUpdateMode( false );
    2285           0 :                 pWindow->Hide();
    2286           0 :                 pWindow->SetParentUpdateMode( true );
    2287             : 
    2288           0 :                 pWindow->SetPosPixel( aOldPos );
    2289           0 :                 if ( bWasVisible )
    2290           0 :                     pWindow->Show( true );
    2291             :             }
    2292             :         }
    2293        2729 :         else if ( pDev )
    2294             :         {
    2295        2729 :             Size aSz = pWindow->GetSizePixel();
    2296        2729 :             aSz = pDev->PixelToLogic( aSz );
    2297        2729 :             Point aP = pDev->PixelToLogic( aPos );
    2298             : 
    2299        2729 :             vcl::PDFExtOutDevData* pPDFExport   = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
    2300        2729 :             bool bDrawSimple =    ( pDev->GetOutDevType() == OUTDEV_PRINTER )
    2301        2729 :                                || ( pDev->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW )
    2302        5458 :                                || ( pPDFExport != NULL );
    2303        2729 :             if ( bDrawSimple )
    2304             :             {
    2305           0 :                 pWindow->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS );
    2306             :             }
    2307             :             else
    2308             :             {
    2309        2729 :                 bool bOldNW =pWindow->IsNativeWidgetEnabled();
    2310        2729 :                 if( bOldNW )
    2311         973 :                     pWindow->EnableNativeWidget(false);
    2312        2729 :                 pWindow->PaintToDevice( pDev, aP, aSz );
    2313        2729 :                 if( bOldNW )
    2314         973 :                     pWindow->EnableNativeWidget(true);
    2315             :             }
    2316             :         }
    2317        2729 :     }
    2318             : }
    2319             : 
    2320       13687 : void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    2321             : {
    2322       13687 :     SolarMutexGuard aGuard;
    2323             : 
    2324       13687 :     if ( GetWindow() )
    2325             :     {
    2326             :         // Fraction::Fraction takes a double, but we have a float only.
    2327             :         // The implicit conversion from float to double can result in a precision loss, i.e. 1.2 is converted to
    2328             :         // 1.200000000047something. To prevent this, we convert explicitly to double, and round it.
    2329       13687 :         double nZoom( fZoomX );
    2330       13687 :         nZoom = ::rtl::math::round( nZoom, 4 );
    2331       13687 :         GetWindow()->SetZoom( Fraction( nZoom ) );
    2332       13687 :     }
    2333       13687 : }
    2334             : 
    2335             : // ::com::sun::star::lang::XEventListener
    2336         323 : void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2337             : {
    2338         323 :     SolarMutexGuard aGuard;
    2339             : 
    2340             :     // check if it comes from our AccessibleContext
    2341         646 :     uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
    2342         646 :     uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY );
    2343             : 
    2344         323 :     if ( aAC.get() == xSource.get() )
    2345             :     {   // yep, it does
    2346         211 :         mpImpl->mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >();
    2347         323 :     }
    2348         323 : }
    2349             : 
    2350             : // ::com::sun::star::accessibility::XAccessible
    2351        1015 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXWindow::getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2352             : {
    2353             :     using namespace ::com::sun::star;
    2354             : 
    2355        1015 :     SolarMutexGuard aGuard;
    2356             : 
    2357             :     // already disposed
    2358        1015 :     if( ! mpImpl )
    2359           0 :         return uno::Reference< accessibility::XAccessibleContext >();
    2360             : 
    2361        1015 :     if ( !mpImpl->mxAccessibleContext.is() && GetWindow() )
    2362             :     {
    2363         211 :         mpImpl->mxAccessibleContext = CreateAccessibleContext();
    2364             : 
    2365             :         // add as event listener to this component
    2366             :         // in case somebody disposes it, we do not want to have a (though weak) reference to a dead
    2367             :         // object
    2368         211 :         uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
    2369         211 :         if ( xComp.is() )
    2370         211 :             xComp->addEventListener( this );
    2371             :     }
    2372             : 
    2373        1015 :     return mpImpl->mxAccessibleContext;
    2374             : }
    2375             : 
    2376             : // ::com::sun::star::awt::XDockable
    2377        6103 : void SAL_CALL VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2378             : {
    2379        6103 :     SolarMutexGuard aGuard;
    2380             : 
    2381        6103 :     if ( xListener.is() )
    2382        6103 :         mpImpl->getDockableWindowListeners().addInterface( xListener );
    2383             : 
    2384        6103 : }
    2385             : 
    2386           0 : void SAL_CALL VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2387             : {
    2388           0 :     SolarMutexGuard aGuard;
    2389             : 
    2390           0 :     mpImpl->getDockableWindowListeners().removeInterface( xListener );
    2391           0 : }
    2392             : 
    2393        6103 : void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2394             : {
    2395        6103 :     SolarMutexGuard aGuard;
    2396             : 
    2397        6103 :     Window* pWindow = GetWindow();
    2398        6103 :     if ( pWindow )
    2399        6103 :         pWindow->EnableDocking( bEnable );
    2400        6103 : }
    2401             : 
    2402       11059 : sal_Bool SAL_CALL VCLXWindow::isFloating(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2403             : {
    2404       11059 :     SolarMutexGuard aGuard;
    2405             : 
    2406       11059 :     Window* pWindow = GetWindow();
    2407       11059 :     if( pWindow )
    2408       11059 :         return Window::GetDockingManager()->IsFloating( pWindow );
    2409             :     else
    2410           0 :         return sal_False;
    2411             : }
    2412             : 
    2413        6103 : void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2414             : {
    2415        6103 :     SolarMutexGuard aGuard;
    2416             : 
    2417        6103 :     Window* pWindow = GetWindow();
    2418        6103 :     if( pWindow )
    2419        6103 :         Window::GetDockingManager()->SetFloatingMode( pWindow, bFloating );
    2420        6103 : }
    2421             : 
    2422           0 : sal_Bool SAL_CALL VCLXWindow::isLocked(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2423             : {
    2424           0 :     SolarMutexGuard aGuard;
    2425             : 
    2426           0 :     Window* pWindow = GetWindow();
    2427           0 :     if( pWindow )
    2428           0 :         return Window::GetDockingManager()->IsLocked( pWindow );
    2429             :     else
    2430           0 :         return sal_False;
    2431             : }
    2432             : 
    2433           0 : void SAL_CALL VCLXWindow::lock(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2434             : {
    2435           0 :     SolarMutexGuard aGuard;
    2436             : 
    2437           0 :     Window* pWindow = GetWindow();
    2438           0 :     if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
    2439           0 :         Window::GetDockingManager()->Lock( pWindow );
    2440           0 : }
    2441             : 
    2442           0 : void SAL_CALL VCLXWindow::unlock(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2443             : {
    2444           0 :     SolarMutexGuard aGuard;
    2445             : 
    2446           0 :     Window* pWindow = GetWindow();
    2447           0 :     if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
    2448           0 :         Window::GetDockingManager()->Unlock( pWindow );
    2449           0 : }
    2450           0 : void SAL_CALL VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2451             : {
    2452             :     // TODO: remove interface in the next incompatible build
    2453           0 :     SolarMutexGuard aGuard;
    2454             : 
    2455           0 : }
    2456             : 
    2457           0 : sal_Bool SAL_CALL VCLXWindow::isInPopupMode(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2458             : {
    2459             :     // TODO: remove interface in the next incompatible build
    2460           0 :     SolarMutexGuard aGuard;
    2461           0 :     return sal_False;
    2462             : }
    2463             : 
    2464             : 
    2465             : // ::com::sun::star::awt::XWindow2
    2466             : 
    2467        6103 : void SAL_CALL VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2468             : {
    2469        6103 :     SolarMutexGuard aGuard;
    2470             :     Window *pWindow;
    2471        6103 :     if( (pWindow = GetWindow()) != NULL )
    2472             :     {
    2473        6103 :         DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
    2474        6103 :         if( pDockingWindow )
    2475        6103 :             pDockingWindow->SetOutputSizePixel( VCLSize( aSize ) );
    2476             :         else
    2477           0 :             pWindow->SetOutputSizePixel( VCLSize( aSize ) );
    2478        6103 :     }
    2479        6103 : }
    2480             : 
    2481           0 : ::com::sun::star::awt::Size SAL_CALL VCLXWindow::getOutputSize(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2482             : {
    2483           0 :     SolarMutexGuard aGuard;
    2484             :     Window *pWindow;
    2485           0 :     if( (pWindow = GetWindow()) != NULL )
    2486             :     {
    2487           0 :         DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
    2488           0 :         if( pDockingWindow )
    2489           0 :             return AWTSize( pDockingWindow->GetOutputSizePixel() );
    2490             :         else
    2491           0 :             return AWTSize( pWindow->GetOutputSizePixel() );
    2492             :     }
    2493             :     else
    2494           0 :         return ::com::sun::star::awt::Size();
    2495             : }
    2496             : 
    2497       11343 : sal_Bool SAL_CALL VCLXWindow::isVisible(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2498             : {
    2499       11343 :     SolarMutexGuard aGuard;
    2500       11343 :     if( GetWindow() )
    2501       11343 :         return GetWindow()->IsVisible();
    2502             :     else
    2503           0 :         return sal_False;
    2504             : }
    2505             : 
    2506       10844 : sal_Bool SAL_CALL VCLXWindow::isActive(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2507             : {
    2508       10844 :     SolarMutexGuard aGuard;
    2509       10844 :     if( GetWindow() )
    2510       10844 :         return GetWindow()->IsActive();
    2511             :     else
    2512           0 :         return sal_False;
    2513             : 
    2514             : }
    2515             : 
    2516          25 : sal_Bool SAL_CALL VCLXWindow::isEnabled(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2517             : {
    2518          25 :     SolarMutexGuard aGuard;
    2519          25 :     if( GetWindow() )
    2520          25 :         return GetWindow()->IsEnabled();
    2521             :     else
    2522           0 :         return sal_False;
    2523             : }
    2524             : 
    2525           0 : sal_Bool SAL_CALL VCLXWindow::hasFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2526             : {
    2527           0 :     SolarMutexGuard aGuard;
    2528           0 :     if( GetWindow() )
    2529           0 :         return GetWindow()->HasFocus();
    2530             :     else
    2531           0 :         return sal_False;
    2532             : }
    2533             : 
    2534             : // ::com::sun::star::beans::XPropertySetInfo
    2535             : 
    2536             : UnoPropertyArrayHelper *
    2537           0 : VCLXWindow::GetPropHelper()
    2538             : {
    2539           0 :     SolarMutexGuard aGuard;
    2540           0 :     if ( mpImpl->mpPropHelper == NULL )
    2541             :     {
    2542           0 :         std::list< sal_uInt16 > aIDs;
    2543           0 :         GetPropertyIds( aIDs );
    2544           0 :         mpImpl->mpPropHelper = new UnoPropertyArrayHelper( aIDs );
    2545             :     }
    2546           0 :     return mpImpl->mpPropHelper;
    2547             : }
    2548             : 
    2549             : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
    2550           0 : VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException, std::exception)
    2551             : {
    2552           0 :     return GetPropHelper()->getProperties();
    2553             : }
    2554             : ::com::sun::star::beans::Property SAL_CALL
    2555           0 : VCLXWindow::getPropertyByName( const OUString& rName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception)
    2556             : {
    2557           0 :     return GetPropHelper()->getPropertyByName( rName );
    2558             : }
    2559             : 
    2560             : sal_Bool SAL_CALL
    2561           0 : VCLXWindow::hasPropertyByName( const OUString& rName ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2562             : {
    2563           0 :     return GetPropHelper()->hasPropertyByName( rName );
    2564             : }
    2565             : 
    2566           0 : Reference< XStyleSettings > SAL_CALL VCLXWindow::getStyleSettings() throw (RuntimeException, std::exception)
    2567             : {
    2568           0 :     return mpImpl->getStyleSettings();
    2569         513 : }
    2570             : 
    2571             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10