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

Generated by: LCOV version 1.10