UniString->rtl::OUStringBuffer
Change-Id: I9938d7c4ab5594baeb10f405f0aa0964ef84d6c5
This commit is contained in:
@@ -19,7 +19,9 @@
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <comphelper/string.hxx>
|
||||
#include <rtl/math.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <basic/sbuno.hxx>
|
||||
#include "runtime.hxx"
|
||||
#include "sbintern.hxx"
|
||||
@@ -147,10 +149,16 @@ void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
|
||||
{
|
||||
SbxVariable* p = GetTOS();
|
||||
String& s = (String&)(const String&) *p;
|
||||
if( s.Len() > nOp1 )
|
||||
s.Erase( static_cast<xub_StrLen>( nOp1 ) );
|
||||
else
|
||||
s.Expand( static_cast<xub_StrLen>( nOp1 ), ' ' );
|
||||
if (s.Len() != nOp1)
|
||||
{
|
||||
rtl::OUStringBuffer aBuf(s);
|
||||
sal_Int32 nLen(nOp1);
|
||||
if (aBuf.getLength() > nLen)
|
||||
comphelper::string::truncateToLength(aBuf, nLen);
|
||||
else
|
||||
comphelper::string::padToLength(aBuf, nLen, ' ');
|
||||
s = aBuf.makeStringAndClear();
|
||||
}
|
||||
}
|
||||
|
||||
// jump (+target)
|
||||
|
@@ -632,9 +632,9 @@ public:
|
||||
@param cSep The character to separate the tokens.
|
||||
@param nSepCount Specifies how often cSep is inserted between two tokens.
|
||||
@param bForceSep true = Always insert separator; false = Only, if not at begin or end. */
|
||||
SC_DLLPUBLIC static void AddToken(
|
||||
String& rTokenList, const String& rToken,
|
||||
sal_Unicode cSep, xub_StrLen nSepCount = 1,
|
||||
SC_DLLPUBLIC static OUString addToken(
|
||||
const OUString& rTokenList, const OUString& rToken,
|
||||
sal_Unicode cSep, sal_Int32 nSepCount = 1,
|
||||
bool bForceSep = false );
|
||||
|
||||
/** Returns true, if the first and last character of the string is cQuote. */
|
||||
|
@@ -56,6 +56,7 @@
|
||||
#include <i18npool/mslangid.hxx>
|
||||
#include <com/sun/star/lang/Locale.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/string.hxx>
|
||||
#include <unotools/calendarwrapper.hxx>
|
||||
#include <unotools/collatorwrapper.hxx>
|
||||
#include <com/sun/star/i18n/CollatorOptions.hpp>
|
||||
@@ -806,11 +807,14 @@ const sal_Unicode* ScGlobal::UnicodeStrChr( const sal_Unicode* pStr,
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ScGlobal::AddToken( String& rTokenList, const String& rToken, sal_Unicode cSep, xub_StrLen nSepCount, bool bForceSep )
|
||||
OUString ScGlobal::addToken(const OUString& rTokenList, const OUString& rToken,
|
||||
sal_Unicode cSep, sal_Int32 nSepCount, bool bForceSep)
|
||||
{
|
||||
if( bForceSep || (rToken.Len() && rTokenList.Len()) )
|
||||
rTokenList.Expand( rTokenList.Len() + nSepCount, cSep );
|
||||
rTokenList.Append( rToken );
|
||||
rtl::OUStringBuffer aBuf(rTokenList);
|
||||
if( bForceSep || (!rToken.isEmpty() && !rTokenList.isEmpty()) )
|
||||
comphelper::string::padToLength(aBuf, aBuf.getLength() + nSepCount, cSep);
|
||||
aBuf.append(rToken);
|
||||
return aBuf.makeStringAndClear();
|
||||
}
|
||||
|
||||
bool ScGlobal::IsQuoted( const String& rString, sal_Unicode cQuote )
|
||||
|
@@ -26,6 +26,7 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include <comphelper/string.hxx>
|
||||
#include <sfx2/linkmgr.hxx>
|
||||
#include <sfx2/dispatch.hxx>
|
||||
#include <sfx2/objsh.hxx>
|
||||
@@ -2602,7 +2603,14 @@ void ScInterpreter::ScRoman()
|
||||
{
|
||||
if( nDigit > 4 )
|
||||
aRoman += pChars[ nIndex - 1 ];
|
||||
aRoman.Expand( aRoman.Len() + (nDigit % 5), pChars[ nIndex ] );
|
||||
sal_Int32 nPad = nDigit % 5;
|
||||
if (nPad)
|
||||
{
|
||||
rtl::OUStringBuffer aBuf(aRoman);
|
||||
comphelper::string::padToLength(aBuf, aBuf.getLength() + nPad,
|
||||
pChars[nIndex]);
|
||||
aRoman = aBuf.makeStringAndClear();
|
||||
}
|
||||
nVal %= pValues[ nIndex ];
|
||||
}
|
||||
}
|
||||
|
@@ -1600,7 +1600,7 @@ XclExpWebQuery::XclExpWebQuery(
|
||||
mbEntireDoc = ScfTools::IsHTMLDocName( aToken );
|
||||
bExitLoop = mbEntireDoc || ScfTools::IsHTMLTablesName( aToken );
|
||||
if( !bExitLoop && ScfTools::GetHTMLNameFromName( aToken, aAppendTable ) )
|
||||
ScGlobal::AddToken( aNewTables, aAppendTable, ',' );
|
||||
aNewTables = ScGlobal::addToken( aNewTables, aAppendTable, ',' );
|
||||
}
|
||||
|
||||
if( !bExitLoop ) // neither HTML_all nor HTML_tables found
|
||||
|
@@ -1225,7 +1225,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
|
||||
mpNoteContents = XclExpStringHelper::CreateString( rRoot, *pEditObj );
|
||||
}
|
||||
// append additional text
|
||||
ScGlobal::AddToken( aNoteText, rAddText, '\n', 2 );
|
||||
aNoteText = ScGlobal::addToken( aNoteText, rAddText, '\n', 2 );
|
||||
maOrigNoteText = aNoteText;
|
||||
|
||||
// initialize record dependent on BIFF type
|
||||
|
@@ -320,7 +320,7 @@ rtl::OUString XclExpHyperlinkHelper::ProcessUrlField( const SvxURLField& rUrlFie
|
||||
aUrlRepr = *pRepr;
|
||||
|
||||
// add URL to note text
|
||||
ScGlobal::AddToken( maUrlList, rUrlField.GetURL(), '\n' );
|
||||
maUrlList = ScGlobal::addToken( maUrlList, rUrlField.GetURL(), '\n' );
|
||||
}
|
||||
|
||||
// no hyperlink representation from Excel HLINK record -> use it from text field
|
||||
@@ -879,7 +879,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico
|
||||
aSel.nStartPos = aSel.nEndPos;
|
||||
}
|
||||
|
||||
ScGlobal::AddToken( aText, aParaText, '\n' );
|
||||
aText = ScGlobal::addToken( aText, aParaText, '\n' );
|
||||
if( nParaHeight == 0 )
|
||||
nParaHeight = aFontData.mnHeight * 20; // points -> twips
|
||||
nHeight += nParaHeight;
|
||||
|
@@ -2329,7 +2329,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
|
||||
mxHyperlinkList->AppendRecord( aLinkHelper.GetLinkRecord() );
|
||||
// add list of multiple URLs to the additional cell note text
|
||||
if( aLinkHelper.HasMultipleUrls() )
|
||||
ScGlobal::AddToken( aAddNoteText, aLinkHelper.GetUrlList(), '\n', 2 );
|
||||
aAddNoteText = ScGlobal::addToken( aAddNoteText, aLinkHelper.GetUrlList(), '\n', 2 );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -947,12 +947,12 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm )
|
||||
String aToken( ScStringUtil::GetQuotedToken( aTables, 0, aQuotedPairs, ',', nStringIx ) );
|
||||
sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.ToInt32() : 0;
|
||||
if( nTabNum > 0 )
|
||||
ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep );
|
||||
maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep );
|
||||
else
|
||||
{
|
||||
ScGlobal::EraseQuotes( aToken, '"', false );
|
||||
if( aToken.Len() )
|
||||
ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLName( aToken ), cSep );
|
||||
maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLName( aToken ), cSep );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -238,7 +238,7 @@ String ScHTMLImport::GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrig
|
||||
ScRange aRange;
|
||||
if( pRangeData->IsReference( aRange ) && !aRangeList.In( aRange ) )
|
||||
{
|
||||
ScGlobal::AddToken( aNewName, aToken, ';' );
|
||||
aNewName = ScGlobal::addToken(aNewName, aToken, ';');
|
||||
aRangeList.Append( aRange );
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ String ScHTMLImport::GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrig
|
||||
}
|
||||
}
|
||||
else
|
||||
ScGlobal::AddToken( aNewName, aToken, ';' );
|
||||
aNewName = ScGlobal::addToken(aNewName, aToken, ';');
|
||||
}
|
||||
return aNewName;
|
||||
}
|
||||
|
@@ -3082,7 +3082,7 @@ void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo )
|
||||
{
|
||||
// font list separator: VCL = ';' HTML = ','
|
||||
String aFName = comphelper::string::strip(rFace.GetToken(0, ',', nPos), ' ');
|
||||
ScGlobal::AddToken( aFontName, aFName, ';' );
|
||||
aFontName = ScGlobal::addToken(aFontName, aFName, ';');
|
||||
}
|
||||
if ( aFontName.Len() )
|
||||
mpCurrTable->PutItem( SvxFontItem( FAMILY_DONTKNOW,
|
||||
|
@@ -269,7 +269,7 @@ void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, s
|
||||
{
|
||||
String aToken( rStringList.GetToken( 0, '\n', nStringIx ) );
|
||||
ScGlobal::AddQuotes( aToken, '"' );
|
||||
ScGlobal::AddToken( rFmlaStr, aToken, cFmlaSep );
|
||||
rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep);
|
||||
}
|
||||
if( !rFmlaStr.Len() )
|
||||
rFmlaStr.AssignAscii( "\"\"" );
|
||||
@@ -300,7 +300,7 @@ bool lclGetStringListFromFormula( String& rStringList, const String& rFmlaStr, s
|
||||
if( bIsStringList )
|
||||
{
|
||||
ScGlobal::EraseQuotes( aToken, '"' );
|
||||
ScGlobal::AddToken( rStringList, aToken, '\n', 1, bTokenAdded );
|
||||
rStringList = ScGlobal::addToken(rStringList, aToken, '\n', 1, bTokenAdded);
|
||||
bTokenAdded = true;
|
||||
}
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <hintids.hxx>
|
||||
#include <com/sun/star/accessibility/XAccessible.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/string.hxx>
|
||||
#include <com/sun/star/i18n/XBreakIterator.hpp>
|
||||
#include <com/sun/star/i18n/ScriptType.hpp>
|
||||
#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
|
||||
@@ -2386,7 +2387,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
|
||||
{
|
||||
// insert a blank ahead of the character. this ends up
|
||||
// between the expanded text and the new "non-word-seperator".
|
||||
aInBuffer.Expand( aInBuffer.Len() + 1, ' ' );
|
||||
aInBuffer += ' ';
|
||||
}
|
||||
|
||||
sal_Bool bIsAutoCorrectChar = SvxAutoCorrect::IsAutoCorrectChar( aCh );
|
||||
@@ -2417,7 +2418,10 @@ KEYINPUT_CHECKTABLE_INSDEL:
|
||||
}
|
||||
else
|
||||
{
|
||||
aInBuffer.Expand( aInBuffer.Len() + aKeyEvent.GetRepeat() + 1,aCh );
|
||||
rtl::OUStringBuffer aBuf(aInBuffer);
|
||||
comphelper::string::padToLength(aBuf,
|
||||
aInBuffer.Len() + aKeyEvent.GetRepeat() + 1, aCh);
|
||||
aInBuffer = aBuf.makeStringAndClear();
|
||||
bFlushCharBuffer = Application::AnyInput( VCL_INPUT_KEYBOARD );
|
||||
bFlushBuffer = !bFlushCharBuffer;
|
||||
if( bFlushCharBuffer )
|
||||
|
@@ -131,7 +131,7 @@ private:
|
||||
sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS );
|
||||
TOOLS_DLLPRIVATE UniString( const sal_Unicode* pCharStr );
|
||||
TOOLS_DLLPRIVATE UniString( const sal_Unicode* pCharStr, xub_StrLen nLen );
|
||||
|
||||
TOOLS_DLLPRIVATE UniString& Expand( xub_StrLen nCount, sal_Unicode cExpandChar );
|
||||
public:
|
||||
UniString();
|
||||
UniString( const ResId& rResId );
|
||||
@@ -216,7 +216,6 @@ public:
|
||||
UniString Copy( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ) const;
|
||||
|
||||
UniString& Fill( xub_StrLen nCount, sal_Unicode cFillChar = ' ' );
|
||||
UniString& Expand( xub_StrLen nCount, sal_Unicode cExpandChar = ' ' );
|
||||
|
||||
UniString& ToLowerAscii();
|
||||
UniString& ToUpperAscii();
|
||||
|
@@ -267,35 +267,6 @@ STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar )
|
||||
return *this;
|
||||
}
|
||||
|
||||
STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar )
|
||||
{
|
||||
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
|
||||
|
||||
// return if string doesn't need expanding
|
||||
sal_Int32 nLen = mpData->mnLen;
|
||||
if ( nCount <= nLen )
|
||||
return *this;
|
||||
|
||||
// allocate string of new size
|
||||
STRINGDATA* pNewData = ImplAllocData( nCount );
|
||||
|
||||
// copy from old string
|
||||
memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
|
||||
|
||||
// and expand using the given character
|
||||
STRCODE* pStr = pNewData->maStr;
|
||||
pStr += nLen;
|
||||
for (sal_Int32 i = nCount - nLen; i > 0; --i) {
|
||||
*pStr++ = cExpandChar;
|
||||
}
|
||||
|
||||
// free old string
|
||||
STRING_RELEASE((STRING_TYPE *)mpData);
|
||||
mpData = pNewData;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
STRCODE* STRING::GetBufferAccess()
|
||||
{
|
||||
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
|
||||
|
@@ -103,10 +103,9 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
|
||||
{
|
||||
XubString aStr = rStr;
|
||||
XubString aStr1;
|
||||
XubString aStr2;
|
||||
rtl::OUStringBuffer aStr2;
|
||||
sal_Bool bNegative = sal_False;
|
||||
xub_StrLen nDecPos;
|
||||
xub_StrLen i;
|
||||
|
||||
// react on empty string
|
||||
if ( !rStr.Len() )
|
||||
@@ -120,7 +119,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
|
||||
if ( nDecPos != STRING_NOTFOUND )
|
||||
{
|
||||
aStr1 = aStr.Copy( 0, nDecPos );
|
||||
aStr2 = aStr.Copy( nDecPos+1 );
|
||||
aStr2.append(aStr.Copy(nDecPos+1));
|
||||
}
|
||||
else
|
||||
aStr1 = aStr;
|
||||
@@ -132,7 +131,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
|
||||
bNegative = sal_True;
|
||||
if ( !bNegative )
|
||||
{
|
||||
for ( i=0; i < aStr.Len(); i++ )
|
||||
for (xub_StrLen i=0; i < aStr.Len(); i++ )
|
||||
{
|
||||
if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
|
||||
break;
|
||||
@@ -149,7 +148,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
|
||||
if ( (nFormat == 3) || (nFormat == 6) ||
|
||||
(nFormat == 7) || (nFormat == 10) )
|
||||
{
|
||||
for ( i = (xub_StrLen)(aStr.Len()-1); i > 0; i++ )
|
||||
for (xub_StrLen i = (xub_StrLen)(aStr.Len()-1); i > 0; i++ )
|
||||
{
|
||||
if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
|
||||
break;
|
||||
@@ -169,22 +168,22 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
|
||||
}
|
||||
|
||||
// remove all unwanted charaters
|
||||
for ( i=0; i < aStr1.Len(); )
|
||||
for (xub_StrLen i=0; i < aStr1.Len(); )
|
||||
{
|
||||
if ( (aStr1.GetChar( i ) >= '0') && (aStr1.GetChar( i ) <= '9') )
|
||||
i++;
|
||||
else
|
||||
aStr1.Erase( i, 1 );
|
||||
}
|
||||
for ( i=0; i < aStr2.Len(); )
|
||||
for (sal_Int32 i=0; i < aStr2.getLength(); )
|
||||
{
|
||||
if ( (aStr2.GetChar( i ) >= '0') && (aStr2.GetChar( i ) <= '9') )
|
||||
i++;
|
||||
if ((aStr2[i] >= '0') && (aStr2[i] <= '9'))
|
||||
++i;
|
||||
else
|
||||
aStr2.Erase( i, 1 );
|
||||
aStr2.remove(i, 1);
|
||||
}
|
||||
|
||||
if ( !aStr1.Len() && !aStr2.Len() )
|
||||
if ( !aStr1.Len() && !aStr2.getLength() )
|
||||
return sal_False;
|
||||
|
||||
if ( !aStr1.Len() )
|
||||
@@ -193,22 +192,22 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
|
||||
aStr1.Insert( '-', 0 );
|
||||
|
||||
// prune and round fraction
|
||||
sal_Bool bRound = sal_False;
|
||||
if ( aStr2.Len() > nDecDigits )
|
||||
bool bRound = false;
|
||||
if (aStr2.getLength() > nDecDigits)
|
||||
{
|
||||
if ( aStr2.GetChar( nDecDigits ) >= '5' )
|
||||
bRound = sal_True;
|
||||
aStr2.Erase( nDecDigits );
|
||||
if (aStr2[nDecDigits] >= '5')
|
||||
bRound = true;
|
||||
string::truncateToLength(aStr2, nDecDigits);
|
||||
}
|
||||
if ( aStr2.Len() < nDecDigits )
|
||||
aStr2.Expand( nDecDigits, '0' );
|
||||
if (aStr2.getLength() < nDecDigits)
|
||||
string::padToLength(aStr2, nDecDigits, '0');
|
||||
|
||||
aStr = aStr1;
|
||||
aStr += aStr2;
|
||||
aStr += aStr2.makeStringAndClear();
|
||||
|
||||
// check range
|
||||
double nValue = rtl::OUString(aStr).toDouble();
|
||||
if ( bRound )
|
||||
if (bRound)
|
||||
{
|
||||
if ( !bNegative )
|
||||
nValue++;
|
||||
@@ -950,12 +949,12 @@ namespace
|
||||
sal_Int32 nTextLen;
|
||||
|
||||
nTextLen = rtl::OUString::valueOf(rFormatter.GetMin()).getLength();
|
||||
comphelper::string::padToLength(aBuf, nTextLen, '9');
|
||||
string::padToLength(aBuf, nTextLen, '9');
|
||||
Size aMinTextSize = rSpinField.CalcMinimumSizeForText(
|
||||
rFormatter.CreateFieldText(aBuf.makeStringAndClear().toInt64()));
|
||||
|
||||
nTextLen = rtl::OUString::valueOf(rFormatter.GetMax()).getLength();
|
||||
comphelper::string::padToLength(aBuf, nTextLen, '9');
|
||||
string::padToLength(aBuf, nTextLen, '9');
|
||||
Size aMaxTextSize = rSpinField.CalcMinimumSizeForText(
|
||||
rFormatter.CreateFieldText(aBuf.makeStringAndClear().toInt64()));
|
||||
|
||||
@@ -967,7 +966,7 @@ namespace
|
||||
if (nDigits)
|
||||
{
|
||||
sBuf.append('.');
|
||||
comphelper::string::padToLength(aBuf, aBuf.getLength() + nDigits, '9');
|
||||
string::padToLength(aBuf, aBuf.getLength() + nDigits, '9');
|
||||
}
|
||||
aMaxTextSize = rSpinField.CalcMinimumSizeForText(sBuf.makeStringAndClear());
|
||||
aRet.Width() = std::min(aRet.Width(), aMaxTextSize.Width());
|
||||
|
@@ -142,10 +142,9 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
|
||||
{
|
||||
XubString aStr = rStr;
|
||||
XubString aStr1;
|
||||
XubString aStr2;
|
||||
rtl::OUStringBuffer aStr2;
|
||||
sal_uInt16 nDecPos;
|
||||
sal_Bool bNegative = sal_False;
|
||||
xub_StrLen i;
|
||||
|
||||
// Reaktion auf leeren String
|
||||
if ( !rStr.Len() )
|
||||
@@ -160,7 +159,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
|
||||
if ( nDecPos != STRING_NOTFOUND )
|
||||
{
|
||||
aStr1 = aStr.Copy( 0, nDecPos );
|
||||
aStr2 = aStr.Copy( nDecPos+1 );
|
||||
aStr2.append(aStr.Copy(nDecPos+1));
|
||||
}
|
||||
else
|
||||
aStr1 = aStr;
|
||||
@@ -172,7 +171,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
|
||||
bNegative = sal_True;
|
||||
if ( !bNegative )
|
||||
{
|
||||
for ( i=0; i < aStr.Len(); i++ )
|
||||
for (xub_StrLen i=0; i < aStr.Len(); i++ )
|
||||
{
|
||||
if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
|
||||
break;
|
||||
@@ -189,7 +188,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
|
||||
if ( (nFormat == 3) || (nFormat == 6) ||
|
||||
(nFormat == 7) || (nFormat == 10) )
|
||||
{
|
||||
for ( i = (sal_uInt16)(aStr.Len()-1); i > 0; i++ )
|
||||
for (xub_StrLen i = (sal_uInt16)(aStr.Len()-1); i > 0; i++ )
|
||||
{
|
||||
if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
|
||||
break;
|
||||
@@ -209,22 +208,22 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
|
||||
}
|
||||
|
||||
// Alle unerwuenschten Zeichen rauswerfen
|
||||
for ( i=0; i < aStr1.Len(); )
|
||||
for (xub_StrLen i=0; i < aStr1.Len(); )
|
||||
{
|
||||
if ( (aStr1.GetChar( i ) >= '0') && (aStr1.GetChar( i ) <= '9') )
|
||||
i++;
|
||||
else
|
||||
aStr1.Erase( i, 1 );
|
||||
}
|
||||
for ( i=0; i < aStr2.Len(); )
|
||||
for (sal_Int32 i=0; i < aStr2.getLength();)
|
||||
{
|
||||
if ( (aStr2.GetChar( i ) >= '0') && (aStr2.GetChar( i ) <= '9') )
|
||||
i++;
|
||||
if ((aStr2[i] >= '0') && (aStr2[i] <= '9'))
|
||||
++i;
|
||||
else
|
||||
aStr2.Erase( i, 1 );
|
||||
aStr2.remove(i, 1);
|
||||
}
|
||||
|
||||
if ( !aStr1.Len() && !aStr2.Len() )
|
||||
if (!aStr1.Len() && !aStr2.getLength())
|
||||
return sal_False;
|
||||
|
||||
if ( !aStr1.Len() )
|
||||
@@ -233,18 +232,18 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
|
||||
aStr1.Insert( '-', 0 );
|
||||
|
||||
// Nachkommateil zurechtstutzen und dabei runden
|
||||
sal_Bool bRound = sal_False;
|
||||
if ( aStr2.Len() > nDecDigits )
|
||||
bool bRound = false;
|
||||
if (aStr2.getLength() > nDecDigits)
|
||||
{
|
||||
if ( aStr2.GetChar( nDecDigits ) >= '5' )
|
||||
bRound = sal_True;
|
||||
aStr2.Erase( nDecDigits );
|
||||
if (aStr2[nDecDigits] >= '5')
|
||||
bRound = true;
|
||||
string::truncateToLength(aStr2, nDecDigits);
|
||||
}
|
||||
if ( aStr2.Len() < nDecDigits )
|
||||
aStr2.Expand( nDecDigits, '0' );
|
||||
if (aStr2.getLength() < nDecDigits)
|
||||
string::padToLength(aStr2, nDecDigits, '0');
|
||||
|
||||
aStr = aStr1;
|
||||
aStr += aStr2;
|
||||
aStr += aStr2.makeStringAndClear();
|
||||
|
||||
// Bereichsueberpruefung
|
||||
BigInt nValue( aStr );
|
||||
|
Reference in New Issue
Block a user