Update ooo320-m1
[ooovba.git] / embedserv / source / embed / xwin.cxx
blob78d1a14aa7e59f6d6188accdf224dcd1557fef83
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xwin.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "xwin.hxx"
32 #include <com/sun/star/lang/SystemDependent.hpp>
35 using namespace ::com::sun::star;
38 ContainerWindowWrapper::ContainerWindowWrapper(HWND aHwnd)
39 : m_aHwnd(aHwnd),
40 m_pDisposeEventListeners(0)
44 ContainerWindowWrapper::~ContainerWindowWrapper()
46 delete m_pDisposeEventListeners;
50 void SAL_CALL
51 ContainerWindowWrapper::dispose(
53 throw (
54 ::com::sun::star::uno::RuntimeException
57 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0);
60 osl::MutexGuard aGuard(m_aMutex);
61 pDisposeEventListeners = m_pDisposeEventListeners;
64 if(pDisposeEventListeners) {
65 lang::EventObject aEvt;
66 aEvt.Source = static_cast< awt::XWindow* >(this);
68 pDisposeEventListeners->disposeAndClear(aEvt);
73 void SAL_CALL
74 ContainerWindowWrapper::addEventListener(
75 const ::com::sun::star::uno::Reference<
76 ::com::sun::star::lang::XEventListener >& Listener
78 throw (
79 ::com::sun::star::uno::RuntimeException
82 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0);
84 osl::MutexGuard aGuard(m_aMutex);
85 pDisposeEventListeners = m_pDisposeEventListeners;
88 if(! pDisposeEventListeners)
90 osl::MutexGuard aGuard(m_aMutex);
91 pDisposeEventListeners = m_pDisposeEventListeners =
92 new cppu::OInterfaceContainerHelper(m_aMutex);
95 pDisposeEventListeners->addInterface( Listener );
99 void SAL_CALL
100 ContainerWindowWrapper::removeEventListener(
101 const ::com::sun::star::uno::Reference<
102 ::com::sun::star::lang::XEventListener >& Listener
104 throw (
105 ::com::sun::star::uno::RuntimeException
108 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0);
110 osl::MutexGuard aGuard(m_aMutex);
111 pDisposeEventListeners = m_pDisposeEventListeners;
113 if( pDisposeEventListeners )
114 pDisposeEventListeners->removeInterface( Listener );
119 // XSystemDependentWindowPeer
121 ::com::sun::star::uno::Any SAL_CALL
122 ContainerWindowWrapper::getWindowHandle(
123 const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId,
124 sal_Int16 SystemType
126 throw (
127 ::com::sun::star::uno::RuntimeException
130 if(SystemType == lang::SystemDependent::SYSTEM_WIN32 ||
131 SystemType == lang::SystemDependent::SYSTEM_WIN16)
133 uno::Any aAny;
134 sal_Int32 nHwnd = sal_Int32(m_aHwnd);
135 aAny <<= nHwnd;
136 return aAny;
138 else
139 return uno::Any();
144 void SAL_CALL
145 ContainerWindowWrapper::setPosSize(
146 sal_Int32 X,
147 sal_Int32 Y,
148 sal_Int32 Width,
149 sal_Int32 Height,
150 sal_Int16 Flags
152 throw (
153 ::com::sun::star::uno::RuntimeException)
158 ::com::sun::star::awt::Rectangle SAL_CALL
159 ContainerWindowWrapper::getPosSize(
161 throw (
162 ::com::sun::star::uno::RuntimeException
165 return awt::Rectangle();
169 void SAL_CALL
170 ContainerWindowWrapper::setVisible(
171 sal_Bool Visible
173 throw (
174 ::com::sun::star::uno::RuntimeException
181 void SAL_CALL
182 ContainerWindowWrapper::setEnable(
183 sal_Bool Enable
185 throw (
186 ::com::sun::star::uno::RuntimeException
192 void SAL_CALL
193 ContainerWindowWrapper::setFocus(
195 throw (
196 ::com::sun::star::uno::RuntimeException
202 void SAL_CALL
203 ContainerWindowWrapper::addWindowListener(
204 const ::com::sun::star::uno::Reference<
205 ::com::sun::star::awt::XWindowListener >& xListener
207 throw (
208 ::com::sun::star::uno::RuntimeException
214 void SAL_CALL
215 ContainerWindowWrapper::removeWindowListener(
216 const ::com::sun::star::uno::Reference<
217 ::com::sun::star::awt::XWindowListener >& xListener
219 throw (
220 ::com::sun::star::uno::RuntimeException
227 void SAL_CALL
228 ContainerWindowWrapper::addFocusListener(
229 const ::com::sun::star::uno::Reference<
230 ::com::sun::star::awt::XFocusListener >& xListener
232 throw (
233 ::com::sun::star::uno::RuntimeException
240 void SAL_CALL
241 ContainerWindowWrapper::removeFocusListener(
242 const ::com::sun::star::uno::Reference<
243 ::com::sun::star::awt::XFocusListener >& xListener
245 throw (
246 ::com::sun::star::uno::RuntimeException
252 void SAL_CALL
253 ContainerWindowWrapper::addKeyListener(
254 const ::com::sun::star::uno::Reference<
255 ::com::sun::star::awt::XKeyListener >& xListener
257 throw (
258 ::com::sun::star::uno::RuntimeException
264 void SAL_CALL
265 ContainerWindowWrapper::removeKeyListener(
266 const ::com::sun::star::uno::Reference<
267 ::com::sun::star::awt::XKeyListener >& xListener
269 throw (
270 ::com::sun::star::uno::RuntimeException
277 void SAL_CALL
278 ContainerWindowWrapper::addMouseListener(
279 const ::com::sun::star::uno::Reference<
280 ::com::sun::star::awt::XMouseListener >& xListener
282 throw (
283 ::com::sun::star::uno::RuntimeException
290 void SAL_CALL
291 ContainerWindowWrapper::removeMouseListener(
292 const ::com::sun::star::uno::Reference<
293 ::com::sun::star::awt::XMouseListener >& xListener
295 throw (
296 ::com::sun::star::uno::RuntimeException
303 void SAL_CALL
304 ContainerWindowWrapper::addMouseMotionListener(
305 const ::com::sun::star::uno::Reference<
306 ::com::sun::star::awt::XMouseMotionListener >& xListener
308 throw (
309 ::com::sun::star::uno::RuntimeException
315 void SAL_CALL
316 ContainerWindowWrapper::removeMouseMotionListener(
317 const ::com::sun::star::uno::Reference<
318 ::com::sun::star::awt::XMouseMotionListener >& xListener
320 throw (
321 ::com::sun::star::uno::RuntimeException
327 void SAL_CALL
328 ContainerWindowWrapper::addPaintListener(
329 const ::com::sun::star::uno::Reference<
330 ::com::sun::star::awt::XPaintListener >& xListener
332 throw (
333 ::com::sun::star::uno::RuntimeException
339 void SAL_CALL
340 ContainerWindowWrapper::removePaintListener(
341 const ::com::sun::star::uno::Reference<
342 ::com::sun::star::awt::XPaintListener >& xListener
344 throw (
345 ::com::sun::star::uno::RuntimeException