Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
21 : #define _TOOLKIT_AWT_VCLXWINDOW_HXX_
22 :
23 : #include <toolkit/dllapi.h>
24 : #include <toolkit/awt/vclxdevice.hxx>
25 : #include <toolkit/helper/listenermultiplexer.hxx>
26 :
27 : #include <com/sun/star/awt/XWindow2.hpp>
28 : #include <com/sun/star/awt/XVclWindowPeer.hpp>
29 : #include <com/sun/star/awt/XLayoutConstrains.hpp>
30 : #include <com/sun/star/awt/XView.hpp>
31 : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
32 : #include <com/sun/star/beans/XPropertySetInfo.hpp>
33 : #include <com/sun/star/accessibility/XAccessible.hpp>
34 : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
35 : #include <com/sun/star/awt/XDockableWindow.hpp>
36 : #include <com/sun/star/awt/XStyleSettingsSupplier.hpp>
37 :
38 : #include <cppuhelper/weak.hxx>
39 : #include <cppuhelper/implbase9.hxx>
40 : #include <osl/mutex.hxx>
41 :
42 : #include <tools/gen.hxx> // Size
43 : #include <tools/link.hxx>
44 :
45 : #include <stdarg.h>
46 : #include <list>
47 : #include <boost/function.hpp>
48 :
49 : class Window;
50 : class VclSimpleEvent;
51 : class VclWindowEvent;
52 : struct SystemParentData;
53 :
54 : namespace toolkit
55 : {
56 : class IAccessibleFactory;
57 : }
58 :
59 :
60 : // ----------------------------------------------------
61 : // class VCLXWINDOW
62 : // ----------------------------------------------------
63 :
64 : class UnoPropertyArrayHelper;
65 : class VCLXWindowImpl;
66 : typedef ::cppu::ImplInheritanceHelper9 < VCLXDevice
67 : , ::com::sun::star::awt::XWindow2
68 : , ::com::sun::star::awt::XVclWindowPeer
69 : , ::com::sun::star::awt::XLayoutConstrains
70 : , ::com::sun::star::awt::XView
71 : , ::com::sun::star::awt::XDockableWindow
72 : , ::com::sun::star::accessibility::XAccessible
73 : , ::com::sun::star::lang::XEventListener
74 : , ::com::sun::star::beans::XPropertySetInfo
75 : , ::com::sun::star::awt::XStyleSettingsSupplier
76 : > VCLXWindow_Base;
77 :
78 : class TOOLKIT_DLLPUBLIC VCLXWindow : public VCLXWindow_Base
79 : {
80 : private:
81 : VCLXWindowImpl* mpImpl;
82 :
83 : UnoPropertyArrayHelper *GetPropHelper();
84 :
85 : protected:
86 : Size ImplCalcWindowSize( const Size& rOutSz ) const;
87 : DECL_LINK( WindowEventListener, VclSimpleEvent* );
88 :
89 : virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
90 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
91 : CreateAccessibleContext();
92 :
93 : void SetSynthesizingVCLEvent( sal_Bool b );
94 : sal_Bool IsSynthesizingVCLEvent() const;
95 :
96 : void SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle );
97 :
98 : ::toolkit::IAccessibleFactory& getAccessibleFactory();
99 :
100 : // helper ...
101 : static void PushPropertyIds( std::list< sal_uInt16 > &aIds, int nFirstId, ...);
102 : // for use in controls/
103 : static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds,
104 : bool bWithDefaults = false );
105 : virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds );
106 :
107 : ::cppu::OInterfaceContainerHelper& GetContainerListeners();
108 : ::cppu::OInterfaceContainerHelper& GetTopWindowListeners();
109 :
110 : public:
111 : typedef ::boost::function0< void > Callback;
112 :
113 : protected:
114 : /** executes the given callback asynchronously
115 :
116 : At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that
117 : you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e.
118 : having a ref count > 0).
119 :
120 : As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers
121 : care for the disposed state themself, and are alive as long as |this| is alive.
122 : */
123 : void ImplExecuteAsyncWithoutSolarLock(
124 : const Callback& i_callback
125 : );
126 :
127 : public:
128 : VCLXWindow( bool bWithDefaultProps = false );
129 : ~VCLXWindow();
130 :
131 : virtual void SetWindow( Window* pWindow );
132 127608 : Window* GetWindow() const { return (Window*)GetOutputDevice(); }
133 :
134 : void suspendVclEventListening( );
135 : void resumeVclEventListening( );
136 :
137 : void notifyWindowRemoved( Window& _rWindow );
138 :
139 : // ::com::sun::star::lang::XUnoTunnel
140 : static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
141 : static VCLXWindow* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
142 : sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
143 :
144 : // ::com::sun::star::lang::XEventListener
145 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
146 :
147 : // ::com::sun::star::lang::XComponent
148 : void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
149 : void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
150 : void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
151 :
152 : // ::com::sun::star::awt::XWindow
153 : void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
154 : ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw(::com::sun::star::uno::RuntimeException);
155 : void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
156 : void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException);
157 : void SAL_CALL setFocus( ) throw(::com::sun::star::uno::RuntimeException);
158 : void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
159 : void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
160 : void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
161 : void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
162 : void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
163 : void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
164 : void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
165 : void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
166 : void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
167 : void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
168 : void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
169 : void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
170 :
171 : // ::com::sun::star::awt::XWindowPeer
172 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > SAL_CALL getToolkit( ) throw(::com::sun::star::uno::RuntimeException);
173 : void SAL_CALL setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& Pointer ) throw(::com::sun::star::uno::RuntimeException);
174 : void SAL_CALL setBackground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException);
175 : void SAL_CALL invalidate( sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
176 : void SAL_CALL invalidateRect( const ::com::sun::star::awt::Rectangle& Rect, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
177 :
178 : // ::com::sun::star::awt::XVclWindowPeer
179 : sal_Bool SAL_CALL isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Peer ) throw(::com::sun::star::uno::RuntimeException);
180 : void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
181 : sal_Bool SAL_CALL isDesignMode( ) throw(::com::sun::star::uno::RuntimeException);
182 : void SAL_CALL enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException);
183 : void SAL_CALL setForeground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException);
184 : void SAL_CALL setControlFont( const ::com::sun::star::awt::FontDescriptor& aFont ) throw(::com::sun::star::uno::RuntimeException);
185 : void SAL_CALL getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException);
186 : void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
187 : ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
188 :
189 : // ::com::sun::star::awt::XLayoutConstrains
190 : ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
191 : ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
192 : ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
193 :
194 : // ::com::sun::star::awt::XView
195 : sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException);
196 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics( ) throw(::com::sun::star::uno::RuntimeException);
197 : ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException);
198 : void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
199 : void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException);
200 :
201 : // ::com::sun::star::accessibility::XAccessible
202 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
203 :
204 : // ::com::sun::star::awt::XDockableWindow
205 : void SAL_CALL addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
206 : void SAL_CALL removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
207 : void SAL_CALL enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException);
208 : sal_Bool SAL_CALL isFloating( ) throw (::com::sun::star::uno::RuntimeException);
209 : void SAL_CALL setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException);
210 : void SAL_CALL lock( ) throw (::com::sun::star::uno::RuntimeException);
211 : void SAL_CALL unlock( ) throw (::com::sun::star::uno::RuntimeException);
212 : sal_Bool SAL_CALL isLocked( ) throw (::com::sun::star::uno::RuntimeException);
213 : void SAL_CALL startPopupMode( const ::com::sun::star::awt::Rectangle& WindowRect ) throw (::com::sun::star::uno::RuntimeException);
214 : sal_Bool SAL_CALL isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException);
215 :
216 : // ::com::sun::star::awt::XWindow2
217 : void SAL_CALL setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException);
218 : ::com::sun::star::awt::Size SAL_CALL getOutputSize( ) throw (::com::sun::star::uno::RuntimeException);
219 : sal_Bool SAL_CALL isVisible( ) throw (::com::sun::star::uno::RuntimeException);
220 : sal_Bool SAL_CALL isActive( ) throw (::com::sun::star::uno::RuntimeException);
221 : sal_Bool SAL_CALL isEnabled( ) throw (::com::sun::star::uno::RuntimeException);
222 : sal_Bool SAL_CALL hasFocus( ) throw (::com::sun::star::uno::RuntimeException);
223 :
224 : // ::com::sun::star::beans::XPropertySetInfo
225 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException);
226 : ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
227 : ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
228 :
229 : // XStyleSettingsSupplier
230 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings > SAL_CALL getStyleSettings() throw (::com::sun::star::uno::RuntimeException);
231 : };
232 :
233 : #endif // _TOOLKIT_AWT_VCLXWINDOW_HXX_
234 :
235 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|