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 const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
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_Int32 SAL_CALL getAccessibleChildCount() override;
124
126 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
127 getAccessibleChild(sal_Int32 nIndex) override;
128
130 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
131 getAccessibleParent() override;
132
134 virtual sal_Int32 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 css::uno::Reference<css::accessibility::XAccessibleStateSet> SAL_CALL
155 getAccessibleStateSet() override;
156
160 virtual css::lang::Locale SAL_CALL
161 getLocale() override;
162
164
168 virtual void SAL_CALL
170 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
171
172 // Remove an existing event listener.
173 virtual void SAL_CALL
175 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
176
178
179 virtual void SAL_CALL
180 disposing( const css::lang::EventObject& Source ) override;
181
182 virtual void SAL_CALL
184 const css::accessibility::AccessibleEventObject& aEvent ) override;
185
187
190 virtual OUString SAL_CALL
191 getImplementationName() override;
192
195 virtual sal_Bool SAL_CALL
196 supportsService(const OUString& sServiceName) override;
197
201 virtual css::uno::Sequence< OUString> SAL_CALL
202 getSupportedServiceNames() override;
203
205
207 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
208 getTypes() override;
209
212 virtual css::uno::Sequence<sal_Int8> SAL_CALL
213 getImplementationId() override;
214
215protected:
219 virtual OUString
221
225 virtual OUString
227
232
236 virtual tools::Rectangle GetBoundingBox() const;
237
238public:
240 void
241 CommitChange(const css::accessibility::AccessibleEventObject& rEvent) const;
242
244 void SetName(const OUString& rName) { msName = rName; }
245
247 void SetDescription(const OUString& rDesc) { msDescription = rDesc; }
248
249 void SetParent(const css::uno::Reference<css::accessibility::XAccessible>& rParent) { mxParent = rParent; }
250
251protected:
253 void CommitFocusGained() const;
254
256 void CommitFocusLost() const;
257
258 bool IsDefunc() const { return rBHelper.bDisposed; }
259
261 void IsObjectValid() const;
262
264 css::uno::Reference<css::accessibility::XAccessible> mxParent;
265
266private:
272
276 OUString msName;
277
279 sal_uInt32 mnClientId;
280
283 sal_Int16 maRole;
284};
285
286/* 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_Int32 SAL_CALL getAccessibleIndexInParent() override
Return this objects index among the parents children.
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::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Return the set of current states.
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::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_Int32 SAL_CALL getBackground() override
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.
ScAccessibleContextBase(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, const sal_Int16 aRole)
virtual tools::Rectangle GetBoundingBox() const
Return the object's current bounding box relative to the parent object.
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
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
===== XAccessibleContext ==============================================
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 css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Return the specified child or NULL if index is invalid.
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