1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include "xwin.hxx" 29 #include <com/sun/star/lang/SystemDependent.hpp> 30 31 32 using namespace ::com::sun::star; 33 34 35 ContainerWindowWrapper::ContainerWindowWrapper(HWND aHwnd) 36 : m_aHwnd(aHwnd), 37 m_pDisposeEventListeners(0) 38 { 39 } 40 41 ContainerWindowWrapper::~ContainerWindowWrapper() 42 { 43 delete m_pDisposeEventListeners; 44 } 45 46 47 void SAL_CALL 48 ContainerWindowWrapper::dispose( 49 ) 50 throw ( 51 ::com::sun::star::uno::RuntimeException 52 ) 53 { 54 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); 55 56 { 57 osl::MutexGuard aGuard(m_aMutex); 58 pDisposeEventListeners = m_pDisposeEventListeners; 59 } 60 61 if(pDisposeEventListeners) { 62 lang::EventObject aEvt; 63 aEvt.Source = static_cast< awt::XWindow* >(this); 64 65 pDisposeEventListeners->disposeAndClear(aEvt); 66 } 67 } 68 69 70 void SAL_CALL 71 ContainerWindowWrapper::addEventListener( 72 const ::com::sun::star::uno::Reference< 73 ::com::sun::star::lang::XEventListener >& Listener 74 ) 75 throw ( 76 ::com::sun::star::uno::RuntimeException 77 ) 78 { 79 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); 80 { 81 osl::MutexGuard aGuard(m_aMutex); 82 pDisposeEventListeners = m_pDisposeEventListeners; 83 } 84 85 if(! pDisposeEventListeners) 86 { 87 osl::MutexGuard aGuard(m_aMutex); 88 pDisposeEventListeners = m_pDisposeEventListeners = 89 new cppu::OInterfaceContainerHelper(m_aMutex); 90 } 91 92 pDisposeEventListeners->addInterface( Listener ); 93 } 94 95 96 void SAL_CALL 97 ContainerWindowWrapper::removeEventListener( 98 const ::com::sun::star::uno::Reference< 99 ::com::sun::star::lang::XEventListener >& Listener 100 ) 101 throw ( 102 ::com::sun::star::uno::RuntimeException 103 ) 104 { 105 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); 106 { 107 osl::MutexGuard aGuard(m_aMutex); 108 pDisposeEventListeners = m_pDisposeEventListeners; 109 } 110 if( pDisposeEventListeners ) 111 pDisposeEventListeners->removeInterface( Listener ); 112 } 113 114 115 116 // XSystemDependentWindowPeer 117 118 ::com::sun::star::uno::Any SAL_CALL 119 ContainerWindowWrapper::getWindowHandle( 120 const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, 121 sal_Int16 SystemType 122 ) 123 throw ( 124 ::com::sun::star::uno::RuntimeException 125 ) 126 { 127 if(SystemType == lang::SystemDependent::SYSTEM_WIN32 || 128 SystemType == lang::SystemDependent::SYSTEM_WIN16) 129 { 130 uno::Any aAny; 131 sal_Int32 nHwnd = sal_Int32(m_aHwnd); 132 aAny <<= nHwnd; 133 return aAny; 134 } 135 else 136 return uno::Any(); 137 } 138 139 140 141 void SAL_CALL 142 ContainerWindowWrapper::setPosSize( 143 sal_Int32 X, 144 sal_Int32 Y, 145 sal_Int32 Width, 146 sal_Int32 Height, 147 sal_Int16 Flags 148 ) 149 throw ( 150 ::com::sun::star::uno::RuntimeException) 151 { 152 153 } 154 155 ::com::sun::star::awt::Rectangle SAL_CALL 156 ContainerWindowWrapper::getPosSize( 157 ) 158 throw ( 159 ::com::sun::star::uno::RuntimeException 160 ) 161 { 162 return awt::Rectangle(); 163 } 164 165 166 void SAL_CALL 167 ContainerWindowWrapper::setVisible( 168 sal_Bool Visible 169 ) 170 throw ( 171 ::com::sun::star::uno::RuntimeException 172 ) 173 { 174 175 } 176 177 178 void SAL_CALL 179 ContainerWindowWrapper::setEnable( 180 sal_Bool Enable 181 ) 182 throw ( 183 ::com::sun::star::uno::RuntimeException 184 ) 185 { 186 187 } 188 189 void SAL_CALL 190 ContainerWindowWrapper::setFocus( 191 ) 192 throw ( 193 ::com::sun::star::uno::RuntimeException 194 ) 195 { 196 197 } 198 199 void SAL_CALL 200 ContainerWindowWrapper::addWindowListener( 201 const ::com::sun::star::uno::Reference< 202 ::com::sun::star::awt::XWindowListener >& xListener 203 ) 204 throw ( 205 ::com::sun::star::uno::RuntimeException 206 ) 207 { 208 209 } 210 211 void SAL_CALL 212 ContainerWindowWrapper::removeWindowListener( 213 const ::com::sun::star::uno::Reference< 214 ::com::sun::star::awt::XWindowListener >& xListener 215 ) 216 throw ( 217 ::com::sun::star::uno::RuntimeException 218 ) 219 { 220 221 } 222 223 224 void SAL_CALL 225 ContainerWindowWrapper::addFocusListener( 226 const ::com::sun::star::uno::Reference< 227 ::com::sun::star::awt::XFocusListener >& xListener 228 ) 229 throw ( 230 ::com::sun::star::uno::RuntimeException 231 ) 232 { 233 234 } 235 236 237 void SAL_CALL 238 ContainerWindowWrapper::removeFocusListener( 239 const ::com::sun::star::uno::Reference< 240 ::com::sun::star::awt::XFocusListener >& xListener 241 ) 242 throw ( 243 ::com::sun::star::uno::RuntimeException 244 ) 245 { 246 247 } 248 249 void SAL_CALL 250 ContainerWindowWrapper::addKeyListener( 251 const ::com::sun::star::uno::Reference< 252 ::com::sun::star::awt::XKeyListener >& xListener 253 ) 254 throw ( 255 ::com::sun::star::uno::RuntimeException 256 ) 257 { 258 259 } 260 261 void SAL_CALL 262 ContainerWindowWrapper::removeKeyListener( 263 const ::com::sun::star::uno::Reference< 264 ::com::sun::star::awt::XKeyListener >& xListener 265 ) 266 throw ( 267 ::com::sun::star::uno::RuntimeException 268 ) 269 { 270 271 } 272 273 274 void SAL_CALL 275 ContainerWindowWrapper::addMouseListener( 276 const ::com::sun::star::uno::Reference< 277 ::com::sun::star::awt::XMouseListener >& xListener 278 ) 279 throw ( 280 ::com::sun::star::uno::RuntimeException 281 ) 282 { 283 284 } 285 286 287 void SAL_CALL 288 ContainerWindowWrapper::removeMouseListener( 289 const ::com::sun::star::uno::Reference< 290 ::com::sun::star::awt::XMouseListener >& xListener 291 ) 292 throw ( 293 ::com::sun::star::uno::RuntimeException 294 ) 295 { 296 297 } 298 299 300 void SAL_CALL 301 ContainerWindowWrapper::addMouseMotionListener( 302 const ::com::sun::star::uno::Reference< 303 ::com::sun::star::awt::XMouseMotionListener >& xListener 304 ) 305 throw ( 306 ::com::sun::star::uno::RuntimeException 307 ) 308 { 309 310 } 311 312 void SAL_CALL 313 ContainerWindowWrapper::removeMouseMotionListener( 314 const ::com::sun::star::uno::Reference< 315 ::com::sun::star::awt::XMouseMotionListener >& xListener 316 ) 317 throw ( 318 ::com::sun::star::uno::RuntimeException 319 ) 320 { 321 322 } 323 324 void SAL_CALL 325 ContainerWindowWrapper::addPaintListener( 326 const ::com::sun::star::uno::Reference< 327 ::com::sun::star::awt::XPaintListener >& xListener 328 ) 329 throw ( 330 ::com::sun::star::uno::RuntimeException 331 ) 332 { 333 334 } 335 336 void SAL_CALL 337 ContainerWindowWrapper::removePaintListener( 338 const ::com::sun::star::uno::Reference< 339 ::com::sun::star::awt::XPaintListener >& xListener 340 ) 341 throw ( 342 ::com::sun::star::uno::RuntimeException 343 ) 344 { 345 346 } 347