20#include <com/sun/star/chart/ErrorBarStyle.hpp>
21#include <com/sun/star/chart/DataLabelPlacement.hpp>
42using namespace css::uno;
73struct LabelPlacementMap
79LabelPlacementMap
const aLabelPlacementMap[] = {
80 { 0, css::chart::DataLabelPlacement::TOP },
81 { 1, css::chart::DataLabelPlacement::BOTTOM },
82 { 2, css::chart::DataLabelPlacement::CENTER },
83 { 3, css::chart::DataLabelPlacement::OUTSIDE },
84 { 4, css::chart::DataLabelPlacement::INSIDE },
85 { 5, css::chart::DataLabelPlacement::NEAR_ORIGIN }
89 std::u16string_view rCID)
97 css::uno::Any aAny = xSeries->getPropertyValue(
"LabelPlacement");
101 sal_Int32 nPlacement = 0;
104 for (LabelPlacementMap
const & i : aLabelPlacementMap)
106 if (
i.nApi == nPlacement)
114 std::u16string_view rCID, sal_Int32
nPos)
123 for (LabelPlacementMap
const & i : aLabelPlacementMap)
132 xSeries->setPropertyValue(
"LabelPlacement", css::uno::Any(
nApi));
136 std::u16string_view rCID)
141 if (!xRegressionCurveContainer.is())
144 return !xRegressionCurveContainer->getRegressionCurves2().empty();
148 xModel, std::u16string_view rCID,
bool bVisible)
153 if (!xRegressionCurveContainer.is())
159 SvxChartRegress::Linear,
160 xRegressionCurveContainer);
164 xRegressionCurveContainer );
169 std::u16string_view rCID,
bool bYError)
181 xModel, std::u16string_view rCID,
bool bYError,
bool bVisible)
192 css::chart::ErrorBarStyle::STANDARD_DEVIATION,
202 xModel, std::u16string_view rCID)
214 xModel, std::u16string_view rCID,
bool bPrimary)
218 if (!xDataSeries.is())
229 const std::vector< rtl::Reference< BaseCoordinateSystem > > & xCooSysSequence( xDiagram->getBaseCoordinateSystems());
230 return xCooSysSequence[0]->getChartTypes2()[0];
242 return xSeries->getLabelForRole(xChartType->getRoleOfSequenceForSeriesLabel());
245OUString getCID(
const css::uno::Reference<css::frame::XModel>& xModel)
247 css::uno::Reference<css::frame::XController>
xController(
xModel->getCurrentController());
248 css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
249 if (!xSelectionSupplier.is())
252 uno::Any aAny = xSelectionSupplier->getSelection();
262#if defined DBG_UTIL && !defined NDEBUG
267 SAL_WARN(
"chart2",
"Selected item is not a chart series");
278 :
PanelLayout(pParent,
"ChartSeriesPanel",
"modules/schart/ui/sidebarseries.ui")
279 , mxCBLabel(m_xBuilder->weld_check_button(
"checkbutton_label"))
280 , mxCBTrendline(m_xBuilder->weld_check_button(
"checkbutton_trendline"))
281 , mxCBXError(m_xBuilder->weld_check_button(
"checkbutton_x_error"))
282 , mxCBYError(m_xBuilder->weld_check_button(
"checkbutton_y_error"))
283 , mxRBPrimaryAxis(m_xBuilder->weld_radio_button(
"radiobutton_primary_axis"))
284 , mxRBSecondaryAxis(m_xBuilder->weld_radio_button(
"radiobutton_secondary_axis"))
285 , mxBoxLabelPlacement(m_xBuilder->weld_widget(
"datalabel_box"))
286 , mxLBLabelPlacement(m_xBuilder->weld_combo_box(
"comboboxtext_label"))
287 , mxFTSeriesName(m_xBuilder->weld_label(
"label_series_name"))
288 , mxFTSeriesTemplate(m_xBuilder->weld_label(
"label_series_tmpl"))
289 ,
mxModel(pController->getChartModel())
319 css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
320 if (xSelectionSupplier.is())
343 OUString aCID = getCID(
mxModel);
351 bool bLabelVisible = isDataLabelVisible(
mxModel, aCID);
357 bool bPrimaryAxis = isPrimaryAxis(
mxModel, aCID);
365 aFrameLabel = aFrameLabel.replaceFirst(
"%1", getSeriesLabel(
mxModel, aCID));
373 if (pParent ==
nullptr)
374 throw lang::IllegalArgumentException(
"no parent Window given to ChartSeriesPanel::Create",
nullptr, 0);
376 return std::make_unique<ChartSeriesPanel>(pParent, pController);
410 css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
411 mxModel->getCurrentController(), css::uno::UNO_QUERY);
412 if (oldSelectionSupplier.is()) {
424 css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
425 if (xSelectionSupplier.is())
431 ::chart::ChartModel* pModel =
dynamic_cast<::chart::ChartModel*
>(
xModel.get());
432 assert(!
xModel || pModel);
444 bool bChecked = rCheckBox.get_active();
445 OUString aCID = getCID(
mxModel);
446 if (&rCheckBox == mxCBLabel.get())
447 setDataLabelVisible(
mxModel, aCID, bChecked);
448 else if (&rCheckBox == mxCBTrendline.get())
449 setTrendlineVisible(
mxModel, aCID, bChecked);
450 else if (&rCheckBox == mxCBXError.get())
451 setErrorBarVisible(
mxModel, aCID,
false, bChecked);
452 else if (&rCheckBox == mxCBYError.get())
453 setErrorBarVisible(
mxModel, aCID,
true, bChecked);
458 OUString aCID = getCID(
mxModel);
459 bool bChecked = mxRBPrimaryAxis->get_active();
461 setAttachedAxisType(
mxModel, aCID, bChecked);
466 OUString aCID = getCID(
mxModel);
468 sal_Int32
nPos = mxLBLabelPlacement->get_active();
css::uno::Reference< css::frame::XModel2 > mxModel
virtual void DataChanged(const DataChangedEvent &rEvent)
static rtl::Reference< ::chart::DataSeries > getDataSeriesForCID(std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel > &xChartModel)
ObjectType getObjectType() const
Reference< script::XScriptListener > mxListener
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries(const rtl::Reference< ::chart::DataSeries > &xSeries)
OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints(const rtl::Reference< ::chart::DataSeries > &xSeries)
OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints(const rtl::Reference< ::chart::DataSeries > &xSeries)
OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex(const rtl::Reference< ::chart::DataSeries > &xSeries)
OOO_DLLPUBLIC_CHARTTOOLS bool removeAllExceptMeanValueLine(rtl::Reference<::chart::DataSeries > const &xCurveContainer)
OOO_DLLPUBLIC_CHARTTOOLS rtl::Reference<::chart::RegressionCurveModel > addRegressionCurve(SvxChartRegress eType, css::uno::Reference< css::chart2::XRegressionCurveContainer > const &xCurveContainer, const css::uno::Reference< css::beans::XPropertySet > &xPropertySource=css::uno::Reference< css::beans::XPropertySet >(), const css::uno::Reference< css::beans::XPropertySet > &xEquationProperties=css::uno::Reference< css::beans::XPropertySet >())
OOO_DLLPUBLIC_CHARTTOOLS void removeErrorBars(const rtl::Reference< ::chart::DataSeries > &xDataSeries, bool bYError=true)
OOO_DLLPUBLIC_CHARTTOOLS bool hasErrorBars(const rtl::Reference< ::chart::DataSeries > &xDataSeries, bool bYError=true)
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet > addErrorBars(const rtl::Reference< ::chart::DataSeries > &xDataSeries, sal_Int32 nStyle, bool bYError=true)
Reference< XComponentContext > getProcessComponentContext()
Reference< XController > xController
Reference< XModel > xModel