Bump version to 6.4-15
[LibreOffice.git] / svx / source / inc / GraphCtlAccessibleContext.hxx
blob9d348c6f3ce726251ddb488130c3c701940b4a81
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 .
21 #ifndef INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
22 #define INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
24 #include <cppuhelper/compbase7.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/IllegalAccessibleComponentStateException.hpp>
31 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
32 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
33 #include <cppuhelper/weak.hxx>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/lang/XTypeProvider.hpp>
36 #include <com/sun/star/lang/XServiceName.hpp>
37 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
38 #include <cppuhelper/basemutex.hxx>
39 #include <svl/lstner.hxx>
41 #include <set>
42 #include <map>
44 #include <svx/rectenum.hxx>
45 #include <svx/AccessibleShapeTreeInfo.hxx>
46 #include <svx/IAccessibleViewForwarder.hxx>
47 #include <svx/AccessibleShape.hxx>
49 namespace com { namespace sun { namespace star { namespace awt {
50 struct Point;
51 struct Rectangle;
52 struct Size;
53 class XFocusListener;
54 } } } }
56 namespace tools { class Rectangle; }
57 class GraphCtrl;
58 class SdrObject;
59 class SdrModel;
60 class SdrPage;
61 class SdrView;
63 /** @descr
64 This base class provides an implementation of the
65 <code>AccessibleContext</code> service.
68 typedef ::cppu::WeakAggComponentImplHelper7<
69 css::accessibility::XAccessible,
70 css::accessibility::XAccessibleComponent,
71 css::accessibility::XAccessibleContext,
72 css::accessibility::XAccessibleEventBroadcaster,
73 css::accessibility::XAccessibleSelection,
74 css::lang::XServiceInfo,
75 css::lang::XServiceName >
76 SvxGraphCtrlAccessibleContext_Base;
78 class SvxGraphCtrlAccessibleContext final :
79 private cppu::BaseMutex, public SvxGraphCtrlAccessibleContext_Base,
80 public SfxListener, public ::accessibility::IAccessibleViewForwarder
82 public:
83 friend class GraphCtrl;
85 // internal
86 SvxGraphCtrlAccessibleContext(GraphCtrl& rRepresentation);
88 void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ) override;
90 // XAccessible
91 /// Return the XAccessibleContext.
92 virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL
93 getAccessibleContext() override;
95 // XAccessibleComponent
96 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& rPoint ) override;
97 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
98 virtual css::awt::Rectangle SAL_CALL getBounds() override;
99 virtual css::awt::Point SAL_CALL getLocation() override;
100 virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
101 virtual css::awt::Size SAL_CALL getSize() override;
102 virtual void SAL_CALL grabFocus() override;
104 virtual sal_Int32 SAL_CALL getForeground() override;
106 virtual sal_Int32 SAL_CALL getBackground() override;
108 // XAccessibleContext
109 virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
110 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int32 nIndex) override;
111 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override;
112 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
113 virtual sal_Int16 SAL_CALL getAccessibleRole() override;
114 virtual OUString SAL_CALL getAccessibleDescription() override;
115 virtual OUString SAL_CALL getAccessibleName() override;
116 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet() override;
117 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet() override;
118 virtual css::lang::Locale SAL_CALL getLocale() override;
120 // XAccessibleEventBroadcaster
121 virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener>& xListener) override;
122 virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener>& xListener) override;
124 // XServiceInfo
125 virtual OUString SAL_CALL getImplementationName() override;
126 virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) override;
127 virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
129 // XTypeProvider
130 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
132 // XServiceName
133 virtual OUString SAL_CALL getServiceName() override;
135 // XAccessibleSelection
136 virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override;
137 virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
138 virtual void SAL_CALL clearAccessibleSelection() override;
139 virtual void SAL_CALL selectAllAccessibleChildren() override;
140 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override;
141 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
142 virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
144 // IAccessibleViewforwarder
145 virtual tools::Rectangle GetVisibleArea() const override;
146 virtual Point LogicToPixel (const Point& rPoint) const override;
147 virtual Size LogicToPixel (const Size& rSize) const override;
149 /** This method is used by the graph control to tell the
150 accessibility object about a new model and view.
152 void setModelAndView (SdrModel* pModel, SdrView* pView);
154 private:
155 virtual ~SvxGraphCtrlAccessibleContext() override;
156 /// @throws css::lang::IndexOutOfBoundsException
157 void checkChildIndexOnSelection( long nIndexOfChild );
159 virtual void SAL_CALL disposing() final override;
161 /// @throws css::uno::RuntimeException
162 /// @throws css::lang::IndexOutOfBoundsException
163 SdrObject* getSdrObject( sal_Int32 nIndex );
165 void CommitChange (sal_Int16 aEventId, const css::uno::Any& rNewValue, const css::uno::Any& rOldValue);
167 css::uno::Reference< css::accessibility::XAccessible > getAccessible( const SdrObject* pObj );
169 ::accessibility::AccessibleShapeTreeInfo maTreeInfo;
171 /** Description of this object. This is not a constant because it can
172 be set from the outside.
174 OUString msDescription;
176 /** Name of this object.
178 OUString msName;
180 /// map of accessible shapes
181 typedef ::std::map< const SdrObject*, rtl::Reference<::accessibility::AccessibleShape> > ShapesMapType;
182 ShapesMapType mxShapes;
184 GraphCtrl* mpControl;
186 SdrModel* mpModel;
187 SdrPage* mpPage;
188 SdrView* mpView;
190 /// client id in the AccessibleEventNotifier queue
191 sal_uInt32 mnClientId;
193 bool mbDisposed;
196 #endif
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */