summaryrefslogtreecommitdiff
path: root/chart2/source/controller/itemsetwrapper
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-09-08 10:21:33 +0200
committerLászló Németh <nemeth@numbertext.org>2020-09-15 09:57:54 +0200
commit28b53da4c49b2dc8550f28b07183fb7c60e1c298 (patch)
tree657e60ce2c1ad6f5efaff61ba43e6d71e20661c2 /chart2/source/controller/itemsetwrapper
parent4ef697e670aaa7cac547846ac961e6d26aac816d (diff)
tdf#133227 chart UI: option to hide leader lines
between data points and displaced data labels of a data series. Follow-up of the following commits related to the new UNO property ShowCustomLeaderLines for data labels: commit e2f4e65a7b8024c00b049eebf0d87637efda7f24 (tdf#134571 chart2, xmloff: add loext:custom-leader-lines) commit 5d67d70b26706ce8a08612c12a68821f984210a2 (tdf#134563 Add UNO API for custom leader lines) Change-Id: Id8a953b16ff737ca924c0c2c3241fba4e3ac904b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102221 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/source/controller/itemsetwrapper')
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx36
-rw-r--r--chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx37
2 files changed, 72 insertions, 1 deletions
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 4920d2b727e0..6328a222b622 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -581,6 +581,26 @@ bool DataPointItemConverter::ApplySpecialItem(
}
}
break;
+
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
+ bool bOld = true;
+ Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
+ if( (xSeriesProp->getPropertyValue("ShowCustomLeaderLines") >>= bOld) && bOld != bNew )
+ {
+ xSeriesProp->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew));
+ bChanged = true;
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ break;
}
return bChanged;
@@ -728,6 +748,22 @@ void DataPointItemConverter::FillSpecialItem(
}
break;
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bValue = true;
+ Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
+ if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue )
+ rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ break;
+
case SCHATTR_STYLE_SYMBOL:
{
chart2::Symbol aSymbol;
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index 496b25e2692f..bdeffbf6cf3c 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -201,7 +201,8 @@ TextLabelItemConverter::TextLabelItemConverter(
mnNumberFormat(nNumberFormat),
mnPercentNumberFormat(nPercentNumberFormat),
mbDataSeries(bDataSeries),
- mbForbidPercentValue(true)
+ mbForbidPercentValue(true),
+ m_xSeries(xSeries)
{
maConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
@@ -498,6 +499,25 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
}
}
break;
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
+ bool bOld = true;
+ Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
+ if( (xSeriesProp->getPropertyValue("ShowCustomLeaderLines") >>= bOld) && bOld != bNew )
+ {
+ xSeriesProp->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew));
+ bChanged = true;
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ break;
}
return bChanged;
@@ -635,6 +655,21 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
rOutItemSet.Put(SfxBoolItem(nWhichId, mbForbidPercentValue));
}
break;
+ case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES:
+ {
+ try
+ {
+ bool bValue = true;
+ Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY);
+ if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue )
+ rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+ break;
case SCHATTR_STYLE_SYMBOL:
{
chart2::Symbol aSymbol;