Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <accessibility/standard/vclxaccessibletextfield.hxx>
21 : #include <vcl/lstbox.hxx>
22 : #include <accessibility/helper/listboxhelper.hxx>
23 :
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>
30 :
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;
36 :
37 :
38 :
39 :
40 5 : VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) :
41 :
42 : VCLXAccessibleTextComponent (pVCLWindow),
43 :
44 5 : m_xParent( _xParent )
45 :
46 : {
47 5 : }
48 :
49 :
50 :
51 :
52 0 : VCLXAccessibleTextField::~VCLXAccessibleTextField()
53 : {
54 0 : }
55 :
56 0 : OUString VCLXAccessibleTextField::implGetText()
57 : {
58 0 : OUString aText;
59 0 : VclPtr< ListBox > pListBox = GetAs< ListBox >();
60 0 : if (pListBox && !pListBox->IsInDropDown())
61 0 : aText = pListBox->GetSelectEntry();
62 :
63 0 : return aText;
64 : }
65 :
66 213 : IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
67 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
68 :
69 :
70 : // XAccessible
71 :
72 : Reference<XAccessibleContext> SAL_CALL
73 12 : VCLXAccessibleTextField::getAccessibleContext()
74 : throw (RuntimeException, std::exception)
75 : {
76 12 : return this;
77 : }
78 :
79 :
80 : // XAccessibleContext
81 :
82 8 : sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount()
83 : throw (RuntimeException, std::exception)
84 : {
85 8 : return 0;
86 : }
87 :
88 :
89 :
90 :
91 0 : Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32)
92 : throw (IndexOutOfBoundsException, RuntimeException, std::exception)
93 : {
94 0 : throw IndexOutOfBoundsException();
95 : }
96 :
97 :
98 :
99 :
100 18 : sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole()
101 : throw (RuntimeException, std::exception)
102 : {
103 18 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
104 :
105 18 : return AccessibleRole::TEXT;
106 : }
107 :
108 3 : Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent( )
109 : throw (RuntimeException, std::exception)
110 : {
111 3 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
112 :
113 3 : return m_xParent;
114 : }
115 :
116 :
117 :
118 : // XServiceInfo
119 :
120 1 : OUString VCLXAccessibleTextField::getImplementationName()
121 : throw (RuntimeException, std::exception)
122 : {
123 1 : return OUString( "com.sun.star.comp.toolkit.AccessibleTextField" );
124 : }
125 :
126 :
127 :
128 :
129 0 : Sequence< OUString > VCLXAccessibleTextField::getSupportedServiceNames()
130 : throw (RuntimeException, std::exception)
131 : {
132 0 : Sequence< OUString > aNames = VCLXAccessibleTextComponent::getSupportedServiceNames();
133 0 : sal_Int32 nLength = aNames.getLength();
134 0 : aNames.realloc( nLength + 1 );
135 0 : aNames[nLength] = "com.sun.star.accessibility.AccessibleTextField";
136 0 : return aNames;
137 36 : }
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|