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 #include "AccessibleBase.hxx"
22 #include <cppuhelper/implbase.hxx>
23 #include <cppuhelper/weakref.hxx>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/view/XSelectionChangeListener.hpp>
29 namespace com::sun::star::accessibility
{ class XAccessible
; }
30 namespace com::sun::star::awt
{ class XWindow
; }
31 namespace com::sun::star::frame
{ class XModel
; }
32 namespace com::sun::star::view
{ class XSelectionSupplier
; }
34 namespace accessibility
36 class IAccessibleViewForwarder
;
45 typedef ::cppu::ImplInheritanceHelper
<
46 ::chart::AccessibleBase
,
47 css::view::XSelectionChangeListener
>
48 AccessibleChartView_Base
;
51 class AccessibleChartView final
:
52 public impl::AccessibleChartView_Base
55 AccessibleChartView( SdrView
* pView
);
56 virtual ~AccessibleChartView() override
;
58 AccessibleChartView() = delete;
60 // ____ WeakComponentHelper (called from XComponent::dispose()) ____
61 using AccessibleBase::disposing
;
63 // 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
64 // 1: frame::XModel representing the chart model - offers access to object data
65 // 2: lang::XInterface representing the normal chart view - offers access to some extra object data
66 // 3: accessibility::XAccessible representing the parent accessible
67 // 4: awt::XWindow representing the view's window (is a vcl Window)
68 // all arguments are only valid until next initialization - don't keep them longer
69 void initialize( ChartController
& rChartController
,
70 const rtl::Reference
<::chart::ChartModel
>& xChartModel
,
71 const rtl::Reference
<::chart::ChartView
>& xChartView
,
72 const css::uno::Reference
< css::accessibility::XAccessible
>& xParent
,
73 const css::uno::Reference
<css::awt::XWindow
>& xViewWindow
);
74 // used to disconnect from view
77 // ____ view::XSelectionChangeListener ____
78 virtual void SAL_CALL
selectionChanged( const css::lang::EventObject
& aEvent
) override
;
80 // ________ XEventListener ________
81 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
83 // ________ XAccessibleContext ________
84 virtual OUString SAL_CALL
getAccessibleDescription() override
;
85 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent() override
;
86 virtual sal_Int64 SAL_CALL
getAccessibleIndexInParent() override
;
87 virtual OUString SAL_CALL
getAccessibleName() override
;
88 virtual sal_Int16 SAL_CALL
getAccessibleRole() override
;
90 // ________ XAccessibleComponent ________
91 virtual css::awt::Rectangle SAL_CALL
getBounds() override
;
92 virtual css::awt::Point SAL_CALL
getLocationOnScreen() override
;
95 // ________ AccessibleChartElement ________
96 virtual css::awt::Point
GetUpperLeftOnScreen() const override
;
99 /** @return the result that m_xWindow->getPosSize() _should_ return. It
100 returns (0,0) as upper left corner. When calling
101 getAccessibleParent, you get the parent's parent, which contains
102 a decoration. Thus you have an offset of (currently) (2,2)
103 which isn't taken into account.
105 css::awt::Rectangle
GetWindowPosSize() const;
108 unotools::WeakReference
< ::chart::ChartController
> m_xChartController
;
109 unotools::WeakReference
< ::chart::ChartModel
> m_xChartModel
;
110 unotools::WeakReference
< ChartView
> m_xChartView
;
111 css::uno::WeakReference
< css::awt::XWindow
> m_xWindow
;
112 css::uno::WeakReference
< css::accessibility::XAccessible
> m_xParent
;
114 std::shared_ptr
< ObjectHierarchy
> m_spObjectHierarchy
;
115 AccessibleUniqueId m_aCurrentSelectionOID
;
117 std::unique_ptr
<::accessibility::IAccessibleViewForwarder
> m_pViewForwarder
;
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */