From 374d3fbf89830a8ee8f4e2e3a802aa408b15afe4 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 15 Jul 2015 21:15:15 +0200 Subject: handle changes to legend checkbox Change-Id: I3901ce4f7664eb7b8eca50014f5916fd6ccb0854 --- chart2/source/controller/sidebar/ChartElementsPanel.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 1c22c605d9b4..8aa044b9a518 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -136,6 +136,18 @@ bool isLegendVisible(css::uno::Reference xModel) return false; } +void setLegendVisible(css::uno::Reference xModel, bool bVisible) +{ + ChartModel* pModel = getChartModel(xModel); + if (!pModel) + return; + + if (bVisible) + LegendHelper::showLegend(*pModel, comphelper::getProcessComponentContext()); + else + LegendHelper::hideLegend(*pModel); +} + bool isTitleVisisble(css::uno::Reference xModel, TitleHelper::eTitleType eTitle) { return TitleHelper::getTitle(eTitle, xModel).is(); @@ -402,6 +414,8 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox) setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked); else if (pCheckBox == mpCB2ndYAxisTitle.get()) setTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked); + else if (pCheckBox == mpCBLegend.get()) + setLegendVisible(mxModel, bChecked); return 0; } -- cgit