diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-02-24 15:44:30 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-02-24 15:46:03 -0500 |
commit | 44b463c0e1b6d21e8707636387d88470ffce438a (patch) | |
tree | 0f8504805479809339e87ac6a1b7ed1d1dc0b3f9 /svl/source/numbers | |
parent | 39d15024ebf47104bae179c3351c6af842edd0bd (diff) |
Pick up numeral shape and calendar type as well as the language.
So far this change doesn't affect the behavior of the number formatter
but only to pick up extra data that Excel provides (that we need to
map to our own later on).
Diffstat (limited to 'svl/source/numbers')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 882c8a548c57..fc3b31651701 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -798,17 +798,17 @@ SvNumberformat::SvNumberformat(String& rString, else { xub_StrLen nTmp = 2; - LanguageType eLang = ImpGetLanguageType( sStr, nTmp ); - if ( eLang == LANGUAGE_DONTKNOW ) + LocaleType aLocale = ImpGetLocaleType( sStr, nTmp ); + if (aLocale.meLanguage == LANGUAGE_DONTKNOW) { bCancel = TRUE; // break for nCheckPos = nPosOld; } else { - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "$-" ) ); - sStr += String::CreateFromInt32( sal_Int32( eLang ), 16 ).ToUpperAscii(); - NumFor[nIndex].SetNatNumLang( eLang ); + sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM("$-") ); + sStr += String::CreateFromInt32(sal_Int32(aLocale.meLanguage), 16).ToUpperAscii(); + NumFor[nIndex].SetNatNumLang(aLocale.meLanguage); } } } @@ -1095,11 +1095,36 @@ xub_StrLen SvNumberformat::ImpGetNumber(String& rString, return nPos - nStartPos; } +::rtl::OUString SvNumberformat::LocaleType::generateCode() const +{ + // TODO: to be worked on ..... + return ::rtl::OUString(); +} + +SvNumberformat::LocaleType::LocaleType() : + mnNumeralShape(0), + mnCalendarType(0), + meLanguage(LANGUAGE_DONTKNOW) +{ +} + +SvNumberformat::LocaleType::LocaleType(sal_uInt32 nRawNum) : + mnNumeralShape(0), + mnCalendarType(0), + meLanguage(LANGUAGE_DONTKNOW) +{ + meLanguage = static_cast<LanguageType>(nRawNum & 0x0000FFFF); + nRawNum = (nRawNum >> 16); + mnCalendarType = static_cast<sal_uInt8>(nRawNum & 0xFF); + nRawNum = (nRawNum >> 8); + mnNumeralShape = static_cast<sal_uInt8>(nRawNum & 0xFF); +} + // static -LanguageType SvNumberformat::ImpGetLanguageType( const String& rString, - xub_StrLen& nPos ) +SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType( + const String& rString, xub_StrLen& nPos ) { - sal_Int32 nNum = 0; + sal_uInt32 nNum = 0; sal_Unicode cToken = 0; xub_StrLen nLen = rString.Len(); while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') ) @@ -1123,8 +1148,8 @@ LanguageType SvNumberformat::ImpGetLanguageType( const String& rString, return LANGUAGE_DONTKNOW; ++nPos; } - return (nNum && (cToken == ']' || nPos == nLen)) ? (LanguageType)nNum : - LANGUAGE_DONTKNOW; + + return (nNum && (cToken == ']' || nPos == nLen)) ? LocaleType(nNum) : LocaleType(); } short SvNumberformat::ImpNextSymbol(String& rString, |