zformat.cxx (86e1cf34) | zformat.cxx (c1e8cc3a) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1610 unchanged lines hidden (view full) --- 1619 sal_Char cStream = NfCurrencyEntry::GetEuroSymbol( eStream ); 1620 if ( aStr.Search( cStream ) == STRING_NOTFOUND ) 1621 { // simple conversion to unicode 1622 rStr = UniString( aStr, eStream ); 1623 } 1624 else 1625 { 1626 sal_Unicode cTarget = NfCurrencyEntry::GetEuroSymbol(); | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1610 unchanged lines hidden (view full) --- 1619 sal_Char cStream = NfCurrencyEntry::GetEuroSymbol( eStream ); 1620 if ( aStr.Search( cStream ) == STRING_NOTFOUND ) 1621 { // simple conversion to unicode 1622 rStr = UniString( aStr, eStream ); 1623 } 1624 else 1625 { 1626 sal_Unicode cTarget = NfCurrencyEntry::GetEuroSymbol(); |
1627 register const sal_Char* p = aStr.GetBuffer(); 1628 register const sal_Char* const pEnd = p + aStr.Len(); 1629 register sal_Unicode* pUni = rStr.AllocBuffer( aStr.Len() ); | 1627 const sal_Char* p = aStr.GetBuffer(); 1628 const sal_Char* const pEnd = p + aStr.Len(); 1629 sal_Unicode* pUni = rStr.AllocBuffer( aStr.Len() ); |
1630 while ( p < pEnd ) 1631 { 1632 if ( *p == cStream ) 1633 *pUni = cTarget; 1634 else 1635 *pUni = ByteString::ConvertToUnicode( *p, eStream ); 1636 p++; 1637 pUni++; --- 1872 unchanged lines hidden (view full) --- 3510 { 3511 sStr = ::rtl::math::doubleToUString( fNumber, 3512 rtl_math_StringFormat_F, 0, '.'); 3513 sStr.EraseLeadingChars('0'); // fuehrende Nullen weg 3514 } 3515 xub_StrLen nPoint = sStr.Search( '.' ); 3516 if ( nPoint != STRING_NOTFOUND ) 3517 { | 1630 while ( p < pEnd ) 1631 { 1632 if ( *p == cStream ) 1633 *pUni = cTarget; 1634 else 1635 *pUni = ByteString::ConvertToUnicode( *p, eStream ); 1636 p++; 1637 pUni++; --- 1872 unchanged lines hidden (view full) --- 3510 { 3511 sStr = ::rtl::math::doubleToUString( fNumber, 3512 rtl_math_StringFormat_F, 0, '.'); 3513 sStr.EraseLeadingChars('0'); // fuehrende Nullen weg 3514 } 3515 xub_StrLen nPoint = sStr.Search( '.' ); 3516 if ( nPoint != STRING_NOTFOUND ) 3517 { |
3518 register const sal_Unicode* p = sStr.GetBuffer() + nPoint; | 3518 const sal_Unicode* p = sStr.GetBuffer() + nPoint; |
3519 while ( *++p == '0' ) 3520 ; 3521 if ( !*p ) 3522 bInteger = sal_True; 3523 sStr.Erase( nPoint, 1 ); // . herausnehmen 3524 } 3525 if (bSign && 3526 (sStr.Len() == 0 || sStr.GetTokenCount('0') == sStr.Len()+1)) // nur 00000 --- 34 unchanged lines hidden (view full) --- 3561 case NF_SYMBOLTYPE_THSEP: 3562 if (rInfo.nThousand == 0) 3563 sStr.Insert(rInfo.sStrArray[j],k); 3564 break; 3565 case NF_SYMBOLTYPE_DIGIT: 3566 { 3567 const String& rStr = rInfo.sStrArray[j]; 3568 const sal_Unicode* p1 = rStr.GetBuffer(); | 3519 while ( *++p == '0' ) 3520 ; 3521 if ( !*p ) 3522 bInteger = sal_True; 3523 sStr.Erase( nPoint, 1 ); // . herausnehmen 3524 } 3525 if (bSign && 3526 (sStr.Len() == 0 || sStr.GetTokenCount('0') == sStr.Len()+1)) // nur 00000 --- 34 unchanged lines hidden (view full) --- 3561 case NF_SYMBOLTYPE_THSEP: 3562 if (rInfo.nThousand == 0) 3563 sStr.Insert(rInfo.sStrArray[j],k); 3564 break; 3565 case NF_SYMBOLTYPE_DIGIT: 3566 { 3567 const String& rStr = rInfo.sStrArray[j]; 3568 const sal_Unicode* p1 = rStr.GetBuffer(); |
3569 register const sal_Unicode* p = p1 + rStr.Len(); | 3569 const sal_Unicode* p = p1 + rStr.Len(); |
3570 while ( p1 < p-- ) 3571 { 3572 const sal_Unicode c = *p; 3573 k--; 3574 if ( sStr.GetChar(k) != '0' ) 3575 bTrailing = sal_False; 3576 if (bTrailing) 3577 { --- 152 unchanged lines hidden (view full) --- 3730 aGrouping.advance(); 3731 } 3732 } 3733 break; 3734 case NF_SYMBOLTYPE_DIGIT: 3735 { 3736 const String& rStr = rInfo.sStrArray[j]; 3737 const sal_Unicode* p1 = rStr.GetBuffer(); | 3570 while ( p1 < p-- ) 3571 { 3572 const sal_Unicode c = *p; 3573 k--; 3574 if ( sStr.GetChar(k) != '0' ) 3575 bTrailing = sal_False; 3576 if (bTrailing) 3577 { --- 152 unchanged lines hidden (view full) --- 3730 aGrouping.advance(); 3731 } 3732 } 3733 break; 3734 case NF_SYMBOLTYPE_DIGIT: 3735 { 3736 const String& rStr = rInfo.sStrArray[j]; 3737 const sal_Unicode* p1 = rStr.GetBuffer(); |
3738 register const sal_Unicode* p = p1 + rStr.Len(); | 3738 const sal_Unicode* p = p1 + rStr.Len(); |
3739 while ( p1 < p-- ) 3740 { 3741 nDigitCount++; 3742 if (k > 0) 3743 k--; 3744 else 3745 { 3746 switch (*p) --- 106 unchanged lines hidden (view full) --- 3853 sStr.Insert(rInfo.sStrArray[j],k); 3854 } 3855 } 3856 break; 3857 case NF_SYMBOLTYPE_DIGIT: 3858 { 3859 const String& rStr = rInfo.sStrArray[j]; 3860 const sal_Unicode* p1 = rStr.GetBuffer(); | 3739 while ( p1 < p-- ) 3740 { 3741 nDigitCount++; 3742 if (k > 0) 3743 k--; 3744 else 3745 { 3746 switch (*p) --- 106 unchanged lines hidden (view full) --- 3853 sStr.Insert(rInfo.sStrArray[j],k); 3854 } 3855 } 3856 break; 3857 case NF_SYMBOLTYPE_DIGIT: 3858 { 3859 const String& rStr = rInfo.sStrArray[j]; 3860 const sal_Unicode* p1 = rStr.GetBuffer(); |
3861 register const sal_Unicode* p = p1 + rStr.Len(); | 3861 const sal_Unicode* p = p1 + rStr.Len(); |
3862 while ( p1 < p-- ) 3863 { 3864 if (k > 0) 3865 k--; 3866 else 3867 { 3868 switch (*p) 3869 { --- 70 unchanged lines hidden (view full) --- 3940 sal_Bool bStop = sal_False; 3941 sal_uInt16 i = 0; 3942 const sal_uInt16 nAnz = NumFor[nNumFor].GetnAnz(); 3943 while (!bStop && i < nAnz) 3944 { 3945 short nType = rInfo.nTypeArray[i]; 3946 if ( nType == NF_SYMBOLTYPE_DIGIT) 3947 { | 3862 while ( p1 < p-- ) 3863 { 3864 if (k > 0) 3865 k--; 3866 else 3867 { 3868 switch (*p) 3869 { --- 70 unchanged lines hidden (view full) --- 3940 sal_Bool bStop = sal_False; 3941 sal_uInt16 i = 0; 3942 const sal_uInt16 nAnz = NumFor[nNumFor].GetnAnz(); 3943 while (!bStop && i < nAnz) 3944 { 3945 short nType = rInfo.nTypeArray[i]; 3946 if ( nType == NF_SYMBOLTYPE_DIGIT) 3947 { |
3948 register const sal_Unicode* p = rInfo.sStrArray[i].GetBuffer(); | 3948 const sal_Unicode* p = rInfo.sStrArray[i].GetBuffer(); |
3949 while ( *p == '#' ) 3950 p++; 3951 while ( *p++ == '0' ) 3952 nAnzLeading++; 3953 } 3954 else if (nType == NF_SYMBOLTYPE_DECSEP || nType == NF_SYMBOLTYPE_EXP) 3955 bStop = sal_True; 3956 i++; --- 467 unchanged lines hidden (view full) --- 4424sal_Bool SvNumberformat::HasStringNegativeSign( const String& rStr ) 4425{ 4426 // fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored) 4427 xub_StrLen nLen = rStr.Len(); 4428 if ( !nLen ) 4429 return sal_False; 4430 const sal_Unicode* const pBeg = rStr.GetBuffer(); 4431 const sal_Unicode* const pEnd = pBeg + nLen; | 3949 while ( *p == '#' ) 3950 p++; 3951 while ( *p++ == '0' ) 3952 nAnzLeading++; 3953 } 3954 else if (nType == NF_SYMBOLTYPE_DECSEP || nType == NF_SYMBOLTYPE_EXP) 3955 bStop = sal_True; 3956 i++; --- 467 unchanged lines hidden (view full) --- 4424sal_Bool SvNumberformat::HasStringNegativeSign( const String& rStr ) 4425{ 4426 // fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored) 4427 xub_StrLen nLen = rStr.Len(); 4428 if ( !nLen ) 4429 return sal_False; 4430 const sal_Unicode* const pBeg = rStr.GetBuffer(); 4431 const sal_Unicode* const pEnd = pBeg + nLen; |
4432 register const sal_Unicode* p = pBeg; | 4432 const sal_Unicode* p = pBeg; |
4433 do 4434 { // Anfang 4435 if ( *p == '-' ) 4436 return sal_True; 4437 } while ( *p == ' ' && ++p < pEnd ); 4438 p = pEnd - 1; 4439 do 4440 { // Ende --- 55 unchanged lines hidden (view full) --- 4496 if ( nLen && rStr.GetChar( nLen-1 ) == ' ' ) 4497 rStr.Erase( --nLen, 1 ); 4498} 4499 4500 4501// static 4502void SvNumberformat::EraseComment( String& rStr ) 4503{ | 4433 do 4434 { // Anfang 4435 if ( *p == '-' ) 4436 return sal_True; 4437 } while ( *p == ' ' && ++p < pEnd ); 4438 p = pEnd - 1; 4439 do 4440 { // Ende --- 55 unchanged lines hidden (view full) --- 4496 if ( nLen && rStr.GetChar( nLen-1 ) == ' ' ) 4497 rStr.Erase( --nLen, 1 ); 4498} 4499 4500 4501// static 4502void SvNumberformat::EraseComment( String& rStr ) 4503{ |
4504 register const sal_Unicode* p = rStr.GetBuffer(); | 4504 const sal_Unicode* p = rStr.GetBuffer(); |
4505 sal_Bool bInString = sal_False; 4506 sal_Bool bEscaped = sal_False; 4507 sal_Bool bFound = sal_False; 4508 xub_StrLen nPos = 0; 4509 while ( !bFound && *p ) 4510 { 4511 switch ( *p ) 4512 { --- 24 unchanged lines hidden (view full) --- 4537 4538// static 4539sal_Bool SvNumberformat::IsInQuote( const String& rStr, xub_StrLen nPos, 4540 sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut ) 4541{ 4542 xub_StrLen nLen = rStr.Len(); 4543 if ( nPos >= nLen ) 4544 return sal_False; | 4505 sal_Bool bInString = sal_False; 4506 sal_Bool bEscaped = sal_False; 4507 sal_Bool bFound = sal_False; 4508 xub_StrLen nPos = 0; 4509 while ( !bFound && *p ) 4510 { 4511 switch ( *p ) 4512 { --- 24 unchanged lines hidden (view full) --- 4537 4538// static 4539sal_Bool SvNumberformat::IsInQuote( const String& rStr, xub_StrLen nPos, 4540 sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut ) 4541{ 4542 xub_StrLen nLen = rStr.Len(); 4543 if ( nPos >= nLen ) 4544 return sal_False; |
4545 register const sal_Unicode* p0 = rStr.GetBuffer(); 4546 register const sal_Unicode* p = p0; 4547 register const sal_Unicode* p1 = p0 + nPos; | 4545 const sal_Unicode* p0 = rStr.GetBuffer(); 4546 const sal_Unicode* p = p0; 4547 const sal_Unicode* p1 = p0 + nPos; |
4548 sal_Bool bQuoted = sal_False; 4549 while ( p <= p1 ) 4550 { 4551 if ( *p == cQuote ) 4552 { 4553 if ( p == p0 ) 4554 bQuoted = sal_True; 4555 else if ( bQuoted ) --- 21 unchanged lines hidden (view full) --- 4577 if ( nPos >= nLen ) 4578 return STRING_NOTFOUND; 4579 if ( !IsInQuote( rStr, nPos, cQuote, cEscIn, cEscOut ) ) 4580 { 4581 if ( rStr.GetChar( nPos ) == cQuote ) 4582 return nPos; // schliessendes cQuote 4583 return STRING_NOTFOUND; 4584 } | 4548 sal_Bool bQuoted = sal_False; 4549 while ( p <= p1 ) 4550 { 4551 if ( *p == cQuote ) 4552 { 4553 if ( p == p0 ) 4554 bQuoted = sal_True; 4555 else if ( bQuoted ) --- 21 unchanged lines hidden (view full) --- 4577 if ( nPos >= nLen ) 4578 return STRING_NOTFOUND; 4579 if ( !IsInQuote( rStr, nPos, cQuote, cEscIn, cEscOut ) ) 4580 { 4581 if ( rStr.GetChar( nPos ) == cQuote ) 4582 return nPos; // schliessendes cQuote 4583 return STRING_NOTFOUND; 4584 } |
4585 register const sal_Unicode* p0 = rStr.GetBuffer(); 4586 register const sal_Unicode* p = p0 + nPos; 4587 register const sal_Unicode* p1 = p0 + nLen; | 4585 const sal_Unicode* p0 = rStr.GetBuffer(); 4586 const sal_Unicode* p = p0 + nPos; 4587 const sal_Unicode* p1 = p0 + nLen; |
4588 while ( p < p1 ) 4589 { 4590 if ( *p == cQuote && p > p0 && *(p-1) != cEscIn ) 4591 return sal::static_int_cast< xub_StrLen >(p - p0); 4592 p++; 4593 } 4594 return nLen; // String Ende 4595} --- 24 unchanged lines hidden --- | 4588 while ( p < p1 ) 4589 { 4590 if ( *p == cQuote && p > p0 && *(p-1) != cEscIn ) 4591 return sal::static_int_cast< xub_StrLen >(p - p0); 4592 p++; 4593 } 4594 return nLen; // String Ende 4595} --- 24 unchanged lines hidden --- |