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 :
33 : //= OCommonAccessibleComponent
34 :
35 :
36 0 : OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock )
37 0 : :OAccessibleContextHelper( _pExternalLock )
38 : {
39 0 : }
40 :
41 :
42 0 : OCommonAccessibleComponent::~OCommonAccessibleComponent( )
43 : {
44 0 : }
45 :
46 :
47 0 : bool SAL_CALL OCommonAccessibleComponent::containsPoint( const Point& _rPoint ) throw (RuntimeException)
48 : {
49 0 : OExternalLockGuard aGuard( this );
50 0 : Rectangle aBounds( implGetBounds() );
51 0 : return ( _rPoint.X >= 0 )
52 0 : && ( _rPoint.Y >= 0 )
53 0 : && ( _rPoint.X < aBounds.Width )
54 0 : && ( _rPoint.Y < aBounds.Height );
55 : }
56 :
57 :
58 0 : Point SAL_CALL OCommonAccessibleComponent::getLocation( ) throw (RuntimeException)
59 : {
60 0 : OExternalLockGuard aGuard( this );
61 0 : Rectangle aBounds( implGetBounds() );
62 0 : return Point( aBounds.X, aBounds.Y );
63 : }
64 :
65 :
66 0 : Point SAL_CALL OCommonAccessibleComponent::getLocationOnScreen( ) throw (RuntimeException)
67 : {
68 0 : OExternalLockGuard aGuard( this );
69 :
70 0 : Point aScreenLoc( 0, 0 );
71 :
72 0 : Reference< XAccessibleComponent > xParentComponent( implGetParentContext(), UNO_QUERY );
73 : OSL_ENSURE( xParentComponent.is(), "OCommonAccessibleComponent::getLocationOnScreen: no parent component!" );
74 0 : if ( xParentComponent.is() )
75 : {
76 0 : Point aParentScreenLoc( xParentComponent->getLocationOnScreen() );
77 0 : Point aOwnRelativeLoc( getLocation() );
78 0 : aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
79 0 : aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
80 : }
81 :
82 0 : return aScreenLoc;
83 : }
84 :
85 :
86 0 : Size SAL_CALL OCommonAccessibleComponent::getSize( ) throw (RuntimeException)
87 : {
88 0 : OExternalLockGuard aGuard( this );
89 0 : Rectangle aBounds( implGetBounds() );
90 0 : return Size( aBounds.Width, aBounds.Height );
91 : }
92 :
93 :
94 0 : Rectangle SAL_CALL OCommonAccessibleComponent::getBounds( ) throw (RuntimeException)
95 : {
96 0 : OExternalLockGuard aGuard( this );
97 0 : return implGetBounds();
98 : }
99 :
100 :
101 : //= OAccessibleComponentHelper
102 :
103 :
104 0 : OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock )
105 0 : :OCommonAccessibleComponent( _pExternalLock )
106 : {
107 0 : }
108 :
109 :
110 0 : IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
111 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleComponentHelper, OCommonAccessibleComponent, OAccessibleComponentHelper_Base )
112 : // (order matters: the first is the class name, the second is the class doing the ref counting)
113 :
114 :
115 0 : sal_Bool SAL_CALL OAccessibleComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException, std::exception)
116 : {
117 0 : return OCommonAccessibleComponent::containsPoint( _rPoint );
118 : }
119 :
120 :
121 0 : Point SAL_CALL OAccessibleComponentHelper::getLocation( ) throw (RuntimeException, std::exception)
122 : {
123 0 : return OCommonAccessibleComponent::getLocation( );
124 : }
125 :
126 :
127 0 : Point SAL_CALL OAccessibleComponentHelper::getLocationOnScreen( ) throw (RuntimeException, std::exception)
128 : {
129 0 : return OCommonAccessibleComponent::getLocationOnScreen( );
130 : }
131 :
132 :
133 0 : Size SAL_CALL OAccessibleComponentHelper::getSize( ) throw (RuntimeException, std::exception)
134 : {
135 0 : return OCommonAccessibleComponent::getSize( );
136 : }
137 :
138 :
139 0 : Rectangle SAL_CALL OAccessibleComponentHelper::getBounds( ) throw (RuntimeException, std::exception)
140 : {
141 0 : return OCommonAccessibleComponent::getBounds( );
142 : }
143 :
144 :
145 : //= OAccessibleExtendedComponentHelper
146 :
147 :
148 0 : OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock )
149 0 : :OCommonAccessibleComponent( _pExternalLock )
150 : {
151 0 : }
152 :
153 :
154 0 : IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
155 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleExtendedComponentHelper, OCommonAccessibleComponent, OAccessibleExtendedComponentHelper_Base )
156 : // (order matters: the first is the class name, the second is the class doing the ref counting)
157 :
158 :
159 0 : sal_Bool SAL_CALL OAccessibleExtendedComponentHelper::containsPoint( const Point& _rPoint ) throw (RuntimeException, std::exception)
160 : {
161 0 : return OCommonAccessibleComponent::containsPoint( _rPoint );
162 : }
163 :
164 :
165 0 : Point SAL_CALL OAccessibleExtendedComponentHelper::getLocation( ) throw (RuntimeException, std::exception)
166 : {
167 0 : return OCommonAccessibleComponent::getLocation( );
168 : }
169 :
170 :
171 0 : Point SAL_CALL OAccessibleExtendedComponentHelper::getLocationOnScreen( ) throw (RuntimeException, std::exception)
172 : {
173 0 : return OCommonAccessibleComponent::getLocationOnScreen( );
174 : }
175 :
176 :
177 0 : Size SAL_CALL OAccessibleExtendedComponentHelper::getSize( ) throw (RuntimeException, std::exception)
178 : {
179 0 : return OCommonAccessibleComponent::getSize( );
180 : }
181 :
182 :
183 0 : Rectangle SAL_CALL OAccessibleExtendedComponentHelper::getBounds( ) throw (RuntimeException, std::exception)
184 : {
185 0 : return OCommonAccessibleComponent::getBounds( );
186 : }
187 :
188 :
189 : } // namespace comphelper
190 :
191 :
192 :
193 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|