summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-04-09 13:45:10 +0200
committerLászló Németh <nemeth@numbertext.org>2020-04-17 12:16:17 +0200
commit434d92a51409b0847ee7d313b50fc547b7615bff (patch)
tree5eb1bc8b13585c8e05223197a56eac2d7a8d4044 /xmloff
parent8cb04bde0aeea1bd0f324ecf989af015356da285 (diff)
tdf#131979 Chart ODF import-export of Link to source format
setting also into data point styles, fixing lost numbering style of custom data points. (Only export into the data series style was supported previously.) Also fix tdf#131115 - FILEOPEN: Incorrect format of single data label Regression from commit: e57d90cd4e51a1353eafc87bb29cfe6076704a7c (tdf#129173 tdf#129175 Fix number format of data labels) Data point styles in older ODF files do not contain the 'link-data-style-to-source' property, so they used the data series style property during the import previously. Now we set the default false value, if the data point style contains a 'data-style-name' (number format). Change-Id: I4786e62ca75770ed632463bcf1275ece7ea793f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91967 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/XMLChartStyleContext.hxx2
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.cxx22
2 files changed, 24 insertions, 0 deletions
diff --git a/xmloff/inc/XMLChartStyleContext.hxx b/xmloff/inc/XMLChartStyleContext.hxx
index f9c44de4ae12..3f4413392920 100644
--- a/xmloff/inc/XMLChartStyleContext.hxx
+++ b/xmloff/inc/XMLChartStyleContext.hxx
@@ -51,6 +51,8 @@ public:
sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
+
+ bool isEmptyDataStyleName() override { return msDataStyleName.isEmpty(); }
};
#endif // INCLUDED_XMLOFF_INC_XMLCHARTSTYLECONTEXT_HXX
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 31e638971368..378c1195633a 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -172,6 +172,26 @@ void lcl_resetSymbolSizeForPointsIfNecessary( const uno::Reference< beans::XProp
lcl_setSymbolSizeIfNeeded( xPointProp, rImport );
}
+void lcl_setLinkNumberFormatToSourceIfNeeded( const uno::Reference< beans::XPropertySet >& xPointProp
+ , const XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
+{
+ uno::Any aAny( SchXMLTools::getPropertyFromContext("LinkNumberFormatToSource", pPropStyleContext, pStylesCtxt) );
+ if( !aAny.hasValue() )
+ {
+ if( !xPointProp.is() )
+ return;
+
+ bool bLinkToSource = false;
+ if( xPointProp.is() && (xPointProp->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource) )
+ {
+ if( bLinkToSource )
+ {
+ xPointProp->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(false));
+ }
+ }
+ }
+}
+
void lcl_insertErrorBarLSequencesToMap(
tSchXMLLSequencesPerIndex & rInOutMap,
const uno::Reference< beans::XPropertySet > & xSeriesProp )
@@ -1086,6 +1106,8 @@ void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeri
pPropStyleContext->FillPropertySet( xPointProp );
if( seriesStyle.mbSymbolSizeForSeriesIsMissingInFile )
lcl_resetSymbolSizeForPointsIfNecessary( xPointProp, rImport, pPropStyleContext, pStylesCtxt );
+ if( !pPropStyleContext->isEmptyDataStyleName() )
+ lcl_setLinkNumberFormatToSourceIfNeeded( xPointProp, pPropStyleContext, pStylesCtxt );
}
// Custom labels might be passed as property