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 // ----------------------------------------------------
559 // ----------------------------------------------------
561 DBG_NAME(VCLXWindow
);
563 VCLXWindow::VCLXWindow( bool _bWithDefaultProps
)
566 DBG_CTOR( VCLXWindow
, 0 );
568 mpImpl
= new VCLXWindowImpl( *this, GetMutex(), _bWithDefaultProps
);
571 VCLXWindow::~VCLXWindow()
573 DBG_DTOR( VCLXWindow
, 0 );
579 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
580 GetWindow()->SetWindowPeer( NULL
, NULL
);
581 GetWindow()->SetAccessible( NULL
);
585 ::toolkit::IAccessibleFactory
& VCLXWindow::getAccessibleFactory()
587 return mpImpl
->getAccessibleFactory().getFactory();
590 void VCLXWindow::SetWindow( Window
* pWindow
)
594 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
595 // GetWindow()->DbgAssertNoEventListeners();
598 SetOutputDevice( pWindow
);
602 GetWindow()->AddEventListener( LINK( this, VCLXWindow
, WindowEventListener
) );
603 sal_Bool bDirectVisible
= pWindow
? pWindow
->IsVisible() : false;
604 mpImpl
->setDirectVisible( bDirectVisible
);
609 void VCLXWindow::suspendVclEventListening( )
611 ++mpImpl
->mnListenerLockLevel
;
614 void VCLXWindow::resumeVclEventListening( )
616 DBG_ASSERT( mpImpl
->mnListenerLockLevel
, "VCLXWindow::resumeVclEventListening: not suspended!" );
617 --mpImpl
->mnListenerLockLevel
;
620 void VCLXWindow::notifyWindowRemoved( Window
& _rWindow
)
622 if ( mpImpl
->getContainerListeners().getLength() )
624 awt::VclContainerEvent aEvent
;
625 aEvent
.Source
= *this;
626 aEvent
.Child
= static_cast< XWindow
* >( _rWindow
.GetWindowPeer() );
627 mpImpl
->getContainerListeners().windowRemoved( aEvent
);
631 IMPL_LINK( VCLXWindow
, WindowEventListener
, VclSimpleEvent
*, pEvent
)
633 if ( mpImpl
->mnListenerLockLevel
)
636 DBG_ASSERT( pEvent
&& pEvent
->ISA( VclWindowEvent
), "Unknown WindowEvent!" );
637 if ( pEvent
&& pEvent
->ISA( VclWindowEvent
) )
639 DBG_ASSERT( ((VclWindowEvent
*)pEvent
)->GetWindow() && GetWindow(), "Window???" );
640 ProcessWindowEvent( *(VclWindowEvent
*)pEvent
);
645 void VCLXWindow::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
647 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> xThis( (::cppu::OWeakObject
*)this );
649 switch ( rVclWindowEvent
.GetId() )
651 case VCLEVENT_WINDOW_ENABLED
:
652 case VCLEVENT_WINDOW_DISABLED
:
654 bool bEnabled
= ( VCLEVENT_WINDOW_ENABLED
== rVclWindowEvent
.GetId() );
655 EventObject
aEvent( *this );
656 mpImpl
->notifyPlainEvent( aEvent
,
657 bEnabled
? EVENT_WINDOW_ENABLED
: EVENT_WINDOW_DISABLED
);
661 case VCLEVENT_WINDOW_PAINT
:
663 if ( mpImpl
->getPaintListeners().getLength() )
665 ::com::sun::star::awt::PaintEvent aEvent
;
666 aEvent
.Source
= (::cppu::OWeakObject
*)this;
667 aEvent
.UpdateRect
= AWTRectangle( *(Rectangle
*)rVclWindowEvent
.GetData() );
669 mpImpl
->getPaintListeners().windowPaint( aEvent
);
673 case VCLEVENT_WINDOW_MOVE
:
675 if ( mpImpl
->getWindowListeners().getLength() )
677 ::com::sun::star::awt::WindowEvent aEvent
;
678 aEvent
.Source
= (::cppu::OWeakObject
*)this;
679 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
680 mpImpl
->getWindowListeners().windowMoved( aEvent
);
684 case VCLEVENT_WINDOW_RESIZE
:
686 if ( mpImpl
->getWindowListeners().getLength() )
688 ::com::sun::star::awt::WindowEvent aEvent
;
689 aEvent
.Source
= (::cppu::OWeakObject
*)this;
690 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
691 mpImpl
->getWindowListeners().windowResized( aEvent
);
695 case VCLEVENT_WINDOW_SHOW
:
697 if ( mpImpl
->getWindowListeners().getLength() )
699 ::com::sun::star::awt::WindowEvent aEvent
;
700 aEvent
.Source
= (::cppu::OWeakObject
*)this;
701 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
702 mpImpl
->getWindowListeners().windowShown( aEvent
);
705 // For TopWindows this means opened...
706 if ( mpImpl
->getTopWindowListeners().getLength() )
708 ::com::sun::star::lang::EventObject aEvent
;
709 aEvent
.Source
= (::cppu::OWeakObject
*)this;
710 mpImpl
->getTopWindowListeners().windowOpened( aEvent
);
714 case VCLEVENT_WINDOW_HIDE
:
716 if ( mpImpl
->getWindowListeners().getLength() )
718 ::com::sun::star::awt::WindowEvent aEvent
;
719 aEvent
.Source
= (::cppu::OWeakObject
*)this;
720 ImplInitWindowEvent( aEvent
, rVclWindowEvent
.GetWindow() );
721 mpImpl
->getWindowListeners().windowHidden( aEvent
);
724 // For TopWindows this means closed...
725 if ( mpImpl
->getTopWindowListeners().getLength() )
727 ::com::sun::star::lang::EventObject aEvent
;
728 aEvent
.Source
= (::cppu::OWeakObject
*)this;
729 mpImpl
->getTopWindowListeners().windowClosed( aEvent
);
733 case VCLEVENT_WINDOW_ACTIVATE
:
735 if ( mpImpl
->getTopWindowListeners().getLength() )
737 ::com::sun::star::lang::EventObject aEvent
;
738 aEvent
.Source
= (::cppu::OWeakObject
*)this;
739 mpImpl
->getTopWindowListeners().windowActivated( aEvent
);
743 case VCLEVENT_WINDOW_DEACTIVATE
:
745 if ( mpImpl
->getTopWindowListeners().getLength() )
747 ::com::sun::star::lang::EventObject aEvent
;
748 aEvent
.Source
= (::cppu::OWeakObject
*)this;
749 mpImpl
->getTopWindowListeners().windowDeactivated( aEvent
);
753 case VCLEVENT_WINDOW_CLOSE
:
755 if ( mpImpl
->getDockableWindowListeners().getLength() )
757 ::com::sun::star::lang::EventObject aEvent
;
758 aEvent
.Source
= (::cppu::OWeakObject
*)this;
759 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed
, aEvent
);
761 if ( mpImpl
->getTopWindowListeners().getLength() )
763 ::com::sun::star::lang::EventObject aEvent
;
764 aEvent
.Source
= (::cppu::OWeakObject
*)this;
765 mpImpl
->getTopWindowListeners().windowClosing( aEvent
);
769 case VCLEVENT_CONTROL_GETFOCUS
:
770 case VCLEVENT_WINDOW_GETFOCUS
:
772 if ( ( rVclWindowEvent
.GetWindow()->IsCompoundControl()
773 && rVclWindowEvent
.GetId() == VCLEVENT_CONTROL_GETFOCUS
775 || ( !rVclWindowEvent
.GetWindow()->IsCompoundControl()
776 && rVclWindowEvent
.GetId() == VCLEVENT_WINDOW_GETFOCUS
780 if ( mpImpl
->getFocusListeners().getLength() )
782 ::com::sun::star::awt::FocusEvent aEvent
;
783 aEvent
.Source
= (::cppu::OWeakObject
*)this;
784 aEvent
.FocusFlags
= rVclWindowEvent
.GetWindow()->GetGetFocusFlags();
785 aEvent
.Temporary
= sal_False
;
786 mpImpl
->getFocusListeners().focusGained( aEvent
);
791 case VCLEVENT_CONTROL_LOSEFOCUS
:
792 case VCLEVENT_WINDOW_LOSEFOCUS
:
794 if ( ( rVclWindowEvent
.GetWindow()->IsCompoundControl()
795 && rVclWindowEvent
.GetId() == VCLEVENT_CONTROL_LOSEFOCUS
797 || ( !rVclWindowEvent
.GetWindow()->IsCompoundControl()
798 && rVclWindowEvent
.GetId() == VCLEVENT_WINDOW_LOSEFOCUS
802 if ( mpImpl
->getFocusListeners().getLength() )
804 ::com::sun::star::awt::FocusEvent aEvent
;
805 aEvent
.Source
= (::cppu::OWeakObject
*)this;
806 aEvent
.FocusFlags
= rVclWindowEvent
.GetWindow()->GetGetFocusFlags();
807 aEvent
.Temporary
= sal_False
;
809 Window
* pNext
= Application::GetFocusWindow();
812 // Bei zusammengesetzten Controls interessiert sich keiner fuer das Innenleben:
813 Window
* pNextC
= pNext
;
814 while ( pNextC
&& !pNextC
->IsCompoundControl() )
815 pNextC
= pNextC
->GetParent();
819 pNext
->GetComponentInterface( sal_True
);
820 aEvent
.NextFocus
= (::cppu::OWeakObject
*)pNext
->GetWindowPeer();
822 mpImpl
->getFocusListeners().focusLost( aEvent
);
827 case VCLEVENT_WINDOW_MINIMIZE
:
829 if ( mpImpl
->getTopWindowListeners().getLength() )
831 ::com::sun::star::lang::EventObject aEvent
;
832 aEvent
.Source
= (::cppu::OWeakObject
*)this;
833 mpImpl
->getTopWindowListeners().windowMinimized( aEvent
);
837 case VCLEVENT_WINDOW_NORMALIZE
:
839 if ( mpImpl
->getTopWindowListeners().getLength() )
841 ::com::sun::star::lang::EventObject aEvent
;
842 aEvent
.Source
= (::cppu::OWeakObject
*)this;
843 mpImpl
->getTopWindowListeners().windowNormalized( aEvent
);
847 case VCLEVENT_WINDOW_KEYINPUT
:
849 if ( mpImpl
->getKeyListeners().getLength() )
851 ::com::sun::star::awt::KeyEvent
aEvent( VCLUnoHelper::createKeyEvent(
852 *(KeyEvent
*)rVclWindowEvent
.GetData(), *this
854 mpImpl
->getKeyListeners().keyPressed( aEvent
);
858 case VCLEVENT_WINDOW_KEYUP
:
860 if ( mpImpl
->getKeyListeners().getLength() )
862 ::com::sun::star::awt::KeyEvent
aEvent( VCLUnoHelper::createKeyEvent(
863 *(KeyEvent
*)rVclWindowEvent
.GetData(), *this
865 mpImpl
->getKeyListeners().keyReleased( aEvent
);
869 case VCLEVENT_WINDOW_COMMAND
:
871 CommandEvent
* pCmdEvt
= (CommandEvent
*)rVclWindowEvent
.GetData();
872 if ( mpImpl
->getMouseListeners().getLength() && ( pCmdEvt
->GetCommand() == COMMAND_CONTEXTMENU
) )
874 // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
875 Point aWhere
= static_cast< CommandEvent
* >( rVclWindowEvent
.GetData() )->GetMousePosPixel();
876 if ( !pCmdEvt
->IsMouseEvent() )
877 { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
878 // handles a context menu command as special case of a mouse event, which is simply wrong.
879 // Without extending the API, we would not have another chance to notify listeners of a
880 // keyboard-triggered context menu request
881 // 102205 - 16.08.2002 - fs@openoffice.org
882 aWhere
= Point( -1, -1 );
885 MouseEvent
aMEvt( aWhere
, 1, MOUSE_SIMPLECLICK
, MOUSE_LEFT
, 0 );
886 awt::MouseEvent
aEvent( VCLUnoHelper::createMouseEvent( aMEvt
, *this ) );
887 aEvent
.PopupTrigger
= sal_True
;
888 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_PRESSED
);
892 case VCLEVENT_WINDOW_MOUSEMOVE
:
894 MouseEvent
* pMouseEvt
= (MouseEvent
*)rVclWindowEvent
.GetData();
895 if ( mpImpl
->getMouseListeners().getLength() && ( pMouseEvt
->IsEnterWindow() || pMouseEvt
->IsLeaveWindow() ) )
897 awt::MouseEvent
aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt
, *this ) );
898 mpImpl
->notifyMouseEvent(
900 pMouseEvt
->IsEnterWindow() ? EVENT_MOUSE_ENTERED
: EVENT_MOUSE_EXITED
904 if ( mpImpl
->getMouseMotionListeners().getLength() && !pMouseEvt
->IsEnterWindow() && !pMouseEvt
->IsLeaveWindow() )
906 awt::MouseEvent
aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt
, *this ) );
907 aEvent
.ClickCount
= 0; // #92138#
908 if ( pMouseEvt
->GetMode() & MOUSE_SIMPLEMOVE
)
909 mpImpl
->getMouseMotionListeners().mouseMoved( aEvent
);
911 mpImpl
->getMouseMotionListeners().mouseDragged( aEvent
);
915 case VCLEVENT_WINDOW_MOUSEBUTTONDOWN
:
917 if ( mpImpl
->getMouseListeners().getLength() )
919 awt::MouseEvent
aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent
*)rVclWindowEvent
.GetData(), *this ) );
920 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_PRESSED
);
924 case VCLEVENT_WINDOW_MOUSEBUTTONUP
:
926 if ( mpImpl
->getMouseListeners().getLength() )
928 awt::MouseEvent
aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent
*)rVclWindowEvent
.GetData(), *this ) );
929 mpImpl
->notifyMouseEvent( aEvent
, EVENT_MOUSE_RELEASED
);
933 case VCLEVENT_WINDOW_STARTDOCKING
:
935 if ( mpImpl
->getDockableWindowListeners().getLength() )
937 DockingData
*pData
= (DockingData
*)rVclWindowEvent
.GetData();
941 ::com::sun::star::awt::DockingEvent aEvent
;
942 aEvent
.Source
= (::cppu::OWeakObject
*)this;
943 aEvent
.TrackingRectangle
= AWTRectangle( pData
->maTrackRect
);
944 aEvent
.MousePos
.X
= pData
->maMousePos
.X();
945 aEvent
.MousePos
.Y
= pData
->maMousePos
.Y();
946 aEvent
.bLiveMode
= pData
->mbLivemode
;
947 aEvent
.bInteractive
= pData
->mbInteractive
;
949 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking
, aEvent
);
954 case VCLEVENT_WINDOW_DOCKING
:
956 if ( mpImpl
->getDockableWindowListeners().getLength() )
958 DockingData
*pData
= (DockingData
*)rVclWindowEvent
.GetData();
962 ::com::sun::star::awt::DockingEvent aEvent
;
963 aEvent
.Source
= (::cppu::OWeakObject
*)this;
964 aEvent
.TrackingRectangle
= AWTRectangle( pData
->maTrackRect
);
965 aEvent
.MousePos
.X
= pData
->maMousePos
.X();
966 aEvent
.MousePos
.Y
= pData
->maMousePos
.Y();
967 aEvent
.bLiveMode
= pData
->mbLivemode
;
968 aEvent
.bInteractive
= pData
->mbInteractive
;
970 Reference
< XDockableWindowListener
> xFirstListener
;
971 ::cppu::OInterfaceIteratorHelper
aIter( mpImpl
->getDockableWindowListeners() );
972 while ( aIter
.hasMoreElements() && !xFirstListener
.is() )
974 xFirstListener
.set( aIter
.next(), UNO_QUERY
);
977 ::com::sun::star::awt::DockingData aDockingData
=
978 xFirstListener
->docking( aEvent
);
979 pData
->maTrackRect
= VCLRectangle( aDockingData
.TrackingRectangle
);
980 pData
->mbFloating
= aDockingData
.bFloating
;
985 case VCLEVENT_WINDOW_ENDDOCKING
:
987 if ( mpImpl
->getDockableWindowListeners().getLength() )
989 EndDockingData
*pData
= (EndDockingData
*)rVclWindowEvent
.GetData();
993 ::com::sun::star::awt::EndDockingEvent aEvent
;
994 aEvent
.Source
= (::cppu::OWeakObject
*)this;
995 aEvent
.WindowRectangle
= AWTRectangle( pData
->maWindowRect
);
996 aEvent
.bFloating
= pData
->mbFloating
;
997 aEvent
.bCancelled
= pData
->mbCancelled
;
998 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking
, aEvent
);
1003 case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING
:
1005 if ( mpImpl
->getDockableWindowListeners().getLength() )
1007 BOOL
*p_bFloating
= (BOOL
*)rVclWindowEvent
.GetData();
1009 ::com::sun::star::lang::EventObject aEvent
;
1010 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1012 Reference
< XDockableWindowListener
> xFirstListener
;
1013 ::cppu::OInterfaceIteratorHelper
aIter( mpImpl
->getDockableWindowListeners() );
1014 while ( aIter
.hasMoreElements() && !xFirstListener
.is() )
1016 xFirstListener
.set( aIter
.next(), UNO_QUERY
);
1019 *p_bFloating
= xFirstListener
->prepareToggleFloatingMode( aEvent
);
1023 case VCLEVENT_WINDOW_TOGGLEFLOATING
:
1025 if ( mpImpl
->getDockableWindowListeners().getLength() )
1027 ::com::sun::star::lang::EventObject aEvent
;
1028 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1029 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode
, aEvent
);
1033 case VCLEVENT_WINDOW_ENDPOPUPMODE
:
1035 if ( mpImpl
->getDockableWindowListeners().getLength() )
1037 EndPopupModeData
*pData
= (EndPopupModeData
*)rVclWindowEvent
.GetData();
1041 ::com::sun::star::awt::EndPopupModeEvent aEvent
;
1042 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1043 aEvent
.FloatingPosition
.X
= pData
->maFloatingPos
.X();
1044 aEvent
.FloatingPosition
.Y
= pData
->maFloatingPos
.Y();
1045 aEvent
.bTearoff
= pData
->mbTearoff
;
1046 mpImpl
->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode
, aEvent
);
1055 uno::Reference
< accessibility::XAccessibleContext
> VCLXWindow::CreateAccessibleContext()
1057 ::vos::OGuard
aGuard( GetMutex() );
1058 return getAccessibleFactory().createAccessibleContext( this );
1061 void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b
)
1063 mpImpl
->mbSynthesizingVCLEvent
= _b
;
1066 BOOL
VCLXWindow::IsSynthesizingVCLEvent() const
1068 return mpImpl
->mbSynthesizingVCLEvent
;
1071 Size
VCLXWindow::ImplCalcWindowSize( const Size
& rOutSz
) const
1075 Window
* pWindow
= GetWindow();
1078 sal_Int32 nLeft
, nTop
, nRight
, nBottom
;
1079 pWindow
->GetBorder( nLeft
, nTop
, nRight
, nBottom
);
1080 aSz
.Width() += nLeft
+nRight
;
1081 aSz
.Height() += nTop
+nBottom
;
1087 // ::com::sun::star::lang::XUnoTunnel
1088 IMPL_XUNOTUNNEL2( VCLXWindow
, VCLXDevice
)
1090 // ::com::sun::star::lang::Component
1091 void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException
)
1093 ::vos::OGuard
aGuard( GetMutex() );
1095 mpImpl
->mxViewGraphics
= NULL
;
1097 if ( !mpImpl
->mbDisposing
)
1099 mpImpl
->mbDisposing
= true;
1101 mpImpl
->disposing();
1105 OutputDevice
* pOutDev
= GetOutputDevice();
1106 SetWindow( NULL
); // Damit ggf. Handler abgemeldet werden (virtuell).
1107 SetOutputDevice( pOutDev
);
1108 DestroyOutputDevice();
1111 // #i14103# dispose the accessible context after the window has been destroyed,
1112 // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
1113 // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object
1116 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> xComponent( mpImpl
->mxAccessibleContext
, ::com::sun::star::uno::UNO_QUERY
);
1117 if ( xComponent
.is() )
1118 xComponent
->dispose();
1120 catch ( const ::com::sun::star::uno::Exception
& )
1122 DBG_ERROR( "VCLXWindow::dispose: could not dispose the accessible context!" );
1124 mpImpl
->mxAccessibleContext
.clear();
1126 mpImpl
->mbDisposing
= false;
1130 void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1132 ::vos::OGuard
aGuard( GetMutex() );
1134 mpImpl
->getEventListeners().addInterface( rxListener
);
1137 void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1139 ::vos::OGuard
aGuard( GetMutex() );
1141 mpImpl
->getEventListeners().removeInterface( rxListener
);
1145 // ::com::sun::star::awt::XWindow
1146 void VCLXWindow::setPosSize( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, sal_Int16 Flags
) throw(::com::sun::star::uno::RuntimeException
)
1148 ::vos::OGuard
aGuard( GetMutex() );
1152 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1153 Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X
, Y
, Width
, Height
, Flags
);
1155 GetWindow()->SetPosSizePixel( X
, Y
, Width
, Height
, Flags
);
1159 ::com::sun::star::awt::Rectangle
VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException
)
1161 ::vos::OGuard
aGuard( GetMutex() );
1163 ::com::sun::star::awt::Rectangle aBounds
;
1166 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1167 aBounds
= AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
1169 aBounds
= AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
1175 void VCLXWindow::setVisible( sal_Bool bVisible
) throw(::com::sun::star::uno::RuntimeException
)
1177 ::vos::OGuard
aGuard( GetMutex() );
1179 Window
* pWindow
= GetWindow();
1185 // #57167# TopWindows mit unsichtbaren Parent anzeigen...
1186 ::com::sun::star::uno::Any aTest = queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >*) 0 ) );
1187 if ( aTest.hasValue() )
1189 Window* pParent = pWindow->GetWindow( WINDOW_PARENTOVERLAP );
1190 if ( pParent && !pParent->IsReallyVisible() )
1191 pWindow->SetParent( pWindow->GetWindow( WINDOW_FRAME ) );
1195 mpImpl
->setDirectVisible( bVisible
);
1196 pWindow
->Show( bVisible
&& mpImpl
->isEnableVisible() );
1200 void VCLXWindow::setEnable( sal_Bool bEnable
) throw(::com::sun::star::uno::RuntimeException
)
1202 ::vos::OGuard
aGuard( GetMutex() );
1204 Window
* pWindow
= GetWindow();
1207 pWindow
->Enable( bEnable
, FALSE
); // #95824# without children!
1208 pWindow
->EnableInput( bEnable
);
1212 void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException
)
1214 ::vos::OGuard
aGuard( GetMutex() );
1217 GetWindow()->GrabFocus();
1220 void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1222 ::vos::OGuard
aGuard( GetMutex() );
1224 mpImpl
->getWindowListeners().addInterface( rxListener
);
1226 Reference
< XWindowListener2
> xListener2( rxListener
, UNO_QUERY
);
1227 if ( xListener2
.is() )
1228 mpImpl
->getWindow2Listeners().addInterface( xListener2
);
1230 // #100119# Get all resize events, even if height or width 0, or invisible
1232 GetWindow()->EnableAllResize( TRUE
);
1235 void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1237 ::vos::OGuard
aGuard( GetMutex() );
1239 Reference
< XWindowListener2
> xListener2( rxListener
, UNO_QUERY
);
1240 if ( xListener2
.is() )
1241 mpImpl
->getWindow2Listeners().removeInterface( xListener2
);
1243 mpImpl
->getWindowListeners().removeInterface( rxListener
);
1246 void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFocusListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1248 ::vos::OGuard
aGuard( GetMutex() );
1249 mpImpl
->getFocusListeners().addInterface( rxListener
);
1252 void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFocusListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1254 ::vos::OGuard
aGuard( GetMutex() );
1255 mpImpl
->getFocusListeners().removeInterface( rxListener
);
1258 void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XKeyListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1260 ::vos::OGuard
aGuard( GetMutex() );
1261 mpImpl
->getKeyListeners().addInterface( rxListener
);
1264 void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XKeyListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1266 ::vos::OGuard
aGuard( GetMutex() );
1267 mpImpl
->getKeyListeners().removeInterface( rxListener
);
1270 void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1272 ::vos::OGuard
aGuard( GetMutex() );
1273 mpImpl
->getMouseListeners().addInterface( rxListener
);
1276 void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1278 ::vos::OGuard
aGuard( GetMutex() );
1279 mpImpl
->getMouseListeners().removeInterface( rxListener
);
1282 void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseMotionListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1284 ::vos::OGuard
aGuard( GetMutex() );
1285 mpImpl
->getMouseMotionListeners().addInterface( rxListener
);
1288 void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMouseMotionListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1290 ::vos::OGuard
aGuard( GetMutex() );
1291 mpImpl
->getMouseMotionListeners().removeInterface( rxListener
);
1294 void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPaintListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1296 ::vos::OGuard
aGuard( GetMutex() );
1297 mpImpl
->getPaintListeners().addInterface( rxListener
);
1300 void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPaintListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
)
1302 ::vos::OGuard
aGuard( GetMutex() );
1303 mpImpl
->getPaintListeners().removeInterface( rxListener
);
1306 // ::com::sun::star::awt::XWindowPeer
1307 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
> VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException
)
1309 // no guard. nothing to guard here.
1310 // 82463 - 12/21/00 - fs
1311 return Application::GetVCLToolkit();
1314 void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPointer
>& rxPointer
) throw(::com::sun::star::uno::RuntimeException
)
1316 ::vos::OGuard
aGuard( GetMutex() );
1318 VCLXPointer
* pPointer
= VCLXPointer::GetImplementation( rxPointer
);
1321 mpImpl
->mxPointer
= rxPointer
;
1323 GetWindow()->SetPointer( pPointer
->GetPointer() );
1327 void VCLXWindow::setBackground( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
1329 ::vos::OGuard
aGuard( GetMutex() );
1333 Color
aColor( (sal_uInt32
)nColor
);
1334 GetWindow()->SetBackground( aColor
);
1335 GetWindow()->SetControlBackground( aColor
);
1337 WindowType eWinType
= GetWindow()->GetType();
1338 if ( ( eWinType
== WINDOW_WINDOW
) ||
1339 ( eWinType
== WINDOW_WORKWINDOW
) ||
1340 ( eWinType
== WINDOW_FLOATINGWINDOW
) )
1342 GetWindow()->Invalidate();
1347 void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags
) throw(::com::sun::star::uno::RuntimeException
)
1349 ::vos::OGuard
aGuard( GetMutex() );
1352 GetWindow()->Invalidate( (sal_uInt16
) nInvalidateFlags
);
1355 void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle
& rRect
, sal_Int16 nInvalidateFlags
) throw(::com::sun::star::uno::RuntimeException
)
1357 ::vos::OGuard
aGuard( GetMutex() );
1360 GetWindow()->Invalidate( VCLRectangle(rRect
), (sal_uInt16
) nInvalidateFlags
);
1364 // ::com::sun::star::awt::XVclWindowPeer
1365 sal_Bool
VCLXWindow::isChild( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& rxPeer
) throw(::com::sun::star::uno::RuntimeException
)
1367 ::vos::OGuard
aGuard( GetMutex() );
1369 sal_Bool bIsChild
= sal_False
;
1370 Window
* pWindow
= GetWindow();
1373 Window
* pPeerWindow
= VCLUnoHelper::GetWindow( rxPeer
);
1374 bIsChild
= pPeerWindow
&& pWindow
->IsChild( pPeerWindow
);
1380 void VCLXWindow::setDesignMode( sal_Bool bOn
) throw(::com::sun::star::uno::RuntimeException
)
1382 ::vos::OGuard
aGuard( GetMutex() );
1384 mpImpl
->mbDesignMode
= bOn
;
1387 sal_Bool
VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException
)
1389 ::vos::OGuard
aGuard( GetMutex() );
1390 return mpImpl
->mbDesignMode
;
1393 void VCLXWindow::enableClipSiblings( sal_Bool bClip
) throw(::com::sun::star::uno::RuntimeException
)
1395 ::vos::OGuard
aGuard( GetMutex() );
1398 GetWindow()->EnableClipSiblings( bClip
);
1401 void VCLXWindow::setForeground( sal_Int32 nColor
) throw(::com::sun::star::uno::RuntimeException
)
1403 ::vos::OGuard
aGuard( GetMutex() );
1407 Color
aColor( (sal_uInt32
)nColor
);
1408 GetWindow()->SetControlForeground( aColor
);
1412 void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor
& rFont
) throw(::com::sun::star::uno::RuntimeException
)
1414 ::vos::OGuard
aGuard( GetMutex() );
1417 GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont
, GetWindow()->GetControlFont() ) );
1420 void VCLXWindow::getStyles( sal_Int16 nType
, ::com::sun::star::awt::FontDescriptor
& Font
, sal_Int32
& ForegroundColor
, sal_Int32
& BackgroundColor
) throw(::com::sun::star::uno::RuntimeException
)
1422 ::vos::OGuard
aGuard( GetMutex() );
1426 const StyleSettings
& rStyleSettings
= GetWindow()->GetSettings().GetStyleSettings();
1430 case ::com::sun::star::awt::Style::FRAME
:
1432 Font
= VCLUnoHelper::CreateFontDescriptor( rStyleSettings
.GetAppFont() );
1433 ForegroundColor
= rStyleSettings
.GetWindowTextColor().GetColor();
1434 BackgroundColor
= rStyleSettings
.GetWindowColor().GetColor();
1437 case ::com::sun::star::awt::Style::DIALOG
:
1439 Font
= VCLUnoHelper::CreateFontDescriptor( rStyleSettings
.GetAppFont() );
1440 ForegroundColor
= rStyleSettings
.GetDialogTextColor().GetColor();
1441 BackgroundColor
= rStyleSettings
.GetDialogColor().GetColor();
1444 default: DBG_ERROR( "VCLWindow::getStyles() - unknown Type" );
1452 static void setColorSettings( Window
* _pWindow
, const ::com::sun::star::uno::Any
& _rValue
,
1453 void (StyleSettings::*pSetter
)( const Color
& ), const Color
& (StyleSettings::*pGetter
)( ) const )
1455 sal_Int32 nColor
= 0;
1456 if ( !( _rValue
>>= nColor
) )
1457 nColor
= (Application::GetSettings().GetStyleSettings().*pGetter
)().GetColor();
1459 AllSettings aSettings
= _pWindow
->GetSettings();
1460 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
1462 (aStyleSettings
.*pSetter
)( Color( nColor
) );
1464 aSettings
.SetStyleSettings( aStyleSettings
);
1465 _pWindow
->SetSettings( aSettings
, TRUE
);
1469 // Terminated by BASEPROPERTY_NOTFOUND (or 0)
1470 void VCLXWindow::PushPropertyIds( std::list
< sal_uInt16
> &rIds
,
1474 va_start( pVarArgs
, nFirstId
);
1476 for ( int nId
= nFirstId
; nId
!= BASEPROPERTY_NOTFOUND
;
1477 nId
= va_arg( pVarArgs
, int ) )
1478 rIds
.push_back( (sal_uInt16
) nId
);
1483 void VCLXWindow::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
, bool bWithDefaults
)
1485 // These are common across ~all VCLXWindow derived classes
1487 PushPropertyIds( rIds
,
1489 BASEPROPERTY_BACKGROUNDCOLOR
,
1490 BASEPROPERTY_BORDER
,
1491 BASEPROPERTY_BORDERCOLOR
,
1492 BASEPROPERTY_DEFAULTCONTROL
,
1493 BASEPROPERTY_ENABLED
,
1494 BASEPROPERTY_FONTDESCRIPTOR
,
1495 BASEPROPERTY_HELPTEXT
,
1496 BASEPROPERTY_HELPURL
,
1498 BASEPROPERTY_PRINTABLE
,
1499 BASEPROPERTY_ENABLEVISIBLE
, // for visibility
1500 BASEPROPERTY_TABSTOP
,
1503 // lovely hack from:
1504 // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
1505 std::list
< sal_uInt16
>::const_iterator iter
;
1506 for( iter
= rIds
.begin(); iter
!= rIds
.end(); iter
++) {
1507 if( *iter
== BASEPROPERTY_FONTDESCRIPTOR
)
1509 // some properties are not included in the FontDescriptor, but everytime
1510 // when we have a FontDescriptor we want to have these properties too.
1511 // => Easier to register the here, istead everywhere where I register the FontDescriptor...
1513 rIds
.push_back( BASEPROPERTY_TEXTCOLOR
);
1514 rIds
.push_back( BASEPROPERTY_TEXTLINECOLOR
);
1515 rIds
.push_back( BASEPROPERTY_FONTRELIEF
);
1516 rIds
.push_back( BASEPROPERTY_FONTEMPHASISMARK
);
1522 void VCLXWindow::GetPropertyIds( std::list
< sal_uInt16
>& _out_rIds
)
1524 return ImplGetPropertyIds( _out_rIds
, mpImpl
->mbWithDefaultProps
);
1527 ::cppu::OInterfaceContainerHelper
& VCLXWindow::GetContainerListeners()
1529 return mpImpl
->getContainerListeners();
1532 ::cppu::OInterfaceContainerHelper
& VCLXWindow::GetTopWindowListeners()
1534 return mpImpl
->getTopWindowListeners();
1539 void lcl_updateWritingMode( Window
& _rWindow
, const sal_Int16 _nWritingMode
, const sal_Int16 _nContextWritingMode
)
1541 BOOL bEnableRTL
= FALSE
;
1542 switch ( _nWritingMode
)
1544 case WritingMode2::LR_TB
: bEnableRTL
= FALSE
; break;
1545 case WritingMode2::RL_TB
: bEnableRTL
= TRUE
; break;
1546 case WritingMode2::CONTEXT
:
1548 // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use
1549 // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our
1550 // own window for its RTL mode
1551 switch ( _nContextWritingMode
)
1553 case WritingMode2::LR_TB
: bEnableRTL
= FALSE
; break;
1554 case WritingMode2::RL_TB
: bEnableRTL
= TRUE
; break;
1555 case WritingMode2::CONTEXT
:
1557 const Window
* pParent
= _rWindow
.GetParent();
1558 OSL_ENSURE( pParent
, "lcl_updateWritingMode: cannot determine context's writing mode!" );
1560 bEnableRTL
= pParent
->IsRTLEnabled();
1567 OSL_ENSURE( false, "lcl_updateWritingMode: unsupported WritingMode!" );
1568 } // switch ( nWritingMode )
1570 _rWindow
.EnableRTL( bEnableRTL
);
1574 void VCLXWindow::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1576 ::vos::OGuard
aGuard( GetMutex() );
1578 Window
* pWindow
= GetWindow();
1582 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
1584 WindowType eWinType
= pWindow
->GetType();
1585 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1586 switch ( nPropType
)
1588 case BASEPROPERTY_CONTEXT_WRITING_MODE
:
1590 OSL_VERIFY( Value
>>= mpImpl
->mnContextWritingMode
);
1591 if ( mpImpl
->mnWritingMode
== WritingMode2::CONTEXT
)
1592 lcl_updateWritingMode( *pWindow
, mpImpl
->mnWritingMode
, mpImpl
->mnContextWritingMode
);
1596 case BASEPROPERTY_WRITING_MODE
:
1598 sal_Bool bProperType
= ( Value
>>= mpImpl
->mnWritingMode
);
1599 OSL_ENSURE( bProperType
, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" );
1601 lcl_updateWritingMode( *pWindow
, mpImpl
->mnWritingMode
, mpImpl
->mnContextWritingMode
);
1605 case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
:
1607 sal_uInt16
nWheelBehavior( MouseWheelBehavior::SCROLL_FOCUS_ONLY
);
1608 OSL_VERIFY( Value
>>= nWheelBehavior
);
1610 AllSettings aSettings
= pWindow
->GetSettings();
1611 MouseSettings aMouseSettings
= aSettings
.GetMouseSettings();
1613 USHORT
nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY
);
1614 switch ( nWheelBehavior
)
1616 case MouseWheelBehavior::SCROLL_DISABLED
: nVclBehavior
= MOUSE_WHEEL_DISABLE
; break;
1617 case MouseWheelBehavior::SCROLL_FOCUS_ONLY
: nVclBehavior
= MOUSE_WHEEL_FOCUS_ONLY
; break;
1618 case MouseWheelBehavior::SCROLL_ALWAYS
: nVclBehavior
= MOUSE_WHEEL_ALWAYS
; break;
1620 OSL_ENSURE( false, "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" );
1623 aMouseSettings
.SetWheelBehavior( nWheelBehavior
);
1624 aSettings
.SetMouseSettings( aMouseSettings
);
1625 pWindow
->SetSettings( aSettings
, TRUE
);
1629 case BASEPROPERTY_NATIVE_WIDGET_LOOK
:
1631 sal_Bool
bEnable( sal_True
);
1632 OSL_VERIFY( Value
>>= bEnable
);
1633 pWindow
->EnableNativeWidget( bEnable
);
1637 case BASEPROPERTY_PLUGINPARENT
:
1639 // set parent handle
1640 SetSystemParent_Impl( Value
);
1644 case BASEPROPERTY_ENABLED
:
1646 sal_Bool b
= sal_Bool();
1651 case BASEPROPERTY_ENABLEVISIBLE
:
1653 sal_Bool b
= sal_False
;
1656 if( b
!= mpImpl
->isEnableVisible() )
1658 mpImpl
->setEnableVisible( b
);
1659 pWindow
->Show( b
&& mpImpl
->isDirectVisible() );
1664 case BASEPROPERTY_TEXT
:
1665 case BASEPROPERTY_LABEL
:
1666 case BASEPROPERTY_TITLE
:
1668 ::rtl::OUString aText
;
1669 if ( Value
>>= aText
)
1673 case WINDOW_OKBUTTON
:
1674 case WINDOW_CANCELBUTTON
:
1675 case WINDOW_HELPBUTTON
:
1676 // Standard Button: overwrite only if not empty.
1677 if (aText
.getLength())
1678 pWindow
->SetText( aText
);
1682 pWindow
->SetText( aText
);
1688 case BASEPROPERTY_ACCESSIBLENAME
:
1690 ::rtl::OUString aText
;
1691 if ( Value
>>= aText
)
1692 pWindow
->SetAccessibleName( aText
);
1695 case BASEPROPERTY_HELPURL
:
1697 ::rtl::OUString aURL
;
1698 if ( Value
>>= aURL
)
1700 String
aHelpURL( aURL
);
1701 String
aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
1702 if ( aHelpURL
.CompareIgnoreCaseToAscii( aPattern
, aPattern
.Len() ) == COMPARE_EQUAL
)
1704 String aID
= aHelpURL
.Copy( aPattern
.Len() );
1705 pWindow
->SetHelpId( aID
.ToInt32() );
1709 pWindow
->SetSmartHelpId( SmartId( aHelpURL
) );
1714 case BASEPROPERTY_HELPTEXT
:
1716 ::rtl::OUString aHelpText
;
1717 if ( Value
>>= aHelpText
)
1719 pWindow
->SetQuickHelpText( aHelpText
);
1723 case BASEPROPERTY_FONTDESCRIPTOR
:
1726 pWindow
->SetControlFont( Font() );
1729 ::com::sun::star::awt::FontDescriptor aFont
;
1730 if ( Value
>>= aFont
)
1731 pWindow
->SetControlFont( VCLUnoHelper::CreateFont( aFont
, pWindow
->GetControlFont() ) );
1735 case BASEPROPERTY_FONTRELIEF
:
1737 sal_Int16 n
= sal_Int16();
1740 Font aFont
= pWindow
->GetControlFont();
1741 aFont
.SetRelief( (FontRelief
)n
);
1742 pWindow
->SetControlFont( aFont
);
1746 case BASEPROPERTY_FONTEMPHASISMARK
:
1748 sal_Int16 n
= sal_Int16();
1751 Font aFont
= pWindow
->GetControlFont();
1752 aFont
.SetEmphasisMark( n
);
1753 pWindow
->SetControlFont( aFont
);
1757 case BASEPROPERTY_BACKGROUNDCOLOR
:
1762 // set dialog color for default
1764 case WINDOW_MESSBOX
:
1765 case WINDOW_INFOBOX
:
1766 case WINDOW_WARNINGBOX
:
1767 case WINDOW_ERRORBOX
:
1768 case WINDOW_QUERYBOX
:
1769 case WINDOW_TABPAGE
:
1771 Color aColor
= pWindow
->GetSettings().GetStyleSettings().GetDialogColor();
1772 pWindow
->SetBackground( aColor
);
1773 pWindow
->SetControlBackground( aColor
);
1777 case WINDOW_FIXEDTEXT
:
1778 case WINDOW_CHECKBOX
:
1779 case WINDOW_RADIOBUTTON
:
1780 case WINDOW_GROUPBOX
:
1781 case WINDOW_FIXEDLINE
:
1783 // support transparency only for special controls
1784 pWindow
->SetBackground();
1785 pWindow
->SetControlBackground();
1786 pWindow
->SetPaintTransparent( TRUE
);
1792 // default code which enables transparency for
1793 // compound controls. It's not real transparency
1794 // as most of these controls repaint their client
1795 // area completely new.
1796 if ( pWindow
->IsCompoundControl() )
1797 pWindow
->SetBackground();
1798 pWindow
->SetControlBackground();
1805 sal_Int32 nColor
= 0;
1806 if ( Value
>>= nColor
)
1808 Color
aColor( nColor
);
1809 pWindow
->SetControlBackground( aColor
);
1810 pWindow
->SetBackground( aColor
);
1813 // reset paint transparent mode
1814 case WINDOW_FIXEDTEXT
:
1815 case WINDOW_CHECKBOX
:
1816 case WINDOW_RADIOBUTTON
:
1817 case WINDOW_GROUPBOX
:
1818 case WINDOW_FIXEDLINE
:
1819 pWindow
->SetPaintTransparent( FALSE
);
1822 pWindow
->Invalidate(); // Falls das Control nicht drauf reagiert
1826 case BASEPROPERTY_TEXTCOLOR
:
1829 pWindow
->SetControlForeground();
1833 sal_Int32 nColor
= 0;
1834 if ( Value
>>= nColor
)
1836 Color
aColor( nColor
);
1837 pWindow
->SetTextColor( aColor
);
1838 pWindow
->SetControlForeground( aColor
);
1842 case BASEPROPERTY_TEXTLINECOLOR
:
1845 pWindow
->SetTextLineColor();
1849 sal_Int32 nColor
= 0;
1850 if ( Value
>>= nColor
)
1852 Color
aColor( nColor
);
1853 pWindow
->SetTextLineColor( aColor
);
1857 case BASEPROPERTY_FILLCOLOR
:
1859 pWindow
->SetFillColor();
1862 sal_Int32 nColor
= 0;
1863 if ( Value
>>= nColor
)
1865 Color
aColor( nColor
);
1866 pWindow
->SetFillColor( aColor
);
1870 case BASEPROPERTY_LINECOLOR
:
1872 pWindow
->SetLineColor();
1875 sal_Int32 nColor
= 0;
1876 if ( Value
>>= nColor
)
1878 Color
aColor( nColor
);
1879 pWindow
->SetLineColor( aColor
);
1883 case BASEPROPERTY_BORDER
:
1885 WinBits nStyle
= pWindow
->GetStyle();
1886 sal_uInt16 nBorder
= 0;
1890 pWindow
->SetStyle( nStyle
& ~WB_BORDER
);
1894 pWindow
->SetStyle( nStyle
| WB_BORDER
);
1895 pWindow
->SetBorderStyle( nBorder
);
1899 case BASEPROPERTY_TABSTOP
:
1901 WinBits nStyle
= pWindow
->GetStyle() & ~WB_TABSTOP
;
1904 sal_Bool bTab
= false;
1907 nStyle
|= WB_TABSTOP
;
1909 nStyle
|= WB_NOTABSTOP
;
1911 pWindow
->SetStyle( nStyle
);
1914 case BASEPROPERTY_VERTICALALIGN
:
1916 VerticalAlignment eAlign
= VerticalAlignment_MAKE_FIXED_SIZE
;
1917 WinBits nStyle
= pWindow
->GetStyle();
1918 nStyle
&= ~(WB_TOP
|WB_VCENTER
|WB_BOTTOM
);
1923 case VerticalAlignment_TOP
:
1926 case VerticalAlignment_MIDDLE
:
1927 nStyle
|= WB_VCENTER
;
1929 case VerticalAlignment_BOTTOM
:
1930 nStyle
|= WB_BOTTOM
;
1932 default: ; // for warning free code, MAKE_FIXED_SIZE
1934 pWindow
->SetStyle( nStyle
);
1937 case BASEPROPERTY_ALIGN
:
1939 sal_Int16 nAlign
= PROPERTY_ALIGN_LEFT
;
1942 case WINDOW_COMBOBOX
:
1944 case WINDOW_PUSHBUTTON
:
1945 case WINDOW_OKBUTTON
:
1946 case WINDOW_CANCELBUTTON
:
1947 case WINDOW_HELPBUTTON
:
1948 nAlign
= PROPERTY_ALIGN_CENTER
;
1950 case WINDOW_FIXEDTEXT
:
1952 case WINDOW_MULTILINEEDIT
:
1953 case WINDOW_CHECKBOX
:
1954 case WINDOW_RADIOBUTTON
:
1955 case WINDOW_LISTBOX
:
1957 WinBits nStyle
= pWindow
->GetStyle();
1958 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
1961 if ( nAlign
== PROPERTY_ALIGN_LEFT
)
1963 else if ( nAlign
== PROPERTY_ALIGN_CENTER
)
1964 nStyle
|= WB_CENTER
;
1967 pWindow
->SetStyle( nStyle
);
1973 case BASEPROPERTY_MULTILINE
:
1975 if ( ( eWinType
== WINDOW_FIXEDTEXT
)
1976 || ( eWinType
== WINDOW_CHECKBOX
)
1977 || ( eWinType
== WINDOW_RADIOBUTTON
)
1978 || ( eWinType
== WINDOW_BUTTON
)
1979 || ( eWinType
== WINDOW_PUSHBUTTON
)
1980 || ( eWinType
== WINDOW_OKBUTTON
)
1981 || ( eWinType
== WINDOW_CANCELBUTTON
)
1982 || ( eWinType
== WINDOW_HELPBUTTON
)
1985 WinBits nStyle
= pWindow
->GetStyle();
1986 sal_Bool bMulti
= false;
1989 nStyle
|= WB_WORDBREAK
;
1991 nStyle
&= ~WB_WORDBREAK
;
1992 pWindow
->SetStyle( nStyle
);
1996 case BASEPROPERTY_ORIENTATION
:
2000 case WINDOW_FIXEDLINE
:
2002 sal_Int32 nOrientation
= 0;
2003 if ( Value
>>= nOrientation
)
2005 WinBits nStyle
= pWindow
->GetStyle();
2006 nStyle
&= ~(WB_HORZ
|WB_VERT
);
2007 if ( nOrientation
== 0 )
2012 pWindow
->SetStyle( nStyle
);
2019 case BASEPROPERTY_AUTOMNEMONICS
:
2021 sal_Bool bAutoMnemonics
= false;
2022 Value
>>= bAutoMnemonics
;
2023 AllSettings aSettings
= pWindow
->GetSettings();
2024 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
2025 if ( aStyleSettings
.GetAutoMnemonic() != bAutoMnemonics
)
2027 aStyleSettings
.SetAutoMnemonic( bAutoMnemonics
);
2028 aSettings
.SetStyleSettings( aStyleSettings
);
2029 pWindow
->SetSettings( aSettings
);
2033 case BASEPROPERTY_MOUSETRANSPARENT
:
2035 sal_Bool bMouseTransparent
= false;
2036 Value
>>= bMouseTransparent
;
2037 pWindow
->SetMouseTransparent( bMouseTransparent
);
2040 case BASEPROPERTY_PAINTTRANSPARENT
:
2042 sal_Bool bPaintTransparent
= false;
2043 Value
>>= bPaintTransparent
;
2044 pWindow
->SetPaintTransparent( bPaintTransparent
);
2045 // pWindow->SetBackground();
2049 case BASEPROPERTY_REPEAT
:
2051 sal_Bool
bRepeat( FALSE
);
2054 WinBits nStyle
= pWindow
->GetStyle();
2056 nStyle
|= WB_REPEAT
;
2058 nStyle
&= ~WB_REPEAT
;
2059 pWindow
->SetStyle( nStyle
);
2063 case BASEPROPERTY_REPEAT_DELAY
:
2065 sal_Int32 nRepeatDelay
= 0;
2066 if ( Value
>>= nRepeatDelay
)
2068 AllSettings aSettings
= pWindow
->GetSettings();
2069 MouseSettings aMouseSettings
= aSettings
.GetMouseSettings();
2071 aMouseSettings
.SetButtonRepeat( nRepeatDelay
);
2072 aSettings
.SetMouseSettings( aMouseSettings
);
2074 pWindow
->SetSettings( aSettings
, TRUE
);
2079 case BASEPROPERTY_SYMBOL_COLOR
:
2080 ::toolkit::setColorSettings( pWindow
, Value
, &StyleSettings::SetButtonTextColor
, &StyleSettings::GetButtonTextColor
);
2083 case BASEPROPERTY_BORDERCOLOR
:
2084 ::toolkit::setColorSettings( pWindow
, Value
, &StyleSettings::SetMonoColor
, &StyleSettings::GetMonoColor
);
2086 case BASEPROPERTY_DEFAULTCONTROL
:
2088 rtl::OUString aName
;
2095 ::com::sun::star::uno::Any
VCLXWindow::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2097 ::vos::OGuard
aGuard( GetMutex() );
2099 ::com::sun::star::uno::Any aProp
;
2102 WindowType eWinType
= GetWindow()->GetType();
2103 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2104 switch ( nPropType
)
2106 case BASEPROPERTY_CONTEXT_WRITING_MODE
:
2107 aProp
<<= mpImpl
->mnContextWritingMode
;
2110 case BASEPROPERTY_WRITING_MODE
:
2111 aProp
<<= mpImpl
->mnWritingMode
;
2114 case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
:
2116 USHORT nVclBehavior
= GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior();
2117 sal_Int16 nBehavior
= MouseWheelBehavior::SCROLL_FOCUS_ONLY
;
2118 switch ( nVclBehavior
)
2120 case MOUSE_WHEEL_DISABLE
: nBehavior
= MouseWheelBehavior::SCROLL_DISABLED
; break;
2121 case MOUSE_WHEEL_FOCUS_ONLY
: nBehavior
= MouseWheelBehavior::SCROLL_FOCUS_ONLY
; break;
2122 case MOUSE_WHEEL_ALWAYS
: nBehavior
= MouseWheelBehavior::SCROLL_ALWAYS
; break;
2124 OSL_ENSURE( false, "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" );
2126 aProp
<<= nBehavior
;
2130 case BASEPROPERTY_NATIVE_WIDGET_LOOK
:
2131 aProp
<<= (sal_Bool
) GetWindow()->IsNativeWidgetEnabled();
2134 case BASEPROPERTY_ENABLED
:
2135 aProp
<<= (sal_Bool
) GetWindow()->IsEnabled();
2138 case BASEPROPERTY_ENABLEVISIBLE
:
2139 aProp
<<= (sal_Bool
) mpImpl
->isEnableVisible();
2142 case BASEPROPERTY_TEXT
:
2143 case BASEPROPERTY_LABEL
:
2144 case BASEPROPERTY_TITLE
:
2146 ::rtl::OUString aText
= GetWindow()->GetText();
2150 case BASEPROPERTY_ACCESSIBLENAME
:
2152 ::rtl::OUString aText
= GetWindow()->GetAccessibleName();
2156 case BASEPROPERTY_HELPTEXT
:
2158 ::rtl::OUString aText
= GetWindow()->GetQuickHelpText();
2162 case BASEPROPERTY_HELPURL
:
2164 SmartId aSmartId
= GetWindow()->GetSmartHelpId();
2165 if( aSmartId
.HasString() )
2167 String aStrHelpId
= aSmartId
.GetStr();
2168 aProp
<<= ::rtl::OUString( aStrHelpId
);
2172 ::rtl::OUStringBuffer aURL
;
2173 aURL
.appendAscii( "HID:" );
2174 aURL
.append( (sal_Int32
) GetWindow()->GetHelpId() );
2175 aProp
<<= aURL
.makeStringAndClear();
2179 case BASEPROPERTY_FONTDESCRIPTOR
:
2181 Font aFont
= GetWindow()->GetControlFont();
2182 ::com::sun::star::awt::FontDescriptor aFD
= VCLUnoHelper::CreateFontDescriptor( aFont
);
2186 case BASEPROPERTY_BACKGROUNDCOLOR
:
2187 aProp
<<= (sal_Int32
) GetWindow()->GetControlBackground().GetColor();
2189 case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR
:
2190 aProp
<<= (sal_Int32
) GetWindow()->GetDisplayBackground().GetColor().GetColor();
2192 case BASEPROPERTY_FONTRELIEF
:
2193 aProp
<<= (sal_Int16
) GetWindow()->GetControlFont().GetRelief();
2195 case BASEPROPERTY_FONTEMPHASISMARK
:
2196 aProp
<<= (sal_Int16
) GetWindow()->GetControlFont().GetEmphasisMark();
2198 case BASEPROPERTY_TEXTCOLOR
:
2199 aProp
<<= (sal_Int32
) GetWindow()->GetControlForeground().GetColor();
2201 case BASEPROPERTY_TEXTLINECOLOR
:
2202 aProp
<<= (sal_Int32
) GetWindow()->GetTextLineColor().GetColor();
2204 case BASEPROPERTY_FILLCOLOR
:
2205 aProp
<<= (sal_Int32
) GetWindow()->GetFillColor().GetColor();
2207 case BASEPROPERTY_LINECOLOR
:
2208 aProp
<<= (sal_Int32
) GetWindow()->GetLineColor().GetColor();
2210 case BASEPROPERTY_BORDER
:
2212 sal_Int16 nBorder
= 0;
2213 if ( GetWindow()->GetStyle() & WB_BORDER
)
2214 nBorder
= GetWindow()->GetBorderStyle();
2218 case BASEPROPERTY_TABSTOP
:
2219 aProp
<<= (sal_Bool
) ( GetWindow()->GetStyle() & WB_TABSTOP
) ? sal_True
: sal_False
;
2221 case BASEPROPERTY_VERTICALALIGN
:
2223 WinBits nStyle
= GetWindow()->GetStyle();
2224 if ( nStyle
& WB_TOP
)
2225 aProp
<<= VerticalAlignment_TOP
;
2226 else if ( nStyle
& WB_VCENTER
)
2227 aProp
<<= VerticalAlignment_MIDDLE
;
2228 else if ( nStyle
& WB_BOTTOM
)
2229 aProp
<<= VerticalAlignment_BOTTOM
;
2232 case BASEPROPERTY_ALIGN
:
2236 case WINDOW_FIXEDTEXT
:
2238 case WINDOW_MULTILINEEDIT
:
2239 case WINDOW_CHECKBOX
:
2240 case WINDOW_RADIOBUTTON
:
2241 case WINDOW_LISTBOX
:
2242 case WINDOW_COMBOBOX
:
2244 case WINDOW_PUSHBUTTON
:
2245 case WINDOW_OKBUTTON
:
2246 case WINDOW_CANCELBUTTON
:
2247 case WINDOW_HELPBUTTON
:
2249 WinBits nStyle
= GetWindow()->GetStyle();
2250 if ( nStyle
& WB_LEFT
)
2251 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_LEFT
;
2252 else if ( nStyle
& WB_CENTER
)
2253 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_CENTER
;
2254 else if ( nStyle
& WB_RIGHT
)
2255 aProp
<<= (sal_Int16
) PROPERTY_ALIGN_RIGHT
;
2260 case BASEPROPERTY_MULTILINE
:
2262 if ( ( eWinType
== WINDOW_FIXEDTEXT
)
2263 || ( eWinType
== WINDOW_CHECKBOX
)
2264 || ( eWinType
== WINDOW_RADIOBUTTON
)
2265 || ( eWinType
== WINDOW_BUTTON
)
2266 || ( eWinType
== WINDOW_PUSHBUTTON
)
2267 || ( eWinType
== WINDOW_OKBUTTON
)
2268 || ( eWinType
== WINDOW_CANCELBUTTON
)
2269 || ( eWinType
== WINDOW_HELPBUTTON
)
2271 aProp
<<= (sal_Bool
) ( GetWindow()->GetStyle() & WB_WORDBREAK
) ? sal_True
: sal_False
;
2274 case BASEPROPERTY_AUTOMNEMONICS
:
2276 sal_Bool bAutoMnemonics
= GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
2277 aProp
<<= bAutoMnemonics
;
2280 case BASEPROPERTY_MOUSETRANSPARENT
:
2282 sal_Bool bMouseTransparent
= GetWindow()->IsMouseTransparent();
2283 aProp
<<= bMouseTransparent
;
2286 case BASEPROPERTY_PAINTTRANSPARENT
:
2288 sal_Bool bPaintTransparent
= GetWindow()->IsPaintTransparent();
2289 aProp
<<= bPaintTransparent
;
2293 case BASEPROPERTY_REPEAT
:
2294 aProp
<<= (sal_Bool
)( 0 != ( GetWindow()->GetStyle() & WB_REPEAT
) );
2297 case BASEPROPERTY_REPEAT_DELAY
:
2299 sal_Int32 nButtonRepeat
= GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
2300 aProp
<<= (sal_Int32
)nButtonRepeat
;
2304 case BASEPROPERTY_SYMBOL_COLOR
:
2305 aProp
<<= (sal_Int32
)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
2308 case BASEPROPERTY_BORDERCOLOR
:
2309 aProp
<<= (sal_Int32
)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor();
2317 // ::com::sun::star::awt::XLayoutConstrains
2318 ::com::sun::star::awt::Size
VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2320 ::vos::OGuard
aGuard( GetMutex() );
2322 // Diese Methode sollte nur fuer Componenten gerufen werden, die zwar
2323 // ueber das ::com::sun::star::awt::Toolkit erzeugt werden koennen, aber fuer die es
2324 // kein Interface gibt.
2329 WindowType nWinType
= GetWindow()->GetType();
2332 case WINDOW_CONTROL
:
2333 aSz
.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
2334 aSz
.Height() = GetWindow()->GetTextHeight()+2*6;
2337 case WINDOW_PATTERNBOX
:
2338 case WINDOW_NUMERICBOX
:
2339 case WINDOW_METRICBOX
:
2340 case WINDOW_CURRENCYBOX
:
2341 case WINDOW_DATEBOX
:
2342 case WINDOW_TIMEBOX
:
2343 case WINDOW_LONGCURRENCYBOX
:
2344 aSz
.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
2345 aSz
.Height() = GetWindow()->GetTextHeight()+2*2;
2347 case WINDOW_SCROLLBARBOX
:
2348 return VCLXScrollBar::implGetMinimumSize( GetWindow() );
2350 aSz
= GetWindow()->GetOptimalSize( WINDOWSIZE_MINIMUM
);
2354 return ::com::sun::star::awt::Size( aSz
.Width(), aSz
.Height() );
2357 ::com::sun::star::awt::Size
VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2359 return getMinimumSize();
2362 ::com::sun::star::awt::Size
VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2364 ::vos::OGuard
aGuard( GetMutex() );
2366 ::com::sun::star::awt::Size
aNewSize( rNewSize
);
2367 ::com::sun::star::awt::Size aMinSize
= getMinimumSize();
2369 if ( aNewSize
.Width
< aMinSize
.Width
)
2370 aNewSize
.Width
= aMinSize
.Width
;
2371 if ( aNewSize
.Height
< aMinSize
.Height
)
2372 aNewSize
.Height
= aMinSize
.Height
;
2378 // ::com::sun::star::awt::XView
2379 sal_Bool
VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& rxDevice
) throw(::com::sun::star::uno::RuntimeException
)
2381 ::vos::OGuard
aGuard( GetMutex() );
2383 if ( VCLUnoHelper::GetOutputDevice( rxDevice
) )
2384 mpImpl
->mxViewGraphics
= rxDevice
;
2386 mpImpl
->mxViewGraphics
= NULL
;
2388 return mpImpl
->mxViewGraphics
.is();
2391 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
> VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException
)
2393 ::vos::OGuard
aGuard( GetMutex() );
2395 return mpImpl
->mxViewGraphics
;
2398 ::com::sun::star::awt::Size
VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException
)
2400 ::vos::OGuard
aGuard( GetMutex() );
2404 aSz
= GetWindow()->GetSizePixel();
2405 return ::com::sun::star::awt::Size( aSz
.Width(), aSz
.Height() );
2408 void VCLXWindow::draw( sal_Int32 nX
, sal_Int32 nY
) throw(::com::sun::star::uno::RuntimeException
)
2410 ::vos::OGuard
aGuard( GetMutex() );
2412 Window
* pWindow
= GetWindow();
2416 if ( isDesignMode() || mpImpl
->isEnableVisible() )
2418 TabPage
* pTabPage
= dynamic_cast< TabPage
* >( pWindow
);
2421 Point
aPos( nX
, nY
);
2422 Size aSize
= pWindow
->GetSizePixel();
2424 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( mpImpl
->mxViewGraphics
);
2425 aPos
= pDev
->PixelToLogic( aPos
);
2426 aSize
= pDev
->PixelToLogic( aSize
);
2428 pTabPage
->Draw( pDev
, aPos
, aSize
, 0 );
2432 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( mpImpl
->mxViewGraphics
);
2433 Point
aPos( nX
, nY
);
2436 pDev
= pWindow
->GetParent();
2438 if ( pWindow
->GetParent() && !pWindow
->IsSystemWindow() && ( pWindow
->GetParent() == pDev
) )
2440 // #i40647# don't draw here if this is a recursive call
2441 // sometimes this is called recursively, because the Update call on the parent
2442 // (strangely) triggers another paint. Prevent a stack overflow here
2443 // Yes, this is only fixing symptoms for the moment ....
2444 // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
2445 if ( !mpImpl
->getDrawingOntoParent_ref() )
2447 FlagGuard
aDrawingflagGuard( mpImpl
->getDrawingOntoParent_ref() );
2449 BOOL bWasVisible
= pWindow
->IsVisible();
2450 Point
aOldPos( pWindow
->GetPosPixel() );
2452 if ( bWasVisible
&& aOldPos
== aPos
)
2458 pWindow
->SetPosPixel( aPos
);
2460 // Erstmal ein Update auf den Parent, damit nicht beim Update
2461 // auf dieses Fenster noch ein Paint vom Parent abgearbeitet wird,
2462 // wo dann ggf. dieses Fenster sofort wieder gehidet wird.
2463 if( pWindow
->GetParent() )
2464 pWindow
->GetParent()->Update();
2468 pWindow
->SetParentUpdateMode( sal_False
);
2470 pWindow
->SetParentUpdateMode( sal_True
);
2472 pWindow
->SetPosPixel( aOldPos
);
2474 pWindow
->Show( TRUE
);
2479 Size aSz
= pWindow
->GetSizePixel();
2480 aSz
= pDev
->PixelToLogic( aSz
);
2481 Point aP
= pDev
->PixelToLogic( aPos
);
2483 vcl::PDFExtOutDevData
* pPDFExport
= dynamic_cast<vcl::PDFExtOutDevData
*>(pDev
->GetExtOutDevData());
2484 bool bDrawSimple
= ( pDev
->GetOutDevType() == OUTDEV_PRINTER
)
2485 || ( pDev
->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW
)
2486 || ( pPDFExport
!= NULL
);
2489 pWindow
->Draw( pDev
, aP
, aSz
, WINDOW_DRAW_NOCONTROLS
);
2493 BOOL bOldNW
=pWindow
->IsNativeWidgetEnabled();
2495 pWindow
->EnableNativeWidget(FALSE
);
2496 pWindow
->PaintToDevice( pDev
, aP
, aSz
);
2498 pWindow
->EnableNativeWidget(TRUE
);
2504 void VCLXWindow::setZoom( float fZoomX
, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException
)
2506 ::vos::OGuard
aGuard( GetMutex() );
2509 GetWindow()->SetZoom( Fraction( fZoomX
) );
2512 // ::com::sun::star::lang::XEventListener
2513 void SAL_CALL
VCLXWindow::disposing( const ::com::sun::star::lang::EventObject
& _rSource
) throw (::com::sun::star::uno::RuntimeException
)
2515 ::vos::OGuard
aGuard( GetMutex() );
2517 // check if it comes from our AccessibleContext
2518 uno::Reference
< uno::XInterface
> aAC( mpImpl
->mxAccessibleContext
, uno::UNO_QUERY
);
2519 uno::Reference
< uno::XInterface
> xSource( _rSource
.Source
, uno::UNO_QUERY
);
2521 if ( aAC
.get() == xSource
.get() )
2523 mpImpl
->mxAccessibleContext
= uno::Reference
< accessibility::XAccessibleContext
>();
2527 // ::com::sun::star::accessibility::XAccessible
2528 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXWindow::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException
)
2530 using namespace ::com::sun::star
;
2532 ::vos::OGuard
aGuard( GetMutex() );
2536 return uno::Reference
< accessibility::XAccessibleContext
>();
2538 if ( !mpImpl
->mxAccessibleContext
.is() && GetWindow() )
2540 mpImpl
->mxAccessibleContext
= CreateAccessibleContext();
2542 // add as event listener to this component
2543 // in case somebody disposes it, we do not want to have a (though weak) reference to a dead
2545 uno::Reference
< lang::XComponent
> xComp( mpImpl
->mxAccessibleContext
, uno::UNO_QUERY
);
2547 xComp
->addEventListener( this );
2550 return mpImpl
->mxAccessibleContext
;
2553 // ::com::sun::star::awt::XDockable
2554 void SAL_CALL
VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDockableWindowListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
2556 ::vos::OGuard
aGuard( GetMutex() );
2558 if ( xListener
.is() )
2559 mpImpl
->getDockableWindowListeners().addInterface( xListener
);
2563 void SAL_CALL
VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDockableWindowListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
2565 ::vos::OGuard
aGuard( GetMutex() );
2567 mpImpl
->getDockableWindowListeners().removeInterface( xListener
);
2570 void SAL_CALL
VCLXWindow::enableDocking( sal_Bool bEnable
) throw (::com::sun::star::uno::RuntimeException
)
2572 ::vos::OGuard
aGuard( GetMutex() );
2574 Window
* pWindow
= GetWindow();
2576 pWindow
->EnableDocking( bEnable
);
2579 sal_Bool SAL_CALL
VCLXWindow::isFloating( ) throw (::com::sun::star::uno::RuntimeException
)
2581 ::vos::OGuard
aGuard( GetMutex() );
2583 Window
* pWindow
= GetWindow();
2585 return Window::GetDockingManager()->IsFloating( pWindow
);
2590 void SAL_CALL
VCLXWindow::setFloatingMode( sal_Bool bFloating
) throw (::com::sun::star::uno::RuntimeException
)
2592 ::vos::OGuard
aGuard( GetMutex() );
2594 Window
* pWindow
= GetWindow();
2596 Window::GetDockingManager()->SetFloatingMode( pWindow
, bFloating
);
2599 sal_Bool SAL_CALL
VCLXWindow::isLocked( ) throw (::com::sun::star::uno::RuntimeException
)
2601 ::vos::OGuard
aGuard( GetMutex() );
2603 Window
* pWindow
= GetWindow();
2605 return Window::GetDockingManager()->IsLocked( pWindow
);
2610 void SAL_CALL
VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException
)
2612 ::vos::OGuard
aGuard( GetMutex() );
2614 Window
* pWindow
= GetWindow();
2615 if( pWindow
&& !Window::GetDockingManager()->IsFloating( pWindow
) )
2616 Window::GetDockingManager()->Lock( pWindow
);
2619 void SAL_CALL
VCLXWindow::unlock( ) throw (::com::sun::star::uno::RuntimeException
)
2621 ::vos::OGuard
aGuard( GetMutex() );
2623 Window
* pWindow
= GetWindow();
2624 if( pWindow
&& !Window::GetDockingManager()->IsFloating( pWindow
) )
2625 Window::GetDockingManager()->Unlock( pWindow
);
2627 void SAL_CALL
VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle
& ) throw (::com::sun::star::uno::RuntimeException
)
2629 // TODO: remove interface in the next incompatible build
2630 ::vos::OGuard
aGuard( GetMutex() );
2634 sal_Bool SAL_CALL
VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException
)
2636 // TODO: remove interface in the next incompatible build
2637 ::vos::OGuard
aGuard( GetMutex() );
2642 // ::com::sun::star::awt::XWindow2
2644 void SAL_CALL
VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size
& aSize
) throw (::com::sun::star::uno::RuntimeException
)
2646 ::vos::OGuard
aGuard( GetMutex() );
2648 if( (pWindow
= GetWindow()) != NULL
)
2650 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >(pWindow
);
2651 if( pDockingWindow
)
2652 pDockingWindow
->SetOutputSizePixel( VCLSize( aSize
) );
2654 pWindow
->SetOutputSizePixel( VCLSize( aSize
) );
2658 ::com::sun::star::awt::Size SAL_CALL
VCLXWindow::getOutputSize( ) throw (::com::sun::star::uno::RuntimeException
)
2660 ::vos::OGuard
aGuard( GetMutex() );
2662 if( (pWindow
= GetWindow()) != NULL
)
2664 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >(pWindow
);
2665 if( pDockingWindow
)
2666 return AWTSize( pDockingWindow
->GetOutputSizePixel() );
2668 return AWTSize( pWindow
->GetOutputSizePixel() );
2671 return ::com::sun::star::awt::Size();
2674 sal_Bool SAL_CALL
VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException
)
2676 ::vos::OGuard
aGuard( GetMutex() );
2678 return GetWindow()->IsVisible();
2683 sal_Bool SAL_CALL
VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException
)
2685 ::vos::OGuard
aGuard( GetMutex() );
2687 return GetWindow()->IsActive();
2693 sal_Bool SAL_CALL
VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException
)
2695 ::vos::OGuard
aGuard( GetMutex() );
2697 return GetWindow()->IsEnabled();
2702 sal_Bool SAL_CALL
VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException
)
2704 ::vos::OGuard
aGuard( GetMutex() );
2706 return GetWindow()->HasFocus();
2711 // ::com::sun::star::beans::XPropertySetInfo
2713 UnoPropertyArrayHelper
*
2714 VCLXWindow::GetPropHelper()
2716 ::vos::OGuard
aGuard( GetMutex() );
2717 if ( mpImpl
->mpPropHelper
== NULL
)
2719 std::list
< sal_uInt16
> aIDs
;
2720 GetPropertyIds( aIDs
);
2721 mpImpl
->mpPropHelper
= new UnoPropertyArrayHelper( aIDs
);
2723 return mpImpl
->mpPropHelper
;
2726 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
2727 VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException
)
2729 return GetPropHelper()->getProperties();
2731 ::com::sun::star::beans::Property SAL_CALL
2732 VCLXWindow::getPropertyByName( const ::rtl::OUString
& rName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
2734 return GetPropHelper()->getPropertyByName( rName
);
2738 VCLXWindow::hasPropertyByName( const ::rtl::OUString
& rName
) throw (::com::sun::star::uno::RuntimeException
)
2740 return GetPropHelper()->hasPropertyByName( rName
);