diff options
author | Eike Rathke <erack@redhat.com> | 2020-02-22 18:52:06 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2020-02-22 20:17:54 +0100 |
commit | 8453f6e5d1fd98700a37e30346a1af0daf8fb753 (patch) | |
tree | 9d5ee1a300bc922dd4c577365e598a2e7a814218 /include | |
parent | 3ac9f491c20fb56c4544444d876687dd6d8de231 (diff) |
Resolves: tdf#130563 Add predefined 4-digit year date+time format
Add a predefined NF_DATETIME_SYS_DDMMYYYY_HHMM format code with
formatindex="50" to all locale data files, which shifts all
reserved area internally generated built-in formats up by one.
Reserved area was filled already so that boundary has to be
increased as well. Add some flexibility for future additions by
setting the new boundary to 65, free first format index to be used
by additional locale data formats is 66 now. Adapt all locales to
the new boundary.
The existing predefined NF_DATETIME_SYSTEM_SHORT_HHMM format code
with formatindex="46" mostly was and is used with 2-digit years
(stemming back from the old binary format and Excel
compatibility), some locales that don't use 2-digit years at all
already defined it to 4-digit years. Keep those but move the
default="true" attribute (if so) to the new "50" format.
Modify populating the format list such that resulting duplicates
will be suppressed there as well.
Also try to match the new format in ODF import if a long year was
requested with date+time.
Finally set the new format as default for all *_IT locales. In
future changing the default date+time format to 4-digit year is
just a matter of moving the default="true" attribute to the new
format.
Change-Id: Ib16aa9fda0e71b2d03f78e3dd013785de03cd288
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89265
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'include')
-rw-r--r-- | include/i18npool/reservedconstants.hxx | 12 | ||||
-rw-r--r-- | include/svl/zforlist.hxx | 18 | ||||
-rw-r--r-- | include/svx/numfmtsh.hxx | 2 |
3 files changed, 25 insertions, 7 deletions
diff --git a/include/i18npool/reservedconstants.hxx b/include/i18npool/reservedconstants.hxx index 400344ce5a8d..6f707f83ac3d 100644 --- a/include/i18npool/reservedconstants.hxx +++ b/include/i18npool/reservedconstants.hxx @@ -12,10 +12,18 @@ /** Constant values shared between i18npool and, for example, the number formatter. */ namespace i18npool { +/** The number of predefined format code indices that must be defined by + locale data, except BOOLEAN and TEXT, exclusive. + This later in the build is static asserted to be equal to + NfIndexTableOffset::NF_INDEX_TABLE_RESERVED_START. */ +constexpr sal_Int16 nStopPredefinedFormatIndex = 51; + /** The number of reserved (with defined meaning) built-in format code indices, additional locale data format codes can be defined starting at this index - value. */ -constexpr sal_Int16 nFirstFreeFormatIndex = 60; + value. + This later in the build is static asserted to be greater or equal to + NfIndexTableOffset::NF_INDEX_TABLE_ENTRIES */ +constexpr sal_Int16 nFirstFreeFormatIndex = 66; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx index adbde81c9315..22689aa88c3d 100644 --- a/include/svl/zforlist.hxx +++ b/include/svl/zforlist.hxx @@ -136,7 +136,7 @@ namespace o3tl { Do NOT insert any new values! The values here correspond with those in offapi/com/sun/star/i18n/NumberFormatIndex.idl - You may append values though. + You may append values though after NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS. */ enum NfIndexTableOffset { @@ -222,8 +222,8 @@ enum NfIndexTableOffset NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // == 50, old number of predefined entries, i18npool locale data additions start after this - // From here on are values of new built-in formats that are not in the - // original NumberFormatIndex.idl + // From here on are values of new predefined and built-in formats that are + // not in the original NumberFormatIndex.idl // XXX Values appended here must also get a corresponding entry in // svl/source/numbers/zforlist.cxx indexTable[] in the same order. @@ -233,8 +233,16 @@ enum NfIndexTableOffset // formats, make new formats known to svx/source/items/numfmtsh.cxx // SvxNumberFormatShell::FillEListWithStd_Impl(), otherwise they will not // be listed at all. Yes that is ugly. + // DATETIME formats need to be added to + // SvxNumberFormatShell::FillEListWithDateTime_Impl(). - NF_FRACTION_3D = NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // # ???/??? + // New predefined format added to i18npool locale data. + NF_DATETIME_SYS_DDMMYYYY_HHMM = NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // 08.10.1997 01:23 formatindex="50" + + // No i18npool defined locale data between here and NF_INDEX_TABLE_ENTRIES. + NF_INDEX_TABLE_RESERVED_START, + + NF_FRACTION_3D = NF_INDEX_TABLE_RESERVED_START, // # ???/??? NF_FRACTION_2, // # ?/2 NF_FRACTION_4, // # ?/4 NF_FRACTION_8, // # ?/8 @@ -248,7 +256,7 @@ enum NfIndexTableOffset // XXX When adding values here, follow the comment above about // svx/source/items/numfmtsh.cxx - NF_INDEX_TABLE_ENTRIES // == 59, reserved up to #59 to not be used in i18npool locale data. + NF_INDEX_TABLE_ENTRIES // == 60, reserved to not be used in i18npool locale data. // XXX Adding values above may increment the reserved area that can't be // used by i18npool's locale data FormatCode definitions, see the diff --git a/include/svx/numfmtsh.hxx b/include/svx/numfmtsh.hxx index 9dc0b2b5c598..fe1193aee5a3 100644 --- a/include/svx/numfmtsh.hxx +++ b/include/svx/numfmtsh.hxx @@ -203,6 +203,8 @@ private: bool bSuppressDuplicates ); SVX_DLLPRIVATE short FillEListWithDateTime_Impl( std::vector<OUString>& rList,short nSelPos, bool bSuppressDuplicates ); + SVX_DLLPRIVATE void FillEListWithOneDateTime_Impl( std::vector<OUString>& rList, short & nSelPos, + bool bSuppressDuplicates, NfIndexTableOffset nOffset ); SVX_DLLPRIVATE short FillEListWithCurrency_Impl( std::vector<OUString>& rList,short nSelPos); SVX_DLLPRIVATE short FillEListWithSysCurrencys( std::vector<OUString>& rList,short nSelPos); SVX_DLLPRIVATE short FillEListWithUserCurrencys( std::vector<OUString>& rList,short nSelPos); |