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 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_comphelper.hxx" 26 #include <comphelper/accessiblecomponenthelper.hxx> 27 28 //......................................................................... 29 namespace comphelper 30 { 31 //......................................................................... 32 33 using namespace ::com::sun::star::uno; 34 using namespace ::com::sun::star::awt; 35 using namespace ::com::sun::star::lang; 36 using namespace ::com::sun::star::accessibility; 37 38 //===================================================================== 39 //= OCommonAccessibleComponent 40 //===================================================================== 41 //--------------------------------------------------------------------- OCommonAccessibleComponent()42 OCommonAccessibleComponent::OCommonAccessibleComponent( ) 43 { 44 } 45 46 //--------------------------------------------------------------------- OCommonAccessibleComponent(IMutex * _pExternalLock)47 OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock ) 48 :OAccessibleContextHelper( _pExternalLock ) 49 { 50 } 51 52 //--------------------------------------------------------------------- ~OCommonAccessibleComponent()53 OCommonAccessibleComponent::~OCommonAccessibleComponent( ) 54 { 55 forgetExternalLock(); 56 // this ensures that the lock, which may be already destroyed as part of the derivee, 57 // is not used anymore 58 } 59 60 //-------------------------------------------------------------------- containsPoint(const Point & _rPoint)61 sal_Bool SAL_CALL OCommonAccessibleComponent::containsPoint( const Point& _rPoint ) throw (RuntimeException) 62 { 63 OExternalLockGuard aGuard( this ); 64 Rectangle aBounds( implGetBounds() ); 65 return ( _rPoint.X >= 0 ) 66 && ( _rPoint.Y >= 0 ) 67 && ( _rPoint.X < aBounds.Width ) 68 && ( _rPoint.Y < aBounds.Height ); 69 } 70 71 //-------------------------------------------------------------------- getLocation()72 Point SAL_CALL OCommonAccessibleComponent::getLocation( ) throw (RuntimeException) 73 { 74 OExternalLockGuard aGuard( this ); 75 Rectangle aBounds( implGetBounds() ); 76 return Point( aBounds.X, aBounds.Y ); 77 } 78 79 //-------------------------------------------------------------------- getLocationOnScreen()80 Point SAL_CALL OCommonAccessibleComponent::getLocationOnScreen( ) throw (RuntimeException) 81 { 82 OExternalLockGuard aGuard( this ); 83 Rectangle aBounds( implGetBounds() ); 84 85 Point aScreenLoc( 0, 0 ); 86 87 Reference< XAccessibleComponent > xParentComponent( implGetParentContext(), UNO_QUERY ); 88 OSL_ENSURE( xParentComponent.is(), "OCommonAccessibleComponent::getLocationOnScreen: no parent component!" ); 89 if ( xParentComponent.is() ) 90 { 91 Point aParentScreenLoc( xParentComponent->getLocationOnScreen() ); 92 Point aOwnRelativeLoc( getLocation() ); 93 aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X; 94 aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y; 95 } 96 97 return aScreenLoc; 98 } 99 100 //-------------------------------------------------------------------- getSize()101 Size SAL_CALL OCommonAccessibleComponent::getSize( ) throw (RuntimeException) 102 { 103 OExternalLockGuard aGuard( this ); 104 Rectangle aBounds( implGetBounds() ); 105 return Size( aBounds.Width, aBounds.Height ); 106 } 107 108 //-------------------------------------------------------------------- getBounds()109 Rectangle SAL_CALL OCommonAccessibleComponent::getBounds( ) throw (RuntimeException) 110 { 111 OExternalLockGuard aGuard( this ); 112 return implGetBounds(); 113 } 114 115 //===================================================================== 116 //= OAccessibleComponentHelper 117 //===================================================================== 118 //--------------------------------------------------------------------- OAccessibleComponentHelper()119 OAccessibleComponentHelper::OAccessibleComponentHelper( ) 120 { 121 } 122 123 //--------------------------------------------------------------------- OAccessibleComponentHelper(IMutex * _pExternalLock)124 OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock ) 125 :OCommonAccessibleComponent( _pExternalLock ) 126 { 127 } 128 129 //-------------------------------------------------------------------- IMPLEMENT_FORWARD_XINTERFACE2(OAccessibleComponentHelper,OCommonAccessibleComponent,OAccessibleComponentHelper_Base)130 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base ) 131 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base ) 132 // (order matters: the first is the class name, the second is the class doing the ref counting) 133 134 //-------------------------------------------------------------------- 135 sal_Bool SAL_CALL OAccessibleComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException) 136 { 137 return OCommonAccessibleComponent::containsPoint( _rPoint ); 138 } 139 140 //-------------------------------------------------------------------- getLocation()141 Point SAL_CALL OAccessibleComponentHelper::getLocation( ) throw (RuntimeException) 142 { 143 return OCommonAccessibleComponent::getLocation( ); 144 } 145 146 //-------------------------------------------------------------------- getLocationOnScreen()147 Point SAL_CALL OAccessibleComponentHelper::getLocationOnScreen( ) throw (RuntimeException) 148 { 149 return OCommonAccessibleComponent::getLocationOnScreen( ); 150 } 151 152 //-------------------------------------------------------------------- getSize()153 Size SAL_CALL OAccessibleComponentHelper::getSize( ) throw (RuntimeException) 154 { 155 return OCommonAccessibleComponent::getSize( ); 156 } 157 158 //-------------------------------------------------------------------- getBounds()159 Rectangle SAL_CALL OAccessibleComponentHelper::getBounds( ) throw (RuntimeException) 160 { 161 return OCommonAccessibleComponent::getBounds( ); 162 } 163 164 //===================================================================== 165 //= OAccessibleExtendedComponentHelper 166 //===================================================================== 167 //--------------------------------------------------------------------- OAccessibleExtendedComponentHelper()168 OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( ) 169 { 170 } 171 172 //--------------------------------------------------------------------- OAccessibleExtendedComponentHelper(IMutex * _pExternalLock)173 OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock ) 174 :OCommonAccessibleComponent( _pExternalLock ) 175 { 176 } 177 178 //-------------------------------------------------------------------- IMPLEMENT_FORWARD_XINTERFACE2(OAccessibleExtendedComponentHelper,OCommonAccessibleComponent,OAccessibleExtendedComponentHelper_Base)179 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base ) 180 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base ) 181 // (order matters: the first is the class name, the second is the class doing the ref counting) 182 183 //-------------------------------------------------------------------- 184 sal_Bool SAL_CALL OAccessibleExtendedComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException) 185 { 186 return OCommonAccessibleComponent::containsPoint( _rPoint ); 187 } 188 189 //-------------------------------------------------------------------- getLocation()190 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocation( ) throw (RuntimeException) 191 { 192 return OCommonAccessibleComponent::getLocation( ); 193 } 194 195 //-------------------------------------------------------------------- getLocationOnScreen()196 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocationOnScreen( ) throw (RuntimeException) 197 { 198 return OCommonAccessibleComponent::getLocationOnScreen( ); 199 } 200 201 //-------------------------------------------------------------------- getSize()202 Size SAL_CALL OAccessibleExtendedComponentHelper::getSize( ) throw (RuntimeException) 203 { 204 return OCommonAccessibleComponent::getSize( ); 205 } 206 207 //-------------------------------------------------------------------- getBounds()208 Rectangle SAL_CALL OAccessibleExtendedComponentHelper::getBounds( ) throw (RuntimeException) 209 { 210 return OCommonAccessibleComponent::getBounds( ); 211 } 212 213 //......................................................................... 214 } // namespace comphelper 215 //......................................................................... 216 217 218