xref: /trunk/main/chart2/source/controller/accessibility/AccessibleChartElement.hxx (revision 9d37da743abb7db0a497688391f6e55a19f27c44)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _CHART2_ACCESSIBLECHARTELEMENT_HXX_
24 #define _CHART2_ACCESSIBLECHARTELEMENT_HXX_
25 
26 #include "AccessibleBase.hxx"
27 #include <com/sun/star/chart2/XChartDocument.hpp>
28 #include <com/sun/star/accessibility/XAccessible.hpp>
29 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
30 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/document/XEventListener.hpp>
33 #include <com/sun/star/lang/XEventListener.hpp>
34 #include <com/sun/star/lang/DisposedException.hpp>
35 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
36 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
37 #include <com/sun/star/view/XSelectionSupplier.hpp>
38 #include <comphelper/accessibleeventnotifier.hxx>
39 #include <cppuhelper/implbase1.hxx>
40 #include <cppuhelper/interfacecontainer.hxx>
41 #include <unotools/accessiblestatesethelper.hxx>
42 
43 #include <vector>
44 #include <map>
45 #include <boost/shared_ptr.hpp>
46 
47 class SfxItemSet;
48 class SdrObject;
49 
50 namespace chart
51 {
52 
53 /** Base class for all Chart Accessibility objects except the root node (see AccessibleChartView)
54 
55     This class contains a reference to the ChartModel, thus, components can easily access all core functionality.
56 
57     Usage Instructions:
58 
59     <ul>
60      <li>define the getAccessibleName() method of XAccessibleContext</li>
61      <li>set the ChartModel using SetChartModel() for the first node before
62          creating any children</li>
63      <li>overload UpdateChildren()</li>
64     </ul>
65  */
66 
67 namespace impl
68 {
69 typedef ::cppu::ImplInheritanceHelper1<
70         AccessibleBase,
71         ::com::sun::star::accessibility::XAccessibleExtendedComponent
72         > AccessibleChartElement_Base;
73 }
74 
75 class AccessibleChartElement :
76     public impl::AccessibleChartElement_Base
77 {
78 public:
79     AccessibleChartElement( const AccessibleElementInfo & rAccInfo,
80                             bool bMayHaveChildren,
81                             bool bAlwaysTransparent = false );
82     virtual ~AccessibleChartElement();
83 
84     // ________ AccessibleBase ________
85     virtual bool ImplUpdateChildren();
86     virtual ::com::sun::star::uno::Reference<
87             ::com::sun::star::accessibility::XAccessible >
88         ImplGetAccessibleChildById( sal_Int32 i ) const;
89     virtual sal_Int32 ImplGetAccessibleChildCount() const;
90 
91     // ________ XAccessibleContext ________
92     virtual ::rtl::OUString SAL_CALL getAccessibleName();
93     virtual ::rtl::OUString SAL_CALL getAccessibleDescription();
94 
95     // ________ XAccessibleExtendedComponent ________
96     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont();
97     virtual ::rtl::OUString SAL_CALL getTitledBorderText();
98     virtual ::rtl::OUString SAL_CALL getToolTipText();
99 
100     // the following interface is implemented in AccessibleBase, however it is
101     // also a (non-virtual) base class of XAccessibleExtendedComponent Thus
102     // these methods have to be overloaded and forward to AccessibleBase
103 
104     // ________ XAccessibleComponent ________
105     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint );
106     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint );
107     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds();
108     virtual ::com::sun::star::awt::Point SAL_CALL getLocation();
109     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen();
110     virtual ::com::sun::star::awt::Size SAL_CALL getSize();
111     virtual void SAL_CALL grabFocus();
112     virtual sal_Int32 SAL_CALL getForeground();
113     virtual sal_Int32 SAL_CALL getBackground();
114 
115     // ________ XServiceInfo ________
116     virtual ::rtl::OUString SAL_CALL getImplementationName();
117 
118 private:
119     bool                m_bHasText;
120     ::com::sun::star::uno::Reference<
121             ::com::sun::star::accessibility::XAccessibleContext >
122                         m_xTextHelper;
123 
124     void InitTextEdit();
125 };
126 
127 }  // namespace chart
128 
129 #endif
130