summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-17 01:08:12 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-17 01:42:42 +0200
commitd84f954cc0ad22cf62e279da2e473f79d1fb889b (patch)
treebe6e865b36956d27621a27101faaa118e07ee703
parent98b0cd76606935fb03476837f8d44acfab62e249 (diff)
also handle primary vs secondary axis in series panel
Change-Id: Ieed69e1e7ebd88b15dd6a6fb51863fab4f57479c
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx63
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.hxx4
-rw-r--r--chart2/uiconfig/ui/sidebarseries.ui2
3 files changed, 68 insertions, 1 deletions
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index b318f59b3359..389ec28414fa 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include "ChartSeriesPanel.hxx"
#include "ChartController.hxx"
@@ -144,6 +145,31 @@ void setErrorBarVisible(css::uno::Reference<css::frame::XModel>
}
}
+bool isPrimaryAxis(css::uno::Reference<css::frame::XModel>
+ xModel, const OUString& rCID)
+{
+ css::uno::Reference< css::chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xSeries.is())
+ return true;
+
+ return DataSeriesHelper::getAttachedAxisIndex(xSeries) == 0;
+}
+
+void setAttachedAxisType(css::uno::Reference<css::frame::XModel>
+ xModel, const OUString& rCID, bool bPrimary)
+{
+ css::uno::Reference< css::beans::XPropertySet > xSeries(
+ ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xSeries.is())
+ return;
+
+ sal_Int32 nIndex = bPrimary ? 0 : 1;
+ xSeries->setPropertyValue("AttachedAxisIndex", css::uno::makeAny(nIndex));
+}
+
}
ChartSeriesPanel::ChartSeriesPanel(
@@ -163,6 +189,9 @@ ChartSeriesPanel::ChartSeriesPanel(
get(mpCBXError, "checkbutton_x_error");
get(mpCBYError, "checkbutton_y_error");
+ get(mpRBPrimaryAxis, "radiobutton_primary_axis");
+ get(mpRBSecondaryAxis, "radiobutton_secondary_axis");
+
Initialize();
}
@@ -181,6 +210,9 @@ void ChartSeriesPanel::dispose()
mpCBXError.clear();
mpCBYError.clear();
+ mpRBPrimaryAxis.clear();
+ mpRBSecondaryAxis.clear();
+
PanelLayout::dispose();
}
@@ -196,6 +228,10 @@ void ChartSeriesPanel::Initialize()
mpCBTrendline->SetClickHdl(aLink);
mpCBXError->SetClickHdl(aLink);
mpCBYError->SetClickHdl(aLink);
+
+ aLink = LINK(this, ChartSeriesPanel, RadioBtnHdl);
+ mpRBPrimaryAxis->SetToggleHdl(aLink);
+ mpRBSecondaryAxis->SetToggleHdl(aLink);
}
void ChartSeriesPanel::updateData()
@@ -218,6 +254,10 @@ void ChartSeriesPanel::updateData()
mpCBTrendline->Check(isTrendlineVisible(mxModel, aCID));
mpCBXError->Check(isErrorBarVisible(mxModel, aCID, false));
mpCBYError->Check(isErrorBarVisible(mxModel, aCID, true));
+
+ bool bPrimaryAxis = isPrimaryAxis(mxModel, aCID);
+ mpRBPrimaryAxis->Check(bPrimaryAxis);
+ mpRBSecondaryAxis->Check(!bPrimaryAxis);
}
VclPtr<vcl::Window> ChartSeriesPanel::Create (
@@ -290,6 +330,29 @@ IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox)
return 0;
}
+IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl)
+{
+ css::uno::Reference<css::frame::XController> xController(mxModel->getCurrentController());
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
+ if (!xSelectionSupplier.is())
+ return 0;
+
+ uno::Any aAny = xSelectionSupplier->getSelection();
+ assert(aAny.hasValue());
+ OUString aCID;
+ aAny >>= aCID;
+#ifdef DBG_UTIL
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ assert(eType == OBJECTTYPE_DATA_SERIES);
+#endif
+
+ bool bChecked = mpRBPrimaryAxis->IsChecked();
+
+ setAttachedAxisType(mxModel, aCID, bChecked);
+
+ return 0;
+}
+
}} // end of namespace ::chart::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 7594e28983d9..a0c773b72e55 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -80,6 +80,9 @@ private:
VclPtr<CheckBox> mpCBXError;
VclPtr<CheckBox> mpCBYError;
+ VclPtr<RadioButton> mpRBPrimaryAxis;
+ VclPtr<RadioButton> mpRBSecondaryAxis;
+
css::uno::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
SfxBindings* mpBindings;
@@ -90,6 +93,7 @@ private:
void Initialize();
DECL_LINK(CheckBoxHdl, CheckBox*);
+ DECL_LINK(RadioBtnHdl, void*);
};
} } // end of namespace ::chart::sidebar
diff --git a/chart2/uiconfig/ui/sidebarseries.ui b/chart2/uiconfig/ui/sidebarseries.ui
index afcc7a995911..88180b5a5005 100644
--- a/chart2/uiconfig/ui/sidebarseries.ui
+++ b/chart2/uiconfig/ui/sidebarseries.ui
@@ -2,7 +2,7 @@
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
- <object class="GtkGrid" id="DataSeriesPanel">
+ <object class="GtkGrid" id="ChartSeriesPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>