Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <comphelper/accessiblecomponenthelper.hxx>
21 :
22 :
23 : namespace comphelper
24 : {
25 :
26 :
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;
31 :
32 3663 : OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock )
33 3663 : :OAccessibleContextHelper( _pExternalLock )
34 : {
35 3663 : }
36 :
37 :
38 3626 : OCommonAccessibleComponent::~OCommonAccessibleComponent( )
39 : {
40 3626 : }
41 :
42 :
43 6460 : bool SAL_CALL OCommonAccessibleComponent::containsPoint( const Point& _rPoint ) throw (RuntimeException)
44 : {
45 6460 : OExternalLockGuard aGuard( this );
46 6460 : Rectangle aBounds( implGetBounds() );
47 6460 : return ( _rPoint.X >= 0 )
48 5353 : && ( _rPoint.Y >= 0 )
49 3245 : && ( _rPoint.X < aBounds.Width )
50 8610 : && ( _rPoint.Y < aBounds.Height );
51 : }
52 :
53 :
54 1253 : Point SAL_CALL OCommonAccessibleComponent::getLocation( ) throw (RuntimeException)
55 : {
56 1253 : OExternalLockGuard aGuard( this );
57 1253 : Rectangle aBounds( implGetBounds() );
58 1253 : return Point( aBounds.X, aBounds.Y );
59 : }
60 :
61 :
62 1247 : Point SAL_CALL OCommonAccessibleComponent::getLocationOnScreen( ) throw (RuntimeException)
63 : {
64 1247 : OExternalLockGuard aGuard( this );
65 :
66 1247 : Point aScreenLoc( 0, 0 );
67 :
68 2494 : Reference< XAccessibleComponent > xParentComponent( implGetParentContext(), UNO_QUERY );
69 : OSL_ENSURE( xParentComponent.is(), "OCommonAccessibleComponent::getLocationOnScreen: no parent component!" );
70 1247 : if ( xParentComponent.is() )
71 : {
72 1247 : Point aParentScreenLoc( xParentComponent->getLocationOnScreen() );
73 1247 : Point aOwnRelativeLoc( getLocation() );
74 1247 : aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
75 1247 : aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
76 : }
77 :
78 2494 : return aScreenLoc;
79 : }
80 :
81 :
82 6 : Size SAL_CALL OCommonAccessibleComponent::getSize( ) throw (RuntimeException)
83 : {
84 6 : OExternalLockGuard aGuard( this );
85 6 : Rectangle aBounds( implGetBounds() );
86 6 : return Size( aBounds.Width, aBounds.Height );
87 : }
88 :
89 :
90 1322 : Rectangle SAL_CALL OCommonAccessibleComponent::getBounds( ) throw (RuntimeException)
91 : {
92 1322 : OExternalLockGuard aGuard( this );
93 1322 : return implGetBounds();
94 : }
95 :
96 29 : OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock )
97 29 : :OCommonAccessibleComponent( _pExternalLock )
98 : {
99 29 : }
100 :
101 :
102 1073 : IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
103 0 : 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)
105 :
106 :
107 0 : sal_Bool SAL_CALL OAccessibleComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException, std::exception)
108 : {
109 0 : return OCommonAccessibleComponent::containsPoint( _rPoint );
110 : }
111 :
112 :
113 0 : Point SAL_CALL OAccessibleComponentHelper::getLocation( ) throw (RuntimeException, std::exception)
114 : {
115 0 : return OCommonAccessibleComponent::getLocation( );
116 : }
117 :
118 :
119 0 : Point SAL_CALL OAccessibleComponentHelper::getLocationOnScreen( ) throw (RuntimeException, std::exception)
120 : {
121 0 : return OCommonAccessibleComponent::getLocationOnScreen( );
122 : }
123 :
124 :
125 0 : Size SAL_CALL OAccessibleComponentHelper::getSize( ) throw (RuntimeException, std::exception)
126 : {
127 0 : return OCommonAccessibleComponent::getSize( );
128 : }
129 :
130 :
131 0 : Rectangle SAL_CALL OAccessibleComponentHelper::getBounds( ) throw (RuntimeException, std::exception)
132 : {
133 0 : return OCommonAccessibleComponent::getBounds( );
134 : }
135 :
136 3634 : OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock )
137 3634 : :OCommonAccessibleComponent( _pExternalLock )
138 : {
139 3634 : }
140 :
141 :
142 280568 : IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
143 0 : 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)
145 :
146 :
147 6460 : sal_Bool SAL_CALL OAccessibleExtendedComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException, std::exception)
148 : {
149 6460 : return OCommonAccessibleComponent::containsPoint( _rPoint );
150 : }
151 :
152 :
153 6 : Point SAL_CALL OAccessibleExtendedComponentHelper::getLocation( ) throw (RuntimeException, std::exception)
154 : {
155 6 : return OCommonAccessibleComponent::getLocation( );
156 : }
157 :
158 :
159 1247 : Point SAL_CALL OAccessibleExtendedComponentHelper::getLocationOnScreen( ) throw (RuntimeException, std::exception)
160 : {
161 1247 : return OCommonAccessibleComponent::getLocationOnScreen( );
162 : }
163 :
164 :
165 6 : Size SAL_CALL OAccessibleExtendedComponentHelper::getSize( ) throw (RuntimeException, std::exception)
166 : {
167 6 : return OCommonAccessibleComponent::getSize( );
168 : }
169 :
170 :
171 1322 : Rectangle SAL_CALL OAccessibleExtendedComponentHelper::getBounds( ) throw (RuntimeException, std::exception)
172 : {
173 1322 : return OCommonAccessibleComponent::getBounds( );
174 : }
175 :
176 :
177 : } // namespace comphelper
178 :
179 :
180 :
181 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|