1*c82f2877SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c82f2877SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c82f2877SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c82f2877SAndrew Rist * distributed with this work for additional information 6*c82f2877SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c82f2877SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c82f2877SAndrew Rist * "License"); you may not use this file except in compliance 9*c82f2877SAndrew Rist * with the License. You may obtain a copy of the License at 10*c82f2877SAndrew Rist * 11*c82f2877SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*c82f2877SAndrew Rist * 13*c82f2877SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c82f2877SAndrew Rist * software distributed under the License is distributed on an 15*c82f2877SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c82f2877SAndrew Rist * KIND, either express or implied. See the License for the 17*c82f2877SAndrew Rist * specific language governing permissions and limitations 18*c82f2877SAndrew Rist * under the License. 19*c82f2877SAndrew Rist * 20*c82f2877SAndrew Rist *************************************************************/ 21*c82f2877SAndrew Rist 22*c82f2877SAndrew 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 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 58cdf0e10cSrcweir VCLXAccessibleTextField::~VCLXAccessibleTextField (void) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir 63cdf0e10cSrcweir 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextField::implGetText (void) 66cdf0e10cSrcweir { 67cdf0e10cSrcweir ::rtl::OUString aText; 68cdf0e10cSrcweir ListBox* pListBox = static_cast<ListBox*>(GetWindow()); 69cdf0e10cSrcweir if (pListBox!=NULL && !pListBox->IsInDropDown()) 70cdf0e10cSrcweir aText = pListBox->GetSelectEntry(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir return aText; 73cdf0e10cSrcweir } 74cdf0e10cSrcweir 75cdf0e10cSrcweir 76cdf0e10cSrcweir 77cdf0e10cSrcweir 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 85cdf0e10cSrcweir VCLXAccessibleTextField::getAccessibleContext (void) 86cdf0e10cSrcweir throw (RuntimeException) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir return this; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir 92cdf0e10cSrcweir //===== XAccessibleContext ================================================== 93cdf0e10cSrcweir 94cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount (void) 95cdf0e10cSrcweir throw (RuntimeException) 96cdf0e10cSrcweir { 97cdf0e10cSrcweir return 0; 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir 103cdf0e10cSrcweir Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32) 104cdf0e10cSrcweir throw (IndexOutOfBoundsException, RuntimeException) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir throw IndexOutOfBoundsException(); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir 110cdf0e10cSrcweir 111cdf0e10cSrcweir 112cdf0e10cSrcweir sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole (void) 113cdf0e10cSrcweir throw (RuntimeException) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir return AccessibleRole::TEXT; 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 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 132cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleTextField::getImplementationName (void) 133cdf0e10cSrcweir throw (RuntimeException) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir return ::rtl::OUString::createFromAscii ("com.sun.star.comp.toolkit.AccessibleTextField"); 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir 139cdf0e10cSrcweir 140cdf0e10cSrcweir 141cdf0e10cSrcweir Sequence< ::rtl::OUString > VCLXAccessibleTextField::getSupportedServiceNames (void) 142cdf0e10cSrcweir 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( 148cdf0e10cSrcweir "com.sun.star.accessibility.AccessibleTextField"); 149cdf0e10cSrcweir return aNames; 150cdf0e10cSrcweir } 151