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