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

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Jul 15 09:35:55 PDT 2015


 chart2/source/controller/sidebar/ChartElementsPanel.cxx |   38 +++++++++++++++-
 1 file changed, 36 insertions(+), 2 deletions(-)

New commits:
commit 181672be2fa8a8ab38e9e6e71f4f052a5d026eb8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jul 15 18:34:37 2015 +0200

    also react to title checkboxes
    
    This needs to improved when tdf#92768 has been implemented. Also we need
    to rethink the default strings.
    
    Change-Id: I74b9bdf0caeaf314f103aa7b13dad3215e828423

diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index f232918..23fdfaf 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -141,6 +141,18 @@ bool isTitleVisisble(css::uno::Reference<css::frame::XModel> xModel, TitleHelper
     return TitleHelper::getTitle(eTitle, xModel).is();
 }
 
+void setTitleVisible(css::uno::Reference<css::frame::XModel> xModel, TitleHelper::eTitleType eTitle, bool bVisible)
+{
+    if (bVisible)
+    {
+        TitleHelper::createTitle(eTitle, "Title", xModel, comphelper::getProcessComponentContext());
+    }
+    else
+    {
+        TitleHelper::removeTitle(eTitle, xModel);
+    }
+}
+
 bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eType)
 {
     Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
@@ -374,16 +386,29 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
 {
     bool bChecked = pCheckBox->IsChecked();
     if (pCheckBox == mpCBTitle.get())
-    {
-    }
+        setTitleVisible(mxModel, TitleHelper::MAIN_TITLE, bChecked);
+    else if (pCheckBox == mpCBSubtitle.get())
+        setTitleVisible(mxModel, TitleHelper::SUB_TITLE, bChecked);
     else if (pCheckBox == mpCBXAxis.get())
         setAxisVisible(mxModel, AxisType::X_MAIN, bChecked);
+    else if (pCheckBox == mpCBXAxisTitle.get())
+        setTitleVisible(mxModel, TitleHelper::X_AXIS_TITLE, bChecked);
     else if (pCheckBox == mpCBYAxis.get())
         setAxisVisible(mxModel, AxisType::Y_MAIN, bChecked);
+    else if (pCheckBox == mpCBYAxisTitle.get())
+        setTitleVisible(mxModel, TitleHelper::Y_AXIS_TITLE, bChecked);
+    else if (pCheckBox == mpCBZAxis.get())
+        setAxisVisible(mxModel, AxisType::Z_MAIN, bChecked);
+    else if (pCheckBox == mpCBZAxisTitle.get())
+        setTitleVisible(mxModel, TitleHelper::Z_AXIS_TITLE, bChecked);
     else if (pCheckBox == mpCB2ndXAxis.get())
         setAxisVisible(mxModel, AxisType::X_SECOND, bChecked);
+    else if (pCheckBox == mpCB2ndXAxisTitle.get())
+        setTitleVisible(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE, bChecked);
     else if (pCheckBox == mpCB2ndYAxis.get())
         setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked);
+    else if (pCheckBox == mpCB2ndYAxisTitle.get())
+        setTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked);
 
     return 0;
 }
commit dd51d05ed3ad1e3f7a49e66b94dda16a3cdf0210
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jul 15 18:07:52 2015 +0200

    disable Z axis boxes for non-3D charts
    
    Change-Id: I0a651dbed939be572e06e3389fa024cafc214854

diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index d73ffaa5..f232918 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -37,6 +37,7 @@
 #include "TitleHelper.hxx"
 #include "ChartModelHelper.hxx"
 #include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
 
 #include "ChartModel.hxx"
 
@@ -289,6 +290,8 @@ void ChartElementsPanel::Initialize()
 
 void ChartElementsPanel::updateData()
 {
+    Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(mxModel));
+    sal_Int32 nDimension = DiagramHelper::getDimension(xDiagram);
     SolarMutexGuard aGuard;
 
     mpCBLegend->Check(isLegendVisible(mxModel));
@@ -306,6 +309,12 @@ void ChartElementsPanel::updateData()
     mpCBZAxis->Check(isAxisVisible(mxModel, AxisType::Z_MAIN));
     mpCB2ndXAxis->Check(isAxisVisible(mxModel, AxisType::X_SECOND));
     mpCB2ndYAxis->Check(isAxisVisible(mxModel, AxisType::Y_SECOND));
+
+    if (nDimension != 3)
+    {
+        mpCBZAxis->Disable();
+        mpCBZAxisTitle->Disable();
+    }
 }
 
 VclPtr<vcl::Window> ChartElementsPanel::Create (


More information about the Libreoffice-commits mailing list