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 .
21 #ifndef INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
22 #define INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
24 #include <cppuhelper/compbase.hxx>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <com/sun/star/accessibility/XAccessible.hpp>
27 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
28 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
29 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
30 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XServiceName.hpp>
33 #include <cppuhelper/basemutex.hxx>
34 #include <svl/lstner.hxx>
38 #include <svx/AccessibleShapeTreeInfo.hxx>
39 #include <svx/IAccessibleViewForwarder.hxx>
40 #include <svx/AccessibleShape.hxx>
42 namespace com::sun::star::awt
{
48 namespace tools
{ class Rectangle
; }
56 This base class provides an implementation of the
57 <code>AccessibleContext</code> service.
60 typedef ::cppu::WeakComponentImplHelper
<
61 css::accessibility::XAccessible
,
62 css::accessibility::XAccessibleComponent
,
63 css::accessibility::XAccessibleContext
,
64 css::accessibility::XAccessibleEventBroadcaster
,
65 css::accessibility::XAccessibleSelection
,
66 css::lang::XServiceInfo
,
67 css::lang::XServiceName
>
68 SvxGraphCtrlAccessibleContext_Base
;
70 class SvxGraphCtrlAccessibleContext final
:
71 private cppu::BaseMutex
, public SvxGraphCtrlAccessibleContext_Base
,
72 public SfxListener
, public ::accessibility::IAccessibleViewForwarder
75 friend class GraphCtrl
;
78 SvxGraphCtrlAccessibleContext(GraphCtrl
& rRepresentation
);
80 void Notify( SfxBroadcaster
& aBC
, const SfxHint
& aHint
) override
;
83 /// Return the XAccessibleContext.
84 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
85 getAccessibleContext() override
;
87 // XAccessibleComponent
88 virtual sal_Bool SAL_CALL
containsPoint( const css::awt::Point
& rPoint
) override
;
89 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& rPoint
) override
;
90 virtual css::awt::Rectangle SAL_CALL
getBounds() override
;
91 virtual css::awt::Point SAL_CALL
getLocation() override
;
92 virtual css::awt::Point SAL_CALL
getLocationOnScreen() override
;
93 virtual css::awt::Size SAL_CALL
getSize() override
;
94 virtual void SAL_CALL
grabFocus() override
;
96 virtual sal_Int32 SAL_CALL
getForeground() override
;
98 virtual sal_Int32 SAL_CALL
getBackground() override
;
100 // XAccessibleContext
101 virtual sal_Int64 SAL_CALL
getAccessibleChildCount() override
;
102 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild (sal_Int64 nIndex
) override
;
103 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent() override
;
104 virtual sal_Int64 SAL_CALL
getAccessibleIndexInParent() override
;
105 virtual sal_Int16 SAL_CALL
getAccessibleRole() override
;
106 virtual OUString SAL_CALL
getAccessibleDescription() override
;
107 virtual OUString SAL_CALL
getAccessibleName() override
;
108 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet() override
;
109 virtual sal_Int64 SAL_CALL
getAccessibleStateSet() override
;
110 virtual css::lang::Locale SAL_CALL
getLocale() override
;
112 // XAccessibleEventBroadcaster
113 virtual void SAL_CALL
addAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& xListener
) override
;
114 virtual void SAL_CALL
removeAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& xListener
) override
;
117 virtual OUString SAL_CALL
getImplementationName() override
;
118 virtual sal_Bool SAL_CALL
supportsService (const OUString
& sServiceName
) override
;
119 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
122 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId() override
;
125 virtual OUString SAL_CALL
getServiceName() override
;
127 // XAccessibleSelection
128 virtual void SAL_CALL
selectAccessibleChild( sal_Int64 nChildIndex
) override
;
129 virtual sal_Bool SAL_CALL
isAccessibleChildSelected( sal_Int64 nChildIndex
) override
;
130 virtual void SAL_CALL
clearAccessibleSelection() override
;
131 virtual void SAL_CALL
selectAllAccessibleChildren() override
;
132 virtual sal_Int64 SAL_CALL
getSelectedAccessibleChildCount() override
;
133 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex
) override
;
134 virtual void SAL_CALL
deselectAccessibleChild( sal_Int64 nSelectedChildIndex
) override
;
136 // IAccessibleViewforwarder
137 virtual tools::Rectangle
GetVisibleArea() const override
;
138 virtual Point
LogicToPixel (const Point
& rPoint
) const override
;
139 virtual Size
LogicToPixel (const Size
& rSize
) const override
;
141 /** This method is used by the graph control to tell the
142 accessibility object about a new model and view.
144 void setModelAndView (SdrModel
* pModel
, SdrView
* pView
);
147 virtual ~SvxGraphCtrlAccessibleContext() override
;
148 /// @throws css::lang::IndexOutOfBoundsException
149 void checkChildIndexOnSelection(sal_Int64 nIndexOfChild
);
151 virtual void SAL_CALL
disposing() final override
;
153 /// @throws css::uno::RuntimeException
154 /// @throws css::lang::IndexOutOfBoundsException
155 SdrObject
* getSdrObject( sal_Int64 nIndex
);
157 void CommitChange (sal_Int16 aEventId
, const css::uno::Any
& rNewValue
, const css::uno::Any
& rOldValue
);
159 css::uno::Reference
< css::accessibility::XAccessible
> getAccessible( const SdrObject
* pObj
);
161 ::accessibility::AccessibleShapeTreeInfo maTreeInfo
;
163 /** Description of this object. This is not a constant because it can
164 be set from the outside.
166 OUString msDescription
;
168 /** Name of this object.
172 /// map of accessible shapes
173 typedef ::std::map
< const SdrObject
*, rtl::Reference
<::accessibility::AccessibleShape
> > ShapesMapType
;
174 ShapesMapType mxShapes
;
176 GraphCtrl
* mpControl
;
182 /// client id in the AccessibleEventNotifier queue
183 sal_uInt32 mnClientId
;
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */