diff options
-rw-r--r-- | basic/source/runtime/runtime.cxx | 4 | ||||
-rw-r--r-- | basic/source/sbx/sbxdate.cxx | 4 | ||||
-rw-r--r-- | basic/source/sbx/sbxscan.cxx | 2 | ||||
-rw-r--r-- | editeng/source/items/flditem.cxx | 29 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 7 | ||||
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 8 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 70 | ||||
-rw-r--r-- | svtools/source/control/fmtfield.cxx | 6 |
9 files changed, 86 insertions, 46 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 3c2c661cc9fc..482526382a50 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -373,7 +373,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, rpNumberFormatter = new SvNumberFormatter( xFactory, eLangType ); - sal_uInt16 nCheckPos = 0; short nType; + sal_Int32 nCheckPos = 0; short nType; rnStdTimeIdx = rpNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eLangType ); // the formatter's standard templates have only got a two-digit date @@ -393,7 +393,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, default: aDateStr = "MM.TT.JJJJ"; break; } rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType, - rnStdDateIdx, LANGUAGE_GERMAN, eLangType ); + rnStdDateIdx, LANGUAGE_GERMAN, eLangType ); nCheckPos = 0; OUString aStrHHMMSS(" HH:MM:SS"); aDateStr += aStrHHMMSS; diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index cc6aedc5cb04..7c0182791a84 100644 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -104,7 +104,7 @@ double ImpGetDate( const SbxValues* p ) pFormatter = new SvNumberFormatter( xFactory, eLangType ); sal_uInt32 nIndex; - sal_uInt16 nCheckPos = 0; + sal_Int32 nCheckPos = 0; short nType = 127; // Default templates of the formatter have only two-digit @@ -277,7 +277,7 @@ start: pFormatter = new SvNumberFormatter( xFactory, eLangType ); sal_uInt32 nIndex; - sal_uInt16 nCheckPos = 0; + sal_Int32 nCheckPos = 0; short nType; SvtSysLocale aSysLocale; diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 3257354bfc74..111c8b3285b3 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -739,7 +739,7 @@ void SbxValue::Format( OUString& rRes, const OUString* pFmt ) const // number format, use SvNumberFormatter to handle it. if( bSuccess ) { - sal_uInt16 nCheckPos = 0; + sal_Int32 nCheckPos = 0; short nType; OUString aFmtStr = *pFmt; VbaFormatInfo* pInfo = getFormatInfo( aFmtStr ); diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index a26f53304cd1..c9eebe655f75 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -838,39 +838,42 @@ rtl::OUString SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, { case SVXTIMEFORMAT_12_HM: nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMAMPM, eLang ); - break; + break; case SVXTIMEFORMAT_12_HMSH: - { // no builtin format available, try to insert or reuse - rtl::OUString aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) ); - xub_StrLen nCheckPos; + { + // no builtin format available, try to insert or reuse + OUString aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) ); + sal_Int32 nCheckPos; short nType; - rFormatter.PutandConvertEntry( aFormatCode, - nCheckPos, nType, nFormatKey, LANGUAGE_ENGLISH_US, eLang ); + rFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType, + nFormatKey, LANGUAGE_ENGLISH_US, eLang ); DBG_ASSERT( nCheckPos == 0, "SVXTIMEFORMAT_12_HMSH: could not insert format code" ); if ( nCheckPos ) + { nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang ); + } + break; } - break; case SVXTIMEFORMAT_24_HM: nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMM, eLang ); - break; + break; case SVXTIMEFORMAT_24_HMSH: nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HH_MMSS00, eLang ); - break; + break; case SVXTIMEFORMAT_12_HMS: nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSSAMPM, eLang ); - break; + break; case SVXTIMEFORMAT_24_HMS: nFormatKey = rFormatter.GetFormatIndex( NF_TIME_HHMMSS, eLang ); - break; + break; case SVXTIMEFORMAT_STANDARD: default: nFormatKey = rFormatter.GetStandardFormat( NUMBERFORMAT_TIME, eLang ); } double fFracTime = aTime.GetTimeInDays(); - rtl::OUString aStr; - Color* pColor = NULL; + OUString aStr; + Color* pColor = NULL; rFormatter.GetOutputString( fFracTime, nFormatKey, aStr, &pColor ); return aStr; } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index d5ad5e7f3326..a60fa55de60b 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -2251,7 +2251,7 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo ) nNumberFormat = GetFormatTable()->GetEntryKey(aNumFmt); if (nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND) { - xub_StrLen nErrPos = 0; + sal_Int32 nErrPos = 0; short nDummy; bool bValidFmt = GetFormatTable()->PutEntry(aNumFmt, nErrPos, nDummy, nNumberFormat); if (!bValidFmt) diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 6e65a15c0cbf..3d1d3919390b 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1898,12 +1898,11 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) aCode = aCode.replaceAll(";;", ";"); // get rid of Xcl escape characters aCode = aCode.replaceAll(rtl::OUString(static_cast<sal_Unicode>(0x1b)), rtl::OUString()); - xub_StrLen nCheckPos; + sal_Int32 nCheckPos; short nType; sal_uInt32 nKey; - pDoc->GetFormatTable()->PutandConvertEntry( - aCode, nCheckPos, nType, nKey, LANGUAGE_ENGLISH_US, - ScGlobal::eLnge ); + pDoc->GetFormatTable()->PutandConvertEntry( aCode, nCheckPos, nType, nKey, + LANGUAGE_ENGLISH_US, ScGlobal::eLnge ); if ( nCheckPos ) nKey = 0; aFormats.push_back( nKey ); diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index ea40a506523d..4c7b949021dd 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -395,7 +395,7 @@ public: bool PutEntry( String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, LanguageType eLnge = LANGUAGE_DONTKNOW ); - bool PutEntry( OUString& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, + bool PutEntry( OUString& rString, sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey, LanguageType eLnge = LANGUAGE_DONTKNOW ); /** Same as <method>PutEntry</method> but the format code string is @@ -405,7 +405,7 @@ public: short& nType, sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge ); - bool PutandConvertEntry( OUString& rString, xub_StrLen& nCheckPos, + bool PutandConvertEntry( OUString& rString, sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge ); @@ -413,6 +413,10 @@ public: is considered to be of the System language/country eLnge and is converted to another System language/country eNewLnge. In this case the automatic currency is converted too. */ + bool PutandConvertEntrySystem( OUString& rString, sal_Int32& nCheckPos, + short& nType, sal_uInt32& nKey, + LanguageType eLnge, LanguageType eNewLnge ); + bool PutandConvertEntrySystem( String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge ); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 60726af504da..2e1c20d2146f 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -416,29 +416,39 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) SvNumberformat* pOldEntry = aOldTable.begin()->second; aOldTable.erase( nKey ); String aString( pOldEntry->GetFormatstring() ); - xub_StrLen nCheckPos = STRING_NOTFOUND; // Same as PutEntry() but assures key position even if format code is // a duplicate. Also won't mix up any LastInsertKey. ChangeIntl( eOldLanguage ); LanguageType eLge = eOldLanguage; // ConvertMode changes this bool bCheck = false; + xub_StrLen nCheckPos; SvNumberformat* pNewEntry = new SvNumberformat( aString, pFormatScanner, - pStringScanner, nCheckPos, eLge ); + pStringScanner, nCheckPos, eLge ); if ( nCheckPos != 0 ) + { delete pNewEntry; + } else { short eCheckType = pNewEntry->GetType(); if ( eCheckType != NUMBERFORMAT_UNDEFINED ) + { pNewEntry->SetType( eCheckType | NUMBERFORMAT_DEFINED ); + } else + { pNewEntry->SetType( NUMBERFORMAT_DEFINED ); + } if ( !aFTable.insert( make_pair( nKey, pNewEntry) ).second ) + { delete pNewEntry; + } else + { bCheck = true; + } } DBG_ASSERT( bCheck, "SvNumberFormatter::ReplaceSystemCL: couldn't convert" ); (void)bCheck; @@ -486,6 +496,7 @@ bool SvNumberFormatter::PutEntry(String& rString, pStringScanner, nCheckPos, eLge); + if (nCheckPos == 0) // Format ok { // Type comparison: short eCheckType = p_Entry->GetType(); @@ -532,14 +543,16 @@ bool SvNumberFormatter::PutEntry(String& rString, return bCheck; } -bool SvNumberFormatter::PutEntry( - OUString& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, - LanguageType eLnge) +bool SvNumberFormatter::PutEntry(OUString& rString, sal_Int32& nCheckPos32, + short& nType, sal_uInt32& nKey, + LanguageType eLnge) { // Wrapper to allow OUString to be used. String aStr(rString); + xub_StrLen nCheckPos = nCheckPos32 < 0 ? 0xFFFF : (xub_StrLen)nCheckPos32; bool bRet = PutEntry(aStr, nCheckPos, nType, nKey, eLnge); rString = aStr; + nCheckPos32 = nCheckPos == 0xFFFF ? -1 : nCheckPos; return bRet; } @@ -561,24 +574,45 @@ bool SvNumberFormatter::PutandConvertEntry(String& rString, } bool SvNumberFormatter::PutandConvertEntry(OUString& rString, - xub_StrLen& nCheckPos, + sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge) { - String aStr; - bool bRet = PutandConvertEntry(aStr, nCheckPos, nType, nKey, eLnge, eNewLnge); - rString = aStr; - return bRet; + bool bRes; + if (eNewLnge == LANGUAGE_DONTKNOW) + eNewLnge = IniLnge; + + pFormatScanner->SetConvertMode(eLnge, eNewLnge); + bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); + pFormatScanner->SetConvertMode(false); + return bRes; +} + +bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString, + sal_Int32& nCheckPos, + short& nType, + sal_uInt32& nKey, + LanguageType eLnge, + LanguageType eNewLnge) +{ + bool bRes; + if (eNewLnge == LANGUAGE_DONTKNOW) + eNewLnge = IniLnge; + + pFormatScanner->SetConvertMode(eLnge, eNewLnge, true); + bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); + pFormatScanner->SetConvertMode(false); + return bRes; } bool SvNumberFormatter::PutandConvertEntrySystem(String& rString, - xub_StrLen& nCheckPos, - short& nType, - sal_uInt32& nKey, - LanguageType eLnge, - LanguageType eNewLnge) + xub_StrLen& nCheckPos, + short& nType, + sal_uInt32& nKey, + LanguageType eLnge, + LanguageType eNewLnge) { bool bRes; if (eNewLnge == LANGUAGE_DONTKNOW) @@ -617,7 +651,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString, // language and wouldn't match eSysLnge anymore, do that on a copy. String aTmp( rString); rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType, - nKey, eLnge, SvtSysLocale().GetLanguage()); + nKey, eLnge, SvtSysLocale().GetLanguage()); if (rCheckPos > 0) { SAL_WARN( "svl.numbers", "SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale"); @@ -3194,7 +3228,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat() { if ( nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) { - xub_StrLen nCheck; + sal_Int32 nCheck; short nType; NfWSStringsDtor aCurrList; sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList, @@ -3237,7 +3271,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) { // none found, create one - xub_StrLen nCheck; + sal_Int32 nCheck; NfWSStringsDtor aCurrList; sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList, GetCurrencyEntry( ActLnge ), false ); diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index 8bb336f05c7e..3bfa00a81b3f 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -640,7 +640,7 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset LanguageType aNewLang = pDefaultEntry ? pDefaultEntry->GetLanguage() : LANGUAGE_DONTKNOW; // den alten Format-String in die neue Sprache konvertieren - sal_uInt16 nCheckPos; + sal_Int32 nCheckPos; short nType; pFormatter->PutandConvertEntry(sOldFormat, nCheckPos, nType, nDestKey, aOldLang, aNewLang); m_nFormatKey = nDestKey; @@ -716,7 +716,7 @@ void FormattedField::SetThousandsSep(sal_Bool _bUseSeparator) // generate a new format ... OUString sFmtDescription = ImplGetFormatter()->GenerateFormat(m_nFormatKey, eLang, _bUseSeparator, IsRed, nPrecision, nAnzLeading); // ... and introduce it to the formatter - sal_uInt16 nCheckPos; + sal_Int32 nCheckPos; sal_uInt32 nNewKey; short nType; ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang); @@ -759,7 +759,7 @@ void FormattedField::SetDecimalDigits(sal_uInt16 _nPrecision) // generate a new format ... OUString sFmtDescription = ImplGetFormatter()->GenerateFormat(m_nFormatKey, eLang, bThousand, IsRed, _nPrecision, nAnzLeading); // ... and introduce it to the formatter - sal_uInt16 nCheckPos; + sal_Int32 nCheckPos; sal_uInt32 nNewKey; short nType; ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang); |