Debian Codegraph @

chart2/source/controller/inc/AccessibleChartView.hxx

raw
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 #pragma once
20
21 #include "AccessibleBase.hxx"
22 #include "ChartWindow.hxx"
23 #include <cppuhelper/implbase.hxx>
24 #include <cppuhelper/weakref.hxx>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/view/XSelectionChangeListener.hpp>
27
28 #include <memory>
29
30 namespace com::sun::star::accessibility { class XAccessible; }
31
32 namespace accessibility
33 {
34 class IAccessibleViewForwarder;
35 }
36
37 namespace chart
38 {
39 class ChartView;
40
41 class AccessibleChartView final
42 : public cppu::ImplInheritanceHelper<chart::AccessibleBase, css::view::XSelectionChangeListener>
43 {
44 public:
45 AccessibleChartView( SdrView* pView );
46 virtual ~AccessibleChartView() override;
47
48 AccessibleChartView() = delete;
49
50 virtual void SAL_CALL disposing() override;
51
52 // 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
53 // 1: frame::XModel representing the chart model - offers access to object data
54 // 2: lang::XInterface representing the normal chart view - offers access to some extra object data
55 // 3: accessibility::XAccessible representing the parent accessible
56 // 4: ChartWindow representing the view's window
57 // all arguments are only valid until next initialization - don't keep them longer
58 void initialize( ChartController& rChartController,
59 const rtl::Reference<::chart::ChartModel>& xChartModel,
60 const rtl::Reference<::chart::ChartView>& xChartView,
61 const css::uno::Reference< css::accessibility::XAccessible >& xParent,
62 ChartWindow* pNewChartWindow);
63 // used to disconnect from view
64 void initialize();
65
66 // ____ view::XSelectionChangeListener ____
67 virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
68
69 // ________ XEventListener ________
70 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
71
72 // ________ XAccessibleContext ________
73 virtual OUString SAL_CALL getAccessibleDescription() override;
74 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
75 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
76 virtual OUString SAL_CALL getAccessibleName() override;
77 virtual sal_Int16 SAL_CALL getAccessibleRole() override;
78
79 // OAccessible
80 virtual css::awt::Rectangle implGetBounds() override;
81
82 protected:
83 // ________ AccessibleChartElement ________
84 virtual css::awt::Point GetUpperLeftOnScreen() const override;
85
86 private: // methods
87 /** @return the result that m_xWindow->getPosSize() _should_ return. It
88 returns (0,0) as upper left corner. When calling
89 getAccessibleParent, you get the parent's parent, which contains
90 a decoration. Thus you have an offset of (currently) (2,2)
91 which isn't taken into account.
92 */
93 css::awt::Rectangle GetWindowPosSize() const;
94
95 private: // members
96 unotools::WeakReference< ::chart::ChartController > m_xChartController;
97 unotools::WeakReference< ::chart::ChartModel > m_xChartModel;
98 unotools::WeakReference< ChartView > m_xChartView;
99 VclPtr<ChartWindow> m_pChartWindow;
100 css::uno::WeakReference< css::accessibility::XAccessible > m_xParent;
101
102 std::shared_ptr< ObjectHierarchy > m_spObjectHierarchy;
103 AccessibleUniqueId m_aCurrentSelectionOID;
104 SdrView* m_pSdrView;
105 std::unique_ptr<::accessibility::IAccessibleViewForwarder> m_pViewForwarder;
106 };
107
108 } //namespace chart
109
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */