diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx index 50e7ea3ca4986..d87641e468431 100644 --- a/include/svl/zforlist.hxx +++ b/include/svl/zforlist.hxx @@ -74,6 +74,7 @@ namespace com { namespace sun { namespace star { 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. */ enum NfIndexTableOffset { @@ -131,6 +132,7 @@ enum NfIndexTableOffset NF_DATE_DIN_MMDD, // 10-08 DIN NF_DATE_DIN_YYMMDD, // 97-10-08 DIN NF_DATE_DIN_YYYYMMDD, // 1997-10-08 DIN + NF_DATE_ISO_YYYYMMDD = NF_DATE_DIN_YYYYMMDD, // 1997-10-08 ISO clarify with name NF_DATE_SYS_MMYY, // 10.97 NF_DATE_SYS_DDMMM, // 08.Oct NF_DATE_MMMM, // October @@ -156,15 +158,26 @@ enum NfIndexTableOffset NF_BOOLEAN, // BOOLEAN NF_TEXT, // @ - NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // old number of predefined entries, locale data additions start after this + 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 + // XXX Values appended here must also get a corresponding entry in + // svl/source/numbers/zforlist.cxx indexTable[] in the same order. + + // XXX The dialog's number format shell assumes start/end spans + // (NF_..._START and NF_..._END above) to fill its categories with builtin + // formats, make new formats known to svx/source/items/numfmtsh.cxx + // SvxNumberFormatShell::FillEListWithStd_Impl(), otherwise they will not + // be be listed at all. Yes that is ugly. + NF_FRACTION_3 = NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // # ?/4 NF_FRACTION_4, // # ?/100 - NF_INDEX_TABLE_ENTRIES + NF_DATETIME_ISO_YYYYMMDD_HHMMSS, // 1997-10-08 01:23:45 ISO (with blank instead of T) + + NF_INDEX_TABLE_ENTRIES // == 53, reserved up to 59 to not use in i18npool locale data. }; diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 91037ff09f864..df13480ff0191 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -91,6 +91,7 @@ using namespace ::std; * (old currency) is recognized as a date (#53155#). */ #define UNKNOWN_SUBSTITUTE LANGUAGE_ENGLISH_US +// Same order as in include/svl/zforlist.hxx enum NfIndexTableOffset static sal_uInt32 const indexTable[NF_INDEX_TABLE_ENTRIES] = { ZF_STANDARD, // NF_NUMBER_STANDARD ZF_STANDARD + 1, // NF_NUMBER_INT @@ -143,7 +144,8 @@ static sal_uInt32 const indexTable[NF_INDEX_TABLE_ENTRIES] = { ZF_STANDARD_LOGICAL, // NF_BOOLEAN ZF_STANDARD_TEXT, // NF_TEXT ZF_STANDARD_FRACTION + 2, // NF_FRACTION_3 - ZF_STANDARD_FRACTION + 3 // NF_FRACTION_4 + ZF_STANDARD_FRACTION + 3, // NF_FRACTION_4 + ZF_STANDARD_DATETIME + 2 // NF_DATETIME_ISO_YYYYMMDD_HHMMSS }; /** @@ -2495,7 +2497,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio ImpInsertFormat( aFormatSeq[nIdx], CLOffset + ZF_STANDARD_NEWEXTENDED_DATE_DIN_YYMMDD /* NF_DATE_DIN_YYMMDD */ ); - // YYYY-MM-DD DIN/EN + // YYYY-MM-DD DIN/EN/ISO nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYYYMMDD ); ImpInsertFormat( aFormatSeq[nIdx], CLOffset + ZF_STANDARD_NEWEXTENDED_DATE_DIN_YYYYMMDD /* NF_DATE_DIN_YYYYMMDD */ ); @@ -2555,6 +2557,22 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio ImpInsertFormat( aFormatSeq[nIdx], CLOffset + ZF_STANDARD_DATETIME+1 /* NF_DATETIME_SYS_DDMMYYYY_HHMMSS */ ); + const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords(); + i18n::NumberFormatCode aSingleFormatCode; + OUStringBuffer aBuf; + aSingleFormatCode.Usage = i18n::KNumberFormatUsage::DATE_TIME; + + // YYYY-MM-DD HH:MM:SS ISO + aBuf.append( rKeyword[NF_KEY_YYYY]).append('-'). + append( rKeyword[NF_KEY_MM]).append('-'). + append( rKeyword[NF_KEY_DD]).append(' '). + append( rKeyword[NF_KEY_HH]).append(':'). + append( rKeyword[NF_KEY_MMI]).append(':'). + append( rKeyword[NF_KEY_SS]); + aSingleFormatCode.Code = aBuf.makeStringAndClear(); + ImpInsertFormat( aSingleFormatCode, + CLOffset + ZF_STANDARD_DATETIME+2 /* NF_DATETIME_ISO_YYYYMMDD_HHMMSS */ ); + // Scientific number aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER ); @@ -2572,7 +2590,6 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // Fraction number (no default option) - i18n::NumberFormatCode aSingleFormatCode; aSingleFormatCode.Usage = i18n::KNumberFormatUsage::FRACTION_NUMBER; // # ?/? @@ -2598,7 +2615,6 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // Week of year - const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords(); aSingleFormatCode.Code = rKeyword[NF_KEY_WW]; ImpInsertFormat( aSingleFormatCode, CLOffset + ZF_STANDARD_NEWEXTENDED_DATE_WW /* NF_DATE_WW */ ); diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index d4d664991210d..b4a4fc2cad6a1 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -621,6 +621,8 @@ void SvxNumberFormatShell::FillEListWithStd_Impl( std::vector& rList, if(nPrivCat==CAT_DATE || nPrivCat==CAT_TIME) { nSelPos=FillEListWithDateTime_Impl(rList,nSelPos); + nSelPos = FillEListWithFormats_Impl( rList, nSelPos, + NF_DATETIME_ISO_YYYYMMDD_HHMMSS, NF_DATETIME_ISO_YYYYMMDD_HHMMSS); } } }