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 <comphelper/compbase.hxx>
23 #include <com/sun/star/accessibility/XAccessible.hpp>
24 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
25 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
26 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
30 namespace sd::slidesorter
{ class SlideSorter
; }
32 namespace accessibility
{
34 typedef comphelper::WeakComponentImplHelper
<
35 css::accessibility::XAccessible
,
36 css::accessibility::XAccessibleEventBroadcaster
,
37 css::accessibility::XAccessibleContext
,
38 css::accessibility::XAccessibleComponent
,
39 css::lang::XServiceInfo
> AccessibleSlideSorterObjectBase
;
41 /** This class makes page objects of the slide sorter accessible.
43 class AccessibleSlideSorterObject
44 : public AccessibleSlideSorterObjectBase
47 /** Create a new object that represents a page object in the slide
50 The accessible parent.
52 The slide sorter whose model manages the page.
54 The number of the page in the range [0,nPageCount).
56 AccessibleSlideSorterObject(
57 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
58 ::sd::slidesorter::SlideSorter
& rSlideSorter
,
59 sal_uInt16 nPageNumber
);
60 virtual ~AccessibleSlideSorterObject() override
;
62 /** Return the page that is made accessible by the called object.
64 SdPage
* GetPage() const;
66 /** The page number as given to the constructor.
68 sal_uInt16
GetPageNumber() const { return mnPageNumber
;}
70 void FireAccessibleEvent (
72 const css::uno::Any
& rOldValue
,
73 const css::uno::Any
& rNewValue
);
75 virtual void disposing(std::unique_lock
<std::mutex
>&) override
;
77 //===== XAccessible =======================================================
79 virtual css::uno::Reference
<css::accessibility::XAccessibleContext
> SAL_CALL
80 getAccessibleContext() override
;
82 //===== XAccessibleEventBroadcaster =======================================
84 addAccessibleEventListener(
85 const css::uno::Reference
<css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
88 removeAccessibleEventListener(
89 const css::uno::Reference
<css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
91 //===== XAccessibleContext ==============================================
93 virtual sal_Int64 SAL_CALL
94 getAccessibleChildCount() override
;
96 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
97 getAccessibleChild (sal_Int64 nIndex
) override
;
99 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
100 getAccessibleParent() override
;
102 virtual sal_Int64 SAL_CALL
103 getAccessibleIndexInParent() override
;
105 virtual sal_Int16 SAL_CALL
106 getAccessibleRole() override
;
108 virtual OUString SAL_CALL
109 getAccessibleDescription() override
;
111 virtual OUString SAL_CALL
112 getAccessibleName() override
;
114 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
115 getAccessibleRelationSet() override
;
117 virtual sal_Int64 SAL_CALL
118 getAccessibleStateSet() override
;
120 virtual css::lang::Locale SAL_CALL
121 getLocale() override
;
123 //===== XAccessibleComponent ================================================
125 virtual sal_Bool SAL_CALL
containsPoint (
126 const css::awt::Point
& aPoint
) override
;
128 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
129 getAccessibleAtPoint (
130 const css::awt::Point
& aPoint
) override
;
132 virtual css::awt::Rectangle SAL_CALL
getBounds() override
;
134 virtual css::awt::Point SAL_CALL
getLocation() override
;
136 virtual css::awt::Point SAL_CALL
getLocationOnScreen() override
;
138 virtual css::awt::Size SAL_CALL
getSize() override
;
140 virtual void SAL_CALL
grabFocus() override
;
142 virtual sal_Int32 SAL_CALL
getForeground() override
;
144 virtual sal_Int32 SAL_CALL
getBackground() override
;
146 //===== XServiceInfo ====================================================
148 /** Returns an identifier for the implementation of this object.
150 virtual OUString SAL_CALL
151 getImplementationName() override
;
153 /** Return whether the specified service is supported by this class.
155 virtual sal_Bool SAL_CALL
156 supportsService (const OUString
& sServiceName
) override
;
158 /** Returns a list of all supported services.
160 virtual css::uno::Sequence
< OUString
> SAL_CALL
161 getSupportedServiceNames() override
;
164 css::uno::Reference
<css::accessibility::XAccessible
> mxParent
;
165 sal_uInt16 mnPageNumber
;
166 ::sd::slidesorter::SlideSorter
& mrSlideSorter
;
167 sal_uInt32 mnClientId
;
169 /** Check whether or not the object has been disposed (or is in the
170 state of being disposed). If that is the case then
171 DisposedException is thrown to inform the (indirect) caller of the
174 @throws css::lang::DisposedException
176 void ThrowIfDisposed();
178 /** Check whether or not the object has been disposed (or is in the
179 state of being disposed).
181 @return sal_True, if the object is disposed or in the course
182 of being disposed. Otherwise, sal_False is returned.
184 bool IsDisposed() const;
187 } // end of namespace ::accessibility
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */