LibreOffice Module sc (master) 1
AccessibleContextBase.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/accessibility/XAccessible.hpp>
23#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
24#include <com/sun/star/accessibility/XAccessibleContext.hpp>
25#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
26#include <com/sun/star/uno/Reference.hxx>
27#include <com/sun/star/lang/XServiceInfo.hpp>
29
30#include <svl/lstner.hxx>
34
35namespace tools { class Rectangle; }
36
43 css::accessibility::XAccessible,
44 css::accessibility::XAccessibleComponent,
45 css::accessibility::XAccessibleContext,
46 css::accessibility::XAccessibleEventBroadcaster,
47 css::lang::XServiceInfo
49
50typedef cppu::ImplHelper1<
51 css::accessibility::XAccessibleEventListener
53
55 : public cppu::BaseMutex,
58 public SfxListener
59{
60public:
61 //===== internal ========================================================
63 css::uno::Reference<css::accessibility::XAccessible> xParent,
64 const sal_Int16 aRole);
65
66 virtual void Init();
67 virtual void SAL_CALL disposing() override;
68protected:
69 virtual ~ScAccessibleContextBase() override;
70public:
71
73 bool isShowing();
74
76 virtual bool isVisible();
77
79
80 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
81
83
84 virtual css::uno::Any SAL_CALL queryInterface(
85 css::uno::Type const & rType ) override;
86
87 virtual void SAL_CALL acquire() noexcept override;
88
89 virtual void SAL_CALL release() noexcept override;
90
92
94 virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL
95 getAccessibleContext() override;
96
98
99 virtual sal_Bool SAL_CALL containsPoint(
100 const css::awt::Point& rPoint ) override;
101
102 virtual css::uno::Reference< css::accessibility::XAccessible >
103 SAL_CALL getAccessibleAtPoint(
104 const css::awt::Point& rPoint ) override;
105
106 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
107
108 virtual css::awt::Point SAL_CALL getLocation( ) override;
109
110 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
111
112 virtual css::awt::Size SAL_CALL getSize( ) override;
113
114 virtual void SAL_CALL grabFocus( ) override;
115
116 virtual sal_Int32 SAL_CALL getForeground( ) override;
117
118 virtual sal_Int32 SAL_CALL getBackground( ) override;
119
121
123 virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
124
126 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
127 getAccessibleChild(sal_Int64 nIndex) override;
128
130 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
131 getAccessibleParent() override;
132
134 virtual sal_Int64 SAL_CALL
136
138 virtual sal_Int16 SAL_CALL
139 getAccessibleRole() override;
140
142 virtual OUString SAL_CALL
143 getAccessibleDescription() override;
144
146 virtual OUString SAL_CALL
147 getAccessibleName() override;
148
150 virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet> SAL_CALL
151 getAccessibleRelationSet() override;
152
154 virtual sal_Int64 SAL_CALL getAccessibleStateSet() override;
155
159 virtual css::lang::Locale SAL_CALL
160 getLocale() override;
161
163
167 virtual void SAL_CALL
169 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
170
171 // Remove an existing event listener.
172 virtual void SAL_CALL
174 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
175
177
178 virtual void SAL_CALL
179 disposing( const css::lang::EventObject& Source ) override;
180
181 virtual void SAL_CALL
183 const css::accessibility::AccessibleEventObject& aEvent ) override;
184
186
189 virtual OUString SAL_CALL
190 getImplementationName() override;
191
194 virtual sal_Bool SAL_CALL
195 supportsService(const OUString& sServiceName) override;
196
200 virtual css::uno::Sequence< OUString> SAL_CALL
201 getSupportedServiceNames() override;
202
204
206 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
207 getTypes() override;
208
211 virtual css::uno::Sequence<sal_Int8> SAL_CALL
212 getImplementationId() override;
213
214protected:
218 virtual OUString
220
224 virtual OUString
226
231
235 virtual tools::Rectangle GetBoundingBox() const;
236
237public:
239 void
240 CommitChange(const css::accessibility::AccessibleEventObject& rEvent) const;
241
243 void SetName(const OUString& rName) { msName = rName; }
244
246 void SetDescription(const OUString& rDesc) { msDescription = rDesc; }
247
248 void SetParent(const css::uno::Reference<css::accessibility::XAccessible>& rParent) { mxParent = rParent; }
249
250protected:
252 void CommitFocusGained() const;
253
255 void CommitFocusLost() const;
256
257 bool IsDefunc() const { return rBHelper.bDisposed; }
258
260 void IsObjectValid() const;
261
263 css::uno::Reference<css::accessibility::XAccessible> mxParent;
264
265private:
271
275 OUString msName;
276
278 sal_uInt32 mnClientId;
279
282 sal_Int16 maRole;
283};
284
285/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
cppu::ImplHelper1< css::accessibility::XAccessibleEventListener > ScAccessibleContextBaseImplEvent
cppu::WeakAggComponentImplHelper5< css::accessibility::XAccessible, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleEventBroadcaster, css::lang::XServiceInfo > ScAccessibleContextBaseWeakImpl
@descr This base class provides an implementation of the AccessibleContext service.
virtual tools::Rectangle GetBoundingBoxOnScreen() const
Return the object's current bounding box relative to the desktop.
virtual ~ScAccessibleContextBase() override
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
OUString msDescription
Description of this object.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
virtual css::awt::Size SAL_CALL getSize() override
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) override
===== XInterface =====================================================
virtual OUString SAL_CALL getAccessibleDescription() override
Return this object's description.
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
===== XAccessible =====================================================
virtual OUString createAccessibleDescription()
Return this object's description.
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
virtual void SAL_CALL disposing() override
void SetDescription(const OUString &rDesc)
Use this method to set initial Description without notification.
OUString msName
Name of this object.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
Return the specified child or NULL if index is invalid.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
===== XAccessibleEventListener ========================================
virtual void SAL_CALL grabFocus() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
===== XAccessibleEventBroadcaster =====================================
virtual OUString SAL_CALL getImplementationName() override
===== XServiceInfo ====================================================
virtual css::awt::Rectangle SAL_CALL getBounds() override
void CommitFocusLost() const
Calls all FocusListener to tell they that the focus is lost.
sal_uInt32 mnClientId
client id in the AccessibleEventNotifier queue
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
virtual css::lang::Locale SAL_CALL getLocale() override
Return the parents locale or throw exception if this object has no parent yet/anymore.
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
===== XTypeProvider ===================================================
virtual css::awt::Point SAL_CALL getLocation() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Return a reference to the parent.
void CommitFocusGained() const
Calls all FocusListener to tell they that the focus is gained.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Returns an implementation id.
css::uno::Reference< css::accessibility::XAccessible > mxParent
Reference to the parent object.
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
Return this objects index among the parents children.
virtual sal_Int32 SAL_CALL getBackground() override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
Return the set of current states.
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
===== XAccessibleContext ==============================================
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return NULL to indicate that an empty relation set.
virtual OUString createAccessibleName()
Return the object's current name.
virtual sal_Int16 SAL_CALL getAccessibleRole() override
Return this object's role.
virtual tools::Rectangle GetBoundingBox() const
Return the object's current bounding box relative to the parent object.
ScAccessibleContextBase(css::uno::Reference< css::accessibility::XAccessible > xParent, const sal_Int16 aRole)
void CommitChange(const css::accessibility::AccessibleEventObject &rEvent) const
Calls all Listener to tell they the change.
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
void SetName(const OUString &rName)
Use this method to set initial Name without notification.
virtual sal_Int32 SAL_CALL getForeground() override
sal_Int16 maRole
This is the role of this object.
virtual void SAL_CALL release() noexcept override
virtual OUString SAL_CALL getAccessibleName() override
Return the object's current name.
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL notifyEvent(const css::accessibility::AccessibleEventObject &aEvent) override
void SetParent(const css::uno::Reference< css::accessibility::XAccessible > &rParent)
sal_Int32 nIndex
unsigned char sal_Bool