summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-12 11:24:30 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-06-12 11:27:19 -0400
commita2a1a59a448420a858724371c4a339f75ebe8c1e (patch)
tree712007fb53468d43a1010e42c71cfd7eaf5976dc /xmloff
parent10f8d24540a4145af3ec629f7eb724849ca53d22 (diff)
fdo#77506: More reliable way to determine label strings.
Not beautiful, but doable. Change-Id: I6f3b00d620e7d7d19cc05ec4239deeb14d0d5201
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx41
1 files changed, 24 insertions, 17 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index ab6290336b7b..6189a8b62542 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2565,7 +2565,6 @@ void SchXMLExportHelper_Impl::exportSeries(
OUString aFirstXDomainRange;
OUString aFirstYDomainRange;
- bool modifyLabelRange = false;
std::vector< XMLPropertyState > aPropertyStates;
@@ -2711,28 +2710,36 @@ void SchXMLExportHelper_Impl::exportSeries(
// #i75297# allow empty series, export empty range to have all ranges on import
mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, OUString());
- if( xLabelSeq.is()) {
- OUString aRange = xLabelSeq->getSourceRangeRepresentation();
- if ( nSeriesIdx == 0 && aRange.equalsAscii("label 1"))
- modifyLabelRange = true;
- if (modifyLabelRange)
- aRange = "label " + OUString::number(aRange.copy( OUString("label").getLength()).toInt32() - 1);
-
- OUString aXMLRange = lcl_ConvertRange( aRange, xNewDoc );
- if(aXMLRange.isEmpty() && !aRange.isEmpty())
+ if (xLabelSeq.is())
+ {
+ // Check if the label is direct string value rather than a reference.
+ bool bHasString = false;
+ uno::Reference<beans::XPropertySet> xLSProp(xLabelSeq, uno::UNO_QUERY);
+ if (xLSProp.is())
{
- // might just be a string
- bool bIsString = isString(aRange);
- if(bIsString)
+ try
{
- mrExport.AddAttribute( XML_NAMESPACE_LO_EXT,
- XML_LABEL_STRING, aRange );
+ xLSProp->getPropertyValue("HasStringLabel") >>= bHasString;
}
+ catch (const beans::UnknownPropertyException&) {}
+ }
+
+ OUString aRange = xLabelSeq->getSourceRangeRepresentation();
+
+ if (bHasString)
+ {
+ mrExport.AddAttribute(
+ XML_NAMESPACE_LO_EXT, XML_LABEL_STRING, aRange);
}
else
- mrExport.AddAttribute( XML_NAMESPACE_CHART,
- XML_LABEL_CELL_ADDRESS, aXMLRange );
+ {
+ mrExport.AddAttribute(
+ XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS,
+ lcl_ConvertRange(
+ xLabelSeq->getSourceRangeRepresentation(), xNewDoc));
+ }
}
+
if( xLabelSeq.is() || xValuesSeq.is() )
aSeriesLabelValuesPair = tLabelValuesDataPair( xLabelSeq, xValuesSeq );