diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-17 10:17:50 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-17 10:25:49 +0200 |
commit | 24c0aafdaf0a9f67e88d1c092285e3ee882391d5 (patch) | |
tree | 32300ec4e9bf6a4a77a8b467539007bf2e55bd46 /chart2 | |
parent | c2bd7a7de177bd81927ad29060ec3db43f9a6086 (diff) |
last item in series panel
Change-Id: Ib37e36d98d599affb379a8727bae88be0acf2631
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/sidebar/ChartSeriesPanel.cxx | 34 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartSeriesPanel.hxx | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx index 8341fc78f230..7d15a96fb147 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -25,6 +25,10 @@ #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/XChartTypeContainer.hpp> +#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include "ChartSeriesPanel.hxx" #include "ChartController.hxx" @@ -233,6 +237,30 @@ void setAttachedAxisType(css::uno::Reference<css::frame::XModel> xSeries->setPropertyValue("AttachedAxisIndex", css::uno::makeAny(nIndex)); } +css::uno::Reference<css::chart2::XChartType> getChartType( + css::uno::Reference<css::frame::XModel> xModel) +{ + css::uno::Reference<css::chart2::XChartDocument> xChartDoc (xModel, css::uno::UNO_QUERY); + css::uno::Reference<css::chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram(); + css::uno::Reference< css::chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW ); + css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems()); + css::uno::Reference< css::chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[0], UNO_QUERY_THROW ); + css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() ); + return xChartTypeSequence[0]; +} + +OUString getSeriesLabel(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 OUString(); + + css::uno::Reference<css::chart2::XChartType> xChartType = getChartType(xModel); + return DataSeriesHelper::getDataSeriesLabel(xSeries, xChartType->getRoleOfSequenceForSeriesLabel()); +} + } ChartSeriesPanel::ChartSeriesPanel( @@ -254,6 +282,8 @@ ChartSeriesPanel::ChartSeriesPanel( get(mpLBLabelPlacement, "comboboxtext_label"); + get(mpFTSeriesName, "label_series_name"); + Initialize(); } @@ -277,6 +307,8 @@ void ChartSeriesPanel::dispose() mpLBLabelPlacement.clear(); + mpFTSeriesName.clear(); + PanelLayout::dispose(); } @@ -328,6 +360,8 @@ void ChartSeriesPanel::updateData() mpLBLabelPlacement->Enable(bLabelVisible); mpLBLabelPlacement->SelectEntryPos(getDataLabelPlacement(mxModel, aCID)); + + mpFTSeriesName->SetText(getSeriesLabel(mxModel, aCID)); } VclPtr<vcl::Window> ChartSeriesPanel::Create ( diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx index a19ecb22323a..7c951f636dff 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx @@ -83,6 +83,8 @@ private: VclPtr<ListBox> mpLBLabelPlacement; + VclPtr<FixedText> mpFTSeriesName; + css::uno::Reference<css::frame::XFrame> mxFrame; css::uno::Reference<css::frame::XModel> mxModel; |