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 31 ContainerWindowWrapper::ContainerWindowWrapper(HWND aHwnd) 32 : m_aHwnd(aHwnd), 33 m_pDisposeEventListeners(0) 34 { 35 } 36 37 ContainerWindowWrapper::~ContainerWindowWrapper() 38 { 39 delete m_pDisposeEventListeners; 40 } 41 42 43 void SAL_CALL 44 ContainerWindowWrapper::dispose( 45 ) 46 { 47 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); 48 49 { 50 osl::MutexGuard aGuard(m_aMutex); 51 pDisposeEventListeners = m_pDisposeEventListeners; 52 } 53 54 if(pDisposeEventListeners) { 55 lang::EventObject aEvt; 56 aEvt.Source = static_cast< awt::XWindow* >(this); 57 58 pDisposeEventListeners->disposeAndClear(aEvt); 59 } 60 } 61 62 63 void SAL_CALL 64 ContainerWindowWrapper::addEventListener( 65 const ::com::sun::star::uno::Reference< 66 ::com::sun::star::lang::XEventListener >& Listener 67 ) 68 { 69 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); 70 { 71 osl::MutexGuard aGuard(m_aMutex); 72 pDisposeEventListeners = m_pDisposeEventListeners; 73 } 74 75 if(! pDisposeEventListeners) 76 { 77 osl::MutexGuard aGuard(m_aMutex); 78 pDisposeEventListeners = m_pDisposeEventListeners = 79 new cppu::OInterfaceContainerHelper(m_aMutex); 80 } 81 82 pDisposeEventListeners->addInterface( Listener ); 83 } 84 85 86 void SAL_CALL 87 ContainerWindowWrapper::removeEventListener( 88 const ::com::sun::star::uno::Reference< 89 ::com::sun::star::lang::XEventListener >& Listener 90 ) 91 { 92 cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); 93 { 94 osl::MutexGuard aGuard(m_aMutex); 95 pDisposeEventListeners = m_pDisposeEventListeners; 96 } 97 if( pDisposeEventListeners ) 98 pDisposeEventListeners->removeInterface( Listener ); 99 } 100 101 102 103 // XSystemDependentWindowPeer 104 105 ::com::sun::star::uno::Any SAL_CALL 106 ContainerWindowWrapper::getWindowHandle( 107 const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, 108 sal_Int16 SystemType 109 ) 110 { 111 if(SystemType == lang::SystemDependent::SYSTEM_WIN32 || 112 SystemType == lang::SystemDependent::SYSTEM_WIN16) 113 { 114 uno::Any aAny; 115 sal_Int32 nHwnd = sal_Int32(m_aHwnd); 116 aAny <<= nHwnd; 117 return aAny; 118 } 119 else 120 return uno::Any(); 121 } 122 123 124 125 void SAL_CALL 126 ContainerWindowWrapper::setPosSize( 127 sal_Int32 X, 128 sal_Int32 Y, 129 sal_Int32 Width, 130 sal_Int32 Height, 131 sal_Int16 Flags 132 ) 133 { 134 135 } 136 137 ::com::sun::star::awt::Rectangle SAL_CALL 138 ContainerWindowWrapper::getPosSize( 139 ) 140 { 141 return awt::Rectangle(); 142 } 143 144 145 void SAL_CALL 146 ContainerWindowWrapper::setVisible( 147 sal_Bool Visible 148 ) 149 { 150 151 } 152 153 154 void SAL_CALL 155 ContainerWindowWrapper::setEnable( 156 sal_Bool Enable 157 ) 158 { 159 160 } 161 162 void SAL_CALL 163 ContainerWindowWrapper::setFocus( 164 ) 165 { 166 167 } 168 169 void SAL_CALL 170 ContainerWindowWrapper::addWindowListener( 171 const ::com::sun::star::uno::Reference< 172 ::com::sun::star::awt::XWindowListener >& xListener 173 ) 174 { 175 176 } 177 178 void SAL_CALL 179 ContainerWindowWrapper::removeWindowListener( 180 const ::com::sun::star::uno::Reference< 181 ::com::sun::star::awt::XWindowListener >& xListener 182 ) 183 { 184 185 } 186 187 188 void SAL_CALL 189 ContainerWindowWrapper::addFocusListener( 190 const ::com::sun::star::uno::Reference< 191 ::com::sun::star::awt::XFocusListener >& xListener 192 ) 193 { 194 195 } 196 197 198 void SAL_CALL 199 ContainerWindowWrapper::removeFocusListener( 200 const ::com::sun::star::uno::Reference< 201 ::com::sun::star::awt::XFocusListener >& xListener 202 ) 203 { 204 205 } 206 207 void SAL_CALL 208 ContainerWindowWrapper::addKeyListener( 209 const ::com::sun::star::uno::Reference< 210 ::com::sun::star::awt::XKeyListener >& xListener 211 ) 212 { 213 214 } 215 216 void SAL_CALL 217 ContainerWindowWrapper::removeKeyListener( 218 const ::com::sun::star::uno::Reference< 219 ::com::sun::star::awt::XKeyListener >& xListener 220 ) 221 { 222 223 } 224 225 226 void SAL_CALL 227 ContainerWindowWrapper::addMouseListener( 228 const ::com::sun::star::uno::Reference< 229 ::com::sun::star::awt::XMouseListener >& xListener 230 ) 231 { 232 233 } 234 235 236 void SAL_CALL 237 ContainerWindowWrapper::removeMouseListener( 238 const ::com::sun::star::uno::Reference< 239 ::com::sun::star::awt::XMouseListener >& xListener 240 ) 241 { 242 243 } 244 245 246 void SAL_CALL 247 ContainerWindowWrapper::addMouseMotionListener( 248 const ::com::sun::star::uno::Reference< 249 ::com::sun::star::awt::XMouseMotionListener >& xListener 250 ) 251 { 252 253 } 254 255 void SAL_CALL 256 ContainerWindowWrapper::removeMouseMotionListener( 257 const ::com::sun::star::uno::Reference< 258 ::com::sun::star::awt::XMouseMotionListener >& xListener 259 ) 260 { 261 262 } 263 264 void SAL_CALL 265 ContainerWindowWrapper::addPaintListener( 266 const ::com::sun::star::uno::Reference< 267 ::com::sun::star::awt::XPaintListener >& xListener 268 ) 269 { 270 271 } 272 273 void SAL_CALL 274 ContainerWindowWrapper::removePaintListener( 275 const ::com::sun::star::uno::Reference< 276 ::com::sun::star::awt::XPaintListener >& xListener 277 ) 278 { 279 280 } 281