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 
24 #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX
25 #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX
26 
27 #include <accessibility/standard/vclxaccessibletextcomponent.hxx>
28 
29 #ifndef _CPPUHELPER_IMPLBASE1_HXX
30 #include <cppuhelper/implbase1.hxx>
31 #endif
32 
33 typedef ::cppu::ImplHelper1<
34     ::com::sun::star::accessibility::XAccessible
35     > VCLXAccessible_BASE;
36 
37 
38 /** This class represents non editable text fields.  The object passed to
39     the constructor is expected to be a list (a <type>ListBox</type> to be
40     more specific).  From this allways the selected item is token to be made
41     accessible by this class.  When the selected item changes then also the
42     exported text changes.
43 */
44 class VCLXAccessibleTextField :
45     public VCLXAccessibleTextComponent,
46     public VCLXAccessible_BASE
47 {
48 public:
49 	VCLXAccessibleTextField (VCLXWindow* pVCLXindow,
50 							 const ::com::sun::star::uno::Reference<
51 							 	::com::sun::star::accessibility::XAccessible >& _xParent);
52 
53     // XInterface
54 	DECLARE_XINTERFACE()
55 
56 	// XTypeProvider
57 	DECLARE_XTYPEPROVIDER()
58 
59 	// XAccessible
60     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
61         getAccessibleContext (void)
62         throw (::com::sun::star::uno::RuntimeException);
63 
64     // XAccessibleContext
65     sal_Int32 SAL_CALL getAccessibleChildCount (void)
66         throw (::com::sun::star::uno::RuntimeException);
67     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
68         getAccessibleChild (sal_Int32 i)
69         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
70 	sal_Int16 SAL_CALL getAccessibleRole (void)
71         throw (::com::sun::star::uno::RuntimeException);
72     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
73 		getAccessibleParent(  )
74 		throw (::com::sun::star::uno::RuntimeException);
75 
76 	// XServiceInfo
77 	virtual ::rtl::OUString SAL_CALL getImplementationName (void)
78         throw (::com::sun::star::uno::RuntimeException);
79     // Return text field specific services.
80 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
81         getSupportedServiceNames (void)
82         throw (::com::sun::star::uno::RuntimeException);
83 
84 protected:
85 	virtual ~VCLXAccessibleTextField (void);
86 
87     /** With this method the text of the currently selected item is made
88         available to the <type>VCLXAccessibleTextComponent</type> base class.
89     */
90     ::rtl::OUString implGetText (void);
91 
92 private:
93     /** We need to save the accessible parent to return it in <type>getAccessibleParent()</type>,
94 		because this method of the base class returns the wrong parent.
95     */
96 	::com::sun::star::uno::Reference<
97 		::com::sun::star::accessibility::XAccessible >	m_xParent;
98 };
99 
100 #endif
101 
102