summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-11-24 16:23:03 -0600
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-11-27 22:59:28 -0600
commita8fe23a16082deb749b0ad8bfef93ef90ef9ce07 (patch)
treeedba056b16553e2c0a6377988842cb14044bdf41 /svl
parent389713cfaaa7b7f9736414abf2f184997b9bcf2b (diff)
clean-up few more String out of zformat internals
Change-Id: I83f7794a3cc413c7720ad605a22c00efe966e1a5
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/svl/zformat.hxx21
-rw-r--r--svl/source/numbers/zformat.cxx76
2 files changed, 53 insertions, 44 deletions
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index eb6c2b83b0c7..8e9dd9523190 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -347,7 +347,7 @@ public:
// of [$xxx-nnn] are returned
bool GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const;
- static bool HasStringNegativeSign( const String& rStr );
+ static bool HasStringNegativeSign( const OUString& rStr );
/**
Whether a character at position nPos is somewhere between two matching
@@ -359,9 +359,9 @@ public:
The default '\0' results in no escapement possible.
Defaults are set right according to the "unlogic" of the Numberformatter
*/
- static bool IsInQuote( const String& rString, xub_StrLen nPos,
- sal_Unicode cQuote = '"',
- sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' );
+ static bool IsInQuote( const OUString& rString, sal_Int32 nPos,
+ sal_Unicode cQuote = '"',
+ sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' );
/**
Return the position of a matching closing cQuote if the character at
@@ -483,8 +483,9 @@ private:
SVL_DLLPRIVATE bool ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const;
#ifdef THE_FUTURE
- SVL_DLLPRIVATE bool ImpSwitchToSpecifiedCalendar( String& rOrgCalendar,
- double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const;
+ SVL_DLLPRIVATE bool ImpSwitchToSpecifiedCalendar( OUString& rOrgCalendar,
+ double& fOrgDateTime,
+ const ImpSvNumFor& rNumFor ) const;
#endif
/** Whether to use possessive genitive case month name, or partitive case
@@ -652,14 +653,16 @@ private:
// normal digits or other digits, depending on ImpSvNumFor.aNatNum,
// [NatNum1], [NatNum2], ...
- SVL_DLLPRIVATE String ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal,
- sal_uInt16 nMinDigits = 0 ) const;
+ SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal,
+ sal_uInt16 nMinDigits = 0 ) const;
- String ImpIntToString( sal_uInt16 nIx, sal_Int32 nVal, sal_uInt16 nMinDigits = 0 ) const
+ OUString ImpIntToString( sal_uInt16 nIx, sal_Int32 nVal, sal_uInt16 nMinDigits = 0 ) const
{
const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum();
if ( nMinDigits || rNum.IsComplete() )
+ {
return ImpGetNatNumString( rNum, nVal, nMinDigits );
+ }
return rtl::OUString::valueOf(nVal);
}
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 4292baaf338f..0e916586aaf3 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3487,7 +3487,7 @@ bool SvNumberformat::ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, dou
* SwitchToSpecifiedCalendar(), see comment in
* ImpSvNumberInputScan::GetDateRef() */
-bool SvNumberformat::ImpSwitchToSpecifiedCalendar( String& rOrgCalendar,
+bool SvNumberformat::ImpSwitchToSpecifiedCalendar( OUString& rOrgCalendar,
double& fOrgDateTime,
const ImpSvNumFor& rNumFor ) const
{
@@ -3498,7 +3498,7 @@ bool SvNumberformat::ImpSwitchToSpecifiedCalendar( String& rOrgCalendar,
if ( rInfo.nTypeArray[i] == NF_SYMBOLTYPE_CALENDAR )
{
CalendarWrapper& rCal = GetCal();
- if ( !rOrgCalendar.Len() )
+ if ( !rOrgCalendar.getLength() )
{
rOrgCalendar = rCal.getUniqueID();
fOrgDateTime = rCal.getDateTime();
@@ -5004,7 +5004,7 @@ Color* SvNumberformat::GetColor( sal_uInt16 nNumFor ) const
return NumFor[nNumFor].GetColor();
}
-static void lcl_SvNumberformat_AddLimitStringImpl( String& rStr,
+static void lcl_SvNumberformat_AddLimitStringImpl( OUString& rStr,
SvNumberformatLimitOps eOp,
double fLimit, const String& rDecSep )
{
@@ -5013,31 +5013,31 @@ static void lcl_SvNumberformat_AddLimitStringImpl( String& rStr,
switch ( eOp )
{
case NUMBERFORMAT_OP_EQ :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[=" ) );
+ rStr = "[=";
break;
case NUMBERFORMAT_OP_NE :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<>" ) );
+ rStr = "[<>";
break;
case NUMBERFORMAT_OP_LT :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<" ) );
+ rStr = "[<";
break;
case NUMBERFORMAT_OP_LE :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<=" ) );
+ rStr = "[<=";
break;
case NUMBERFORMAT_OP_GT :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>" ) );
+ rStr = "[>";
break;
case NUMBERFORMAT_OP_GE :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>=" ) );
+ rStr = "[>=";
break;
default:
SAL_WARN( "svl.numbers", "unsupported number format" );
break;
}
- rStr += String( ::rtl::math::doubleToUString( fLimit,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- rDecSep.GetChar(0), true));
- rStr += ']';
+ rStr += ::rtl::math::doubleToUString( fLimit,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ rDecSep.GetChar(0), true);
+ rStr += "]";
}
}
@@ -5098,7 +5098,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
nSem++;
}
- String aPrefix;
+ OUString aPrefix;
bool LCIDInserted = false;
if ( !bDefaults )
@@ -5124,9 +5124,9 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
if ( rKey[j] == rColorName )
{
- aPrefix += '[';
- aPrefix += String(rKeywords[j]);
- aPrefix += ']';
+ aPrefix += "[";
+ aPrefix += rKeywords[j];
+ aPrefix += "]";
break; // for
}
}
@@ -5135,7 +5135,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
const SvNumberNatNum& rNum = NumFor[n].GetNatNum();
sal_uInt16 nAnz = NumFor[n].GetCount();
- if ( nSem && (nAnz || aPrefix.Len()) )
+ if ( nSem && (nAnz || !aPrefix.isEmpty()) )
{
for ( ; nSem; --nSem )
{
@@ -5147,7 +5147,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
}
- if ( aPrefix.Len() )
+ if ( !aPrefix.isEmpty() )
{
aStr.append( aPrefix );
}
@@ -5161,7 +5161,9 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
aStr.append( rKeywords[pType[j]] );
if( NF_KEY_NNNN == pType[j] )
+ {
aStr.append( rLocWrp.getLongDateDayOfWeekSep() );
+ }
}
else
{
@@ -5235,12 +5237,12 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
for ( ; nSub<4 && bDefault[nSub]; ++nSub )
{ // append empty subformats
- aStr.append( ';' );
+ aStr.append( (sal_Unicode)';' );
}
return aStr.makeStringAndClear();
}
-String SvNumberformat::ImpGetNatNumString( const SvNumberNatNum& rNum,
+OUString SvNumberformat::ImpGetNatNumString( const SvNumberNatNum& rNum,
sal_Int32 nVal, sal_uInt16 nMinDigits ) const
{
OUString aStr;
@@ -5263,16 +5265,18 @@ String SvNumberformat::ImpGetNatNumString( const SvNumberNatNum& rNum,
}
else
{
- String aValStr( rtl::OUString::valueOf( nVal ) );
- if ( aValStr.Len() >= nMinDigits )
+ OUString aValStr( rtl::OUString::valueOf( nVal ) );
+ if ( aValStr.getLength() >= nMinDigits )
{
aStr = aValStr;
}
else
{
- using namespace comphelper::string;
OUStringBuffer aBuf;
- padToLength(aBuf, nMinDigits - aValStr.Len(), '0' );
+ for(sal_Int32 index = 0; index < nMinDigits - aValStr.getLength(); ++index)
+ {
+ aBuf.append((sal_Unicode)'0');
+ }
aBuf.append(aValStr);
aStr = aBuf.makeStringAndClear();
}
@@ -5328,47 +5332,49 @@ void SvNumberformat::GetNatNumXml( com::sun::star::i18n::NativeNumberXmlAttribut
}
// static
-bool SvNumberformat::HasStringNegativeSign( const String& rStr )
+bool SvNumberformat::HasStringNegativeSign( const OUString& rStr )
{
// fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored)
- xub_StrLen nLen = rStr.Len();
+ sal_Int32 nLen = rStr.getLength();
if ( !nLen )
{
return false;
}
- const sal_Unicode* const pBeg = rStr.GetBuffer();
+ const sal_Unicode* const pBeg = rStr.getStr();
const sal_Unicode* const pEnd = pBeg + nLen;
register const sal_Unicode* p = pBeg;
do
{ // Anfang
- if ( *p == '-' )
+ if ( *p == (sal_Unicode)'-' )
{
return true;
}
}
- while ( *p == ' ' && ++p < pEnd );
+ while ( *p == (sal_Unicode)' ' && ++p < pEnd );
+
p = pEnd - 1;
+
do
{ // Ende
- if ( *p == '-' )
+ if ( *p == (sal_Unicode)'-' )
{
return true;
}
}
- while ( *p == ' ' && pBeg < --p );
+ while ( *p == (sal_Unicode)' ' && pBeg < --p );
return false;
}
// static
-bool SvNumberformat::IsInQuote( const String& rStr, xub_StrLen nPos,
+bool SvNumberformat::IsInQuote( const OUString& rStr, sal_Int32 nPos,
sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut )
{
- xub_StrLen nLen = rStr.Len();
+ sal_Int32 nLen = rStr.getLength();
if ( nPos >= nLen )
{
return false;
}
- register const sal_Unicode* p0 = rStr.GetBuffer();
+ register const sal_Unicode* p0 = rStr.getStr();
register const sal_Unicode* p = p0;
register const sal_Unicode* p1 = p0 + nPos;
bool bQuoted = false;