1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vclxwindow.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include <com/sun/star/awt/WindowEvent.hpp>
34 #include <com/sun/star/awt/KeyEvent.hpp>
35 #include <com/sun/star/awt/KeyModifier.hpp>
36 #include <com/sun/star/awt/MouseEvent.hpp>
37 #include <com/sun/star/awt/MouseButton.hpp>
38 #include <com/sun/star/awt/MouseWheelBehavior.hpp>
39 #include <com/sun/star/awt/XTopWindow.hpp>
40 #include <com/sun/star/awt/Style.hpp>
41 #include <com/sun/star/accessibility/AccessibleRole.hpp>
42 #include <com/sun/star/awt/DockingEvent.hpp>
43 #include <com/sun/star/awt/EndDockingEvent.hpp>
44 #include <com/sun/star/awt/EndPopupModeEvent.hpp>
45 #include <com/sun/star/awt/XWindowListener2.hpp>
46 #include <com/sun/star/style/VerticalAlignment.hpp>
47 #include <com/sun/star/text/WritingMode2.hpp>
48 #include <toolkit/awt/vclxwindow.hxx>
49 #include <toolkit/awt/vclxpointer.hxx>
50 #include <toolkit/awt/vclxwindows.hxx>
51 #include <toolkit/helper/macros.hxx>
52 #include <toolkit/helper/vclunohelper.hxx>
53 #include <toolkit/helper/convert.hxx>
54 #include <toolkit/helper/macros.hxx>
55 #include <toolkit/helper/property.hxx>
56 #include <toolkit/helper/accessibilityclient.hxx>
57 #include <cppuhelper/typeprovider.hxx>
58 #include <rtl/memory.h>
60 #include <rtl/ustrbuf.hxx>
61 #include <vcl/svapp.hxx>
62 #include <vcl/window.hxx>
63 #include <tools/color.hxx>
64 #include <vcl/dockwin.hxx>
65 #include <vcl/pdfextoutdevdata.hxx>
66 #include <vcl/tabpage.hxx>
67 #include <comphelper/asyncnotification.hxx>
68 #include <toolkit/helper/solarrelease.hxx>
70 #include <toolkit/helper/unopropertyarrayhelper.hxx>
72 using namespace ::com::sun::star
;
74 using ::com::sun::star::uno::Reference
;
75 using ::com::sun::star::uno::UNO_QUERY
;
76 using ::com::sun::star::lang::EventObject
;
77 using ::com::sun::star::awt::XWindowListener2
;
78 using ::com::sun::star::awt::XDockableWindowListener
;
79 using ::com::sun::star::style::VerticalAlignment
;
80 using ::com::sun::star::style::VerticalAlignment_TOP
;
81 using ::com::sun::star::style::VerticalAlignment_MIDDLE
;
82 using ::com::sun::star::style::VerticalAlignment_BOTTOM
;
83 using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE
;
85 namespace WritingMode2
= ::com::sun::star::text::WritingMode2
;
86 namespace MouseWheelBehavior
= ::com::sun::star::awt::MouseWheelBehavior
;
89 //====================================================================
91 //====================================================================
94 //................................................................
96 //................................................................
103 FlagGuard( bool& _rFlag
)
114 //................................................................
116 //................................................................
119 META_FIRST_MOUSE_EVENT
= 0,
121 EVENT_MOUSE_PRESSED
= 0,
122 EVENT_MOUSE_RELEASED
= 1,
123 EVENT_MOUSE_ENTERED
= 2,
124 EVENT_MOUSE_EXITED
= 3,
126 META_LAST_MOUSE_EVENT
= 3
129 //................................................................
131 //................................................................
134 META_FIRST_PLAIN_EVENT
= 4,
136 EVENT_WINDOW_ENABLED
= 4,
137 EVENT_WINDOW_DISABLED
= 5,
139 META_LAST_PLAIN_EVENT
= 5
142 #if OSL_DEBUG_LEVEL > 0
143 static void checkEventDefinitions()
145 OSL_ENSURE( (int)META_LAST_MOUSE_EVENT
< (int)META_FIRST_PLAIN_EVENT
, "checkEventDefinitions: invalid event definitions!" );
147 #define DBG_CHECK_EVENTS() checkEventDefinitions()
149 #define DBG_CHECK_EVENTS()
152 //................................................................
154 //................................................................
155 struct AnyWindowEvent
: public ::comphelper::AnyEvent
158 awt::MouseEvent m_aMouseEvent
;
159 lang::EventObject m_aPlainEvent
;
161 sal_Int32 m_nEventType
;
164 AnyWindowEvent( const awt::MouseEvent
& _rEvent
, MouseEventType _nType
)
165 :comphelper::AnyEvent()
166 ,m_aMouseEvent( _rEvent
)
167 ,m_nEventType( static_cast< sal_Int32
>( _nType
) )
172 AnyWindowEvent( const lang::EventObject
& _rEvent
, PlainEventType _nType
)
173 :comphelper::AnyEvent()
174 ,m_aPlainEvent( _rEvent
)
175 ,m_nEventType( static_cast< sal_Int32
>( _nType
) )
180 bool isMouseEvent() const
182 return ( META_FIRST_MOUSE_EVENT
<= m_nEventType
) && ( m_nEventType
<= META_LAST_MOUSE_EVENT
);
185 bool isPlainEvent() const
187 return ( META_FIRST_PLAIN_EVENT
<= m_nEventType
) && ( m_nEventType
<= META_LAST_PLAIN_EVENT
);
190 const awt::MouseEvent
& getMouseEvent() const
192 OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEvent: no mouse event!" );
193 return m_aMouseEvent
;
196 MouseEventType
getMouseEventType() const
198 OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEventType: no mouse event!" );
199 return static_cast< MouseEventType
>( m_nEventType
);
202 const lang::EventObject
& getPlainEvent() const
204 OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEvent: no plain event!" );
205 return m_aPlainEvent
;
208 PlainEventType
getPlainEventType() const
210 OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEventType: no mouse event!" );
211 return static_cast< PlainEventType
>( m_nEventType
);
216 //====================================================================
218 //====================================================================
219 class SAL_DLLPRIVATE VCLXWindowImpl
: public ::comphelper::IEventProcessor
222 typedef ::std::vector
< ::rtl::Reference
< ::comphelper::AnyEvent
> >
226 VCLXWindow
& mrAntiImpl
;
227 ::vos::IMutex
& mrMutex
;
228 ::toolkit::AccessibilityClient maAccFactory
;
230 bool mbDrawingOntoParent
; // no bit mask, is passed around by reference
231 sal_Bool mbEnableVisible
;
232 sal_Bool mbDirectVisible
;
234 ::osl::Mutex maListenerContainerMutex
;
235 ::cppu::OInterfaceContainerHelper maWindow2Listeners
;
236 ::cppu::OInterfaceContainerHelper maDockableWindowListeners
;
237 EventListenerMultiplexer maEventListeners
;
238 FocusListenerMultiplexer maFocusListeners
;
239 WindowListenerMultiplexer maWindowListeners
;
240 KeyListenerMultiplexer maKeyListeners
;
241 MouseListenerMultiplexer maMouseListeners
;
242 MouseMotionListenerMultiplexer maMouseMotionListeners
;
243 PaintListenerMultiplexer maPaintListeners
;
244 VclContainerListenerMultiplexer maContainerListeners
;
245 TopWindowListenerMultiplexer maTopWindowListeners
;
251 bool mbDisposing
: 1;
252 bool mbDesignMode
: 1;
253 bool mbSynthesizingVCLEvent
: 1;
254 bool mbWithDefaultProps
: 1;
256 ULONG mnListenerLockLevel
;
257 sal_Int16 mnWritingMode
;
258 sal_Int16 mnContextWritingMode
;
260 UnoPropertyArrayHelper
* mpPropHelper
;
262 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPointer
>
264 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
>
266 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>
270 bool& getDrawingOntoParent_ref() { return mbDrawingOntoParent
; }
275 the <type>VCLXWindow</type> instance which the object belongs to. Must
276 live longer then the object just being constructed.
278 VCLXWindowImpl( VCLXWindow
& _rAntiImpl
, ::vos::IMutex
& _rMutex
, bool _bWithDefaultProps
);
280 /** synchronously mbEnableVisible
282 void setEnableVisible( sal_Bool bEnableVisible
) { mbEnableVisible
= bEnableVisible
; }
283 sal_Bool
isEnableVisible() { return mbEnableVisible
; }
284 /** synchronously mbDirectVisible;
286 void setDirectVisible( sal_Bool bDirectVisible
) { mbDirectVisible
= bDirectVisible
; }
287 sal_Bool
isDirectVisible() { return mbDirectVisible
; }
289 /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners
291 void notifyMouseEvent( const awt::MouseEvent
& _rMouseEvent
, MouseEventType _nType
);
293 /** asynchronously notifies an event described by an EventObject to the respective listeners
295 void notifyPlainEvent( const lang::EventObject
& _rPlainEvent
, PlainEventType _nType
);
297 /** notifies the object that its VCLXWindow is being disposed
301 inline ::toolkit::AccessibilityClient
& getAccessibleFactory()
306 /** returns the container of registered XWindowListener2 listeners
308 inline ::cppu::OInterfaceContainerHelper
& getWindow2Listeners() { return maWindow2Listeners
; }
309 inline ::cppu::OInterfaceContainerHelper
& getDockableWindowListeners(){ return maDockableWindowListeners
; }
310 inline EventListenerMultiplexer
& getEventListeners() { return maEventListeners
; }
311 inline FocusListenerMultiplexer
& getFocusListeners() { return maFocusListeners
; }
312 inline WindowListenerMultiplexer
& getWindowListeners() { return maWindowListeners
; }
313 inline KeyListenerMultiplexer
& getKeyListeners() { return maKeyListeners
; }
314 inline MouseListenerMultiplexer
& getMouseListeners() { return maMouseListeners
; }
315 inline MouseMotionListenerMultiplexer
& getMouseMotionListeners() { return maMouseMotionListeners
; }
316 inline PaintListenerMultiplexer
& getPaintListeners() { return maPaintListeners
; }
317 inline VclContainerListenerMultiplexer
& getContainerListeners() { return maContainerListeners
; }
318 inline TopWindowListenerMultiplexer
& getTopWindowListeners() { return maTopWindowListeners
; }
320 virtual ~VCLXWindowImpl();
323 virtual void SAL_CALL
acquire();
324 virtual void SAL_CALL
release();
327 virtual void processEvent( const ::comphelper::AnyEvent
& _rEvent
);
330 DECL_LINK( OnProcessEvent
, void* );
333 /** notifies an arbitrary event
337 void impl_notifyAnyEvent(
338 const ::rtl::Reference
< ::comphelper::AnyEvent
>& _rEvent
342 /** determines whether the instance is already disposed
344 m_aMutex must be acquired
346 inline bool impl_isDisposed()
352 VCLXWindowImpl(); // never implemented
353 VCLXWindowImpl( const VCLXWindowImpl
& ); // never implemented
354 VCLXWindowImpl
& operator=( const VCLXWindowImpl
& ); // never implemented
357 //--------------------------------------------------------------------
358 VCLXWindowImpl::VCLXWindowImpl( VCLXWindow
& _rAntiImpl
, ::vos::IMutex
& _rMutex
, bool _bWithDefaultProps
)
359 :mrAntiImpl( _rAntiImpl
)
362 ,mbDrawingOntoParent( false )
363 ,mbEnableVisible(sal_True
)
364 ,mbDirectVisible(sal_True
)
365 ,maListenerContainerMutex( )
366 ,maWindow2Listeners( maListenerContainerMutex
)
367 ,maDockableWindowListeners( maListenerContainerMutex
)
368 ,maEventListeners( _rAntiImpl
)
369 ,maFocusListeners( _rAntiImpl
)
370 ,maWindowListeners( _rAntiImpl
)
371 ,maKeyListeners( _rAntiImpl
)
372 ,maMouseListeners( _rAntiImpl
)
373 ,maMouseMotionListeners( _rAntiImpl
)
374 ,maPaintListeners( _rAntiImpl
)
375 ,maContainerListeners( _rAntiImpl
)
376 ,maTopWindowListeners( _rAntiImpl
)
378 ,mbDisposing( false )
379 ,mbDesignMode( false )
380 ,mbSynthesizingVCLEvent( false )
381 ,mbWithDefaultProps( _bWithDefaultProps
)
382 ,mnListenerLockLevel( 0 )
383 ,mnWritingMode( WritingMode2::CONTEXT
)
384 ,mnContextWritingMode( WritingMode2::CONTEXT
)
385 ,mpPropHelper( NULL
)
389 VCLXWindowImpl::~VCLXWindowImpl()
394 //--------------------------------------------------------------------
395 void VCLXWindowImpl::disposing()
397 ::vos::OGuard
aGuard( mrMutex
);
399 Application::RemoveUserEvent( mnEventId
);
403 ::com::sun::star::lang::EventObject aEvent
;
404 aEvent
.Source
= mrAntiImpl
;
406 maEventListeners
.disposeAndClear( aEvent
);
407 maFocusListeners
.disposeAndClear( aEvent
);
408 maWindowListeners
.disposeAndClear( aEvent
);
409 maKeyListeners
.disposeAndClear( aEvent
);
410 maMouseListeners
.disposeAndClear( aEvent
);
411 maMouseMotionListeners
.disposeAndClear( aEvent
);
412 maPaintListeners
.disposeAndClear( aEvent
);
413 maContainerListeners
.disposeAndClear( aEvent
);
414 maTopWindowListeners
.disposeAndClear( aEvent
);
418 //--------------------------------------------------------------------
419 void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference
< ::comphelper::AnyEvent
>& _rEvent
)
421 maEvents
.push_back( _rEvent
);
423 mnEventId
= Application::PostUserEvent( LINK( this, VCLXWindowImpl
, OnProcessEvent
) );
426 //--------------------------------------------------------------------
427 void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent
& _rMouseEvent
, MouseEventType _nType
)
429 ::vos::OClearableGuard
aGuard( mrMutex
);
430 if ( maMouseListeners
.getLength() )
431 impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent
, _nType
) );
434 //--------------------------------------------------------------------
435 void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject
& _rPlainEvent
, PlainEventType _nType
)
437 ::vos::OClearableGuard
aGuard( mrMutex
);
438 if ( maWindow2Listeners
.getLength() )
439 impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent
, _nType
) );
442 //--------------------------------------------------------------------
443 IMPL_LINK( VCLXWindowImpl
, OnProcessEvent
, void*, EMPTYARG
)
445 // work on a copy of the events array
446 EventArray aEventsCopy
;
448 ::vos::OGuard
aGuard( mrMutex
);
449 aEventsCopy
= maEvents
;
453 // we were disposed while waiting for the mutex to lock
460 ::toolkit::ReleaseSolarMutex aReleaseSolar
;
461 for ( EventArray::const_iterator loop
= aEventsCopy
.begin();
462 loop
!= aEventsCopy
.end();
466 processEvent( *(*loop
) );
473 //--------------------------------------------------------------------
474 void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent
& _rEvent
)
476 ::vos::OGuard
aGuard( mrMutex
);
477 if ( impl_isDisposed() )
478 // while we were waiting for our mutex, another thread disposed us
481 const AnyWindowEvent
& rEventDescriptor( static_cast< const AnyWindowEvent
& >( _rEvent
) );
482 if ( rEventDescriptor
.isMouseEvent() )
484 const awt::MouseEvent
& rEvent( rEventDescriptor
.getMouseEvent() );
485 switch ( rEventDescriptor
.getMouseEventType() )
487 case EVENT_MOUSE_PRESSED
:
488 maMouseListeners
.mousePressed( rEvent
);
490 case EVENT_MOUSE_RELEASED
:
491 maMouseListeners
.mouseReleased( rEvent
);
493 case EVENT_MOUSE_ENTERED
:
494 maMouseListeners
.mouseEntered( rEvent
);
496 case EVENT_MOUSE_EXITED
:
497 maMouseListeners
.mouseExited( rEvent
);
500 DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" );
504 else if ( rEventDescriptor
.isPlainEvent() )
506 const lang::EventObject
& rEvent( rEventDescriptor
.getPlainEvent() );
507 switch ( rEventDescriptor
.getPlainEventType() )
509 case EVENT_WINDOW_ENABLED
:
510 maWindow2Listeners
.notifyEach( &XWindowListener2::windowEnabled
, rEvent
);
512 case EVENT_WINDOW_DISABLED
:
513 maWindow2Listeners
.notifyEach( &XWindowListener2::windowDisabled
, rEvent
);
516 DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" );
522 DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (3)?" );
526 //--------------------------------------------------------------------
527 void SAL_CALL
VCLXWindowImpl::acquire()
529 mrAntiImpl
.acquire();
532 //--------------------------------------------------------------------
533 void SAL_CALL
VCLXWindowImpl::release()
535 mrAntiImpl
.release();
538 //====================================================================
539 //====================================================================
541 // Mit Out-Parameter besser als Rueckgabewert, wegen Ref-Objekt...
543 void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent
& rEvent
, Window
* pWindow
)
545 Point aPos
= pWindow
->GetPosPixel();
546 Size aSz
= pWindow
->GetSizePixel();
551 rEvent
.Width
= aSz
.Width();
552 rEvent
.Height
= aSz
.Height();
554 pWindow
->GetBorder( rEvent
.LeftInset
, rEvent
.TopInset
, rEvent
.RightInset
, rEvent
.BottomInset
);
557 void ImplInitKeyEvent( ::com::sun::star::awt::KeyEvent
& rEvent
, const KeyEvent
& rEvt
)
559 rEvent
.Modifiers
= 0;
560 if ( rEvt
.GetKeyCode().IsShift() )
561 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::SHIFT
;
562 if ( rEvt
.GetKeyCode().IsMod1() )
563 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD1
;
564 if ( rEvt
.GetKeyCode().IsMod2() )
565 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD2
;
566 if ( rEvt
.GetKeyCode().IsMod3() )
567 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD3
;
569 rEvent
.KeyCode
= rEvt
.GetKeyCode().GetCode();
570 rEvent
.KeyChar
= rEvt
.GetCharCode();
571 rEvent
.KeyFunc
= sal::static_int_cast
< sal_Int16
>(
572 rEvt
.GetKeyCode().GetFunction());
575 void ImplInitMouseEvent( awt::MouseEvent
& rEvent
, const MouseEvent
& rEvt
)
577 rEvent
.Modifiers
= 0;
578 if ( rEvt
.IsShift() )
579 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::SHIFT
;
581 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD1
;
583 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD2
;
587 rEvent
.Buttons
|= ::com::sun::star::awt::MouseButton::LEFT
;
588 if ( rEvt
.IsRight() )
589 rEvent
.Buttons
|= ::com::sun::star::awt::MouseButton::RIGHT
;
590 if ( rEvt
.IsMiddle() )
591 rEvent
.Buttons
|= ::com::sun::star::awt::MouseButton::MIDDLE
;
593 rEvent
.X
= rEvt
.GetPosPixel().X();
594 rEvent
.Y
= rEvt
.GetPosPixel().Y();
595 rEvent
.ClickCount
= rEvt
.GetClicks();
596 rEvent
.PopupTrigger
= sal_False
;
599 // ----------------------------------------------------
601 // ----------------------------------------------------
603 DBG_NAME(VCLXWindow
);
605 VCLXWindow::VCLXWindow( bool _bWithDefaultProps
)
608 DBG_CTOR( VCLXWindow
, 0 );
610 mpImpl
= new VCLXWindowImpl( *this, GetMutex(), _bWithDefaultProps
);
613 VCLXWindow::~VCLXWindow()
615 DBG_DTOR( VCLXWindow
, 0 );
621 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
622 GetWindow()->SetWindowPeer( NULL
, NULL
);
623 GetWindow()->SetAccessible( NULL
);
627 ::toolkit::IAccessibleFactory
& VCLXWindow::getAccessibleFactory()
629 return mpImpl
->getAccessibleFactory().getFactory();
632 void VCLXWindow::SetWindow( Window
* pWindow
)
636 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
637 // GetWindow()->DbgAssertNoEventListeners();
640 SetOutputDevice( pWindow
);
644 GetWindow()->AddEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
645 sal_Bool bDirectVisible
= pWindow
? pWindow
->IsVisible() : false;
646 mpImpl
->setDirectVisible( bDirectVisible
);
651 void VCLXWindow::suspendVclEventListening( )
653 ++mpImpl
->mnListenerLockLevel
;
656 void VCLXWindow::resumeVclEventListening( )
658 DBG_ASSERT( mpImpl
->mnListenerLockLevel
, "VCLXWindow::resumeVclEventListening: not suspended!" );
659 --mpImpl
->mnListenerLockLevel
;
662 void VCLXWindow::notifyWindowRemoved( Window
& _rWindow
)
664 if ( mpImpl
->getContainerListeners().getLength() )
666 awt::VclContainerEvent aEvent
;
667 aEvent
.Source
= *this;
668 aEvent
.Child
= static_cast< XWindow
* >( _rWindow
.GetWindowPeer() );
669 mpImpl
->getContainerListeners().windowRemoved( aEvent
);
673 IMPL_LINK( VCLXWindow
, WindowEventListener
, VclSimpleEvent
*, pEvent
)
675 if ( mpImpl
->mnListenerLockLevel
)
678 DBG_ASSERT( pEvent
&& pEvent
->ISA( VclWindowEvent
), "Unknown WindowEvent!" );
679 if ( pEvent
&& pEvent
->ISA( VclWindowEvent
) )
681 DBG_ASSERT( ((VclWindowEvent
*)pEvent
)->GetWindow() && GetWindow(), "Window???" );
682 ProcessWindowEvent( *(VclWindowEvent
*)pEvent
);
687 void VCLXWindow::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
689 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xThis( (::cppu::OWeakObject
*)this );
691 switch ( rVclWindowEvent
.GetId() )
693 case VCLEVENT_WINDOW_ENABLED
:
694 case VCLEVENT_WINDOW_DISABLED
:
696 bool bEnabled
= ( VCLEVENT_WINDOW_ENABLED
== rVclWindowEvent
.GetId() );
697 EventObject
aEvent( *this );
698 mpImpl
->notifyPlainEvent( aEvent
,
699 bEnabled
? EVENT_WINDOW_ENABLED
: EVENT_WINDOW_DISABLED
);
703 case VCLEVENT_WINDOW_PAINT
:
705 if ( mpImpl
->getPaintListeners().getLength() )
707 ::com::sun::star::awt::PaintEvent aEvent
;
708 aEvent
.Source
= (::cppu::OWeakObject
*)this;
709 aEvent
.UpdateRect
= AWTRectangle( *(Rectangle
*)rVclWindowEvent
.GetData() );
711 mpImpl
->getPaintListeners().windowPaint( aEvent
);
715 case VCLEVENT_WINDOW_MOVE
:
717 if ( mpImpl
->getWindowListeners().getLength() )
719 ::com::sun::star::awt::WindowEvent aEvent
;
720 aEvent
.Source
= (::cppu::OWeakObject
*)this;
721 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
722 mpImpl
->getWindowListeners().windowMoved( aEvent
);
726 case VCLEVENT_WINDOW_RESIZE
:
728 if ( mpImpl
->getWindowListeners().getLength() )
730 ::com::sun::star::awt::WindowEvent aEvent
;
731 aEvent
.Source
= (::cppu::OWeakObject
*)this;
732 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
733 mpImpl
->getWindowListeners().windowResized( aEvent
);
737 case VCLEVENT_WINDOW_SHOW
:
739 if ( mpImpl
->getWindowListeners().getLength() )
741 ::com::sun::star::awt::WindowEvent aEvent
;
742 aEvent
.Source
= (::cppu::OWeakObject
*)this;
743 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
744 mpImpl
->getWindowListeners().windowShown( aEvent
);
747 // For TopWindows this means opened...
748 if ( mpImpl
->getTopWindowListeners().getLength() )
750 ::com::sun::star::lang::EventObject aEvent
;
751 aEvent
.Source
= (::cppu::OWeakObject
*)this;
752 mpImpl
->getTopWindowListeners().windowOpened( aEvent
);
756 case VCLEVENT_WINDOW_HIDE
:
758 if ( mpImpl
->getWindowListeners().getLength() )
760 ::com::sun::star::awt::WindowEvent aEvent
;
761 aEvent
.Source
= (::cppu::OWeakObject
*)this;
762 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
763 mpImpl
->getWindowListeners().windowHidden( aEvent
);
766 // For TopWindows this means closed...
767 if ( mpImpl
->getTopWindowListeners().getLength() )
769 ::com::sun::star::lang::EventObject aEvent
;
770 aEvent
.Source
= (::cppu::OWeakObject
*)this;
771 mpImpl
->getTopWindowListeners().windowClosed( aEvent
);
775 case VCLEVENT_WINDOW_ACTIVATE
:
777 if ( mpImpl
->getTopWindowListeners().getLength() )
779 ::com::sun::star::lang::EventObject aEvent
;
780 aEvent
.Source
= (::cppu::OWeakObject
*)this;
781 mpImpl
->getTopWindowListeners().windowActivated( aEvent
);
785 case VCLEVENT_WINDOW_DEACTIVATE
:
787 if ( mpImpl
->getTopWindowListeners().getLength() )
789 ::com::sun::star::lang::EventObject aEvent
;
790 aEvent
.Source
= (::cppu::OWeakObject
*)this;
791 mpImpl
->getTopWindowListeners().windowDeactivated( aEvent
);
795 case VCLEVENT_WINDOW_CLOSE
:
797 if ( mpImpl
->getDockableWindowListeners().getLength() )
799 ::com::sun::star::lang::EventObject aEvent
;
800 aEvent
.Source
= (::cppu::OWeakObject
*)this;
801 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed
, aEvent
);
803 if ( mpImpl
->getTopWindowListeners().getLength() )
805 ::com::sun::star::lang::EventObject aEvent
;
806 aEvent
.Source
= (::cppu::OWeakObject
*)this;
807 mpImpl
->getTopWindowListeners().windowClosing( aEvent
);
811 case VCLEVENT_CONTROL_GETFOCUS
:
812 case VCLEVENT_WINDOW_GETFOCUS
:
814 if ( ( rVclWindowEvent
.GetWindow()->IsCompoundControl()
815 && rVclWindowEvent
.GetId() == VCLEVENT_CONTROL_GETFOCUS
817 || ( !rVclWindowEvent
.GetWindow()->IsCompoundControl()
818 && rVclWindowEvent
.GetId() == VCLEVENT_WINDOW_GETFOCUS
822 if ( mpImpl
->getFocusListeners().getLength() )
824 ::com::sun::star::awt::FocusEvent aEvent
;
825 aEvent
.Source
= (::cppu::OWeakObject
*)this;
826 aEvent
.FocusFlags
= rVclWindowEvent
.GetWindow()->GetGetFocusFlags();
827 aEvent
.Temporary
= sal_False
;
828 mpImpl
->getFocusListeners().focusGained( aEvent
);
833 case VCLEVENT_CONTROL_LOSEFOCUS
:
834 case VCLEVENT_WINDOW_LOSEFOCUS
:
836 if ( ( rVclWindowEvent
.GetWindow()->IsCompoundControl()
837 && rVclWindowEvent
.GetId() == VCLEVENT_CONTROL_LOSEFOCUS
839 || ( !rVclWindowEvent
.GetWindow()->IsCompoundControl()
840 && rVclWindowEvent
.GetId() == VCLEVENT_WINDOW_LOSEFOCUS
844 if ( mpImpl
->getFocusListeners().getLength() )
846 ::com::sun::star::awt::FocusEvent aEvent
;
847 aEvent
.Source
= (::cppu::OWeakObject
*)this;
848 aEvent
.FocusFlags
= rVclWindowEvent
.GetWindow()->GetGetFocusFlags();
849 aEvent
.Temporary
= sal_False
;
851 Window
* pNext
= Application::GetFocusWindow();
854 // Bei zusammengesetzten Controls interessiert sich keiner fuer das Innenleben:
855 Window
* pNextC
= pNext
;
856 while ( pNextC
&& !pNextC
->IsCompoundControl() )
857 pNextC
= pNextC
->GetParent();
861 pNext
->GetComponentInterface( sal_True
);
862 aEvent
.NextFocus
= (::cppu::OWeakObject
*)pNext
->GetWindowPeer();
864 mpImpl
->getFocusListeners().focusLost( aEvent
);
869 case VCLEVENT_WINDOW_MINIMIZE
:
871 if ( mpImpl
->getTopWindowListeners().getLength() )
873 ::com::sun::star::lang::EventObject aEvent
;
874 aEvent
.Source
= (::cppu::OWeakObject
*)this;
875 mpImpl
->getTopWindowListeners().windowMinimized( aEvent
);
879 case VCLEVENT_WINDOW_NORMALIZE
:
881 if ( mpImpl
->getTopWindowListeners().getLength() )
883 ::com::sun::star::lang::EventObject aEvent
;
884 aEvent
.Source
= (::cppu::OWeakObject
*)this;
885 mpImpl
->getTopWindowListeners().windowNormalized( aEvent
);
889 case VCLEVENT_WINDOW_KEYINPUT
:
891 if ( mpImpl
->getKeyListeners().getLength() )
893 ::com::sun::star::awt::KeyEvent aEvent
;
894 aEvent
.Source
= (::cppu::OWeakObject
*)this;
895 ImplInitKeyEvent( aEvent
, *(KeyEvent
*)rVclWindowEvent
.GetData() );
896 mpImpl
->getKeyListeners().keyPressed( aEvent
);
900 case VCLEVENT_WINDOW_KEYUP
:
902 if ( mpImpl
->getKeyListeners().getLength() )
904 ::com::sun::star::awt::KeyEvent aEvent
;
905 aEvent
.Source
= (::cppu::OWeakObject
*)this;
906 ImplInitKeyEvent( aEvent
, *(KeyEvent
*)rVclWindowEvent
.GetData() );
907 mpImpl
->getKeyListeners().keyReleased( aEvent
);
911 case VCLEVENT_WINDOW_COMMAND
:
913 CommandEvent
* pCmdEvt
= (CommandEvent
*)rVclWindowEvent
.GetData();
914 if ( mpImpl
->getMouseListeners().getLength() && ( pCmdEvt
->GetCommand() == COMMAND_CONTEXTMENU
) )
916 // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
917 Point aWhere
= static_cast< CommandEvent
* >( rVclWindowEvent
.GetData() )->GetMousePosPixel();
918 if ( !pCmdEvt
->IsMouseEvent() )
919 { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
920 // handles a context menu command as special case of a mouse event, which is simply wrong.
921 // Without extending the API, we would not have another chance to notify listeners of a
922 // keyboard-triggered context menu request
923 // 102205 - 16.08.2002 - fs@openoffice.org
924 aWhere
= Point( -1, -1 );
927 MouseEvent
aMEvt( aWhere
, 1, MOUSE_SIMPLECLICK
, MOUSE_LEFT
, 0 );
928 awt::MouseEvent aEvent
;
929 aEvent
.Source
= (::cppu::OWeakObject
*)this;
930 ImplInitMouseEvent( aEvent
, aMEvt
);
931 aEvent
.PopupTrigger
= sal_True
;
932 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_PRESSED
);
936 case VCLEVENT_WINDOW_MOUSEMOVE
:
938 MouseEvent
* pMouseEvt
= (MouseEvent
*)rVclWindowEvent
.GetData();
939 if ( mpImpl
->getMouseListeners().getLength() && ( pMouseEvt
->IsEnterWindow() || pMouseEvt
->IsLeaveWindow() ) )
941 awt::MouseEvent aEvent
;
942 aEvent
.Source
= (::cppu::OWeakObject
*)this;
943 ImplInitMouseEvent( aEvent
, *pMouseEvt
);
945 mpImpl
->notifyMouseEvent(
947 pMouseEvt
->IsEnterWindow() ? EVENT_MOUSE_ENTERED
: EVENT_MOUSE_EXITED
951 if ( mpImpl
->getMouseMotionListeners().getLength() && !pMouseEvt
->IsEnterWindow() && !pMouseEvt
->IsLeaveWindow() )
953 awt::MouseEvent aEvent
;
954 aEvent
.Source
= (::cppu::OWeakObject
*)this;
955 ImplInitMouseEvent( aEvent
, *pMouseEvt
);
956 aEvent
.ClickCount
= 0; // #92138#
958 if ( pMouseEvt
->GetMode() & MOUSE_SIMPLEMOVE
)
959 mpImpl
->getMouseMotionListeners().mouseMoved( aEvent
);
961 mpImpl
->getMouseMotionListeners().mouseDragged( aEvent
);
965 case VCLEVENT_WINDOW_MOUSEBUTTONDOWN
:
967 if ( mpImpl
->getMouseListeners().getLength() )
969 awt::MouseEvent aEvent
;
970 aEvent
.Source
= (::cppu::OWeakObject
*)this;
971 ImplInitMouseEvent( aEvent
, *(MouseEvent
*)rVclWindowEvent
.GetData() );
972 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_PRESSED
);
976 case VCLEVENT_WINDOW_MOUSEBUTTONUP
:
978 if ( mpImpl
->getMouseListeners().getLength() )
980 awt::MouseEvent aEvent
;
981 aEvent
.Source
= (::cppu::OWeakObject
*)this;
982 ImplInitMouseEvent( aEvent
, *(MouseEvent
*)rVclWindowEvent
.GetData() );
983 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_RELEASED
);
987 case VCLEVENT_WINDOW_STARTDOCKING
:
989 if ( mpImpl
->getDockableWindowListeners().getLength() )
991 DockingData
*pData
= (DockingData
*)rVclWindowEvent
.GetData();
995 ::com::sun::star::awt::DockingEvent aEvent
;
996 aEvent
.Source
= (::cppu::OWeakObject
*)this;
997 aEvent
.TrackingRectangle
= AWTRectangle( pData
->maTrackRect
);
998 aEvent
.MousePos
.X
= pData
->maMousePos
.X();
999 aEvent
.MousePos
.Y
= pData
->maMousePos
.Y();
1000 aEvent
.bLiveMode
= pData
->mbLivemode
;
1001 aEvent
.bInteractive
= pData
->mbInteractive
;
1003 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking
, aEvent
);
1008 case VCLEVENT_WINDOW_DOCKING
:
1010 if ( mpImpl
->getDockableWindowListeners().getLength() )
1012 DockingData
*pData
= (DockingData
*)rVclWindowEvent
.GetData();
1016 ::com::sun::star::awt::DockingEvent aEvent
;
1017 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1018 aEvent
.TrackingRectangle
= AWTRectangle( pData
->maTrackRect
);
1019 aEvent
.MousePos
.X
= pData
->maMousePos
.X();
1020 aEvent
.MousePos
.Y
= pData
->maMousePos
.Y();
1021 aEvent
.bLiveMode
= pData
->mbLivemode
;
1022 aEvent
.bInteractive
= pData
->mbInteractive
;
1024 Reference
< XDockableWindowListener
> xFirstListener
;
1025 ::cppu::OInterfaceIteratorHelper
aIter( mpImpl
->getDockableWindowListeners() );
1026 while ( aIter
.hasMoreElements() && !xFirstListener
.is() )
1028 xFirstListener
.set( aIter
.next(), UNO_QUERY
);
1031 ::com::sun::star::awt::DockingData aDockingData
=
1032 xFirstListener
->docking( aEvent
);
1033 pData
->maTrackRect
= VCLRectangle( aDockingData
.TrackingRectangle
);
1034 pData
->mbFloating
= aDockingData
.bFloating
;
1039 case VCLEVENT_WINDOW_ENDDOCKING
:
1041 if ( mpImpl
->getDockableWindowListeners().getLength() )
1043 EndDockingData
*pData
= (EndDockingData
*)rVclWindowEvent
.GetData();
1047 ::com::sun::star::awt::EndDockingEvent aEvent
;
1048 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1049 aEvent
.WindowRectangle
= AWTRectangle( pData
->maWindowRect
);
1050 aEvent
.bFloating
= pData
->mbFloating
;
1051 aEvent
.bCancelled
= pData
->mbCancelled
;
1052 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking
, aEvent
);
1057 case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING
:
1059 if ( mpImpl
->getDockableWindowListeners().getLength() )
1061 BOOL
*p_bFloating
= (BOOL
*)rVclWindowEvent
.GetData();
1063 ::com::sun::star::lang::EventObject aEvent
;
1064 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1066 Reference
< XDockableWindowListener
> xFirstListener
;
1067 ::cppu::OInterfaceIteratorHelper
aIter( mpImpl
->getDockableWindowListeners() );
1068 while ( aIter
.hasMoreElements() && !xFirstListener
.is() )
1070 xFirstListener
.set( aIter
.next(), UNO_QUERY
);
1073 *p_bFloating
= xFirstListener
->prepareToggleFloatingMode( aEvent
);
1077 case VCLEVENT_WINDOW_TOGGLEFLOATING
:
1079 if ( mpImpl
->getDockableWindowListeners().getLength() )
1081 ::com::sun::star::lang::EventObject aEvent
;
1082 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1083 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode
, aEvent
);
1087 case VCLEVENT_WINDOW_ENDPOPUPMODE
:
1089 if ( mpImpl
->getDockableWindowListeners().getLength() )
1091 EndPopupModeData
*pData
= (EndPopupModeData
*)rVclWindowEvent
.GetData();
1095 ::com::sun::star::awt::EndPopupModeEvent aEvent
;
1096 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1097 aEvent
.FloatingPosition
.X
= pData
->maFloatingPos
.X();
1098 aEvent
.FloatingPosition
.Y
= pData
->maFloatingPos
.Y();
1099 aEvent
.bTearoff
= pData
->mbTearoff
;
1100 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode
, aEvent
);
1109 uno::Reference
< accessibility::XAccessibleContext
> VCLXWindow::CreateAccessibleContext()
1111 ::vos::OGuard
aGuard( GetMutex() );
1112 return getAccessibleFactory().createAccessibleContext( this );
1115 void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b
)
1117 mpImpl
->mbSynthesizingVCLEvent
= _b
;
1120 BOOL
VCLXWindow::IsSynthesizingVCLEvent() const
1122 return mpImpl
->mbSynthesizingVCLEvent
;
1125 Size
VCLXWindow::ImplCalcWindowSize( const Size
& rOutSz
) const
1129 Window
* pWindow
= GetWindow();
1132 sal_Int32 nLeft
, nTop
, nRight
, nBottom
;
1133 pWindow
->GetBorder( nLeft
, nTop
, nRight
, nBottom
);
1134 aSz
.Width() += nLeft
+nRight
;
1135 aSz
.Height() += nTop
+nBottom
;
1141 // ::com::sun::star::lang::XUnoTunnel
1142 IMPL_XUNOTUNNEL2( VCLXWindow
, VCLXDevice
)
1144 // ::com::sun::star::lang::Component
1145 void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException
)
1147 ::vos::OGuard
aGuard( GetMutex() );
1149 mpImpl
->mxViewGraphics
= NULL
;
1151 if ( !mpImpl
->mbDisposing
)
1153 mpImpl
->mbDisposing
= true;
1155 mpImpl
->disposing();
1159 OutputDevice
* pOutDev
= GetOutputDevice();
1160 SetWindow( NULL
); // Damit ggf. Handler abgemeldet werden (virtuell).
1161 SetOutputDevice( pOutDev
);
1162 DestroyOutputDevice();
1165 // #i14103# dispose the accessible context after the window has been destroyed,
1166 // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
1167 // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object
1170 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> xComponent( mpImpl
->mxAccessibleContext
, ::com::sun::star::uno::UNO_QUERY
);
1171 if ( xComponent
.is() )
1172 xComponent
->dispose();
1174 catch ( const ::com::sun::star::uno::Exception
& )
1176 DBG_ERROR( "VCLXWindow::dispose: could not dispose the accessible context!" );
1178 mpImpl
->mxAccessibleContext
.clear();
1180 mpImpl
->mbDisposing
= false;
1184 void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1186 ::vos::OGuard
aGuard( GetMutex() );
1188 mpImpl
->getEventListeners().addInterface( rxListener
);
1191 void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1193 ::vos::OGuard
aGuard( GetMutex() );
1195 mpImpl
->getEventListeners().removeInterface( rxListener
);
1199 // ::com::sun::star::awt::XWindow
1200 void VCLXWindow::setPosSize( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, sal_Int16 Flags
) throw(::com::sun::star::uno::RuntimeException
)
1202 ::vos::OGuard
aGuard( GetMutex() );
1206 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1207 Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X
, Y
, Width
, Height
, Flags
);
1209 GetWindow()->SetPosSizePixel( X
, Y
, Width
, Height
, Flags
);
1213 ::com::sun::star::awt::Rectangle
VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException
)
1215 ::vos::OGuard
aGuard( GetMutex() );
1217 ::com::sun::star::awt::Rectangle aBounds
;
1220 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1221 aBounds
= AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
1223 aBounds
= AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
1229 void VCLXWindow::setVisible( sal_Bool bVisible
) throw(::com::sun::star::uno::RuntimeException
)
1231 ::vos::OGuard
aGuard( GetMutex() );
1233 Window
* pWindow
= GetWindow();
1239 // #57167# TopWindows mit unsichtbaren Parent anzeigen...
1240 ::com::sun::star::uno::Any aTest = queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >*) 0 ) );
1241 if ( aTest.hasValue() )
1243 Window* pParent = pWindow->GetWindow( WINDOW_PARENTOVERLAP );
1244 if ( pParent && !pParent->IsReallyVisible() )
1245 pWindow->SetParent( pWindow->GetWindow( WINDOW_FRAME ) );
1249 mpImpl
->setDirectVisible( bVisible
);
1250 pWindow
->Show( bVisible
&& mpImpl
->isEnableVisible() );
1254 void VCLXWindow::setEnable( sal_Bool bEnable
) throw(::com::sun::star::uno::RuntimeException
)
1256 ::vos::OGuard
aGuard( GetMutex() );
1258 Window
* pWindow
= GetWindow();
1261 pWindow
->Enable( bEnable
, FALSE
); // #95824# without children!
1262 pWindow
->EnableInput( bEnable
);
1266 void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException
)
1268 ::vos::OGuard
aGuard( GetMutex() );
1271 GetWindow()->GrabFocus();
1274 void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1276 ::vos::OGuard
aGuard( GetMutex() );
1278 mpImpl
->getWindowListeners().addInterface( rxListener
);
1280 Reference
< XWindowListener2
> xListener2( rxListener
, UNO_QUERY
);
1281 if ( xListener2
.is() )
1282 mpImpl
->getWindow2Listeners().addInterface( xListener2
);
1284 // #100119# Get all resize events, even if height or width 0, or invisible
1286 GetWindow()->EnableAllResize( TRUE
);
1289 void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1291 ::vos::OGuard
aGuard( GetMutex() );
1293 Reference
< XWindowListener2
> xListener2( rxListener
, UNO_QUERY
);
1294 if ( xListener2
.is() )
1295 mpImpl
->getWindow2Listeners().removeInterface( xListener2
);
1297 mpImpl
->getWindowListeners().removeInterface( rxListener
);
1300 void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFocusListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1302 ::vos::OGuard
aGuard( GetMutex() );
1303 mpImpl
->getFocusListeners().addInterface( rxListener
);
1306 void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFocusListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1308 ::vos::OGuard
aGuard( GetMutex() );
1309 mpImpl
->getFocusListeners().removeInterface( rxListener
);
1312 void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XKeyListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1314 ::vos::OGuard
aGuard( GetMutex() );
1315 mpImpl
->getKeyListeners().addInterface( rxListener
);
1318 void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XKeyListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1320 ::vos::OGuard
aGuard( GetMutex() );
1321 mpImpl
->getKeyListeners().removeInterface( rxListener
);
1324 void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1326 ::vos::OGuard
aGuard( GetMutex() );
1327 mpImpl
->getMouseListeners().addInterface( rxListener
);
1330 void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1332 ::vos::OGuard
aGuard( GetMutex() );
1333 mpImpl
->getMouseListeners().removeInterface( rxListener
);
1336 void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseMotionListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1338 ::vos::OGuard
aGuard( GetMutex() );
1339 mpImpl
->getMouseMotionListeners().addInterface( rxListener
);
1342 void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseMotionListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1344 ::vos::OGuard
aGuard( GetMutex() );
1345 mpImpl
->getMouseMotionListeners().removeInterface( rxListener
);
1348 void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPaintListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1350 ::vos::OGuard
aGuard( GetMutex() );
1351 mpImpl
->getPaintListeners().addInterface( rxListener
);
1354 void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPaintListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1356 ::vos::OGuard
aGuard( GetMutex() );
1357 mpImpl
->getPaintListeners().removeInterface( rxListener
);
1360 // ::com::sun::star::awt::XWindowPeer
1361 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
> VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException
)
1363 // no guard. nothing to guard here.
1364 // 82463 - 12/21/00 - fs
1365 return Application::GetVCLToolkit();
1368 void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPointer
>& rxPointer
) throw(::com::sun::star::uno::RuntimeException
)
1370 ::vos::OGuard
aGuard( GetMutex() );
1372 VCLXPointer
* pPointer
= VCLXPointer::GetImplementation( rxPointer
);
1375 mpImpl
->mxPointer
= rxPointer
;
1377 GetWindow()->SetPointer( pPointer
->GetPointer() );
1381 void VCLXWindow::setBackground( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
1383 ::vos::OGuard
aGuard( GetMutex() );
1387 Color
aColor( (sal_uInt32
)nColor
);
1388 GetWindow()->SetBackground( aColor
);
1389 GetWindow()->SetControlBackground( aColor
);
1391 WindowType eWinType
= GetWindow()->GetType();
1392 if ( ( eWinType
== WINDOW_WINDOW
) ||
1393 ( eWinType
== WINDOW_WORKWINDOW
) ||
1394 ( eWinType
== WINDOW_FLOATINGWINDOW
) )
1396 GetWindow()->Invalidate();
1401 void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags
) throw(::com::sun::star::uno::RuntimeException
)
1403 ::vos::OGuard
aGuard( GetMutex() );
1406 GetWindow()->Invalidate( (sal_uInt16
) nInvalidateFlags
);
1409 void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle
& rRect
, sal_Int16 nInvalidateFlags
) throw(::com::sun::star::uno::RuntimeException
)
1411 ::vos::OGuard
aGuard( GetMutex() );
1414 GetWindow()->Invalidate( VCLRectangle(rRect
), (sal_uInt16
) nInvalidateFlags
);
1418 // ::com::sun::star::awt::XVclWindowPeer
1419 sal_Bool
VCLXWindow::isChild( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& rxPeer
) throw(::com::sun::star::uno::RuntimeException
)
1421 ::vos::OGuard
aGuard( GetMutex() );
1423 sal_Bool bIsChild
= sal_False
;
1424 Window
* pWindow
= GetWindow();
1427 Window
* pPeerWindow
= VCLUnoHelper::GetWindow( rxPeer
);
1428 bIsChild
= pPeerWindow
&& pWindow
->IsChild( pPeerWindow
);
1434 void VCLXWindow::setDesignMode( sal_Bool bOn
) throw(::com::sun::star::uno::RuntimeException
)
1436 ::vos::OGuard
aGuard( GetMutex() );
1438 mpImpl
->mbDesignMode
= bOn
;
1441 sal_Bool
VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException
)
1443 ::vos::OGuard
aGuard( GetMutex() );
1444 return mpImpl
->mbDesignMode
;
1447 void VCLXWindow::enableClipSiblings( sal_Bool bClip
) throw(::com::sun::star::uno::RuntimeException
)
1449 ::vos::OGuard
aGuard( GetMutex() );
1452 GetWindow()->EnableClipSiblings( bClip
);
1455 void VCLXWindow::setForeground( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
1457 ::vos::OGuard
aGuard( GetMutex() );
1461 Color
aColor( (sal_uInt32
)nColor
);
1462 GetWindow()->SetControlForeground( aColor
);
1466 void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor
& rFont
) throw(::com::sun::star::uno::RuntimeException
)
1468 ::vos::OGuard
aGuard( GetMutex() );
1471 GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont
, GetWindow()->GetControlFont() ) );
1474 void VCLXWindow::getStyles( sal_Int16 nType
, ::com::sun::star::awt::FontDescriptor
& Font
, sal_Int32
& ForegroundColor
, sal_Int32
& BackgroundColor
) throw(::com::sun::star::uno::RuntimeException
)
1476 ::vos::OGuard
aGuard( GetMutex() );
1480 const StyleSettings
& rStyleSettings
= GetWindow()->GetSettings().GetStyleSettings();
1484 case ::com::sun::star::awt::Style::FRAME
:
1486 Font
= VCLUnoHelper::CreateFontDescriptor( rStyleSettings
.GetAppFont() );
1487 ForegroundColor
= rStyleSettings
.GetWindowTextColor().GetColor();
1488 BackgroundColor
= rStyleSettings
.GetWindowColor().GetColor();
1491 case ::com::sun::star::awt::Style::DIALOG
:
1493 Font
= VCLUnoHelper::CreateFontDescriptor( rStyleSettings
.GetAppFont() );
1494 ForegroundColor
= rStyleSettings
.GetDialogTextColor().GetColor();
1495 BackgroundColor
= rStyleSettings
.GetDialogColor().GetColor();
1498 default: DBG_ERROR( "VCLWindow::getStyles() - unknown Type" );
1506 static void setColorSettings( Window
* _pWindow
, const ::com::sun::star::uno::Any
& _rValue
,
1507 void (StyleSettings::*pSetter
)( const Color
& ), const Color
& (StyleSettings::*pGetter
)( ) const )
1509 sal_Int32 nColor
= 0;
1510 if ( !( _rValue
>>= nColor
) )
1511 nColor
= (Application::GetSettings().GetStyleSettings().*pGetter
)().GetColor();
1513 AllSettings aSettings
= _pWindow
->GetSettings();
1514 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
1516 (aStyleSettings
.*pSetter
)( Color( nColor
) );
1518 aSettings
.SetStyleSettings( aStyleSettings
);
1519 _pWindow
->SetSettings( aSettings
, TRUE
);
1523 // Terminated by BASEPROPERTY_NOTFOUND (or 0)
1524 void VCLXWindow::PushPropertyIds( std::list
< sal_uInt16
> &rIds
,
1528 va_start( pVarArgs
, nFirstId
);
1530 for ( int nId
= nFirstId
; nId
!= BASEPROPERTY_NOTFOUND
;
1531 nId
= va_arg( pVarArgs
, int ) )
1532 rIds
.push_back( (sal_uInt16
) nId
);
1537 void VCLXWindow::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
, bool bWithDefaults
)
1539 // These are common across ~all VCLXWindow derived classes
1541 PushPropertyIds( rIds
,
1543 BASEPROPERTY_BACKGROUNDCOLOR
,
1544 BASEPROPERTY_BORDER
,
1545 BASEPROPERTY_BORDERCOLOR
,
1546 BASEPROPERTY_DEFAULTCONTROL
,
1547 BASEPROPERTY_ENABLED
,
1548 BASEPROPERTY_FONTDESCRIPTOR
,
1549 BASEPROPERTY_HELPTEXT
,
1550 BASEPROPERTY_HELPURL
,
1552 BASEPROPERTY_PRINTABLE
,
1553 BASEPROPERTY_ENABLEVISIBLE
, // for visibility
1554 BASEPROPERTY_TABSTOP
,
1557 // lovely hack from:
1558 // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
1559 std::list
< sal_uInt16
>::const_iterator iter
;
1560 for( iter
= rIds
.begin(); iter
!= rIds
.end(); iter
++) {
1561 if( *iter
== BASEPROPERTY_FONTDESCRIPTOR
)
1563 // some properties are not included in the FontDescriptor, but everytime
1564 // when we have a FontDescriptor we want to have these properties too.
1565 // => Easier to register the here, istead everywhere where I register the FontDescriptor...
1567 rIds
.push_back( BASEPROPERTY_TEXTCOLOR
);
1568 rIds
.push_back( BASEPROPERTY_TEXTLINECOLOR
);
1569 rIds
.push_back( BASEPROPERTY_FONTRELIEF
);
1570 rIds
.push_back( BASEPROPERTY_FONTEMPHASISMARK
);
1576 void VCLXWindow::GetPropertyIds( std::list
< sal_uInt16
>& _out_rIds
)
1578 return ImplGetPropertyIds( _out_rIds
, mpImpl
->mbWithDefaultProps
);
1581 ::cppu::OInterfaceContainerHelper
& VCLXWindow::GetContainerListeners()
1583 return mpImpl
->getContainerListeners();
1586 ::cppu::OInterfaceContainerHelper
& VCLXWindow::GetTopWindowListeners()
1588 return mpImpl
->getTopWindowListeners();
1593 void lcl_updateWritingMode( Window
& _rWindow
, const sal_Int16 _nWritingMode
, const sal_Int16 _nContextWritingMode
)
1595 BOOL bEnableRTL
= FALSE
;
1596 switch ( _nWritingMode
)
1598 case WritingMode2::LR_TB
: bEnableRTL
= FALSE
; break;
1599 case WritingMode2::RL_TB
: bEnableRTL
= TRUE
; break;
1600 case WritingMode2::CONTEXT
:
1602 // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use
1603 // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our
1604 // own window for its RTL mode
1605 switch ( _nContextWritingMode
)
1607 case WritingMode2::LR_TB
: bEnableRTL
= FALSE
; break;
1608 case WritingMode2::RL_TB
: bEnableRTL
= TRUE
; break;
1609 case WritingMode2::CONTEXT
:
1611 const Window
* pParent
= _rWindow
.GetParent();
1612 OSL_ENSURE( pParent
, "lcl_updateWritingMode: cannot determine context's writing mode!" );
1614 bEnableRTL
= pParent
->IsRTLEnabled();
1621 OSL_ENSURE( false, "lcl_updateWritingMode: unsupported WritingMode!" );
1622 } // switch ( nWritingMode )
1624 _rWindow
.EnableRTL( bEnableRTL
);
1628 void VCLXWindow::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1630 ::vos::OGuard
aGuard( GetMutex() );
1632 Window
* pWindow
= GetWindow();
1636 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
1638 WindowType eWinType
= pWindow
->GetType();
1639 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1640 switch ( nPropType
)
1642 case BASEPROPERTY_CONTEXT_WRITING_MODE
:
1644 OSL_VERIFY( Value
>>= mpImpl
->mnContextWritingMode
);
1645 if ( mpImpl
->mnWritingMode
== WritingMode2::CONTEXT
)
1646 lcl_updateWritingMode( *pWindow
, mpImpl
->mnWritingMode
, mpImpl
->mnContextWritingMode
);
1650 case BASEPROPERTY_WRITING_MODE
:
1652 sal_Bool bProperType
= ( Value
>>= mpImpl
->mnWritingMode
);
1653 OSL_ENSURE( bProperType
, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" );
1655 lcl_updateWritingMode( *pWindow
, mpImpl
->mnWritingMode
, mpImpl
->mnContextWritingMode
);
1659 case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
:
1661 sal_uInt16
nWheelBehavior( MouseWheelBehavior::SCROLL_FOCUS_ONLY
);
1662 OSL_VERIFY( Value
>>= nWheelBehavior
);
1664 AllSettings aSettings
= pWindow
->GetSettings();
1665 MouseSettings aMouseSettings
= aSettings
.GetMouseSettings();
1667 USHORT
nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY
);
1668 switch ( nWheelBehavior
)
1670 case MouseWheelBehavior::SCROLL_DISABLED
: nVclBehavior
= MOUSE_WHEEL_DISABLE
; break;
1671 case MouseWheelBehavior::SCROLL_FOCUS_ONLY
: nVclBehavior
= MOUSE_WHEEL_FOCUS_ONLY
; break;
1672 case MouseWheelBehavior::SCROLL_ALWAYS
: nVclBehavior
= MOUSE_WHEEL_ALWAYS
; break;
1674 OSL_ENSURE( false, "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" );
1677 aMouseSettings
.SetWheelBehavior( nWheelBehavior
);
1678 aSettings
.SetMouseSettings( aMouseSettings
);
1679 pWindow
->SetSettings( aSettings
, TRUE
);
1683 case BASEPROPERTY_NATIVE_WIDGET_LOOK
:
1685 sal_Bool
bEnable( sal_True
);
1686 OSL_VERIFY( Value
>>= bEnable
);
1687 pWindow
->EnableNativeWidget( bEnable
);
1691 case BASEPROPERTY_PLUGINPARENT
:
1693 // set parent handle
1694 SetSystemParent_Impl( Value
);
1698 case BASEPROPERTY_ENABLED
:
1700 sal_Bool b
= sal_Bool();
1705 case BASEPROPERTY_ENABLEVISIBLE
:
1707 sal_Bool b
= sal_False
;
1710 if( b
!= mpImpl
->isEnableVisible() )
1712 mpImpl
->setEnableVisible( b
);
1713 pWindow
->Show( b
&& mpImpl
->isDirectVisible() );
1718 case BASEPROPERTY_TEXT
:
1719 case BASEPROPERTY_LABEL
:
1720 case BASEPROPERTY_TITLE
:
1722 ::rtl::OUString aText
;
1723 if ( Value
>>= aText
)
1727 case WINDOW_OKBUTTON
:
1728 case WINDOW_CANCELBUTTON
:
1729 case WINDOW_HELPBUTTON
:
1730 // Standard Button: overwrite only if not empty.
1731 if (aText
.getLength())
1732 pWindow
->SetText( aText
);
1736 pWindow
->SetText( aText
);
1742 case BASEPROPERTY_ACCESSIBLENAME
:
1744 ::rtl::OUString aText
;
1745 if ( Value
>>= aText
)
1746 pWindow
->SetAccessibleName( aText
);
1749 case BASEPROPERTY_HELPURL
:
1751 ::rtl::OUString aURL
;
1752 if ( Value
>>= aURL
)
1754 String
aHelpURL( aURL
);
1755 String
aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
1756 if ( aHelpURL
.CompareIgnoreCaseToAscii( aPattern
, aPattern
.Len() ) == COMPARE_EQUAL
)
1758 String aID
= aHelpURL
.Copy( aPattern
.Len() );
1759 pWindow
->SetHelpId( aID
.ToInt32() );
1763 pWindow
->SetSmartHelpId( SmartId( aHelpURL
) );
1768 case BASEPROPERTY_HELPTEXT
:
1770 ::rtl::OUString aHelpText
;
1771 if ( Value
>>= aHelpText
)
1773 pWindow
->SetQuickHelpText( aHelpText
);
1777 case BASEPROPERTY_FONTDESCRIPTOR
:
1780 pWindow
->SetControlFont( Font() );
1783 ::com::sun::star::awt::FontDescriptor aFont
;
1784 if ( Value
>>= aFont
)
1785 pWindow
->SetControlFont( VCLUnoHelper::CreateFont( aFont
, pWindow
->GetControlFont() ) );
1789 case BASEPROPERTY_FONTRELIEF
:
1791 sal_Int16 n
= sal_Int16();
1794 Font aFont
= pWindow
->GetControlFont();
1795 aFont
.SetRelief( (FontRelief
)n
);
1796 pWindow
->SetControlFont( aFont
);
1800 case BASEPROPERTY_FONTEMPHASISMARK
:
1802 sal_Int16 n
= sal_Int16();
1805 Font aFont
= pWindow
->GetControlFont();
1806 aFont
.SetEmphasisMark( n
);
1807 pWindow
->SetControlFont( aFont
);
1811 case BASEPROPERTY_BACKGROUNDCOLOR
:
1816 // set dialog color for default
1818 case WINDOW_MESSBOX
:
1819 case WINDOW_INFOBOX
:
1820 case WINDOW_WARNINGBOX
:
1821 case WINDOW_ERRORBOX
:
1822 case WINDOW_QUERYBOX
:
1823 case WINDOW_TABPAGE
:
1825 Color aColor
= pWindow
->GetSettings().GetStyleSettings().GetDialogColor();
1826 pWindow
->SetBackground( aColor
);
1827 pWindow
->SetControlBackground( aColor
);
1831 case WINDOW_FIXEDTEXT
:
1832 case WINDOW_CHECKBOX
:
1833 case WINDOW_RADIOBUTTON
:
1834 case WINDOW_GROUPBOX
:
1835 case WINDOW_FIXEDLINE
:
1837 // support transparency only for special controls
1838 pWindow
->SetBackground();
1839 pWindow
->SetControlBackground();
1840 pWindow
->SetPaintTransparent( TRUE
);
1846 // default code which enables transparency for
1847 // compound controls. It's not real transparency
1848 // as most of these controls repaint their client
1849 // area completely new.
1850 if ( pWindow
->IsCompoundControl() )
1851 pWindow
->SetBackground();
1852 pWindow
->SetControlBackground();
1859 sal_Int32 nColor
= 0;
1860 if ( Value
>>= nColor
)
1862 Color
aColor( nColor
);
1863 pWindow
->SetControlBackground( aColor
);
1864 pWindow
->SetBackground( aColor
);
1867 // reset paint transparent mode
1868 case WINDOW_FIXEDTEXT
:
1869 case WINDOW_CHECKBOX
:
1870 case WINDOW_RADIOBUTTON
:
1871 case WINDOW_GROUPBOX
:
1872 case WINDOW_FIXEDLINE
:
1873 pWindow
->SetPaintTransparent( FALSE
);
1876 pWindow
->Invalidate(); // Falls das Control nicht drauf reagiert
1880 case BASEPROPERTY_TEXTCOLOR
:
1883 pWindow
->SetControlForeground();
1887 sal_Int32 nColor
= 0;
1888 if ( Value
>>= nColor
)
1890 Color
aColor( nColor
);
1891 pWindow
->SetTextColor( aColor
);
1892 pWindow
->SetControlForeground( aColor
);
1896 case BASEPROPERTY_TEXTLINECOLOR
:
1899 pWindow
->SetTextLineColor();
1903 sal_Int32 nColor
= 0;
1904 if ( Value
>>= nColor
)
1906 Color
aColor( nColor
);
1907 pWindow
->SetTextLineColor( aColor
);
1911 case BASEPROPERTY_FILLCOLOR
:
1913 pWindow
->SetFillColor();
1916 sal_Int32 nColor
= 0;
1917 if ( Value
>>= nColor
)
1919 Color
aColor( nColor
);
1920 pWindow
->SetFillColor( aColor
);
1924 case BASEPROPERTY_LINECOLOR
:
1926 pWindow
->SetLineColor();
1929 sal_Int32 nColor
= 0;
1930 if ( Value
>>= nColor
)
1932 Color
aColor( nColor
);
1933 pWindow
->SetLineColor( aColor
);
1937 case BASEPROPERTY_BORDER
:
1939 WinBits nStyle
= pWindow
->GetStyle();
1940 sal_uInt16 nBorder
= 0;
1944 pWindow
->SetStyle( nStyle
& ~WB_BORDER
);
1948 pWindow
->SetStyle( nStyle
| WB_BORDER
);
1949 pWindow
->SetBorderStyle( nBorder
);
1953 case BASEPROPERTY_TABSTOP
:
1955 WinBits nStyle
= pWindow
->GetStyle() & ~WB_TABSTOP
;
1958 sal_Bool bTab
= false;
1961 nStyle
|= WB_TABSTOP
;
1963 nStyle
|= WB_NOTABSTOP
;
1965 pWindow
->SetStyle( nStyle
);
1968 case BASEPROPERTY_VERTICALALIGN
:
1970 VerticalAlignment eAlign
= VerticalAlignment_MAKE_FIXED_SIZE
;
1971 WinBits nStyle
= pWindow
->GetStyle();
1972 nStyle
&= ~(WB_TOP
|WB_VCENTER
|WB_BOTTOM
);
1977 case VerticalAlignment_TOP
:
1980 case VerticalAlignment_MIDDLE
:
1981 nStyle
|= WB_VCENTER
;
1983 case VerticalAlignment_BOTTOM
:
1984 nStyle
|= WB_BOTTOM
;
1986 default: ; // for warning free code, MAKE_FIXED_SIZE
1988 pWindow
->SetStyle( nStyle
);
1991 case BASEPROPERTY_ALIGN
:
1993 sal_Int16 nAlign
= PROPERTY_ALIGN_LEFT
;
1996 case WINDOW_COMBOBOX
:
1998 case WINDOW_PUSHBUTTON
:
1999 case WINDOW_OKBUTTON
:
2000 case WINDOW_CANCELBUTTON
:
2001 case WINDOW_HELPBUTTON
:
2002 nAlign
= PROPERTY_ALIGN_CENTER
;
2004 case WINDOW_FIXEDTEXT
:
2006 case WINDOW_MULTILINEEDIT
:
2007 case WINDOW_CHECKBOX
:
2008 case WINDOW_RADIOBUTTON
:
2009 case WINDOW_LISTBOX
:
2011 WinBits nStyle
= pWindow
->GetStyle();
2012 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
2015 if ( nAlign
== PROPERTY_ALIGN_LEFT
)
2017 else if ( nAlign
== PROPERTY_ALIGN_CENTER
)
2018 nStyle
|= WB_CENTER
;
2021 pWindow
->SetStyle( nStyle
);
2027 case BASEPROPERTY_MULTILINE
:
2029 if ( ( eWinType
== WINDOW_FIXEDTEXT
)
2030 || ( eWinType
== WINDOW_CHECKBOX
)
2031 || ( eWinType
== WINDOW_RADIOBUTTON
)
2032 || ( eWinType
== WINDOW_BUTTON
)
2033 || ( eWinType
== WINDOW_PUSHBUTTON
)
2034 || ( eWinType
== WINDOW_OKBUTTON
)
2035 || ( eWinType
== WINDOW_CANCELBUTTON
)
2036 || ( eWinType
== WINDOW_HELPBUTTON
)
2039 WinBits nStyle
= pWindow
->GetStyle();
2040 sal_Bool bMulti
= false;
2043 nStyle
|= WB_WORDBREAK
;
2045 nStyle
&= ~WB_WORDBREAK
;
2046 pWindow
->SetStyle( nStyle
);
2050 case BASEPROPERTY_ORIENTATION
:
2054 case WINDOW_FIXEDLINE
:
2056 sal_Int32 nOrientation
= 0;
2057 if ( Value
>>= nOrientation
)
2059 WinBits nStyle
= pWindow
->GetStyle();
2060 nStyle
&= ~(WB_HORZ
|WB_VERT
);
2061 if ( nOrientation
== 0 )
2066 pWindow
->SetStyle( nStyle
);
2073 case BASEPROPERTY_AUTOMNEMONICS
:
2075 sal_Bool bAutoMnemonics
= false;
2076 Value
>>= bAutoMnemonics
;
2077 AllSettings aSettings
= pWindow
->GetSettings();
2078 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
2079 if ( aStyleSettings
.GetAutoMnemonic() != bAutoMnemonics
)
2081 aStyleSettings
.SetAutoMnemonic( bAutoMnemonics
);
2082 aSettings
.SetStyleSettings( aStyleSettings
);
2083 pWindow
->SetSettings( aSettings
);
2087 case BASEPROPERTY_MOUSETRANSPARENT
:
2089 sal_Bool bMouseTransparent
= false;
2090 Value
>>= bMouseTransparent
;
2091 pWindow
->SetMouseTransparent( bMouseTransparent
);
2094 case BASEPROPERTY_PAINTTRANSPARENT
:
2096 sal_Bool bPaintTransparent
= false;
2097 Value
>>= bPaintTransparent
;
2098 pWindow
->SetPaintTransparent( bPaintTransparent
);
2099 // pWindow->SetBackground();
2103 case BASEPROPERTY_REPEAT
:
2105 sal_Bool
bRepeat( FALSE
);
2108 WinBits nStyle
= pWindow
->GetStyle();
2110 nStyle
|= WB_REPEAT
;
2112 nStyle
&= ~WB_REPEAT
;
2113 pWindow
->SetStyle( nStyle
);
2117 case BASEPROPERTY_REPEAT_DELAY
:
2119 sal_Int32 nRepeatDelay
= 0;
2120 if ( Value
>>= nRepeatDelay
)
2122 AllSettings aSettings
= pWindow
->GetSettings();
2123 MouseSettings aMouseSettings
= aSettings
.GetMouseSettings();
2125 aMouseSettings
.SetButtonRepeat( nRepeatDelay
);
2126 aSettings
.SetMouseSettings( aMouseSettings
);
2128 pWindow
->SetSettings( aSettings
, TRUE
);
2133 case BASEPROPERTY_SYMBOL_COLOR
:
2134 ::toolkit::setColorSettings( pWindow
, Value
, &StyleSettings::SetButtonTextColor
, &StyleSettings::GetButtonTextColor
);
2137 case BASEPROPERTY_BORDERCOLOR
:
2138 ::toolkit::setColorSettings( pWindow
, Value
, &StyleSettings::SetMonoColor
, &StyleSettings::GetMonoColor
);
2140 case BASEPROPERTY_DEFAULTCONTROL
:
2142 rtl::OUString aName
;
2149 ::com::sun::star::uno::Any
VCLXWindow::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2151 ::vos::OGuard
aGuard( GetMutex() );
2153 ::com::sun::star::uno::Any aProp
;
2156 WindowType eWinType
= GetWindow()->GetType();
2157 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2158 switch ( nPropType
)
2160 case BASEPROPERTY_CONTEXT_WRITING_MODE
:
2161 aProp
<<= mpImpl
->mnContextWritingMode
;
2164 case BASEPROPERTY_WRITING_MODE
:
2165 aProp
<<= mpImpl
->mnWritingMode
;
2168 case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
:
2170 USHORT nVclBehavior
= GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior();
2171 sal_Int16 nBehavior
= MouseWheelBehavior::SCROLL_FOCUS_ONLY
;
2172 switch ( nVclBehavior
)
2174 case MOUSE_WHEEL_DISABLE
: nBehavior
= MouseWheelBehavior::SCROLL_DISABLED
; break;
2175 case MOUSE_WHEEL_FOCUS_ONLY
: nBehavior
= MouseWheelBehavior::SCROLL_FOCUS_ONLY
; break;
2176 case MOUSE_WHEEL_ALWAYS
: nBehavior
= MouseWheelBehavior::SCROLL_ALWAYS
; break;
2178 OSL_ENSURE( false, "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" );
2180 aProp
<<= nBehavior
;
2184 case BASEPROPERTY_NATIVE_WIDGET_LOOK
:
2185 aProp
<<= (sal_Bool
) GetWindow()->IsNativeWidgetEnabled();
2188 case BASEPROPERTY_ENABLED
:
2189 aProp
<<= (sal_Bool
) GetWindow()->IsEnabled();
2192 case BASEPROPERTY_ENABLEVISIBLE
:
2193 aProp
<<= (sal_Bool
) mpImpl
->isEnableVisible();
2196 case BASEPROPERTY_TEXT
:
2197 case BASEPROPERTY_LABEL
:
2198 case BASEPROPERTY_TITLE
:
2200 ::rtl::OUString aText
= GetWindow()->GetText();
2204 case BASEPROPERTY_ACCESSIBLENAME
:
2206 ::rtl::OUString aText
= GetWindow()->GetAccessibleName();
2210 case BASEPROPERTY_HELPTEXT
:
2212 ::rtl::OUString aText
= GetWindow()->GetQuickHelpText();
2216 case BASEPROPERTY_HELPURL
:
2218 SmartId aSmartId
= GetWindow()->GetSmartHelpId();
2219 if( aSmartId
.HasString() )
2221 String aStrHelpId
= aSmartId
.GetStr();
2222 aProp
<<= ::rtl::OUString( aStrHelpId
);
2226 ::rtl::OUStringBuffer aURL
;
2227 aURL
.appendAscii( "HID:" );
2228 aURL
.append( (sal_Int32
) GetWindow()->GetHelpId() );
2229 aProp
<<= aURL
.makeStringAndClear();
2233 case BASEPROPERTY_FONTDESCRIPTOR
:
2235 Font aFont
= GetWindow()->GetControlFont();
2236 ::com::sun::star::awt::FontDescriptor aFD
= VCLUnoHelper::CreateFontDescriptor( aFont
);
2240 case BASEPROPERTY_BACKGROUNDCOLOR
:
2241 aProp
<<= (sal_Int32
) GetWindow()->GetControlBackground().GetColor();
2243 case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR
:
2244 aProp
<<= (sal_Int32
) GetWindow()->GetDisplayBackground().GetColor().GetColor();
2246 case BASEPROPERTY_FONTRELIEF
:
2247 aProp
<<= (sal_Int16
) GetWindow()->GetControlFont().GetRelief();
2249 case BASEPROPERTY_FONTEMPHASISMARK
:
2250 aProp
<<= (sal_Int16
) GetWindow()->GetControlFont().GetEmphasisMark();
2252 case BASEPROPERTY_TEXTCOLOR
:
2253 aProp
<<= (sal_Int32
) GetWindow()->GetControlForeground().GetColor();
2255 case BASEPROPERTY_TEXTLINECOLOR
:
2256 aProp
<<= (sal_Int32
) GetWindow()->GetTextLineColor().GetColor();
2258 case BASEPROPERTY_FILLCOLOR
:
2259 aProp
<<= (sal_Int32
) GetWindow()->GetFillColor().GetColor();
2261 case BASEPROPERTY_LINECOLOR
:
2262 aProp
<<= (sal_Int32
) GetWindow()->GetLineColor().GetColor();
2264 case BASEPROPERTY_BORDER
:
2266 sal_Int16 nBorder
= 0;
2267 if ( GetWindow()->GetStyle() & WB_BORDER
)
2268 nBorder
= GetWindow()->GetBorderStyle();
2272 case BASEPROPERTY_TABSTOP
:
2273 aProp
<<= (sal_Bool
) ( GetWindow()->GetStyle() & WB_TABSTOP
) ? sal_True
: sal_False
;
2275 case BASEPROPERTY_VERTICALALIGN
:
2277 WinBits nStyle
= GetWindow()->GetStyle();
2278 if ( nStyle
& WB_TOP
)
2279 aProp
<<= VerticalAlignment_TOP
;
2280 else if ( nStyle
& WB_VCENTER
)
2281 aProp
<<= VerticalAlignment_MIDDLE
;
2282 else if ( nStyle
& WB_BOTTOM
)
2283 aProp
<<= VerticalAlignment_BOTTOM
;
2286 case BASEPROPERTY_ALIGN
:
2290 case WINDOW_FIXEDTEXT
:
2292 case WINDOW_MULTILINEEDIT
:
2293 case WINDOW_CHECKBOX
:
2294 case WINDOW_RADIOBUTTON
:
2295 case WINDOW_LISTBOX
:
2296 case WINDOW_COMBOBOX
:
2298 case WINDOW_PUSHBUTTON
:
2299 case WINDOW_OKBUTTON
:
2300 case WINDOW_CANCELBUTTON
:
2301 case WINDOW_HELPBUTTON
:
2303 WinBits nStyle
= GetWindow()->GetStyle();
2304 if ( nStyle
& WB_LEFT
)
2305 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_LEFT
;
2306 else if ( nStyle
& WB_CENTER
)
2307 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_CENTER
;
2308 else if ( nStyle
& WB_RIGHT
)
2309 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_RIGHT
;
2314 case BASEPROPERTY_MULTILINE
:
2316 if ( ( eWinType
== WINDOW_FIXEDTEXT
)
2317 || ( eWinType
== WINDOW_CHECKBOX
)
2318 || ( eWinType
== WINDOW_RADIOBUTTON
)
2319 || ( eWinType
== WINDOW_BUTTON
)
2320 || ( eWinType
== WINDOW_PUSHBUTTON
)
2321 || ( eWinType
== WINDOW_OKBUTTON
)
2322 || ( eWinType
== WINDOW_CANCELBUTTON
)
2323 || ( eWinType
== WINDOW_HELPBUTTON
)
2325 aProp
<<= (sal_Bool
) ( GetWindow()->GetStyle() & WB_WORDBREAK
) ? sal_True
: sal_False
;
2328 case BASEPROPERTY_AUTOMNEMONICS
:
2330 sal_Bool bAutoMnemonics
= GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
2331 aProp
<<= bAutoMnemonics
;
2334 case BASEPROPERTY_MOUSETRANSPARENT
:
2336 sal_Bool bMouseTransparent
= GetWindow()->IsMouseTransparent();
2337 aProp
<<= bMouseTransparent
;
2340 case BASEPROPERTY_PAINTTRANSPARENT
:
2342 sal_Bool bPaintTransparent
= GetWindow()->IsPaintTransparent();
2343 aProp
<<= bPaintTransparent
;
2347 case BASEPROPERTY_REPEAT
:
2348 aProp
<<= (sal_Bool
)( 0 != ( GetWindow()->GetStyle() & WB_REPEAT
) );
2351 case BASEPROPERTY_REPEAT_DELAY
:
2353 sal_Int32 nButtonRepeat
= GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
2354 aProp
<<= (sal_Int32
)nButtonRepeat
;
2358 case BASEPROPERTY_SYMBOL_COLOR
:
2359 aProp
<<= (sal_Int32
)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
2362 case BASEPROPERTY_BORDERCOLOR
:
2363 aProp
<<= (sal_Int32
)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor();
2371 // ::com::sun::star::awt::XLayoutConstrains
2372 ::com::sun::star::awt::Size
VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2374 ::vos::OGuard
aGuard( GetMutex() );
2376 // Diese Methode sollte nur fuer Componenten gerufen werden, die zwar
2377 // ueber das ::com::sun::star::awt::Toolkit erzeugt werden koennen, aber fuer die es
2378 // kein Interface gibt.
2383 WindowType nWinType
= GetWindow()->GetType();
2386 case WINDOW_CONTROL
:
2387 aSz
.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
2388 aSz
.Height() = GetWindow()->GetTextHeight()+2*6;
2391 case WINDOW_PATTERNBOX
:
2392 case WINDOW_NUMERICBOX
:
2393 case WINDOW_METRICBOX
:
2394 case WINDOW_CURRENCYBOX
:
2395 case WINDOW_DATEBOX
:
2396 case WINDOW_TIMEBOX
:
2397 case WINDOW_LONGCURRENCYBOX
:
2398 aSz
.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
2399 aSz
.Height() = GetWindow()->GetTextHeight()+2*2;
2401 case WINDOW_SCROLLBARBOX
:
2402 return VCLXScrollBar::implGetMinimumSize( GetWindow() );
2404 aSz
= GetWindow()->GetOptimalSize( WINDOWSIZE_MINIMUM
);
2408 return ::com::sun::star::awt::Size( aSz
.Width(), aSz
.Height() );
2411 ::com::sun::star::awt::Size
VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2413 return getMinimumSize();
2416 ::com::sun::star::awt::Size
VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2418 ::vos::OGuard
aGuard( GetMutex() );
2420 ::com::sun::star::awt::Size
aNewSize( rNewSize
);
2421 ::com::sun::star::awt::Size aMinSize
= getMinimumSize();
2423 if ( aNewSize
.Width
< aMinSize
.Width
)
2424 aNewSize
.Width
= aMinSize
.Width
;
2425 if ( aNewSize
.Height
< aMinSize
.Height
)
2426 aNewSize
.Height
= aMinSize
.Height
;
2432 // ::com::sun::star::awt::XView
2433 sal_Bool
VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& rxDevice
) throw(::com::sun::star::uno::RuntimeException
)
2435 ::vos::OGuard
aGuard( GetMutex() );
2437 if ( VCLUnoHelper::GetOutputDevice( rxDevice
) )
2438 mpImpl
->mxViewGraphics
= rxDevice
;
2440 mpImpl
->mxViewGraphics
= NULL
;
2442 return mpImpl
->mxViewGraphics
.is();
2445 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
> VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException
)
2447 ::vos::OGuard
aGuard( GetMutex() );
2449 return mpImpl
->mxViewGraphics
;
2452 ::com::sun::star::awt::Size
VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException
)
2454 ::vos::OGuard
aGuard( GetMutex() );
2458 aSz
= GetWindow()->GetSizePixel();
2459 return ::com::sun::star::awt::Size( aSz
.Width(), aSz
.Height() );
2462 void VCLXWindow::draw( sal_Int32 nX
, sal_Int32 nY
) throw(::com::sun::star::uno::RuntimeException
)
2464 ::vos::OGuard
aGuard( GetMutex() );
2466 Window
* pWindow
= GetWindow();
2470 if ( isDesignMode() || mpImpl
->isEnableVisible() )
2472 TabPage
* pTabPage
= dynamic_cast< TabPage
* >( pWindow
);
2475 Point
aPos( nX
, nY
);
2476 Size aSize
= pWindow
->GetSizePixel();
2478 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( mpImpl
->mxViewGraphics
);
2479 aPos
= pDev
->PixelToLogic( aPos
);
2480 aSize
= pDev
->PixelToLogic( aSize
);
2482 pTabPage
->Draw( pDev
, aPos
, aSize
, 0 );
2486 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( mpImpl
->mxViewGraphics
);
2487 Point
aPos( nX
, nY
);
2490 pDev
= pWindow
->GetParent();
2492 if ( pWindow
->GetParent() && !pWindow
->IsSystemWindow() && ( pWindow
->GetParent() == pDev
) )
2494 // #i40647# don't draw here if this is a recursive call
2495 // sometimes this is called recursively, because the Update call on the parent
2496 // (strangely) triggers another paint. Prevent a stack overflow here
2497 // Yes, this is only fixing symptoms for the moment ....
2498 // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
2499 if ( !mpImpl
->getDrawingOntoParent_ref() )
2501 FlagGuard
aDrawingflagGuard( mpImpl
->getDrawingOntoParent_ref() );
2503 BOOL bWasVisible
= pWindow
->IsVisible();
2504 Point
aOldPos( pWindow
->GetPosPixel() );
2506 if ( bWasVisible
&& aOldPos
== aPos
)
2512 pWindow
->SetPosPixel( aPos
);
2514 // Erstmal ein Update auf den Parent, damit nicht beim Update
2515 // auf dieses Fenster noch ein Paint vom Parent abgearbeitet wird,
2516 // wo dann ggf. dieses Fenster sofort wieder gehidet wird.
2517 if( pWindow
->GetParent() )
2518 pWindow
->GetParent()->Update();
2522 pWindow
->SetParentUpdateMode( sal_False
);
2524 pWindow
->SetParentUpdateMode( sal_True
);
2526 pWindow
->SetPosPixel( aOldPos
);
2528 pWindow
->Show( TRUE
);
2533 Size aSz
= pWindow
->GetSizePixel();
2534 aSz
= pDev
->PixelToLogic( aSz
);
2535 Point aP
= pDev
->PixelToLogic( aPos
);
2537 vcl::PDFExtOutDevData
* pPDFExport
= dynamic_cast<vcl::PDFExtOutDevData
*>(pDev
->GetExtOutDevData());
2538 bool bDrawSimple
= ( pDev
->GetOutDevType() == OUTDEV_PRINTER
)
2539 || ( pDev
->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW
)
2540 || ( pPDFExport
!= NULL
);
2543 pWindow
->Draw( pDev
, aP
, aSz
, WINDOW_DRAW_NOCONTROLS
);
2547 BOOL bOldNW
=pWindow
->IsNativeWidgetEnabled();
2549 pWindow
->EnableNativeWidget(FALSE
);
2550 pWindow
->PaintToDevice( pDev
, aP
, aSz
);
2552 pWindow
->EnableNativeWidget(TRUE
);
2558 void VCLXWindow::setZoom( float fZoomX
, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException
)
2560 ::vos::OGuard
aGuard( GetMutex() );
2563 GetWindow()->SetZoom( Fraction( fZoomX
) );
2566 // ::com::sun::star::lang::XEventListener
2567 void SAL_CALL
VCLXWindow::disposing( const ::com::sun::star::lang::EventObject
& _rSource
) throw (::com::sun::star::uno::RuntimeException
)
2569 ::vos::OGuard
aGuard( GetMutex() );
2571 // check if it comes from our AccessibleContext
2572 uno::Reference
< uno::XInterface
> aAC( mpImpl
->mxAccessibleContext
, uno::UNO_QUERY
);
2573 uno::Reference
< uno::XInterface
> xSource( _rSource
.Source
, uno::UNO_QUERY
);
2575 if ( aAC
.get() == xSource
.get() )
2577 mpImpl
->mxAccessibleContext
= uno::Reference
< accessibility::XAccessibleContext
>();
2581 // ::com::sun::star::accessibility::XAccessible
2582 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXWindow::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException
)
2584 using namespace ::com::sun::star
;
2586 ::vos::OGuard
aGuard( GetMutex() );
2590 return uno::Reference
< accessibility::XAccessibleContext
>();
2592 if ( !mpImpl
->mxAccessibleContext
.is() && GetWindow() )
2594 mpImpl
->mxAccessibleContext
= CreateAccessibleContext();
2596 // add as event listener to this component
2597 // in case somebody disposes it, we do not want to have a (though weak) reference to a dead
2599 uno::Reference
< lang::XComponent
> xComp( mpImpl
->mxAccessibleContext
, uno::UNO_QUERY
);
2601 xComp
->addEventListener( this );
2604 return mpImpl
->mxAccessibleContext
;
2607 // ::com::sun::star::awt::XDockable
2608 void SAL_CALL
VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDockableWindowListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
2610 ::vos::OGuard
aGuard( GetMutex() );
2612 if ( xListener
.is() )
2613 mpImpl
->getDockableWindowListeners().addInterface( xListener
);
2617 void SAL_CALL
VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDockableWindowListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
2619 ::vos::OGuard
aGuard( GetMutex() );
2621 mpImpl
->getDockableWindowListeners().removeInterface( xListener
);
2624 void SAL_CALL
VCLXWindow::enableDocking( sal_Bool bEnable
) throw (::com::sun::star::uno::RuntimeException
)
2626 ::vos::OGuard
aGuard( GetMutex() );
2628 Window
* pWindow
= GetWindow();
2630 pWindow
->EnableDocking( bEnable
);
2633 sal_Bool SAL_CALL
VCLXWindow::isFloating( ) throw (::com::sun::star::uno::RuntimeException
)
2635 ::vos::OGuard
aGuard( GetMutex() );
2637 Window
* pWindow
= GetWindow();
2639 return Window::GetDockingManager()->IsFloating( pWindow
);
2644 void SAL_CALL
VCLXWindow::setFloatingMode( sal_Bool bFloating
) throw (::com::sun::star::uno::RuntimeException
)
2646 ::vos::OGuard
aGuard( GetMutex() );
2648 Window
* pWindow
= GetWindow();
2650 Window::GetDockingManager()->SetFloatingMode( pWindow
, bFloating
);
2653 sal_Bool SAL_CALL
VCLXWindow::isLocked( ) throw (::com::sun::star::uno::RuntimeException
)
2655 ::vos::OGuard
aGuard( GetMutex() );
2657 Window
* pWindow
= GetWindow();
2659 return Window::GetDockingManager()->IsLocked( pWindow
);
2664 void SAL_CALL
VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException
)
2666 ::vos::OGuard
aGuard( GetMutex() );
2668 Window
* pWindow
= GetWindow();
2669 if( pWindow
&& !Window::GetDockingManager()->IsFloating( pWindow
) )
2670 Window::GetDockingManager()->Lock( pWindow
);
2673 void SAL_CALL
VCLXWindow::unlock( ) throw (::com::sun::star::uno::RuntimeException
)
2675 ::vos::OGuard
aGuard( GetMutex() );
2677 Window
* pWindow
= GetWindow();
2678 if( pWindow
&& !Window::GetDockingManager()->IsFloating( pWindow
) )
2679 Window::GetDockingManager()->Unlock( pWindow
);
2681 void SAL_CALL
VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle
& ) throw (::com::sun::star::uno::RuntimeException
)
2683 // TODO: remove interface in the next incompatible build
2684 ::vos::OGuard
aGuard( GetMutex() );
2688 sal_Bool SAL_CALL
VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException
)
2690 // TODO: remove interface in the next incompatible build
2691 ::vos::OGuard
aGuard( GetMutex() );
2696 // ::com::sun::star::awt::XWindow2
2698 void SAL_CALL
VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size
& aSize
) throw (::com::sun::star::uno::RuntimeException
)
2700 ::vos::OGuard
aGuard( GetMutex() );
2702 if( (pWindow
= GetWindow()) != NULL
)
2704 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >(pWindow
);
2705 if( pDockingWindow
)
2706 pDockingWindow
->SetOutputSizePixel( VCLSize( aSize
) );
2708 pWindow
->SetOutputSizePixel( VCLSize( aSize
) );
2712 ::com::sun::star::awt::Size SAL_CALL
VCLXWindow::getOutputSize( ) throw (::com::sun::star::uno::RuntimeException
)
2714 ::vos::OGuard
aGuard( GetMutex() );
2716 if( (pWindow
= GetWindow()) != NULL
)
2718 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >(pWindow
);
2719 if( pDockingWindow
)
2720 return AWTSize( pDockingWindow
->GetOutputSizePixel() );
2722 return AWTSize( pWindow
->GetOutputSizePixel() );
2725 return ::com::sun::star::awt::Size();
2728 sal_Bool SAL_CALL
VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException
)
2730 ::vos::OGuard
aGuard( GetMutex() );
2732 return GetWindow()->IsVisible();
2737 sal_Bool SAL_CALL
VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException
)
2739 ::vos::OGuard
aGuard( GetMutex() );
2741 return GetWindow()->IsActive();
2747 sal_Bool SAL_CALL
VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException
)
2749 ::vos::OGuard
aGuard( GetMutex() );
2751 return GetWindow()->IsEnabled();
2756 sal_Bool SAL_CALL
VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException
)
2758 ::vos::OGuard
aGuard( GetMutex() );
2760 return GetWindow()->HasFocus();
2765 // ::com::sun::star::beans::XPropertySetInfo
2767 UnoPropertyArrayHelper
*
2768 VCLXWindow::GetPropHelper()
2770 ::vos::OGuard
aGuard( GetMutex() );
2771 if ( mpImpl
->mpPropHelper
== NULL
)
2773 std::list
< sal_uInt16
> aIDs
;
2774 GetPropertyIds( aIDs
);
2775 mpImpl
->mpPropHelper
= new UnoPropertyArrayHelper( aIDs
);
2777 return mpImpl
->mpPropHelper
;
2780 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
2781 VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException
)
2783 return GetPropHelper()->getProperties();
2785 ::com::sun::star::beans::Property SAL_CALL
2786 VCLXWindow::getPropertyByName( const ::rtl::OUString
& rName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
2788 return GetPropHelper()->getPropertyByName( rName
);
2792 VCLXWindow::hasPropertyByName( const ::rtl::OUString
& rName
) throw (::com::sun::star::uno::RuntimeException
)
2794 return GetPropHelper()->hasPropertyByName( rName
);