1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xwin.cxx,v $
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 ************************************************************************/
32 #include <com/sun/star/lang/SystemDependent.hpp>
35 using namespace ::com::sun::star
;
38 ContainerWindowWrapper::ContainerWindowWrapper(HWND aHwnd
)
40 m_pDisposeEventListeners(0)
44 ContainerWindowWrapper::~ContainerWindowWrapper()
46 delete m_pDisposeEventListeners
;
51 ContainerWindowWrapper::dispose(
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
);
74 ContainerWindowWrapper::addEventListener(
75 const ::com::sun::star::uno::Reference
<
76 ::com::sun::star::lang::XEventListener
>& Listener
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
);
100 ContainerWindowWrapper::removeEventListener(
101 const ::com::sun::star::uno::Reference
<
102 ::com::sun::star::lang::XEventListener
>& Listener
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
,
127 ::com::sun::star::uno::RuntimeException
130 if(SystemType
== lang::SystemDependent::SYSTEM_WIN32
||
131 SystemType
== lang::SystemDependent::SYSTEM_WIN16
)
134 sal_Int32 nHwnd
= sal_Int32(m_aHwnd
);
145 ContainerWindowWrapper::setPosSize(
153 ::com::sun::star::uno::RuntimeException
)
158 ::com::sun::star::awt::Rectangle SAL_CALL
159 ContainerWindowWrapper::getPosSize(
162 ::com::sun::star::uno::RuntimeException
165 return awt::Rectangle();
170 ContainerWindowWrapper::setVisible(
174 ::com::sun::star::uno::RuntimeException
182 ContainerWindowWrapper::setEnable(
186 ::com::sun::star::uno::RuntimeException
193 ContainerWindowWrapper::setFocus(
196 ::com::sun::star::uno::RuntimeException
203 ContainerWindowWrapper::addWindowListener(
204 const ::com::sun::star::uno::Reference
<
205 ::com::sun::star::awt::XWindowListener
>& xListener
208 ::com::sun::star::uno::RuntimeException
215 ContainerWindowWrapper::removeWindowListener(
216 const ::com::sun::star::uno::Reference
<
217 ::com::sun::star::awt::XWindowListener
>& xListener
220 ::com::sun::star::uno::RuntimeException
228 ContainerWindowWrapper::addFocusListener(
229 const ::com::sun::star::uno::Reference
<
230 ::com::sun::star::awt::XFocusListener
>& xListener
233 ::com::sun::star::uno::RuntimeException
241 ContainerWindowWrapper::removeFocusListener(
242 const ::com::sun::star::uno::Reference
<
243 ::com::sun::star::awt::XFocusListener
>& xListener
246 ::com::sun::star::uno::RuntimeException
253 ContainerWindowWrapper::addKeyListener(
254 const ::com::sun::star::uno::Reference
<
255 ::com::sun::star::awt::XKeyListener
>& xListener
258 ::com::sun::star::uno::RuntimeException
265 ContainerWindowWrapper::removeKeyListener(
266 const ::com::sun::star::uno::Reference
<
267 ::com::sun::star::awt::XKeyListener
>& xListener
270 ::com::sun::star::uno::RuntimeException
278 ContainerWindowWrapper::addMouseListener(
279 const ::com::sun::star::uno::Reference
<
280 ::com::sun::star::awt::XMouseListener
>& xListener
283 ::com::sun::star::uno::RuntimeException
291 ContainerWindowWrapper::removeMouseListener(
292 const ::com::sun::star::uno::Reference
<
293 ::com::sun::star::awt::XMouseListener
>& xListener
296 ::com::sun::star::uno::RuntimeException
304 ContainerWindowWrapper::addMouseMotionListener(
305 const ::com::sun::star::uno::Reference
<
306 ::com::sun::star::awt::XMouseMotionListener
>& xListener
309 ::com::sun::star::uno::RuntimeException
316 ContainerWindowWrapper::removeMouseMotionListener(
317 const ::com::sun::star::uno::Reference
<
318 ::com::sun::star::awt::XMouseMotionListener
>& xListener
321 ::com::sun::star::uno::RuntimeException
328 ContainerWindowWrapper::addPaintListener(
329 const ::com::sun::star::uno::Reference
<
330 ::com::sun::star::awt::XPaintListener
>& xListener
333 ::com::sun::star::uno::RuntimeException
340 ContainerWindowWrapper::removePaintListener(
341 const ::com::sun::star::uno::Reference
<
342 ::com::sun::star::awt::XPaintListener
>& xListener
345 ::com::sun::star::uno::RuntimeException