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
42typedef cppu::WeakComponentImplHelper<
43 css::accessibility::XAccessible,
44 css::accessibility::XAccessibleComponent,
45 css::accessibility::XAccessibleContext,
46 css::accessibility::XAccessibleEventBroadcaster,
47 css::lang::XServiceInfo,
48 css::accessibility::XAccessibleEventListener
50
52 : public cppu::BaseMutex,
54 public SfxListener
55{
56public:
57 //===== internal ========================================================
59 css::uno::Reference<css::accessibility::XAccessible> xParent,
60 const sal_Int16 aRole);
61
62 virtual void Init();
63 virtual void SAL_CALL disposing() override;
64protected:
65 virtual ~ScAccessibleContextBase() override;
66public:
67
69 bool isShowing();
70
72 virtual bool isVisible();
73
75
76 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
77
79
81 virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL
82 getAccessibleContext() override;
83
85
86 virtual sal_Bool SAL_CALL containsPoint(
87 const css::awt::Point& rPoint ) override;
88
89 virtual css::uno::Reference< css::accessibility::XAccessible >
90 SAL_CALL getAccessibleAtPoint(
91 const css::awt::Point& rPoint ) override;
92
93 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
94
95 virtual css::awt::Point SAL_CALL getLocation( ) override;
96
97 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
98
99 virtual css::awt::Size SAL_CALL getSize( ) override;
100
101 virtual void SAL_CALL grabFocus( ) override;
102
103 virtual sal_Int32 SAL_CALL getForeground( ) override;
104
105 virtual sal_Int32 SAL_CALL getBackground( ) override;
106
108
110 virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
111
113 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
114 getAccessibleChild(sal_Int64 nIndex) override;
115
117 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
118 getAccessibleParent() override;
119
121 virtual sal_Int64 SAL_CALL
123
125 virtual sal_Int16 SAL_CALL
126 getAccessibleRole() override;
127
129 virtual OUString SAL_CALL
130 getAccessibleDescription() override;
131
133 virtual OUString SAL_CALL
134 getAccessibleName() override;
135
137 virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet> SAL_CALL
138 getAccessibleRelationSet() override;
139
141 virtual sal_Int64 SAL_CALL getAccessibleStateSet() override;
142
146 virtual css::lang::Locale SAL_CALL
147 getLocale() override;
148
150
154 virtual void SAL_CALL
156 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
157
158 // Remove an existing event listener.
159 virtual void SAL_CALL
161 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
162
164
165 virtual void SAL_CALL
166 disposing( const css::lang::EventObject& Source ) override;
167
168 virtual void SAL_CALL
170 const css::accessibility::AccessibleEventObject& aEvent ) override;
171
173
176 virtual OUString SAL_CALL
177 getImplementationName() override;
178
181 virtual sal_Bool SAL_CALL
182 supportsService(const OUString& sServiceName) override;
183
187 virtual css::uno::Sequence< OUString> SAL_CALL
188 getSupportedServiceNames() override;
189
190protected:
194 virtual OUString
196
200 virtual OUString
202
207
211 virtual tools::Rectangle GetBoundingBox() const;
212
213public:
215 void
216 CommitChange(const css::accessibility::AccessibleEventObject& rEvent) const;
217
219 void SetName(const OUString& rName) { msName = rName; }
220
222 void SetDescription(const OUString& rDesc) { msDescription = rDesc; }
223
224 void SetParent(const css::uno::Reference<css::accessibility::XAccessible>& rParent) { mxParent = rParent; }
225
226protected:
228 void CommitFocusGained() const;
229
231 void CommitFocusLost() const;
232
233 bool IsDefunc() const { return rBHelper.bDisposed; }
234
236 void IsObjectValid() const;
237
239 css::uno::Reference<css::accessibility::XAccessible> mxParent;
240
241private:
247
251 OUString msName;
252
254 sal_uInt32 mnClientId;
255
258 sal_Int16 maRole;
259};
260
261/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
cppu::WeakComponentImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleEventBroadcaster, css::lang::XServiceInfo, css::accessibility::XAccessibleEventListener > 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 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::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.
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 OUString SAL_CALL getAccessibleName() override
Return the object's current name.
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