summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-23 00:34:55 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-23 00:35:37 +0200
commitd550cdb9411b53e20741d79489a2fcd0c4849c13 (patch)
tree8bae860586e236cf84c1e0d9070cda1067a184d4 /chart2
parent0348b94bef515f3a0efc4a39ec385baf4982e5fa (diff)
implement text rotation for chart axis sidebar panel, tdf#94970
Change-Id: Ifce97c437238bd1520a2122aa4027a1bcbba1e5d
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.cxx42
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.hxx5
2 files changed, 45 insertions, 2 deletions
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 11a453340e31..bb7236097524 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 0191267bb64d..3ea3618ab42b 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