diff options
author | Eike Rathke <erack@redhat.com> | 2017-10-04 23:50:31 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-10-05 09:26:30 +0200 |
commit | 5be8c9cc1b92101e6f9fe5685df86e77d3eee3cc (patch) | |
tree | 3ab94d8dde0cf5df515c46c4866c254b32a0c410 /include | |
parent | 4fd81a26681063dcc0d8d2eae795d39c8d894cb8 (diff) |
Resolves: tdf#102075 support system [$-F400] time and [$-F800] long date
By substituting a (valid matching the type) format using these
special LCID modifier values with the current system locale's
format.
See ECMA-376-1:2016 18.8.31 numFmts (Number Formats) and
https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.numberingformats.aspx
which seems to be the only documentation available.
Change-Id: Ieca048a77d4ef473ae475e202557d1353ff5387d
Reviewed-on: https://gerrit.libreoffice.org/43148
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/svl/zforlist.hxx | 6 | ||||
-rw-r--r-- | include/svl/zformat.hxx | 32 | ||||
-rw-r--r-- | include/xmloff/xmlnumfe.hxx | 4 |
3 files changed, 39 insertions, 3 deletions
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx index 35a1bc5c50c1..19015cc1000c 100644 --- a/include/svl/zforlist.hxx +++ b/include/svl/zforlist.hxx @@ -552,6 +552,9 @@ public: /// Return the format for a format index const SvNumberformat* GetEntry( sal_uInt32 nKey ) const; + /// Obtain substituted GetFormatEntry(), i.e. system formats. + const SvNumberformat* GetSubstitutedEntry( sal_uInt32 nKey, sal_uInt32 & o_rNewKey ) const; + /// Return the format index of the standard default number format for language/country sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW); @@ -904,6 +907,9 @@ private: // return position of a special character sal_Int32 ImpPosToken ( const OUStringBuffer & sFormat, sal_Unicode token, sal_Int32 nStartPos = 0 ); + // Substitute a format during GetFormatEntry(), i.e. system formats. + SvNumberformat* ImpSubstituteEntry( SvNumberformat* pFormat, sal_uInt32 * o_pRealKey = nullptr ); + public: // own static mutex, may also be used by internal class SvNumberFormatterRegistry_Impl diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx index 6fcb24dd7a24..5d0e1f288643 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -141,9 +141,17 @@ class SVL_DLLPUBLIC SvNumberformat { struct LocaleType { + enum class Substitute : sal_uInt8 + { + NONE, + TIME, + LONGDATE + }; + + LanguageType meLanguage; + Substitute meSubstitute; sal_uInt8 mnNumeralShape; sal_uInt8 mnCalendarType; - LanguageType meLanguage; OUString generateCode() const; @@ -184,6 +192,28 @@ public: LanguageType GetLanguage() const { return maLocale.meLanguage;} + /** If the format is a placeholder and needs to be substituted. */ + bool IsSubstituted() const + { + return maLocale.meSubstitute != LocaleType::Substitute::NONE; + } + + /** If the format is a placeholder for the sytem time format and needs to + be substituted during formatting time. + */ + bool IsSystemTimeFormat() const + { + return maLocale.meSubstitute == LocaleType::Substitute::TIME && maLocale.meLanguage == LANGUAGE_SYSTEM; + } + + /** If the format is a placeholder for the sytem long date format and needs + to be substituted during formatting time. + */ + bool IsSystemLongDateFormat() const + { + return maLocale.meSubstitute == LocaleType::Substitute::LONGDATE && maLocale.meLanguage == LANGUAGE_SYSTEM; + } + const OUString& GetFormatstring() const { return sFormatstring; } // Build a format string of application defined keywords diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx index c3c51ea57797..79df5c853f5d 100644 --- a/include/xmloff/xmlnumfe.hxx +++ b/include/xmloff/xmlnumfe.hxx @@ -92,10 +92,10 @@ private: SAL_DLLPRIVATE void WriteRepeatedElement_Impl( sal_Unicode ch ); SAL_DLLPRIVATE bool WriteTextWithCurrency_Impl( const OUString& rString, const css::lang::Locale& rLocale ); - SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, + SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey, sal_uInt16 nPart, bool bDefPart ); - SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey ); + SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey ); public: SvXMLNumFmtExport( SvXMLExport& rExport, |