PutEntry familly of functions use consistent pairing OUString/sal_Int32
Change-Id: I23ae9d3e8bf71ef9ece75ea013d18c36ab2e69d4
This commit is contained in:
parent
82a134c156
commit
cc63555fd0
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user