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         throw (::com::sun::star::lang::IndexOutOfBoundsException,
90                ::com::sun::star::uno::RuntimeException);
91     virtual sal_Int32 ImplGetAccessibleChildCount() const
92         throw (::com::sun::star::uno::RuntimeException);
93 
94     // ________ XAccessibleContext ________
95     virtual ::rtl::OUString SAL_CALL getAccessibleName()
96         throw (::com::sun::star::uno::RuntimeException);
97     virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
98         throw (::com::sun::star::uno::RuntimeException);
99 
100     // ________ XAccessibleExtendedComponent ________
101     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont()
102         throw (::com::sun::star::uno::RuntimeException);
103     virtual ::rtl::OUString SAL_CALL getTitledBorderText()
104         throw (::com::sun::star::uno::RuntimeException);
105     virtual ::rtl::OUString SAL_CALL getToolTipText()
106         throw (::com::sun::star::uno::RuntimeException);
107 
108     // the following interface is implemented in AccessibleBase, however it is
109     // also a (non-virtual) base class of XAccessibleExtendedComponent Thus
110     // these methods have to be overloaded and forward to AccessibleBase
111 
112     // ________ XAccessibleComponent ________
113     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
114     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
115     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
116     virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
117     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
118     virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
119     virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
120     virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException);
121     virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException);
122 
123     // ________ XServiceInfo ________
124     virtual ::rtl::OUString SAL_CALL getImplementationName()
125         throw (::com::sun::star::uno::RuntimeException);
126 
127 private:
128     bool                m_bHasText;
129     ::com::sun::star::uno::Reference<
130             ::com::sun::star::accessibility::XAccessibleContext >
131                         m_xTextHelper;
132 
133     void InitTextEdit();
134 };
135 
136 }  // namespace chart
137 
138 #endif
139