diff options
author | Eike Rathke <erack@redhat.com> | 2012-04-30 13:20:07 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-04-30 13:20:07 +0200 |
commit | dba0aed4ca39b2b40c6609ff336384dcc75c6914 (patch) | |
tree | 676be2fa22d58d4f27283a86c77b41d9045b8f0c /svl | |
parent | get rid of dead binary file format legacy cruft in number formatter (diff) | |
download | core-dba0aed4ca39b2b40c6609ff336384dcc75c6914.tar.gz core-dba0aed4ca39b2b40c6609ff336384dcc75c6914.zip |
some changes for new fixed fraction built-in formats
Moved new fixed fraction built-in formats into the fixed set so they keep
their relative key position when switching system locale.
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/nfversi.hxx | 23 | ||||
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 10 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 28 |
3 files changed, 38 insertions, 23 deletions
diff --git a/svl/inc/svl/nfversi.hxx b/svl/inc/svl/nfversi.hxx index bd1fd3f740c2..65fe52111dc7 100644 --- a/svl/inc/svl/nfversi.hxx +++ b/svl/inc/svl/nfversi.hxx @@ -31,19 +31,20 @@ // file IDs -#define SV_NUMBERFORMATTER_VERSION_SYSTORE 0x0004 -#define SV_NUMBERFORMATTER_VERSION_KEYWORDS 0x0005 -#define SV_NUMBERFORMATTER_VERSION_NEWSTANDARD 0x0006 -#define SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 0x0007 -#define SV_NUMBERFORMATTER_VERSION_NF_DATE_WW 0x0008 -#define SV_NUMBERFORMATTER_VERSION_NEW_CURR 0x0009 -#define SV_NUMBERFORMATTER_VERSION_YEAR2000 0x000a -#define SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR 0x000b +#define SV_NUMBERFORMATTER_VERSION_SYSTORE 0x0004 +#define SV_NUMBERFORMATTER_VERSION_KEYWORDS 0x0005 +#define SV_NUMBERFORMATTER_VERSION_NEWSTANDARD 0x0006 +#define SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 0x0007 +#define SV_NUMBERFORMATTER_VERSION_NF_DATE_WW 0x0008 +#define SV_NUMBERFORMATTER_VERSION_NEW_CURR 0x0009 +#define SV_NUMBERFORMATTER_VERSION_YEAR2000 0x000a +#define SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR 0x000b #define SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS 0x000c -#define SV_NUMBERFORMATTER_VERSION_CALENDAR 0x000d +#define SV_NUMBERFORMATTER_VERSION_CALENDAR 0x000d #define SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS 0x000e +#define SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION 0x000f -#define SV_NUMBERFORMATTER_VERSION 0x000e +#define SV_NUMBERFORMATTER_VERSION 0x000f // 1 to 1996-01-18 // 2 1996-01-19 added TT.MM.JJJJ @@ -64,6 +65,8 @@ // C ????-??-?? date/time format of system variables // D 2000-11-23 new calendar // E 2001-01-19 additional formats provided by i18n +// F 2012-04-27 fixed fraction formats ?/4 and ??/100, actually added +// already 2010/2011 but without versioning #endif diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index fd3a7b913ff1..96a8955936e5 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -101,6 +101,9 @@ namespace rtl { <li>DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require. <li>all other: hard coded </ul> + + Do NOT insert any new values! + The values here correspond with those in offapi/com/sun/star/i18n/NumberFormatIndex.idl */ enum NfIndexTableOffset { @@ -182,6 +185,13 @@ enum NfIndexTableOffset NF_BOOLEAN, // BOOLEAN NF_TEXT, // @ + + // From here on are values of new built-in formats that are not in the + // original NumberFormatIndex.idl + + NF_FRACTION_3, // # ?/4 + NF_FRACTION_4, // # ?/100 + NF_INDEX_TABLE_ENTRIES }; diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 2b067cf25ac5..c09d14ea28b2 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -2545,6 +2545,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio // Fraction number (no default option) i18n::NumberFormatCode aSingleFormatCode; + aSingleFormatCode.Usage = i18n::KNumberFormatUsage::FRACTION_NUMBER; // # ?/? aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) ); @@ -2557,6 +2558,20 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio ImpInsertFormat( aSingleFormatCode, CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 )); + // # ?/4 + aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?/4" ) ); + ImpInsertNewStandardFormat( aSingleFormatCode, + CLOffset + SetIndexTable( NF_FRACTION_3, ZF_STANDARD_FRACTION+2 ), + SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION ); + + // # ??/100 + aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?\?/100" ) ); + ImpInsertNewStandardFormat( aSingleFormatCode, + CLOffset + SetIndexTable( NF_FRACTION_4, ZF_STANDARD_FRACTION+3 ), + SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION ); + + + // Week of year must be appended here because of nNewExtended const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords(); aSingleFormatCode.Code = rKeyword[NF_KEY_WW]; @@ -2565,7 +2580,6 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio SV_NUMBERFORMATTER_VERSION_NF_DATE_WW ); - bIndexTableInitialized = true; DBG_ASSERT( nNewExtended <= ZF_STANDARD_NEWEXTENDEDMAX, "ImpGenerateFormats: overflow of nNewExtended standard formats" ); @@ -2575,18 +2589,6 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio if ( !bNoAdditionalFormats ) ImpGenerateAdditionalFormats( CLOffset, aNumberFormatCode, false ); - sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); - - aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?/4" ) ); - ImpInsertNewStandardFormat( aSingleFormatCode, nPos+1, SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS ); - nPos++; - - aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?\?/100" ) ); - ImpInsertNewStandardFormat( aSingleFormatCode, nPos+1, SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS ); - nPos++; - - pStdFormat->SetLastInsertKey( (sal_uInt16)(nPos - CLOffset) ); - if (bOldConvertMode) pFormatScanner->SetConvertMode(true); } |