1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SD_SOURCE_UI_INC_ACCESSIBLESLIDESORTERVIEW_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLESLIDESORTERVIEW_HXX
23 #include "MutexOwner.hxx"
24 #include <cppuhelper/compbase.hxx>
25 #include <com/sun/star/accessibility/XAccessible.hpp>
26 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
27 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
28 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
29 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <vcl/vclptr.hxx>
32 #include <vcl/window.hxx>
36 namespace sd
{ namespace slidesorter
{
40 namespace accessibility
{
42 class AccessibleSlideSorterObject
;
44 typedef ::cppu::WeakComponentImplHelper
<
45 css::accessibility::XAccessible
,
46 css::accessibility::XAccessibleEventBroadcaster
,
47 css::accessibility::XAccessibleContext
,
48 css::accessibility::XAccessibleComponent
,
49 css::accessibility::XAccessibleSelection
,
50 css::lang::XServiceInfo
51 > AccessibleSlideSorterViewBase
;
53 /** This class makes the SlideSorterViewShell accessible. It uses objects
54 of the AccessibleSlideSorterObject class to the make the page objects
57 class AccessibleSlideSorterView
58 : public ::sd::MutexOwner
,
59 public AccessibleSlideSorterViewBase
62 AccessibleSlideSorterView(
63 ::sd::slidesorter::SlideSorter
& rSlideSorter
,
64 vcl::Window
* pParentWindow
);
68 virtual ~AccessibleSlideSorterView() override
;
70 /** This method acts like a dispose call. It sends a disposing to all
71 of its listeners. It may be called twice.
75 void FireAccessibleEvent (
77 const css::uno::Any
& rOldValue
,
78 const css::uno::Any
& rNewValue
);
80 virtual void SAL_CALL
disposing() override
;
82 /** Return the implementation object of the specified child.
84 Index of the child for which to return the implementation object.
86 AccessibleSlideSorterObject
* GetAccessibleChildImplementation (sal_Int32 nIndex
);
88 //===== XAccessible =======================================================
90 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
91 getAccessibleContext() override
;
93 //===== XAccessibleEventBroadcaster =======================================
95 addAccessibleEventListener(
96 const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
99 removeAccessibleEventListener(
100 const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
102 //===== XAccessibleContext ==============================================
104 /// Return the number of currently visible children.
105 virtual sal_Int32 SAL_CALL
106 getAccessibleChildCount() override
;
108 /// Return the specified child or throw exception.
109 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
110 getAccessibleChild (sal_Int32 nIndex
) override
;
112 /// Return a reference to the parent.
113 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
114 getAccessibleParent() override
;
116 /// Return this objects index among the parents children.
117 virtual sal_Int32 SAL_CALL
118 getAccessibleIndexInParent() override
;
120 /// Return this object's role.
121 virtual sal_Int16 SAL_CALL
122 getAccessibleRole() override
;
124 /// Return this object's description.
125 virtual OUString SAL_CALL
126 getAccessibleDescription() override
;
128 /// Return the object's current name.
129 virtual OUString SAL_CALL
130 getAccessibleName() override
;
132 /// Return NULL to indicate that an empty relation set.
133 virtual css::uno::Reference
<
134 css::accessibility::XAccessibleRelationSet
> SAL_CALL
135 getAccessibleRelationSet() override
;
137 /// Return the set of current states.
138 virtual css::uno::Reference
<
139 css::accessibility::XAccessibleStateSet
> SAL_CALL
140 getAccessibleStateSet() override
;
142 /** Return the parents locale or throw exception if this object has no
145 virtual css::lang::Locale SAL_CALL
146 getLocale() override
;
148 //===== XAccessibleComponent ================================================
150 /** The default implementation uses the result of
151 <member>getBounds</member> to determine whether the given point lies
154 virtual sal_Bool SAL_CALL
containsPoint (
155 const css::awt::Point
& aPoint
) override
;
157 /** The default implementation returns an empty reference.
159 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
160 getAccessibleAtPoint (
161 const css::awt::Point
& aPoint
) override
;
163 /** The default implementation returns an empty rectangle.
165 virtual css::awt::Rectangle SAL_CALL
getBounds() override
;
167 /** The default implementation uses the result of
168 <member>getBounds</member> to determine the location.
170 virtual css::awt::Point SAL_CALL
getLocation() override
;
172 /** The default implementation returns an empty position, i.e. the
173 * result of the default constructor of <type>css::awt::Point</type>.
175 virtual css::awt::Point SAL_CALL
getLocationOnScreen() override
;
177 /** The default implementation uses the result of
178 <member>getBounds</member> to determine the size.
180 virtual css::awt::Size SAL_CALL
getSize() override
;
182 /** The default implementation does nothing.
184 virtual void SAL_CALL
grabFocus() override
;
186 /** Returns black as the default foreground color.
188 virtual sal_Int32 SAL_CALL
getForeground() override
;
190 /** Returns white as the default background color.
192 virtual sal_Int32 SAL_CALL
getBackground() override
;
194 //===== XAccessibleSelection ==============================================
196 virtual void SAL_CALL
197 selectAccessibleChild (sal_Int32 nChildIndex
) override
;
199 virtual sal_Bool SAL_CALL
200 isAccessibleChildSelected( sal_Int32 nChildIndex
) override
;
202 virtual void SAL_CALL
203 clearAccessibleSelection( ) override
;
205 virtual void SAL_CALL
206 selectAllAccessibleChildren( ) override
;
208 virtual sal_Int32 SAL_CALL
209 getSelectedAccessibleChildCount( ) override
;
211 virtual css::uno::Reference
<
212 css::accessibility::XAccessible
> SAL_CALL
213 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
) override
;
215 virtual void SAL_CALL
216 deselectAccessibleChild( sal_Int32 nSelectedChildIndex
) override
;
218 //===== XServiceInfo ====================================================
220 /** Returns an identifier for the implementation of this object.
222 virtual OUString SAL_CALL
223 getImplementationName() override
;
225 /** Return whether the specified service is supported by this class.
227 virtual sal_Bool SAL_CALL
228 supportsService (const OUString
& sServiceName
) override
;
230 /** Returns a list of all supported services.
232 virtual css::uno::Sequence
< OUString
> SAL_CALL
233 getSupportedServiceNames() override
;
235 void SwitchViewActivated();
237 class Implementation
;
238 ::std::unique_ptr
<Implementation
> mpImpl
;
240 ::sd::slidesorter::SlideSorter
& mrSlideSorter
;
242 sal_uInt32 mnClientId
;
244 VclPtr
<vcl::Window
> mpContentWindow
;
246 /** Check whether or not the object has been disposed (or is in the
247 state of being disposed). If that is the case then
248 DisposedException is thrown to inform the (indirect) caller of the
251 @throws css::lang::DisposedException
253 void ThrowIfDisposed();
256 } // end of namespace ::accessibility
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */