LibreOffice Module sfx2 (master) 1
thumbnailviewacc.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#ifndef INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
21#define INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
22
25
26#include <com/sun/star/accessibility/XAccessible.hpp>
27#include <com/sun/star/accessibility/XAccessibleContext.hpp>
28#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
29#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
30#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
31
32#include <vector>
33
34class ThumbnailView;
36
38 css::accessibility::XAccessible,
39 css::accessibility::XAccessibleEventBroadcaster,
40 css::accessibility::XAccessibleContext,
41 css::accessibility::XAccessibleComponent,
42 css::accessibility::XAccessibleSelection >
44
47{
48public:
49
51 virtual ~ThumbnailViewAcc() override;
52
53 void FireAccessibleEvent( short nEventId,
54 const css::uno::Any& rOldValue,
55 const css::uno::Any& rNewValue );
56
57 bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
58
59 static ThumbnailViewAcc* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) noexcept;
60
61public:
65 void GetFocus();
66
70 void LoseFocus();
71
72 // XAccessible
73 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
74
75 // XAccessibleEventBroadcaster
76 virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
77 virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
78
79 // XAccessibleContext
80 virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
81 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
82 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
83 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
84 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
85 virtual OUString SAL_CALL getAccessibleDescription( ) override;
86 virtual OUString SAL_CALL getAccessibleName( ) override;
87 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
88 virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
89 virtual css::lang::Locale SAL_CALL getLocale( ) override;
90
91 // XAccessibleComponent
92 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
93 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
94 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
95 virtual css::awt::Point SAL_CALL getLocation( ) override;
96 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
97 virtual css::awt::Size SAL_CALL getSize( ) override;
98 virtual void SAL_CALL grabFocus( ) override;
99 virtual sal_Int32 SAL_CALL getForeground( ) override;
100 virtual sal_Int32 SAL_CALL getBackground( ) override;
101
102 // XAccessibleSelection
103 virtual void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override;
104 virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override;
105 virtual void SAL_CALL clearAccessibleSelection( ) override;
106 virtual void SAL_CALL selectAllAccessibleChildren( ) override;
107 virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override;
108 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
109 virtual void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
110
111private:
112 ::std::vector< css::uno::Reference<
113 css::accessibility::XAccessibleEventListener > > mxEventListeners;
115
119 virtual void disposing(std::unique_lock<std::mutex>&) override;
120
123 sal_uInt16 getItemCount() const;
124
134 ThumbnailViewItem* getItem (sal_uInt16 nIndex) const;
135
143 void ThrowIfDisposed();
144};
145
146
147class ThumbnailViewItemAcc : public ::cppu::WeakImplHelper< css::accessibility::XAccessible,
148 css::accessibility::XAccessibleEventBroadcaster,
149 css::accessibility::XAccessibleContext,
150 css::accessibility::XAccessibleComponent>
151{
152private:
153
154 ::std::vector< css::uno::Reference< css::accessibility::XAccessibleEventListener > >
156 std::mutex maMutex;
159
160public:
161
162 ThumbnailViewItemAcc( ThumbnailViewItem* pParent, bool bIsTransientChildrenDisabled );
163 virtual ~ThumbnailViewItemAcc() override;
164
165 void ParentDestroyed();
166
167 static ThumbnailViewItemAcc* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) noexcept;
168
169public:
170
171 // XAccessible
172 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
173
174 // XAccessibleEventBroadcaster
175 virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
176 virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
177
178 // XAccessibleContext
179 virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
180 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
181 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
182 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
183 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
184 virtual OUString SAL_CALL getAccessibleDescription( ) override;
185 virtual OUString SAL_CALL getAccessibleName( ) override;
186 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
187 virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
188 virtual css::lang::Locale SAL_CALL getLocale( ) override;
189
190 // XAccessibleComponent
191 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
192 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
193 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
194 virtual css::awt::Point SAL_CALL getLocation( ) override;
195 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
196 virtual css::awt::Size SAL_CALL getSize( ) override;
197 virtual void SAL_CALL grabFocus( ) override;
198 virtual sal_Int32 SAL_CALL getForeground( ) override;
199 virtual sal_Int32 SAL_CALL getBackground( ) override;
200};
201
202#endif // INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
203
204/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void FireAccessibleEvent(short nEventId, const css::uno::Any &rOldValue, const css::uno::Any &rNewValue)
bool HasAccessibleListeners() const
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
static ThumbnailViewAcc * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
ThumbnailView * mpParent
::std::vector< css::uno::Reference< css::accessibility::XAccessibleEventListener > > mxEventListeners
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
virtual void disposing(std::unique_lock< std::mutex > &) override
Tell all listeners that the object is dying.
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
virtual css::awt::Size SAL_CALL getSize() override
virtual void SAL_CALL clearAccessibleSelection() override
virtual ~ThumbnailViewAcc() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual OUString SAL_CALL getAccessibleName() override
virtual css::lang::Locale SAL_CALL getLocale() override
void ThrowIfDisposed()
Check whether or not the object has been disposed (or is in the state of being disposed).
virtual void SAL_CALL selectAllAccessibleChildren() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
ThumbnailViewItem * getItem(sal_uInt16 nIndex) const
Return the item associated with the given index.
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
virtual void SAL_CALL grabFocus() override
sal_uInt16 getItemCount() const
Return the number of items.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual css::awt::Rectangle SAL_CALL getBounds() override
virtual css::awt::Point SAL_CALL getLocation() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
void GetFocus()
Called by the corresponding ValueSet when it gets the focus.
ThumbnailViewAcc(ThumbnailView *pParent)
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
virtual OUString SAL_CALL getAccessibleDescription() override
void LoseFocus()
Called by the corresponding ValueSet when it loses the focus.
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual sal_Int32 SAL_CALL getForeground() override
ThumbnailViewItem * mpParent
virtual OUString SAL_CALL getAccessibleDescription() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
::std::vector< css::uno::Reference< css::accessibility::XAccessibleEventListener > > mxEventListeners
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual sal_Int32 SAL_CALL getForeground() override
virtual void SAL_CALL grabFocus() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual css::lang::Locale SAL_CALL getLocale() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual css::awt::Size SAL_CALL getSize() override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual OUString SAL_CALL getAccessibleName() override
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
ThumbnailViewItemAcc(ThumbnailViewItem *pParent, bool bIsTransientChildrenDisabled)
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
virtual css::awt::Rectangle SAL_CALL getBounds() override
virtual ~ThumbnailViewItemAcc() override
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
static ThumbnailViewItemAcc * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
virtual css::awt::Point SAL_CALL getLocation() override
Class to display thumbnails with their names below their respective icons.
comphelper::WeakComponentImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleEventBroadcaster, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleSelection > ValueSetAccComponentBase
unsigned char sal_Bool