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/XTopWindow.hpp>
39 #include <com/sun/star/awt/Style.hpp>
40 #include <com/sun/star/accessibility/AccessibleRole.hpp>
41 #include <com/sun/star/awt/DockingEvent.hpp>
42 #include <com/sun/star/awt/EndDockingEvent.hpp>
43 #include <com/sun/star/awt/EndPopupModeEvent.hpp>
44 #include <com/sun/star/awt/XWindowListener2.hpp>
45 #include <com/sun/star/style/VerticalAlignment.hpp>
46 #include <com/sun/star/text/WritingMode2.hpp>
47 #include <toolkit/awt/vclxwindow.hxx>
48 #include <toolkit/awt/vclxpointer.hxx>
49 #include <toolkit/awt/vclxwindows.hxx>
50 #include <toolkit/helper/macros.hxx>
51 #include <toolkit/helper/vclunohelper.hxx>
52 #include <toolkit/helper/convert.hxx>
53 #include <toolkit/helper/macros.hxx>
54 #include <toolkit/helper/property.hxx>
55 #include <toolkit/helper/accessibilityclient.hxx>
56 #include <cppuhelper/typeprovider.hxx>
57 #include <rtl/memory.h>
59 #include <rtl/ustrbuf.hxx>
60 #include <vcl/svapp.hxx>
61 #include <vcl/window.hxx>
62 #include <tools/color.hxx>
63 #include <vcl/dockwin.hxx>
64 #include <vcl/pdfextoutdevdata.hxx>
65 #include <vcl/tabpage.hxx>
66 #include <comphelper/asyncnotification.hxx>
67 #include <toolkit/helper/solarrelease.hxx>
69 #include <toolkit/helper/unopropertyarrayhelper.hxx>
71 using namespace ::com::sun::star
;
73 using ::com::sun::star::uno::Reference
;
74 using ::com::sun::star::uno::UNO_QUERY
;
75 using ::com::sun::star::lang::EventObject
;
76 using ::com::sun::star::awt::XWindowListener2
;
77 using ::com::sun::star::awt::XDockableWindowListener
;
78 using ::com::sun::star::style::VerticalAlignment
;
79 using ::com::sun::star::style::VerticalAlignment_TOP
;
80 using ::com::sun::star::style::VerticalAlignment_MIDDLE
;
81 using ::com::sun::star::style::VerticalAlignment_BOTTOM
;
82 using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE
;
84 namespace WritingMode2
= ::com::sun::star::text::WritingMode2
;
87 //====================================================================
89 //====================================================================
92 //................................................................
94 //................................................................
101 FlagGuard( bool& _rFlag
)
112 //................................................................
114 //................................................................
117 META_FIRST_MOUSE_EVENT
= 0,
119 EVENT_MOUSE_PRESSED
= 0,
120 EVENT_MOUSE_RELEASED
= 1,
121 EVENT_MOUSE_ENTERED
= 2,
122 EVENT_MOUSE_EXITED
= 3,
124 META_LAST_MOUSE_EVENT
= 3
127 //................................................................
129 //................................................................
132 META_FIRST_PLAIN_EVENT
= 4,
134 EVENT_WINDOW_ENABLED
= 4,
135 EVENT_WINDOW_DISABLED
= 5,
137 META_LAST_PLAIN_EVENT
= 5
140 #if OSL_DEBUG_LEVEL > 0
141 static void checkEventDefinitions()
143 OSL_ENSURE( (int)META_LAST_MOUSE_EVENT
< (int)META_FIRST_PLAIN_EVENT
, "checkEventDefinitions: invalid event definitions!" );
145 #define DBG_CHECK_EVENTS() checkEventDefinitions()
147 #define DBG_CHECK_EVENTS()
150 //................................................................
152 //................................................................
153 struct AnyWindowEvent
: public ::comphelper::AnyEvent
156 awt::MouseEvent m_aMouseEvent
;
157 lang::EventObject m_aPlainEvent
;
159 sal_Int32 m_nEventType
;
162 AnyWindowEvent( const awt::MouseEvent
& _rEvent
, MouseEventType _nType
)
163 :comphelper::AnyEvent()
164 ,m_aMouseEvent( _rEvent
)
165 ,m_nEventType( static_cast< sal_Int32
>( _nType
) )
170 AnyWindowEvent( const lang::EventObject
& _rEvent
, PlainEventType _nType
)
171 :comphelper::AnyEvent()
172 ,m_aPlainEvent( _rEvent
)
173 ,m_nEventType( static_cast< sal_Int32
>( _nType
) )
178 bool isMouseEvent() const
180 return ( META_FIRST_MOUSE_EVENT
<= m_nEventType
) && ( m_nEventType
<= META_LAST_MOUSE_EVENT
);
183 bool isPlainEvent() const
185 return ( META_FIRST_PLAIN_EVENT
<= m_nEventType
) && ( m_nEventType
<= META_LAST_PLAIN_EVENT
);
188 const awt::MouseEvent
& getMouseEvent() const
190 OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEvent: no mouse event!" );
191 return m_aMouseEvent
;
194 MouseEventType
getMouseEventType() const
196 OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEventType: no mouse event!" );
197 return static_cast< MouseEventType
>( m_nEventType
);
200 const lang::EventObject
& getPlainEvent() const
202 OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEvent: no plain event!" );
203 return m_aPlainEvent
;
206 PlainEventType
getPlainEventType() const
208 OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEventType: no mouse event!" );
209 return static_cast< PlainEventType
>( m_nEventType
);
214 //====================================================================
216 //====================================================================
217 class SAL_DLLPRIVATE VCLXWindowImpl
: public ::comphelper::IEventProcessor
220 typedef ::std::vector
< ::rtl::Reference
< ::comphelper::AnyEvent
> >
224 VCLXWindow
& mrAntiImpl
;
225 ::vos::IMutex
& mrMutex
;
226 ::toolkit::AccessibilityClient maAccFactory
;
228 bool mbDrawingOntoParent
; // no bit mask, is passed around by reference
229 sal_Bool mbEnableVisible
;
230 sal_Bool mbDirectVisible
;
232 ::osl::Mutex maListenerContainerMutex
;
233 ::cppu::OInterfaceContainerHelper maWindow2Listeners
;
234 ::cppu::OInterfaceContainerHelper maDockableWindowListeners
;
235 EventListenerMultiplexer maEventListeners
;
236 FocusListenerMultiplexer maFocusListeners
;
237 WindowListenerMultiplexer maWindowListeners
;
238 KeyListenerMultiplexer maKeyListeners
;
239 MouseListenerMultiplexer maMouseListeners
;
240 MouseMotionListenerMultiplexer maMouseMotionListeners
;
241 PaintListenerMultiplexer maPaintListeners
;
242 VclContainerListenerMultiplexer maContainerListeners
;
243 TopWindowListenerMultiplexer maTopWindowListeners
;
249 bool mbDisposing
: 1;
250 bool mbDesignMode
: 1;
251 bool mbSynthesizingVCLEvent
: 1;
252 bool mbWithDefaultProps
: 1;
254 ULONG mnListenerLockLevel
;
255 sal_Int16 mnWritingMode
;
256 sal_Int16 mnContextWritingMode
;
258 UnoPropertyArrayHelper
* mpPropHelper
;
260 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPointer
>
262 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
>
264 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>
268 bool& getDrawingOntoParent_ref() { return mbDrawingOntoParent
; }
273 the <type>VCLXWindow</type> instance which the object belongs to. Must
274 live longer then the object just being constructed.
276 VCLXWindowImpl( VCLXWindow
& _rAntiImpl
, ::vos::IMutex
& _rMutex
, bool _bWithDefaultProps
);
278 /** synchronously mbEnableVisible
280 void setEnableVisible( sal_Bool bEnableVisible
) { mbEnableVisible
= bEnableVisible
; }
281 sal_Bool
isEnableVisible() { return mbEnableVisible
; }
282 /** synchronously mbDirectVisible;
284 void setDirectVisible( sal_Bool bDirectVisible
) { mbDirectVisible
= bDirectVisible
; }
285 sal_Bool
isDirectVisible() { return mbDirectVisible
; }
287 /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners
289 void notifyMouseEvent( const awt::MouseEvent
& _rMouseEvent
, MouseEventType _nType
);
291 /** asynchronously notifies an event described by an EventObject to the respective listeners
293 void notifyPlainEvent( const lang::EventObject
& _rPlainEvent
, PlainEventType _nType
);
295 /** notifies the object that its VCLXWindow is being disposed
299 inline ::toolkit::AccessibilityClient
& getAccessibleFactory()
304 /** returns the container of registered XWindowListener2 listeners
306 inline ::cppu::OInterfaceContainerHelper
& getWindow2Listeners() { return maWindow2Listeners
; }
307 inline ::cppu::OInterfaceContainerHelper
& getDockableWindowListeners(){ return maDockableWindowListeners
; }
308 inline EventListenerMultiplexer
& getEventListeners() { return maEventListeners
; }
309 inline FocusListenerMultiplexer
& getFocusListeners() { return maFocusListeners
; }
310 inline WindowListenerMultiplexer
& getWindowListeners() { return maWindowListeners
; }
311 inline KeyListenerMultiplexer
& getKeyListeners() { return maKeyListeners
; }
312 inline MouseListenerMultiplexer
& getMouseListeners() { return maMouseListeners
; }
313 inline MouseMotionListenerMultiplexer
& getMouseMotionListeners() { return maMouseMotionListeners
; }
314 inline PaintListenerMultiplexer
& getPaintListeners() { return maPaintListeners
; }
315 inline VclContainerListenerMultiplexer
& getContainerListeners() { return maContainerListeners
; }
316 inline TopWindowListenerMultiplexer
& getTopWindowListeners() { return maTopWindowListeners
; }
318 virtual ~VCLXWindowImpl();
321 virtual void SAL_CALL
acquire();
322 virtual void SAL_CALL
release();
325 virtual void processEvent( const ::comphelper::AnyEvent
& _rEvent
);
328 DECL_LINK( OnProcessEvent
, void* );
331 /** notifies an arbitrary event
335 void impl_notifyAnyEvent(
336 const ::rtl::Reference
< ::comphelper::AnyEvent
>& _rEvent
340 /** determines whether the instance is already disposed
342 m_aMutex must be acquired
344 inline bool impl_isDisposed()
350 VCLXWindowImpl(); // never implemented
351 VCLXWindowImpl( const VCLXWindowImpl
& ); // never implemented
352 VCLXWindowImpl
& operator=( const VCLXWindowImpl
& ); // never implemented
355 //--------------------------------------------------------------------
356 VCLXWindowImpl::VCLXWindowImpl( VCLXWindow
& _rAntiImpl
, ::vos::IMutex
& _rMutex
, bool _bWithDefaultProps
)
357 :mrAntiImpl( _rAntiImpl
)
360 ,mbDrawingOntoParent( false )
361 ,mbEnableVisible(sal_True
)
362 ,mbDirectVisible(sal_True
)
363 ,maListenerContainerMutex( )
364 ,maWindow2Listeners( maListenerContainerMutex
)
365 ,maDockableWindowListeners( maListenerContainerMutex
)
366 ,maEventListeners( _rAntiImpl
)
367 ,maFocusListeners( _rAntiImpl
)
368 ,maWindowListeners( _rAntiImpl
)
369 ,maKeyListeners( _rAntiImpl
)
370 ,maMouseListeners( _rAntiImpl
)
371 ,maMouseMotionListeners( _rAntiImpl
)
372 ,maPaintListeners( _rAntiImpl
)
373 ,maContainerListeners( _rAntiImpl
)
374 ,maTopWindowListeners( _rAntiImpl
)
376 ,mbDisposing( false )
377 ,mbDesignMode( false )
378 ,mbSynthesizingVCLEvent( false )
379 ,mbWithDefaultProps( _bWithDefaultProps
)
380 ,mnListenerLockLevel( 0 )
381 ,mnWritingMode( WritingMode2::CONTEXT
)
382 ,mnContextWritingMode( WritingMode2::CONTEXT
)
383 ,mpPropHelper( NULL
)
387 VCLXWindowImpl::~VCLXWindowImpl()
392 //--------------------------------------------------------------------
393 void VCLXWindowImpl::disposing()
395 ::vos::OGuard
aGuard( mrMutex
);
397 Application::RemoveUserEvent( mnEventId
);
401 ::com::sun::star::lang::EventObject aEvent
;
402 aEvent
.Source
= mrAntiImpl
;
404 maEventListeners
.disposeAndClear( aEvent
);
405 maFocusListeners
.disposeAndClear( aEvent
);
406 maWindowListeners
.disposeAndClear( aEvent
);
407 maKeyListeners
.disposeAndClear( aEvent
);
408 maMouseListeners
.disposeAndClear( aEvent
);
409 maMouseMotionListeners
.disposeAndClear( aEvent
);
410 maPaintListeners
.disposeAndClear( aEvent
);
411 maContainerListeners
.disposeAndClear( aEvent
);
412 maTopWindowListeners
.disposeAndClear( aEvent
);
416 //--------------------------------------------------------------------
417 void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference
< ::comphelper::AnyEvent
>& _rEvent
)
419 maEvents
.push_back( _rEvent
);
421 mnEventId
= Application::PostUserEvent( LINK( this, VCLXWindowImpl
, OnProcessEvent
) );
424 //--------------------------------------------------------------------
425 void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent
& _rMouseEvent
, MouseEventType _nType
)
427 ::vos::OClearableGuard
aGuard( mrMutex
);
428 if ( maMouseListeners
.getLength() )
429 impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent
, _nType
) );
432 //--------------------------------------------------------------------
433 void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject
& _rPlainEvent
, PlainEventType _nType
)
435 ::vos::OClearableGuard
aGuard( mrMutex
);
436 if ( maWindow2Listeners
.getLength() )
437 impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent
, _nType
) );
440 //--------------------------------------------------------------------
441 IMPL_LINK( VCLXWindowImpl
, OnProcessEvent
, void*, EMPTYARG
)
443 // work on a copy of the events array
444 EventArray aEventsCopy
;
446 ::vos::OGuard
aGuard( mrMutex
);
447 aEventsCopy
= maEvents
;
451 // we were disposed while waiting for the mutex to lock
458 ::toolkit::ReleaseSolarMutex aReleaseSolar
;
459 for ( EventArray::const_iterator loop
= aEventsCopy
.begin();
460 loop
!= aEventsCopy
.end();
464 processEvent( *(*loop
) );
471 //--------------------------------------------------------------------
472 void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent
& _rEvent
)
474 ::vos::OGuard
aGuard( mrMutex
);
475 if ( impl_isDisposed() )
476 // while we were waiting for our mutex, another thread disposed us
479 const AnyWindowEvent
& rEventDescriptor( static_cast< const AnyWindowEvent
& >( _rEvent
) );
480 if ( rEventDescriptor
.isMouseEvent() )
482 const awt::MouseEvent
& rEvent( rEventDescriptor
.getMouseEvent() );
483 switch ( rEventDescriptor
.getMouseEventType() )
485 case EVENT_MOUSE_PRESSED
:
486 maMouseListeners
.mousePressed( rEvent
);
488 case EVENT_MOUSE_RELEASED
:
489 maMouseListeners
.mouseReleased( rEvent
);
491 case EVENT_MOUSE_ENTERED
:
492 maMouseListeners
.mouseEntered( rEvent
);
494 case EVENT_MOUSE_EXITED
:
495 maMouseListeners
.mouseExited( rEvent
);
498 DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" );
502 else if ( rEventDescriptor
.isPlainEvent() )
504 const lang::EventObject
& rEvent( rEventDescriptor
.getPlainEvent() );
505 switch ( rEventDescriptor
.getPlainEventType() )
507 case EVENT_WINDOW_ENABLED
:
508 maWindow2Listeners
.notifyEach( &XWindowListener2::windowEnabled
, rEvent
);
510 case EVENT_WINDOW_DISABLED
:
511 maWindow2Listeners
.notifyEach( &XWindowListener2::windowDisabled
, rEvent
);
514 DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" );
520 DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (3)?" );
524 //--------------------------------------------------------------------
525 void SAL_CALL
VCLXWindowImpl::acquire()
527 mrAntiImpl
.acquire();
530 //--------------------------------------------------------------------
531 void SAL_CALL
VCLXWindowImpl::release()
533 mrAntiImpl
.release();
536 //====================================================================
537 //====================================================================
539 // Mit Out-Parameter besser als Rueckgabewert, wegen Ref-Objekt...
541 void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent
& rEvent
, Window
* pWindow
)
543 Point aPos
= pWindow
->GetPosPixel();
544 Size aSz
= pWindow
->GetSizePixel();
549 rEvent
.Width
= aSz
.Width();
550 rEvent
.Height
= aSz
.Height();
552 pWindow
->GetBorder( rEvent
.LeftInset
, rEvent
.TopInset
, rEvent
.RightInset
, rEvent
.BottomInset
);
555 void ImplInitKeyEvent( ::com::sun::star::awt::KeyEvent
& rEvent
, const KeyEvent
& rEvt
)
557 rEvent
.Modifiers
= 0;
558 if ( rEvt
.GetKeyCode().IsShift() )
559 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::SHIFT
;
560 if ( rEvt
.GetKeyCode().IsMod1() )
561 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD1
;
562 if ( rEvt
.GetKeyCode().IsMod2() )
563 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD2
;
565 rEvent
.KeyCode
= rEvt
.GetKeyCode().GetCode();
566 rEvent
.KeyChar
= rEvt
.GetCharCode();
567 rEvent
.KeyFunc
= sal::static_int_cast
< sal_Int16
>(
568 rEvt
.GetKeyCode().GetFunction());
571 void ImplInitMouseEvent( awt::MouseEvent
& rEvent
, const MouseEvent
& rEvt
)
573 rEvent
.Modifiers
= 0;
574 if ( rEvt
.IsShift() )
575 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::SHIFT
;
577 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD1
;
579 rEvent
.Modifiers
|= ::com::sun::star::awt::KeyModifier::MOD2
;
583 rEvent
.Buttons
|= ::com::sun::star::awt::MouseButton::LEFT
;
584 if ( rEvt
.IsRight() )
585 rEvent
.Buttons
|= ::com::sun::star::awt::MouseButton::RIGHT
;
586 if ( rEvt
.IsMiddle() )
587 rEvent
.Buttons
|= ::com::sun::star::awt::MouseButton::MIDDLE
;
589 rEvent
.X
= rEvt
.GetPosPixel().X();
590 rEvent
.Y
= rEvt
.GetPosPixel().Y();
591 rEvent
.ClickCount
= rEvt
.GetClicks();
592 rEvent
.PopupTrigger
= sal_False
;
595 // ----------------------------------------------------
597 // ----------------------------------------------------
599 DBG_NAME(VCLXWindow
);
601 VCLXWindow::VCLXWindow( bool _bWithDefaultProps
)
604 DBG_CTOR( VCLXWindow
, 0 );
606 mpImpl
= new VCLXWindowImpl( *this, GetMutex(), _bWithDefaultProps
);
609 VCLXWindow::~VCLXWindow()
611 DBG_DTOR( VCLXWindow
, 0 );
617 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
618 GetWindow()->SetWindowPeer( NULL
, NULL
);
619 GetWindow()->SetAccessible( NULL
);
623 ::toolkit::IAccessibleFactory
& VCLXWindow::getAccessibleFactory()
625 return mpImpl
->getAccessibleFactory().getFactory();
628 void VCLXWindow::SetWindow( Window
* pWindow
)
632 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
633 // GetWindow()->DbgAssertNoEventListeners();
636 SetOutputDevice( pWindow
);
640 GetWindow()->AddEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
641 sal_Bool bDirectVisible
= pWindow
? pWindow
->IsVisible() : false;
642 mpImpl
->setDirectVisible( bDirectVisible
);
647 void VCLXWindow::suspendVclEventListening( )
649 ++mpImpl
->mnListenerLockLevel
;
652 void VCLXWindow::resumeVclEventListening( )
654 DBG_ASSERT( mpImpl
->mnListenerLockLevel
, "VCLXWindow::resumeVclEventListening: not suspended!" );
655 --mpImpl
->mnListenerLockLevel
;
658 void VCLXWindow::notifyWindowRemoved( Window
& _rWindow
)
660 if ( mpImpl
->getContainerListeners().getLength() )
662 awt::VclContainerEvent aEvent
;
663 aEvent
.Source
= *this;
664 aEvent
.Child
= static_cast< XWindow
* >( _rWindow
.GetWindowPeer() );
665 mpImpl
->getContainerListeners().windowRemoved( aEvent
);
669 IMPL_LINK( VCLXWindow
, WindowEventListener
, VclSimpleEvent
*, pEvent
)
671 if ( mpImpl
->mnListenerLockLevel
)
674 DBG_ASSERT( pEvent
&& pEvent
->ISA( VclWindowEvent
), "Unknown WindowEvent!" );
675 if ( pEvent
&& pEvent
->ISA( VclWindowEvent
) )
677 DBG_ASSERT( ((VclWindowEvent
*)pEvent
)->GetWindow() && GetWindow(), "Window???" );
678 ProcessWindowEvent( *(VclWindowEvent
*)pEvent
);
683 void VCLXWindow::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
685 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xThis( (::cppu::OWeakObject
*)this );
687 switch ( rVclWindowEvent
.GetId() )
689 case VCLEVENT_WINDOW_ENABLED
:
690 case VCLEVENT_WINDOW_DISABLED
:
692 bool bEnabled
= ( VCLEVENT_WINDOW_ENABLED
== rVclWindowEvent
.GetId() );
693 EventObject
aEvent( *this );
694 mpImpl
->notifyPlainEvent( aEvent
,
695 bEnabled
? EVENT_WINDOW_ENABLED
: EVENT_WINDOW_DISABLED
);
699 case VCLEVENT_WINDOW_PAINT
:
701 if ( mpImpl
->getPaintListeners().getLength() )
703 ::com::sun::star::awt::PaintEvent aEvent
;
704 aEvent
.Source
= (::cppu::OWeakObject
*)this;
705 aEvent
.UpdateRect
= AWTRectangle( *(Rectangle
*)rVclWindowEvent
.GetData() );
707 mpImpl
->getPaintListeners().windowPaint( aEvent
);
711 case VCLEVENT_WINDOW_MOVE
:
713 if ( mpImpl
->getWindowListeners().getLength() )
715 ::com::sun::star::awt::WindowEvent aEvent
;
716 aEvent
.Source
= (::cppu::OWeakObject
*)this;
717 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
718 mpImpl
->getWindowListeners().windowMoved( aEvent
);
722 case VCLEVENT_WINDOW_RESIZE
:
724 if ( mpImpl
->getWindowListeners().getLength() )
726 ::com::sun::star::awt::WindowEvent aEvent
;
727 aEvent
.Source
= (::cppu::OWeakObject
*)this;
728 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
729 mpImpl
->getWindowListeners().windowResized( aEvent
);
733 case VCLEVENT_WINDOW_SHOW
:
735 if ( mpImpl
->getWindowListeners().getLength() )
737 ::com::sun::star::awt::WindowEvent aEvent
;
738 aEvent
.Source
= (::cppu::OWeakObject
*)this;
739 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
740 mpImpl
->getWindowListeners().windowShown( aEvent
);
743 // For TopWindows this means opened...
744 if ( mpImpl
->getTopWindowListeners().getLength() )
746 ::com::sun::star::lang::EventObject aEvent
;
747 aEvent
.Source
= (::cppu::OWeakObject
*)this;
748 mpImpl
->getTopWindowListeners().windowOpened( aEvent
);
752 case VCLEVENT_WINDOW_HIDE
:
754 if ( mpImpl
->getWindowListeners().getLength() )
756 ::com::sun::star::awt::WindowEvent aEvent
;
757 aEvent
.Source
= (::cppu::OWeakObject
*)this;
758 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
759 mpImpl
->getWindowListeners().windowHidden( aEvent
);
762 // For TopWindows this means closed...
763 if ( mpImpl
->getTopWindowListeners().getLength() )
765 ::com::sun::star::lang::EventObject aEvent
;
766 aEvent
.Source
= (::cppu::OWeakObject
*)this;
767 mpImpl
->getTopWindowListeners().windowClosed( aEvent
);
771 case VCLEVENT_WINDOW_ACTIVATE
:
773 if ( mpImpl
->getTopWindowListeners().getLength() )
775 ::com::sun::star::lang::EventObject aEvent
;
776 aEvent
.Source
= (::cppu::OWeakObject
*)this;
777 mpImpl
->getTopWindowListeners().windowActivated( aEvent
);
781 case VCLEVENT_WINDOW_DEACTIVATE
:
783 if ( mpImpl
->getTopWindowListeners().getLength() )
785 ::com::sun::star::lang::EventObject aEvent
;
786 aEvent
.Source
= (::cppu::OWeakObject
*)this;
787 mpImpl
->getTopWindowListeners().windowDeactivated( aEvent
);
791 case VCLEVENT_WINDOW_CLOSE
:
793 if ( mpImpl
->getDockableWindowListeners().getLength() )
795 ::com::sun::star::lang::EventObject aEvent
;
796 aEvent
.Source
= (::cppu::OWeakObject
*)this;
797 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed
, aEvent
);
799 if ( mpImpl
->getTopWindowListeners().getLength() )
801 ::com::sun::star::lang::EventObject aEvent
;
802 aEvent
.Source
= (::cppu::OWeakObject
*)this;
803 mpImpl
->getTopWindowListeners().windowClosing( aEvent
);
807 case VCLEVENT_CONTROL_GETFOCUS
:
808 case VCLEVENT_WINDOW_GETFOCUS
:
810 if ( ( rVclWindowEvent
.GetWindow()->IsCompoundControl()
811 && rVclWindowEvent
.GetId() == VCLEVENT_CONTROL_GETFOCUS
813 || ( !rVclWindowEvent
.GetWindow()->IsCompoundControl()
814 && rVclWindowEvent
.GetId() == VCLEVENT_WINDOW_GETFOCUS
818 if ( mpImpl
->getFocusListeners().getLength() )
820 ::com::sun::star::awt::FocusEvent aEvent
;
821 aEvent
.Source
= (::cppu::OWeakObject
*)this;
822 aEvent
.FocusFlags
= rVclWindowEvent
.GetWindow()->GetGetFocusFlags();
823 aEvent
.Temporary
= sal_False
;
824 mpImpl
->getFocusListeners().focusGained( aEvent
);
829 case VCLEVENT_CONTROL_LOSEFOCUS
:
830 case VCLEVENT_WINDOW_LOSEFOCUS
:
832 if ( ( rVclWindowEvent
.GetWindow()->IsCompoundControl()
833 && rVclWindowEvent
.GetId() == VCLEVENT_CONTROL_LOSEFOCUS
835 || ( !rVclWindowEvent
.GetWindow()->IsCompoundControl()
836 && rVclWindowEvent
.GetId() == VCLEVENT_WINDOW_LOSEFOCUS
840 if ( mpImpl
->getFocusListeners().getLength() )
842 ::com::sun::star::awt::FocusEvent aEvent
;
843 aEvent
.Source
= (::cppu::OWeakObject
*)this;
844 aEvent
.FocusFlags
= rVclWindowEvent
.GetWindow()->GetGetFocusFlags();
845 aEvent
.Temporary
= sal_False
;
847 Window
* pNext
= Application::GetFocusWindow();
850 // Bei zusammengesetzten Controls interessiert sich keiner fuer das Innenleben:
851 Window
* pNextC
= pNext
;
852 while ( pNextC
&& !pNextC
->IsCompoundControl() )
853 pNextC
= pNextC
->GetParent();
857 pNext
->GetComponentInterface( sal_True
);
858 aEvent
.NextFocus
= (::cppu::OWeakObject
*)pNext
->GetWindowPeer();
860 mpImpl
->getFocusListeners().focusLost( aEvent
);
865 case VCLEVENT_WINDOW_MINIMIZE
:
867 if ( mpImpl
->getTopWindowListeners().getLength() )
869 ::com::sun::star::lang::EventObject aEvent
;
870 aEvent
.Source
= (::cppu::OWeakObject
*)this;
871 mpImpl
->getTopWindowListeners().windowMinimized( aEvent
);
875 case VCLEVENT_WINDOW_NORMALIZE
:
877 if ( mpImpl
->getTopWindowListeners().getLength() )
879 ::com::sun::star::lang::EventObject aEvent
;
880 aEvent
.Source
= (::cppu::OWeakObject
*)this;
881 mpImpl
->getTopWindowListeners().windowNormalized( aEvent
);
885 case VCLEVENT_WINDOW_KEYINPUT
:
887 if ( mpImpl
->getKeyListeners().getLength() )
889 ::com::sun::star::awt::KeyEvent aEvent
;
890 aEvent
.Source
= (::cppu::OWeakObject
*)this;
891 ImplInitKeyEvent( aEvent
, *(KeyEvent
*)rVclWindowEvent
.GetData() );
892 mpImpl
->getKeyListeners().keyPressed( aEvent
);
896 case VCLEVENT_WINDOW_KEYUP
:
898 if ( mpImpl
->getKeyListeners().getLength() )
900 ::com::sun::star::awt::KeyEvent aEvent
;
901 aEvent
.Source
= (::cppu::OWeakObject
*)this;
902 ImplInitKeyEvent( aEvent
, *(KeyEvent
*)rVclWindowEvent
.GetData() );
903 mpImpl
->getKeyListeners().keyReleased( aEvent
);
907 case VCLEVENT_WINDOW_COMMAND
:
909 CommandEvent
* pCmdEvt
= (CommandEvent
*)rVclWindowEvent
.GetData();
910 if ( mpImpl
->getMouseListeners().getLength() && ( pCmdEvt
->GetCommand() == COMMAND_CONTEXTMENU
) )
912 // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
913 Point aWhere
= static_cast< CommandEvent
* >( rVclWindowEvent
.GetData() )->GetMousePosPixel();
914 if ( !pCmdEvt
->IsMouseEvent() )
915 { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
916 // handles a context menu command as special case of a mouse event, which is simply wrong.
917 // Without extending the API, we would not have another chance to notify listeners of a
918 // keyboard-triggered context menu request
919 // 102205 - 16.08.2002 - fs@openoffice.org
920 aWhere
= Point( -1, -1 );
923 MouseEvent
aMEvt( aWhere
, 1, MOUSE_SIMPLECLICK
, MOUSE_LEFT
, 0 );
924 awt::MouseEvent aEvent
;
925 aEvent
.Source
= (::cppu::OWeakObject
*)this;
926 ImplInitMouseEvent( aEvent
, aMEvt
);
927 aEvent
.PopupTrigger
= sal_True
;
928 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_PRESSED
);
932 case VCLEVENT_WINDOW_MOUSEMOVE
:
934 MouseEvent
* pMouseEvt
= (MouseEvent
*)rVclWindowEvent
.GetData();
935 if ( mpImpl
->getMouseListeners().getLength() && ( pMouseEvt
->IsEnterWindow() || pMouseEvt
->IsLeaveWindow() ) )
937 awt::MouseEvent aEvent
;
938 aEvent
.Source
= (::cppu::OWeakObject
*)this;
939 ImplInitMouseEvent( aEvent
, *pMouseEvt
);
941 mpImpl
->notifyMouseEvent(
943 pMouseEvt
->IsEnterWindow() ? EVENT_MOUSE_ENTERED
: EVENT_MOUSE_EXITED
947 if ( mpImpl
->getMouseMotionListeners().getLength() && !pMouseEvt
->IsEnterWindow() && !pMouseEvt
->IsLeaveWindow() )
949 awt::MouseEvent aEvent
;
950 aEvent
.Source
= (::cppu::OWeakObject
*)this;
951 ImplInitMouseEvent( aEvent
, *pMouseEvt
);
952 aEvent
.ClickCount
= 0; // #92138#
954 if ( pMouseEvt
->GetMode() & MOUSE_SIMPLEMOVE
)
955 mpImpl
->getMouseMotionListeners().mouseMoved( aEvent
);
957 mpImpl
->getMouseMotionListeners().mouseDragged( aEvent
);
961 case VCLEVENT_WINDOW_MOUSEBUTTONDOWN
:
963 if ( mpImpl
->getMouseListeners().getLength() )
965 awt::MouseEvent aEvent
;
966 aEvent
.Source
= (::cppu::OWeakObject
*)this;
967 ImplInitMouseEvent( aEvent
, *(MouseEvent
*)rVclWindowEvent
.GetData() );
968 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_PRESSED
);
972 case VCLEVENT_WINDOW_MOUSEBUTTONUP
:
974 if ( mpImpl
->getMouseListeners().getLength() )
976 awt::MouseEvent aEvent
;
977 aEvent
.Source
= (::cppu::OWeakObject
*)this;
978 ImplInitMouseEvent( aEvent
, *(MouseEvent
*)rVclWindowEvent
.GetData() );
979 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_RELEASED
);
983 case VCLEVENT_WINDOW_STARTDOCKING
:
985 if ( mpImpl
->getDockableWindowListeners().getLength() )
987 DockingData
*pData
= (DockingData
*)rVclWindowEvent
.GetData();
991 ::com::sun::star::awt::DockingEvent aEvent
;
992 aEvent
.Source
= (::cppu::OWeakObject
*)this;
993 aEvent
.TrackingRectangle
= AWTRectangle( pData
->maTrackRect
);
994 aEvent
.MousePos
.X
= pData
->maMousePos
.X();
995 aEvent
.MousePos
.Y
= pData
->maMousePos
.Y();
996 aEvent
.bLiveMode
= pData
->mbLivemode
;
997 aEvent
.bInteractive
= pData
->mbInteractive
;
999 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking
, aEvent
);
1004 case VCLEVENT_WINDOW_DOCKING
:
1006 if ( mpImpl
->getDockableWindowListeners().getLength() )
1008 DockingData
*pData
= (DockingData
*)rVclWindowEvent
.GetData();
1012 ::com::sun::star::awt::DockingEvent aEvent
;
1013 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1014 aEvent
.TrackingRectangle
= AWTRectangle( pData
->maTrackRect
);
1015 aEvent
.MousePos
.X
= pData
->maMousePos
.X();
1016 aEvent
.MousePos
.Y
= pData
->maMousePos
.Y();
1017 aEvent
.bLiveMode
= pData
->mbLivemode
;
1018 aEvent
.bInteractive
= pData
->mbInteractive
;
1020 Reference
< XDockableWindowListener
> xFirstListener
;
1021 ::cppu::OInterfaceIteratorHelper
aIter( mpImpl
->getDockableWindowListeners() );
1022 while ( aIter
.hasMoreElements() && !xFirstListener
.is() )
1024 xFirstListener
.set( aIter
.next(), UNO_QUERY
);
1027 ::com::sun::star::awt::DockingData aDockingData
=
1028 xFirstListener
->docking( aEvent
);
1029 pData
->maTrackRect
= VCLRectangle( aDockingData
.TrackingRectangle
);
1030 pData
->mbFloating
= aDockingData
.bFloating
;
1035 case VCLEVENT_WINDOW_ENDDOCKING
:
1037 if ( mpImpl
->getDockableWindowListeners().getLength() )
1039 EndDockingData
*pData
= (EndDockingData
*)rVclWindowEvent
.GetData();
1043 ::com::sun::star::awt::EndDockingEvent aEvent
;
1044 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1045 aEvent
.WindowRectangle
= AWTRectangle( pData
->maWindowRect
);
1046 aEvent
.bFloating
= pData
->mbFloating
;
1047 aEvent
.bCancelled
= pData
->mbCancelled
;
1048 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking
, aEvent
);
1053 case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING
:
1055 if ( mpImpl
->getDockableWindowListeners().getLength() )
1057 BOOL
*p_bFloating
= (BOOL
*)rVclWindowEvent
.GetData();
1059 ::com::sun::star::lang::EventObject aEvent
;
1060 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1062 Reference
< XDockableWindowListener
> xFirstListener
;
1063 ::cppu::OInterfaceIteratorHelper
aIter( mpImpl
->getDockableWindowListeners() );
1064 while ( aIter
.hasMoreElements() && !xFirstListener
.is() )
1066 xFirstListener
.set( aIter
.next(), UNO_QUERY
);
1069 *p_bFloating
= xFirstListener
->prepareToggleFloatingMode( aEvent
);
1073 case VCLEVENT_WINDOW_TOGGLEFLOATING
:
1075 if ( mpImpl
->getDockableWindowListeners().getLength() )
1077 ::com::sun::star::lang::EventObject aEvent
;
1078 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1079 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode
, aEvent
);
1083 case VCLEVENT_WINDOW_ENDPOPUPMODE
:
1085 if ( mpImpl
->getDockableWindowListeners().getLength() )
1087 EndPopupModeData
*pData
= (EndPopupModeData
*)rVclWindowEvent
.GetData();
1091 ::com::sun::star::awt::EndPopupModeEvent aEvent
;
1092 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1093 aEvent
.FloatingPosition
.X
= pData
->maFloatingPos
.X();
1094 aEvent
.FloatingPosition
.Y
= pData
->maFloatingPos
.Y();
1095 aEvent
.bTearoff
= pData
->mbTearoff
;
1096 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode
, aEvent
);
1105 uno::Reference
< accessibility::XAccessibleContext
> VCLXWindow::CreateAccessibleContext()
1107 ::vos::OGuard
aGuard( GetMutex() );
1108 return getAccessibleFactory().createAccessibleContext( this );
1111 void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b
)
1113 mpImpl
->mbSynthesizingVCLEvent
= _b
;
1116 BOOL
VCLXWindow::IsSynthesizingVCLEvent() const
1118 return mpImpl
->mbSynthesizingVCLEvent
;
1121 Size
VCLXWindow::ImplCalcWindowSize( const Size
& rOutSz
) const
1125 Window
* pWindow
= GetWindow();
1128 sal_Int32 nLeft
, nTop
, nRight
, nBottom
;
1129 pWindow
->GetBorder( nLeft
, nTop
, nRight
, nBottom
);
1130 aSz
.Width() += nLeft
+nRight
;
1131 aSz
.Height() += nTop
+nBottom
;
1137 // ::com::sun::star::lang::XUnoTunnel
1138 IMPL_XUNOTUNNEL2( VCLXWindow
, VCLXDevice
)
1140 // ::com::sun::star::lang::Component
1141 void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException
)
1143 ::vos::OGuard
aGuard( GetMutex() );
1145 mpImpl
->mxViewGraphics
= NULL
;
1147 if ( !mpImpl
->mbDisposing
)
1149 mpImpl
->mbDisposing
= true;
1151 mpImpl
->disposing();
1155 OutputDevice
* pOutDev
= GetOutputDevice();
1156 SetWindow( NULL
); // Damit ggf. Handler abgemeldet werden (virtuell).
1157 SetOutputDevice( pOutDev
);
1158 DestroyOutputDevice();
1161 // #i14103# dispose the accessible context after the window has been destroyed,
1162 // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
1163 // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object
1166 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> xComponent( mpImpl
->mxAccessibleContext
, ::com::sun::star::uno::UNO_QUERY
);
1167 if ( xComponent
.is() )
1168 xComponent
->dispose();
1170 catch ( const ::com::sun::star::uno::Exception
& )
1172 DBG_ERROR( "VCLXWindow::dispose: could not dispose the accessible context!" );
1174 mpImpl
->mxAccessibleContext
.clear();
1176 mpImpl
->mbDisposing
= false;
1180 void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1182 ::vos::OGuard
aGuard( GetMutex() );
1184 mpImpl
->getEventListeners().addInterface( rxListener
);
1187 void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1189 ::vos::OGuard
aGuard( GetMutex() );
1191 mpImpl
->getEventListeners().removeInterface( rxListener
);
1195 // ::com::sun::star::awt::XWindow
1196 void VCLXWindow::setPosSize( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, sal_Int16 Flags
) throw(::com::sun::star::uno::RuntimeException
)
1198 ::vos::OGuard
aGuard( GetMutex() );
1202 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1203 Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X
, Y
, Width
, Height
, Flags
);
1205 GetWindow()->SetPosSizePixel( X
, Y
, Width
, Height
, Flags
);
1209 ::com::sun::star::awt::Rectangle
VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException
)
1211 ::vos::OGuard
aGuard( GetMutex() );
1213 ::com::sun::star::awt::Rectangle aBounds
;
1216 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1217 aBounds
= AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
1219 aBounds
= AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
1225 void VCLXWindow::setVisible( sal_Bool bVisible
) throw(::com::sun::star::uno::RuntimeException
)
1227 ::vos::OGuard
aGuard( GetMutex() );
1229 Window
* pWindow
= GetWindow();
1235 // #57167# TopWindows mit unsichtbaren Parent anzeigen...
1236 ::com::sun::star::uno::Any aTest = queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >*) 0 ) );
1237 if ( aTest.hasValue() )
1239 Window* pParent = pWindow->GetWindow( WINDOW_PARENTOVERLAP );
1240 if ( pParent && !pParent->IsReallyVisible() )
1241 pWindow->SetParent( pWindow->GetWindow( WINDOW_FRAME ) );
1245 mpImpl
->setDirectVisible( bVisible
);
1246 pWindow
->Show( bVisible
&& mpImpl
->isEnableVisible() );
1250 void VCLXWindow::setEnable( sal_Bool bEnable
) throw(::com::sun::star::uno::RuntimeException
)
1252 ::vos::OGuard
aGuard( GetMutex() );
1254 Window
* pWindow
= GetWindow();
1257 pWindow
->Enable( bEnable
, FALSE
); // #95824# without children!
1258 pWindow
->EnableInput( bEnable
);
1262 void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException
)
1264 ::vos::OGuard
aGuard( GetMutex() );
1267 GetWindow()->GrabFocus();
1270 void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1272 ::vos::OGuard
aGuard( GetMutex() );
1274 mpImpl
->getWindowListeners().addInterface( rxListener
);
1276 Reference
< XWindowListener2
> xListener2( rxListener
, UNO_QUERY
);
1277 if ( xListener2
.is() )
1278 mpImpl
->getWindow2Listeners().addInterface( xListener2
);
1280 // #100119# Get all resize events, even if height or width 0, or invisible
1282 GetWindow()->EnableAllResize( TRUE
);
1285 void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1287 ::vos::OGuard
aGuard( GetMutex() );
1289 Reference
< XWindowListener2
> xListener2( rxListener
, UNO_QUERY
);
1290 if ( xListener2
.is() )
1291 mpImpl
->getWindow2Listeners().removeInterface( xListener2
);
1293 mpImpl
->getWindowListeners().removeInterface( rxListener
);
1296 void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFocusListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1298 ::vos::OGuard
aGuard( GetMutex() );
1299 mpImpl
->getFocusListeners().addInterface( rxListener
);
1302 void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFocusListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1304 ::vos::OGuard
aGuard( GetMutex() );
1305 mpImpl
->getFocusListeners().removeInterface( rxListener
);
1308 void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XKeyListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1310 ::vos::OGuard
aGuard( GetMutex() );
1311 mpImpl
->getKeyListeners().addInterface( rxListener
);
1314 void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XKeyListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1316 ::vos::OGuard
aGuard( GetMutex() );
1317 mpImpl
->getKeyListeners().removeInterface( rxListener
);
1320 void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1322 ::vos::OGuard
aGuard( GetMutex() );
1323 mpImpl
->getMouseListeners().addInterface( rxListener
);
1326 void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1328 ::vos::OGuard
aGuard( GetMutex() );
1329 mpImpl
->getMouseListeners().removeInterface( rxListener
);
1332 void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseMotionListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1334 ::vos::OGuard
aGuard( GetMutex() );
1335 mpImpl
->getMouseMotionListeners().addInterface( rxListener
);
1338 void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseMotionListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1340 ::vos::OGuard
aGuard( GetMutex() );
1341 mpImpl
->getMouseMotionListeners().removeInterface( rxListener
);
1344 void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPaintListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1346 ::vos::OGuard
aGuard( GetMutex() );
1347 mpImpl
->getPaintListeners().addInterface( rxListener
);
1350 void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPaintListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1352 ::vos::OGuard
aGuard( GetMutex() );
1353 mpImpl
->getPaintListeners().removeInterface( rxListener
);
1356 // ::com::sun::star::awt::XWindowPeer
1357 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
> VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException
)
1359 // no guard. nothing to guard here.
1360 // 82463 - 12/21/00 - fs
1361 return Application::GetVCLToolkit();
1364 void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPointer
>& rxPointer
) throw(::com::sun::star::uno::RuntimeException
)
1366 ::vos::OGuard
aGuard( GetMutex() );
1368 VCLXPointer
* pPointer
= VCLXPointer::GetImplementation( rxPointer
);
1371 mpImpl
->mxPointer
= rxPointer
;
1373 GetWindow()->SetPointer( pPointer
->GetPointer() );
1377 void VCLXWindow::setBackground( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
1379 ::vos::OGuard
aGuard( GetMutex() );
1383 Color
aColor( (sal_uInt32
)nColor
);
1384 GetWindow()->SetBackground( aColor
);
1385 GetWindow()->SetControlBackground( aColor
);
1387 WindowType eWinType
= GetWindow()->GetType();
1388 if ( ( eWinType
== WINDOW_WINDOW
) ||
1389 ( eWinType
== WINDOW_WORKWINDOW
) ||
1390 ( eWinType
== WINDOW_FLOATINGWINDOW
) )
1392 GetWindow()->Invalidate();
1397 void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags
) throw(::com::sun::star::uno::RuntimeException
)
1399 ::vos::OGuard
aGuard( GetMutex() );
1402 GetWindow()->Invalidate( (sal_uInt16
) nInvalidateFlags
);
1405 void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle
& rRect
, sal_Int16 nInvalidateFlags
) throw(::com::sun::star::uno::RuntimeException
)
1407 ::vos::OGuard
aGuard( GetMutex() );
1410 GetWindow()->Invalidate( VCLRectangle(rRect
), (sal_uInt16
) nInvalidateFlags
);
1414 // ::com::sun::star::awt::XVclWindowPeer
1415 sal_Bool
VCLXWindow::isChild( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& rxPeer
) throw(::com::sun::star::uno::RuntimeException
)
1417 ::vos::OGuard
aGuard( GetMutex() );
1419 sal_Bool bIsChild
= sal_False
;
1420 Window
* pWindow
= GetWindow();
1423 Window
* pPeerWindow
= VCLUnoHelper::GetWindow( rxPeer
);
1424 bIsChild
= pPeerWindow
&& pWindow
->IsChild( pPeerWindow
);
1430 void VCLXWindow::setDesignMode( sal_Bool bOn
) throw(::com::sun::star::uno::RuntimeException
)
1432 ::vos::OGuard
aGuard( GetMutex() );
1434 mpImpl
->mbDesignMode
= bOn
;
1437 sal_Bool
VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException
)
1439 ::vos::OGuard
aGuard( GetMutex() );
1440 return mpImpl
->mbDesignMode
;
1443 void VCLXWindow::enableClipSiblings( sal_Bool bClip
) throw(::com::sun::star::uno::RuntimeException
)
1445 ::vos::OGuard
aGuard( GetMutex() );
1448 GetWindow()->EnableClipSiblings( bClip
);
1451 void VCLXWindow::setForeground( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
1453 ::vos::OGuard
aGuard( GetMutex() );
1457 Color
aColor( (sal_uInt32
)nColor
);
1458 GetWindow()->SetControlForeground( aColor
);
1462 void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor
& rFont
) throw(::com::sun::star::uno::RuntimeException
)
1464 ::vos::OGuard
aGuard( GetMutex() );
1467 GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont
, GetWindow()->GetControlFont() ) );
1470 void VCLXWindow::getStyles( sal_Int16 nType
, ::com::sun::star::awt::FontDescriptor
& Font
, sal_Int32
& ForegroundColor
, sal_Int32
& BackgroundColor
) throw(::com::sun::star::uno::RuntimeException
)
1472 ::vos::OGuard
aGuard( GetMutex() );
1476 const StyleSettings
& rStyleSettings
= GetWindow()->GetSettings().GetStyleSettings();
1480 case ::com::sun::star::awt::Style::FRAME
:
1482 Font
= VCLUnoHelper::CreateFontDescriptor( rStyleSettings
.GetAppFont() );
1483 ForegroundColor
= rStyleSettings
.GetWindowTextColor().GetColor();
1484 BackgroundColor
= rStyleSettings
.GetWindowColor().GetColor();
1487 case ::com::sun::star::awt::Style::DIALOG
:
1489 Font
= VCLUnoHelper::CreateFontDescriptor( rStyleSettings
.GetAppFont() );
1490 ForegroundColor
= rStyleSettings
.GetDialogTextColor().GetColor();
1491 BackgroundColor
= rStyleSettings
.GetDialogColor().GetColor();
1494 default: DBG_ERROR( "VCLWindow::getStyles() - unknown Type" );
1502 static void setColorSettings( Window
* _pWindow
, const ::com::sun::star::uno::Any
& _rValue
,
1503 void (StyleSettings::*pSetter
)( const Color
& ), const Color
& (StyleSettings::*pGetter
)( ) const )
1505 sal_Int32 nColor
= 0;
1506 if ( !( _rValue
>>= nColor
) )
1507 nColor
= (Application::GetSettings().GetStyleSettings().*pGetter
)().GetColor();
1509 AllSettings aSettings
= _pWindow
->GetSettings();
1510 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
1512 (aStyleSettings
.*pSetter
)( Color( nColor
) );
1514 aSettings
.SetStyleSettings( aStyleSettings
);
1515 _pWindow
->SetSettings( aSettings
, TRUE
);
1519 // Terminated by BASEPROPERTY_NOTFOUND (or 0)
1520 void VCLXWindow::PushPropertyIds( std::list
< sal_uInt16
> &rIds
,
1524 va_start( pVarArgs
, nFirstId
);
1526 for ( int nId
= nFirstId
; nId
!= BASEPROPERTY_NOTFOUND
;
1527 nId
= va_arg( pVarArgs
, int ) )
1528 rIds
.push_back( (sal_uInt16
) nId
);
1533 void VCLXWindow::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
, bool bWithDefaults
)
1535 // These are common across ~all VCLXWindow derived classes
1537 PushPropertyIds( rIds
,
1539 BASEPROPERTY_BACKGROUNDCOLOR
,
1540 BASEPROPERTY_BORDER
,
1541 BASEPROPERTY_BORDERCOLOR
,
1542 BASEPROPERTY_DEFAULTCONTROL
,
1543 BASEPROPERTY_ENABLED
,
1544 BASEPROPERTY_FONTDESCRIPTOR
,
1545 BASEPROPERTY_HELPTEXT
,
1546 BASEPROPERTY_HELPURL
,
1548 BASEPROPERTY_PRINTABLE
,
1549 BASEPROPERTY_ENABLEVISIBLE
, // for visibility
1550 BASEPROPERTY_TABSTOP
,
1553 // lovely hack from:
1554 // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
1555 std::list
< sal_uInt16
>::const_iterator iter
;
1556 for( iter
= rIds
.begin(); iter
!= rIds
.end(); iter
++) {
1557 if( *iter
== BASEPROPERTY_FONTDESCRIPTOR
)
1559 // some properties are not included in the FontDescriptor, but everytime
1560 // when we have a FontDescriptor we want to have these properties too.
1561 // => Easier to register the here, istead everywhere where I register the FontDescriptor...
1563 rIds
.push_back( BASEPROPERTY_TEXTCOLOR
);
1564 rIds
.push_back( BASEPROPERTY_TEXTLINECOLOR
);
1565 rIds
.push_back( BASEPROPERTY_FONTRELIEF
);
1566 rIds
.push_back( BASEPROPERTY_FONTEMPHASISMARK
);
1572 void VCLXWindow::GetPropertyIds( std::list
< sal_uInt16
>& _out_rIds
)
1574 return ImplGetPropertyIds( _out_rIds
, mpImpl
->mbWithDefaultProps
);
1577 ::cppu::OInterfaceContainerHelper
& VCLXWindow::GetContainerListeners()
1579 return mpImpl
->getContainerListeners();
1582 ::cppu::OInterfaceContainerHelper
& VCLXWindow::GetTopWindowListeners()
1584 return mpImpl
->getTopWindowListeners();
1589 void lcl_updateWritingMode( Window
& _rWindow
, const sal_Int16 _nWritingMode
, const sal_Int16 _nContextWritingMode
)
1591 BOOL bEnableRTL
= FALSE
;
1592 switch ( _nWritingMode
)
1594 case WritingMode2::LR_TB
: bEnableRTL
= FALSE
; break;
1595 case WritingMode2::RL_TB
: bEnableRTL
= TRUE
; break;
1596 case WritingMode2::CONTEXT
:
1598 // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use
1599 // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our
1600 // own window for its RTL mode
1601 switch ( _nContextWritingMode
)
1603 case WritingMode2::LR_TB
: bEnableRTL
= FALSE
; break;
1604 case WritingMode2::RL_TB
: bEnableRTL
= TRUE
; break;
1605 case WritingMode2::CONTEXT
:
1607 const Window
* pParent
= _rWindow
.GetParent();
1608 OSL_ENSURE( pParent
, "lcl_updateWritingMode: cannot determine context's writing mode!" );
1610 bEnableRTL
= pParent
->IsRTLEnabled();
1617 OSL_ENSURE( false, "lcl_updateWritingMode: unsupported WritingMode!" );
1618 } // switch ( nWritingMode )
1620 _rWindow
.EnableRTL( bEnableRTL
);
1624 void VCLXWindow::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1626 ::vos::OGuard
aGuard( GetMutex() );
1628 Window
* pWindow
= GetWindow();
1632 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
1634 WindowType eWinType
= pWindow
->GetType();
1635 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1636 switch ( nPropType
)
1638 case BASEPROPERTY_CONTEXT_WRITING_MODE
:
1640 OSL_VERIFY( Value
>>= mpImpl
->mnContextWritingMode
);
1641 if ( mpImpl
->mnWritingMode
== WritingMode2::CONTEXT
)
1642 lcl_updateWritingMode( *pWindow
, mpImpl
->mnWritingMode
, mpImpl
->mnContextWritingMode
);
1646 case BASEPROPERTY_WRITING_MODE
:
1648 sal_Bool bProperType
= ( Value
>>= mpImpl
->mnWritingMode
);
1649 OSL_ENSURE( bProperType
, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" );
1651 lcl_updateWritingMode( *pWindow
, mpImpl
->mnWritingMode
, mpImpl
->mnContextWritingMode
);
1655 case BASEPROPERTY_WHEELWITHOUTFOCUS
:
1657 sal_Bool
bWheelOnHover( sal_True
);
1658 if ( Value
>>= bWheelOnHover
)
1660 AllSettings aSettings
= pWindow
->GetSettings();
1661 MouseSettings aMouseSettings
= aSettings
.GetMouseSettings();
1663 aMouseSettings
.SetNoWheelActionWithoutFocus( !bWheelOnHover
);
1664 aSettings
.SetMouseSettings( aMouseSettings
);
1666 pWindow
->SetSettings( aSettings
, TRUE
);
1671 case BASEPROPERTY_NATIVE_WIDGET_LOOK
:
1673 sal_Bool
bEnable( sal_True
);
1674 OSL_VERIFY( Value
>>= bEnable
);
1675 pWindow
->EnableNativeWidget( bEnable
);
1679 case BASEPROPERTY_PLUGINPARENT
:
1681 // set parent handle
1682 SetSystemParent_Impl( Value
);
1686 case BASEPROPERTY_ENABLED
:
1688 sal_Bool b
= sal_Bool();
1693 case BASEPROPERTY_ENABLEVISIBLE
:
1695 sal_Bool b
= sal_False
;
1698 if( b
!= mpImpl
->isEnableVisible() )
1700 mpImpl
->setEnableVisible( b
);
1701 Window
* pWindow
= GetWindow();
1703 pWindow
->Show( b
&& mpImpl
->isDirectVisible() );
1708 case BASEPROPERTY_TEXT
:
1709 case BASEPROPERTY_LABEL
:
1710 case BASEPROPERTY_TITLE
:
1712 ::rtl::OUString aText
;
1713 if ( Value
>>= aText
)
1717 case WINDOW_OKBUTTON
:
1718 case WINDOW_CANCELBUTTON
:
1719 case WINDOW_HELPBUTTON
:
1720 // Standard Button: overwrite only if not empty.
1721 if (aText
.getLength())
1722 pWindow
->SetText( aText
);
1726 pWindow
->SetText( aText
);
1732 case BASEPROPERTY_ACCESSIBLENAME
:
1734 ::rtl::OUString aText
;
1735 if ( Value
>>= aText
)
1736 pWindow
->SetAccessibleName( aText
);
1739 case BASEPROPERTY_HELPURL
:
1741 ::rtl::OUString aURL
;
1742 if ( Value
>>= aURL
)
1744 String
aHelpURL( aURL
);
1745 String
aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
1746 if ( aHelpURL
.CompareIgnoreCaseToAscii( aPattern
, aPattern
.Len() ) == COMPARE_EQUAL
)
1748 String aID
= aHelpURL
.Copy( aPattern
.Len() );
1749 pWindow
->SetHelpId( aID
.ToInt32() );
1753 pWindow
->SetSmartHelpId( SmartId( aHelpURL
) );
1758 case BASEPROPERTY_HELPTEXT
:
1760 ::rtl::OUString aHelpText
;
1761 if ( Value
>>= aHelpText
)
1763 pWindow
->SetQuickHelpText( aHelpText
);
1767 case BASEPROPERTY_FONTDESCRIPTOR
:
1770 pWindow
->SetControlFont( Font() );
1773 ::com::sun::star::awt::FontDescriptor aFont
;
1774 if ( Value
>>= aFont
)
1775 pWindow
->SetControlFont( VCLUnoHelper::CreateFont( aFont
, pWindow
->GetControlFont() ) );
1779 case BASEPROPERTY_FONTRELIEF
:
1781 sal_Int16 n
= sal_Int16();
1784 Font aFont
= pWindow
->GetControlFont();
1785 aFont
.SetRelief( (FontRelief
)n
);
1786 pWindow
->SetControlFont( aFont
);
1790 case BASEPROPERTY_FONTEMPHASISMARK
:
1792 sal_Int16 n
= sal_Int16();
1795 Font aFont
= pWindow
->GetControlFont();
1796 aFont
.SetEmphasisMark( n
);
1797 pWindow
->SetControlFont( aFont
);
1801 case BASEPROPERTY_BACKGROUNDCOLOR
:
1806 // set dialog color for default
1808 case WINDOW_MESSBOX
:
1809 case WINDOW_INFOBOX
:
1810 case WINDOW_WARNINGBOX
:
1811 case WINDOW_ERRORBOX
:
1812 case WINDOW_QUERYBOX
:
1813 case WINDOW_TABPAGE
:
1815 Color aColor
= pWindow
->GetSettings().GetStyleSettings().GetDialogColor();
1816 pWindow
->SetBackground( aColor
);
1817 pWindow
->SetControlBackground( aColor
);
1821 case WINDOW_FIXEDTEXT
:
1822 case WINDOW_CHECKBOX
:
1823 case WINDOW_RADIOBUTTON
:
1824 case WINDOW_GROUPBOX
:
1825 case WINDOW_FIXEDLINE
:
1827 // support transparency only for special controls
1828 pWindow
->SetBackground();
1829 pWindow
->SetControlBackground();
1830 pWindow
->SetPaintTransparent( TRUE
);
1836 // default code which enables transparency for
1837 // compound controls. It's not real transparency
1838 // as most of these controls repaint their client
1839 // area completely new.
1840 if ( pWindow
->IsCompoundControl() )
1841 pWindow
->SetBackground();
1842 pWindow
->SetControlBackground();
1849 sal_Int32 nColor
= 0;
1850 if ( Value
>>= nColor
)
1852 Color
aColor( nColor
);
1853 pWindow
->SetControlBackground( aColor
);
1854 pWindow
->SetBackground( aColor
);
1857 // reset paint transparent mode
1858 case WINDOW_FIXEDTEXT
:
1859 case WINDOW_CHECKBOX
:
1860 case WINDOW_RADIOBUTTON
:
1861 case WINDOW_GROUPBOX
:
1862 case WINDOW_FIXEDLINE
:
1863 pWindow
->SetPaintTransparent( FALSE
);
1866 pWindow
->Invalidate(); // Falls das Control nicht drauf reagiert
1870 case BASEPROPERTY_TEXTCOLOR
:
1873 pWindow
->SetControlForeground();
1877 sal_Int32 nColor
= 0;
1878 if ( Value
>>= nColor
)
1880 Color
aColor( nColor
);
1881 pWindow
->SetTextColor( aColor
);
1882 pWindow
->SetControlForeground( aColor
);
1886 case BASEPROPERTY_TEXTLINECOLOR
:
1889 pWindow
->SetTextLineColor();
1893 sal_Int32 nColor
= 0;
1894 if ( Value
>>= nColor
)
1896 Color
aColor( nColor
);
1897 pWindow
->SetTextLineColor( aColor
);
1901 case BASEPROPERTY_FILLCOLOR
:
1903 pWindow
->SetFillColor();
1906 sal_Int32 nColor
= 0;
1907 if ( Value
>>= nColor
)
1909 Color
aColor( nColor
);
1910 pWindow
->SetFillColor( aColor
);
1914 case BASEPROPERTY_LINECOLOR
:
1916 pWindow
->SetLineColor();
1919 sal_Int32 nColor
= 0;
1920 if ( Value
>>= nColor
)
1922 Color
aColor( nColor
);
1923 pWindow
->SetLineColor( aColor
);
1927 case BASEPROPERTY_BORDER
:
1929 WinBits nStyle
= pWindow
->GetStyle();
1930 sal_uInt16 nBorder
= 0;
1934 pWindow
->SetStyle( nStyle
& ~WB_BORDER
);
1938 pWindow
->SetStyle( nStyle
| WB_BORDER
);
1939 pWindow
->SetBorderStyle( nBorder
);
1943 case BASEPROPERTY_TABSTOP
:
1945 WinBits nStyle
= pWindow
->GetStyle() & ~WB_TABSTOP
;
1948 sal_Bool bTab
= false;
1951 nStyle
|= WB_TABSTOP
;
1953 nStyle
|= WB_NOTABSTOP
;
1955 pWindow
->SetStyle( nStyle
);
1958 case BASEPROPERTY_VERTICALALIGN
:
1960 VerticalAlignment eAlign
= VerticalAlignment_MAKE_FIXED_SIZE
;
1961 WinBits nStyle
= pWindow
->GetStyle();
1962 nStyle
&= ~(WB_TOP
|WB_VCENTER
|WB_BOTTOM
);
1967 case VerticalAlignment_TOP
:
1970 case VerticalAlignment_MIDDLE
:
1971 nStyle
|= WB_VCENTER
;
1973 case VerticalAlignment_BOTTOM
:
1974 nStyle
|= WB_BOTTOM
;
1976 default: ; // for warning free code, MAKE_FIXED_SIZE
1978 pWindow
->SetStyle( nStyle
);
1981 case BASEPROPERTY_ALIGN
:
1983 sal_Int16 nAlign
= PROPERTY_ALIGN_LEFT
;
1986 case WINDOW_COMBOBOX
:
1988 case WINDOW_PUSHBUTTON
:
1989 case WINDOW_OKBUTTON
:
1990 case WINDOW_CANCELBUTTON
:
1991 case WINDOW_HELPBUTTON
:
1992 nAlign
= PROPERTY_ALIGN_CENTER
;
1994 case WINDOW_FIXEDTEXT
:
1996 case WINDOW_MULTILINEEDIT
:
1997 case WINDOW_CHECKBOX
:
1998 case WINDOW_RADIOBUTTON
:
1999 case WINDOW_LISTBOX
:
2001 WinBits nStyle
= pWindow
->GetStyle();
2002 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
2005 if ( nAlign
== PROPERTY_ALIGN_LEFT
)
2007 else if ( nAlign
== PROPERTY_ALIGN_CENTER
)
2008 nStyle
|= WB_CENTER
;
2011 pWindow
->SetStyle( nStyle
);
2017 case BASEPROPERTY_MULTILINE
:
2019 if ( ( eWinType
== WINDOW_FIXEDTEXT
)
2020 || ( eWinType
== WINDOW_CHECKBOX
)
2021 || ( eWinType
== WINDOW_RADIOBUTTON
)
2022 || ( eWinType
== WINDOW_BUTTON
)
2023 || ( eWinType
== WINDOW_PUSHBUTTON
)
2024 || ( eWinType
== WINDOW_OKBUTTON
)
2025 || ( eWinType
== WINDOW_CANCELBUTTON
)
2026 || ( eWinType
== WINDOW_HELPBUTTON
)
2029 WinBits nStyle
= pWindow
->GetStyle();
2030 sal_Bool bMulti
= false;
2033 nStyle
|= WB_WORDBREAK
;
2035 nStyle
&= ~WB_WORDBREAK
;
2036 pWindow
->SetStyle( nStyle
);
2040 case BASEPROPERTY_ORIENTATION
:
2044 case WINDOW_FIXEDLINE
:
2046 sal_Int32 nOrientation
= 0;
2047 if ( Value
>>= nOrientation
)
2049 WinBits nStyle
= pWindow
->GetStyle();
2050 nStyle
&= ~(WB_HORZ
|WB_VERT
);
2051 if ( nOrientation
== 0 )
2056 pWindow
->SetStyle( nStyle
);
2063 case BASEPROPERTY_AUTOMNEMONICS
:
2065 sal_Bool bAutoMnemonics
= false;
2066 Value
>>= bAutoMnemonics
;
2067 AllSettings aSettings
= pWindow
->GetSettings();
2068 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
2069 if ( aStyleSettings
.GetAutoMnemonic() != bAutoMnemonics
)
2071 aStyleSettings
.SetAutoMnemonic( bAutoMnemonics
);
2072 aSettings
.SetStyleSettings( aStyleSettings
);
2073 pWindow
->SetSettings( aSettings
);
2077 case BASEPROPERTY_MOUSETRANSPARENT
:
2079 sal_Bool bMouseTransparent
= false;
2080 Value
>>= bMouseTransparent
;
2081 pWindow
->SetMouseTransparent( bMouseTransparent
);
2084 case BASEPROPERTY_PAINTTRANSPARENT
:
2086 sal_Bool bPaintTransparent
= false;
2087 Value
>>= bPaintTransparent
;
2088 pWindow
->SetPaintTransparent( bPaintTransparent
);
2089 // pWindow->SetBackground();
2093 case BASEPROPERTY_REPEAT
:
2095 sal_Bool
bRepeat( FALSE
);
2098 WinBits nStyle
= pWindow
->GetStyle();
2100 nStyle
|= WB_REPEAT
;
2102 nStyle
&= ~WB_REPEAT
;
2103 pWindow
->SetStyle( nStyle
);
2107 case BASEPROPERTY_REPEAT_DELAY
:
2109 sal_Int32 nRepeatDelay
= 0;
2110 if ( Value
>>= nRepeatDelay
)
2112 AllSettings aSettings
= pWindow
->GetSettings();
2113 MouseSettings aMouseSettings
= aSettings
.GetMouseSettings();
2115 aMouseSettings
.SetButtonRepeat( nRepeatDelay
);
2116 aSettings
.SetMouseSettings( aMouseSettings
);
2118 pWindow
->SetSettings( aSettings
, TRUE
);
2123 case BASEPROPERTY_SYMBOL_COLOR
:
2124 ::toolkit::setColorSettings( pWindow
, Value
, &StyleSettings::SetButtonTextColor
, &StyleSettings::GetButtonTextColor
);
2127 case BASEPROPERTY_BORDERCOLOR
:
2128 ::toolkit::setColorSettings( pWindow
, Value
, &StyleSettings::SetMonoColor
, &StyleSettings::GetMonoColor
);
2130 case BASEPROPERTY_DEFAULTCONTROL
:
2132 rtl::OUString aName
;
2139 ::com::sun::star::uno::Any
VCLXWindow::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2141 ::vos::OGuard
aGuard( GetMutex() );
2143 ::com::sun::star::uno::Any aProp
;
2146 WindowType eWinType
= GetWindow()->GetType();
2147 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2148 switch ( nPropType
)
2150 case BASEPROPERTY_CONTEXT_WRITING_MODE
:
2151 aProp
<<= mpImpl
->mnContextWritingMode
;
2154 case BASEPROPERTY_WRITING_MODE
:
2155 aProp
<<= mpImpl
->mnWritingMode
;
2158 case BASEPROPERTY_WHEELWITHOUTFOCUS
:
2160 sal_Bool bWheelOnHover
= !GetWindow()->GetSettings().GetMouseSettings().GetNoWheelActionWithoutFocus();
2161 aProp
<<= bWheelOnHover
;
2165 case BASEPROPERTY_NATIVE_WIDGET_LOOK
:
2166 aProp
<<= (sal_Bool
) GetWindow()->IsNativeWidgetEnabled();
2169 case BASEPROPERTY_ENABLED
:
2170 aProp
<<= (sal_Bool
) GetWindow()->IsEnabled();
2173 case BASEPROPERTY_ENABLEVISIBLE
:
2174 aProp
<<= (sal_Bool
) GetWindow()->IsVisible();
2177 case BASEPROPERTY_TEXT
:
2178 case BASEPROPERTY_LABEL
:
2179 case BASEPROPERTY_TITLE
:
2181 ::rtl::OUString aText
= GetWindow()->GetText();
2185 case BASEPROPERTY_ACCESSIBLENAME
:
2187 ::rtl::OUString aText
= GetWindow()->GetAccessibleName();
2191 case BASEPROPERTY_HELPTEXT
:
2193 ::rtl::OUString aText
= GetWindow()->GetQuickHelpText();
2197 case BASEPROPERTY_HELPURL
:
2199 SmartId aSmartId
= GetWindow()->GetSmartHelpId();
2200 if( aSmartId
.HasString() )
2202 String aStrHelpId
= aSmartId
.GetStr();
2203 aProp
<<= ::rtl::OUString( aStrHelpId
);
2207 ::rtl::OUStringBuffer aURL
;
2208 aURL
.appendAscii( "HID:" );
2209 aURL
.append( (sal_Int32
) GetWindow()->GetHelpId() );
2210 aProp
<<= aURL
.makeStringAndClear();
2214 case BASEPROPERTY_FONTDESCRIPTOR
:
2216 Font aFont
= GetWindow()->GetControlFont();
2217 ::com::sun::star::awt::FontDescriptor aFD
= VCLUnoHelper::CreateFontDescriptor( aFont
);
2221 case BASEPROPERTY_BACKGROUNDCOLOR
:
2222 aProp
<<= (sal_Int32
) GetWindow()->GetControlBackground().GetColor();
2224 case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR
:
2225 aProp
<<= (sal_Int32
) GetWindow()->GetDisplayBackground().GetColor().GetColor();
2227 case BASEPROPERTY_FONTRELIEF
:
2228 aProp
<<= (sal_Int16
) GetWindow()->GetControlFont().GetRelief();
2230 case BASEPROPERTY_FONTEMPHASISMARK
:
2231 aProp
<<= (sal_Int16
) GetWindow()->GetControlFont().GetEmphasisMark();
2233 case BASEPROPERTY_TEXTCOLOR
:
2234 aProp
<<= (sal_Int32
) GetWindow()->GetControlForeground().GetColor();
2236 case BASEPROPERTY_TEXTLINECOLOR
:
2237 aProp
<<= (sal_Int32
) GetWindow()->GetTextLineColor().GetColor();
2239 case BASEPROPERTY_FILLCOLOR
:
2240 aProp
<<= (sal_Int32
) GetWindow()->GetFillColor().GetColor();
2242 case BASEPROPERTY_LINECOLOR
:
2243 aProp
<<= (sal_Int32
) GetWindow()->GetLineColor().GetColor();
2245 case BASEPROPERTY_BORDER
:
2247 sal_Int16 nBorder
= 0;
2248 if ( GetWindow()->GetStyle() & WB_BORDER
)
2249 nBorder
= GetWindow()->GetBorderStyle();
2253 case BASEPROPERTY_TABSTOP
:
2254 aProp
<<= (sal_Bool
) ( GetWindow()->GetStyle() & WB_TABSTOP
) ? sal_True
: sal_False
;
2256 case BASEPROPERTY_VERTICALALIGN
:
2258 WinBits nStyle
= GetWindow()->GetStyle();
2259 if ( nStyle
& WB_TOP
)
2260 aProp
<<= VerticalAlignment_TOP
;
2261 else if ( nStyle
& WB_VCENTER
)
2262 aProp
<<= VerticalAlignment_MIDDLE
;
2263 else if ( nStyle
& WB_BOTTOM
)
2264 aProp
<<= VerticalAlignment_BOTTOM
;
2267 case BASEPROPERTY_ALIGN
:
2271 case WINDOW_FIXEDTEXT
:
2273 case WINDOW_MULTILINEEDIT
:
2274 case WINDOW_CHECKBOX
:
2275 case WINDOW_RADIOBUTTON
:
2276 case WINDOW_LISTBOX
:
2277 case WINDOW_COMBOBOX
:
2279 case WINDOW_PUSHBUTTON
:
2280 case WINDOW_OKBUTTON
:
2281 case WINDOW_CANCELBUTTON
:
2282 case WINDOW_HELPBUTTON
:
2284 WinBits nStyle
= GetWindow()->GetStyle();
2285 if ( nStyle
& WB_LEFT
)
2286 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_LEFT
;
2287 else if ( nStyle
& WB_CENTER
)
2288 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_CENTER
;
2289 else if ( nStyle
& WB_RIGHT
)
2290 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_RIGHT
;
2295 case BASEPROPERTY_MULTILINE
:
2297 if ( ( eWinType
== WINDOW_FIXEDTEXT
)
2298 || ( eWinType
== WINDOW_CHECKBOX
)
2299 || ( eWinType
== WINDOW_RADIOBUTTON
)
2300 || ( eWinType
== WINDOW_BUTTON
)
2301 || ( eWinType
== WINDOW_PUSHBUTTON
)
2302 || ( eWinType
== WINDOW_OKBUTTON
)
2303 || ( eWinType
== WINDOW_CANCELBUTTON
)
2304 || ( eWinType
== WINDOW_HELPBUTTON
)
2306 aProp
<<= (sal_Bool
) ( GetWindow()->GetStyle() & WB_WORDBREAK
) ? sal_True
: sal_False
;
2309 case BASEPROPERTY_AUTOMNEMONICS
:
2311 sal_Bool bAutoMnemonics
= GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
2312 aProp
<<= bAutoMnemonics
;
2315 case BASEPROPERTY_MOUSETRANSPARENT
:
2317 sal_Bool bMouseTransparent
= GetWindow()->IsMouseTransparent();
2318 aProp
<<= bMouseTransparent
;
2321 case BASEPROPERTY_PAINTTRANSPARENT
:
2323 sal_Bool bPaintTransparent
= GetWindow()->IsPaintTransparent();
2324 aProp
<<= bPaintTransparent
;
2328 case BASEPROPERTY_REPEAT
:
2329 aProp
<<= (sal_Bool
)( 0 != ( GetWindow()->GetStyle() & WB_REPEAT
) );
2332 case BASEPROPERTY_REPEAT_DELAY
:
2334 sal_Int32 nButtonRepeat
= GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
2335 aProp
<<= (sal_Int32
)nButtonRepeat
;
2339 case BASEPROPERTY_SYMBOL_COLOR
:
2340 aProp
<<= (sal_Int32
)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
2343 case BASEPROPERTY_BORDERCOLOR
:
2344 aProp
<<= (sal_Int32
)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor();
2352 // ::com::sun::star::awt::XLayoutConstrains
2353 ::com::sun::star::awt::Size
VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2355 ::vos::OGuard
aGuard( GetMutex() );
2357 // Diese Methode sollte nur fuer Componenten gerufen werden, die zwar
2358 // ueber das ::com::sun::star::awt::Toolkit erzeugt werden koennen, aber fuer die es
2359 // kein Interface gibt.
2364 WindowType nWinType
= GetWindow()->GetType();
2367 case WINDOW_CONTROL
:
2368 aSz
.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
2369 aSz
.Height() = GetWindow()->GetTextHeight()+2*6;
2372 case WINDOW_PATTERNBOX
:
2373 case WINDOW_NUMERICBOX
:
2374 case WINDOW_METRICBOX
:
2375 case WINDOW_CURRENCYBOX
:
2376 case WINDOW_DATEBOX
:
2377 case WINDOW_TIMEBOX
:
2378 case WINDOW_LONGCURRENCYBOX
:
2379 aSz
.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
2380 aSz
.Height() = GetWindow()->GetTextHeight()+2*2;
2382 case WINDOW_SCROLLBARBOX
:
2383 return VCLXScrollBar::implGetMinimumSize( GetWindow() );
2385 aSz
= GetWindow()->GetOptimalSize( WINDOWSIZE_MINIMUM
);
2389 return ::com::sun::star::awt::Size( aSz
.Width(), aSz
.Height() );
2392 ::com::sun::star::awt::Size
VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2394 return getMinimumSize();
2397 ::com::sun::star::awt::Size
VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2399 ::vos::OGuard
aGuard( GetMutex() );
2401 ::com::sun::star::awt::Size
aNewSize( rNewSize
);
2402 ::com::sun::star::awt::Size aMinSize
= getMinimumSize();
2404 if ( aNewSize
.Width
< aMinSize
.Width
)
2405 aNewSize
.Width
= aMinSize
.Width
;
2406 if ( aNewSize
.Height
< aMinSize
.Height
)
2407 aNewSize
.Height
= aMinSize
.Height
;
2413 // ::com::sun::star::awt::XView
2414 sal_Bool
VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& rxDevice
) throw(::com::sun::star::uno::RuntimeException
)
2416 ::vos::OGuard
aGuard( GetMutex() );
2418 if ( VCLUnoHelper::GetOutputDevice( rxDevice
) )
2419 mpImpl
->mxViewGraphics
= rxDevice
;
2421 mpImpl
->mxViewGraphics
= NULL
;
2423 return mpImpl
->mxViewGraphics
.is();
2426 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
> VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException
)
2428 ::vos::OGuard
aGuard( GetMutex() );
2430 return mpImpl
->mxViewGraphics
;
2433 ::com::sun::star::awt::Size
VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException
)
2435 ::vos::OGuard
aGuard( GetMutex() );
2439 aSz
= GetWindow()->GetSizePixel();
2440 return ::com::sun::star::awt::Size( aSz
.Width(), aSz
.Height() );
2443 void VCLXWindow::draw( sal_Int32 nX
, sal_Int32 nY
) throw(::com::sun::star::uno::RuntimeException
)
2445 ::vos::OGuard
aGuard( GetMutex() );
2447 Window
* pWindow
= GetWindow();
2451 if ( isDesignMode() || mpImpl
->isEnableVisible() )
2453 TabPage
* pTabPage
= dynamic_cast< TabPage
* >( pWindow
);
2456 Point
aPos( nX
, nY
);
2457 Size aSize
= pWindow
->GetSizePixel();
2459 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( mpImpl
->mxViewGraphics
);
2460 aPos
= pDev
->PixelToLogic( aPos
);
2461 aSize
= pDev
->PixelToLogic( aSize
);
2463 pTabPage
->Draw( pDev
, aPos
, aSize
, 0 );
2467 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( mpImpl
->mxViewGraphics
);
2468 Point
aPos( nX
, nY
);
2471 pDev
= pWindow
->GetParent();
2473 if ( pWindow
->GetParent() && !pWindow
->IsSystemWindow() && ( pWindow
->GetParent() == pDev
) )
2475 // #i40647# don't draw here if this is a recursive call
2476 // sometimes this is called recursively, because the Update call on the parent
2477 // (strangely) triggers another paint. Prevent a stack overflow here
2478 // Yes, this is only fixing symptoms for the moment ....
2479 // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
2480 if ( !mpImpl
->getDrawingOntoParent_ref() )
2482 FlagGuard
aDrawingflagGuard( mpImpl
->getDrawingOntoParent_ref() );
2484 BOOL bWasVisible
= pWindow
->IsVisible();
2485 Point
aOldPos( pWindow
->GetPosPixel() );
2487 if ( bWasVisible
&& aOldPos
== aPos
)
2493 pWindow
->SetPosPixel( aPos
);
2495 // Erstmal ein Update auf den Parent, damit nicht beim Update
2496 // auf dieses Fenster noch ein Paint vom Parent abgearbeitet wird,
2497 // wo dann ggf. dieses Fenster sofort wieder gehidet wird.
2498 if( pWindow
->GetParent() )
2499 pWindow
->GetParent()->Update();
2503 pWindow
->SetParentUpdateMode( sal_False
);
2505 pWindow
->SetParentUpdateMode( sal_True
);
2507 pWindow
->SetPosPixel( aOldPos
);
2509 pWindow
->Show( TRUE
);
2514 Size aSz
= pWindow
->GetSizePixel();
2515 aSz
= pDev
->PixelToLogic( aSz
);
2516 Point aP
= pDev
->PixelToLogic( aPos
);
2518 vcl::PDFExtOutDevData
* pPDFExport
= dynamic_cast<vcl::PDFExtOutDevData
*>(pDev
->GetExtOutDevData());
2519 bool bDrawSimple
= ( pDev
->GetOutDevType() == OUTDEV_PRINTER
)
2520 || ( pDev
->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW
)
2521 || ( pPDFExport
&& ! pPDFExport
->GetIsExportFormFields() );
2524 pWindow
->Draw( pDev
, aP
, aSz
, WINDOW_DRAW_NOCONTROLS
);
2528 BOOL bOldNW
=pWindow
->IsNativeWidgetEnabled();
2530 pWindow
->EnableNativeWidget(FALSE
);
2531 pWindow
->PaintToDevice( pDev
, aP
, aSz
);
2533 pWindow
->EnableNativeWidget(TRUE
);
2539 void VCLXWindow::setZoom( float fZoomX
, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException
)
2541 ::vos::OGuard
aGuard( GetMutex() );
2544 GetWindow()->SetZoom( Fraction( fZoomX
) );
2547 // ::com::sun::star::lang::XEventListener
2548 void SAL_CALL
VCLXWindow::disposing( const ::com::sun::star::lang::EventObject
& _rSource
) throw (::com::sun::star::uno::RuntimeException
)
2550 ::vos::OGuard
aGuard( GetMutex() );
2552 // check if it comes from our AccessibleContext
2553 uno::Reference
< uno::XInterface
> aAC( mpImpl
->mxAccessibleContext
, uno::UNO_QUERY
);
2554 uno::Reference
< uno::XInterface
> xSource( _rSource
.Source
, uno::UNO_QUERY
);
2556 if ( aAC
.get() == xSource
.get() )
2558 mpImpl
->mxAccessibleContext
= uno::Reference
< accessibility::XAccessibleContext
>();
2562 // ::com::sun::star::accessibility::XAccessible
2563 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXWindow::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException
)
2565 using namespace ::com::sun::star
;
2567 ::vos::OGuard
aGuard( GetMutex() );
2571 return uno::Reference
< accessibility::XAccessibleContext
>();
2573 if ( !mpImpl
->mxAccessibleContext
.is() && GetWindow() )
2575 mpImpl
->mxAccessibleContext
= CreateAccessibleContext();
2577 // add as event listener to this component
2578 // in case somebody disposes it, we do not want to have a (though weak) reference to a dead
2580 uno::Reference
< lang::XComponent
> xComp( mpImpl
->mxAccessibleContext
, uno::UNO_QUERY
);
2582 xComp
->addEventListener( this );
2585 return mpImpl
->mxAccessibleContext
;
2588 // ::com::sun::star::awt::XDockable
2589 void SAL_CALL
VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDockableWindowListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
2591 ::vos::OGuard
aGuard( GetMutex() );
2593 if ( xListener
.is() )
2594 mpImpl
->getDockableWindowListeners().addInterface( xListener
);
2598 void SAL_CALL
VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDockableWindowListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
2600 ::vos::OGuard
aGuard( GetMutex() );
2602 mpImpl
->getDockableWindowListeners().removeInterface( xListener
);
2605 void SAL_CALL
VCLXWindow::enableDocking( sal_Bool bEnable
) throw (::com::sun::star::uno::RuntimeException
)
2607 ::vos::OGuard
aGuard( GetMutex() );
2609 Window
* pWindow
= GetWindow();
2611 pWindow
->EnableDocking( bEnable
);
2614 sal_Bool SAL_CALL
VCLXWindow::isFloating( ) throw (::com::sun::star::uno::RuntimeException
)
2616 ::vos::OGuard
aGuard( GetMutex() );
2618 Window
* pWindow
= GetWindow();
2620 return Window::GetDockingManager()->IsFloating( pWindow
);
2625 void SAL_CALL
VCLXWindow::setFloatingMode( sal_Bool bFloating
) throw (::com::sun::star::uno::RuntimeException
)
2627 ::vos::OGuard
aGuard( GetMutex() );
2629 Window
* pWindow
= GetWindow();
2631 Window::GetDockingManager()->SetFloatingMode( pWindow
, bFloating
);
2634 sal_Bool SAL_CALL
VCLXWindow::isLocked( ) throw (::com::sun::star::uno::RuntimeException
)
2636 ::vos::OGuard
aGuard( GetMutex() );
2638 Window
* pWindow
= GetWindow();
2640 return Window::GetDockingManager()->IsLocked( pWindow
);
2645 void SAL_CALL
VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException
)
2647 ::vos::OGuard
aGuard( GetMutex() );
2649 Window
* pWindow
= GetWindow();
2650 if( pWindow
&& !Window::GetDockingManager()->IsFloating( pWindow
) )
2651 Window::GetDockingManager()->Lock( pWindow
);
2654 void SAL_CALL
VCLXWindow::unlock( ) throw (::com::sun::star::uno::RuntimeException
)
2656 ::vos::OGuard
aGuard( GetMutex() );
2658 Window
* pWindow
= GetWindow();
2659 if( pWindow
&& !Window::GetDockingManager()->IsFloating( pWindow
) )
2660 Window::GetDockingManager()->Unlock( pWindow
);
2662 void SAL_CALL
VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle
& ) throw (::com::sun::star::uno::RuntimeException
)
2664 // TODO: remove interface in the next incompatible build
2665 ::vos::OGuard
aGuard( GetMutex() );
2669 sal_Bool SAL_CALL
VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException
)
2671 // TODO: remove interface in the next incompatible build
2672 ::vos::OGuard
aGuard( GetMutex() );
2677 // ::com::sun::star::awt::XWindow2
2679 void SAL_CALL
VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size
& aSize
) throw (::com::sun::star::uno::RuntimeException
)
2681 ::vos::OGuard
aGuard( GetMutex() );
2683 if( (pWindow
= GetWindow()) != NULL
)
2685 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >(pWindow
);
2686 if( pDockingWindow
)
2687 pDockingWindow
->SetOutputSizePixel( VCLSize( aSize
) );
2689 pWindow
->SetOutputSizePixel( VCLSize( aSize
) );
2693 ::com::sun::star::awt::Size SAL_CALL
VCLXWindow::getOutputSize( ) throw (::com::sun::star::uno::RuntimeException
)
2695 ::vos::OGuard
aGuard( GetMutex() );
2697 if( (pWindow
= GetWindow()) != NULL
)
2699 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >(pWindow
);
2700 if( pDockingWindow
)
2701 return AWTSize( pDockingWindow
->GetOutputSizePixel() );
2703 return AWTSize( pWindow
->GetOutputSizePixel() );
2706 return ::com::sun::star::awt::Size();
2709 sal_Bool SAL_CALL
VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException
)
2711 ::vos::OGuard
aGuard( GetMutex() );
2713 return GetWindow()->IsVisible();
2718 sal_Bool SAL_CALL
VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException
)
2720 ::vos::OGuard
aGuard( GetMutex() );
2722 return GetWindow()->IsActive();
2728 sal_Bool SAL_CALL
VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException
)
2730 ::vos::OGuard
aGuard( GetMutex() );
2732 return GetWindow()->IsEnabled();
2737 sal_Bool SAL_CALL
VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException
)
2739 ::vos::OGuard
aGuard( GetMutex() );
2741 return GetWindow()->HasFocus();
2746 // ::com::sun::star::beans::XPropertySetInfo
2748 UnoPropertyArrayHelper
*
2749 VCLXWindow::GetPropHelper()
2751 ::vos::OGuard
aGuard( GetMutex() );
2752 if ( mpImpl
->mpPropHelper
== NULL
)
2754 std::list
< sal_uInt16
> aIDs
;
2755 GetPropertyIds( aIDs
);
2756 mpImpl
->mpPropHelper
= new UnoPropertyArrayHelper( aIDs
);
2758 return mpImpl
->mpPropHelper
;
2761 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
2762 VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException
)
2764 return GetPropHelper()->getProperties();
2766 ::com::sun::star::beans::Property SAL_CALL
2767 VCLXWindow::getPropertyByName( const ::rtl::OUString
& rName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
2769 return GetPropHelper()->getPropertyByName( rName
);
2773 VCLXWindow::hasPropertyByName( const ::rtl::OUString
& rName
) throw (::com::sun::star::uno::RuntimeException
)
2775 return GetPropHelper()->hasPropertyByName( rName
);