LibreOffice Module svx (master)  1
GraphCtlAccessibleContext.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 
21 #ifndef INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
22 #define INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
23 
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/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>
35 
36 #include <map>
37 
40 #include <svx/AccessibleShape.hxx>
41 
42 namespace com::sun::star::awt {
43  struct Point;
44  struct Rectangle;
45  struct Size;
46  class XFocusListener;
47 }
48 namespace tools { class Rectangle; }
49 class GraphCtrl;
50 class SdrObject;
51 class SdrModel;
52 class SdrPage;
53 class SdrView;
54 
60 typedef ::cppu::WeakAggComponentImplHelper7<
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 >
69 
73 {
74 public:
75  friend class GraphCtrl;
76 
77  // internal
78  SvxGraphCtrlAccessibleContext(GraphCtrl& rRepresentation);
79 
80  void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ) override;
81 
82  // XAccessible
84  virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL
85  getAccessibleContext() override;
86 
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;
95 
96  virtual sal_Int32 SAL_CALL getForeground() override;
97 
98  virtual sal_Int32 SAL_CALL getBackground() override;
99 
100  // XAccessibleContext
101  virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
102  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int32 nIndex) override;
103  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override;
104  virtual sal_Int32 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 css::uno::Reference< css::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet() override;
110  virtual css::lang::Locale SAL_CALL getLocale() override;
111 
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;
115 
116  // XServiceInfo
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;
120 
121  // XTypeProvider
122  virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
123 
124  // XServiceName
125  virtual OUString SAL_CALL getServiceName() override;
126 
127  // XAccessibleSelection
128  virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override;
129  virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
130  virtual void SAL_CALL clearAccessibleSelection() override;
131  virtual void SAL_CALL selectAllAccessibleChildren() override;
132  virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override;
133  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
134  virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
135 
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;
140 
145 
146 private:
147  virtual ~SvxGraphCtrlAccessibleContext() override;
149  void checkChildIndexOnSelection( long nIndexOfChild );
150 
151  virtual void SAL_CALL disposing() final override;
152 
155  SdrObject* getSdrObject( sal_Int32 nIndex );
156 
157  void CommitChange (sal_Int16 aEventId, const css::uno::Any& rNewValue, const css::uno::Any& rOldValue);
158 
159  css::uno::Reference< css::accessibility::XAccessible > getAccessible( const SdrObject* pObj );
160 
161  ::accessibility::AccessibleShapeTreeInfo maTreeInfo;
162 
166  OUString msDescription;
167 
170  OUString msName;
171 
173  typedef ::std::map< const SdrObject*, rtl::Reference<::accessibility::AccessibleShape> > ShapesMapType;
174  ShapesMapType mxShapes;
175 
177 
181 
183  sal_uInt32 mnClientId;
184 
186 };
187 
188 #endif
189 
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Notify(SfxBroadcaster &aBC, const SfxHint &aHint) override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return empty reference to indicate that the relation set is not supported.
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
SvxGraphCtrlAccessibleContext(GraphCtrl &rRepresentation)
initialize this component and set default values
sal_uInt32 mnClientId
client id in the AccessibleEventNotifier queue
std::unique_ptr< SdrModel > pModel
Definition: graphctl.hxx:74
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
Return the XAccessibleContext.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
virtual css::lang::Locale SAL_CALL getLocale() override
OUString msName
Name of this object.
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
virtual void SAL_CALL grabFocus() override
virtual css::awt::Rectangle SAL_CALL getBounds() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
virtual tools::Rectangle GetVisibleArea() const override
Returns the area of the underlying document that is visible in the corresponding window.
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual css::awt::Size SAL_CALL getSize() override
OUString msDescription
Description of this object.
::std::map< const SdrObject *, rtl::Reference<::accessibility::AccessibleShape > > ShapesMapType
map of accessible shapes
virtual ~SvxGraphCtrlAccessibleContext() override
on destruction, this component is disposed and all dispose listeners are called, except if this compo...
void CommitChange(sal_Int16 aEventId, const css::uno::Any &rNewValue, const css::uno::Any &rOldValue)
sends an AccessibleEventObject to all added XAccessibleEventListeners
SdrObject * getSdrObject(sal_Int32 nIndex)
returns the SdrObject at index nIndex from the model of this graph
virtual OUString SAL_CALL getAccessibleName() override
::cppu::WeakAggComponentImplHelper7< css::accessibility::XAccessible, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleEventBroadcaster, css::accessibility::XAccessibleSelection, css::lang::XServiceInfo, css::lang::XServiceName > SvxGraphCtrlAccessibleContext_Base
This base class provides an implementation of the AccessibleContext service.
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nSelectedChildIndex) override
void checkChildIndexOnSelection(long nIndexOfChild)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
unsigned char sal_Bool
virtual OUString SAL_CALL getServiceName() override
virtual OUString SAL_CALL getAccessibleDescription() override
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual sal_Int32 SAL_CALL getBackground() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &rPoint) override
virtual void SAL_CALL clearAccessibleSelection() override
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
virtual sal_Int32 SAL_CALL getForeground() override
virtual void SAL_CALL selectAllAccessibleChildren() override
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
virtual css::awt::Point SAL_CALL getLocation() override
std::unique_ptr< SdrView > pView
Definition: graphctl.hxx:75
virtual void SAL_CALL disposing() final override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
css::uno::Reference< css::accessibility::XAccessible > getAccessible(const SdrObject *pObj)
returns the XAccessible interface for a given SdrObject.
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:365
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
void setModelAndView(SdrModel *pModel, SdrView *pView)
This method is used by the graph control to tell the accessibility object about a new model and view...
virtual Point LogicToPixel(const Point &rPoint) const override
Transform the specified point from internal coordinates in 100th of mm to an absolute screen position...
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
::accessibility::AccessibleShapeTreeInfo maTreeInfo