Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / controller / inc / AccessibleChartView.hxx
blob0acac0d57e2be7750a92d7343611b0ccd8979b0c
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLECHARTVIEW_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLECHARTVIEW_HXX
22 #include "AccessibleBase.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>
28 #include <memory>
30 namespace com { namespace sun { namespace star { namespace accessibility { class XAccessible; } } } }
31 namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
32 namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
33 namespace com { namespace sun { namespace star { namespace view { class XSelectionSupplier; } } } }
35 namespace accessibility
37 class IAccessibleViewForwarder;
40 namespace chart
43 namespace impl
45 typedef ::cppu::ImplInheritanceHelper<
46 ::chart::AccessibleBase,
47 css::lang::XInitialization,
48 css::view::XSelectionChangeListener >
49 AccessibleChartView_Base;
52 class AccessibleChartView :
53 public impl::AccessibleChartView_Base
55 public:
56 AccessibleChartView(SdrView* pView );
57 virtual ~AccessibleChartView() override;
59 AccessibleChartView() = delete;
61 // ____ WeakComponentHelper (called from XComponent::dispose()) ____
62 using AccessibleBase::disposing;
64 // ____ lang::XInitialization ____
65 // 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
66 // 1: frame::XModel representing the chart model - offers access to object data
67 // 2: lang::XInterface representing the normal chart view - offers access to some extra object data
68 // 3: accessibility::XAccessible representing the parent accessible
69 // 4: awt::XWindow representing the view's window (is a vcl Window)
70 // all arguments are only valid until next initialization - don't keep them longer
71 virtual void SAL_CALL initialize(
72 const css::uno::Sequence< css::uno::Any >& aArguments ) override;
74 // ____ view::XSelectionChangeListener ____
75 virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
77 // ________ XEventListener ________
78 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
80 // ________ XAccessibleContext ________
81 virtual OUString SAL_CALL getAccessibleDescription() override;
82 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
83 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
84 virtual OUString SAL_CALL getAccessibleName() override;
85 virtual sal_Int16 SAL_CALL getAccessibleRole() override;
87 // ________ XAccessibleComponent ________
88 virtual css::awt::Rectangle SAL_CALL getBounds() override;
89 virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
91 protected:
92 // ________ AccessibleChartElement ________
93 virtual css::awt::Point GetUpperLeftOnScreen() const override;
95 private: // methods
96 /** @return the result that m_xWindow->getPosSize() _should_ return. It
97 returns (0,0) as upper left corner. When calling
98 getAccessibleParent, you get the parent's parent, which contains
99 a decoration. Thus you have an offset of (currently) (2,2)
100 which isn't taken into account.
102 css::awt::Rectangle GetWindowPosSize() const;
104 private: // members
105 css::uno::WeakReference< css::view::XSelectionSupplier > m_xSelectionSupplier;
106 css::uno::WeakReference< css::frame::XModel > m_xChartModel;
107 css::uno::WeakReference< css::uno::XInterface > m_xChartView;
108 css::uno::WeakReference< css::awt::XWindow > m_xWindow;
109 css::uno::WeakReference< css::accessibility::XAccessible > m_xParent;
111 std::shared_ptr< ObjectHierarchy > m_spObjectHierarchy;
112 AccessibleUniqueId m_aCurrentSelectionOID;
113 SdrView* m_pSdrView;
114 std::unique_ptr<::accessibility::IAccessibleViewForwarder> m_pViewForwarder;
117 } //namespace chart
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */