bump product version to 5.0.4.1
[LibreOffice.git] / comphelper / source / misc / accessiblecomponenthelper.cxx
blob4e8488d376a1f29ae417ddf97b75db90e4f59e14
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <comphelper/accessiblecomponenthelper.hxx>
23 namespace comphelper
27 using namespace ::com::sun::star::uno;
28 using namespace ::com::sun::star::awt;
29 using namespace ::com::sun::star::lang;
30 using namespace ::com::sun::star::accessibility;
32 OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock )
33 :OAccessibleContextHelper( _pExternalLock )
38 OCommonAccessibleComponent::~OCommonAccessibleComponent( )
43 bool SAL_CALL OCommonAccessibleComponent::containsPoint( const Point& _rPoint ) throw (RuntimeException)
45 OExternalLockGuard aGuard( this );
46 Rectangle aBounds( implGetBounds() );
47 return ( _rPoint.X >= 0 )
48 && ( _rPoint.Y >= 0 )
49 && ( _rPoint.X < aBounds.Width )
50 && ( _rPoint.Y < aBounds.Height );
54 Point SAL_CALL OCommonAccessibleComponent::getLocation( ) throw (RuntimeException)
56 OExternalLockGuard aGuard( this );
57 Rectangle aBounds( implGetBounds() );
58 return Point( aBounds.X, aBounds.Y );
62 Point SAL_CALL OCommonAccessibleComponent::getLocationOnScreen( ) throw (RuntimeException)
64 OExternalLockGuard aGuard( this );
66 Point aScreenLoc( 0, 0 );
68 Reference< XAccessibleComponent > xParentComponent( implGetParentContext(), UNO_QUERY );
69 OSL_ENSURE( xParentComponent.is(), "OCommonAccessibleComponent::getLocationOnScreen: no parent component!" );
70 if ( xParentComponent.is() )
72 Point aParentScreenLoc( xParentComponent->getLocationOnScreen() );
73 Point aOwnRelativeLoc( getLocation() );
74 aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
75 aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
78 return aScreenLoc;
82 Size SAL_CALL OCommonAccessibleComponent::getSize( ) throw (RuntimeException)
84 OExternalLockGuard aGuard( this );
85 Rectangle aBounds( implGetBounds() );
86 return Size( aBounds.Width, aBounds.Height );
90 Rectangle SAL_CALL OCommonAccessibleComponent::getBounds( ) throw (RuntimeException)
92 OExternalLockGuard aGuard( this );
93 return implGetBounds();
96 OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock )
97 :OCommonAccessibleComponent( _pExternalLock )
102 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
103 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
104 // (order matters: the first is the class name, the second is the class doing the ref counting)
107 sal_Bool SAL_CALL OAccessibleComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException, std::exception)
109 return OCommonAccessibleComponent::containsPoint( _rPoint );
113 Point SAL_CALL OAccessibleComponentHelper::getLocation( ) throw (RuntimeException, std::exception)
115 return OCommonAccessibleComponent::getLocation( );
119 Point SAL_CALL OAccessibleComponentHelper::getLocationOnScreen( ) throw (RuntimeException, std::exception)
121 return OCommonAccessibleComponent::getLocationOnScreen( );
125 Size SAL_CALL OAccessibleComponentHelper::getSize( ) throw (RuntimeException, std::exception)
127 return OCommonAccessibleComponent::getSize( );
131 Rectangle SAL_CALL OAccessibleComponentHelper::getBounds( ) throw (RuntimeException, std::exception)
133 return OCommonAccessibleComponent::getBounds( );
136 OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock )
137 :OCommonAccessibleComponent( _pExternalLock )
142 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
143 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
144 // (order matters: the first is the class name, the second is the class doing the ref counting)
147 sal_Bool SAL_CALL OAccessibleExtendedComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException, std::exception)
149 return OCommonAccessibleComponent::containsPoint( _rPoint );
153 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocation( ) throw (RuntimeException, std::exception)
155 return OCommonAccessibleComponent::getLocation( );
159 Point SAL_CALL OAccessibleExtendedComponentHelper::getLocationOnScreen( ) throw (RuntimeException, std::exception)
161 return OCommonAccessibleComponent::getLocationOnScreen( );
165 Size SAL_CALL OAccessibleExtendedComponentHelper::getSize( ) throw (RuntimeException, std::exception)
167 return OCommonAccessibleComponent::getSize( );
171 Rectangle SAL_CALL OAccessibleExtendedComponentHelper::getBounds( ) throw (RuntimeException, std::exception)
173 return OCommonAccessibleComponent::getBounds( );
177 } // namespace comphelper
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */