diff options
author | Eike Rathke <erack@redhat.com> | 2017-11-17 00:16:17 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-17 00:17:04 +0100 |
commit | eb8bd7f21103ed2349b44c954db977709de2e4ec (patch) | |
tree | f872db70d10239b88c049a7caf9c34c14e9e8602 | |
parent | f643e1f687e27e7f46c53d7298772d4dddb3e660 (diff) |
Resolves: tdf#113889 no date particle reordering when exporting to Excel
Change-Id: I45667a67c6c69106d86755ed41438f23e019dfea
-rw-r--r-- | include/svl/zforlist.hxx | 3 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 7 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 6 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.hxx | 4 |
4 files changed, 14 insertions, 6 deletions
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx index 9c809bf30e8c..3e59064281c2 100644 --- a/include/svl/zforlist.hxx +++ b/include/svl/zforlist.hxx @@ -402,7 +402,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 97f846ecc98b..dcca285d9f4b 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -623,14 +623,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; @@ -808,7 +809,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 f845b5f2ed5d..a48063f7df24 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -115,6 +115,7 @@ ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP ) pFormatter = pFormatterP; xNFC = css::i18n::NumberFormatMapper::create( pFormatter->GetComponentContext() ); bConvertMode = false; + mbConvertForExcelExport = false; bConvertSystemToSystem = false; sKeyword[NF_KEY_E] = sEnglishKeyword[NF_KEY_E]; // Exponent @@ -1725,7 +1726,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 fe08984e5c77..54c59323836f 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -136,12 +136,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; } @@ -197,6 +198,7 @@ private: // Private section static const 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) |