ofz#44991 keep paragraph's that failed to load until import is complete
[LibreOffice.git] / sfx2 / source / control / thumbnailviewacc.hxx
blob2e31843d64388b3ad3f2b0498f5b83eff4ac878e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
21 #define INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
23 #include <cppuhelper/implbase.hxx>
24 #include <cppuhelper/compbase.hxx>
25 #include <cppuhelper/basemutex.hxx>
27 #include <com/sun/star/lang/XUnoTunnel.hpp>
28 #include <com/sun/star/accessibility/XAccessible.hpp>
29 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
30 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
31 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
32 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
34 #include <mutex>
35 #include <vcl/vclptr.hxx>
36 #include <vector>
38 class ThumbnailView;
39 class ThumbnailViewItem;
41 typedef ::cppu::WeakComponentImplHelper<
42 css::accessibility::XAccessible,
43 css::accessibility::XAccessibleEventBroadcaster,
44 css::accessibility::XAccessibleContext,
45 css::accessibility::XAccessibleComponent,
46 css::accessibility::XAccessibleSelection,
47 css::lang::XUnoTunnel >
48 ValueSetAccComponentBase;
50 class ThumbnailViewAcc :
51 public ::cppu::BaseMutex,
52 public ValueSetAccComponentBase
54 public:
56 ThumbnailViewAcc( ThumbnailView* pParent );
57 virtual ~ThumbnailViewAcc() override;
59 void FireAccessibleEvent( short nEventId,
60 const css::uno::Any& rOldValue,
61 const css::uno::Any& rNewValue );
63 bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
65 static ThumbnailViewAcc* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) noexcept;
67 public:
68 /** Called by the corresponding ValueSet when it gets the focus.
69 Stores the new focus state and broadcasts a state change event.
71 void GetFocus();
73 /** Called by the corresponding ValueSet when it loses the focus.
74 Stores the new focus state and broadcasts a state change event.
76 void LoseFocus();
78 // XAccessible
79 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
81 // XAccessibleEventBroadcaster
82 virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
83 virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
85 // XAccessibleContext
86 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
87 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
88 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
89 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
90 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
91 virtual OUString SAL_CALL getAccessibleDescription( ) override;
92 virtual OUString SAL_CALL getAccessibleName( ) override;
93 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
94 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
95 virtual css::lang::Locale SAL_CALL getLocale( ) override;
97 // XAccessibleComponent
98 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
99 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
100 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
101 virtual css::awt::Point SAL_CALL getLocation( ) override;
102 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
103 virtual css::awt::Size SAL_CALL getSize( ) override;
104 virtual void SAL_CALL grabFocus( ) override;
105 virtual sal_Int32 SAL_CALL getForeground( ) override;
106 virtual sal_Int32 SAL_CALL getBackground( ) override;
108 // XAccessibleSelection
109 virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override;
110 virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
111 virtual void SAL_CALL clearAccessibleSelection( ) override;
112 virtual void SAL_CALL selectAllAccessibleChildren( ) override;
113 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
114 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
115 virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
117 // XUnoTunnel
118 static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
119 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override;
121 private:
122 ::std::vector< css::uno::Reference<
123 css::accessibility::XAccessibleEventListener > > mxEventListeners;
124 ThumbnailView* mpParent;
126 /** Tell all listeners that the object is dying. This callback is
127 usually called from the WeakComponentImplHelper class.
129 virtual void SAL_CALL disposing() override;
131 /** Return the number of items. This takes the None-Item into account.
133 sal_uInt16 getItemCount() const;
135 /** Return the item associated with the given index. The None-Item is
136 taken into account which, when present, is taken to be the first
137 (with index 0) item.
138 @param nIndex
139 Index of the item to return. The index 0 denotes the None-Item
140 when present.
141 @return
142 Returns NULL when the given index is out of range.
144 ThumbnailViewItem* getItem (sal_uInt16 nIndex) const;
146 /** Check whether or not the object has been disposed (or is in the
147 state of being disposed). If that is the case then
148 DisposedException is thrown to inform the (indirect) caller of the
149 foul deed.
151 @throws css::lang::DisposedException
153 void ThrowIfDisposed();
157 class ThumbnailViewItemAcc : public ::cppu::WeakImplHelper< css::accessibility::XAccessible,
158 css::accessibility::XAccessibleEventBroadcaster,
159 css::accessibility::XAccessibleContext,
160 css::accessibility::XAccessibleComponent,
161 css::lang::XUnoTunnel >
163 private:
165 ::std::vector< css::uno::Reference< css::accessibility::XAccessibleEventListener > >
166 mxEventListeners;
167 std::mutex maMutex;
168 ThumbnailViewItem* mpParent;
169 bool mbIsTransientChildrenDisabled;
171 public:
173 ThumbnailViewItemAcc( ThumbnailViewItem* pParent, bool bIsTransientChildrenDisabled );
174 virtual ~ThumbnailViewItemAcc() override;
176 void ParentDestroyed();
178 static ThumbnailViewItemAcc* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) noexcept;
180 public:
182 // XAccessible
183 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
185 // XAccessibleEventBroadcaster
186 virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
187 virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
189 // XAccessibleContext
190 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
191 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
192 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
193 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
194 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
195 virtual OUString SAL_CALL getAccessibleDescription( ) override;
196 virtual OUString SAL_CALL getAccessibleName( ) override;
197 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
198 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
199 virtual css::lang::Locale SAL_CALL getLocale( ) override;
201 // XAccessibleComponent
202 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
203 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
204 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
205 virtual css::awt::Point SAL_CALL getLocation( ) override;
206 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
207 virtual css::awt::Size SAL_CALL getSize( ) override;
208 virtual void SAL_CALL grabFocus( ) override;
209 virtual sal_Int32 SAL_CALL getForeground( ) override;
210 virtual sal_Int32 SAL_CALL getBackground( ) override;
212 // XUnoTunnel
213 static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
214 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override;
217 #endif // INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */