Kaydet (Commit) 24c0aafd authored tarafından Markus Mohrhard's avatar Markus Mohrhard

last item in series panel

Change-Id: Ib37e36d98d599affb379a8727bae88be0acf2631
üst c2bd7a7d
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart/DataLabelPlacement.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 "ChartSeriesPanel.hxx"
#include "ChartController.hxx" #include "ChartController.hxx"
...@@ -233,6 +237,30 @@ void setAttachedAxisType(css::uno::Reference<css::frame::XModel> ...@@ -233,6 +237,30 @@ void setAttachedAxisType(css::uno::Reference<css::frame::XModel>
xSeries->setPropertyValue("AttachedAxisIndex", css::uno::makeAny(nIndex)); 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( ChartSeriesPanel::ChartSeriesPanel(
...@@ -254,6 +282,8 @@ ChartSeriesPanel::ChartSeriesPanel( ...@@ -254,6 +282,8 @@ ChartSeriesPanel::ChartSeriesPanel(
get(mpLBLabelPlacement, "comboboxtext_label"); get(mpLBLabelPlacement, "comboboxtext_label");
get(mpFTSeriesName, "label_series_name");
Initialize(); Initialize();
} }
...@@ -277,6 +307,8 @@ void ChartSeriesPanel::dispose() ...@@ -277,6 +307,8 @@ void ChartSeriesPanel::dispose()
mpLBLabelPlacement.clear(); mpLBLabelPlacement.clear();
mpFTSeriesName.clear();
PanelLayout::dispose(); PanelLayout::dispose();
} }
...@@ -328,6 +360,8 @@ void ChartSeriesPanel::updateData() ...@@ -328,6 +360,8 @@ void ChartSeriesPanel::updateData()
mpLBLabelPlacement->Enable(bLabelVisible); mpLBLabelPlacement->Enable(bLabelVisible);
mpLBLabelPlacement->SelectEntryPos(getDataLabelPlacement(mxModel, aCID)); mpLBLabelPlacement->SelectEntryPos(getDataLabelPlacement(mxModel, aCID));
mpFTSeriesName->SetText(getSeriesLabel(mxModel, aCID));
} }
VclPtr<vcl::Window> ChartSeriesPanel::Create ( VclPtr<vcl::Window> ChartSeriesPanel::Create (
......
...@@ -83,6 +83,8 @@ private: ...@@ -83,6 +83,8 @@ private:
VclPtr<ListBox> mpLBLabelPlacement; VclPtr<ListBox> mpLBLabelPlacement;
VclPtr<FixedText> mpFTSeriesName;
css::uno::Reference<css::frame::XFrame> mxFrame; css::uno::Reference<css::frame::XFrame> mxFrame;
css::uno::Reference<css::frame::XModel> mxModel; css::uno::Reference<css::frame::XModel> mxModel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment