bump product version to 4.1.6.2
[LibreOffice.git] / toolkit / source / awt / vclxwindow.cxx
blob0f1bf33130cf4baf0dda681e8f5d90fd80bfe76f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <com/sun/star/awt/WindowEvent.hpp>
22 #include <com/sun/star/awt/KeyEvent.hpp>
23 #include <com/sun/star/awt/KeyModifier.hpp>
24 #include <com/sun/star/awt/MouseEvent.hpp>
25 #include <com/sun/star/awt/MouseButton.hpp>
26 #include <com/sun/star/awt/MouseWheelBehavior.hpp>
27 #include <com/sun/star/awt/XTopWindow.hpp>
28 #include <com/sun/star/awt/Style.hpp>
29 #include <com/sun/star/accessibility/AccessibleRole.hpp>
30 #include <com/sun/star/awt/DockingEvent.hpp>
31 #include <com/sun/star/awt/EndDockingEvent.hpp>
32 #include <com/sun/star/awt/EndPopupModeEvent.hpp>
33 #include <com/sun/star/awt/XWindowListener2.hpp>
34 #include <com/sun/star/style/VerticalAlignment.hpp>
35 #include <com/sun/star/lang/DisposedException.hpp>
36 #include <com/sun/star/text/WritingMode2.hpp>
37 #include <toolkit/awt/vclxwindow.hxx>
38 #include <toolkit/awt/vclxpointer.hxx>
39 #include <toolkit/awt/vclxwindows.hxx>
40 #include <toolkit/helper/macros.hxx>
41 #include <toolkit/helper/vclunohelper.hxx>
42 #include <toolkit/helper/convert.hxx>
43 #include <toolkit/helper/property.hxx>
44 #include <toolkit/helper/accessibilityclient.hxx>
45 #include <cppuhelper/typeprovider.hxx>
46 #include <rtl/uuid.h>
47 #include <rtl/ustrbuf.hxx>
48 #include <vcl/svapp.hxx>
49 #include <vcl/window.hxx>
50 #include <tools/color.hxx>
51 #include <vcl/dockwin.hxx>
52 #include <vcl/pdfextoutdevdata.hxx>
53 #include <vcl/tabpage.hxx>
54 #include <vcl/button.hxx>
55 #include <comphelper/asyncnotification.hxx>
56 #include <comphelper/flagguard.hxx>
57 #include "stylesettings.hxx"
58 #include <tools/urlobj.hxx>
59 #include <toolkit/helper/unopropertyarrayhelper.hxx>
61 #include <boost/bind.hpp>
63 using namespace ::com::sun::star;
65 using ::com::sun::star::uno::Reference;
66 using ::com::sun::star::uno::UNO_QUERY;
67 using ::com::sun::star::uno::RuntimeException;
68 using ::com::sun::star::lang::EventObject;
69 using ::com::sun::star::awt::XWindowListener2;
70 using ::com::sun::star::awt::XDockableWindowListener;
71 using ::com::sun::star::awt::XDevice;
72 using ::com::sun::star::awt::XStyleSettings;
73 using ::com::sun::star::lang::DisposedException;
74 using ::com::sun::star::style::VerticalAlignment;
75 using ::com::sun::star::style::VerticalAlignment_TOP;
76 using ::com::sun::star::style::VerticalAlignment_MIDDLE;
77 using ::com::sun::star::style::VerticalAlignment_BOTTOM;
78 using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE;
80 namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
81 namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
83 //====================================================================
84 //= VCLXWindowImpl
85 //====================================================================
86 class SAL_DLLPRIVATE VCLXWindowImpl
88 private:
89 typedef ::std::vector< VCLXWindow::Callback > CallbackArray;
91 private:
92 VCLXWindow& mrAntiImpl;
93 ::toolkit::AccessibilityClient maAccFactory;
94 bool mbDisposed;
95 bool mbDrawingOntoParent; // no bit mask, is passed around by reference
96 sal_Bool mbEnableVisible;
97 sal_Bool mbDirectVisible;
99 ::osl::Mutex maListenerContainerMutex;
100 ::cppu::OInterfaceContainerHelper maWindow2Listeners;
101 ::cppu::OInterfaceContainerHelper maDockableWindowListeners;
102 EventListenerMultiplexer maEventListeners;
103 FocusListenerMultiplexer maFocusListeners;
104 WindowListenerMultiplexer maWindowListeners;
105 KeyListenerMultiplexer maKeyListeners;
106 MouseListenerMultiplexer maMouseListeners;
107 MouseMotionListenerMultiplexer maMouseMotionListeners;
108 PaintListenerMultiplexer maPaintListeners;
109 VclContainerListenerMultiplexer maContainerListeners;
110 TopWindowListenerMultiplexer maTopWindowListeners;
112 CallbackArray maCallbackEvents;
113 sal_uLong mnCallbackEventId;
115 public:
116 bool mbDisposing : 1;
117 bool mbDesignMode : 1;
118 bool mbSynthesizingVCLEvent : 1;
119 bool mbWithDefaultProps : 1;
121 sal_uLong mnListenerLockLevel;
122 sal_Int16 mnWritingMode;
123 sal_Int16 mnContextWritingMode;
125 UnoPropertyArrayHelper* mpPropHelper;
127 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >
128 mxPointer;
129 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
130 mxAccessibleContext;
131 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >
132 mxViewGraphics;
133 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings >
134 mxWindowStyleSettings;
136 public:
137 bool& getDrawingOntoParent_ref() { return mbDrawingOntoParent; }
139 public:
140 /** ctor
141 @param _pAntiImpl
142 the <type>VCLXWindow</type> instance which the object belongs to. Must
143 live longer then the object just being constructed.
145 VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps );
147 /** synchronously mbEnableVisible
149 void setEnableVisible( sal_Bool bEnableVisible ) { mbEnableVisible = bEnableVisible; }
150 sal_Bool isEnableVisible() { return mbEnableVisible; }
151 /** synchronously mbDirectVisible;
153 void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; }
154 sal_Bool isDirectVisible() { return mbDirectVisible; }
156 /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock
158 void callBackAsync( const VCLXWindow::Callback& i_callback );
160 /** notifies the object that its VCLXWindow is being disposed
162 void disposing();
164 inline ::toolkit::AccessibilityClient& getAccessibleFactory()
166 return maAccFactory;
169 Reference< XStyleSettings > getStyleSettings();
171 /** returns the container of registered XWindowListener2 listeners
173 inline ::cppu::OInterfaceContainerHelper& getWindow2Listeners() { return maWindow2Listeners; }
174 inline ::cppu::OInterfaceContainerHelper& getDockableWindowListeners(){ return maDockableWindowListeners; }
175 inline EventListenerMultiplexer& getEventListeners() { return maEventListeners; }
176 inline FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; }
177 inline WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; }
178 inline KeyListenerMultiplexer& getKeyListeners() { return maKeyListeners; }
179 inline MouseListenerMultiplexer& getMouseListeners() { return maMouseListeners; }
180 inline MouseMotionListenerMultiplexer& getMouseMotionListeners() { return maMouseMotionListeners; }
181 inline PaintListenerMultiplexer& getPaintListeners() { return maPaintListeners; }
182 inline VclContainerListenerMultiplexer& getContainerListeners() { return maContainerListeners; }
183 inline TopWindowListenerMultiplexer& getTopWindowListeners() { return maTopWindowListeners; }
185 virtual ~VCLXWindowImpl();
187 protected:
188 virtual void SAL_CALL acquire();
189 virtual void SAL_CALL release();
191 private:
192 DECL_LINK( OnProcessCallbacks, void* );
194 private:
195 VCLXWindowImpl(); // never implemented
196 VCLXWindowImpl( const VCLXWindowImpl& ); // never implemented
197 VCLXWindowImpl& operator=( const VCLXWindowImpl& ); // never implemented
200 //--------------------------------------------------------------------
201 VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps )
202 :mrAntiImpl( _rAntiImpl )
203 ,mbDisposed( false )
204 ,mbDrawingOntoParent( false )
205 ,mbEnableVisible(sal_True)
206 ,mbDirectVisible(sal_True)
207 ,maListenerContainerMutex( )
208 ,maWindow2Listeners( maListenerContainerMutex )
209 ,maDockableWindowListeners( maListenerContainerMutex )
210 ,maEventListeners( _rAntiImpl )
211 ,maFocusListeners( _rAntiImpl )
212 ,maWindowListeners( _rAntiImpl )
213 ,maKeyListeners( _rAntiImpl )
214 ,maMouseListeners( _rAntiImpl )
215 ,maMouseMotionListeners( _rAntiImpl )
216 ,maPaintListeners( _rAntiImpl )
217 ,maContainerListeners( _rAntiImpl )
218 ,maTopWindowListeners( _rAntiImpl )
219 ,mnCallbackEventId( 0 )
220 ,mbDisposing( false )
221 ,mbDesignMode( false )
222 ,mbSynthesizingVCLEvent( false )
223 ,mbWithDefaultProps( _bWithDefaultProps )
224 ,mnListenerLockLevel( 0 )
225 ,mnWritingMode( WritingMode2::CONTEXT )
226 ,mnContextWritingMode( WritingMode2::CONTEXT )
227 ,mpPropHelper( NULL )
231 VCLXWindowImpl::~VCLXWindowImpl()
233 delete mpPropHelper;
236 //--------------------------------------------------------------------
237 void VCLXWindowImpl::disposing()
239 SolarMutexGuard aGuard;
240 if ( mnCallbackEventId )
241 Application::RemoveUserEvent( mnCallbackEventId );
242 mnCallbackEventId = 0;
244 mbDisposed= true;
246 ::com::sun::star::lang::EventObject aEvent;
247 aEvent.Source = mrAntiImpl;
249 maDockableWindowListeners.disposeAndClear( aEvent );
250 maEventListeners.disposeAndClear( aEvent );
251 maFocusListeners.disposeAndClear( aEvent );
252 maWindowListeners.disposeAndClear( aEvent );
253 maKeyListeners.disposeAndClear( aEvent );
254 maMouseListeners.disposeAndClear( aEvent );
255 maMouseMotionListeners.disposeAndClear( aEvent );
256 maPaintListeners.disposeAndClear( aEvent );
257 maContainerListeners.disposeAndClear( aEvent );
258 maTopWindowListeners.disposeAndClear( aEvent );
260 ::toolkit::WindowStyleSettings* pStyleSettings = static_cast< ::toolkit::WindowStyleSettings* >( mxWindowStyleSettings.get() );
261 if ( pStyleSettings != NULL )
262 pStyleSettings->dispose();
263 mxWindowStyleSettings.clear();
266 //--------------------------------------------------------------------
267 void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback )
269 DBG_TESTSOLARMUTEX();
270 maCallbackEvents.push_back( i_callback );
271 if ( !mnCallbackEventId )
273 // ensure our VCLXWindow is not destroyed while the event is underway
274 mrAntiImpl.acquire();
275 mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) );
279 //----------------------------------------------------------------------------------------------------------------------
280 IMPL_LINK_NOARG(VCLXWindowImpl, OnProcessCallbacks)
282 const Reference< uno::XInterface > xKeepAlive( mrAntiImpl );
284 // work on a copy of the callback array
285 CallbackArray aCallbacksCopy;
287 SolarMutexGuard aGuard;
288 aCallbacksCopy = maCallbackEvents;
289 maCallbackEvents.clear();
291 // we acquired our VCLXWindow once before posting the event, release this one ref now
292 mrAntiImpl.release();
294 if ( !mnCallbackEventId )
295 // we were disposed while waiting for the mutex to lock
296 return 1L;
298 mnCallbackEventId = 0;
302 SolarMutexReleaser aReleaseSolar;
303 for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin();
304 loop != aCallbacksCopy.end();
305 ++loop
308 (*loop)();
312 return 0L;
315 //--------------------------------------------------------------------
316 void SAL_CALL VCLXWindowImpl::acquire()
318 mrAntiImpl.acquire();
321 //--------------------------------------------------------------------
322 void SAL_CALL VCLXWindowImpl::release()
324 mrAntiImpl.release();
327 //--------------------------------------------------------------------
328 Reference< XStyleSettings > VCLXWindowImpl::getStyleSettings()
330 SolarMutexGuard aGuard;
331 if ( mbDisposed )
332 throw DisposedException( OUString(), mrAntiImpl );
333 if ( !mxWindowStyleSettings.is() )
334 mxWindowStyleSettings = new ::toolkit::WindowStyleSettings( maListenerContainerMutex, mrAntiImpl );
335 return mxWindowStyleSettings;
338 //====================================================================
339 //====================================================================
341 // Uses an out-parameter instead of return value, due to the object reference
343 void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pWindow )
345 Point aPos = pWindow->GetPosPixel();
346 Size aSz = pWindow->GetSizePixel();
348 rEvent.X = aPos.X();
349 rEvent.Y = aPos.Y();
351 rEvent.Width = aSz.Width();
352 rEvent.Height = aSz.Height();
354 pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset );
357 // ----------------------------------------------------
358 // class VCLXWindow
359 // ----------------------------------------------------
361 DBG_NAME(VCLXWindow);
363 VCLXWindow::VCLXWindow( bool _bWithDefaultProps )
364 :mpImpl( NULL )
366 DBG_CTOR( VCLXWindow, 0 );
368 mpImpl = new VCLXWindowImpl( *this, _bWithDefaultProps );
371 VCLXWindow::~VCLXWindow()
373 DBG_DTOR( VCLXWindow, 0 );
375 delete mpImpl;
377 if ( GetWindow() )
379 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
380 GetWindow()->SetWindowPeer( NULL, NULL );
381 GetWindow()->SetAccessible( NULL );
385 //----------------------------------------------------------------------------------------------------------------------
386 void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
388 mpImpl->callBackAsync( i_callback );
391 //----------------------------------------------------------------------------------------------------------------------
392 ::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory()
394 return mpImpl->getAccessibleFactory().getFactory();
397 void VCLXWindow::SetWindow( Window* pWindow )
399 if ( GetWindow() )
401 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
402 // GetWindow()->DbgAssertNoEventListeners();
405 SetOutputDevice( pWindow );
407 if ( GetWindow() )
409 GetWindow()->AddEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
410 sal_Bool bDirectVisible = pWindow ? pWindow->IsVisible() : false;
411 mpImpl->setDirectVisible( bDirectVisible );
415 void VCLXWindow::suspendVclEventListening( )
417 ++mpImpl->mnListenerLockLevel;
420 void VCLXWindow::resumeVclEventListening( )
422 DBG_ASSERT( mpImpl->mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" );
423 --mpImpl->mnListenerLockLevel;
426 void VCLXWindow::notifyWindowRemoved( Window& _rWindow )
428 if ( mpImpl->getContainerListeners().getLength() )
430 awt::VclContainerEvent aEvent;
431 aEvent.Source = *this;
432 aEvent.Child = static_cast< XWindow* >( _rWindow.GetWindowPeer() );
433 mpImpl->getContainerListeners().windowRemoved( aEvent );
437 IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent )
439 if ( mpImpl->mnListenerLockLevel )
440 return 0L;
442 DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
443 if ( pEvent && pEvent->ISA( VclWindowEvent ) )
445 DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow() && GetWindow(), "Window???" );
446 ProcessWindowEvent( *(VclWindowEvent*)pEvent );
448 return 0;
451 namespace
453 struct CallWindow2Listener
455 CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent )
456 :m_rWindow2Listeners( i_rWindow2Listeners )
457 ,m_bEnabled( i_bEnabled )
458 ,m_aEvent( i_rEvent )
462 void operator()()
464 m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent );
467 ::cppu::OInterfaceContainerHelper& m_rWindow2Listeners;
468 const bool m_bEnabled;
469 const EventObject m_aEvent;
473 void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
475 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this );
477 switch ( rVclWindowEvent.GetId() )
479 case VCLEVENT_WINDOW_ENABLED:
480 case VCLEVENT_WINDOW_DISABLED:
482 Callback aCallback = CallWindow2Listener(
483 mpImpl->getWindow2Listeners(),
484 ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ),
485 EventObject( *this )
487 ImplExecuteAsyncWithoutSolarLock( aCallback );
489 break;
491 case VCLEVENT_WINDOW_PAINT:
493 if ( mpImpl->getPaintListeners().getLength() )
495 ::com::sun::star::awt::PaintEvent aEvent;
496 aEvent.Source = (::cppu::OWeakObject*)this;
497 aEvent.UpdateRect = AWTRectangle( *(Rectangle*)rVclWindowEvent.GetData() );
498 aEvent.Count = 0;
499 mpImpl->getPaintListeners().windowPaint( aEvent );
502 break;
503 case VCLEVENT_WINDOW_MOVE:
505 if ( mpImpl->getWindowListeners().getLength() )
507 ::com::sun::star::awt::WindowEvent aEvent;
508 aEvent.Source = (::cppu::OWeakObject*)this;
509 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
510 mpImpl->getWindowListeners().windowMoved( aEvent );
513 break;
514 case VCLEVENT_WINDOW_RESIZE:
516 if ( mpImpl->getWindowListeners().getLength() )
518 ::com::sun::star::awt::WindowEvent aEvent;
519 aEvent.Source = (::cppu::OWeakObject*)this;
520 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
521 mpImpl->getWindowListeners().windowResized( aEvent );
524 break;
525 case VCLEVENT_WINDOW_SHOW:
527 if ( mpImpl->getWindowListeners().getLength() )
529 ::com::sun::star::awt::WindowEvent aEvent;
530 aEvent.Source = (::cppu::OWeakObject*)this;
531 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
532 mpImpl->getWindowListeners().windowShown( aEvent );
535 // For TopWindows this means opened...
536 if ( mpImpl->getTopWindowListeners().getLength() )
538 ::com::sun::star::lang::EventObject aEvent;
539 aEvent.Source = (::cppu::OWeakObject*)this;
540 mpImpl->getTopWindowListeners().windowOpened( aEvent );
543 break;
544 case VCLEVENT_WINDOW_HIDE:
546 if ( mpImpl->getWindowListeners().getLength() )
548 ::com::sun::star::awt::WindowEvent aEvent;
549 aEvent.Source = (::cppu::OWeakObject*)this;
550 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
551 mpImpl->getWindowListeners().windowHidden( aEvent );
554 // For TopWindows this means closed...
555 if ( mpImpl->getTopWindowListeners().getLength() )
557 ::com::sun::star::lang::EventObject aEvent;
558 aEvent.Source = (::cppu::OWeakObject*)this;
559 mpImpl->getTopWindowListeners().windowClosed( aEvent );
562 break;
563 case VCLEVENT_WINDOW_ACTIVATE:
565 if ( mpImpl->getTopWindowListeners().getLength() )
567 ::com::sun::star::lang::EventObject aEvent;
568 aEvent.Source = (::cppu::OWeakObject*)this;
569 mpImpl->getTopWindowListeners().windowActivated( aEvent );
572 break;
573 case VCLEVENT_WINDOW_DEACTIVATE:
575 if ( mpImpl->getTopWindowListeners().getLength() )
577 ::com::sun::star::lang::EventObject aEvent;
578 aEvent.Source = (::cppu::OWeakObject*)this;
579 mpImpl->getTopWindowListeners().windowDeactivated( aEvent );
582 break;
583 case VCLEVENT_WINDOW_CLOSE:
585 if ( mpImpl->getDockableWindowListeners().getLength() )
587 ::com::sun::star::lang::EventObject aEvent;
588 aEvent.Source = (::cppu::OWeakObject*)this;
589 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed, aEvent );
591 if ( mpImpl->getTopWindowListeners().getLength() )
593 ::com::sun::star::lang::EventObject aEvent;
594 aEvent.Source = (::cppu::OWeakObject*)this;
595 mpImpl->getTopWindowListeners().windowClosing( aEvent );
598 break;
599 case VCLEVENT_CONTROL_GETFOCUS:
600 case VCLEVENT_WINDOW_GETFOCUS:
602 if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
603 && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS
605 || ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
606 && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS
610 if ( mpImpl->getFocusListeners().getLength() )
612 ::com::sun::star::awt::FocusEvent aEvent;
613 aEvent.Source = (::cppu::OWeakObject*)this;
614 aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
615 aEvent.Temporary = sal_False;
616 mpImpl->getFocusListeners().focusGained( aEvent );
620 break;
621 case VCLEVENT_CONTROL_LOSEFOCUS:
622 case VCLEVENT_WINDOW_LOSEFOCUS:
624 if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
625 && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS
627 || ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
628 && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS
632 if ( mpImpl->getFocusListeners().getLength() )
634 ::com::sun::star::awt::FocusEvent aEvent;
635 aEvent.Source = (::cppu::OWeakObject*)this;
636 aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
637 aEvent.Temporary = sal_False;
639 Window* pNext = Application::GetFocusWindow();
640 if ( pNext )
642 // Don't care about internals if this control is compound
643 Window* pNextC = pNext;
644 while ( pNextC && !pNextC->IsCompoundControl() )
645 pNextC = pNextC->GetParent();
646 if ( pNextC )
647 pNext = pNextC;
649 pNext->GetComponentInterface( sal_True );
650 aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer();
652 mpImpl->getFocusListeners().focusLost( aEvent );
656 break;
657 case VCLEVENT_WINDOW_MINIMIZE:
659 if ( mpImpl->getTopWindowListeners().getLength() )
661 ::com::sun::star::lang::EventObject aEvent;
662 aEvent.Source = (::cppu::OWeakObject*)this;
663 mpImpl->getTopWindowListeners().windowMinimized( aEvent );
666 break;
667 case VCLEVENT_WINDOW_NORMALIZE:
669 if ( mpImpl->getTopWindowListeners().getLength() )
671 ::com::sun::star::lang::EventObject aEvent;
672 aEvent.Source = (::cppu::OWeakObject*)this;
673 mpImpl->getTopWindowListeners().windowNormalized( aEvent );
676 break;
677 case VCLEVENT_WINDOW_KEYINPUT:
679 if ( mpImpl->getKeyListeners().getLength() )
681 ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
682 *(KeyEvent*)rVclWindowEvent.GetData(), *this
683 ) );
684 mpImpl->getKeyListeners().keyPressed( aEvent );
687 break;
688 case VCLEVENT_WINDOW_KEYUP:
690 if ( mpImpl->getKeyListeners().getLength() )
692 ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
693 *(KeyEvent*)rVclWindowEvent.GetData(), *this
694 ) );
695 mpImpl->getKeyListeners().keyReleased( aEvent );
698 break;
699 case VCLEVENT_WINDOW_COMMAND:
701 CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData();
702 if ( mpImpl->getMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) )
704 // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
705 Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel();
706 if ( !pCmdEvt->IsMouseEvent() )
707 { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
708 // handles a context menu command as special case of a mouse event, which is simply wrong.
709 // Without extending the API, we would not have another chance to notify listeners of a
710 // keyboard-triggered context menu request
711 aWhere = Point( -1, -1 );
714 MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
715 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) );
716 aEvent.PopupTrigger = sal_True;
718 Callback aCallback = ::boost::bind(
719 &MouseListenerMultiplexer::mousePressed,
720 &mpImpl->getMouseListeners(),
721 aEvent
723 ImplExecuteAsyncWithoutSolarLock( aCallback );
726 break;
727 case VCLEVENT_WINDOW_MOUSEMOVE:
729 MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData();
730 if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
732 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
734 Callback aCallback = ::boost::bind(
735 pMouseEvt->IsEnterWindow() ? &MouseListenerMultiplexer::mouseEntered : &MouseListenerMultiplexer::mouseExited,
736 &mpImpl->getMouseListeners(),
737 aEvent
739 ImplExecuteAsyncWithoutSolarLock( aCallback );
742 if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
744 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
745 aEvent.ClickCount = 0; // #92138#
746 if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE )
747 mpImpl->getMouseMotionListeners().mouseMoved( aEvent );
748 else
749 mpImpl->getMouseMotionListeners().mouseDragged( aEvent );
752 break;
753 case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
755 if ( mpImpl->getMouseListeners().getLength() )
757 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
758 Callback aCallback = ::boost::bind(
759 &MouseListenerMultiplexer::mousePressed,
760 &mpImpl->getMouseListeners(),
761 aEvent
763 ImplExecuteAsyncWithoutSolarLock( aCallback );
766 break;
767 case VCLEVENT_WINDOW_MOUSEBUTTONUP:
769 if ( mpImpl->getMouseListeners().getLength() )
771 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
772 Callback aCallback = ::boost::bind(
773 &MouseListenerMultiplexer::mouseReleased,
774 &mpImpl->getMouseListeners(),
775 aEvent
777 ImplExecuteAsyncWithoutSolarLock( aCallback );
780 break;
781 case VCLEVENT_WINDOW_STARTDOCKING:
783 if ( mpImpl->getDockableWindowListeners().getLength() )
785 DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
787 if( pData )
789 ::com::sun::star::awt::DockingEvent aEvent;
790 aEvent.Source = (::cppu::OWeakObject*)this;
791 aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
792 aEvent.MousePos.X = pData->maMousePos.X();
793 aEvent.MousePos.Y = pData->maMousePos.Y();
794 aEvent.bLiveMode = pData->mbLivemode;
795 aEvent.bInteractive = pData->mbInteractive;
797 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking, aEvent );
801 break;
802 case VCLEVENT_WINDOW_DOCKING:
804 if ( mpImpl->getDockableWindowListeners().getLength() )
806 DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
808 if( pData )
810 ::com::sun::star::awt::DockingEvent aEvent;
811 aEvent.Source = (::cppu::OWeakObject*)this;
812 aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
813 aEvent.MousePos.X = pData->maMousePos.X();
814 aEvent.MousePos.Y = pData->maMousePos.Y();
815 aEvent.bLiveMode = pData->mbLivemode;
816 aEvent.bInteractive = pData->mbInteractive;
818 Reference< XDockableWindowListener > xFirstListener;
819 ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() );
820 while ( aIter.hasMoreElements() && !xFirstListener.is() )
822 xFirstListener.set( aIter.next(), UNO_QUERY );
825 ::com::sun::star::awt::DockingData aDockingData =
826 xFirstListener->docking( aEvent );
827 pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle );
828 pData->mbFloating = aDockingData.bFloating;
832 break;
833 case VCLEVENT_WINDOW_ENDDOCKING:
835 if ( mpImpl->getDockableWindowListeners().getLength() )
837 EndDockingData *pData = (EndDockingData*)rVclWindowEvent.GetData();
839 if( pData )
841 ::com::sun::star::awt::EndDockingEvent aEvent;
842 aEvent.Source = (::cppu::OWeakObject*)this;
843 aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect );
844 aEvent.bFloating = pData->mbFloating;
845 aEvent.bCancelled = pData->mbCancelled;
846 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent );
850 break;
851 case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING:
853 if ( mpImpl->getDockableWindowListeners().getLength() )
855 sal_Bool *p_bFloating = (sal_Bool*)rVclWindowEvent.GetData();
857 ::com::sun::star::lang::EventObject aEvent;
858 aEvent.Source = (::cppu::OWeakObject*)this;
860 Reference< XDockableWindowListener > xFirstListener;
861 ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() );
862 while ( aIter.hasMoreElements() && !xFirstListener.is() )
864 xFirstListener.set( aIter.next(), UNO_QUERY );
867 *p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent );
870 break;
871 case VCLEVENT_WINDOW_TOGGLEFLOATING:
873 if ( mpImpl->getDockableWindowListeners().getLength() )
875 ::com::sun::star::lang::EventObject aEvent;
876 aEvent.Source = (::cppu::OWeakObject*)this;
877 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode, aEvent );
880 break;
881 case VCLEVENT_WINDOW_ENDPOPUPMODE:
883 if ( mpImpl->getDockableWindowListeners().getLength() )
885 EndPopupModeData *pData = (EndPopupModeData*)rVclWindowEvent.GetData();
887 if( pData )
889 ::com::sun::star::awt::EndPopupModeEvent aEvent;
890 aEvent.Source = (::cppu::OWeakObject*)this;
891 aEvent.FloatingPosition.X = pData->maFloatingPos.X();
892 aEvent.FloatingPosition.Y = pData->maFloatingPos.Y();
893 aEvent.bTearoff = pData->mbTearoff;
894 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode, aEvent );
898 break;
903 uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext()
905 SolarMutexGuard aGuard;
906 return getAccessibleFactory().createAccessibleContext( this );
909 void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b )
911 mpImpl->mbSynthesizingVCLEvent = _b;
914 sal_Bool VCLXWindow::IsSynthesizingVCLEvent() const
916 return mpImpl->mbSynthesizingVCLEvent;
919 Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const
921 Size aSz = rOutSz;
923 Window* pWindow = GetWindow();
924 if ( pWindow )
926 sal_Int32 nLeft, nTop, nRight, nBottom;
927 pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
928 aSz.Width() += nLeft+nRight;
929 aSz.Height() += nTop+nBottom;
931 return aSz;
935 // ::com::sun::star::lang::XUnoTunnel
936 IMPL_XUNOTUNNEL2( VCLXWindow, VCLXDevice )
938 // ::com::sun::star::lang::Component
939 void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException)
941 SolarMutexGuard aGuard;
943 mpImpl->mxViewGraphics = NULL;
945 if ( !mpImpl->mbDisposing )
947 mpImpl->mbDisposing = true;
949 mpImpl->disposing();
951 if ( GetWindow() )
953 OutputDevice* pOutDev = GetOutputDevice();
954 SetWindow( NULL ); // so that handlers are logged off, if necessary (virtual)
955 SetOutputDevice( pOutDev );
956 DestroyOutputDevice();
959 // #i14103# dispose the accessible context after the window has been destroyed,
960 // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
961 // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object
964 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY );
965 if ( xComponent.is() )
966 xComponent->dispose();
968 catch ( const ::com::sun::star::uno::Exception& )
970 OSL_FAIL( "VCLXWindow::dispose: could not dispose the accessible context!" );
972 mpImpl->mxAccessibleContext.clear();
974 mpImpl->mbDisposing = false;
978 void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
980 SolarMutexGuard aGuard;
982 mpImpl->getEventListeners().addInterface( rxListener );
985 void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
987 SolarMutexGuard aGuard;
989 mpImpl->getEventListeners().removeInterface( rxListener );
993 // ::com::sun::star::awt::XWindow
994 void VCLXWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException)
996 SolarMutexGuard aGuard;
998 if ( GetWindow() )
1000 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1001 Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X, Y, Width, Height, Flags );
1002 else
1003 GetWindow()->setPosSizePixel( X, Y, Width, Height, Flags );
1007 ::com::sun::star::awt::Rectangle VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException)
1009 SolarMutexGuard aGuard;
1011 ::com::sun::star::awt::Rectangle aBounds;
1012 if ( GetWindow() )
1014 if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
1015 aBounds = AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
1016 else
1017 aBounds = AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
1020 return aBounds;
1023 void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
1025 SolarMutexGuard aGuard;
1027 Window* pWindow = GetWindow();
1028 if ( pWindow )
1030 mpImpl->setDirectVisible( bVisible );
1031 pWindow->Show( bVisible && mpImpl->isEnableVisible() );
1035 void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
1037 SolarMutexGuard aGuard;
1039 Window* pWindow = GetWindow();
1040 if ( pWindow )
1042 pWindow->Enable( bEnable, sal_False ); // #95824# without children!
1043 pWindow->EnableInput( bEnable );
1047 void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException)
1049 SolarMutexGuard aGuard;
1051 if ( GetWindow() )
1052 GetWindow()->GrabFocus();
1055 void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1057 SolarMutexGuard aGuard;
1059 mpImpl->getWindowListeners().addInterface( rxListener );
1061 Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
1062 if ( xListener2.is() )
1063 mpImpl->getWindow2Listeners().addInterface( xListener2 );
1065 // #100119# Get all resize events, even if height or width 0, or invisible
1066 if ( GetWindow() )
1067 GetWindow()->EnableAllResize( sal_True );
1070 void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1072 SolarMutexGuard aGuard;
1074 Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
1075 if ( xListener2.is() )
1076 mpImpl->getWindow2Listeners().removeInterface( xListener2 );
1078 mpImpl->getWindowListeners().removeInterface( rxListener );
1081 void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1083 SolarMutexGuard aGuard;
1084 mpImpl->getFocusListeners().addInterface( rxListener );
1087 void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1089 SolarMutexGuard aGuard;
1090 mpImpl->getFocusListeners().removeInterface( rxListener );
1093 void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1095 SolarMutexGuard aGuard;
1096 mpImpl->getKeyListeners().addInterface( rxListener );
1099 void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1101 SolarMutexGuard aGuard;
1102 mpImpl->getKeyListeners().removeInterface( rxListener );
1105 void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1107 SolarMutexGuard aGuard;
1108 mpImpl->getMouseListeners().addInterface( rxListener );
1111 void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1113 SolarMutexGuard aGuard;
1114 mpImpl->getMouseListeners().removeInterface( rxListener );
1117 void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1119 SolarMutexGuard aGuard;
1120 mpImpl->getMouseMotionListeners().addInterface( rxListener );
1123 void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1125 SolarMutexGuard aGuard;
1126 mpImpl->getMouseMotionListeners().removeInterface( rxListener );
1129 void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1131 SolarMutexGuard aGuard;
1132 mpImpl->getPaintListeners().addInterface( rxListener );
1135 void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
1137 SolarMutexGuard aGuard;
1138 mpImpl->getPaintListeners().removeInterface( rxListener );
1141 // ::com::sun::star::awt::XWindowPeer
1142 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException)
1144 // no guard. nothing to guard here.
1145 // 82463 - 12/21/00 - fs
1146 return Application::GetVCLToolkit();
1149 void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& rxPointer ) throw(::com::sun::star::uno::RuntimeException)
1151 SolarMutexGuard aGuard;
1153 VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer );
1154 if ( pPointer )
1156 mpImpl->mxPointer = rxPointer;
1157 if ( GetWindow() )
1158 GetWindow()->SetPointer( pPointer->GetPointer() );
1162 void VCLXWindow::setBackground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
1164 SolarMutexGuard aGuard;
1166 if ( GetWindow() )
1168 Color aColor( (sal_uInt32)nColor );
1169 GetWindow()->SetBackground( aColor );
1170 GetWindow()->SetControlBackground( aColor );
1172 WindowType eWinType = GetWindow()->GetType();
1173 if ( ( eWinType == WINDOW_WINDOW ) ||
1174 ( eWinType == WINDOW_WORKWINDOW ) ||
1175 ( eWinType == WINDOW_FLOATINGWINDOW ) )
1177 GetWindow()->Invalidate();
1182 void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException)
1184 SolarMutexGuard aGuard;
1186 if ( GetWindow() )
1187 GetWindow()->Invalidate( (sal_uInt16) nInvalidateFlags );
1190 void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle& rRect, sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException)
1192 SolarMutexGuard aGuard;
1194 if ( GetWindow() )
1195 GetWindow()->Invalidate( VCLRectangle(rRect), (sal_uInt16) nInvalidateFlags );
1199 // ::com::sun::star::awt::XVclWindowPeer
1200 sal_Bool VCLXWindow::isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxPeer ) throw(::com::sun::star::uno::RuntimeException)
1202 SolarMutexGuard aGuard;
1204 sal_Bool bIsChild = sal_False;
1205 Window* pWindow = GetWindow();
1206 if ( pWindow )
1208 Window* pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
1209 bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow );
1212 return bIsChild;
1215 void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException)
1217 SolarMutexGuard aGuard;
1219 mpImpl->mbDesignMode = bOn;
1222 sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException)
1224 SolarMutexGuard aGuard;
1225 return mpImpl->mbDesignMode;
1228 void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException)
1230 SolarMutexGuard aGuard;
1232 if ( GetWindow() )
1233 GetWindow()->EnableClipSiblings( bClip );
1236 void VCLXWindow::setForeground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
1238 SolarMutexGuard aGuard;
1240 if ( GetWindow() )
1242 Color aColor( (sal_uInt32)nColor );
1243 GetWindow()->SetControlForeground( aColor );
1247 void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor& rFont ) throw(::com::sun::star::uno::RuntimeException)
1249 SolarMutexGuard aGuard;
1251 if ( GetWindow() )
1252 GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont, GetWindow()->GetControlFont() ) );
1255 void VCLXWindow::getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException)
1257 SolarMutexGuard aGuard;
1259 if ( GetWindow() )
1261 const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
1263 switch ( nType )
1265 case ::com::sun::star::awt::Style::FRAME:
1267 Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
1268 ForegroundColor = rStyleSettings.GetWindowTextColor().GetColor();
1269 BackgroundColor = rStyleSettings.GetWindowColor().GetColor();
1271 break;
1272 case ::com::sun::star::awt::Style::DIALOG:
1274 Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
1275 ForegroundColor = rStyleSettings.GetDialogTextColor().GetColor();
1276 BackgroundColor = rStyleSettings.GetDialogColor().GetColor();
1278 break;
1279 default: OSL_FAIL( "VCLWindow::getStyles() - unknown Type" );
1285 namespace toolkit
1287 static void setColorSettings( Window* _pWindow, const ::com::sun::star::uno::Any& _rValue,
1288 void (StyleSettings::*pSetter)( const Color& ), const Color& (StyleSettings::*pGetter)( ) const )
1290 sal_Int32 nColor = 0;
1291 if ( !( _rValue >>= nColor ) )
1292 nColor = (Application::GetSettings().GetStyleSettings().*pGetter)().GetColor();
1294 AllSettings aSettings = _pWindow->GetSettings();
1295 StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1297 (aStyleSettings.*pSetter)( Color( nColor ) );
1299 aSettings.SetStyleSettings( aStyleSettings );
1300 _pWindow->SetSettings( aSettings, sal_True );
1304 // Terminated by BASEPROPERTY_NOTFOUND (or 0)
1305 void VCLXWindow::PushPropertyIds( std::list< sal_uInt16 > &rIds,
1306 int nFirstId, ...)
1308 va_list pVarArgs;
1309 va_start( pVarArgs, nFirstId );
1311 for ( int nId = nFirstId; nId != BASEPROPERTY_NOTFOUND;
1312 nId = va_arg( pVarArgs, int ) )
1313 rIds.push_back( (sal_uInt16) nId );
1315 va_end( pVarArgs );
1318 void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDefaults )
1320 // These are common across ~all VCLXWindow derived classes
1321 if( bWithDefaults )
1322 PushPropertyIds( rIds,
1323 BASEPROPERTY_ALIGN,
1324 BASEPROPERTY_BACKGROUNDCOLOR,
1325 BASEPROPERTY_BORDER,
1326 BASEPROPERTY_BORDERCOLOR,
1327 BASEPROPERTY_DEFAULTCONTROL,
1328 BASEPROPERTY_ENABLED,
1329 BASEPROPERTY_FONTDESCRIPTOR,
1330 BASEPROPERTY_HELPTEXT,
1331 BASEPROPERTY_HELPURL,
1332 BASEPROPERTY_TEXT,
1333 BASEPROPERTY_PRINTABLE,
1334 BASEPROPERTY_ENABLEVISIBLE, // for visibility
1335 BASEPROPERTY_TABSTOP,
1338 // lovely hack from:
1339 // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
1340 std::list< sal_uInt16 >::const_iterator iter;
1341 for( iter = rIds.begin(); iter != rIds.end(); ++iter) {
1342 if( *iter == BASEPROPERTY_FONTDESCRIPTOR )
1344 // some properties are not included in the FontDescriptor, but everytime
1345 // when we have a FontDescriptor we want to have these properties too.
1346 // => Easier to register the here, istead everywhere where I register the FontDescriptor...
1348 rIds.push_back( BASEPROPERTY_TEXTCOLOR );
1349 rIds.push_back( BASEPROPERTY_TEXTLINECOLOR );
1350 rIds.push_back( BASEPROPERTY_FONTRELIEF );
1351 rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK );
1352 break;
1357 void VCLXWindow::GetPropertyIds( std::list< sal_uInt16 >& _out_rIds )
1359 return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps );
1362 ::cppu::OInterfaceContainerHelper& VCLXWindow::GetContainerListeners()
1364 return mpImpl->getContainerListeners();
1367 ::cppu::OInterfaceContainerHelper& VCLXWindow::GetTopWindowListeners()
1369 return mpImpl->getTopWindowListeners();
1372 namespace
1374 void lcl_updateWritingMode( Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode )
1376 sal_Bool bEnableRTL = sal_False;
1377 switch ( _nWritingMode )
1379 case WritingMode2::LR_TB: bEnableRTL = sal_False; break;
1380 case WritingMode2::RL_TB: bEnableRTL = sal_True; break;
1381 case WritingMode2::CONTEXT:
1383 // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use
1384 // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our
1385 // own window for its RTL mode
1386 switch ( _nContextWritingMode )
1388 case WritingMode2::LR_TB: bEnableRTL = sal_False; break;
1389 case WritingMode2::RL_TB: bEnableRTL = sal_True; break;
1390 case WritingMode2::CONTEXT:
1392 const Window* pParent = _rWindow.GetParent();
1393 OSL_ENSURE( pParent, "lcl_updateWritingMode: cannot determine context's writing mode!" );
1394 if ( pParent )
1395 bEnableRTL = pParent->IsRTLEnabled();
1397 break;
1400 break;
1401 default:
1402 OSL_FAIL( "lcl_updateWritingMode: unsupported WritingMode!" );
1403 } // switch ( nWritingMode )
1405 _rWindow.EnableRTL( bEnableRTL );
1409 void VCLXWindow::setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException)
1411 SolarMutexGuard aGuard;
1413 Window* pWindow = GetWindow();
1414 if ( !pWindow )
1415 return;
1417 sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
1419 WindowType eWinType = pWindow->GetType();
1420 sal_uInt16 nPropType = GetPropertyId( PropertyName );
1421 switch ( nPropType )
1423 case BASEPROPERTY_REFERENCE_DEVICE:
1425 Control* pControl = dynamic_cast< Control* >( pWindow );
1426 OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
1427 if ( !pControl )
1428 break;
1429 Reference< XDevice > xDevice( Value, UNO_QUERY );
1430 OutputDevice* pDevice = VCLUnoHelper::GetOutputDevice( xDevice );
1431 pControl->SetReferenceDevice( pDevice );
1433 break;
1435 case BASEPROPERTY_CONTEXT_WRITING_MODE:
1437 OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode );
1438 if ( mpImpl->mnWritingMode == WritingMode2::CONTEXT )
1439 lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
1441 break;
1443 case BASEPROPERTY_WRITING_MODE:
1445 sal_Bool bProperType = ( Value >>= mpImpl->mnWritingMode );
1446 OSL_ENSURE( bProperType, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" );
1447 if ( bProperType )
1448 lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
1450 break;
1452 case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:
1454 sal_uInt16 nWheelBehavior( MouseWheelBehavior::SCROLL_FOCUS_ONLY );
1455 OSL_VERIFY( Value >>= nWheelBehavior );
1457 AllSettings aSettings = pWindow->GetSettings();
1458 MouseSettings aMouseSettings = aSettings.GetMouseSettings();
1460 sal_uInt16 nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY );
1461 switch ( nWheelBehavior )
1463 case MouseWheelBehavior::SCROLL_DISABLED: nVclBehavior = MOUSE_WHEEL_DISABLE; break;
1464 case MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclBehavior = MOUSE_WHEEL_FOCUS_ONLY; break;
1465 case MouseWheelBehavior::SCROLL_ALWAYS: nVclBehavior = MOUSE_WHEEL_ALWAYS; break;
1466 default:
1467 OSL_FAIL( "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" );
1470 aMouseSettings.SetWheelBehavior( nVclBehavior );
1471 aSettings.SetMouseSettings( aMouseSettings );
1472 pWindow->SetSettings( aSettings, sal_True );
1474 break;
1476 case BASEPROPERTY_NATIVE_WIDGET_LOOK:
1478 sal_Bool bEnable( sal_True );
1479 OSL_VERIFY( Value >>= bEnable );
1480 pWindow->EnableNativeWidget( bEnable );
1482 break;
1484 case BASEPROPERTY_PLUGINPARENT:
1486 // set parent handle
1487 SetSystemParent_Impl( Value );
1489 break;
1491 case BASEPROPERTY_ENABLED:
1493 sal_Bool b = sal_Bool();
1494 if ( Value >>= b )
1495 setEnable( b );
1497 break;
1498 case BASEPROPERTY_ENABLEVISIBLE:
1500 sal_Bool b = sal_False;
1501 if ( Value >>= b )
1503 if( b != mpImpl->isEnableVisible() )
1505 mpImpl->setEnableVisible( b );
1506 pWindow->Show( b && mpImpl->isDirectVisible() );
1510 break;
1511 case BASEPROPERTY_TEXT:
1512 case BASEPROPERTY_LABEL:
1513 case BASEPROPERTY_TITLE:
1515 OUString aText;
1516 if ( Value >>= aText )
1518 switch (eWinType)
1520 case WINDOW_OKBUTTON:
1521 case WINDOW_CANCELBUTTON:
1522 case WINDOW_HELPBUTTON:
1523 // Standard Button: overwrite only if not empty.
1524 if (!aText.isEmpty())
1525 pWindow->SetText( aText );
1526 break;
1528 default:
1529 pWindow->SetText( aText );
1530 break;
1534 break;
1535 case BASEPROPERTY_ACCESSIBLENAME:
1537 OUString aText;
1538 if ( Value >>= aText )
1539 pWindow->SetAccessibleName( aText );
1541 break;
1542 case BASEPROPERTY_HELPURL:
1544 OUString aURL;
1545 if ( Value >>= aURL )
1547 INetURLObject aHelpURL( aURL );
1548 if ( aHelpURL.GetProtocol() == INET_PROT_HID )
1549 pWindow->SetHelpId( OUStringToOString( aHelpURL.GetURLPath(), RTL_TEXTENCODING_UTF8 ) );
1550 else
1551 pWindow->SetHelpId( OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ) );
1554 break;
1555 case BASEPROPERTY_HELPTEXT:
1557 OUString aHelpText;
1558 if ( Value >>= aHelpText )
1560 pWindow->SetQuickHelpText( aHelpText );
1563 break;
1564 case BASEPROPERTY_FONTDESCRIPTOR:
1566 if ( bVoid )
1567 pWindow->SetControlFont( Font() );
1568 else
1570 ::com::sun::star::awt::FontDescriptor aFont;
1571 if ( Value >>= aFont )
1572 pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) );
1575 break;
1576 case BASEPROPERTY_FONTRELIEF:
1578 sal_Int16 n = sal_Int16();
1579 if ( Value >>= n )
1581 Font aFont = pWindow->GetControlFont();
1582 aFont.SetRelief( (FontRelief)n );
1583 pWindow->SetControlFont( aFont );
1586 break;
1587 case BASEPROPERTY_FONTEMPHASISMARK:
1589 sal_Int16 n = sal_Int16();
1590 if ( Value >>= n )
1592 Font aFont = pWindow->GetControlFont();
1593 aFont.SetEmphasisMark( n );
1594 pWindow->SetControlFont( aFont );
1597 break;
1598 case BASEPROPERTY_BACKGROUNDCOLOR:
1599 if ( bVoid )
1601 switch ( eWinType )
1603 // set dialog color for default
1604 case WINDOW_DIALOG:
1605 case WINDOW_MESSBOX:
1606 case WINDOW_INFOBOX:
1607 case WINDOW_WARNINGBOX:
1608 case WINDOW_ERRORBOX:
1609 case WINDOW_QUERYBOX:
1610 case WINDOW_TABPAGE:
1612 Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor();
1613 pWindow->SetBackground( aColor );
1614 pWindow->SetControlBackground( aColor );
1615 break;
1618 case WINDOW_FIXEDTEXT:
1619 case WINDOW_CHECKBOX:
1620 case WINDOW_RADIOBUTTON:
1621 case WINDOW_GROUPBOX:
1622 case WINDOW_FIXEDLINE:
1624 // support transparency only for special controls
1625 pWindow->SetBackground();
1626 pWindow->SetControlBackground();
1627 pWindow->SetPaintTransparent( sal_True );
1628 break;
1631 default:
1633 // default code which enables transparency for
1634 // compound controls. It's not real transparency
1635 // as most of these controls repaint their client
1636 // area completely new.
1637 if ( pWindow->IsCompoundControl() )
1638 pWindow->SetBackground();
1639 pWindow->SetControlBackground();
1640 break;
1644 else
1646 sal_Int32 nColor = 0;
1647 if ( Value >>= nColor )
1649 Color aColor( nColor );
1650 pWindow->SetControlBackground( aColor );
1651 pWindow->SetBackground( aColor );
1652 switch ( eWinType )
1654 // reset paint transparent mode
1655 case WINDOW_FIXEDTEXT:
1656 case WINDOW_CHECKBOX:
1657 case WINDOW_RADIOBUTTON:
1658 case WINDOW_GROUPBOX:
1659 case WINDOW_FIXEDLINE:
1660 pWindow->SetPaintTransparent( sal_False );
1661 default: ;
1663 pWindow->Invalidate(); // Invalidate if control does not respond to it
1666 break;
1667 case BASEPROPERTY_TEXTCOLOR:
1668 if ( bVoid )
1670 pWindow->SetControlForeground();
1672 else
1674 sal_Int32 nColor = 0;
1675 if ( Value >>= nColor )
1677 Color aColor( nColor );
1678 pWindow->SetTextColor( aColor );
1679 pWindow->SetControlForeground( aColor );
1682 break;
1683 case BASEPROPERTY_TEXTLINECOLOR:
1684 if ( bVoid )
1686 pWindow->SetTextLineColor();
1688 else
1690 sal_Int32 nColor = 0;
1691 if ( Value >>= nColor )
1693 Color aColor( nColor );
1694 pWindow->SetTextLineColor( aColor );
1697 break;
1698 case BASEPROPERTY_FILLCOLOR:
1699 if ( bVoid )
1700 pWindow->SetFillColor();
1701 else
1703 sal_Int32 nColor = 0;
1704 if ( Value >>= nColor )
1706 Color aColor( nColor );
1707 pWindow->SetFillColor( aColor );
1710 break;
1711 case BASEPROPERTY_LINECOLOR:
1712 if ( bVoid )
1713 pWindow->SetLineColor();
1714 else
1716 sal_Int32 nColor = 0;
1717 if ( Value >>= nColor )
1719 Color aColor( nColor );
1720 pWindow->SetLineColor( aColor );
1723 break;
1724 case BASEPROPERTY_BORDER:
1726 WinBits nStyle = pWindow->GetStyle();
1727 sal_uInt16 nBorder = 0;
1728 Value >>= nBorder;
1729 if ( !nBorder )
1731 pWindow->SetStyle( nStyle & ~WB_BORDER );
1733 else
1735 pWindow->SetStyle( nStyle | WB_BORDER );
1736 pWindow->SetBorderStyle( nBorder );
1739 break;
1740 case BASEPROPERTY_TABSTOP:
1742 WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP;
1743 if ( !bVoid )
1745 sal_Bool bTab = false;
1746 Value >>= bTab;
1747 if ( bTab )
1748 nStyle |= WB_TABSTOP;
1749 else
1750 nStyle |= WB_NOTABSTOP;
1752 pWindow->SetStyle( nStyle );
1754 break;
1755 case BASEPROPERTY_VERTICALALIGN:
1757 VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE;
1758 WinBits nStyle = pWindow->GetStyle();
1759 nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM);
1760 if ( !bVoid )
1761 Value >>= eAlign;
1762 switch ( eAlign )
1764 case VerticalAlignment_TOP:
1765 nStyle |= WB_TOP;
1766 break;
1767 case VerticalAlignment_MIDDLE:
1768 nStyle |= WB_VCENTER;
1769 break;
1770 case VerticalAlignment_BOTTOM:
1771 nStyle |= WB_BOTTOM;
1772 break;
1773 default: ; // for warning free code, MAKE_FIXED_SIZE
1775 pWindow->SetStyle( nStyle );
1777 break;
1778 case BASEPROPERTY_ALIGN:
1780 sal_Int16 nAlign = PROPERTY_ALIGN_LEFT;
1781 switch ( eWinType )
1783 case WINDOW_COMBOBOX:
1784 case WINDOW_BUTTON:
1785 case WINDOW_PUSHBUTTON:
1786 case WINDOW_OKBUTTON:
1787 case WINDOW_CANCELBUTTON:
1788 case WINDOW_HELPBUTTON:
1789 nAlign = PROPERTY_ALIGN_CENTER;
1790 // no break here!
1791 case WINDOW_FIXEDTEXT:
1792 case WINDOW_EDIT:
1793 case WINDOW_MULTILINEEDIT:
1794 case WINDOW_CHECKBOX:
1795 case WINDOW_RADIOBUTTON:
1796 case WINDOW_LISTBOX:
1798 WinBits nStyle = pWindow->GetStyle();
1799 nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
1800 if ( !bVoid )
1801 Value >>= nAlign;
1802 if ( nAlign == PROPERTY_ALIGN_LEFT )
1803 nStyle |= WB_LEFT;
1804 else if ( nAlign == PROPERTY_ALIGN_CENTER )
1805 nStyle |= WB_CENTER;
1806 else
1807 nStyle |= WB_RIGHT;
1808 pWindow->SetStyle( nStyle );
1810 break;
1813 break;
1814 case BASEPROPERTY_MULTILINE:
1816 if ( ( eWinType == WINDOW_FIXEDTEXT )
1817 || ( eWinType == WINDOW_CHECKBOX )
1818 || ( eWinType == WINDOW_RADIOBUTTON )
1819 || ( eWinType == WINDOW_BUTTON )
1820 || ( eWinType == WINDOW_PUSHBUTTON )
1821 || ( eWinType == WINDOW_OKBUTTON )
1822 || ( eWinType == WINDOW_CANCELBUTTON )
1823 || ( eWinType == WINDOW_HELPBUTTON )
1826 WinBits nStyle = pWindow->GetStyle();
1827 sal_Bool bMulti = false;
1828 Value >>= bMulti;
1829 if ( bMulti )
1830 nStyle |= WB_WORDBREAK;
1831 else
1832 nStyle &= ~WB_WORDBREAK;
1833 pWindow->SetStyle( nStyle );
1836 break;
1837 case BASEPROPERTY_ORIENTATION:
1839 switch ( eWinType )
1841 case WINDOW_FIXEDLINE:
1843 sal_Int32 nOrientation = 0;
1844 if ( Value >>= nOrientation )
1846 WinBits nStyle = pWindow->GetStyle();
1847 nStyle &= ~(WB_HORZ|WB_VERT);
1848 if ( nOrientation == 0 )
1849 nStyle |= WB_HORZ;
1850 else
1851 nStyle |= WB_VERT;
1853 pWindow->SetStyle( nStyle );
1856 break;
1859 break;
1860 case BASEPROPERTY_AUTOMNEMONICS:
1862 sal_Bool bAutoMnemonics = false;
1863 Value >>= bAutoMnemonics;
1864 AllSettings aSettings = pWindow->GetSettings();
1865 StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1866 if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics )
1868 aStyleSettings.SetAutoMnemonic( bAutoMnemonics );
1869 aSettings.SetStyleSettings( aStyleSettings );
1870 pWindow->SetSettings( aSettings );
1873 break;
1874 case BASEPROPERTY_MOUSETRANSPARENT:
1876 sal_Bool bMouseTransparent = false;
1877 Value >>= bMouseTransparent;
1878 pWindow->SetMouseTransparent( bMouseTransparent );
1880 break;
1881 case BASEPROPERTY_PAINTTRANSPARENT:
1883 sal_Bool bPaintTransparent = false;
1884 Value >>= bPaintTransparent;
1885 pWindow->SetPaintTransparent( bPaintTransparent );
1886 // pWindow->SetBackground();
1888 break;
1890 case BASEPROPERTY_REPEAT:
1892 sal_Bool bRepeat( sal_False );
1893 Value >>= bRepeat;
1895 WinBits nStyle = pWindow->GetStyle();
1896 if ( bRepeat )
1897 nStyle |= WB_REPEAT;
1898 else
1899 nStyle &= ~WB_REPEAT;
1900 pWindow->SetStyle( nStyle );
1902 break;
1904 case BASEPROPERTY_REPEAT_DELAY:
1906 sal_Int32 nRepeatDelay = 0;
1907 if ( Value >>= nRepeatDelay )
1909 AllSettings aSettings = pWindow->GetSettings();
1910 MouseSettings aMouseSettings = aSettings.GetMouseSettings();
1912 aMouseSettings.SetButtonRepeat( nRepeatDelay );
1913 aSettings.SetMouseSettings( aMouseSettings );
1915 pWindow->SetSettings( aSettings, sal_True );
1918 break;
1920 case BASEPROPERTY_SYMBOL_COLOR:
1921 ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor );
1922 break;
1924 case BASEPROPERTY_BORDERCOLOR:
1925 ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor);
1926 break;
1927 case BASEPROPERTY_DEFAULTCONTROL:
1929 OUString aName;
1930 Value >>= aName;
1931 break;
1936 ::com::sun::star::uno::Any VCLXWindow::getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1938 SolarMutexGuard aGuard;
1940 ::com::sun::star::uno::Any aProp;
1941 if ( GetWindow() )
1943 WindowType eWinType = GetWindow()->GetType();
1944 sal_uInt16 nPropType = GetPropertyId( PropertyName );
1945 switch ( nPropType )
1947 case BASEPROPERTY_REFERENCE_DEVICE:
1949 Control* pControl = dynamic_cast< Control* >( GetWindow() );
1950 OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
1951 if ( !pControl )
1952 break;
1954 VCLXDevice* pDevice = new VCLXDevice;
1955 pDevice->SetOutputDevice( pControl->GetReferenceDevice() );
1956 aProp <<= Reference< XDevice >( pDevice );
1958 break;
1960 case BASEPROPERTY_CONTEXT_WRITING_MODE:
1961 aProp <<= mpImpl->mnContextWritingMode;
1962 break;
1964 case BASEPROPERTY_WRITING_MODE:
1965 aProp <<= mpImpl->mnWritingMode;
1966 break;
1968 case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:
1970 sal_uInt16 nVclBehavior = GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior();
1971 sal_Int16 nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY;
1972 switch ( nVclBehavior )
1974 case MOUSE_WHEEL_DISABLE: nBehavior = MouseWheelBehavior::SCROLL_DISABLED; break;
1975 case MOUSE_WHEEL_FOCUS_ONLY: nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; break;
1976 case MOUSE_WHEEL_ALWAYS: nBehavior = MouseWheelBehavior::SCROLL_ALWAYS; break;
1977 default:
1978 OSL_FAIL( "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" );
1980 aProp <<= nBehavior;
1982 break;
1984 case BASEPROPERTY_NATIVE_WIDGET_LOOK:
1985 aProp <<= (sal_Bool) GetWindow()->IsNativeWidgetEnabled();
1986 break;
1988 case BASEPROPERTY_ENABLED:
1989 aProp <<= (sal_Bool) GetWindow()->IsEnabled();
1990 break;
1992 case BASEPROPERTY_ENABLEVISIBLE:
1993 aProp <<= (sal_Bool) mpImpl->isEnableVisible();
1994 break;
1996 case BASEPROPERTY_HIGHCONTRASTMODE:
1997 aProp <<= (sal_Bool) GetWindow()->GetSettings().GetStyleSettings().GetHighContrastMode();
1998 break;
2000 case BASEPROPERTY_TEXT:
2001 case BASEPROPERTY_LABEL:
2002 case BASEPROPERTY_TITLE:
2004 OUString aText = GetWindow()->GetText();
2005 aProp <<= aText;
2007 break;
2008 case BASEPROPERTY_ACCESSIBLENAME:
2010 OUString aText = GetWindow()->GetAccessibleName();
2011 aProp <<= aText;
2013 break;
2014 case BASEPROPERTY_HELPTEXT:
2016 OUString aText = GetWindow()->GetQuickHelpText();
2017 aProp <<= aText;
2019 break;
2020 case BASEPROPERTY_HELPURL:
2022 OUString aHelpId( OStringToOUString( GetWindow()->GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
2023 aProp <<= OUString( aHelpId );
2025 break;
2026 case BASEPROPERTY_FONTDESCRIPTOR:
2028 Font aFont = GetWindow()->GetControlFont();
2029 ::com::sun::star::awt::FontDescriptor aFD = VCLUnoHelper::CreateFontDescriptor( aFont );
2030 aProp <<= aFD;
2032 break;
2033 case BASEPROPERTY_BACKGROUNDCOLOR:
2034 aProp <<= (sal_Int32) GetWindow()->GetControlBackground().GetColor();
2035 break;
2036 case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR:
2037 aProp <<= (sal_Int32) GetWindow()->GetDisplayBackground().GetColor().GetColor();
2038 break;
2039 case BASEPROPERTY_FONTRELIEF:
2040 aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetRelief();
2041 break;
2042 case BASEPROPERTY_FONTEMPHASISMARK:
2043 aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetEmphasisMark();
2044 break;
2045 case BASEPROPERTY_TEXTCOLOR:
2046 aProp <<= (sal_Int32) GetWindow()->GetControlForeground().GetColor();
2047 break;
2048 case BASEPROPERTY_TEXTLINECOLOR:
2049 aProp <<= (sal_Int32) GetWindow()->GetTextLineColor().GetColor();
2050 break;
2051 case BASEPROPERTY_FILLCOLOR:
2052 aProp <<= (sal_Int32) GetWindow()->GetFillColor().GetColor();
2053 break;
2054 case BASEPROPERTY_LINECOLOR:
2055 aProp <<= (sal_Int32) GetWindow()->GetLineColor().GetColor();
2056 break;
2057 case BASEPROPERTY_BORDER:
2059 sal_Int16 nBorder = 0;
2060 if ( GetWindow()->GetStyle() & WB_BORDER )
2061 nBorder = GetWindow()->GetBorderStyle();
2062 aProp <<= nBorder;
2064 break;
2065 case BASEPROPERTY_TABSTOP:
2066 aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_TABSTOP ) ? sal_True : sal_False;
2067 break;
2068 case BASEPROPERTY_VERTICALALIGN:
2070 WinBits nStyle = GetWindow()->GetStyle();
2071 if ( nStyle & WB_TOP )
2072 aProp <<= VerticalAlignment_TOP;
2073 else if ( nStyle & WB_VCENTER )
2074 aProp <<= VerticalAlignment_MIDDLE;
2075 else if ( nStyle & WB_BOTTOM )
2076 aProp <<= VerticalAlignment_BOTTOM;
2078 break;
2079 case BASEPROPERTY_ALIGN:
2081 switch ( eWinType )
2083 case WINDOW_FIXEDTEXT:
2084 case WINDOW_EDIT:
2085 case WINDOW_MULTILINEEDIT:
2086 case WINDOW_CHECKBOX:
2087 case WINDOW_RADIOBUTTON:
2088 case WINDOW_LISTBOX:
2089 case WINDOW_COMBOBOX:
2090 case WINDOW_BUTTON:
2091 case WINDOW_PUSHBUTTON:
2092 case WINDOW_OKBUTTON:
2093 case WINDOW_CANCELBUTTON:
2094 case WINDOW_HELPBUTTON:
2096 WinBits nStyle = GetWindow()->GetStyle();
2097 if ( nStyle & WB_LEFT )
2098 aProp <<= (sal_Int16) PROPERTY_ALIGN_LEFT;
2099 else if ( nStyle & WB_CENTER )
2100 aProp <<= (sal_Int16) PROPERTY_ALIGN_CENTER;
2101 else if ( nStyle & WB_RIGHT )
2102 aProp <<= (sal_Int16) PROPERTY_ALIGN_RIGHT;
2104 break;
2107 case BASEPROPERTY_MULTILINE:
2109 if ( ( eWinType == WINDOW_FIXEDTEXT )
2110 || ( eWinType == WINDOW_CHECKBOX )
2111 || ( eWinType == WINDOW_RADIOBUTTON )
2112 || ( eWinType == WINDOW_BUTTON )
2113 || ( eWinType == WINDOW_PUSHBUTTON )
2114 || ( eWinType == WINDOW_OKBUTTON )
2115 || ( eWinType == WINDOW_CANCELBUTTON )
2116 || ( eWinType == WINDOW_HELPBUTTON )
2118 aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_WORDBREAK ) ? sal_True : sal_False;
2120 break;
2121 case BASEPROPERTY_AUTOMNEMONICS:
2123 sal_Bool bAutoMnemonics = GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
2124 aProp <<= bAutoMnemonics;
2126 break;
2127 case BASEPROPERTY_MOUSETRANSPARENT:
2129 sal_Bool bMouseTransparent = GetWindow()->IsMouseTransparent();
2130 aProp <<= bMouseTransparent;
2132 break;
2133 case BASEPROPERTY_PAINTTRANSPARENT:
2135 sal_Bool bPaintTransparent = GetWindow()->IsPaintTransparent();
2136 aProp <<= bPaintTransparent;
2138 break;
2140 case BASEPROPERTY_REPEAT:
2141 aProp <<= (sal_Bool)( 0 != ( GetWindow()->GetStyle() & WB_REPEAT ) );
2142 break;
2144 case BASEPROPERTY_REPEAT_DELAY:
2146 sal_Int32 nButtonRepeat = GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
2147 aProp <<= (sal_Int32)nButtonRepeat;
2149 break;
2151 case BASEPROPERTY_SYMBOL_COLOR:
2152 aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
2153 break;
2155 case BASEPROPERTY_BORDERCOLOR:
2156 aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor();
2157 break;
2160 return aProp;
2164 // ::com::sun::star::awt::XLayoutConstrains
2165 ::com::sun::star::awt::Size VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
2167 SolarMutexGuard aGuard;
2169 // Use this method only for those components which can be created through
2170 // ::com::sun::star::awt::Toolkit , but do not have an interface
2172 Size aSz;
2173 if ( GetWindow() )
2175 WindowType nWinType = GetWindow()->GetType();
2176 switch ( nWinType )
2178 case WINDOW_CONTROL:
2179 aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
2180 aSz.Height() = GetWindow()->GetTextHeight()+2*6;
2181 break;
2183 case WINDOW_PATTERNBOX:
2184 case WINDOW_NUMERICBOX:
2185 case WINDOW_METRICBOX:
2186 case WINDOW_CURRENCYBOX:
2187 case WINDOW_DATEBOX:
2188 case WINDOW_TIMEBOX:
2189 case WINDOW_LONGCURRENCYBOX:
2190 aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
2191 aSz.Height() = GetWindow()->GetTextHeight()+2*2;
2192 break;
2193 case WINDOW_SCROLLBARBOX:
2194 return VCLXScrollBar::implGetMinimumSize( GetWindow() );
2195 default:
2196 aSz = GetWindow()->GetOptimalSize();
2200 return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
2203 ::com::sun::star::awt::Size VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
2205 return getMinimumSize();
2208 ::com::sun::star::awt::Size VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
2210 SolarMutexGuard aGuard;
2212 ::com::sun::star::awt::Size aNewSize( rNewSize );
2213 ::com::sun::star::awt::Size aMinSize = getMinimumSize();
2215 if ( aNewSize.Width < aMinSize.Width )
2216 aNewSize.Width = aMinSize.Width;
2217 if ( aNewSize.Height < aMinSize.Height )
2218 aNewSize.Height = aMinSize.Height;
2220 return aNewSize;
2224 // ::com::sun::star::awt::XView
2225 sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rxDevice ) throw(::com::sun::star::uno::RuntimeException)
2227 SolarMutexGuard aGuard;
2229 if ( VCLUnoHelper::GetOutputDevice( rxDevice ) )
2230 mpImpl->mxViewGraphics = rxDevice;
2231 else
2232 mpImpl->mxViewGraphics = NULL;
2234 return mpImpl->mxViewGraphics.is();
2237 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException)
2239 SolarMutexGuard aGuard;
2241 return mpImpl->mxViewGraphics;
2244 ::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException)
2246 SolarMutexGuard aGuard;
2248 Size aSz;
2249 if ( GetWindow() )
2250 aSz = GetWindow()->GetSizePixel();
2251 return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
2254 void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
2256 SolarMutexGuard aGuard;
2258 Window* pWindow = GetWindow();
2259 if ( !pWindow )
2260 return;
2262 if ( isDesignMode() || mpImpl->isEnableVisible() )
2264 TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow );
2265 if ( pTabPage )
2267 Point aPos( nX, nY );
2268 Size aSize = pWindow->GetSizePixel();
2270 OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
2271 aPos = pDev->PixelToLogic( aPos );
2272 aSize = pDev->PixelToLogic( aSize );
2274 pTabPage->Draw( pDev, aPos, aSize, 0 );
2275 return;
2278 OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
2279 Point aPos( nX, nY );
2281 if ( !pDev )
2282 pDev = pWindow->GetParent();
2284 if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) )
2286 // #i40647# don't draw here if this is a recursive call
2287 // sometimes this is called recursively, because the Update call on the parent
2288 // (strangely) triggers another paint. Prevent a stack overflow here
2289 // Yes, this is only fixing symptoms for the moment ....
2290 // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
2291 if ( !mpImpl->getDrawingOntoParent_ref() )
2293 ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
2295 sal_Bool bWasVisible = pWindow->IsVisible();
2296 Point aOldPos( pWindow->GetPosPixel() );
2298 if ( bWasVisible && aOldPos == aPos )
2300 pWindow->Update();
2301 return;
2304 pWindow->SetPosPixel( aPos );
2306 // Update parent first to avoid painting the parent upon the update
2307 // of this window, as it may otherwise cause the parent
2308 // to hide this window again
2309 if( pWindow->GetParent() )
2310 pWindow->GetParent()->Update();
2312 pWindow->Show();
2313 pWindow->Update();
2314 pWindow->SetParentUpdateMode( sal_False );
2315 pWindow->Hide();
2316 pWindow->SetParentUpdateMode( sal_True );
2318 pWindow->SetPosPixel( aOldPos );
2319 if ( bWasVisible )
2320 pWindow->Show( sal_True );
2323 else if ( pDev )
2325 Size aSz = pWindow->GetSizePixel();
2326 aSz = pDev->PixelToLogic( aSz );
2327 Point aP = pDev->PixelToLogic( aPos );
2329 vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
2330 bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER )
2331 || ( pDev->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW )
2332 || ( pPDFExport != NULL );
2333 if ( bDrawSimple )
2335 pWindow->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS );
2337 else
2339 sal_Bool bOldNW =pWindow->IsNativeWidgetEnabled();
2340 if( bOldNW )
2341 pWindow->EnableNativeWidget(sal_False);
2342 pWindow->PaintToDevice( pDev, aP, aSz );
2343 if( bOldNW )
2344 pWindow->EnableNativeWidget(sal_True);
2350 void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException)
2352 SolarMutexGuard aGuard;
2354 if ( GetWindow() )
2356 // Fraction::Fraction takes a double, but we have a float only.
2357 // The implicit conversion from float to double can result in a precision loss, i.e. 1.2 is converted to
2358 // 1.200000000047something. To prevent this, we convert explicitly to double, and round it.
2359 double nZoom( fZoomX );
2360 nZoom = ::rtl::math::round( nZoom, 4 );
2361 GetWindow()->SetZoom( Fraction( nZoom ) );
2365 // ::com::sun::star::lang::XEventListener
2366 void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException)
2368 SolarMutexGuard aGuard;
2370 // check if it comes from our AccessibleContext
2371 uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
2372 uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY );
2374 if ( aAC.get() == xSource.get() )
2375 { // yep, it does
2376 mpImpl->mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >();
2380 // ::com::sun::star::accessibility::XAccessible
2381 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXWindow::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException)
2383 using namespace ::com::sun::star;
2385 SolarMutexGuard aGuard;
2387 // already disposed
2388 if( ! mpImpl )
2389 return uno::Reference< accessibility::XAccessibleContext >();
2391 if ( !mpImpl->mxAccessibleContext.is() && GetWindow() )
2393 mpImpl->mxAccessibleContext = CreateAccessibleContext();
2395 // add as event listener to this component
2396 // in case somebody disposes it, we do not want to have a (though weak) reference to a dead
2397 // object
2398 uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
2399 if ( xComp.is() )
2400 xComp->addEventListener( this );
2403 return mpImpl->mxAccessibleContext;
2406 // ::com::sun::star::awt::XDockable
2407 void SAL_CALL VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
2409 SolarMutexGuard aGuard;
2411 if ( xListener.is() )
2412 mpImpl->getDockableWindowListeners().addInterface( xListener );
2416 void SAL_CALL VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
2418 SolarMutexGuard aGuard;
2420 mpImpl->getDockableWindowListeners().removeInterface( xListener );
2423 void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException)
2425 SolarMutexGuard aGuard;
2427 Window* pWindow = GetWindow();
2428 if ( pWindow )
2429 pWindow->EnableDocking( bEnable );
2432 sal_Bool SAL_CALL VCLXWindow::isFloating( ) throw (::com::sun::star::uno::RuntimeException)
2434 SolarMutexGuard aGuard;
2436 Window* pWindow = GetWindow();
2437 if( pWindow )
2438 return Window::GetDockingManager()->IsFloating( pWindow );
2439 else
2440 return sal_False;
2443 void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException)
2445 SolarMutexGuard aGuard;
2447 Window* pWindow = GetWindow();
2448 if( pWindow )
2449 Window::GetDockingManager()->SetFloatingMode( pWindow, bFloating );
2452 sal_Bool SAL_CALL VCLXWindow::isLocked( ) throw (::com::sun::star::uno::RuntimeException)
2454 SolarMutexGuard aGuard;
2456 Window* pWindow = GetWindow();
2457 if( pWindow )
2458 return Window::GetDockingManager()->IsLocked( pWindow );
2459 else
2460 return sal_False;
2463 void SAL_CALL VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException)
2465 SolarMutexGuard aGuard;
2467 Window* pWindow = GetWindow();
2468 if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
2469 Window::GetDockingManager()->Lock( pWindow );
2472 void SAL_CALL VCLXWindow::unlock( ) throw (::com::sun::star::uno::RuntimeException)
2474 SolarMutexGuard aGuard;
2476 Window* pWindow = GetWindow();
2477 if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
2478 Window::GetDockingManager()->Unlock( pWindow );
2480 void SAL_CALL VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle& ) throw (::com::sun::star::uno::RuntimeException)
2482 // TODO: remove interface in the next incompatible build
2483 SolarMutexGuard aGuard;
2487 sal_Bool SAL_CALL VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException)
2489 // TODO: remove interface in the next incompatible build
2490 SolarMutexGuard aGuard;
2491 return sal_False;
2495 // ::com::sun::star::awt::XWindow2
2497 void SAL_CALL VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException)
2499 SolarMutexGuard aGuard;
2500 Window *pWindow;
2501 if( (pWindow = GetWindow()) != NULL )
2503 DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
2504 if( pDockingWindow )
2505 pDockingWindow->SetOutputSizePixel( VCLSize( aSize ) );
2506 else
2507 pWindow->SetOutputSizePixel( VCLSize( aSize ) );
2511 ::com::sun::star::awt::Size SAL_CALL VCLXWindow::getOutputSize( ) throw (::com::sun::star::uno::RuntimeException)
2513 SolarMutexGuard aGuard;
2514 Window *pWindow;
2515 if( (pWindow = GetWindow()) != NULL )
2517 DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
2518 if( pDockingWindow )
2519 return AWTSize( pDockingWindow->GetOutputSizePixel() );
2520 else
2521 return AWTSize( pWindow->GetOutputSizePixel() );
2523 else
2524 return ::com::sun::star::awt::Size();
2527 sal_Bool SAL_CALL VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException)
2529 SolarMutexGuard aGuard;
2530 if( GetWindow() )
2531 return GetWindow()->IsVisible();
2532 else
2533 return sal_False;
2536 sal_Bool SAL_CALL VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException)
2538 SolarMutexGuard aGuard;
2539 if( GetWindow() )
2540 return GetWindow()->IsActive();
2541 else
2542 return sal_False;
2546 sal_Bool SAL_CALL VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException)
2548 SolarMutexGuard aGuard;
2549 if( GetWindow() )
2550 return GetWindow()->IsEnabled();
2551 else
2552 return sal_False;
2555 sal_Bool SAL_CALL VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException)
2557 SolarMutexGuard aGuard;
2558 if( GetWindow() )
2559 return GetWindow()->HasFocus();
2560 else
2561 return sal_False;
2564 // ::com::sun::star::beans::XPropertySetInfo
2566 UnoPropertyArrayHelper *
2567 VCLXWindow::GetPropHelper()
2569 SolarMutexGuard aGuard;
2570 if ( mpImpl->mpPropHelper == NULL )
2572 std::list< sal_uInt16 > aIDs;
2573 GetPropertyIds( aIDs );
2574 mpImpl->mpPropHelper = new UnoPropertyArrayHelper( aIDs );
2576 return mpImpl->mpPropHelper;
2579 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
2580 VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException)
2582 return GetPropHelper()->getProperties();
2584 ::com::sun::star::beans::Property SAL_CALL
2585 VCLXWindow::getPropertyByName( const OUString& rName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
2587 return GetPropHelper()->getPropertyByName( rName );
2590 ::sal_Bool SAL_CALL
2591 VCLXWindow::hasPropertyByName( const OUString& rName ) throw (::com::sun::star::uno::RuntimeException)
2593 return GetPropHelper()->hasPropertyByName( rName );
2596 Reference< XStyleSettings > SAL_CALL VCLXWindow::getStyleSettings() throw (RuntimeException)
2598 return mpImpl->getStyleSettings();
2601 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */