1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _CHART2_ACCESSIBLECHARTELEMENT_HXX_
28 #define _CHART2_ACCESSIBLECHARTELEMENT_HXX_
29 
30 #include "AccessibleBase.hxx"
31 #include <com/sun/star/chart2/XChartDocument.hpp>
32 #include <com/sun/star/accessibility/XAccessible.hpp>
33 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
34 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/document/XEventListener.hpp>
37 #include <com/sun/star/lang/XEventListener.hpp>
38 #include <com/sun/star/lang/DisposedException.hpp>
39 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
40 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
41 #include <com/sun/star/view/XSelectionSupplier.hpp>
42 #include <comphelper/accessibleeventnotifier.hxx>
43 #include <cppuhelper/implbase1.hxx>
44 #include <cppuhelper/interfacecontainer.hxx>
45 #include <unotools/accessiblestatesethelper.hxx>
46 
47 #include <vector>
48 #include <map>
49 #include <boost/shared_ptr.hpp>
50 
51 class SfxItemSet;
52 class SdrObject;
53 
54 namespace chart
55 {
56 
57 /** Base class for all Chart Accessibility objects except the root node (see AccessibleChartView)
58 
59     This class contains a reference to the ChartModel, thus, components can easily access all core functionality.
60 
61     Usage Instructions:
62 
63     <ul>
64      <li>define the getAccessibleName() method of XAccessibleContext</li>
65      <li>set the ChartModel using SetChartModel() for the first node before
66          creating any children</li>
67      <li>overload UpdateChildren()</li>
68     </ul>
69  */
70 
71 namespace impl
72 {
73 typedef ::cppu::ImplInheritanceHelper1<
74         AccessibleBase,
75         ::com::sun::star::accessibility::XAccessibleExtendedComponent
76         > AccessibleChartElement_Base;
77 }
78 
79 class AccessibleChartElement :
80     public impl::AccessibleChartElement_Base
81 {
82 public:
83     AccessibleChartElement( const AccessibleElementInfo & rAccInfo,
84                             bool bMayHaveChildren,
85                             bool bAlwaysTransparent = false );
86     virtual ~AccessibleChartElement();
87 
88     // ________ AccessibleBase ________
89     virtual bool ImplUpdateChildren();
90     virtual ::com::sun::star::uno::Reference<
91             ::com::sun::star::accessibility::XAccessible >
92         ImplGetAccessibleChildById( sal_Int32 i ) const
93         throw (::com::sun::star::lang::IndexOutOfBoundsException,
94                ::com::sun::star::uno::RuntimeException);
95     virtual sal_Int32 ImplGetAccessibleChildCount() const
96         throw (::com::sun::star::uno::RuntimeException);
97 
98     // ________ XAccessibleContext ________
99     virtual ::rtl::OUString SAL_CALL getAccessibleName()
100         throw (::com::sun::star::uno::RuntimeException);
101     virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
102         throw (::com::sun::star::uno::RuntimeException);
103 
104     // ________ XAccessibleExtendedComponent ________
105     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont()
106         throw (::com::sun::star::uno::RuntimeException);
107     virtual ::rtl::OUString SAL_CALL getTitledBorderText()
108         throw (::com::sun::star::uno::RuntimeException);
109     virtual ::rtl::OUString SAL_CALL getToolTipText()
110         throw (::com::sun::star::uno::RuntimeException);
111 
112     // the following interface is implemented in AccessibleBase, however it is
113     // also a (non-virtual) base class of XAccessibleExtendedComponent Thus
114     // these methods have to be overloaded and forward to AccessibleBase
115 
116     // ________ XAccessibleComponent ________
117     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
118     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);
119     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
120     virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
121     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
122     virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
123     virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
124     virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException);
125     virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException);
126 
127     // ________ XServiceInfo ________
128     virtual ::rtl::OUString SAL_CALL getImplementationName()
129         throw (::com::sun::star::uno::RuntimeException);
130 
131 private:
132     bool                m_bHasText;
133     ::com::sun::star::uno::Reference<
134             ::com::sun::star::accessibility::XAccessibleContext >
135                         m_xTextHelper;
136 
137     void InitTextEdit();
138 };
139 
140 }  // namespace chart
141 
142 #endif
143