30#include <com/sun/star/chart2/ScaleData.hpp>
31#include <com/sun/star/chart2/XAxis.hpp>
32#include <com/sun/star/chart2/XDataSeries.hpp>
33#include <com/sun/star/chart/ErrorBarStyle.hpp>
34#include <com/sun/star/drawing/XShape.hpp>
35#include <com/sun/star/view/XSelectionSupplier.hpp>
42using ::com::sun::star::uno::Reference;
43using ::com::sun::star::uno::Sequence;
51 Sequence< chart2::data::HighlightedRange > & rOutRanges,
52 const Sequence< OUString >& aRangeStrings,
53 Color nPreferredColor,
54 sal_Int32 nIndex = -1 )
56 rOutRanges.realloc( aRangeStrings.getLength());
57 auto pOutRanges = rOutRanges.getArray();
58 for( sal_Int32 i=0;
i<aRangeStrings.getLength(); ++
i )
60 pOutRanges[
i].RangeRepresentation = aRangeStrings[
i];
61 pOutRanges[
i].PreferredColor = sal_Int32(nPreferredColor);
62 pOutRanges[
i].AllowMerginigWithOtherRanges =
false;
74 m_xSelectionSupplier(xChartModel->getCurrentController(),
uno::UNO_QUERY),
75 m_xChartModel( xChartModel ),
76 m_nAddedListenerCount( 0 ),
77 m_bIncludeHiddenCells(true)
103 const uno::Type& rType = aSelection.getValueType();
111 if ( !aCID.isEmpty() )
120 eObjectType = eParentObjectType;
140 else if( xDataSeries.is() )
176 aSelection >>= xShape;
189 catch(
const uno::Exception & )
201 for( sal_Int32
i=0;
i<aSelectedRanges.getLength(); ++
i )
203 pSelectedRanges[
i].RangeRepresentation = aSelectedRanges[
i];
204 pSelectedRanges[
i].Index = -1;
205 pSelectedRanges[
i].PreferredColor = sal_Int32(defaultPreferredColor);
206 pSelectedRanges[
i].AllowMerginigWithOtherRanges =
true;
217 defaultPreferredColor );
226 bool bUsesRangesAsErrorBars =
false;
229 sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
230 bUsesRangesAsErrorBars =
232 (xErrorBar->getPropertyValue(
"ErrorBarStyle") >>= nStyle) &&
233 nStyle == css::chart::ErrorBarStyle::FROM_DATA );
235 catch(
const uno::Exception & )
240 if( bUsesRangesAsErrorBars )
247 defaultPreferredColor );
260 chart2::ScaleData
aData( xAxis->getScaleData());
263 defaultPreferredColor );
268 if( !xDataSeries.is())
271 Color nPreferredColor = defaultPreferredColor;
272 std::vector< chart2::data::HighlightedRange > aHilightedRanges;
273 const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aLSeqSeq( xDataSeries->getDataSequences2());
280 aHilightedRanges.emplace_back(
281 xLabel->getSourceRangeRepresentation(),
283 sal_Int32(nPreferredColor),
288 aHilightedRanges.emplace_back(
289 xValues->getSourceRangeRepresentation(),
291 sal_Int32(nPreferredColor),
309 lang::EventObject
aEvent(
static_cast< lang::XComponent*
>(
this ) );
310 xListener->selectionChanged(
aEvent );
337 lang::EventObject
aEvent(
static_cast< lang::XComponent*
>(
this ) );
339 [&
aEvent](
const css::uno::Reference<view::XSelectionChangeListener>& xListener)
341 xListener->selectionChanged(
aEvent);
static bool isIncludeHiddenCells(const rtl::Reference<::chart::ChartModel > &xChartModel)
static SAL_DLLPRIVATE css::uno::Sequence< OUString > getUsedDataRanges(const rtl::Reference< ::chart::Diagram > &xDiagram)
static SAL_DLLPRIVATE css::uno::Sequence< OUString > getRangesFromLabeledDataSequence(const css::uno::Reference< css::chart2::data::XLabeledDataSequence > &xLSeq)
static SAL_DLLPRIVATE css::uno::Sequence< OUString > getRangesFromDataSource(const css::uno::Reference< css::chart2::data::XDataSource > &xSource)
static rtl::Reference< ::chart::DataSeries > getDataSeriesForCID(std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel > &xChartModel)
static css::uno::Reference< css::beans::XPropertySet > getObjectPropertySet(std::u16string_view rObjectCID, const rtl::Reference< ::chart::ChartModel > &xChartDocument)
static sal_Int32 getIndexFromParticleOrCID(std::u16string_view rParticleOrCID)
static rtl::Reference< ::chart::Diagram > getDiagramForCID(std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel > &xChartModel)
static std::u16string_view getFullParentParticle(std::u16string_view rCID)
ObjectType getObjectType() const
css::uno::Sequence< css::chart2::data::HighlightedRange > m_aSelectedRanges
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
virtual css::uno::Sequence< css::chart2::data::HighlightedRange > SAL_CALL getSelectedRanges() override
virtual ~RangeHighlighter() override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
void fireSelectionEvent()
void fillRangesForCategories(const css::uno::Reference< css::chart2::XAxis > &xAxis)
void fillRangesForDataPoint(const rtl::Reference< ::chart::DataSeries > &xDataSeries, sal_Int32 nIndex)
sal_Int32 m_nAddedListenerCount
RangeHighlighter(const rtl::Reference< ::chart::ChartModel > &xSelectionSupplier)
bool m_bIncludeHiddenCells
void fillRangesForDiagram(const rtl::Reference< ::chart::Diagram > &xDiagram)
comphelper::OInterfaceContainerHelper4< css::view::XSelectionChangeListener > maSelectionChangeListeners
css::uno::Reference< css::view::XSelectionSupplier > m_xSelectionSupplier
void fillRangesForDataSeries(const css::uno::Reference< css::chart2::XDataSeries > &xSeries)
css::uno::Reference< css::view::XSelectionChangeListener > m_xListener
void fillRangesForErrorBars(const css::uno::Reference< css::beans::XPropertySet > &xErrorBar, const css::uno::Reference< css::chart2::XDataSeries > &xDataSeries)
virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
rtl::Reference< ::chart::ChartModel > m_xChartModel
virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
void forEach(std::unique_lock< std::mutex > &rGuard, FuncT const &func) const
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
sal_Int32 getLength(std::unique_lock< std::mutex > &rGuard) const
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
#define DBG_UNHANDLED_EXCEPTION(...)
constexpr OUStringLiteral aData
OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 translateIndexFromHiddenToFullSequence(sal_Int32 nClippedIndex, const css::uno::Reference< css::chart2::data::XDataSequence > &xDataSequence, bool bTranslate)
@ OBJECTTYPE_LEGEND_ENTRY
@ OBJECTTYPE_DATA_ERRORS_X
@ OBJECTTYPE_DIAGRAM_FLOOR
@ OBJECTTYPE_DATA_ERRORS_Y
@ OBJECTTYPE_DATA_ERRORS_Z
@ OBJECTTYPE_DIAGRAM_WALL
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)