tdf#39468 Translate German comments in sw
Translate German comments and terms in sw/source/filter/html/parcss1.cxx
Change-Id: Ib36ba2214d621a2f5272928922c5999a718d86bb
Reviewed-on: https://gerrit.libreoffice.org/36442
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx
index 5554efdb..3285d08 100644
--- a/sw/source/filter/html/parcss1.cxx
+++ b/sw/source/filter/html/parcss1.cxx
@@ -26,9 +26,8 @@
#include "css1kywd.hxx"
#include "parcss1.hxx"
// Loop-Check: Um Endlos-Schleifen zu vermeiden, wird in jeder
// Schalife geprueft, ob ein Fortschritt in der Eingabe-Position
// stattgefunden hat
// Loop-Check: Used to avoid infinite loops, is checked after every
// loop, if there is progress of the input position
#define LOOP_CHECK
#ifdef LOOP_CHECK
@@ -59,7 +58,7 @@ void CSS1Parser::InitRead( const OUString& rIn )
nlLineNr = 0;
nlLinePos = 0;
bWhiteSpace = true; // Wenn noch nichts gelesen wurde ist das wie WS
bWhiteSpace = true; // if nothing was read it's like there was WS
bEOF = false;
eState = CSS1_PAR_WORKING;
nValue = 0.;
@@ -92,13 +91,13 @@ sal_Unicode CSS1Parser::GetNextChar()
return c;
}
// Diese Funktion realisiert den in
// This function implements the scanner described in
// http://www.w3.orh/pub/WWW/TR/WD-css1.html
// bzw. http://www.w3.orh/pub/WWW/TR/WD-css1-960220.html
// http://www.w3.orh/pub/WWW/TR/WD-css1.html
// resp. http://www.w3.orh/pub/WWW/TR/WD-css1-960220.html
// beschriebenen Scanner fuer CSS1. Es handelt sich um eine direkte
// Umsetzung der dort beschriebenen Lex-Grammatik
// for CSS1. It's a direct implementation of the
// described Lex grammar.
CSS1Token CSS1Parser::GetNextToken()
{
@@ -106,7 +105,7 @@ CSS1Token CSS1Parser::GetNextToken()
aToken.clear();
do {
// Merken, ob davor White-Space gelesen wurde
// remember if white space was read
bool bPrevWhiteSpace = bWhiteSpace;
bWhiteSpace = false;
@@ -142,7 +141,7 @@ CSS1Token CSS1Parser::GetNextToken()
cNextCh = GetNextChar();
if (rtl::isAsciiAlpha(cNextCh))
{
// den naechsten Identifer scannen
// scan the next identifier
OUStringBuffer sTmpBuffer(32);
do {
sTmpBuffer.append( cNextCh );
@@ -152,7 +151,7 @@ CSS1Token CSS1Parser::GetNextToken()
aToken += sTmpBuffer.makeStringAndClear();
// und schauen, ob wir ihn kennen
// check if we know it
switch( aToken[0] )
{
case 'i':
@@ -167,9 +166,8 @@ CSS1Token CSS1Parser::GetNextToken()
break;
}
// Fehlerbehandlung: '@ident' und alles bis
// zu einem Semikolon der dem Ende des folgenden
// Blocks ignorieren
// error handling: ignore '@indent' and the rest until
// semicolon at end of the next block
if( CSS1_NULL==nRet )
{
aToken.clear();
@@ -225,7 +223,7 @@ CSS1Token CSS1Parser::GetNextToken()
case '!': // '!' 'legal' | '!' 'important' | syntax error
{
// White Space ueberlesen
// ignore white space
cNextCh = GetNextChar();
while( ( ' ' == cNextCh ||
(cNextCh >= 0x09 && cNextCh <= 0x0d) ) && !IsEOF() )
@@ -236,7 +234,7 @@ CSS1Token CSS1Parser::GetNextToken()
if( 'i'==cNextCh || 'I'==cNextCh)
{
// den naechsten Identifer scannen
// scan next identifier
OUStringBuffer sTmpBuffer(32);
do {
sTmpBuffer.append( cNextCh );
@@ -254,7 +252,7 @@ CSS1Token CSS1Parser::GetNextToken()
}
else
{
// Fehlerbehandlung: '!' ignorieren, IDENT nicht
// error handling: ignore '!', not IDENT
nRet = CSS1_IDENT;
}
@@ -263,7 +261,7 @@ CSS1Token CSS1Parser::GetNextToken()
}
else
{
// Fehlerbehandlung: '!' ignorieren
// error handling: ignore '!'
bNextCh = false;
}
}
@@ -272,7 +270,7 @@ CSS1Token CSS1Parser::GetNextToken()
case '\"':
case '\'': // STRING
{
// \... geht noch nicht!!!
// \... isn't possible yet!!!
sal_Unicode cQuoteChar = cNextCh;
cNextCh = GetNextChar();
@@ -299,14 +297,14 @@ CSS1Token CSS1Parser::GetNextToken()
case '8':
case '9': // NUMBER | PERCENTAGE | LENGTH
{
// die aktuelle Position retten
// save current position
std::size_t nInPosSave = nInPos;
sal_Unicode cNextChSave = cNextCh;
sal_uInt32 nlLineNrSave = nlLineNr;
sal_uInt32 nlLinePosSave = nlLinePos;
bool bEOFSave = bEOF;
// erstmal versuchen eine Hex-Zahl zu scannen
// first try to parse a hex digit
OUStringBuffer sTmpBuffer( 16 );
do {
sTmpBuffer.append( cNextCh );
@@ -319,7 +317,7 @@ CSS1Token CSS1Parser::GetNextToken()
if( sTmpBuffer.getLength()==6 )
{
// wir haben eine hexadezimale Farbe gefunden
// we found a color in hex
aToken += sTmpBuffer.makeStringAndClear();
nRet = CSS1_HEXCOLOR;
bNextCh = false;
@@ -327,14 +325,14 @@ CSS1Token CSS1Parser::GetNextToken()
break;
}
// sonst versuchen wir es mit einer Zahl
// otherwise we try a number
nInPos = nInPosSave;
cNextCh = cNextChSave;
nlLineNr = nlLineNrSave;
nlLinePos = nlLinePosSave;
bEOF = bEOFSave;
// erstmal die Zahl scannen
// first parse the number
sTmpBuffer.setLength( 0L );
do {
sTmpBuffer.append( cNextCh );
@@ -345,7 +343,7 @@ CSS1Token CSS1Parser::GetNextToken()
aToken += sTmpBuffer.makeStringAndClear();
nValue = aToken.toDouble();
// White Space ueberlesen
// ignore white space
while( ( ' ' == cNextCh ||
(cNextCh >= 0x09 && cNextCh <= 0x0d) ) && !IsEOF() )
{
@@ -353,7 +351,7 @@ CSS1Token CSS1Parser::GetNextToken()
cNextCh = GetNextChar();
}
// und nun Schauen, ob es eine Einheit gibt
// check now, of there is an unit
switch( cNextCh )
{
case '%': // PERCENTAGE
@@ -372,14 +370,14 @@ CSS1Token CSS1Parser::GetNextToken()
case 'm':
case 'M': // LENGTH mm | LENGTH IDENT
{
// die aktuelle Position retten
// save current position
sal_Int32 nInPosOld = nInPos;
sal_Unicode cNextChOld = cNextCh;
sal_uLong nlLineNrOld = nlLineNr;
sal_uLong nlLinePosOld = nlLinePos;
bool bEOFOld = bEOF;
// den naechsten Identifer scannen
// parse the next identifier
OUString aIdent;
OUStringBuffer sTmpBuffer2(64);
do {
@@ -390,7 +388,7 @@ CSS1Token CSS1Parser::GetNextToken()
aIdent += sTmpBuffer2.makeStringAndClear();
// Ist es eine Einheit?
// Is it an unit?
const sal_Char *pCmp1 = nullptr, *pCmp2 = nullptr, *pCmp3 = nullptr;
double nScale1 = 1., nScale2 = 1.;
CSS1Token nToken1 = CSS1_LENGTH,
@@ -435,7 +433,7 @@ CSS1Token CSS1Parser::GetNextToken()
}
double nScale = 0.0;
OSL_ENSURE( pCmp1, "Wo kommt das erste Zeichen her?" );
OSL_ENSURE( pCmp1, "Where does the first digit come from?" );
if( aIdent.equalsIgnoreAsciiCaseAscii( pCmp1 ) )
{
nScale = nScale1;
@@ -485,7 +483,7 @@ CSS1Token CSS1Parser::GetNextToken()
break;
case ':': // ':'
// link/visited/active abfangen !!!
// catch link/visited/active !!!
nRet = CSS1_COLON;
break;
@@ -523,14 +521,14 @@ CSS1Token CSS1Parser::GetNextToken()
('a'<=cNextCh && 'f'>=cNextCh) ||
('A'<=cNextCh && 'F'>=cNextCh) )
{
// die aktuelle Position retten
// save current position
sal_Int32 nInPosSave = nInPos;
sal_Unicode cNextChSave = cNextCh;
sal_uLong nlLineNrSave = nlLineNr;
sal_uLong nlLinePosSave = nlLinePos;
bool bEOFSave = bEOF;
// erstmal versuchen eine Hex-Zahl zu scannen
// first try to parse a hex digit
OUStringBuffer sTmpBuffer(6);
do {
sTmpBuffer.append( cNextCh );
@@ -543,7 +541,7 @@ CSS1Token CSS1Parser::GetNextToken()
if( sTmpBuffer.getLength()==6 || sTmpBuffer.getLength()==3 )
{
// wir haben eine hexadezimale Farbe gefunden
// we found a color in hex
aToken += sTmpBuffer.makeStringAndClear();
nRet = CSS1_HEXCOLOR;
bNextCh = false;
@@ -551,7 +549,7 @@ CSS1Token CSS1Parser::GetNextToken()
break;
}
// sonst versuchen wir es mit einer Zahl
// otherwise we try a number
nInPos = nInPosSave;
cNextCh = cNextChSave;
nlLineNr = nlLineNrSave;
@@ -586,7 +584,7 @@ CSS1Token CSS1Parser::GetNextToken()
bool bHexColor = true;
// den naechsten Identifer scannen
// parse the next identifier
OUStringBuffer sTmpBuffer(64);
do {
sTmpBuffer.append( cNextCh );
@@ -640,7 +638,7 @@ CSS1Token CSS1Parser::GetNextToken()
nRet = CSS1_IDENT;
}
}
// Fehlerbehandlung: Zeichen ignorieren
// error handling: ignore digit
break;
}
if( bNextCh )
@@ -651,13 +649,13 @@ CSS1Token CSS1Parser::GetNextToken()
return nRet;
}
// Dies folegenden Funktionen realisieren den in
// These functions implement the parser described in
// http://www.w3.orh/pub/WWW/TR/WD-css1.html
// bzw. http://www.w3.orh/pub/WWW/TR/WD-css1-960220.html
// http://www.w3.orh/pub/WWW/TR/WD-css1.html
// resp. http://www.w3.orh/pub/WWW/TR/WD-css1-960220.html
// beschriebenen Parser fuer CSS1. Es handelt sich um eine direkte
// Umsetzung der dort beschriebenen Grammatik
// for CSS1. It's a direct implementation of the
// described Lex grammar.
// stylesheet
// : import* rule*
@@ -676,13 +674,13 @@ void CSS1Parser::ParseStyleSheet()
bool bDone = false;
while( !bDone && IsParserWorking() )
{
LOOP_CHECK_CHECK( "Endlos-Schleife in ParseStyleSheet()/import *" )
LOOP_CHECK_CHECK( "Infinite loop in ParseStyleSheet()/import *" )
switch( nToken )
{
case CSS1_IMPORT_SYM:
// IMPORT_SYM url
// url ueberspringen wir ungeprueft
// URL are skipped without checks
nToken = GetNextToken();
break;
case CSS1_IDENT: // Look-Aheads
@@ -693,7 +691,7 @@ void CSS1Parser::ParseStyleSheet()
bDone = true;
break;
default:
// Fehlerbehandlung: ueberlesen
// error handling: ignore
break;
}
@@ -706,7 +704,7 @@ void CSS1Parser::ParseStyleSheet()
// rule *
while( IsParserWorking() )
{
LOOP_CHECK_CHECK( "Endlos-Schleife in ParseStyleSheet()/rule *" )
LOOP_CHECK_CHECK( "Infinite loop in ParseStyleSheet()/rule *" )
switch( nToken )
{
@@ -718,7 +716,7 @@ void CSS1Parser::ParseStyleSheet()
ParseRule();
break;
default:
// Fehlerbehandlung: ueberlesen
// error handling: ignore
nToken = GetNextToken();
break;
}
@@ -736,7 +734,7 @@ void CSS1Parser::ParseRule()
if( !pSelector )
return;
// Selektor verarbeiten
// process selector
if( SelectorParsed( pSelector, true ) )
delete pSelector;
@@ -745,9 +743,9 @@ void CSS1Parser::ParseRule()
// [ ',' selector ]*
while( CSS1_COMMA==nToken && IsParserWorking() )
{
LOOP_CHECK_CHECK( "Endlos-Schleife in ParseRule()/selector *" )
LOOP_CHECK_CHECK( "Infinite loop in ParseRule()/selector *" )
// ',' ueberelesen
// ignore ','
nToken = GetNextToken();
// selector
@@ -755,7 +753,7 @@ void CSS1Parser::ParseRule()
if( !pSelector )
return;
// Selektor verarbeiten
// process selector
if( SelectorParsed( pSelector, false ) )
delete pSelector;
}
@@ -771,7 +769,7 @@ void CSS1Parser::ParseRule()
if( !pExpr )
return;
// expression verarbeiten
// process expression
if( DeclarationParsed( aProperty, pExpr ) )
delete pExpr;
@@ -780,7 +778,7 @@ void CSS1Parser::ParseRule()
// [ ';' declaration ]*
while( CSS1_SEMICOLON==nToken && IsParserWorking() )
{
LOOP_CHECK_CHECK( "Endlos-Schleife in ParseRule()/declaration *" )
LOOP_CHECK_CHECK( "Infinite loop in ParseRule()/declaration *" )
// ';'
nToken = GetNextToken();
@@ -791,7 +789,7 @@ void CSS1Parser::ParseRule()
CSS1Expression *pExp = ParseDeclaration( aProperty );
if( pExp )
{
// expression verarbeiten
// process expression
if( DeclarationParsed( aProperty, pExp ) )
delete pExp;
}
@@ -835,7 +833,7 @@ CSS1Selector *CSS1Parser::ParseSelector()
// simple_selector+
while( !bDone && IsParserWorking() )
{
LOOP_CHECK_CHECK( "Endlos-Schleife in ParseSelector()" )
LOOP_CHECK_CHECK( "Infinite loop in ParseSelector()" )
bool bNextToken = true;
@@ -863,13 +861,13 @@ CSS1Selector *CSS1Parser::ParseSelector()
}
else
{
// class fehlt
// missing class
return pRoot;
}
}
else
{
// das war jetzt ein Look-Ahead
// that was a look-ahead
bNextToken = false;
}
pNew = new CSS1Selector( eType, aElement );
@@ -888,7 +886,7 @@ CSS1Selector *CSS1Parser::ParseSelector()
}
else
{
// class fehlt
// missing class
return pRoot;
}
break;
@@ -905,7 +903,7 @@ CSS1Selector *CSS1Parser::ParseSelector()
}
else
{
// id_selector fehlt
// missing id_selector
return pRoot;
}
break;
@@ -918,16 +916,16 @@ CSS1Selector *CSS1Parser::ParseSelector()
break;
default:
// wir wissen nicht was kommt, also aufhoehren
// stop because we don't know what's next
bDone = true;
break;
}
// falls ein Selektor angelegt wurd, ihn speichern
// if created a new selector then save it
if( pNew )
{
OSL_ENSURE( (pRoot!=nullptr) == (pLast!=nullptr),
"Root-Selektor, aber kein Last" );
"Root-Selector, but no Last" );
if( pLast )
pLast->SetNext( pNew );
else
@@ -943,7 +941,7 @@ CSS1Selector *CSS1Parser::ParseSelector()
if( !pRoot )
{
// simple_selector fehlt
// missing simple_selector
return pRoot;
}
@@ -959,7 +957,7 @@ CSS1Selector *CSS1Parser::ParseSelector()
}
else
{
// pseudo_element fehlt
// missing pseudo_element
return pRoot;
}
}
@@ -988,8 +986,8 @@ CSS1Selector *CSS1Parser::ParseSelector()
// property
// : ident
// das Vorzeichen wird nur fuer numerische Werte (ausser PERCENTAGE)
// beruecksichtigt und wird auf nValue angewendet!
// the sign is only used for numeric values (except PERCENTAGE)
// and it's applied on nValue!
CSS1Expression *CSS1Parser::ParseDeclaration( OUString& rProperty )
{
CSS1Expression *pRoot = nullptr, *pLast = nullptr;
@@ -997,7 +995,7 @@ CSS1Expression *CSS1Parser::ParseDeclaration( OUString& rProperty )
// property
if( CSS1_IDENT != nToken )
{
// property fehlt
// missing property
return pRoot;
}
rProperty = aToken;
@@ -1007,14 +1005,14 @@ CSS1Expression *CSS1Parser::ParseDeclaration( OUString& rProperty )
// ':'
if( CSS1_COLON != nToken )
{
// ':' fehlt
// missing ':'
return pRoot;
}
nToken = GetNextToken();
// term [operator term]*
// hier sind wir sehr lax, was die Syntax angeht, sollte aber kein
// Problem sein
// here we're pretty lax regarding the syntax, but this shouldn't
// be a problem
bool bDone = false;
sal_Unicode cSign = 0, cOp = 0;
CSS1Expression *pNew = nullptr;
@@ -1023,7 +1021,7 @@ CSS1Expression *CSS1Parser::ParseDeclaration( OUString& rProperty )
while( !bDone && IsParserWorking() )
{
LOOP_CHECK_CHECK( "Endlos-Schleife in ParseDeclaration()" )
LOOP_CHECK_CHECK( "Infinite loop in ParseDeclaration()" )
switch( nToken )
{
@@ -1050,7 +1048,7 @@ CSS1Expression *CSS1Parser::ParseDeclaration( OUString& rProperty )
case CSS1_RGB:
case CSS1_HEXCOLOR:
pNew = new CSS1Expression( nToken, aToken, nValue, cOp );
nValue = 0; // sonst landet das auch im naechsten Ident
nValue = 0; // otherwise this also is applied to next ident
cSign = 0;
cOp = 0;
break;
@@ -1070,11 +1068,11 @@ CSS1Expression *CSS1Parser::ParseDeclaration( OUString& rProperty )
break;
}
// falls ein Expression angelegt wurde, diesen speichern
// if created a new expression save it
if( pNew )
{
OSL_ENSURE( (pRoot!=nullptr) == (pLast!=nullptr),
"Root-Selektor, aber kein Last" );
"Root-Selector, but no Last" );
if( pLast )
pLast->SetNext( pNew );
else
@@ -1090,7 +1088,7 @@ CSS1Expression *CSS1Parser::ParseDeclaration( OUString& rProperty )
if( !pRoot )
{
// term fehlt
// missing term
return pRoot;
}
@@ -1134,7 +1132,7 @@ bool CSS1Parser::ParseStyleSheet( const OUString& rIn )
|| '\t'==c || '\r'==c || '\n'==c ) )
aTmp = aTmp.copy( 0, aTmp.getLength()-1 );
// SGML-Kommentare entfernen
// remove SGML comments
if( aTmp.getLength() >= 4 &&
aTmp.startsWith( "<!--" ) )
aTmp = aTmp.copy( 4, aTmp.getLength() - 4 );
@@ -1173,7 +1171,7 @@ bool CSS1Parser::ParseStyleOption( const OUString& rIn )
return false;
}
// expression verarbeiten
// process expression
if( DeclarationParsed( aProperty, pExpr ) )
delete pExpr;
@@ -1182,7 +1180,7 @@ bool CSS1Parser::ParseStyleOption( const OUString& rIn )
// [ ';' declaration ]*
while( CSS1_SEMICOLON==nToken && IsParserWorking() )
{
LOOP_CHECK_CHECK( "Endlos-Schleife in ParseStyleOption()" )
LOOP_CHECK_CHECK( "Infinite loop in ParseStyleOption()" )
nToken = GetNextToken();
if( CSS1_IDENT==nToken )
@@ -1190,7 +1188,7 @@ bool CSS1Parser::ParseStyleOption( const OUString& rIn )
CSS1Expression *pExp = ParseDeclaration( aProperty );
if( pExp )
{
// expression verarbeiten
// process expression
if( DeclarationParsed( aProperty, pExp ) )
delete pExp;
}
@@ -1202,14 +1200,14 @@ bool CSS1Parser::ParseStyleOption( const OUString& rIn )
bool CSS1Parser::SelectorParsed( CSS1Selector* /* pSelector */, bool /*bFirst*/ )
{
// Selektor loeschen
// delete selector
return true;
}
bool CSS1Parser::DeclarationParsed( const OUString& /*rProperty*/,
const CSS1Expression * /* pExpr */ )
{
// Deklaration loeschen
// delete declaration
return true;
}
@@ -1225,13 +1223,13 @@ CSS1Expression::~CSS1Expression()
void CSS1Expression::GetURL( OUString& rURL ) const
{
OSL_ENSURE( CSS1_URL==eType, "CSS1-Ausruck ist keine Farbe URL" );
OSL_ENSURE( CSS1_URL==eType, "CSS1-Expression is not URL" );
OSL_ENSURE( aValue.startsWithIgnoreAsciiCase( "url" ) &&
aValue.getLength() > 5 &&
'(' == aValue[3] &&
')' == aValue[aValue.getLength()-1],
"keine gueltiges URL(...)" );
"no valid URL(...)" );
if( aValue.getLength() > 5 )
{
@@ -1253,7 +1251,7 @@ bool CSS1Expression::GetColor( Color &rColor ) const
{
OSL_ENSURE( CSS1_IDENT==eType || CSS1_RGB==eType ||
CSS1_HEXCOLOR==eType || CSS1_STRING==eType,
"CSS1-Ausruck kann keine Farbe sein" );
"CSS1-Expression cannot be colour" );
bool bRet = false;
sal_uInt32 nColor = SAL_MAX_UINT32;
@@ -1297,7 +1295,7 @@ bool CSS1Expression::GetColor( Color &rColor ) const
rColor.SetGreen( aColors[1] );
rColor.SetBlue( aColors[2] );
bRet = true; // etwas anderes als eine Farbe kann es nicht sein
bRet = true; // something different than a colour isn't possible
}
break;
@@ -1314,7 +1312,7 @@ bool CSS1Expression::GetColor( Color &rColor ) const
SAL_FALLTHROUGH;
case CSS1_HEXCOLOR:
{
// HACK fuer MS-IE: DIe Farbe kann auch in einem String stehen
// MS-IE hack: colour can also be a string
sal_Int32 nOffset = CSS1_STRING==eType ? 1 : 0;
bool bDouble = aValue.getLength()-nOffset == 3;
sal_Int32 i = nOffset, nEnd = (bDouble ? 3 : 6) + nOffset;