1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
21 #define INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
23 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
24 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
25 #include <comphelper/accessiblecontexthelper.hxx>
26 #include <cppuhelper/implbase1.hxx>
27 #include <comphelper/uno3.hxx>
28 #include <comphelper/comphelperdllapi.h>
35 //= OCommonAccessibleComponent
37 /** base class encapsulating common functionality for the helper classes implementing
38 the XAccessibleComponent respectively XAccessibleExtendendComponent
40 class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent
: public OAccessibleContextHelper
43 /// see the respective base class ctor for an extensive comment on this, please
44 OCommonAccessibleComponent( IMutex
* _pExternalLock
);
45 virtual ~OCommonAccessibleComponent() override
;
48 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
50 /// @throws css::uno::RuntimeException
51 virtual css::awt::Rectangle
implGetBounds( ) = 0;
54 /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
55 note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
56 which itself implements XAccessibleComponent
58 @throws css::uno::RuntimeException
60 bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
);
61 /// @throws css::uno::RuntimeException
62 css::awt::Point SAL_CALL
getLocation( );
63 /// @throws css::uno::RuntimeException
64 css::awt::Point SAL_CALL
getLocationOnScreen( );
65 /// @throws css::uno::RuntimeException
66 css::awt::Size SAL_CALL
getSize( );
67 /// @throws css::uno::RuntimeException
68 css::awt::Rectangle SAL_CALL
getBounds( );
72 //= OAccessibleComponentHelper
75 struct OAccessibleComponentHelper_Base
:
76 public ::cppu::ImplHelper1
< css::accessibility::XAccessibleComponent
>
79 ~OAccessibleComponentHelper_Base() {}
82 /** a helper class for implementing an AccessibleContext which at the same time
83 supports an XAccessibleComponent interface.
85 class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
86 :public OCommonAccessibleComponent
87 ,public OAccessibleComponentHelper_Base
90 /// see the respective base class ctor for an extensive comment on this, please
91 OAccessibleComponentHelper( IMutex
* _pExternalLock
);
96 DECLARE_XTYPEPROVIDER( )
98 // XAccessibleComponent - default implementations
99 virtual sal_Bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
) override
;
100 virtual css::awt::Point SAL_CALL
getLocation( ) override
;
101 virtual css::awt::Point SAL_CALL
getLocationOnScreen( ) override
;
102 virtual css::awt::Size SAL_CALL
getSize( ) override
;
103 virtual css::awt::Rectangle SAL_CALL
getBounds( ) override
;
107 //= OAccessibleExtendedComponentHelper
110 typedef ::cppu::ImplHelper1
< css::accessibility::XAccessibleExtendedComponent
111 > OAccessibleExtendedComponentHelper_Base
;
113 /** a helper class for implementing an AccessibleContext which at the same time
114 supports an XAccessibleExtendedComponent interface.
116 class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
117 :public OCommonAccessibleComponent
118 ,public OAccessibleExtendedComponentHelper_Base
121 /// see the respective base class ctor for an extensive comment on this, please
122 OAccessibleExtendedComponentHelper( IMutex
* _pExternalLock
);
126 DECLARE_XINTERFACE( )
127 DECLARE_XTYPEPROVIDER( )
129 // XAccessibleComponent - default implementations
130 virtual sal_Bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
) override
;
131 virtual css::awt::Point SAL_CALL
getLocation( ) override
;
132 virtual css::awt::Point SAL_CALL
getLocationOnScreen( ) override
;
133 virtual css::awt::Size SAL_CALL
getSize( ) override
;
134 virtual css::awt::Rectangle SAL_CALL
getBounds( ) override
;
138 } // namespace comphelper
141 #endif // INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */