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 COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
21 : #define COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_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 : OCommonAccessibleComponent();
45 : /// see the respective base class ctor for an extensive comment on this, please
46 : OCommonAccessibleComponent( IMutex* _pExternalLock );
47 : ~OCommonAccessibleComponent();
48 :
49 : protected:
50 : /// implements the calculation of the bounding rectangle - still waiting to be overwritten
51 : virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException) = 0;
52 :
53 : protected:
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
57 : */
58 : sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
59 : ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
60 : ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
61 : ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
62 : ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
63 : };
64 :
65 : //=====================================================================
66 : //= OAccessibleComponentHelper
67 : //=====================================================================
68 :
69 29 : struct OAccessibleComponentHelper_Base :
70 : public ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleComponent >
71 : {
72 : protected:
73 29 : ~OAccessibleComponentHelper_Base() {}
74 : };
75 :
76 : /** a helper class for implementing an AccessibleContext which at the same time
77 : supports an XAccessibleComponent interface.
78 : */
79 29 : class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
80 : :public OCommonAccessibleComponent
81 : ,public OAccessibleComponentHelper_Base
82 : {
83 : protected:
84 : OAccessibleComponentHelper( );
85 : /// see the respective base class ctor for an extensive comment on this, please
86 : OAccessibleComponentHelper( IMutex* _pExternalLock );
87 :
88 : public:
89 : // XInterface
90 : DECLARE_XINTERFACE( )
91 : DECLARE_XTYPEPROVIDER( )
92 :
93 : // XAccessibleComponent - default implementations
94 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
95 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
96 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
97 : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
98 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
99 : };
100 :
101 : //=====================================================================
102 : //= OAccessibleExtendedComponentHelper
103 : //=====================================================================
104 :
105 : typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleExtendedComponent
106 : > OAccessibleExtendedComponentHelper_Base;
107 :
108 : /** a helper class for implementing an AccessibleContext which at the same time
109 : supports an XAccessibleExtendedComponent interface.
110 : */
111 2662 : class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
112 : :public OCommonAccessibleComponent
113 : ,public OAccessibleExtendedComponentHelper_Base
114 : {
115 : protected:
116 : OAccessibleExtendedComponentHelper( );
117 : /// see the respective base class ctor for an extensive comment on this, please
118 : OAccessibleExtendedComponentHelper( IMutex* _pExternalLock );
119 :
120 : public:
121 : // XInterface
122 : DECLARE_XINTERFACE( )
123 : DECLARE_XTYPEPROVIDER( )
124 :
125 : // XAccessibleComponent - default implementations
126 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
127 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
128 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
129 : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
130 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
131 : };
132 :
133 : //.........................................................................
134 : } // namespace comphelper
135 : //.........................................................................
136 :
137 : #endif // COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
138 :
139 :
140 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|