update dev300-m58
[ooovba.git] / comphelper / source / misc / accessiblecomponenthelper.cxx
blobcdbb3e31761a8b87a3040ff4f7597bf4df42b83a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accessiblecomponenthelper.cxx,v $
10 * $Revision: 1.9 $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_comphelper.hxx"
33 #include <comphelper/accessiblecomponenthelper.hxx>
35 //.........................................................................
36 namespace comphelper
38 //.........................................................................
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::awt;
42 using namespace ::com::sun::star::lang;
43 using namespace ::com::sun::star::accessibility;
45 //=====================================================================
46 //= OCommonAccessibleComponent
47 //=====================================================================
48 //---------------------------------------------------------------------
49 OCommonAccessibleComponent::OCommonAccessibleComponent( )
53 //---------------------------------------------------------------------
54 OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock )
55 :OAccessibleContextHelper( _pExternalLock )
59 //---------------------------------------------------------------------
60 OCommonAccessibleComponent::~OCommonAccessibleComponent( )
62 forgetExternalLock();
63 // this ensures that the lock, which may be already destroyed as part of the derivee,
64 // is not used anymore
67 //--------------------------------------------------------------------
68 sal_Bool SAL_CALL OCommonAccessibleComponent::containsPoint( const Point& _rPoint ) throw (RuntimeException)
70 OExternalLockGuard aGuard( this );
71 Rectangle aBounds( implGetBounds() );
72 return ( _rPoint.X >= 0 )
73 && ( _rPoint.Y >= 0 )
74 && ( _rPoint.X < aBounds.Width )
75 && ( _rPoint.Y < aBounds.Height );
78 //--------------------------------------------------------------------
79 Point SAL_CALL OCommonAccessibleComponent::getLocation( ) throw (RuntimeException)
81 OExternalLockGuard aGuard( this );
82 Rectangle aBounds( implGetBounds() );
83 return Point( aBounds.X, aBounds.Y );
86 //--------------------------------------------------------------------
87 Point SAL_CALL OCommonAccessibleComponent::getLocationOnScreen( ) throw (RuntimeException)
89 OExternalLockGuard aGuard( this );
90 Rectangle aBounds( implGetBounds() );
92 Point aScreenLoc( 0, 0 );
94 Reference< XAccessibleComponent > xParentComponent( implGetParentContext(), UNO_QUERY );
95 OSL_ENSURE( xParentComponent.is(), "OCommonAccessibleComponent::getLocationOnScreen: no parent component!" );
96 if ( xParentComponent.is() )
98 Point aParentScreenLoc( xParentComponent->getLocationOnScreen() );
99 Point aOwnRelativeLoc( getLocation() );
100 aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
101 aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
104 return aScreenLoc;
107 //--------------------------------------------------------------------
108 Size SAL_CALL OCommonAccessibleComponent::getSize( ) throw (RuntimeException)
110 OExternalLockGuard aGuard( this );
111 Rectangle aBounds( implGetBounds() );
112 return Size( aBounds.Width, aBounds.Height );
115 //--------------------------------------------------------------------
116 Rectangle SAL_CALL OCommonAccessibleComponent::getBounds( ) throw (RuntimeException)
118 OExternalLockGuard aGuard( this );
119 return implGetBounds();
122 //=====================================================================
123 //= OAccessibleComponentHelper
124 //=====================================================================
125 //---------------------------------------------------------------------
126 OAccessibleComponentHelper::OAccessibleComponentHelper( )
130 //---------------------------------------------------------------------
131 OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock )
132 :OCommonAccessibleComponent( _pExternalLock )
136 //--------------------------------------------------------------------
137 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
138 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
139 // (order matters: the first is the class name, the second is the class doing the ref counting)
141 //--------------------------------------------------------------------
142 sal_Bool SAL_CALL OAccessibleComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException)
144 return OCommonAccessibleComponent::containsPoint( _rPoint );
147 //--------------------------------------------------------------------
148 Point SAL_CALL OAccessibleComponentHelper::getLocation( ) throw (RuntimeException)
150 return OCommonAccessibleComponent::getLocation( );
153 //--------------------------------------------------------------------
154 Point SAL_CALL OAccessibleComponentHelper::getLocationOnScreen( ) throw (RuntimeException)
156 return OCommonAccessibleComponent::getLocationOnScreen( );
159 //--------------------------------------------------------------------
160 Size SAL_CALL OAccessibleComponentHelper::getSize( ) throw (RuntimeException)
162 return OCommonAccessibleComponent::getSize( );
165 //--------------------------------------------------------------------
166 Rectangle SAL_CALL OAccessibleComponentHelper::getBounds( ) throw (RuntimeException)
168 return OCommonAccessibleComponent::getBounds( );
171 //=====================================================================
172 //= OAccessibleExtendedComponentHelper
173 //=====================================================================
174 //---------------------------------------------------------------------
175 OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( )
179 //---------------------------------------------------------------------
180 OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock )
181 :OCommonAccessibleComponent( _pExternalLock )
185 //--------------------------------------------------------------------
186 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
187 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
188 // (order matters: the first is the class name, the second is the class doing the ref counting)
190 //--------------------------------------------------------------------
191 sal_Bool SAL_CALL OAccessibleExtendedComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException)
193 return OCommonAccessibleComponent::containsPoint( _rPoint );
196 //--------------------------------------------------------------------
197 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocation( ) throw (RuntimeException)
199 return OCommonAccessibleComponent::getLocation( );
202 //--------------------------------------------------------------------
203 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocationOnScreen( ) throw (RuntimeException)
205 return OCommonAccessibleComponent::getLocationOnScreen( );
208 //--------------------------------------------------------------------
209 Size SAL_CALL OAccessibleExtendedComponentHelper::getSize( ) throw (RuntimeException)
211 return OCommonAccessibleComponent::getSize( );
214 //--------------------------------------------------------------------
215 Rectangle SAL_CALL OAccessibleExtendedComponentHelper::getBounds( ) throw (RuntimeException)
217 return OCommonAccessibleComponent::getBounds( );
220 //.........................................................................
221 } // namespace comphelper
222 //.........................................................................