Bump version to 4.1-6
[LibreOffice.git] / sfx2 / source / control / thumbnailviewacc.hxx
blob6794ceca11bc01b197f537a6914e32d68fcfbb14
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 THUMBNAILVIEWACC_HXX
21 #define THUMBNAILVIEWACC_HXX
23 #include <osl/mutex.hxx>
24 #include <cppuhelper/implbase5.hxx>
25 #include <cppuhelper/compbase6.hxx>
26 #include <comphelper/broadcasthelper.hxx>
28 #include <com/sun/star/lang/XUnoTunnel.hpp>
29 #include <com/sun/star/accessibility/XAccessible.hpp>
30 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
31 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
32 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
33 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
34 #include <com/sun/star/lang/DisposedException.hpp>
36 #include <vector>
38 class ThumbnailView;
39 class ThumbnailViewItem;
41 typedef ::cppu::PartialWeakComponentImplHelper6<
42 ::com::sun::star::accessibility::XAccessible,
43 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
44 ::com::sun::star::accessibility::XAccessibleContext,
45 ::com::sun::star::accessibility::XAccessibleComponent,
46 ::com::sun::star::accessibility::XAccessibleSelection,
47 ::com::sun::star::lang::XUnoTunnel >
48 ValueSetAccComponentBase;
50 class ThumbnailViewAcc :
51 public ::comphelper::OBaseMutex,
52 public ValueSetAccComponentBase
54 public:
56 ThumbnailViewAcc( ThumbnailView* pParent, bool bIsTransientChildrenDisabled );
57 ~ThumbnailViewAcc();
59 void FireAccessibleEvent( short nEventId,
60 const ::com::sun::star::uno::Any& rOldValue,
61 const ::com::sun::star::uno::Any& rNewValue );
63 sal_Bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
65 static ThumbnailViewAcc* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
67 public:
69 /** Called by the corresponding ValueSet when it gets the focus.
70 Stores the new focus state and broadcasts a state change event.
72 void GetFocus (void);
74 /** Called by the corresponding ValueSet when it loses the focus.
75 Stores the new focus state and broadcasts a state change event.
77 void LoseFocus (void);
79 // XComponent
80 virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
81 { WeakComponentImplHelperBase::dispose(); }
82 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
83 { WeakComponentImplHelperBase::addEventListener(xListener); }
84 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
85 { WeakComponentImplHelperBase::removeEventListener(xListener); }
87 // XAccessible
88 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
90 // XAccessibleEventBroadcaster
91 virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
92 virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
94 // XAccessibleContext
95 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
96 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
97 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
98 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
99 virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
100 virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
101 virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
102 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
103 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
104 virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
106 // XAccessibleComponent
107 virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
108 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
109 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
110 virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
111 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
112 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
113 virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
114 virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
115 virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
116 virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
118 // XAccessibleSelection
119 virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
120 virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
121 virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
122 virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
123 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
125 virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
127 // XUnoTunnel
128 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
130 private:
131 ::std::vector< ::com::sun::star::uno::Reference<
132 ::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
133 ThumbnailView* mpParent;
134 bool mbIsTransientChildrenDisabled;
135 /// The current FOCUSED state.
136 bool mbIsFocused;
138 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
140 /** Tell all listeners that the object is dying. This callback is
141 usually called from the WeakComponentImplHelper class.
143 virtual void SAL_CALL disposing (void);
145 /** Return the number of items. This takes the None-Item into account.
147 sal_uInt16 getItemCount (void) const;
149 /** Return the item associated with the given index. The None-Item is
150 taken into account which, when present, is taken to be the first
151 (with index 0) item.
152 @param nIndex
153 Index of the item to return. The index 0 denotes the None-Item
154 when present.
155 @return
156 Returns NULL when the given index is out of range.
158 ThumbnailViewItem* getItem (sal_uInt16 nIndex) const;
160 /** Check whether or not the object has been disposed (or is in the
161 state of beeing disposed). If that is the case then
162 DisposedException is thrown to inform the (indirect) caller of the
163 foul deed.
165 void ThrowIfDisposed (void)
166 throw (::com::sun::star::lang::DisposedException);
169 class ThumbnailViewItemAcc : public ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible,
170 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
171 ::com::sun::star::accessibility::XAccessibleContext,
172 ::com::sun::star::accessibility::XAccessibleComponent,
173 ::com::sun::star::lang::XUnoTunnel >
175 private:
177 ::std::vector< ::com::sun::star::uno::Reference<
178 ::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
179 ::osl::Mutex maMutex;
180 ThumbnailViewItem* mpParent;
181 bool mbIsTransientChildrenDisabled;
183 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
185 public:
187 ThumbnailViewItemAcc( ThumbnailViewItem* pParent, bool bIsTransientChildrenDisabled );
188 ~ThumbnailViewItemAcc();
190 void ParentDestroyed();
192 sal_Bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
194 public:
196 // XAccessible
197 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
199 // XAccessibleEventBroadcaster
200 virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
201 virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
203 // XAccessibleContext
204 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
205 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
206 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
207 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
208 virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
209 virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
210 virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
211 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
212 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
213 virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
215 // XAccessibleComponent
216 virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
217 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
218 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
219 virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
220 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
221 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
222 virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
223 virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
224 virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
225 virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
227 // XUnoTunnel
228 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
231 #endif // THUMBNAILVIEWACC_HXX
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */