This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new 29d7882dfd Use UTF-8 encoding, cleanup
29d7882dfd is described below
commit 29d7882dfd44bedddaf81c3b4e2999e0ea40948d
Author: mseidel <[email protected]>
AuthorDate: Sun Feb 16 22:56:35 2025 +0100
Use UTF-8 encoding, cleanup
---
main/basic/source/comp/scanner.cxx | 220 ++++++++++++++++++-------------------
main/basic/source/sbx/sbxscan.cxx | 180 +++++++++++++++---------------
2 files changed, 199 insertions(+), 201 deletions(-)
diff --git a/main/basic/source/comp/scanner.cxx
b/main/basic/source/comp/scanner.cxx
index 39e73eac96..6e712bd367 100644
--- a/main/basic/source/comp/scanner.cxx
+++ b/main/basic/source/comp/scanner.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,20 +7,18 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
@@ -31,7 +29,7 @@
#if defined UNX
#include <stdlib.h>
#else
-#include <math.h> // atof()
+#include <math.h> // atof()
#endif
#include <rtl/math.hxx>
#include <vcl/svapp.hxx>
@@ -53,15 +51,15 @@ SbiScanner::SbiScanner( const ::rtl::OUString& rBuf,
StarBASIC* p ) : aBuf( rBuf
nLine = 0;
nCol1 = 0;
nCol2 = 0;
- nCol = 0;
+ nCol = 0;
bError =
bAbort =
bSpaces =
bNumber =
bSymbol =
bUsedForHilite =
- bCompatible =
- bVBASupportOn =
+ bCompatible =
+ bVBASupportOn =
bPrevLineExtentsComment = sal_False;
bHash =
bErrors = sal_True;
@@ -84,11 +82,11 @@ void SbiScanner::UnlockColumn()
void SbiScanner::GenError( SbError code )
{
- if( GetSbData()->bBlockCompilerError )
- {
- bAbort = sal_True;
- return;
- }
+ if( GetSbData()->bBlockCompilerError )
+ {
+ bAbort = sal_True;
+ return;
+ }
if( !bError && bErrors )
{
sal_Bool bRes = sal_True;
@@ -97,7 +95,7 @@ void SbiScanner::GenError( SbError code )
if( pBasic )
{
// Falls EXPECTED oder UNEXPECTED kommen sollte,
bezieht es sich
- // immer auf das letzte Token, also die Col1 uebernehmen
+ // immer auf das letzte Token, also die Col1 übernehmen
sal_uInt16 nc = nColLock ? nSavedCol1 : nCol1;
switch( code )
{
@@ -118,7 +116,7 @@ void SbiScanner::GenError( SbError code )
nErrors++;
}
-// Falls sofort ein Doppelpunkt folgt, wird sal_True zurueckgeliefert.
+// Falls sofort ein Doppelpunkt folgt, wird sal_True zurückgeliefert.
// Wird von SbiTokenizer::MayBeLabel() verwendet, um einen Label zu erkennen
sal_Bool SbiScanner::DoesColonFollow()
@@ -144,7 +142,7 @@ static SbxDataType GetSuffixType( sal_Unicode c )
return SbxVARIANT;
}
-// Einlesen des naechsten Symbols in die Variablen aSym, nVal und eType
+// Einlesen des nächsten Symbols in die Variablen aSym, nVal und eType
// Returnwert ist sal_False bei EOF oder Fehlern
#define BUF_SIZE 80
@@ -153,14 +151,14 @@ namespace {
/** Returns true, if the passed character is a white space character. */
inline bool lclIsWhitespace( sal_Unicode cChar )
{
- return (cChar == ' ') || (cChar == '\t') || (cChar == '\f');
+ return (cChar == ' ') || (cChar == '\t') || (cChar == '\f');
}
} // namespace
sal_Bool SbiScanner::NextSym()
{
- // Fuer den EOLN-Fall merken
+ // Für den EOLN-Fall merken
sal_uInt16 nOldLine = nLine;
sal_uInt16 nOldCol1 = nCol1;
sal_uInt16 nOldCol2 = nCol2;
@@ -183,20 +181,20 @@ sal_Bool SbiScanner::NextSym()
p2 += n;
while( ( n < nLen ) && ( *p2 != '\n' ) && ( *p2 != '\r' ) )
p2++, n++;
- // #163944# ignore trailing whitespace
- sal_Int32 nCopyEndPos = n;
- while( (nBufPos < nCopyEndPos) && lclIsWhitespace( aBuf[ nCopyEndPos -
1 ] ) )
- --nCopyEndPos;
+ // #163944# ignore trailing whitespace
+ sal_Int32 nCopyEndPos = n;
+ while( (nBufPos < nCopyEndPos) && lclIsWhitespace( aBuf[
nCopyEndPos - 1 ] ) )
+ --nCopyEndPos;
aLine = aBuf.copy( nBufPos, nCopyEndPos - nBufPos );
if( n < nLen )
- {
- if( *p2 == '\r' && *( p2+1 ) == '\n' )
- n += 2;
- else
- n++;
- }
+ {
+ if( *p2 == '\r' && *( p2+1 ) == '\n' )
+ n += 2;
+ else
+ n++;
+ }
nBufPos = n;
- pLine = aLine.getStr();
+ pLine = aLine.getStr();
nOldLine = ++nLine;
nCol = nCol1 = nCol2 = nOldCol1 = nOldCol2 = 0;
nColLock = 0;
@@ -223,7 +221,7 @@ sal_Bool SbiScanner::NextSym()
}
// Symbol? Dann Zeichen kopieren.
- if( BasicSimpleCharClass::isAlpha( *pLine, bCompatible ) || *pLine == '_' )
+ if( BasicSimpleCharClass::isAlpha( *pLine, bCompatible ) || *pLine ==
'_' )
{
// Wenn nach '_' nichts kommt, ist es ein Zeilenabschluss!
if( *pLine == '_' && !*(pLine+1) )
@@ -314,8 +312,8 @@ sal_Bool SbiScanner::NextSym()
{
pLine++; nCol++; continue;
}
-// if( toupper( *pLine ) == 'D' )
-// eScanType = SbxDOUBLE;
+// if( toupper( *pLine ) == 'D' )
+// eScanType = SbxDOUBLE;
*p++ = 'E'; pLine++; nCol++;
// Vorzeichen hinter Exponent?
if( *pLine == '+' )
@@ -339,7 +337,7 @@ sal_Bool SbiScanner::NextSym()
GenError( SbERR_BAD_CHAR_IN_NUMBER ); }
// #57844 Lokalisierte Funktion benutzen
- nVal = rtl_math_uStringToDouble( buf, buf+(p-buf), '.', ',', NULL,
NULL );
+ nVal = rtl_math_uStringToDouble( buf, buf+(p-buf), '.', ',',
NULL, NULL );
// ALT: nVal = atof( buf );
ndig = ndig - comma;
@@ -353,12 +351,12 @@ sal_Bool SbiScanner::NextSym()
}
if( bBufOverflow )
GenError( SbERR_MATH_OVERFLOW );
- // zu viele Zahlen fuer SINGLE?
-// if (ndig > 15 || ncdig > 6)
-// eScanType = SbxDOUBLE;
-// else
-// if( nVal > SbxMAXSNG || nVal < SbxMINSNG )
-// eScanType = SbxDOUBLE;
+ // zu viele Zahlen für SINGLE?
+// if (ndig > 15 || ncdig > 6)
+// eScanType = SbxDOUBLE;
+// else
+// if( nVal > SbxMAXSNG || nVal < SbxMINSNG )
+// eScanType = SbxDOUBLE;
// Typkennung?
SbxDataType t = GetSuffixType( *pLine );
@@ -399,7 +397,7 @@ sal_Bool SbiScanner::NextSym()
while( BasicSimpleCharClass::isAlphaNumeric( *pLine & 0xFF,
bCompatible ) )
{
sal_Unicode ch = sal::static_int_cast< sal_Unicode >(
- toupper( *pLine & 0xFF ) );
+ toupper( *pLine & 0xFF ) );
pLine++; nCol++;
// AB 4.1.1996: Buffer voll, leer weiter scannen
if( (p-buf) == (BUF_SIZE-1) )
@@ -448,7 +446,7 @@ sal_Bool SbiScanner::NextSym()
if( *pLine != cSep || cSep == ']' ) break;
} else aError = cSep, GenError( SbERR_EXPECTED );
}
- // If VBA Interop then doen't eat the [] chars
+ // If VBA Interop then doesn't eat the [] chars
if ( cSep == ']' && bVBASupportOn )
aSym = aLine.copy( n - 1, nCol - n + 1);
else
@@ -457,14 +455,14 @@ sal_Bool SbiScanner::NextSym()
String s( cSep );
s += cSep;
sal_uInt16 nIdx = 0;
- do
+ do
{
nIdx = aSym.Search( s, nIdx );
if( nIdx == STRING_NOTFOUND )
break;
aSym.Erase( nIdx, 1 );
nIdx++;
- }
+ }
while( true );
if( cSep != ']' )
eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING;
@@ -510,15 +508,15 @@ PrevLineCommentLbl:
eoln:
if( nCol && *--pLine == '_' )
{
- pLine = NULL;
+ pLine = NULL;
bool bRes = NextSym();
if( bVBASupportOn && aSym.GetBuffer()[0] == '.' )
{
// object _
// .Method
// ^^^ <- spaces is legal in MSO VBA
- OSL_TRACE("*** resetting bSpaces***");
- bSpaces = sal_False;
+ OSL_TRACE("*** resetting bSpaces***");
+ bSpaces = sal_False;
}
return bRes;
}
@@ -541,68 +539,68 @@ LetterTable::LetterTable( void )
for( int i = 0 ; i < 256 ; ++i )
IsLetterTab[i] = false;
- IsLetterTab[0xC0] = true; // � , CAPITAL LETTER A WITH GRAVE
ACCENT
- IsLetterTab[0xC1] = true; // � , CAPITAL LETTER A WITH ACUTE
ACCENT
- IsLetterTab[0xC2] = true; // � , CAPITAL LETTER A WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xC3] = true; // � , CAPITAL LETTER A WITH TILDE
- IsLetterTab[0xC4] = true; // � , CAPITAL LETTER A WITH DIAERESIS
- IsLetterTab[0xC5] = true; // � , CAPITAL LETTER A WITH RING ABOVE
- IsLetterTab[0xC6] = true; // � , CAPITAL LIGATURE AE
- IsLetterTab[0xC7] = true; // � , CAPITAL LETTER C WITH CEDILLA
- IsLetterTab[0xC8] = true; // � , CAPITAL LETTER E WITH GRAVE
ACCENT
- IsLetterTab[0xC9] = true; // � , CAPITAL LETTER E WITH ACUTE
ACCENT
- IsLetterTab[0xCA] = true; // � , CAPITAL LETTER E WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xCB] = true; // � , CAPITAL LETTER E WITH DIAERESIS
- IsLetterTab[0xCC] = true; // � , CAPITAL LETTER I WITH GRAVE
ACCENT
- IsLetterTab[0xCD] = true; // � , CAPITAL LETTER I WITH ACUTE
ACCENT
- IsLetterTab[0xCE] = true; // � , CAPITAL LETTER I WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xCF] = true; // � , CAPITAL LETTER I WITH DIAERESIS
- IsLetterTab[0xD0] = true; // � , CAPITAL LETTER ETH
- IsLetterTab[0xD1] = true; // � , CAPITAL LETTER N WITH TILDE
- IsLetterTab[0xD2] = true; // � , CAPITAL LETTER O WITH GRAVE
ACCENT
- IsLetterTab[0xD3] = true; // � , CAPITAL LETTER O WITH ACUTE
ACCENT
- IsLetterTab[0xD4] = true; // � , CAPITAL LETTER O WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xD5] = true; // � , CAPITAL LETTER O WITH TILDE
- IsLetterTab[0xD6] = true; // � , CAPITAL LETTER O WITH DIAERESIS
- IsLetterTab[0xD8] = true; // � , CAPITAL LETTER O WITH STROKE
- IsLetterTab[0xD9] = true; // � , CAPITAL LETTER U WITH GRAVE
ACCENT
- IsLetterTab[0xDA] = true; // � , CAPITAL LETTER U WITH ACUTE
ACCENT
- IsLetterTab[0xDB] = true; // � , CAPITAL LETTER U WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xDC] = true; // � , CAPITAL LETTER U WITH DIAERESIS
- IsLetterTab[0xDD] = true; // � , CAPITAL LETTER Y WITH ACUTE
ACCENT
- IsLetterTab[0xDE] = true; // � , CAPITAL LETTER THORN
- IsLetterTab[0xDF] = true; // � , SMALL LETTER SHARP S
- IsLetterTab[0xE0] = true; // � , SMALL LETTER A WITH GRAVE ACCENT
- IsLetterTab[0xE1] = true; // � , SMALL LETTER A WITH ACUTE ACCENT
- IsLetterTab[0xE2] = true; // � , SMALL LETTER A WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xE3] = true; // � , SMALL LETTER A WITH TILDE
- IsLetterTab[0xE4] = true; // � , SMALL LETTER A WITH DIAERESIS
- IsLetterTab[0xE5] = true; // � , SMALL LETTER A WITH RING ABOVE
- IsLetterTab[0xE6] = true; // � , SMALL LIGATURE AE
- IsLetterTab[0xE7] = true; // � , SMALL LETTER C WITH CEDILLA
- IsLetterTab[0xE8] = true; // � , SMALL LETTER E WITH GRAVE ACCENT
- IsLetterTab[0xE9] = true; // � , SMALL LETTER E WITH ACUTE ACCENT
- IsLetterTab[0xEA] = true; // � , SMALL LETTER E WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xEB] = true; // � , SMALL LETTER E WITH DIAERESIS
- IsLetterTab[0xEC] = true; // � , SMALL LETTER I WITH GRAVE ACCENT
- IsLetterTab[0xED] = true; // � , SMALL LETTER I WITH ACUTE ACCENT
- IsLetterTab[0xEE] = true; // � , SMALL LETTER I WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xEF] = true; // � , SMALL LETTER I WITH DIAERESIS
- IsLetterTab[0xF0] = true; // � , SMALL LETTER ETH
- IsLetterTab[0xF1] = true; // � , SMALL LETTER N WITH TILDE
- IsLetterTab[0xF2] = true; // � , SMALL LETTER O WITH GRAVE ACCENT
- IsLetterTab[0xF3] = true; // � , SMALL LETTER O WITH ACUTE ACCENT
- IsLetterTab[0xF4] = true; // � , SMALL LETTER O WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xF5] = true; // � , SMALL LETTER O WITH TILDE
- IsLetterTab[0xF6] = true; // � , SMALL LETTER O WITH DIAERESIS
- IsLetterTab[0xF8] = true; // � , SMALL LETTER O WITH OBLIQUE BAR
- IsLetterTab[0xF9] = true; // � , SMALL LETTER U WITH GRAVE ACCENT
- IsLetterTab[0xFA] = true; // � , SMALL LETTER U WITH ACUTE ACCENT
- IsLetterTab[0xFB] = true; // � , SMALL LETTER U WITH CIRCUMFLEX
ACCENT
- IsLetterTab[0xFC] = true; // � , SMALL LETTER U WITH DIAERESIS
- IsLetterTab[0xFD] = true; // � , SMALL LETTER Y WITH ACUTE ACCENT
- IsLetterTab[0xFE] = true; // � , SMALL LETTER THORN
- IsLetterTab[0xFF] = true; // � , SMALL LETTER Y WITH DIAERESIS
+ IsLetterTab[0xC0] = true; // À , CAPITAL LETTER A WITH GRAVE
ACCENT
+ IsLetterTab[0xC1] = true; // Á , CAPITAL LETTER A WITH ACUTE
ACCENT
+ IsLetterTab[0xC2] = true; // Â , CAPITAL LETTER A WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xC3] = true; // Ã , CAPITAL LETTER A WITH TILDE
+ IsLetterTab[0xC4] = true; // Ä , CAPITAL LETTER A WITH DIAERESIS
+ IsLetterTab[0xC5] = true; // Å , CAPITAL LETTER A WITH RING ABOVE
+ IsLetterTab[0xC6] = true; // Æ , CAPITAL LIGATURE AE
+ IsLetterTab[0xC7] = true; // Ç , CAPITAL LETTER C WITH CEDILLA
+ IsLetterTab[0xC8] = true; // È , CAPITAL LETTER E WITH GRAVE
ACCENT
+ IsLetterTab[0xC9] = true; // É , CAPITAL LETTER E WITH ACUTE
ACCENT
+ IsLetterTab[0xCA] = true; // Ê , CAPITAL LETTER E WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xCB] = true; // Ë , CAPITAL LETTER E WITH DIAERESIS
+ IsLetterTab[0xCC] = true; // Ì , CAPITAL LETTER I WITH GRAVE
ACCENT
+ IsLetterTab[0xCD] = true; // Í , CAPITAL LETTER I WITH ACUTE
ACCENT
+ IsLetterTab[0xCE] = true; // Î , CAPITAL LETTER I WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xCF] = true; // Ï , CAPITAL LETTER I WITH DIAERESIS
+ IsLetterTab[0xD0] = true; // Ð , CAPITAL LETTER ETH
+ IsLetterTab[0xD1] = true; // Ñ , CAPITAL LETTER N WITH TILDE
+ IsLetterTab[0xD2] = true; // Ò , CAPITAL LETTER O WITH GRAVE
ACCENT
+ IsLetterTab[0xD3] = true; // Ó , CAPITAL LETTER O WITH ACUTE
ACCENT
+ IsLetterTab[0xD4] = true; // Ô , CAPITAL LETTER O WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xD5] = true; // Õ , CAPITAL LETTER O WITH TILDE
+ IsLetterTab[0xD6] = true; // Ö , CAPITAL LETTER O WITH DIAERESIS
+ IsLetterTab[0xD8] = true; // Ø , CAPITAL LETTER O WITH STROKE
+ IsLetterTab[0xD9] = true; // Ù , CAPITAL LETTER U WITH GRAVE
ACCENT
+ IsLetterTab[0xDA] = true; // Ú , CAPITAL LETTER U WITH ACUTE
ACCENT
+ IsLetterTab[0xDB] = true; // Û , CAPITAL LETTER U WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xDC] = true; // Ü , CAPITAL LETTER U WITH DIAERESIS
+ IsLetterTab[0xDD] = true; // Ý , CAPITAL LETTER Y WITH ACUTE
ACCENT
+ IsLetterTab[0xDE] = true; // Þ , CAPITAL LETTER THORN
+ IsLetterTab[0xDF] = true; // ß , SMALL LETTER SHARP S
+ IsLetterTab[0xE0] = true; // à , SMALL LETTER A WITH GRAVE ACCENT
+ IsLetterTab[0xE1] = true; // á , SMALL LETTER A WITH ACUTE ACCENT
+ IsLetterTab[0xE2] = true; // â , SMALL LETTER A WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xE3] = true; // ã , SMALL LETTER A WITH TILDE
+ IsLetterTab[0xE4] = true; // ä , SMALL LETTER A WITH DIAERESIS
+ IsLetterTab[0xE5] = true; // å , SMALL LETTER A WITH RING ABOVE
+ IsLetterTab[0xE6] = true; // æ , SMALL LIGATURE AE
+ IsLetterTab[0xE7] = true; // ç , SMALL LETTER C WITH CEDILLA
+ IsLetterTab[0xE8] = true; // è , SMALL LETTER E WITH GRAVE ACCENT
+ IsLetterTab[0xE9] = true; // é , SMALL LETTER E WITH ACUTE ACCENT
+ IsLetterTab[0xEA] = true; // ê , SMALL LETTER E WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xEB] = true; // ë , SMALL LETTER E WITH DIAERESIS
+ IsLetterTab[0xEC] = true; // ì , SMALL LETTER I WITH GRAVE ACCENT
+ IsLetterTab[0xED] = true; // í , SMALL LETTER I WITH ACUTE ACCENT
+ IsLetterTab[0xEE] = true; // î , SMALL LETTER I WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xEF] = true; // ï , SMALL LETTER I WITH DIAERESIS
+ IsLetterTab[0xF0] = true; // ð , SMALL LETTER ETH
+ IsLetterTab[0xF1] = true; // ñ , SMALL LETTER N WITH TILDE
+ IsLetterTab[0xF2] = true; // ò , SMALL LETTER O WITH GRAVE ACCENT
+ IsLetterTab[0xF3] = true; // ó , SMALL LETTER O WITH ACUTE ACCENT
+ IsLetterTab[0xF4] = true; // ô , SMALL LETTER O WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xF5] = true; // õ , SMALL LETTER O WITH TILDE
+ IsLetterTab[0xF6] = true; // ö , SMALL LETTER O WITH DIAERESIS
+ IsLetterTab[0xF8] = true; // ø , SMALL LETTER O WITH OBLIQUE BAR
+ IsLetterTab[0xF9] = true; // ù , SMALL LETTER U WITH GRAVE ACCENT
+ IsLetterTab[0xFA] = true; // ú , SMALL LETTER U WITH ACUTE ACCENT
+ IsLetterTab[0xFB] = true; // û , SMALL LETTER U WITH CIRCUMFLEX
ACCENT
+ IsLetterTab[0xFC] = true; // ü , SMALL LETTER U WITH DIAERESIS
+ IsLetterTab[0xFD] = true; // ý , SMALL LETTER Y WITH ACUTE ACCENT
+ IsLetterTab[0xFE] = true; // þ , SMALL LETTER THORN
+ IsLetterTab[0xFF] = true; // ÿ , SMALL LETTER Y WITH DIAERESIS
}
bool LetterTable::isLetterUnicode( sal_Unicode c )
@@ -614,3 +612,5 @@ bool LetterTable::isLetterUnicode( sal_Unicode c )
bool bRet = pCharClass->isLetter( aStr, 0 );
return bRet;
}
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/basic/source/sbx/sbxscan.cxx
b/main/basic/source/sbx/sbxscan.cxx
index 170c35af87..97e5ff181c 100644
--- a/main/basic/source/sbx/sbxscan.cxx
+++ b/main/basic/source/sbx/sbxscan.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,20 +7,18 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
#include <tools/errcode.hxx>
@@ -54,16 +52,16 @@
void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep )
{
- SvtSysLocale aSysLocale;
- const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
+ SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
rcDecimalSep = rData.getNumDecimalSep().GetBuffer()[0];
rcThousandSep = rData.getNumThousandSep().GetBuffer()[0];
}
// Scannen eines Strings nach BASIC-Konventionen
-// Dies entspricht den ueblichen Konventionen, nur dass der Exponent
+// Dies entspricht den üblichen Konventionen, nur dass der Exponent
// auch ein D sein darf, was den Datentyp auf SbxDOUBLE festlegt.
-// Die Routine versucht, den Datentyp so klein wie moeglich zu gestalten.
+// Die Routine versucht, den Datentyp so klein wie möglich zu gestalten.
// Das ganze gibt auch noch einen Konversionsfehler, wenn der Datentyp
// Fixed ist und das ganze nicht hineinpasst!
@@ -76,20 +74,20 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double&
nVal, SbxDataType& rType
char cIntntlComma, cIntntl1000;
char cNonIntntlComma = '.';
- sal_Unicode cDecimalSep, cThousandSep = 0;
+ sal_Unicode cDecimalSep, cThousandSep = 0;
if( bAllowIntntl || bOnlyIntntl )
{
- ImpGetIntntlSep( cDecimalSep, cThousandSep );
+ ImpGetIntntlSep( cDecimalSep, cThousandSep );
cIntntlComma = (char)cDecimalSep;
- cIntntl1000 = (char)cThousandSep;
+ cIntntl1000 = (char)cThousandSep;
}
// Sonst einfach auch auf . setzen
else
{
cIntntlComma = cNonIntntlComma;
- cIntntl1000 = cNonIntntlComma; // Unschaedlich machen
+ cIntntl1000 = cNonIntntlComma; // Unschädlich machen
}
- // Nur International -> IntnlComma uebernehmen
+ // Nur International -> IntnlComma übernehmen
if( bOnlyIntntl )
{
cNonIntntlComma = cIntntlComma;
@@ -125,7 +123,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double&
nVal, SbxDataType& rType
const char* pSearchStr = aSearchStr.GetBuffer();
while( strchr( pSearchStr, *p ) && *p )
{
- // 1000er-Trenner ueberlesen
+ // 1000er-Trenner überlesen
if( bOnlyIntntl && *p == cIntntl1000 )
{
p++;
@@ -135,7 +133,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double&
nVal, SbxDataType& rType
// Komma oder Exponent?
if( *p == cNonIntntlComma || *p == cIntntlComma )
{
- // Immer '.' einfuegen, damit atof funktioniert
+ // Immer '.' einfügen, damit atof funktioniert
p++;
if( ++comma > 1 )
continue;
@@ -180,7 +178,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double&
nVal, SbxDataType& rType
nVal = atof( buf );
ndig = ndig - comma;
- // zu viele Zahlen fuer SINGLE?
+ // zu viele Zahlen für SINGLE?
if( ndig > 15 || ncdig > 6 )
eScanType = SbxDOUBLE;
@@ -240,7 +238,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double&
nVal, SbxDataType& rType
return SbxERR_OK;
}
-// Schnittstelle fuer CDbl im Basic
+// Schnittstelle für CDbl im Basic
SbxError SbxValue::ScanNumIntnl( const String& rSrc, double& nVal, sal_Bool
bSingle )
{
SbxDataType t;
@@ -289,10 +287,10 @@ static void myftoa( double nNum, char * pBuf, short
nPrec, short nExpWidth,
register int i, digit;
// Komma besorgen
- sal_Unicode cDecimalSep, cThousandSep;
- ImpGetIntntlSep( cDecimalSep, cThousandSep );
- if( cForceThousandSep )
- cThousandSep = cForceThousandSep;
+ sal_Unicode cDecimalSep, cThousandSep;
+ ImpGetIntntlSep( cDecimalSep, cThousandSep );
+ if( cForceThousandSep )
+ cThousandSep = cForceThousandSep;
// Exponentberechnung:
nExp = 0;
@@ -392,10 +390,10 @@ void ImpCvtNum( double nNum, short nPrec,
::rtl::OUString& rRes, sal_Bool bCoreS
char *q;
char cBuf[ 40 ], *p = cBuf;
- sal_Unicode cDecimalSep, cThousandSep;
- ImpGetIntntlSep( cDecimalSep, cThousandSep );
- if( bCoreString )
- cDecimalSep = '.';
+ sal_Unicode cDecimalSep, cThousandSep;
+ ImpGetIntntlSep( cDecimalSep, cThousandSep );
+ if( bCoreString )
+ cDecimalSep = '.';
if( nNum < 0.0 ) {
nNum = -nNum;
@@ -403,7 +401,7 @@ void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString&
rRes, sal_Bool bCoreS
}
double dMaxNumWithoutExp = (nPrec == 6) ? 1E6 : 1E14;
myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum >=
dMaxNumWithoutExp ) ) ? 4:0,
- sal_False, sal_True, cDecimalSep );
+ sal_False, sal_True, cDecimalSep );
// Trailing Zeroes weg:
for( p = cBuf; *p &&( *p != 'E' ); p++ ) {}
q = p; p--;
@@ -420,14 +418,14 @@ void ImpCvtNum( double nNum, short nPrec,
::rtl::OUString& rRes, sal_Bool bCoreS
sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
{
- // Merken, ob ueberhaupt was geaendert wurde
+ // Merken, ob überhaupt was geändert wurde
sal_Bool bChanged = sal_False;
::rtl::OUString aNewString;
- // Nur Spezial-F�lle behandeln, als Default tun wir nichts
+ // Nur Spezial-Fälle behandeln, als Default tun wir nichts
switch( eTargetType )
{
- // Bei Fliesskomma International beruecksichtigen
+ // Bei Fliesskomma International berücksichtigen
case SbxSINGLE:
case SbxDOUBLE:
case SbxCURRENCY:
@@ -435,8 +433,8 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc,
SbxDataType eTargetType )
::rtl::OString aBStr( ::rtl::OUStringToOString( rSrc,
RTL_TEXTENCODING_ASCII_US ) );
// Komma besorgen
- sal_Unicode cDecimalSep, cThousandSep;
- ImpGetIntntlSep( cDecimalSep, cThousandSep );
+ sal_Unicode cDecimalSep, cThousandSep;
+ ImpGetIntntlSep( cDecimalSep, cThousandSep );
aNewString = rSrc;
// Ersetzen, wenn DecimalSep kein '.' (nur den ersten)
@@ -445,7 +443,7 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc,
SbxDataType eTargetType )
sal_Int32 nPos = aNewString.indexOf(
cDecimalSep );
if( nPos != -1 )
{
- sal_Unicode* pStr = (sal_Unicode*)aNewString.getStr();
+ sal_Unicode* pStr =
(sal_Unicode*)aNewString.getStr();
pStr[nPos] = (sal_Unicode)'.';
bChanged = sal_True;
}
@@ -453,7 +451,7 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc,
SbxDataType eTargetType )
break;
}
- // Bei sal_Bool sal_True und sal_False als String pruefen
+ // Bei sal_Bool sal_True und sal_False als String prüfen
case SbxBOOL:
{
if( rSrc.equalsIgnoreAsciiCaseAscii( "true" ) )
@@ -471,7 +469,7 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc,
SbxDataType eTargetType )
}
default: break;
}
- // String bei Aenderung uebernehmen
+ // String bei Änderung übernehmen
if( bChanged )
rSrc = aNewString;
return bChanged;
@@ -480,7 +478,7 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc,
SbxDataType eTargetType )
// Formatierte Zahlenausgabe
// Der Returnwert ist die Anzahl Zeichen, die aus dem
-// Format verwendt wurden.
+// Format verwendet wurden.
#ifdef _old_format_code_
// lasse diesen Code vorl"aufig drin, zum 'abgucken'
@@ -557,7 +555,7 @@ static sal_uInt16 printfmtnum( double nNum, XubString&
rRes, const XubString& rW
myftoa( nNum, p, nPrec, nExpDig, bPoint, sal_False );
nLen = strlen( cBuf );
- // Ueberlauf?
+ // Überlauf?
if( cPre ) nLen++;
if( nLen > nWidth ) rRes += '%';
else {
@@ -652,38 +650,38 @@ public:
enum VbaFormatType
{
- VBA_FORMAT_TYPE_OFFSET, // standard number format
- VBA_FORMAT_TYPE_USERDEFINED, // user defined number format
- VBA_FORMAT_TYPE_NULL
+ VBA_FORMAT_TYPE_OFFSET, // standard number format
+ VBA_FORMAT_TYPE_USERDEFINED, // user defined number format
+ VBA_FORMAT_TYPE_NULL
};
struct VbaFormatInfo
{
- VbaFormatType meType;
- const char* mpVbaFormat; // Format string in vba
- NfIndexTableOffset meOffset; // SvNumberFormatter format index, if meType
= VBA_FORMAT_TYPE_OFFSET
- const char* mpOOoFormat; // if meType = VBA_FORMAT_TYPE_USERDEFINED
+ VbaFormatType meType;
+ const char* mpVbaFormat; // Format string in vba
+ NfIndexTableOffset meOffset; // SvNumberFormatter format index, if
meType = VBA_FORMAT_TYPE_OFFSET
+ const char* mpOOoFormat; // if meType = VBA_FORMAT_TYPE_USERDEFINED
};
#define VBA_FORMAT_OFFSET( pcUtf8, eOffset ) \
- { VBA_FORMAT_TYPE_OFFSET, pcUtf8, eOffset, 0 }
+ { VBA_FORMAT_TYPE_OFFSET, pcUtf8, eOffset, 0 }
#define VBA_FORMAT_USERDEFINED( pcUtf8, pcDefinedUtf8 ) \
- { VBA_FORMAT_TYPE_USERDEFINED, pcUtf8, NF_NUMBER_STANDARD, pcDefinedUtf8 }
+ { VBA_FORMAT_TYPE_USERDEFINED, pcUtf8, NF_NUMBER_STANDARD,
pcDefinedUtf8 }
-static VbaFormatInfo pFormatInfoTable[] =
+static VbaFormatInfo pFormatInfoTable[] =
{
- VBA_FORMAT_OFFSET( "Long Date", NF_DATE_SYSTEM_LONG ),
- VBA_FORMAT_USERDEFINED( "Medium Date", "DD-MMM-YY" ),
- VBA_FORMAT_OFFSET( "Short Date", NF_DATE_SYSTEM_SHORT ),
- VBA_FORMAT_USERDEFINED( "Long Time", "H:MM:SS AM/PM" ),
- VBA_FORMAT_OFFSET( "Medium Time", NF_TIME_HHMMAMPM ),
- VBA_FORMAT_OFFSET( "Short Time", NF_TIME_HHMM ),
- VBA_FORMAT_OFFSET( "ddddd", NF_DATE_SYSTEM_SHORT ),
- VBA_FORMAT_OFFSET( "dddddd", NF_DATE_SYSTEM_LONG ),
- VBA_FORMAT_USERDEFINED( "ttttt", "H:MM:SS AM/PM" ),
- VBA_FORMAT_OFFSET( "ww", NF_DATE_WW ),
- { VBA_FORMAT_TYPE_NULL, 0, NF_INDEX_TABLE_ENTRIES, 0 }
+ VBA_FORMAT_OFFSET( "Long Date", NF_DATE_SYSTEM_LONG ),
+ VBA_FORMAT_USERDEFINED( "Medium Date", "DD-MMM-YY" ),
+ VBA_FORMAT_OFFSET( "Short Date", NF_DATE_SYSTEM_SHORT ),
+ VBA_FORMAT_USERDEFINED( "Long Time", "H:MM:SS AM/PM" ),
+ VBA_FORMAT_OFFSET( "Medium Time", NF_TIME_HHMMAMPM ),
+ VBA_FORMAT_OFFSET( "Short Time", NF_TIME_HHMM ),
+ VBA_FORMAT_OFFSET( "ddddd", NF_DATE_SYSTEM_SHORT ),
+ VBA_FORMAT_OFFSET( "dddddd", NF_DATE_SYSTEM_LONG ),
+ VBA_FORMAT_USERDEFINED( "ttttt", "H:MM:SS AM/PM" ),
+ VBA_FORMAT_OFFSET( "ww", NF_DATE_WW ),
+ { VBA_FORMAT_TYPE_NULL, 0, NF_INDEX_TABLE_ENTRIES, 0 }
};
VbaFormatInfo* getFormatInfo( const String& rFmt )
@@ -694,7 +692,7 @@ VbaFormatInfo* getFormatInfo( const String& rFmt )
{
if( rFmt.EqualsIgnoreCaseAscii( pInfo->mpVbaFormat ) )
break;
- i++;
+ i++;
}
return pInfo;
}
@@ -721,30 +719,30 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
double d = 0;
// pflin, It is better to use SvNumberFormatter to handle the
date/time/number format.
- // the SvNumberFormatter output is mostly compatible with
- // VBA output besides the OOo-basic output
+ // the SvNumberFormatter output is mostly compatible with
+ // VBA output besides the AOO-BASIC output
if( pFmt && !SbxBasicFormater::isBasicFormat( *pFmt ) )
{
String aStr = GetString();
- SvtSysLocale aSysLocale;
- const CharClass& rCharClass = aSysLocale.GetCharClass();
+ SvtSysLocale aSysLocale;
+ const CharClass& rCharClass = aSysLocale.GetCharClass();
if( pFmt->EqualsIgnoreCaseAscii( VBAFORMAT_LOWERCASE ) )
{
- rCharClass.toLower( aStr );
- rRes = aStr;
+ rCharClass.toLower( aStr );
+ rRes = aStr;
return;
}
if( pFmt->EqualsIgnoreCaseAscii( VBAFORMAT_UPPERCASE ) )
{
- rCharClass.toUpper( aStr );
- rRes = aStr;
+ rCharClass.toUpper( aStr );
+ rRes = aStr;
return;
}
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
- com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory >
+ com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory >
xFactory = comphelper::getProcessServiceFactory();
SvNumberFormatter aFormatter( xFactory, eLangType );
@@ -756,7 +754,7 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
sal_Bool bSuccess = aFormatter.IsNumberFormat( aStr, nIndex,
nNumber );
- // number format, use SvNumberFormatter to handle it.
+ // number format, use SvNumberFormatter to handle it.
if( bSuccess )
{
String aFmtStr = *pFmt;
@@ -775,14 +773,14 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
aFormatter.GetOutputString( nNumber, nIndex, rRes, &pCol );
}
else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_GENERALDATE )
- || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_C ))
+ || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_C ))
{
if( nNumber <=-1.0 || nNumber >= 1.0 )
{
- // short date
+ // short date
nIndex = aFormatter.GetFormatIndex( NF_DATE_SYSTEM_SHORT,
eLangType );
aFormatter.GetOutputString( nNumber, nIndex,
rRes, &pCol );
-
+
// long time
if( floor( nNumber ) != nNumber )
{
@@ -803,7 +801,7 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
}
}
else if( aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_N )
- || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ))
+ || aFmtStr.EqualsIgnoreCaseAscii( VBAFORMAT_NN ))
{
sal_Int32 nMin = implGetMinute( nNumber );
if( nMin < 10 && aFmtStr.EqualsIgnoreCaseAscii(
VBAFORMAT_NN ) )
@@ -835,10 +833,10 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
{
aFormatter.PutandConvertEntry( aFmtStr, nCheckPos, nType,
nIndex, LANGUAGE_ENGLISH, eLangType );
aFormatter.GetOutputString( nNumber, nIndex, rRes,
&pCol );
- }
+ }
return;
- }
+ }
}
SbxDataType eType = GetType();
@@ -863,14 +861,14 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
if( eType != SbxNULL )
d = GetDouble();
- // #45355 weiterer Einsprungpunkt fuer isnumeric-String
+ // #45355 weiterer Einsprungpunkt für isnumeric-String
cvt2:
if( pFmt )
{
// hole die 'statischen' Daten f"ur Sbx
SbxAppData* pData = GetSbxData_Impl();
- LanguageType eLangType =
GetpApp()->GetSettings().GetLanguage();
+ LanguageType eLangType =
GetpApp()->GetSettings().GetLanguage();
if( pData->pBasicFormater )
{
if( pData->eBasicFormaterLangType != eLangType )
@@ -885,15 +883,15 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
// existiert, so erzeuge dieses
if( !pData->pBasicFormater )
{
- SvtSysLocale aSysLocale;
- const LocaleDataWrapper& rData =
aSysLocale.GetLocaleData();
+ SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rData =
aSysLocale.GetLocaleData();
sal_Unicode cComma =
rData.getNumDecimalSep().GetBuffer()[0];
sal_Unicode c1000 =
rData.getNumThousandSep().GetBuffer()[0];
String aCurrencyStrg =
rData.getCurrSymbol();
-
+
// Initialisierung des
Basic-Formater-Hilfsobjekts:
- // hole die Resourcen f"ur die
vordefinierten Ausgaben
- // des Format()-Befehls, z.B. f"ur
"On/Off".
+ // hole die Ressourcen für die
vordefinierten Ausgaben
+ // des Format()-Befehls, z.B. für
"On/Off".
String aOnStrg = String(
SbxValueFormatResId(
STR_BASICKEY_FORMAT_ON ) );
String aOffStrg = String(
SbxValueFormatResId(
@@ -914,10 +912,10 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
aYesStrg,aNoStrg,aTrueStrg,aFalseStrg,
aCurrencyStrg,aCurrencyFormatStrg );
}
- // Bem.: Aus Performance-Gr"unden wird nur EIN
BasicFormater-
+ // Bem.: Aus Performance-Gründen wird nur EIN
BasicFormater-
// Objekt erzeugt und 'gespeichert', dadurch
erspart man
- // sich das teure Resourcen-Laden (f"ur
landesspezifische
- // vordefinierte Ausgaben, z.B. "On/Off")
und die st"andige
+ // sich das teure Ressourcen-Laden (für
landesspezifische
+ // vordefinierte Ausgaben, z.B. "On/Off")
und die ständige
// String-Erzeugungs Operationen.
// ABER: dadurch ist dieser Code NICHT
multithreading f"ahig !
@@ -937,11 +935,11 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
//old: printfmtnum( GetDouble(), rRes, *pFmt );
}
else
- {
- ::rtl::OUString aTmpString( rRes );
+ {
+ ::rtl::OUString aTmpString( rRes );
ImpCvtNum( GetDouble(), nComma, aTmpString );
- rRes = aTmpString;
- }
+ rRes = aTmpString;
+ }
break;
case SbxSTRING:
if( pFmt )
@@ -966,4 +964,4 @@ void SbxValue::Format( XubString& rRes, const XubString*
pFmt ) const
}
}
-
+/* vim: set noet sw=4 ts=4: */