1c82f2877SAndrew Rist /**************************************************************
2*15466770Smseidel  *
3c82f2877SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c82f2877SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c82f2877SAndrew Rist  * distributed with this work for additional information
6c82f2877SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c82f2877SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c82f2877SAndrew Rist  * "License"); you may not use this file except in compliance
9c82f2877SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*15466770Smseidel  *
11c82f2877SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*15466770Smseidel  *
13c82f2877SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c82f2877SAndrew Rist  * software distributed under the License is distributed on an
15c82f2877SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c82f2877SAndrew Rist  * KIND, either express or implied.  See the License for the
17c82f2877SAndrew Rist  * specific language governing permissions and limitations
18c82f2877SAndrew Rist  * under the License.
19*15466770Smseidel  *
20c82f2877SAndrew Rist  *************************************************************/
21c82f2877SAndrew Rist 
22c82f2877SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
26cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletextfield.hxx>
27cdf0e10cSrcweir #include <vcl/lstbox.hxx>
28cdf0e10cSrcweir #include <accessibility/helper/listboxhelper.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
32cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
33cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
34cdf0e10cSrcweir #include <vcl/svapp.hxx>
35cdf0e10cSrcweir #include <vcl/combobox.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir using namespace ::com::sun::star;
38cdf0e10cSrcweir using namespace ::com::sun::star::uno;
39cdf0e10cSrcweir using namespace ::com::sun::star::lang;
40cdf0e10cSrcweir using namespace ::com::sun::star::beans;
41cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
VCLXAccessibleTextField(VCLXWindow * pVCLWindow,const Reference<XAccessible> & _xParent)46cdf0e10cSrcweir VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) :
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	VCLXAccessibleTextComponent (pVCLWindow),
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	m_xParent( _xParent )
51cdf0e10cSrcweir 
52cdf0e10cSrcweir {
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
~VCLXAccessibleTextField(void)58cdf0e10cSrcweir VCLXAccessibleTextField::~VCLXAccessibleTextField (void)
59cdf0e10cSrcweir {
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
implGetText(void)65cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextField::implGetText (void)
66cdf0e10cSrcweir {
67*15466770Smseidel 	::rtl::OUString aText;
68*15466770Smseidel 	ListBox* pListBox = static_cast<ListBox*>(GetWindow());
69*15466770Smseidel 	if (pListBox!=NULL && !pListBox->IsInDropDown())
70cdf0e10cSrcweir 		aText = pListBox->GetSelectEntry();
71cdf0e10cSrcweir 
72*15466770Smseidel 	return aText;
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField,VCLXAccessibleTextComponent,VCLXAccessible_BASE)78cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
79cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 
82cdf0e10cSrcweir //=====  XAccessible  =========================================================
83cdf0e10cSrcweir 
84cdf0e10cSrcweir Reference<XAccessibleContext> SAL_CALL
85*15466770Smseidel 	VCLXAccessibleTextField::getAccessibleContext (void)
86*15466770Smseidel 	throw (RuntimeException)
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 	return this;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 
92cdf0e10cSrcweir //=====  XAccessibleContext  ==================================================
93cdf0e10cSrcweir 
getAccessibleChildCount(void)94cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount (void)
95*15466770Smseidel 	throw (RuntimeException)
96cdf0e10cSrcweir {
97*15466770Smseidel 	return 0;
98cdf0e10cSrcweir }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
getAccessibleChild(sal_Int32)103cdf0e10cSrcweir Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32)
104*15466770Smseidel 	throw (IndexOutOfBoundsException, RuntimeException)
105cdf0e10cSrcweir {
106*15466770Smseidel 	throw IndexOutOfBoundsException();
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
getAccessibleRole(void)112cdf0e10cSrcweir sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole (void)
113*15466770Smseidel 	throw (RuntimeException)
114cdf0e10cSrcweir {
115cdf0e10cSrcweir 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
116cdf0e10cSrcweir 
117*15466770Smseidel 	return AccessibleRole::TEXT;
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
getAccessibleParent()120cdf0e10cSrcweir Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent(  )
121cdf0e10cSrcweir 	throw (RuntimeException)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	return m_xParent;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 
130cdf0e10cSrcweir //===== XServiceInfo ==========================================================
131cdf0e10cSrcweir 
getImplementationName(void)132cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextField::getImplementationName (void)
133*15466770Smseidel 	throw (RuntimeException)
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii ("com.sun.star.comp.toolkit.AccessibleTextField");
136cdf0e10cSrcweir }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 
getSupportedServiceNames(void)141cdf0e10cSrcweir Sequence< ::rtl::OUString > VCLXAccessibleTextField::getSupportedServiceNames (void)
142*15466770Smseidel 	throw (RuntimeException)
143cdf0e10cSrcweir {
144cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aNames = VCLXAccessibleTextComponent::getSupportedServiceNames();
145cdf0e10cSrcweir 	sal_Int32 nLength = aNames.getLength();
146cdf0e10cSrcweir 	aNames.realloc( nLength + 1 );
147cdf0e10cSrcweir 	aNames[nLength] = ::rtl::OUString::createFromAscii(
148*15466770Smseidel 		"com.sun.star.accessibility.AccessibleTextField");
149cdf0e10cSrcweir 	return aNames;
150cdf0e10cSrcweir }
151