1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
),
52 VCLXAccessibleTextField::~VCLXAccessibleTextField (void)
59 OUString
VCLXAccessibleTextField::implGetText (void)
62 ListBox
* pListBox
= static_cast<ListBox
*>(GetWindow());
63 if (pListBox
!=NULL
&& !pListBox
->IsInDropDown())
64 aText
= pListBox
->GetSelectEntry();
72 IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField
, VCLXAccessibleTextComponent
, VCLXAccessible_BASE
)
73 IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField
, VCLXAccessibleTextComponent
, VCLXAccessible_BASE
)
76 //===== XAccessible =========================================================
78 Reference
<XAccessibleContext
> SAL_CALL
79 VCLXAccessibleTextField::getAccessibleContext (void)
80 throw (RuntimeException
)
86 //===== XAccessibleContext ==================================================
88 sal_Int32 SAL_CALL
VCLXAccessibleTextField::getAccessibleChildCount (void)
89 throw (RuntimeException
)
97 Reference
<XAccessible
> SAL_CALL
VCLXAccessibleTextField::getAccessibleChild (sal_Int32
)
98 throw (IndexOutOfBoundsException
, RuntimeException
)
100 throw IndexOutOfBoundsException();
106 sal_Int16 SAL_CALL
VCLXAccessibleTextField::getAccessibleRole (void)
107 throw (RuntimeException
)
109 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
111 return AccessibleRole::TEXT
;
114 Reference
< XAccessible
> SAL_CALL
VCLXAccessibleTextField::getAccessibleParent( )
115 throw (RuntimeException
)
117 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
124 //===== XServiceInfo ==========================================================
126 OUString
VCLXAccessibleTextField::getImplementationName (void)
127 throw (RuntimeException
)
129 return OUString( "com.sun.star.comp.toolkit.AccessibleTextField" );
135 Sequence
< OUString
> VCLXAccessibleTextField::getSupportedServiceNames (void)
136 throw (RuntimeException
)
138 Sequence
< OUString
> aNames
= VCLXAccessibleTextComponent::getSupportedServiceNames();
139 sal_Int32 nLength
= aNames
.getLength();
140 aNames
.realloc( nLength
+ 1 );
141 aNames
[nLength
] = "com.sun.star.accessibility.AccessibleTextField";
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */