20#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
21#include <com/sun/star/chart2/AxisOrientation.hpp>
32using namespace css::uno;
39 std::u16string_view rCID)
46 uno::Any aAny = xAxis->getPropertyValue(
"DisplayLabels");
56 std::u16string_view rCID,
bool bVisible)
63 xAxis->setPropertyValue(
"DisplayLabels", css::uno::Any(bVisible));
69 css::chart::ChartAxisLabelPosition
ePos;
72AxisLabelPosMap
const aLabelPosMap[] = {
73 { 0, css::chart::ChartAxisLabelPosition_NEAR_AXIS },
74 { 1, css::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE },
75 { 2, css::chart::ChartAxisLabelPosition_OUTSIDE_START },
76 { 3, css::chart::ChartAxisLabelPosition_OUTSIDE_END }
80 std::u16string_view rCID)
87 uno::Any aAny = xAxis->getPropertyValue(
"LabelPosition");
91 css::chart::ChartAxisLabelPosition
ePos;
93 for (AxisLabelPosMap
const & i : aLabelPosMap)
103 std::u16string_view rCID, sal_Int32
nPos)
110 css::chart::ChartAxisLabelPosition
ePos;
111 for (AxisLabelPosMap
const & i : aLabelPosMap)
117 xAxis->setPropertyValue(
"LabelPosition", css::uno::Any(
ePos));
121 std::u16string_view rCID)
129 css::chart2::ScaleData
aData = xAxis->getScaleData();
131 return aData.Orientation == css::chart2::AxisOrientation_REVERSE;
135 std::u16string_view rCID,
bool bReverse)
143 css::chart2::ScaleData
aData = xAxis->getScaleData();
145 aData.Orientation = css::chart2::AxisOrientation_REVERSE;
147 aData.Orientation = css::chart2::AxisOrientation_MATHEMATICAL;
149 xAxis->setScaleData(aData);
152OUString getCID(
const css::uno::Reference<css::frame::XModel>& xModel)
154 css::uno::Reference<css::frame::XController>
xController(
xModel->getCurrentController());
155 css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
156 if (!xSelectionSupplier.is())
159 uno::Any aAny = xSelectionSupplier->getSelection();
163#if defined DBG_UTIL && !defined NDEBUG
166 SAL_WARN(
"chart2",
"Selected item is not an axis");
173 std::u16string_view rCID,
double nVal)
181 xAxis->setPropertyValue(
"TextRotation", css::uno::Any(nVal));
185 std::u16string_view rCID)
193 css::uno::Any aAny = xAxis->getPropertyValue(
"TextRotation");
204 :
PanelLayout(pParent,
"ChartAxisPanel",
"modules/schart/ui/sidebaraxis.ui")
205 , mxCBShowLabel(m_xBuilder->weld_check_button(
"checkbutton_show_label"))
206 , mxCBReverse(m_xBuilder->weld_check_button(
"checkbutton_reverse"))
207 , mxLBLabelPos(m_xBuilder->weld_combo_box(
"comboboxtext_label_position"))
208 , mxGridLabel(m_xBuilder->weld_widget(
"label_props"))
209 , mxNFRotation(m_xBuilder->weld_metric_spin_button(
"spinbutton1",
FieldUnit::
DEGREE))
210 ,
mxModel(pController->getChartModel())
235 css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
236 if (xSelectionSupplier.is())
256 OUString aCID = getCID(
mxModel);
274 if (pParent ==
nullptr)
275 throw lang::IllegalArgumentException(
"no parent Window given to ChartAxisPanel::Create",
nullptr, 0);
276 return std::make_unique<ChartAxisPanel>(pParent, pController);
309 css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
310 mxModel->getCurrentController(), css::uno::UNO_QUERY);
311 if (oldSelectionSupplier.is()) {
324 css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
325 if (xSelectionSupplier.is())
331 ::chart::ChartModel* pModel =
dynamic_cast<::chart::ChartModel*
>(
xModel.get());
332 assert(!
xModel || pModel);
344 OUString aCID = getCID(
mxModel);
345 bool bChecked = rCheckbox.get_active();
347 if (&rCheckbox == mxCBShowLabel.get())
349 mxGridLabel->set_sensitive(bChecked);
350 setLabelShown(
mxModel, aCID, bChecked);
352 else if (&rCheckbox == mxCBReverse.get())
353 setReverse(
mxModel, aCID, bChecked);
358 OUString aCID = getCID(
mxModel);
359 sal_Int32
nPos = mxLBLabelPos->get_active();
366 OUString aCID = getCID(
mxModel);
367 double nVal = rMetricField.get_value(FieldUnit::DEGREE);
368 setAxisRotation(
mxModel, aCID, nVal);
css::chart::ChartAxisLabelPosition ePos
css::uno::Reference< css::frame::XModel2 > mxModel
virtual void DataChanged(const DataChangedEvent &rEvent)
static rtl::Reference< ::chart::Axis > getAxisForCID(std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel > &xChartModel)
ObjectType getObjectType() const
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
Reference< XController > xController
Reference< XModel > xModel