Branch libreoffice-5-0-4
[LibreOffice.git] / accessibility / source / standard / vclxaccessibletextfield.cxx
blob4eb05d3ecb50bb41a96d6ccdea9cf4004ba4d1d4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <accessibility/standard/vclxaccessibletextfield.hxx>
21 #include <vcl/lstbox.hxx>
22 #include <accessibility/helper/listboxhelper.hxx>
24 #include <unotools/accessiblestatesethelper.hxx>
25 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
26 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
27 #include <com/sun/star/accessibility/AccessibleRole.hpp>
28 #include <vcl/svapp.hxx>
29 #include <vcl/combobox.hxx>
31 using namespace ::com::sun::star;
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::lang;
34 using namespace ::com::sun::star::beans;
35 using namespace ::com::sun::star::accessibility;
40 VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) :
42 VCLXAccessibleTextComponent (pVCLWindow),
44 m_xParent( _xParent )
52 VCLXAccessibleTextField::~VCLXAccessibleTextField()
56 OUString VCLXAccessibleTextField::implGetText()
58 OUString aText;
59 VclPtr< ListBox > pListBox = GetAs< ListBox >();
60 if (pListBox && !pListBox->IsInDropDown())
61 aText = pListBox->GetSelectEntry();
63 return aText;
66 IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
67 IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
70 // XAccessible
72 Reference<XAccessibleContext> SAL_CALL
73 VCLXAccessibleTextField::getAccessibleContext()
74 throw (RuntimeException, std::exception)
76 return this;
80 // XAccessibleContext
82 sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount()
83 throw (RuntimeException, std::exception)
85 return 0;
91 Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32)
92 throw (IndexOutOfBoundsException, RuntimeException, std::exception)
94 throw IndexOutOfBoundsException();
100 sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole()
101 throw (RuntimeException, std::exception)
103 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
105 return AccessibleRole::TEXT;
108 Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent( )
109 throw (RuntimeException, std::exception)
111 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
113 return m_xParent;
118 // XServiceInfo
120 OUString VCLXAccessibleTextField::getImplementationName()
121 throw (RuntimeException, std::exception)
123 return OUString( "com.sun.star.comp.toolkit.AccessibleTextField" );
129 Sequence< OUString > VCLXAccessibleTextField::getSupportedServiceNames()
130 throw (RuntimeException, std::exception)
132 Sequence< OUString > aNames = VCLXAccessibleTextComponent::getSupportedServiceNames();
133 sal_Int32 nLength = aNames.getLength();
134 aNames.realloc( nLength + 1 );
135 aNames[nLength] = "com.sun.star.accessibility.AccessibleTextField";
136 return aNames;
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */