1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vclxaccessibletextfield.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_accessibility.hxx"
33 #include <accessibility/standard/vclxaccessibletextfield.hxx>
34 #include <vcl/lstbox.hxx>
35 #include <accessibility/helper/listboxhelper.hxx>
37 #include <unotools/accessiblestatesethelper.hxx>
38 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
39 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
40 #include <com/sun/star/accessibility/AccessibleRole.hpp>
41 #include <vcl/svapp.hxx>
42 #include <vcl/combobox.hxx>
44 using namespace ::com::sun::star
;
45 using namespace ::com::sun::star::uno
;
46 using namespace ::com::sun::star::lang
;
47 using namespace ::com::sun::star::beans
;
48 using namespace ::com::sun::star::accessibility
;
53 VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow
* pVCLWindow
, const Reference
< XAccessible
>& _xParent
) :
55 VCLXAccessibleTextComponent (pVCLWindow
),
65 VCLXAccessibleTextField::~VCLXAccessibleTextField (void)
72 ::rtl::OUString
VCLXAccessibleTextField::implGetText (void)
74 ::rtl::OUString aText
;
75 ListBox
* pListBox
= static_cast<ListBox
*>(GetWindow());
76 if (pListBox
!=NULL
&& !pListBox
->IsInDropDown())
77 aText
= pListBox
->GetSelectEntry();
85 IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField
, VCLXAccessibleTextComponent
, VCLXAccessible_BASE
)
86 IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField
, VCLXAccessibleTextComponent
, VCLXAccessible_BASE
)
89 //===== XAccessible =========================================================
91 Reference
<XAccessibleContext
> SAL_CALL
92 VCLXAccessibleTextField::getAccessibleContext (void)
93 throw (RuntimeException
)
99 //===== XAccessibleContext ==================================================
101 sal_Int32 SAL_CALL
VCLXAccessibleTextField::getAccessibleChildCount (void)
102 throw (RuntimeException
)
110 Reference
<XAccessible
> SAL_CALL
VCLXAccessibleTextField::getAccessibleChild (sal_Int32
)
111 throw (IndexOutOfBoundsException
, RuntimeException
)
113 throw IndexOutOfBoundsException();
119 sal_Int16 SAL_CALL
VCLXAccessibleTextField::getAccessibleRole (void)
120 throw (RuntimeException
)
122 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
124 return AccessibleRole::TEXT
;
127 Reference
< XAccessible
> SAL_CALL
VCLXAccessibleTextField::getAccessibleParent( )
128 throw (RuntimeException
)
130 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
137 //===== XServiceInfo ==========================================================
139 ::rtl::OUString
VCLXAccessibleTextField::getImplementationName (void)
140 throw (RuntimeException
)
142 return ::rtl::OUString::createFromAscii ("com.sun.star.comp.toolkit.AccessibleTextField");
148 Sequence
< ::rtl::OUString
> VCLXAccessibleTextField::getSupportedServiceNames (void)
149 throw (RuntimeException
)
151 Sequence
< ::rtl::OUString
> aNames
= VCLXAccessibleTextComponent::getSupportedServiceNames();
152 sal_Int32 nLength
= aNames
.getLength();
153 aNames
.realloc( nLength
+ 1 );
154 aNames
[nLength
] = ::rtl::OUString::createFromAscii(
155 "com.sun.star.accessibility.AccessibleTextField");