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/vclxaccessibletextfield.hxx> 27 #include <vcl/lstbox.hxx> 28 #include <accessibility/helper/listboxhelper.hxx> 29 30 #include <unotools/accessiblestatesethelper.hxx> 31 #include <com/sun/star/accessibility/AccessibleStateType.hpp> 32 #include <com/sun/star/accessibility/AccessibleEventId.hpp> 33 #include <com/sun/star/accessibility/AccessibleRole.hpp> 34 #include <vcl/svapp.hxx> 35 #include <vcl/combobox.hxx> 36 37 using namespace ::com::sun::star; 38 using namespace ::com::sun::star::uno; 39 using namespace ::com::sun::star::lang; 40 using namespace ::com::sun::star::beans; 41 using namespace ::com::sun::star::accessibility; 42 43 44 45 46 VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) : 47 48 VCLXAccessibleTextComponent (pVCLWindow), 49 50 m_xParent( _xParent ) 51 52 { 53 } 54 55 56 57 58 VCLXAccessibleTextField::~VCLXAccessibleTextField (void) 59 { 60 } 61 62 63 64 65 ::rtl::OUString VCLXAccessibleTextField::implGetText (void) 66 { 67 ::rtl::OUString aText; 68 ListBox* pListBox = static_cast<ListBox*>(GetWindow()); 69 if (pListBox!=NULL && !pListBox->IsInDropDown()) 70 aText = pListBox->GetSelectEntry(); 71 72 return aText; 73 } 74 75 76 77 78 IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE) 79 IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE) 80 81 82 //===== XAccessible ========================================================= 83 84 Reference<XAccessibleContext> SAL_CALL 85 VCLXAccessibleTextField::getAccessibleContext (void) 86 { 87 return this; 88 } 89 90 91 //===== XAccessibleContext ================================================== 92 93 sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount (void) 94 { 95 return 0; 96 } 97 98 99 100 101 Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32) 102 { 103 throw IndexOutOfBoundsException(); 104 } 105 106 107 108 109 sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole (void) 110 { 111 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 112 113 return AccessibleRole::TEXT; 114 } 115 116 Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent( ) 117 { 118 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 119 120 return m_xParent; 121 } 122 123 124 125 //===== XServiceInfo ========================================================== 126 127 ::rtl::OUString VCLXAccessibleTextField::getImplementationName (void) 128 { 129 return ::rtl::OUString::createFromAscii ("com.sun.star.comp.toolkit.AccessibleTextField"); 130 } 131 132 133 134 135 Sequence< ::rtl::OUString > VCLXAccessibleTextField::getSupportedServiceNames (void) 136 { 137 Sequence< ::rtl::OUString > aNames = VCLXAccessibleTextComponent::getSupportedServiceNames(); 138 sal_Int32 nLength = aNames.getLength(); 139 aNames.realloc( nLength + 1 ); 140 aNames[nLength] = ::rtl::OUString::createFromAscii( 141 "com.sun.star.accessibility.AccessibleTextField"); 142 return aNames; 143 } 144