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 .
22 #include <cppuhelper/basemutex.hxx>
23 #include <cppuhelper/compbase.hxx>
24 #include <com/sun/star/accessibility/XAccessible.hpp>
25 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
27 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
28 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <vcl/vclptr.hxx>
31 #include <vcl/window.hxx>
35 namespace sd::slidesorter
{ class SlideSorter
; }
37 namespace accessibility
{
39 class AccessibleSlideSorterObject
;
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::XServiceInfo
48 > AccessibleSlideSorterViewBase
;
50 /** This class makes the SlideSorterViewShell accessible. It uses objects
51 of the AccessibleSlideSorterObject class to the make the page objects
54 class AccessibleSlideSorterView
55 : public cppu::BaseMutex
,
56 public AccessibleSlideSorterViewBase
59 AccessibleSlideSorterView(
60 ::sd::slidesorter::SlideSorter
& rSlideSorter
,
61 vcl::Window
* pParentWindow
);
65 virtual ~AccessibleSlideSorterView() override
;
67 /** This method acts like a dispose call. It sends a disposing to all
68 of its listeners. It may be called twice.
72 void FireAccessibleEvent (
74 const css::uno::Any
& rOldValue
,
75 const css::uno::Any
& rNewValue
);
77 virtual void SAL_CALL
disposing() override
;
79 /** Return the implementation object of the specified child.
81 Index of the child for which to return the implementation object.
83 AccessibleSlideSorterObject
* GetAccessibleChildImplementation (sal_Int32 nIndex
);
85 //===== XAccessible =======================================================
87 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
88 getAccessibleContext() override
;
90 //===== XAccessibleEventBroadcaster =======================================
92 addAccessibleEventListener(
93 const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
96 removeAccessibleEventListener(
97 const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
99 //===== XAccessibleContext ==============================================
101 /// Return the number of currently visible children.
102 virtual sal_Int64 SAL_CALL
103 getAccessibleChildCount() override
;
105 /// Return the specified child or throw exception.
106 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
107 getAccessibleChild (sal_Int64 nIndex
) override
;
109 /// Return a reference to the parent.
110 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
111 getAccessibleParent() override
;
113 /// Return this objects index among the parents children.
114 virtual sal_Int64 SAL_CALL
115 getAccessibleIndexInParent() override
;
117 /// Return this object's role.
118 virtual sal_Int16 SAL_CALL
119 getAccessibleRole() override
;
121 /// Return this object's description.
122 virtual OUString SAL_CALL
123 getAccessibleDescription() override
;
125 /// Return the object's current name.
126 virtual OUString SAL_CALL
127 getAccessibleName() override
;
129 /// Return NULL to indicate that an empty relation set.
130 virtual css::uno::Reference
<
131 css::accessibility::XAccessibleRelationSet
> SAL_CALL
132 getAccessibleRelationSet() override
;
134 /// Return the set of current states.
135 virtual sal_Int64 SAL_CALL
getAccessibleStateSet() override
;
137 /** Return the parents locale or throw exception if this object has no
140 virtual css::lang::Locale SAL_CALL
141 getLocale() override
;
143 //===== XAccessibleComponent ================================================
145 /** The default implementation uses the result of
146 <member>getBounds</member> to determine whether the given point lies
149 virtual sal_Bool SAL_CALL
containsPoint (
150 const css::awt::Point
& aPoint
) override
;
152 /** The default implementation returns an empty reference.
154 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
155 getAccessibleAtPoint (
156 const css::awt::Point
& aPoint
) override
;
158 /** The default implementation returns an empty rectangle.
160 virtual css::awt::Rectangle SAL_CALL
getBounds() override
;
162 /** The default implementation uses the result of
163 <member>getBounds</member> to determine the location.
165 virtual css::awt::Point SAL_CALL
getLocation() override
;
167 /** The default implementation returns an empty position, i.e. the
168 * result of the default constructor of <type>css::awt::Point</type>.
170 virtual css::awt::Point SAL_CALL
getLocationOnScreen() override
;
172 /** The default implementation uses the result of
173 <member>getBounds</member> to determine the size.
175 virtual css::awt::Size SAL_CALL
getSize() override
;
177 /** The default implementation does nothing.
179 virtual void SAL_CALL
grabFocus() override
;
181 /** Returns black as the default foreground color.
183 virtual sal_Int32 SAL_CALL
getForeground() override
;
185 /** Returns white as the default background color.
187 virtual sal_Int32 SAL_CALL
getBackground() override
;
189 //===== XAccessibleSelection ==============================================
191 virtual void SAL_CALL
192 selectAccessibleChild (sal_Int64 nChildIndex
) override
;
194 virtual sal_Bool SAL_CALL
195 isAccessibleChildSelected( sal_Int64 nChildIndex
) override
;
197 virtual void SAL_CALL
198 clearAccessibleSelection( ) override
;
200 virtual void SAL_CALL
201 selectAllAccessibleChildren( ) override
;
203 virtual sal_Int64 SAL_CALL
204 getSelectedAccessibleChildCount( ) override
;
206 virtual css::uno::Reference
<
207 css::accessibility::XAccessible
> SAL_CALL
208 getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex
) override
;
210 virtual void SAL_CALL
211 deselectAccessibleChild( sal_Int64 nSelectedChildIndex
) override
;
213 //===== XServiceInfo ====================================================
215 /** Returns an identifier for the implementation of this object.
217 virtual OUString SAL_CALL
218 getImplementationName() override
;
220 /** Return whether the specified service is supported by this class.
222 virtual sal_Bool SAL_CALL
223 supportsService (const OUString
& sServiceName
) override
;
225 /** Returns a list of all supported services.
227 virtual css::uno::Sequence
< OUString
> SAL_CALL
228 getSupportedServiceNames() override
;
230 void SwitchViewActivated();
232 class Implementation
;
233 ::std::unique_ptr
<Implementation
> mpImpl
;
235 ::sd::slidesorter::SlideSorter
& mrSlideSorter
;
237 sal_uInt32 mnClientId
;
239 VclPtr
<vcl::Window
> mpContentWindow
;
241 /** Check whether or not the object has been disposed (or is in the
242 state of being disposed). If that is the case then
243 DisposedException is thrown to inform the (indirect) caller of the
246 @throws css::lang::DisposedException
248 void ThrowIfDisposed();
251 } // end of namespace ::accessibility
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */