10841af79SAndrew Rist /**************************************************************
2*09e0ec10Smseidel  *
30841af79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
40841af79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
50841af79SAndrew Rist  * distributed with this work for additional information
60841af79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
70841af79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
80841af79SAndrew Rist  * "License"); you may not use this file except in compliance
90841af79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*09e0ec10Smseidel  *
110841af79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*09e0ec10Smseidel  *
130841af79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
140841af79SAndrew Rist  * software distributed under the License is distributed on an
150841af79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
160841af79SAndrew Rist  * KIND, either express or implied.  See the License for the
170841af79SAndrew Rist  * specific language governing permissions and limitations
180841af79SAndrew Rist  * under the License.
19*09e0ec10Smseidel  *
200841af79SAndrew Rist  *************************************************************/
210841af79SAndrew Rist 
220841af79SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
26cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibledropdowncombobox.hxx>
27cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblecombobox.hxx>
28cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletextfield.hxx>
29cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblelist.hxx>
30cdf0e10cSrcweir #include <accessibility/helper/accresmgr.hxx>
31cdf0e10cSrcweir #include <accessibility/helper/accessiblestrings.hrc>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
34cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
35cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
36cdf0e10cSrcweir #include <tools/debug.hxx>
37cdf0e10cSrcweir #include <vcl/svapp.hxx>
38cdf0e10cSrcweir #include <vcl/combobox.hxx>
39cdf0e10cSrcweir #include <vcl/unohelp.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
42cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <comphelper/sequence.hxx>
45cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
46cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir using namespace ::com::sun::star;
50cdf0e10cSrcweir using namespace ::com::sun::star::lang;
51cdf0e10cSrcweir using namespace ::com::sun::star::uno;
52cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 
VCLXAccessibleDropDownComboBox(VCLXWindow * pVCLWindow)55*09e0ec10Smseidel VCLXAccessibleDropDownComboBox::VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLWindow)
56*09e0ec10Smseidel 	: VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::COMBOBOX, true)
57cdf0e10cSrcweir {
58cdf0e10cSrcweir }
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 
~VCLXAccessibleDropDownComboBox(void)63cdf0e10cSrcweir VCLXAccessibleDropDownComboBox::~VCLXAccessibleDropDownComboBox (void)
64cdf0e10cSrcweir {
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
IsValid(void) const69cdf0e10cSrcweir bool VCLXAccessibleDropDownComboBox::IsValid (void) const
70cdf0e10cSrcweir {
71*09e0ec10Smseidel 	return static_cast<ComboBox*>(GetWindow()) != NULL;
72*09e0ec10Smseidel 
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
ProcessWindowEvent(const VclWindowEvent & rVclWindowEvent)78cdf0e10cSrcweir void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	switch ( rVclWindowEvent.GetId() )
81cdf0e10cSrcweir 	{
82cdf0e10cSrcweir 		case VCLEVENT_DROPDOWN_OPEN:
83cdf0e10cSrcweir 		case VCLEVENT_DROPDOWN_CLOSE:
84cdf0e10cSrcweir 		{
85*09e0ec10Smseidel 			/*			// child count changed
86cdf0e10cSrcweir 			Any aOldValue, aNewValue;
87cdf0e10cSrcweir 			// get the listbox child
88cdf0e10cSrcweir 			Reference< XAccessible > xChild;
89cdf0e10cSrcweir 			if ( !xChild.is() )
90cdf0e10cSrcweir 			{
91cdf0e10cSrcweir 				try
92cdf0e10cSrcweir 				{
93cdf0e10cSrcweir 					// the listbox is the second child
94cdf0e10cSrcweir 					xChild = getAccessibleChild(1);
95cdf0e10cSrcweir 				}
96cdf0e10cSrcweir 				catch ( IndexOutOfBoundsException& ) {}
97cdf0e10cSrcweir 				catch ( RuntimeException& ) {}
98cdf0e10cSrcweir 			}
99cdf0e10cSrcweir 			if ( rVclWindowEvent.GetId() == VCLEVENT_DROPDOWN_OPEN )
100cdf0e10cSrcweir 				aNewValue <<= xChild;
101cdf0e10cSrcweir 			else
102cdf0e10cSrcweir 				aOldValue <<= xChild;
103cdf0e10cSrcweir 			NotifyAccessibleEvent(
104cdf0e10cSrcweir 			AccessibleEventId::CHILD, aOldValue, aNewValue
105cdf0e10cSrcweir 			);
106*09e0ec10Smseidel 			*/
107cdf0e10cSrcweir 			break;
108cdf0e10cSrcweir 		}
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 		default:
111cdf0e10cSrcweir 			VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
112cdf0e10cSrcweir 	}
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 
118cdf0e10cSrcweir //=====  XServiceInfo  ========================================================
119cdf0e10cSrcweir 
getImplementationName()120*09e0ec10Smseidel ::rtl::OUString VCLXAccessibleDropDownComboBox::getImplementationName()
121*09e0ec10Smseidel 	throw (RuntimeException)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.AccessibleDropDownComboBox");
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
getSupportedServiceNames(void)129*09e0ec10Smseidel Sequence< ::rtl::OUString > VCLXAccessibleDropDownComboBox::getSupportedServiceNames (void)
130*09e0ec10Smseidel 	throw (RuntimeException)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames();
133cdf0e10cSrcweir 	sal_Int32 nLength = aNames.getLength();
134cdf0e10cSrcweir 	aNames.realloc( nLength + 1 );
135cdf0e10cSrcweir 	aNames[nLength] = ::rtl::OUString::createFromAscii(
136*09e0ec10Smseidel 		"com.sun.star.accessibility.AccessibleDropDownComboBox" );
137cdf0e10cSrcweir 	return aNames;
138cdf0e10cSrcweir }
139