[Libreoffice-commits] core.git: Branch 'feature/chart-sidebar' - chart2/source

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Jul 15 08:46:02 PDT 2015


 chart2/source/controller/sidebar/ChartElementsPanel.cxx |   55 ++++++++++++++++
 1 file changed, 55 insertions(+)

New commits:
commit 3a590bb197930e2104ff28331fafdc26ff478cf5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jul 15 17:44:56 2015 +0200

    react to changing the checkboxes: axis
    
    Change-Id: Ic1296b9035dce00837b8e8d24cc63e1d9bda0b88

diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 11039e8..d73ffaa5 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -31,6 +31,7 @@
 #include <vcl/toolbox.hxx>
 #include <svl/intitem.hxx>
 #include <svl/stritem.hxx>
+#include <comphelper/processfactory.hxx>
 
 #include "LegendHelper.hxx"
 #include "TitleHelper.hxx"
@@ -174,7 +175,26 @@ bool isAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eTyp
         return bHasAxis;
     }
     return false;
+}
+
+void setAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eType, bool bVisible)
+{
+    Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+    if(xDiagram.is())
+    {
+        sal_Int32 nDimensionIndex = 0;
+        if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND)
+            nDimensionIndex = 1;
+        else if (eType == AxisType::Z_MAIN)
+            nDimensionIndex = 2;
+
+        bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND);
 
+        if (bVisible)
+            AxisHelper::showAxis(nDimensionIndex, bMajor, xDiagram, comphelper::getProcessComponentContext());
+        else
+            AxisHelper::hideAxis(nDimensionIndex, bMajor, xDiagram);
+    }
 }
 
 }
@@ -248,6 +268,23 @@ void ChartElementsPanel::Initialize()
     css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
     xBroadcaster->addModifyListener(mxListener);
     updateData();
+
+    Link<> aLink = LINK(this, ChartElementsPanel, CheckBoxHdl);
+    mpCBTitle->SetClickHdl(aLink);
+    mpCBSubtitle->SetClickHdl(aLink);
+    mpCBXAxis->SetClickHdl(aLink);
+    mpCBXAxisTitle->SetClickHdl(aLink);
+    mpCBYAxis->SetClickHdl(aLink);
+    mpCBYAxisTitle->SetClickHdl(aLink);
+    mpCBZAxis->SetClickHdl(aLink);
+    mpCBZAxisTitle->SetClickHdl(aLink);
+    mpCB2ndXAxis->SetClickHdl(aLink);
+    mpCB2ndXAxisTitle->SetClickHdl(aLink);
+    mpCB2ndYAxis->SetClickHdl(aLink);
+    mpCB2ndYAxisTitle->SetClickHdl(aLink);
+    mpCBLegend->SetClickHdl(aLink);
+    mpCBGridVertical->SetClickHdl(aLink);
+    mpCBGridHorizontal->SetClickHdl(aLink);
 }
 
 void ChartElementsPanel::updateData()
@@ -324,6 +361,24 @@ void ChartElementsPanel::modelInvalid()
 
 }
 
+IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
+{
+    bool bChecked = pCheckBox->IsChecked();
+    if (pCheckBox == mpCBTitle.get())
+    {
+    }
+    else if (pCheckBox == mpCBXAxis.get())
+        setAxisVisible(mxModel, AxisType::X_MAIN, bChecked);
+    else if (pCheckBox == mpCBYAxis.get())
+        setAxisVisible(mxModel, AxisType::Y_MAIN, bChecked);
+    else if (pCheckBox == mpCB2ndXAxis.get())
+        setAxisVisible(mxModel, AxisType::X_SECOND, bChecked);
+    else if (pCheckBox == mpCB2ndYAxis.get())
+        setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked);
+
+    return 0;
+}
+
 }} // end of namespace ::chart::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list