CWS-TOOLING: integrate CWS os146
[LibreOffice.git] / comphelper / source / misc / accessiblecomponenthelper.cxx
blob5fb86f3f7b1df1f7c2f6fbef1a44e66f70359c33
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_comphelper.hxx"
30 #include <comphelper/accessiblecomponenthelper.hxx>
32 //.........................................................................
33 namespace comphelper
35 //.........................................................................
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::awt;
39 using namespace ::com::sun::star::lang;
40 using namespace ::com::sun::star::accessibility;
42 //=====================================================================
43 //= OCommonAccessibleComponent
44 //=====================================================================
45 //---------------------------------------------------------------------
46 OCommonAccessibleComponent::OCommonAccessibleComponent( )
50 //---------------------------------------------------------------------
51 OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock )
52 :OAccessibleContextHelper( _pExternalLock )
56 //---------------------------------------------------------------------
57 OCommonAccessibleComponent::~OCommonAccessibleComponent( )
59 forgetExternalLock();
60 // this ensures that the lock, which may be already destroyed as part of the derivee,
61 // is not used anymore
64 //--------------------------------------------------------------------
65 sal_Bool SAL_CALL OCommonAccessibleComponent::containsPoint( const Point& _rPoint ) throw (RuntimeException)
67 OExternalLockGuard aGuard( this );
68 Rectangle aBounds( implGetBounds() );
69 return ( _rPoint.X >= 0 )
70 && ( _rPoint.Y >= 0 )
71 && ( _rPoint.X < aBounds.Width )
72 && ( _rPoint.Y < aBounds.Height );
75 //--------------------------------------------------------------------
76 Point SAL_CALL OCommonAccessibleComponent::getLocation( ) throw (RuntimeException)
78 OExternalLockGuard aGuard( this );
79 Rectangle aBounds( implGetBounds() );
80 return Point( aBounds.X, aBounds.Y );
83 //--------------------------------------------------------------------
84 Point SAL_CALL OCommonAccessibleComponent::getLocationOnScreen( ) throw (RuntimeException)
86 OExternalLockGuard aGuard( this );
87 Rectangle aBounds( implGetBounds() );
89 Point aScreenLoc( 0, 0 );
91 Reference< XAccessibleComponent > xParentComponent( implGetParentContext(), UNO_QUERY );
92 OSL_ENSURE( xParentComponent.is(), "OCommonAccessibleComponent::getLocationOnScreen: no parent component!" );
93 if ( xParentComponent.is() )
95 Point aParentScreenLoc( xParentComponent->getLocationOnScreen() );
96 Point aOwnRelativeLoc( getLocation() );
97 aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
98 aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
101 return aScreenLoc;
104 //--------------------------------------------------------------------
105 Size SAL_CALL OCommonAccessibleComponent::getSize( ) throw (RuntimeException)
107 OExternalLockGuard aGuard( this );
108 Rectangle aBounds( implGetBounds() );
109 return Size( aBounds.Width, aBounds.Height );
112 //--------------------------------------------------------------------
113 Rectangle SAL_CALL OCommonAccessibleComponent::getBounds( ) throw (RuntimeException)
115 OExternalLockGuard aGuard( this );
116 return implGetBounds();
119 //=====================================================================
120 //= OAccessibleComponentHelper
121 //=====================================================================
122 //---------------------------------------------------------------------
123 OAccessibleComponentHelper::OAccessibleComponentHelper( )
127 //---------------------------------------------------------------------
128 OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock )
129 :OCommonAccessibleComponent( _pExternalLock )
133 //--------------------------------------------------------------------
134 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
135 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
136 // (order matters: the first is the class name, the second is the class doing the ref counting)
138 //--------------------------------------------------------------------
139 sal_Bool SAL_CALL OAccessibleComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException)
141 return OCommonAccessibleComponent::containsPoint( _rPoint );
144 //--------------------------------------------------------------------
145 Point SAL_CALL OAccessibleComponentHelper::getLocation( ) throw (RuntimeException)
147 return OCommonAccessibleComponent::getLocation( );
150 //--------------------------------------------------------------------
151 Point SAL_CALL OAccessibleComponentHelper::getLocationOnScreen( ) throw (RuntimeException)
153 return OCommonAccessibleComponent::getLocationOnScreen( );
156 //--------------------------------------------------------------------
157 Size SAL_CALL OAccessibleComponentHelper::getSize( ) throw (RuntimeException)
159 return OCommonAccessibleComponent::getSize( );
162 //--------------------------------------------------------------------
163 Rectangle SAL_CALL OAccessibleComponentHelper::getBounds( ) throw (RuntimeException)
165 return OCommonAccessibleComponent::getBounds( );
168 //=====================================================================
169 //= OAccessibleExtendedComponentHelper
170 //=====================================================================
171 //---------------------------------------------------------------------
172 OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( )
176 //---------------------------------------------------------------------
177 OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock )
178 :OCommonAccessibleComponent( _pExternalLock )
182 //--------------------------------------------------------------------
183 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
184 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
185 // (order matters: the first is the class name, the second is the class doing the ref counting)
187 //--------------------------------------------------------------------
188 sal_Bool SAL_CALL OAccessibleExtendedComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException)
190 return OCommonAccessibleComponent::containsPoint( _rPoint );
193 //--------------------------------------------------------------------
194 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocation( ) throw (RuntimeException)
196 return OCommonAccessibleComponent::getLocation( );
199 //--------------------------------------------------------------------
200 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocationOnScreen( ) throw (RuntimeException)
202 return OCommonAccessibleComponent::getLocationOnScreen( );
205 //--------------------------------------------------------------------
206 Size SAL_CALL OAccessibleExtendedComponentHelper::getSize( ) throw (RuntimeException)
208 return OCommonAccessibleComponent::getSize( );
211 //--------------------------------------------------------------------
212 Rectangle SAL_CALL OAccessibleExtendedComponentHelper::getBounds( ) throw (RuntimeException)
214 return OCommonAccessibleComponent::getBounds( );
217 //.........................................................................
218 } // namespace comphelper
219 //.........................................................................