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

implement text rotation for chart axis sidebar panel, tdf#94970

Change-Id: Ifce97c437238bd1520a2122aa4027a1bcbba1e5d
üst 0348b94b
......@@ -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: */
......@@ -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
......
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