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_ACCESSIBLETEXTHELPER_HXX
24 #define CHART2_ACCESSIBLETEXTHELPER_HXX
25 
26 #include "MutexContainer.hxx"
27 #include <cppuhelper/compbase2.hxx>
28 #include <com/sun/star/lang/XInitialization.hpp>
29 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
30 
31 // forward declaration of helper class from svx
32 namespace accessibility
33 {
34 class AccessibleTextHelper;
35 }
36 
37 namespace chart
38 {
39 
40 class DrawViewWrapper;
41 
42 namespace impl
43 {
44 typedef ::cppu::WeakComponentImplHelper2<
45         ::com::sun::star::lang::XInitialization,
46         ::com::sun::star::accessibility::XAccessibleContext >
47     AccessibleTextHelper_Base;
48 }
49 
50 class AccessibleTextHelper :
51         public MutexContainer,
52         public impl::AccessibleTextHelper_Base
53 {
54 public:
55 	explicit AccessibleTextHelper( DrawViewWrapper * pDrawViewWrapper );
56 	virtual ~AccessibleTextHelper();
57 
58     // ____ XInitialization ____
59     /** Must be called at least once for this helper class to work.
60 
61         mandatory parameter 0: type string. This is the CID that is used to find
62             the corresponding drawing object that contains the text that should
63             be handled by this helper class.
64 1
65         mandatory parameter 1: type XAccessible.  Is used as EventSource for the
66             ::accessibility::AccessibleTextHelper (svx)
67 
68         mandatory parameter 2: type awt::XWindow.  The Window that shows the
69             text currently.
70      */
71     virtual void SAL_CALL initialize(
72         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
73         throw (::com::sun::star::uno::Exception,
74                ::com::sun::star::uno::RuntimeException);
75 
76     // ____ XAccessibleContext ____
77     virtual ::sal_Int32 SAL_CALL getAccessibleChildCount()
78         throw (::com::sun::star::uno::RuntimeException);
79     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild(
80         ::sal_Int32 i )
81         throw (::com::sun::star::lang::IndexOutOfBoundsException,
82                ::com::sun::star::uno::RuntimeException);
83     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent()
84         throw (::com::sun::star::uno::RuntimeException);
85     virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent()
86         throw (::com::sun::star::uno::RuntimeException);
87     virtual ::sal_Int16 SAL_CALL getAccessibleRole()
88         throw (::com::sun::star::uno::RuntimeException);
89     virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
90         throw (::com::sun::star::uno::RuntimeException);
91     virtual ::rtl::OUString SAL_CALL getAccessibleName()
92         throw (::com::sun::star::uno::RuntimeException);
93     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet()
94         throw (::com::sun::star::uno::RuntimeException);
95     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet()
96         throw (::com::sun::star::uno::RuntimeException);
97     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale()
98         throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException,
99                ::com::sun::star::uno::RuntimeException);
100 
101 private:
102     ::accessibility::AccessibleTextHelper * m_pTextHelper;
103     DrawViewWrapper *                       m_pDrawViewWrapper;
104 };
105 
106 } //  namespace chart
107 
108 // CHART2_ACCESSIBLETEXTHELPER_HXX
109 #endif
110