summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-11-17 00:16:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-11-21 14:14:15 +0100
commit985523eee724f41eefb3aa84edcfcd1a4a3cf3db (patch)
tree56dadf30c80e1e71451fb99d02a62da198ee9de4
parent01632a5ee892ebd2218ad8729738672e02d94697 (diff)
Resolves: tdf#113889 no date particle reordering when exporting to Excel
Change-Id: I45667a67c6c69106d86755ed41438f23e019dfea (cherry picked from commit eb8bd7f21103ed2349b44c954db977709de2e4ec) Reviewed-on: https://gerrit.libreoffice.org/44841 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/svl/zforlist.hxx3
-rw-r--r--svl/source/numbers/zforlist.cxx7
-rw-r--r--svl/source/numbers/zforscan.cxx6
-rw-r--r--svl/source/numbers/zforscan.hxx4
4 files changed, 14 insertions, 6 deletions
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index f6f338972886..82e30ce58b29 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -390,7 +390,8 @@ public:
language/country eNewLnge */
bool PutandConvertEntry( OUString& rString, sal_Int32& nCheckPos,
short& nType, sal_uInt32& nKey,
- LanguageType eLnge, LanguageType eNewLnge );
+ LanguageType eLnge, LanguageType eNewLnge,
+ bool bForExcelExport = false );
/** Same as <method>PutandConvertEntry</method> but the format code string
is considered to be of the System language/country eLnge and is
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 7db681089cc1..9a2e443cc8d2 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -636,14 +636,15 @@ bool SvNumberFormatter::PutandConvertEntry(OUString& rString,
short& nType,
sal_uInt32& nKey,
LanguageType eLnge,
- LanguageType eNewLnge)
+ LanguageType eNewLnge,
+ bool bForExcelExport )
{
bool bRes;
if (eNewLnge == LANGUAGE_DONTKNOW)
{
eNewLnge = IniLnge;
}
- pFormatScanner->SetConvertMode(eLnge, eNewLnge);
+ pFormatScanner->SetConvertMode(eLnge, eNewLnge, false, bForExcelExport);
bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge);
pFormatScanner->SetConvertMode(false);
return bRes;
@@ -821,7 +822,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe
short nType = css::util::NumberFormat::DEFINED;
sal_uInt32 nTempKey;
OUString aTemp( pEntry->GetFormatstring());
- rTempFormatter.PutandConvertEntry( aTemp, nCheckPos, nType, nTempKey, nLang, LANGUAGE_ENGLISH_US);
+ rTempFormatter.PutandConvertEntry( aTemp, nCheckPos, nType, nTempKey, nLang, LANGUAGE_ENGLISH_US, true);
SAL_WARN_IF( nCheckPos != 0, "svl.numbers",
"SvNumberFormatter::GetFormatStringForExcel - format code not convertible");
if (nTempKey != NUMBERFORMAT_ENTRY_NOT_FOUND)
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index b3fae53899e7..cd09a444c81f 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -47,6 +47,7 @@ ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP )
pFormatter = pFormatterP;
xNFC = css::i18n::NumberFormatMapper::create( pFormatter->GetComponentContext() );
bConvertMode = false;
+ mbConvertForExcelExport = false;
bConvertSystemToSystem = false;
//! All keywords MUST be UPPERCASE!
sKeyword[NF_KEY_E] = "E"; // Exponent
@@ -1580,7 +1581,10 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
pLoc = pFormatter->GetLocaleData();
//! init new keywords
InitKeywords();
- bNewDateOrder = (eOldDateOrder != pLoc->getDateOrder());
+ // Adapt date order to target locale, but Excel does not handle date
+ // particle re-ordering for the target locale when loading documents,
+ // though it does exchange separators, tdf#113889
+ bNewDateOrder = (!mbConvertForExcelExport && eOldDateOrder != pLoc->getDateOrder());
}
const CharClass* pChrCls = pFormatter->GetCharClass();
diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index 13d5b1a67177..5e5d981f79bf 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -124,12 +124,13 @@ public:
}
void SetConvertMode(LanguageType eTmpLge, LanguageType eNewLge,
- bool bSystemToSystem = false )
+ bool bSystemToSystem = false, bool bForExcelExport = false)
{
bConvertMode = true;
eNewLnge = eNewLge;
eTmpLnge = eTmpLge;
bConvertSystemToSystem = bSystemToSystem;
+ mbConvertForExcelExport = bForExcelExport;
}
// Only changes the bool variable, in order to temporarily pause the convert mode
void SetConvertMode(bool bMode) { bConvertMode = bMode; }
@@ -183,6 +184,7 @@ private: // Private section
OUString sErrStr; // String for error output
bool bConvertMode; // Set in the convert mode
+ bool mbConvertForExcelExport; // Set in the convert mode whether to convert for Excel export
LanguageType eNewLnge; // Language/country which the scanned string is converted to (for Excel filter)
LanguageType eTmpLnge; // Language/country which the scanned string is converted from (for Excel filter)