xref: /trunk/main/embedserv/source/embed/xwin.cxx (revision f78e906f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "xwin.hxx"
25 #include <com/sun/star/lang/SystemDependent.hpp>
26 
27 
28 using namespace ::com::sun::star;
29 
30 
ContainerWindowWrapper(HWND aHwnd)31 ContainerWindowWrapper::ContainerWindowWrapper(HWND aHwnd)
32     : m_aHwnd(aHwnd),
33       m_pDisposeEventListeners(0)
34 {
35 }
36 
~ContainerWindowWrapper()37 ContainerWindowWrapper::~ContainerWindowWrapper()
38 {
39     delete m_pDisposeEventListeners;
40 }
41 
42 
43 void SAL_CALL
dispose()44 ContainerWindowWrapper::dispose(
45 )
46     throw (
47         ::com::sun::star::uno::RuntimeException
48     )
49 {
50     cppu::OInterfaceContainerHelper *pDisposeEventListeners(0);
51 
52     {
53         osl::MutexGuard aGuard(m_aMutex);
54         pDisposeEventListeners = m_pDisposeEventListeners;
55     }
56 
57     if(pDisposeEventListeners) {
58         lang::EventObject aEvt;
59         aEvt.Source = static_cast< awt::XWindow* >(this);
60 
61         pDisposeEventListeners->disposeAndClear(aEvt);
62     }
63 }
64 
65 
66 void SAL_CALL
addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & Listener)67 ContainerWindowWrapper::addEventListener(
68     const ::com::sun::star::uno::Reference<
69     ::com::sun::star::lang::XEventListener >& Listener
70 )
71     throw (
72         ::com::sun::star::uno::RuntimeException
73     )
74 {
75     cppu::OInterfaceContainerHelper *pDisposeEventListeners(0);
76     {
77         osl::MutexGuard aGuard(m_aMutex);
78         pDisposeEventListeners = m_pDisposeEventListeners;
79     }
80 
81 	if(! pDisposeEventListeners)
82     {
83         osl::MutexGuard aGuard(m_aMutex);
84 		pDisposeEventListeners = m_pDisposeEventListeners =
85 			new cppu::OInterfaceContainerHelper(m_aMutex);
86     }
87 
88 	pDisposeEventListeners->addInterface( Listener );
89 }
90 
91 
92 void SAL_CALL
removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & Listener)93 ContainerWindowWrapper::removeEventListener(
94     const ::com::sun::star::uno::Reference<
95     ::com::sun::star::lang::XEventListener >& Listener
96 )
97     throw (
98         ::com::sun::star::uno::RuntimeException
99     )
100 {
101     cppu::OInterfaceContainerHelper *pDisposeEventListeners(0);
102     {
103         osl::MutexGuard aGuard(m_aMutex);
104         pDisposeEventListeners = m_pDisposeEventListeners;
105     }
106 	if( pDisposeEventListeners )
107 		pDisposeEventListeners->removeInterface( Listener );
108 }
109 
110 
111 
112 // XSystemDependentWindowPeer
113 
114 ::com::sun::star::uno::Any SAL_CALL
getWindowHandle(const::com::sun::star::uno::Sequence<sal_Int8> & ProcessId,sal_Int16 SystemType)115 ContainerWindowWrapper::getWindowHandle(
116     const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId,
117     sal_Int16 SystemType
118 )
119     throw (
120         ::com::sun::star::uno::RuntimeException
121     )
122 {
123     if(SystemType == lang::SystemDependent::SYSTEM_WIN32 ||
124        SystemType == lang::SystemDependent::SYSTEM_WIN16)
125     {
126         uno::Any aAny;
127         sal_Int32 nHwnd = sal_Int32(m_aHwnd);
128         aAny <<= nHwnd;
129         return aAny;
130     }
131     else
132         return uno::Any();
133 }
134 
135 
136 
137 void SAL_CALL
setPosSize(sal_Int32 X,sal_Int32 Y,sal_Int32 Width,sal_Int32 Height,sal_Int16 Flags)138 ContainerWindowWrapper::setPosSize(
139     sal_Int32 X,
140     sal_Int32 Y,
141     sal_Int32 Width,
142     sal_Int32 Height,
143     sal_Int16 Flags
144 )
145     throw (
146         ::com::sun::star::uno::RuntimeException)
147 {
148 
149 }
150 
151 ::com::sun::star::awt::Rectangle SAL_CALL
getPosSize()152 ContainerWindowWrapper::getPosSize(
153 )
154     throw (
155         ::com::sun::star::uno::RuntimeException
156     )
157 {
158     return awt::Rectangle();
159 }
160 
161 
162 void SAL_CALL
setVisible(sal_Bool Visible)163 ContainerWindowWrapper::setVisible(
164     sal_Bool Visible
165 )
166     throw (
167         ::com::sun::star::uno::RuntimeException
168     )
169 {
170 
171 }
172 
173 
174 void SAL_CALL
setEnable(sal_Bool Enable)175 ContainerWindowWrapper::setEnable(
176     sal_Bool Enable
177 )
178     throw (
179         ::com::sun::star::uno::RuntimeException
180     )
181 {
182 
183 }
184 
185 void SAL_CALL
setFocus()186 ContainerWindowWrapper::setFocus(
187 )
188     throw (
189         ::com::sun::star::uno::RuntimeException
190     )
191 {
192 
193 }
194 
195 void SAL_CALL
addWindowListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XWindowListener> & xListener)196 ContainerWindowWrapper::addWindowListener(
197     const ::com::sun::star::uno::Reference<
198     ::com::sun::star::awt::XWindowListener >& xListener
199 )
200     throw (
201         ::com::sun::star::uno::RuntimeException
202     )
203 {
204 
205 }
206 
207 void SAL_CALL
removeWindowListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XWindowListener> & xListener)208 ContainerWindowWrapper::removeWindowListener(
209     const ::com::sun::star::uno::Reference<
210     ::com::sun::star::awt::XWindowListener >& xListener
211 )
212     throw (
213         ::com::sun::star::uno::RuntimeException
214     )
215 {
216 
217 }
218 
219 
220 void SAL_CALL
addFocusListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XFocusListener> & xListener)221 ContainerWindowWrapper::addFocusListener(
222     const ::com::sun::star::uno::Reference<
223     ::com::sun::star::awt::XFocusListener >& xListener
224 )
225     throw (
226         ::com::sun::star::uno::RuntimeException
227     )
228 {
229 
230 }
231 
232 
233 void SAL_CALL
removeFocusListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XFocusListener> & xListener)234 ContainerWindowWrapper::removeFocusListener(
235     const ::com::sun::star::uno::Reference<
236     ::com::sun::star::awt::XFocusListener >& xListener
237 )
238     throw (
239         ::com::sun::star::uno::RuntimeException
240     )
241 {
242 
243 }
244 
245 void SAL_CALL
addKeyListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XKeyListener> & xListener)246 ContainerWindowWrapper::addKeyListener(
247     const ::com::sun::star::uno::Reference<
248     ::com::sun::star::awt::XKeyListener >& xListener
249 )
250     throw (
251         ::com::sun::star::uno::RuntimeException
252     )
253 {
254 
255 }
256 
257 void SAL_CALL
removeKeyListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XKeyListener> & xListener)258 ContainerWindowWrapper::removeKeyListener(
259     const ::com::sun::star::uno::Reference<
260     ::com::sun::star::awt::XKeyListener >& xListener
261 )
262     throw (
263         ::com::sun::star::uno::RuntimeException
264     )
265 {
266 
267 }
268 
269 
270 void SAL_CALL
addMouseListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XMouseListener> & xListener)271 ContainerWindowWrapper::addMouseListener(
272     const ::com::sun::star::uno::Reference<
273     ::com::sun::star::awt::XMouseListener >& xListener
274 )
275     throw (
276         ::com::sun::star::uno::RuntimeException
277     )
278 {
279 
280 }
281 
282 
283 void SAL_CALL
removeMouseListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XMouseListener> & xListener)284 ContainerWindowWrapper::removeMouseListener(
285     const ::com::sun::star::uno::Reference<
286     ::com::sun::star::awt::XMouseListener >& xListener
287 )
288     throw (
289         ::com::sun::star::uno::RuntimeException
290     )
291 {
292 
293 }
294 
295 
296 void SAL_CALL
addMouseMotionListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XMouseMotionListener> & xListener)297 ContainerWindowWrapper::addMouseMotionListener(
298     const ::com::sun::star::uno::Reference<
299     ::com::sun::star::awt::XMouseMotionListener >& xListener
300 )
301     throw (
302         ::com::sun::star::uno::RuntimeException
303     )
304 {
305 
306 }
307 
308 void SAL_CALL
removeMouseMotionListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XMouseMotionListener> & xListener)309 ContainerWindowWrapper::removeMouseMotionListener(
310     const ::com::sun::star::uno::Reference<
311     ::com::sun::star::awt::XMouseMotionListener >& xListener
312 )
313     throw (
314         ::com::sun::star::uno::RuntimeException
315     )
316 {
317 
318 }
319 
320 void SAL_CALL
addPaintListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XPaintListener> & xListener)321 ContainerWindowWrapper::addPaintListener(
322     const ::com::sun::star::uno::Reference<
323     ::com::sun::star::awt::XPaintListener >& xListener
324 )
325     throw (
326         ::com::sun::star::uno::RuntimeException
327     )
328 {
329 
330 }
331 
332 void SAL_CALL
removePaintListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XPaintListener> & xListener)333 ContainerWindowWrapper::removePaintListener(
334     const ::com::sun::star::uno::Reference<
335     ::com::sun::star::awt::XPaintListener >& xListener
336 )
337     throw (
338         ::com::sun::star::uno::RuntimeException
339     )
340 {
341 
342 }
343