summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-16 20:17:37 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-16 22:18:09 +0200
commit71c6ee42d3311b31896e5a408d8f83f4e5d7726e (patch)
tree2b4b87a42d0cb5c1788a98b048ac643e68e57c75 /chart2
parent75d50b7189bf9fb37d3024fa5765dfb22ca6fce6 (diff)
first parts in data series panel
Change-Id: Ia25460e6f57ff6d3c44bae1ddb33a36845ffcdd2
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx80
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.hxx6
2 files changed, 86 insertions, 0 deletions
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 732aefc9c014..1d214254cdf9 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -21,6 +21,8 @@
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+
#include "ChartSeriesPanel.hxx"
#include "ChartController.hxx"
#include <sfx2/bindings.hxx>
@@ -35,6 +37,7 @@
#include <comphelper/processfactory.hxx>
#include "ChartModel.hxx"
+#include "DataSeriesHelper.hxx"
using namespace css;
using namespace css::uno;
@@ -42,6 +45,35 @@ using ::sfx2::sidebar::Theme;
namespace chart { namespace sidebar {
+namespace {
+
+bool isDataLabelVisible(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 false;
+
+ return DataSeriesHelper::hasDataLabelsAtSeries(xSeries);
+}
+
+void setDataLabelVisible(css::uno::Reference<css::frame::XModel> xModel, const OUString& rCID, bool bVisible)
+{
+ css::uno::Reference< css::chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xSeries.is())
+ return;
+
+ if (bVisible)
+ DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints(xSeries);
+ else
+ DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints(xSeries);
+}
+
+}
+
ChartSeriesPanel::ChartSeriesPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
@@ -53,6 +85,11 @@ ChartSeriesPanel::ChartSeriesPanel(
mpBindings(pBindings),
mxModel(pController->getModel())
{
+ get(mpCBLabel, "checkbutton_label");
+ get(mpCBTrendline, "checkbutton_trendline");
+ get(mpCBXError, "checkbutton_x_error");
+ get(mpCBYError, "checkbutton_y_error");
+
Initialize();
}
@@ -69,11 +106,32 @@ void ChartSeriesPanel::dispose()
void ChartSeriesPanel::Initialize()
{
+ updateData();
+
+ Link<> aLink = LINK(this, ChartSeriesPanel, CheckBoxHdl);
+ mpCBLabel->SetClickHdl(aLink);
+ mpCBTrendline->SetClickHdl(aLink);
+ mpCBXError->SetClickHdl(aLink);
+ mpCBYError->SetClickHdl(aLink);
}
void ChartSeriesPanel::updateData()
{
+ 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;
+
+ 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
SolarMutexGuard aGuard;
+ mpCBLabel->Check(isDataLabelVisible(mxModel, aCID));
}
VclPtr<vcl::Window> ChartSeriesPanel::Create (
@@ -124,6 +182,28 @@ void ChartSeriesPanel::modelInvalid()
}
+IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox)
+{
+ bool bChecked = pCheckBox->IsChecked();
+ 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
+ if (pCheckBox == mpCBLabel.get())
+ setDataLabelVisible(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 6fa61e351a76..f38aa9e53a4d 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -72,6 +72,10 @@ public:
private:
//ui controls
+ VclPtr<CheckBox> mpCBLabel;
+ VclPtr<CheckBox> mpCBTrendline;
+ VclPtr<CheckBox> mpCBXError;
+ VclPtr<CheckBox> mpCBYError;
css::uno::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
@@ -81,6 +85,8 @@ private:
css::uno::Reference<css::util::XModifyListener> mxListener;
void Initialize();
+
+ DECL_LINK(CheckBoxHdl, CheckBox*);
};
} } // end of namespace ::chart::sidebar