Kaydet (Commit) fb468545 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

more wrapper in zforlist to isolate String/OUString issues

Change-Id: I53e5e60f59739bdcedb6e7b13006850e0e5b22c0
üst 7796d003
...@@ -494,7 +494,7 @@ public: ...@@ -494,7 +494,7 @@ public:
/** Format a string according to a format index, return string and color. /** Format a string according to a format index, return string and color.
Formats only if the format code is of type text or the 4th subcode Formats only if the format code is of type text or the 4th subcode
of a format code is specified, otherwise sOutString will be == "" */ of a format code is specified, otherwise sOutString will be == "" */
void GetOutputString( OUString& sString, sal_uInt32 nFIndex, void GetOutputString( const OUString& sString, sal_uInt32 nFIndex,
OUString& sOutString, Color** ppColor, bool bUseStarFormat = false ); OUString& sOutString, Color** ppColor, bool bUseStarFormat = false );
/** Format a number according to the standard default format matching /** Format a number according to the standard default format matching
...@@ -524,6 +524,10 @@ public: ...@@ -524,6 +524,10 @@ public:
/** Same as <method>GetPreviewString</method> but the format code string /** Same as <method>GetPreviewString</method> but the format code string
may be either language/country eLnge or en_US english US */ may be either language/country eLnge or en_US english US */
bool GetPreviewStringGuess( const OUString& sFormatString, double fPreviewNumber,
OUString& sOutString, Color** ppColor,
LanguageType eLnge = LANGUAGE_DONTKNOW );
bool GetPreviewStringGuess( const String& sFormatString, double fPreviewNumber, bool GetPreviewStringGuess( const String& sFormatString, double fPreviewNumber,
String& sOutString, Color** ppColor, String& sOutString, Color** ppColor,
LanguageType eLnge = LANGUAGE_DONTKNOW ); LanguageType eLnge = LANGUAGE_DONTKNOW );
...@@ -533,6 +537,10 @@ public: ...@@ -533,6 +537,10 @@ public:
<FALSE/> if format code contains an error <FALSE/> if format code contains an error
<TRUE/> else, in which case the string and color are returned. <TRUE/> else, in which case the string and color are returned.
*/ */
bool GetPreviewString( const OUString& sFormatString, const OUString& sPreviewString,
OUString& sOutString, Color** ppColor,
LanguageType eLnge = LANGUAGE_DONTKNOW );
bool GetPreviewString( const String& sFormatString, const String& sPreviewString, bool GetPreviewString( const String& sFormatString, const String& sPreviewString,
String& sOutString, Color** ppColor, String& sOutString, Color** ppColor,
LanguageType eLnge = LANGUAGE_DONTKNOW ); LanguageType eLnge = LANGUAGE_DONTKNOW );
......
...@@ -1555,7 +1555,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, ...@@ -1555,7 +1555,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
rOutString = aTmp; rOutString = aTmp;
} }
void SvNumberFormatter::GetOutputString(OUString& sString, void SvNumberFormatter::GetOutputString(const OUString& sString,
sal_uInt32 nFIndex, sal_uInt32 nFIndex,
OUString& sOutString, OUString& sOutString,
Color** ppColor, Color** ppColor,
...@@ -1683,7 +1683,7 @@ bool SvNumberFormatter::GetPreviewString(const String& sFormatString, ...@@ -1683,7 +1683,7 @@ bool SvNumberFormatter::GetPreviewString(const String& sFormatString,
{ {
bool result; bool result;
OUString sTemp(sOutString); OUString sTemp(sOutString);
result = GetPreviewString(sFormatString, fPreviewNumber, sTemp, result = GetPreviewString(OUString(sFormatString), fPreviewNumber, sTemp,
ppColor, eLnge, bUseStarFormat ); ppColor, eLnge, bUseStarFormat );
sOutString = sTemp; sOutString = sTemp;
return result; return result;
...@@ -1695,7 +1695,21 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, ...@@ -1695,7 +1695,21 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString,
Color** ppColor, Color** ppColor,
LanguageType eLnge ) LanguageType eLnge )
{ {
if (sFormatString.Len() == 0) // no empty string bool result;
OUString sTemp(sOutString);
result = GetPreviewStringGuess( OUString(sFormatString), fPreviewNumber,
sTemp, ppColor, eLnge );
sOutString = sTemp;
return result;
}
bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
double fPreviewNumber,
OUString& sOutString,
Color** ppColor,
LanguageType eLnge )
{
if (sFormatString.isEmpty()) // no empty string
{ {
return false; return false;
} }
...@@ -1707,7 +1721,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, ...@@ -1707,7 +1721,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString,
eLnge = ActLnge; eLnge = ActLnge;
bool bEnglish = (eLnge == LANGUAGE_ENGLISH_US); bool bEnglish = (eLnge == LANGUAGE_ENGLISH_US);
String aFormatStringUpper( pCharClass->uppercase( sFormatString ) ); OUString aFormatStringUpper( pCharClass->uppercase( sFormatString ) );
sal_uInt32 nCLOffset = ImpGenerateCL( eLnge ); sal_uInt32 nCLOffset = ImpGenerateCL( eLnge );
sal_uInt32 nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, eLnge ); sal_uInt32 nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, eLnge );
if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND )
...@@ -1782,9 +1796,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, ...@@ -1782,9 +1796,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString,
if (nCheckPos == 0) // String ok if (nCheckPos == 0) // String ok
{ {
ImpGenerateCL( eLnge ); // create new standard formats if necessary ImpGenerateCL( eLnge ); // create new standard formats if necessary
OUString sTemp(sOutString); pEntry->GetOutputString( fPreviewNumber, sOutString, ppColor );
pEntry->GetOutputString( fPreviewNumber, sTemp, ppColor );
sOutString = sTemp;
delete pEntry; delete pEntry;
return true; return true;
} }
...@@ -1798,7 +1810,21 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString, ...@@ -1798,7 +1810,21 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString,
Color** ppColor, Color** ppColor,
LanguageType eLnge ) LanguageType eLnge )
{ {
if (sFormatString.Len() == 0) // no empty string bool result;
OUString sTemp(sOutString);
result = GetPreviewString( OUString(sFormatString), OUString(sPreviewString),
sTemp, ppColor, eLnge );
sOutString = sTemp;
return result;
}
bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString,
const OUString& sPreviewString,
OUString& sOutString,
Color** ppColor,
LanguageType eLnge )
{
if (sFormatString.isEmpty()) // no empty string
{ {
return false; return false;
} }
...@@ -1818,15 +1844,12 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString, ...@@ -1818,15 +1844,12 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString,
eLnge); eLnge);
if (nCheckPos == 0) // String ok if (nCheckPos == 0) // String ok
{ {
OUString aNonConstPreview( sPreviewString);
OUString sTemp;
// May have to create standard formats for this locale. // May have to create standard formats for this locale.
sal_uInt32 CLOffset = ImpGenerateCL(eLnge); sal_uInt32 CLOffset = ImpGenerateCL(eLnge);
nKey = ImpIsEntry( p_Entry->GetFormatstring(), CLOffset, eLnge); nKey = ImpIsEntry( p_Entry->GetFormatstring(), CLOffset, eLnge);
if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // already present if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // already present
{ {
GetOutputString( aNonConstPreview, nKey, sTemp, ppColor); GetOutputString( sPreviewString, nKey, sOutString, ppColor);
sOutString = sTemp;
} }
else else
{ {
...@@ -1835,8 +1858,7 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString, ...@@ -1835,8 +1858,7 @@ bool SvNumberFormatter::GetPreviewString( const String& sFormatString,
// in SvNumberFormatter::GetOutputString() // in SvNumberFormatter::GetOutputString()
if (p_Entry->IsTextFormat() || p_Entry->HasTextFormat()) if (p_Entry->IsTextFormat() || p_Entry->HasTextFormat())
{ {
p_Entry->GetOutputString( aNonConstPreview, sTemp, ppColor); p_Entry->GetOutputString( sPreviewString, sOutString, ppColor);
sOutString = sTemp;
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment