diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-06-11 13:26:50 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2019-06-18 14:07:55 +0200 |
commit | 0869c65a7e937d71bd623ed498a3a47cebe0a66d (patch) | |
tree | c579f0300d15af53d6d5ab36b6bbb93244ebc899 /chart2 | |
parent | 528a1e8b1a2b26cf75e714145aea897079c02409 (diff) |
tdf#75659 Chart: fix empty legend at not available legend names
by using localized versions of "Unnamed Series 1" etc.
Note: OOXML files don't contain the default or fallback legend names
used by MSO in this case, so the original empty string replacement
of the missing names resulted bad chart import.
Change-Id: I2897c70d9003e1ab3241dd569de0d79821d896b1
Reviewed-on: https://gerrit.libreoffice.org/73817
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 007bf60611e2ba5a65ffabe80dbb0e279fcb9f26)
Reviewed-on: https://gerrit.libreoffice.org/74252
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga991@gmail.com>
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/tools/UncachedDataSequence.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx index b9721490b7e7..ca3a9280c452 100644 --- a/chart2/source/tools/UncachedDataSequence.cxx +++ b/chart2/source/tools/UncachedDataSequence.cxx @@ -23,6 +23,8 @@ #include <cppuhelper/supportsservice.hxx> #include <algorithm> +#include <strings.hrc> +#include <ResId.hxx> #include <com/sun/star/chart2/XInternalDataProvider.hpp> #include <tools/diagnose_ex.h> @@ -209,8 +211,15 @@ OUString SAL_CALL UncachedDataSequence::getSourceRangeRepresentation() Sequence< OUString > SAL_CALL UncachedDataSequence::generateLabel( chart2::data::LabelOrigin ) { - // auto-generated label is an empty string - return Sequence< OUString >(1); + // auto-generated label + sal_Int32 nSeries = m_aSourceRepresentation.toInt32() + 1; + OUString aResString(::chart::SchResId(STR_DATA_UNNAMED_SERIES_WITH_INDEX)); + const OUString aReplacementStr("%NUMBER"); + sal_Int32 nIndex = aResString.indexOf(aReplacementStr); + OUString aName; + if( nIndex != -1 ) + aName = aResString.replaceAt(nIndex, aReplacementStr.getLength(), OUString::number(nSeries)); + return Sequence< OUString >( &aName, 1 ); } ::sal_Int32 SAL_CALL UncachedDataSequence::getNumberFormatKeyByIndex( ::sal_Int32 ) |