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 : #ifndef INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
21 : #define INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
22 :
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>
29 :
30 :
31 : namespace comphelper
32 : {
33 :
34 :
35 :
36 : //= OCommonAccessibleComponent
37 :
38 : /** base class encapsulating common functionality for the helper classes implementing
39 : the XAccessibleComponent respectively XAccessibleExtendendComponent
40 : */
41 : class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper
42 : {
43 : protected:
44 : /// see the respective base class ctor for an extensive comment on this, please
45 : OCommonAccessibleComponent( IMutex* _pExternalLock );
46 : virtual ~OCommonAccessibleComponent();
47 :
48 : protected:
49 : /// implements the calculation of the bounding rectangle - still waiting to be overwritten
50 : virtual ::com::sun::star::awt::Rectangle implGetBounds( ) throw (::com::sun::star::uno::RuntimeException) = 0;
51 :
52 : protected:
53 : /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
54 : note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
55 : which itself implements XAccessibleComponent
56 : */
57 : bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
58 : ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
59 : ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
60 : ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
61 : ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
62 : };
63 :
64 :
65 : //= OAccessibleComponentHelper
66 :
67 :
68 0 : struct OAccessibleComponentHelper_Base :
69 : public ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleComponent >
70 : {
71 : protected:
72 0 : ~OAccessibleComponentHelper_Base() {}
73 : };
74 :
75 : /** a helper class for implementing an AccessibleContext which at the same time
76 : supports an XAccessibleComponent interface.
77 : */
78 0 : class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
79 : :public OCommonAccessibleComponent
80 : ,public OAccessibleComponentHelper_Base
81 : {
82 : protected:
83 : /// see the respective base class ctor for an extensive comment on this, please
84 : OAccessibleComponentHelper( IMutex* _pExternalLock );
85 :
86 : public:
87 : // XInterface
88 : DECLARE_XINTERFACE( )
89 : DECLARE_XTYPEPROVIDER( )
90 :
91 : // XAccessibleComponent - default implementations
92 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : };
98 :
99 :
100 : //= OAccessibleExtendedComponentHelper
101 :
102 :
103 : typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleExtendedComponent
104 : > OAccessibleExtendedComponentHelper_Base;
105 :
106 : /** a helper class for implementing an AccessibleContext which at the same time
107 : supports an XAccessibleExtendedComponent interface.
108 : */
109 0 : class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
110 : :public OCommonAccessibleComponent
111 : ,public OAccessibleExtendedComponentHelper_Base
112 : {
113 : protected:
114 : /// see the respective base class ctor for an extensive comment on this, please
115 : OAccessibleExtendedComponentHelper( IMutex* _pExternalLock );
116 :
117 : public:
118 : // XInterface
119 : DECLARE_XINTERFACE( )
120 : DECLARE_XTYPEPROVIDER( )
121 :
122 : // XAccessibleComponent - default implementations
123 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : };
129 :
130 :
131 : } // namespace comphelper
132 :
133 :
134 : #endif // INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
135 :
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|