[Libreoffice-commits] core.git: chart2/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Thu Oct 22 15:36:02 PDT 2015
chart2/source/controller/sidebar/ChartAxisPanel.cxx | 42 +++++++++++++++++++-
chart2/source/controller/sidebar/ChartAxisPanel.hxx | 5 +-
2 files changed, 45 insertions(+), 2 deletions(-)
New commits:
commit d550cdb9411b53e20741d79489a2fcd0c4849c13
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Oct 23 00:34:55 2015 +0200
implement text rotation for chart axis sidebar panel, tdf#94970
Change-Id: Ifce97c437238bd1520a2122aa4027a1bcbba1e5d
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 11a4533..bb72360 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -181,6 +181,33 @@ OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
return aCID;
}
+void setAxisRotation(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID, double nVal)
+{
+ css::uno::Reference< css::beans::XPropertySet > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return;
+
+ xAxis->setPropertyValue("TextRotation", css::uno::makeAny(nVal));
+}
+
+double getAxisRotation(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID)
+{
+ css::uno::Reference< css::beans::XPropertySet > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return 0;
+
+ css::uno::Any aAny = xAxis->getPropertyValue("TextRotation");
+ double nVal = 0;
+ aAny >>= nVal;
+ return nVal;
+}
+
}
ChartAxisPanel::ChartAxisPanel(
@@ -198,7 +225,7 @@ ChartAxisPanel::ChartAxisPanel(
get(mpCBReverse, "checkbutton_reverse");
get(mpLBLabelPos, "comboboxtext_label_position");
- //FIXME: add text orientation spinbox + its handler
+ get(mpNFRotation, "spinbutton1");
get(mpGridLabel, "label_props");
Initialize();
@@ -224,6 +251,8 @@ void ChartAxisPanel::dispose()
mpLBLabelPos.clear();
mpGridLabel.clear();
+ mpNFRotation.clear();
+
PanelLayout::dispose();
}
@@ -242,6 +271,9 @@ void ChartAxisPanel::Initialize()
mpCBShowLabel->SetClickHdl(aLink);
mpCBReverse->SetClickHdl(aLink);
+ Link<Edit&, void> aSpinButtonLink = LINK(this, ChartAxisPanel, TextRotationHdl);
+ mpNFRotation->SetModifyHdl(aSpinButtonLink);
+
mpLBLabelPos->SetSelectHdl(LINK(this, ChartAxisPanel, ListBoxHdl));
}
@@ -257,6 +289,7 @@ void ChartAxisPanel::updateData()
mpCBReverse->Check(isReverse(mxModel, aCID));
mpLBLabelPos->SelectEntryPos(getLabelPosition(mxModel, aCID));
+ mpNFRotation->SetValue(getAxisRotation(mxModel, aCID));
}
VclPtr<vcl::Window> ChartAxisPanel::Create (
@@ -351,6 +384,13 @@ IMPL_LINK_NOARG_TYPED(ChartAxisPanel, ListBoxHdl, ListBox&, void)
setLabelPosition(mxModel, aCID, nPos);
}
+IMPL_LINK_TYPED(ChartAxisPanel, TextRotationHdl, Edit&, rMetricField, void)
+{
+ OUString aCID = getCID(mxModel);
+ double nVal = static_cast<NumericField&>(rMetricField).GetValue();
+ setAxisRotation(mxModel, aCID, nVal);
+}
+
}} // end of namespace ::chart::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index 0191267..3ea3618 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -25,7 +25,7 @@
class FixedText;
class ListBox;
-class NumericField;
+class MetricField;
namespace chart {
@@ -82,6 +82,8 @@ private:
VclPtr<ListBox> mpLBLabelPos;
VclPtr<VclGrid> mpGridLabel;
+ VclPtr<MetricField> mpNFRotation;
+
css::uno::Reference<css::frame::XFrame> mxFrame;
css::uno::Reference<css::frame::XModel> mxModel;
@@ -94,6 +96,7 @@ private:
DECL_LINK_TYPED(CheckBoxHdl, Button*, void);
DECL_LINK_TYPED(ListBoxHdl, ListBox&, void);
+ DECL_LINK_TYPED(TextRotationHdl, Edit&, void);
};
} } // end of namespace ::chart::sidebar
More information about the Libreoffice-commits
mailing list