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