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 <comphelper/compbase.hxx>
22 #include <comphelper/interfacecontainer4.hxx>
23 #include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
24 #include <com/sun/star/view/XSelectionChangeListener.hpp>
25 #include <rtl/ref.hxx>
27 namespace com::sun::star
{
34 namespace com::sun::star::beans
{ class XPropertySet
; }
35 namespace com::sun::star::view
{ class XSelectionSupplier
; }
45 typedef comphelper::WeakComponentImplHelper
<
46 css::chart2::data::XRangeHighlighter
,
47 css::view::XSelectionChangeListener
49 RangeHighlighter_Base
;
52 class RangeHighlighter final
:
53 public impl::RangeHighlighter_Base
56 explicit RangeHighlighter(
57 const rtl::Reference
< ::chart::ChartModel
> & xSelectionSupplier
);
58 virtual ~RangeHighlighter() override
;
61 // ____ XRangeHighlighter ____
62 virtual css::uno::Sequence
< css::chart2::data::HighlightedRange
> SAL_CALL
getSelectedRanges() override
;
63 virtual void SAL_CALL
addSelectionChangeListener(
64 const css::uno::Reference
< css::view::XSelectionChangeListener
>& xListener
) override
;
65 virtual void SAL_CALL
removeSelectionChangeListener(
66 const css::uno::Reference
< css::view::XSelectionChangeListener
>& xListener
) override
;
68 // ____ XSelectionChangeListener ____
69 virtual void SAL_CALL
selectionChanged(
70 const css::lang::EventObject
& aEvent
) override
;
72 // ____ XEventListener (base of XSelectionChangeListener) ____
73 virtual void SAL_CALL
disposing(
74 const css::lang::EventObject
& Source
) override
;
76 // ____ WeakComponentImplHelperBase ____
77 // is called when dispose() is called at this component
78 virtual void disposing(std::unique_lock
<std::mutex
>&) override
;
81 void fireSelectionEvent();
82 void startListening();
84 void determineRanges();
86 void fillRangesForDiagram( const rtl::Reference
< ::chart::Diagram
> & xDiagram
);
87 void fillRangesForDataSeries( const css::uno::Reference
< css::chart2::XDataSeries
> & xSeries
);
88 void fillRangesForCategories( const css::uno::Reference
< css::chart2::XAxis
> & xAxis
);
89 void fillRangesForDataPoint( const rtl::Reference
< ::chart::DataSeries
> & xDataSeries
, sal_Int32 nIndex
);
90 void fillRangesForErrorBars( const css::uno::Reference
< css::beans::XPropertySet
> & xErrorBar
,
91 const css::uno::Reference
< css::chart2::XDataSeries
> & xDataSeries
);
93 css::uno::Reference
< css::view::XSelectionSupplier
>
95 rtl::Reference
< ::chart::ChartModel
> m_xChartModel
;
96 css::uno::Reference
< css::view::XSelectionChangeListener
>
98 css::uno::Sequence
< css::chart2::data::HighlightedRange
>
100 sal_Int32 m_nAddedListenerCount
;
101 bool m_bIncludeHiddenCells
;
102 comphelper::OInterfaceContainerHelper4
<css::view::XSelectionChangeListener
> maSelectionChangeListeners
;
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */