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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_accessibility.hxx"
26 #include <accessibility/standard/vclxaccessibledropdowncombobox.hxx>
27 #include <accessibility/standard/vclxaccessiblecombobox.hxx>
28 #include <accessibility/standard/vclxaccessibletextfield.hxx>
29 #include <accessibility/standard/vclxaccessiblelist.hxx>
30 #include <accessibility/helper/accresmgr.hxx>
31 #include <accessibility/helper/accessiblestrings.hrc>
32 
33 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
34 #include <com/sun/star/accessibility/AccessibleRole.hpp>
35 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
36 #include <tools/debug.hxx>
37 #include <vcl/svapp.hxx>
38 #include <vcl/combobox.hxx>
39 #include <vcl/unohelp.hxx>
40 
41 #include <toolkit/awt/vclxwindow.hxx>
42 #include <toolkit/helper/convert.hxx>
43 
44 #include <comphelper/sequence.hxx>
45 #include <cppuhelper/typeprovider.hxx>
46 #include <unotools/accessiblestatesethelper.hxx>
47 
48 
49 using namespace ::com::sun::star;
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::uno;
52 using namespace ::com::sun::star::accessibility;
53 
54 
VCLXAccessibleDropDownComboBox(VCLXWindow * pVCLWindow)55 VCLXAccessibleDropDownComboBox::VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLWindow)
56     : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::COMBOBOX, true)
57 {
58 }
59 
60 
61 
62 
~VCLXAccessibleDropDownComboBox(void)63 VCLXAccessibleDropDownComboBox::~VCLXAccessibleDropDownComboBox (void)
64 {
65 }
66 
67 
68 
IsValid(void) const69 bool VCLXAccessibleDropDownComboBox::IsValid (void) const
70 {
71     return static_cast<ComboBox*>(GetWindow()) != NULL;
72 
73 }
74 
75 
76 
77 
ProcessWindowEvent(const VclWindowEvent & rVclWindowEvent)78 void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
79 {
80 	switch ( rVclWindowEvent.GetId() )
81 	{
82 		case VCLEVENT_DROPDOWN_OPEN:
83 		case VCLEVENT_DROPDOWN_CLOSE:
84 		{
85             /*			// child count changed
86 			Any aOldValue, aNewValue;
87 			// get the listbox child
88 			Reference< XAccessible > xChild;
89 			if ( !xChild.is() )
90 			{
91 				try
92 				{
93 					// the listbox is the second child
94 					xChild = getAccessibleChild(1);
95 				}
96 				catch ( IndexOutOfBoundsException& ) {}
97 				catch ( RuntimeException& ) {}
98 			}
99 			if ( rVclWindowEvent.GetId() == VCLEVENT_DROPDOWN_OPEN )
100 				aNewValue <<= xChild;
101 			else
102 				aOldValue <<= xChild;
103 			NotifyAccessibleEvent(
104 			AccessibleEventId::CHILD, aOldValue, aNewValue
105 			);
106             */
107 			break;
108 		}
109 
110 		default:
111 			VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
112 	}
113 }
114 
115 
116 
117 
118 //=====  XServiceInfo  ========================================================
119 
getImplementationName()120 ::rtl::OUString VCLXAccessibleDropDownComboBox::getImplementationName()
121     throw (RuntimeException)
122 {
123 	return ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.AccessibleDropDownComboBox");
124 }
125 
126 
127 
128 
getSupportedServiceNames(void)129 Sequence< ::rtl::OUString > VCLXAccessibleDropDownComboBox::getSupportedServiceNames (void)
130     throw (RuntimeException)
131 {
132 	Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames();
133 	sal_Int32 nLength = aNames.getLength();
134 	aNames.realloc( nLength + 1 );
135 	aNames[nLength] = ::rtl::OUString::createFromAscii(
136         "com.sun.star.accessibility.AccessibleDropDownComboBox" );
137 	return aNames;
138 }
139