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