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 0 : VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) :
41 :
42 : VCLXAccessibleTextComponent (pVCLWindow),
43 :
44 0 : m_xParent( _xParent )
45 :
46 : {
47 0 : }
48 :
49 :
50 :
51 :
52 0 : VCLXAccessibleTextField::~VCLXAccessibleTextField (void)
53 : {
54 0 : }
55 :
56 :
57 :
58 :
59 0 : OUString VCLXAccessibleTextField::implGetText (void)
60 : {
61 0 : OUString aText;
62 0 : ListBox* pListBox = static_cast<ListBox*>(GetWindow());
63 0 : if (pListBox!=NULL && !pListBox->IsInDropDown())
64 0 : aText = pListBox->GetSelectEntry();
65 :
66 0 : return aText;
67 : }
68 :
69 :
70 :
71 :
72 0 : IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
73 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
74 :
75 :
76 : //===== XAccessible =========================================================
77 :
78 : Reference<XAccessibleContext> SAL_CALL
79 0 : VCLXAccessibleTextField::getAccessibleContext (void)
80 : throw (RuntimeException, std::exception)
81 : {
82 0 : return this;
83 : }
84 :
85 :
86 : //===== XAccessibleContext ==================================================
87 :
88 0 : sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount (void)
89 : throw (RuntimeException, std::exception)
90 : {
91 0 : return 0;
92 : }
93 :
94 :
95 :
96 :
97 0 : Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32)
98 : throw (IndexOutOfBoundsException, RuntimeException, std::exception)
99 : {
100 0 : throw IndexOutOfBoundsException();
101 : }
102 :
103 :
104 :
105 :
106 0 : sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole (void)
107 : throw (RuntimeException, std::exception)
108 : {
109 0 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
110 :
111 0 : return AccessibleRole::TEXT;
112 : }
113 :
114 0 : Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent( )
115 : throw (RuntimeException, std::exception)
116 : {
117 0 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
118 :
119 0 : return m_xParent;
120 : }
121 :
122 :
123 :
124 : //===== XServiceInfo ==========================================================
125 :
126 0 : OUString VCLXAccessibleTextField::getImplementationName (void)
127 : throw (RuntimeException, std::exception)
128 : {
129 0 : return OUString( "com.sun.star.comp.toolkit.AccessibleTextField" );
130 : }
131 :
132 :
133 :
134 :
135 0 : Sequence< OUString > VCLXAccessibleTextField::getSupportedServiceNames (void)
136 : throw (RuntimeException, std::exception)
137 : {
138 0 : Sequence< OUString > aNames = VCLXAccessibleTextComponent::getSupportedServiceNames();
139 0 : sal_Int32 nLength = aNames.getLength();
140 0 : aNames.realloc( nLength + 1 );
141 0 : aNames[nLength] = "com.sun.star.accessibility.AccessibleTextField";
142 0 : return aNames;
143 : }
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|