From ce6cb1db65054b8261b16f1542d03de6ea0e054c Mon Sep 17 00:00:00 2001 From: Philipp Riemer Date: Sun, 9 Jun 2013 00:07:31 +0200 Subject: fdo#39468: Translate German comments in sw/source/core/edit Change-Id: I48682db4a27be298b8c0392603879d2e12f24cd7 Reviewed-on: https://gerrit.libreoffice.org/4203 Reviewed-by: Philipp Riemer Tested-by: Philipp Riemer --- sw/source/core/edit/autofmt.cxx | 294 ++++++++++++++++++--------------------- sw/source/core/edit/eddel.cxx | 77 +++++----- sw/source/core/edit/edfcol.cxx | 7 +- sw/source/core/edit/edfld.cxx | 124 +++++------------ sw/source/core/edit/edglbldc.cxx | 20 +-- sw/source/core/edit/edglss.cxx | 54 +++---- sw/source/core/edit/editsh.cxx | 111 ++++++--------- sw/source/core/edit/edlingu.cxx | 201 ++++++++++---------------- sw/source/core/edit/ednumber.cxx | 55 ++++---- sw/source/core/edit/edtab.cxx | 25 ++-- sw/source/core/edit/edtox.cxx | 62 +++------ sw/source/core/edit/edundo.cxx | 30 ++-- sw/source/core/edit/edws.cxx | 54 +++---- 13 files changed, 433 insertions(+), 681 deletions(-) diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index e8a553ba552d..eb6e8cf15497 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -249,7 +249,7 @@ SwTxtFrm* SwAutoFormat::GetFrm( const SwTxtNode& rTxtNd ) const { // get the Frame const SwCntntFrm *pFrm = rTxtNd.getLayoutFrm( pEditShell->GetLayout() ); - OSL_ENSURE( pFrm, "zum Autoformat muss das Layout vorhanden sein" ); + OSL_ENSURE( pFrm, "For Autoformat a Layout is needed" ); if( aFlags.bAFmtByInput && !pFrm->IsValid() ) { SwRect aTmpFrm( pFrm->Frm() ); @@ -298,7 +298,7 @@ void SwAutoFormat::_SetRedlineTxt( sal_uInt16 nActionId ) } #if OSL_DEBUG_LEVEL > 0 else - sTxt = OUString("Action-Text fehlt"); + sTxt = OUString("Action text is missing"); #endif pDoc->SetAutoFmtRedlineComment( &sTxt, nSeqNo ); @@ -516,8 +516,7 @@ sal_Bool SwAutoFormat::IsNoAlphaLine( const SwTxtNode& rNd ) const const String& rStr = rNd.GetTxt(); if( !rStr.Len() ) return sal_False; - // oder besser: ueber die Anzahl von Alpha/Num- und !AN-Zeichen - // bestimmen. + // or better: determine via number of AlphaNum and !AlphaNum characters xub_StrLen nANChar = 0, nBlnk = 0; CharClass& rCC = GetCharClass( rNd.GetSwAttrSet().GetLanguage().GetLanguage() ); @@ -527,7 +526,7 @@ sal_Bool SwAutoFormat::IsNoAlphaLine( const SwTxtNode& rNd ) const else if( rCC.isLetterNumeric( rStr, n )) ++nANChar; - // sind zu 75% keine Alpha-Nummerische-Zeichen, dann sal_True + // If there are 75% of non-alphanumeric characters, then sal_True sal_uLong nLen = rStr.Len() - nBlnk; nLen = ( nLen * 3 ) / 4; // long overflow, if the strlen > sal_uInt16 return xub_StrLen(nLen) < (rStr.Len() - nANChar - nBlnk); @@ -566,7 +565,7 @@ bool SwAutoFormat::DoUnderline() if( 2 < nCnt ) { - // dann unterstreiche mal den vorherigen Absatz, wenn es diesen gibt! + // then underline the previous paragraph if one exists DelEmptyLine( false ); aDelPam.SetMark(); aDelPam.GetMark()->nContent = 0; @@ -662,7 +661,7 @@ bool SwAutoFormat::DoTable() if( 1 < aPosArr.size() ) { - // Ausrichtung vom Textnode besorgen: + // get the text node's alignment sal_uInt16 nColCnt = aPosArr.size() - 1; SwTwips nSttPos = aPosArr[ 0 ]; sal_Int16 eHori; @@ -675,8 +674,7 @@ bool SwAutoFormat::DoTable() if( nSttPos ) { eHori = text::HoriOrientation::NONE; - // dann muss als letztes noch die akt. FrameBreite - // ins Array + // then - as last - we need to add the current frame width into the array aPosArr.push_back( static_cast(pAktTxtFrm->Frm().Width()) ); } else @@ -684,7 +682,7 @@ bool SwAutoFormat::DoTable() break; } - // dann erzeuge eine Tabelle, die den Zeichen entspricht + // then create a table that matches the character DelEmptyLine(); SwNodeIndex aIdx( aDelPam.GetPoint()->nNode ); aDelPam.Move( fnMoveForward ); @@ -704,7 +702,7 @@ String& SwAutoFormat::DelLeadingBlanks( String& rStr ) const for( nL = rStr.Len(), n = 0; n < nL && IsSpace( rStr.GetChar(n) ); ++n ) ; - if( n ) // keine Spaces + if( n ) // no Spaces rStr.Erase( 0, n ); return rStr; } @@ -718,7 +716,7 @@ String& SwAutoFormat::DelTrailingBlanks( String& rStr ) const while( --n && IsSpace( rStr.GetChar( n ) ) ) ; - if( n+1 != nL ) // keine Spaces + if( n+1 != nL ) // no Spaces rStr.Erase( n+1 ); return rStr; } @@ -767,7 +765,7 @@ bool SwAutoFormat::IsFirstCharCapital( const SwTxtNode& rNd ) const sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, String* pPreFix, String* pPostFix, String* pNumTypes ) const { - // Teste auf 1.) / 1. / 1.1.1 / (1). / (1) / .... + // check for 1.) / 1. / 1.1.1 / (1). / (1) / .... const OUString& rTxt = rNd.GetTxt(); xub_StrLen nPos = rPos; int eScan = NONE; @@ -788,7 +786,7 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, { if( eScan & DELIM ) { - if( eScan & CHG ) // nicht wenns mit einer Zahl beginnt + if( eScan & CHG ) // not if it starts with a number { ++nDigitLvl; if( pPostFix ) @@ -803,12 +801,12 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, else if( pNumTypes && !(eScan & DIGIT) ) *pNumTypes += (sal_Unicode)('0' + SVX_NUM_ARABIC); - eScan &= ~DELIM; // Delim raus + eScan &= ~DELIM; // remvoe Delim if( 0 != (eScan & ~CHG) && DIGIT != (eScan & ~CHG)) return USHRT_MAX; - eScan |= DIGIT; // Digit rein - if( 3 == ++nDigitCnt ) // mehr als 2 Nummern sind kein Enum mehr + eScan |= DIGIT; // add Digit + if( 3 == ++nDigitCnt ) // more than 2 numbers are not an enum anymore return USHRT_MAX; nStart *= 10; @@ -822,9 +820,8 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, sal_Unicode cLow = rCC.lowercase(rTxt, nPos, 1)[0], cNumTyp; int eTmpScan; - // roemische Zeichen sind "mdclxvi". Da man aber eher mal eine - // Numerierung mit c oder d anfangen will, werden diese erstmal - // zu chars und spaeter ggfs. zu romischen Zeichen! + // Roman numbers are "mdclxvi". Since we want to start numbering with c or d more often, + // convert first to characters and later to roman numbers if needed. #ifdef WITH_ALPHANUM_AS_NUMFMT //detection of 'c' and 'd' a ROMAN numbering should not be done here if( 256 > cLow &&( (eScan & (LOWER_ROMAN|UPPER_ROMAN)) @@ -845,7 +842,7 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, cNumTyp = '0' + SVX_NUM_CHARS_LOWER_LETTER, eTmpScan = LOWER_ALPHA; - //ggfs. auf roemische Zeichen umschalten (nur bei c/d!)? + // Switch to roman numbers (only for c/d!) if( 1 == nDigitCnt && ( eScan & (UPPER_ALPHA|LOWER_ALPHA) ) && ( 3 == nStart || 4 == nStart) && 256 > cLow && strchr( "mdclxvi", cLow ) && @@ -866,7 +863,7 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, if( eScan & DELIM ) { - if( eScan & CHG ) // nicht wenns mit einer Zahl beginnt + if( eScan & CHG ) // not if it starts with a number { ++nDigitLvl; if( pPostFix ) @@ -880,20 +877,20 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTxtNode& rNd, xub_StrLen& rPos, else if( pNumTypes && !(eScan & eTmpScan) ) *pNumTypes += cNumTyp; - eScan &= ~DELIM; // Delim raus + eScan &= ~DELIM; // remove Delim - // falls ein andere Type gesetzt ist, brechen wir ab + // if another type is set, stop here if( 0 != ( eScan & ~CHG ) && eTmpScan != ( eScan & ~CHG )) return USHRT_MAX; if( eTmpScan & (UPPER_ALPHA | LOWER_ALPHA) ) { - // Buchstaben nur zulassen, wenn sie einmalig vorkommen + // allow characters only if they appear once return USHRT_MAX; } else { - // roemische Zahlen: checke ob das gueltige Zeichen sind + // roman numbers, check if valid characters sal_uInt16 nVal; bool bError = false; switch( cLow ) @@ -956,7 +953,7 @@ CHECK_ROMAN_5: if( bError ) return USHRT_MAX; } - eScan |= eTmpScan; // Digit rein + eScan |= eTmpScan; // add Digit ++nDigitCnt; } else if( (256 > cCurrentChar && @@ -970,7 +967,7 @@ CHECK_ROMAN_5: nOpeningParentheses++; else if(cCurrentChar == ')'|| cCurrentChar == 0xFF08) nClosingParentheses++; - // nur wenn noch keine Zahlen gelesen wurden! + // only if no numbers were read until here if( pPreFix && !( eScan & ( NO_DELIM | CHG )) ) *pPreFix += rTxt[nPos]; else if( pPostFix ) @@ -983,8 +980,8 @@ CHECK_ROMAN_5: (*pPreFix += (sal_Unicode)1) += OUString::number( nStart ); } - eScan &= ~NO_DELIM; // Delim raus - eScan |= DELIM; // Digit rein + eScan &= ~NO_DELIM; // remove Delim + eScan |= DELIM; // add Digit nDigitCnt = 0; nStart = 0; } @@ -997,7 +994,7 @@ CHECK_ROMAN_5: (nOpeningParentheses > nClosingParentheses)) return USHRT_MAX; - if( (NO_DELIM & eScan) && pPreFix ) // den letzen nicht vergessen + if( (NO_DELIM & eScan) && pPreFix ) // do not forget the last one (*pPreFix += (sal_Unicode)1) += OUString::number( nStart ); rPos = nPos; @@ -1011,8 +1008,7 @@ void SwAutoFormat::SetColl( sal_uInt16 nId, bool bHdLineOrText ) aDelPam.GetPoint()->nNode = aNdIdx; aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 ); - // behalte harte Tabs, Ausrichtung, Sprache, Silbentrennung, - // DropCaps und fast alle Frame-Attribute + // keep hard tabs, alignment, language, hyphenation, DropCaps and nearly all frame attributes SfxItemSet aSet( pDoc->GetAttrPool(), RES_PARATR_ADJUST, RES_PARATR_ADJUST, RES_PARATR_TABSTOP, RES_PARATR_DROP, @@ -1023,9 +1019,7 @@ void SwAutoFormat::SetColl( sal_uInt16 nId, bool bHdLineOrText ) if( pAktTxtNd->HasSwAttrSet() ) { aSet.Put( *pAktTxtNd->GetpSwAttrSet() ); - // einige Sonderbedingungen: - // HeaderLine/Textkoerper: nur zentriert oder rechts mitnehmem - // sonst nur den Blocksatz + // take HeaderLine/TextBody only if centered or right aligned, otherwise only justification SvxAdjustItem* pAdj; if( SFX_ITEM_SET == aSet.GetItemState( RES_PARATR_ADJUST, sal_False, (const SfxPoolItem**)&pAdj )) @@ -1044,8 +1038,8 @@ void SwAutoFormat::SetColl( sal_uInt16 nId, bool bHdLineOrText ) bool SwAutoFormat::HasSelBlanks( SwPaM& rPam ) const { - // noch ein Blank am Anfang oder Ende ? - // nicht loeschen, wird wieder eingefuegt. + // Is there a Blank at the beginning or end? + // Do not delete it, it will be inserted again. SwPosition * pPos = rPam.End(); xub_StrLen nBlnkPos = pPos->nContent.GetIndex(); SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode(); @@ -1086,7 +1080,7 @@ bool SwAutoFormat::HasBreakAttr( const SwTxtNode& rTxtNd ) const } -// ist ein Punkt am Ende ?? +/// Is there a dot at the end? bool SwAutoFormat::IsSentenceAtEnd( const SwTxtNode& rTxtNd ) const { const String& rStr = rTxtNd.GetTxt(); @@ -1100,14 +1094,14 @@ bool SwAutoFormat::IsSentenceAtEnd( const SwTxtNode& rTxtNd ) const } -// loesche im Node Anfang oder/und Ende +/// Delete beginning and/or end in a node void SwAutoFormat::DeleteAktPara( bool bStart, bool bEnd ) { if( aFlags.bAFmtByInput ? aFlags.bAFmtByInpDelSpacesAtSttEnd : aFlags.bAFmtDelSpacesAtSttEnd ) { - // Loesche Blanks am Ende vom akt. und am Anfang vom naechsten + // delete blanks at the end of the current and at the beginning of the next one aDelPam.DeleteMark(); aDelPam.GetPoint()->nNode = aNdIdx; xub_StrLen nPos(0); @@ -1136,8 +1130,7 @@ void SwAutoFormat::DeleteSel( SwPaM& rDelPam ) { if( aFlags.bWithRedlining ) { - // damit der DelPam auch verschoben wird, in den Shell-Cursr-Ring - // mit aufnehmen !! + // Add to Shell-Cursor-Ring so that DelPam will be moved as well! SwPaM* pShCrsr = pEditShell->_GetCrsr(); SwPaM aTmp( *pAktTxtNd, 0, pShCrsr ); @@ -1146,7 +1139,7 @@ void SwAutoFormat::DeleteSel( SwPaM& rDelPam ) pEditShell->DeleteSel( rDelPam ); - // und den Pam wieder herausnehmen: + // and remove Pam again: Ring *p, *pNext = (Ring*)&rDelPam; do { p = pNext; @@ -1163,7 +1156,7 @@ void SwAutoFormat::DeleteSel( SwPaM& rDelPam ) bool SwAutoFormat::DeleteAktNxtPara( const String& rNxtPara ) { - // Loesche Blanks am Ende vom akt. und am Anfang vom naechsten + // delete blanks at the end of the current and at the beginning of the next one aDelPam.DeleteMark(); aDelPam.GetPoint()->nNode = aNdIdx; aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, @@ -1174,7 +1167,7 @@ bool SwAutoFormat::DeleteAktNxtPara( const String& rNxtPara ) SwTxtNode* pTNd = aDelPam.GetNode()->GetTxtNode(); if( !pTNd ) { - // dann nur bis zum Ende von Absatz loeschen + // then delete only up to end of the paragraph aDelPam.GetPoint()->nNode--; aDelPam.GetPoint()->nContent = pAktTxtNd->GetTxt().getLength(); } @@ -1182,8 +1175,8 @@ bool SwAutoFormat::DeleteAktNxtPara( const String& rNxtPara ) aDelPam.GetPoint()->nContent.Assign( pTNd, GetLeadingBlanks( rNxtPara )); - // noch ein Blank am Anfang oder Ende ? - // nicht loeschen, wird wieder eingefuegt. + // Is there a Blank at the beginning or end? + // Do not delete it, it will be inserted again. bool bHasBlnks = HasSelBlanks( aDelPam ); if( *aDelPam.GetPoint() != *aDelPam.GetMark() ) @@ -1197,7 +1190,7 @@ bool SwAutoFormat::DeleteAktNxtPara( const String& rNxtPara ) void SwAutoFormat::DelEmptyLine( bool bTstNextPara ) { SetRedlineTxt( STR_AUTOFMTREDL_DEL_EMPTY_PARA ); - // Loesche Blanks den leeren Absatz + // delete blanks in empty paragraph aDelPam.DeleteMark(); aDelPam.GetPoint()->nNode = aNdIdx; aDelPam.GetPoint()->nContent.Assign( @@ -1207,12 +1200,11 @@ void SwAutoFormat::DelEmptyLine( bool bTstNextPara ) aDelPam.GetMark()->nNode--; SwTxtNode* pTNd = aDelPam.GetNode( sal_False )->GetTxtNode(); if( pTNd ) - // erstmal den vorherigen Textnode benutzen. + // first use the previous text node aDelPam.GetMark()->nContent.Assign(pTNd, pTNd->GetTxt().getLength()); else if( bTstNextPara ) { - // dann versuche den naechsten (am Anfang vom Dok, Tabellen-Zellen, - // Rahmen, ... + // then try the next (at the beginning of a Doc, table cells, borders, ...) aDelPam.GetMark()->nNode += 2; pTNd = aDelPam.GetNode( sal_False )->GetTxtNode(); if( pTNd ) @@ -1241,7 +1233,7 @@ void SwAutoFormat::DelMoreLinesBlanks( bool bWithLineBreaks ) ? aFlags.bAFmtByInpDelSpacesBetweenLines : aFlags.bAFmtDelSpacesBetweenLines ) { - // loesche alle "Blanks" Links und Rechts vom Einzug + // delete all blanks on the left and right of the indentation aDelPam.DeleteMark(); aDelPam.GetPoint()->nNode = aNdIdx; aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 ); @@ -1272,7 +1264,7 @@ void SwAutoFormat::DelMoreLinesBlanks( bool bWithLineBreaks ) } - // loesche den vorherigen Absatz +// delete the previous paragraph void SwAutoFormat::DelPrevPara() { aDelPam.DeleteMark(); @@ -1296,7 +1288,7 @@ void SwAutoFormat::BuildIndent() { SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_INDENT ); - // lese alle nachfolgenden Absaetze die zu diesem Einzug gehoeren + // read all succeeding paragraphs that belong to this indentation bool bBreak = true; if( bMoreLines ) DelMoreLinesBlanks( true ); @@ -1334,7 +1326,7 @@ void SwAutoFormat::BuildIndent() void SwAutoFormat::BuildTextIndent() { SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT); - // lese alle nachfolgenden Absaetze die zu diesem Einzug gehoeren + // read all succeeding paragraphs that belong to this indentation bool bBreak = true; if( bMoreLines ) DelMoreLinesBlanks( true ); @@ -1373,8 +1365,7 @@ void SwAutoFormat::BuildTextIndent() void SwAutoFormat::BuildText() { SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_TEXT ); - // lese alle nachfolgenden Absaetze die zu diesem Text - // ohne Einzug gehoeren + // read all succeeding paragraphs that belong to this text without indentation bool bBreak = true; if( bMoreLines ) DelMoreLinesBlanks(); @@ -1415,7 +1406,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) bool bBreak = true; - // als erstes den akt. Einzug bestimmen und die Framebreite bestimmen + // first, determine current indentation and frame width SwTwips nFrmWidth = pAktTxtFrm->Prt().Width();; SwTwips nLeftTxtPos; { @@ -1443,7 +1434,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) bool bChgBullet = false, bChgEnum = false; xub_StrLen nAutoCorrPos = 0; - // falls die Numerierung gesetzt werden, die akt. besorgen + // if numbering is set, get the current one SwNumRule aRule( pDoc->GetUniqueNumRuleName(), // #i89178# numfunc::GetDefaultPositionAndSpaceMode() ); @@ -1452,7 +1443,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) if( aFlags.bSetNumRule && 0 != (pCur = pAktTxtNd->GetNumRule()) ) aRule = *pCur; - // ersetze das Bullet-Zeichen mit dem definiertem + // replace bullet character with defined one const String& rStr = pAktTxtNd->GetTxt(); xub_StrLen nTxtStt = 0, nOrigTxtStt = 0; const sal_Unicode* pFndBulletChr; @@ -1468,7 +1459,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) SwCharFmt* pCFmt = pDoc->GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL ); bChgBullet = true; - // wurde das Format schon mal angepasst? + // Was the format already somewhere adjusted? if( !aRule.GetNumFmt( nLvl ) ) { int nBulletPos = pFndBulletChr - pBulletChar; @@ -1530,11 +1521,10 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) } else { - // dann ist das eine Nummerierung + // Then it is a numbering - //JP 21.11.97: Der NumLevel wird entweder der DigitLevel oder - // wenn der nicht vorhanden oder 0 ist, durch den - // (Einrueckungs-)Level. + //JP 21.11.97: The NumLevel is either the DigitLevel or, if the latter is not existent or 0, + // it is determined by the indentation level. String aPostFix, aPreFix, aNumTypes; if( USHRT_MAX != ( nDigitLevel = GetDigitLevel( *pAktTxtNd, nTxtStt, @@ -1542,8 +1532,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) { bChgEnum = true; - // Ebene 0 und Einrueckung dann wird die Ebene durch den linken - // Einzug und der default NumEinrueckung bestimmt. + // Level 0 and Indentation, determine level by left indentation and default NumIndent if( !nDigitLevel && nLeftTxtPos ) nLvl = std::min( sal_uInt16( nLeftTxtPos / lNumIndent ), sal_uInt16( MAXLEVEL - 1 ) ); @@ -1553,7 +1542,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) if( bChgEnum && aFlags.bSetNumRule ) { - if( !pCur ) // NumRule anpassen, wenn sie neu ist + if( !pCur ) // adjust NumRule if it is new { SwCharFmt* pCFmt = pDoc->GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL ); @@ -1604,7 +1593,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) aRule.Set( n, aFmt ); } - // passt alles vollstaendig in den Frame? + // Does it fit completely into the frame? bool bDefStep = nFrmWidth < (nSpaceSteps * MAXLEVEL); for( ; n < MAXLEVEL; ++n ) { @@ -1697,7 +1686,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) if( bBreak ) { - AutoCorrect( nAutoCorrPos ); /* Offset wegen Bullet + Tab */ + AutoCorrect( nAutoCorrPos ); /* Offset due to Bullet + Tab */ return; } @@ -1727,11 +1716,9 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) void SwAutoFormat::BuildNegIndent( SwTwips nSpaces ) { SetRedlineTxt( STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT ); - // Test auf Gegenueberstellung: - // (n Worte, durch Space/Tabs getrennt, mit gleicher - // Einrueckung in der 2.Zeile) + // Test of contraposition (n words, divided by spaces/tabs, with same indentation in 2nd line) - // lese alle nachfolgenden Absaetze die zu dieser Aufzaehlung gehoeren + // read all succeeding paragraphs that belong to this enumeration bool bBreak = true; xub_StrLen nSpacePos, nTxtPos = GetBigIndent( nSpacePos ); if( bMoreLines ) @@ -1772,7 +1759,7 @@ void SwAutoFormat::BuildNegIndent( SwTwips nSpaces ) aDelPam.GetPoint()->nNode = aNdIdx; aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, nSpacePos ); - // alten Spaces, usw. loeschen + // delete old Spaces, etc. if( nSpaceStt < nSpacePos ) { aDelPam.SetMark(); @@ -1846,7 +1833,7 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl ) } - // dann lasse doch mal das AutoCorrect auf den akt. TextNode los +/// Start autocorrection for the current TextNode void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) { SvxAutoCorrect* pATst = SvxAutoCorrCfg::Get().GetAutoCorrect(); @@ -1948,8 +1935,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) case '\'': if( ( cChar == '\"' && bReplaceQuote ) || ( cChar == '\'' && bReplaceSglQuote ) ) { - // -------------------------------------- - // beachte: Sonderfall Symbolfonts !!! + // consider Symbolfonts! if( !aFInfo.GetFrm() ) aFInfo.SetFrm( GetFrm( *pAktTxtNd ) ); if( !aFInfo.IsBullet( nPos )) @@ -1996,8 +1982,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) case '_': if( aFlags.bChgWeightUnderl ) { - // -------------------------------------- - // beachte: Sonderfall Symbolfonts !!! + // consider Symbolfonts! if( !aFInfo.GetFrm() ) aFInfo.SetFrm( GetFrm( *pAktTxtNd ) ); if( !aFInfo.IsBullet( nPos )) @@ -2024,7 +2009,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) //#125102# in case of the mode REDLINE_SHOW_DELETE the ** are still contained in pTxt if(0 == (pDoc->GetRedlineMode() & nsRedlineMode_t::REDLINE_SHOW_DELETE)) nPos = aDelPam.GetPoint()->nContent.GetIndex() - 1; - // wurde vorm Start ein Zeichen entfernt? + // Was a character deleted before starting? if (cBlank && cBlank != (*pTxt)[nSttPos - 1]) --nSttPos; } @@ -2053,7 +2038,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) if( !( rAppCC.isLetterNumeric( *pTxt, nPos ) || '/' == cChar )) // '/' should not be a word separator (e.g. '1/2' needs to be handled as one word for replacement) { - --nPos; // ++nPos von dem for ungueltig machen ! + --nPos; // revert ++nPos which was decremented in for loop ++bBreak; } break; @@ -2087,7 +2072,7 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) aDelPam.DeleteMark(); } - continue; // nichts weiter mehr abpruefen + continue; // do not check further } LanguageType eLang = (bGetLanguage && pAktTxtNd) @@ -2113,13 +2098,13 @@ void SwAutoFormat::AutoCorrect( xub_StrLen nPos ) nPos = aDelPam.GetPoint()->nContent.GetIndex(); else { - // Zwei Grossbuchstaben am Wort-Anfang ?? + // two capital letters at the beginning of a word? if( aFlags.bCptlSttWrd ) { SetRedlineTxt( STR_AUTOFMTREDL_CPTL_STT_WORD ); pATst->FnCptlSttWrd( aACorrDoc, *pTxt, nSttPos, nPos, eLang ); } - // Grossbuchstabe am Satz-Anfang ?? + // capital letter at the beginning of a sentence? if( aFlags.bCptlSttSntnc && bFirst ) { SetRedlineTxt( STR_AUTOFMTREDL_CPTL_STT_SENT ); @@ -2158,7 +2143,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, nRedlAutoFmtSeqId( 0 ) { OSL_ENSURE( (pSttNd && pEndNd) || (!pSttNd && !pEndNd), - "Kein Bereich angegeben" ); + "Got no area" ); if( aFlags.bSetNumRule && !aFlags.bAFmtByInput ) aFlags.bSetNumRule = sal_False; @@ -2170,26 +2155,26 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, sal_Bool bNxtAlpha = sal_False; sal_uInt16 nNxtLevel = 0; - // setze den Bereich zum Autoformatieren + // set area for autoformatting if( pSttNd ) { aNdIdx = *pSttNd; - aNdIdx--; // fuer GoNextPara, ein Absatz davor + aNdIdx--; // for GoNextPara, one paragraph prior to that aEndNdIdx = *pEndNd; aEndNdIdx++; - // teste den vorhergehenden TextNode + // check the previous TextNode pNxtNd = aNdIdx.GetNode().GetTxtNode(); bEmptyLine = !pNxtNd || IsEmptyLine( *pNxtNd ) || IsNoAlphaLine( *pNxtNd ); } else - bEmptyLine = true; // am Dokument Anfang + bEmptyLine = true; // at document beginning bEnde = false; - // setze die Werte fuer die Prozent-Anzeige + // set value for percentage display nEndNdIdx = aEndNdIdx.GetIndex(); if( !aFlags.bAFmtByInput ) @@ -2210,8 +2195,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, // save undo state (might be turned off) bool const bUndoState = pDoc->GetIDocumentUndoRedo().DoesUndo(); - // wenn mehrere Zeilen, dann erstmal nicht mit - // dem nachfolgenden Absatz zusammenfassen. + // If multiple lines, then do not merge with next paragraph bMoreLines = false; nLastCalcHeadLvl = nLastCalcEnumLvl = 0; @@ -2219,10 +2203,10 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, sal_uInt16 nLevel = 0; sal_uInt16 nDigitLvl = 0; - // defaulten + // set defaults SwTxtFrmInfo aFInfo( 0 ); - // das ist unser Automat fuer die Auto-Formatierung + // This is the automat for autoformatting eStat = READ_NEXT_PARA; while( !bEnde ) { @@ -2243,9 +2227,9 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, bEmptyLine = true; sal_uLong nOldCnt = pDoc->GetNodes().Count(); DelEmptyLine(); - // wurde wiklich ein Node geloescht ? + // Was there really a deletion of a node? if( nOldCnt != pDoc->GetNodes().Count() ) - aNdIdx--; // nicht den naechsten Absatz ueberspringen + aNdIdx--; // do not skip the next paragraph } eStat = READ_NEXT_PARA; } @@ -2256,11 +2240,10 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, case TST_ALPHA_LINE: if( IsNoAlphaLine( *pAktTxtNd )) { - // erkenne eine Tabellendefinition +---+---+ + // recognize a table definition +---+---+ if( aFlags.bAFmtByInput && aFlags.bCreateTable && DoTable() ) { - //JP 30.09.96: das DoTable() verlaesst sich auf das - // Pop und Move - Crsr nach dem AutoFormat! + //JP 30.09.96: DoTable() builds on PopCrsr and MoveCrsr after AutoFormat! pEdShell->Pop( sal_False ); *pEdShell->GetCrsr() = aDelPam; pEdShell->Push(); @@ -2269,9 +2252,8 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, break; } - // dann teste mal auf 3 "---" oder "===". In dem Fall - // soll der vorherige Absatz unterstrichen und dieser - // geloescht werden! + // Check for 3 "---" or "===". In this case, the previous paragraph should be + // underlined and the current be deleted! if( !DoUnderline() && bReplaceStyles ) { SetColl( RES_POOLCOLL_STANDARD, true ); @@ -2287,21 +2269,18 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, { if( pAktTxtNd->GetNumRule() ) { - // in Numerierung nichts machen, zum naechsten + // do nothing in numbering, go to next bEmptyLine = false; eStat = READ_NEXT_PARA; - // loesche alle Blanks am Anfang/Ende - // und alle mitten drin - //JP 29.04.98: erstmal nur alle "mitten drin". + // delete all blanks at beginning/end and in between + //JP 29.04.98: first only "all in between" DelMoreLinesBlanks( false ); break; } aFInfo.SetFrm( pAktTxtFrm ); - // erstmal: wurden schon mal entsprechende Vorlagen - // vergeben, so behalte die bei, gehe zum - // naechsten Node. + // so far: if there were templates assigned, keep these and go to next node sal_uInt16 nPoolId = pAktTxtNd->GetTxtColl()->GetPoolFmtId(); if( IsPoolUserFmt( nPoolId ) ? !aFlags.bChgUserColl @@ -2314,7 +2293,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, break; } - // teste auf Harte oder aus Vorlagen gesetzte LRSpaces + // check for hard spaces or LRSpaces set by the template if( IsPoolUserFmt( nPoolId ) || RES_POOLCOLL_STANDARD == nPoolId ) { @@ -2326,8 +2305,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, ( 0 != (nSz = pLRSpace->GetTxtFirstLineOfst()) || 0 != pLRSpace->GetTxtLeft() ) ) { - // Ausnahme: Numerierun/Aufzaehlung kann mit Einzug - // existieren!! + // exception: numbering/enumation can have an indentation if( IsEnumericChar( *pAktTxtNd )) { nLevel = CalcLevel( *pAktTxtNd, &nDigitLvl ); @@ -2338,19 +2316,17 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, break; } - - // nie zusammenfassen, so belassen - // (Opt. vielleicht als Ausnahmen nur Einzug) + // never merge (maybe only indent as exception) bMoreLines = true; if( bReplaceStyles ) { - // dann setze doch eine unserer Vorlagen - if( 0 < nSz ) // positiver 1. Zeileneinzug + // then use one of our templates + if( 0 < nSz ) // positive 1st line indentation BuildIndent(); - else if( 0 > nSz ) // negativer 1. Zeileneinzug + else if( 0 > nSz ) // negative 1st line indentation BuildNegIndent( aFInfo.GetLineStart() ); - else if( pLRSpace->GetTxtLeft() ) // ist ein Einzug + else if( pLRSpace->GetTxtLeft() ) // is indentation BuildTextIndent(); } eStat = READ_NEXT_PARA; @@ -2395,10 +2371,10 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, { bEmptyLine = true; eStat = READ_NEXT_PARA; - break; // naechsten Absatz lesen + break; // read next paragraph } - // Teste auf Ueberschrift + // check if headline if( !bEmptyLine || !IsFirstCharCapital( *pAktTxtNd ) || IsBlanksInString( *pAktTxtNd ) ) break; @@ -2407,7 +2383,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, String sEndClrStr( sClrStr ); xub_StrLen nLen = DelTrailingBlanks( sEndClrStr ).Len(); - // nicht, dann teste auf Ueberschrift + // not, then check if headline if( ':' == sEndClrStr.GetChar( nLen - 1 ) ) { { @@ -2425,7 +2401,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, ) { - // eine Ebene runter ? + // one level below? if( nLevel >= MAXLEVEL ) nLevel = MAXLEVEL-1; @@ -2436,7 +2412,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, if( nLastHeadLvl+1 < MAXLEVEL ) ++nLastHeadLvl; } - // eine Ebene hoch ? + // one level above? else if( nLastCalcHeadLvl > nLevel ) { if( nLastHeadLvl ) @@ -2473,15 +2449,15 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, break; case TST_IDENT: - // Spaces am Anfang, dann teste doch mal auf Einzuege + // Spaces at the beginning, check again for indentation if( bMoreLines && nLevel ) { SwTwips nSz = aFInfo.GetFirstIndent(); - if( 0 < nSz ) // positiver 1. Zeileneinzug + if( 0 < nSz ) // positive 1st line indentation BuildIndent(); - else if( 0 > nSz ) // negativer 1. Zeileneinzug + else if( 0 > nSz ) // negative 1st line indentation BuildNegIndent( aFInfo.GetLineStart() ); - else // ist ein Einzug + else // is indentation BuildTextIndent(); eStat = READ_NEXT_PARA; } @@ -2489,7 +2465,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, !bNxtEmpty && !bNxtAlpha && !nNxtLevel && !IsEnumericChar( *pNxtNd ) ) { - // ist ein Einzug + // is an indentation BuildIndent(); eStat = READ_NEXT_PARA; } @@ -2498,16 +2474,16 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, break; case TST_NEG_IDENT: - // keine Spaces am Anfang, dann teste doch mal auf neg. Einzuege + // no spaces at the beginning, check again for negative indentation { if( bMoreLines && !nLevel ) { SwTwips nSz = aFInfo.GetFirstIndent(); - if( 0 < nSz ) // positiver 1. Zeileneinzug + if( 0 < nSz ) // positive 1st line indentation BuildIndent(); - else if( 0 > nSz ) // negativer 1. Zeileneinzug + else if( 0 > nSz ) // negative 1st line indentation BuildNegIndent( aFInfo.GetLineStart() ); - else // ist ein kein Einzug + else // is _no_ indentation BuildText(); eStat = READ_NEXT_PARA; } @@ -2515,7 +2491,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, !bNxtEmpty && !bNxtAlpha && nNxtLevel && !IsEnumericChar( *pNxtNd ) ) { - // ist ein neg. Einzug + // is a negative indentation BuildNegIndent( aFInfo.GetLineStart() ); eStat = READ_NEXT_PARA; } @@ -2529,11 +2505,11 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, if( bMoreLines ) { SwTwips nSz = aFInfo.GetFirstIndent(); - if( 0 < nSz ) // positiver 1. Zeileneinzug + if( 0 < nSz ) // positive 1st line indentation BuildIndent(); - else if( 0 > nSz ) // negativer 1. Zeileneinzug + else if( 0 > nSz ) // negative 1st line indentation BuildNegIndent( aFInfo.GetLineStart() ); - else if( nLevel ) // ist ein Einzug + else if( nLevel ) // is indentation BuildTextIndent(); else BuildText(); @@ -2548,17 +2524,14 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, case HAS_FMTCOLL: { - // erstmal: wurden schon mal entsprechende Vorlagen - // vergeben, so behalte die bei, gehe zum - // naechsten Node. + // so far: if there were templates assigned, keep these and go to next node bEmptyLine = false; eStat = READ_NEXT_PARA; - // loesche alle Blanks am Anfang/Ende - // und alle mitten drin - //JP 29.04.98: erstmal nur alle "mitten drin". + // delete all blanks at beginning/end and in between + //JP 29.04.98: first only "all in between" DelMoreLinesBlanks( false ); - // behandel die harte Attributierung + // handle hard attributes if( pAktTxtNd->HasSwAttrSet() ) { short nSz; @@ -2570,14 +2543,14 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, ( 0 != (nSz = pLRSpace->GetTxtFirstLineOfst()) || 0 != pLRSpace->GetTxtLeft() ) ) { - // dann setze doch eine unserer Vorlagen - if( 0 < nSz ) // positiver 1. Zeileneinzug + // then use one of our templates + if( 0 < nSz ) // positive 1st line indentation BuildIndent(); - else if( 0 > nSz ) // negativer 1. Zeileneinzug + else if( 0 > nSz ) // negative 1st line indentation { BuildNegIndent( aFInfo.GetLineStart() ); } - else if( pLRSpace->GetTxtLeft() ) // ist ein Einzug + else if( pLRSpace->GetTxtLeft() ) // is indentation BuildTextIndent(); else BuildText(); @@ -2599,7 +2572,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, // restore undo (in case it has been changed) pDoc->GetIDocumentUndoRedo().DoUndo(bUndoState); - // Prozent-Anzeige wieder abschalten + // disable display of percentage again if( !aFlags.bAFmtByInput ) ::EndProgress( pDoc->GetDocShell() ); } @@ -2612,8 +2585,8 @@ void SwEditShell::AutoFormat( const SvxSwAutoFmtFlags* pAFlags ) StartAllAction(); StartUndo( UNDO_AUTOFORMAT ); - SvxSwAutoFmtFlags aAFFlags; // erst mal default - Werte - if( pAFlags ) // oder doch angegeben ?? + SvxSwAutoFmtFlags aAFFlags; // use default values or add params? + if( pAFlags ) { aAFFlags = *pAFlags; if( !aAFFlags.bAFmtByInput ) @@ -2621,7 +2594,7 @@ void SwEditShell::AutoFormat( const SvxSwAutoFmtFlags* pAFlags ) } SwPaM* pCrsr = GetCrsr(); - // es gibt mehr als einen oder ist eine Selektion offen + // There are more than one or a selection is open if( pCrsr->GetNext() != pCrsr || pCrsr->HasMark() ) { FOREACHPAM_START(this) @@ -2663,7 +2636,7 @@ void SwEditShell::AutoFmtBySplitNode() } else { - // dann einen Node zurueckspringen + // then go one node backwards SwNodeIndex aNdIdx( pCrsr->GetMark()->nNode, -1 ); SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode(); if (pTxtNd && !pTxtNd->GetTxt().isEmpty()) @@ -2676,15 +2649,14 @@ void SwEditShell::AutoFmtBySplitNode() if( bRange ) { - Push(); // Cursor sichern + Push(); // save cursor - SvxSwAutoFmtFlags aAFFlags = *GetAutoFmtFlags(); // erst mal default - Werte + SvxSwAutoFmtFlags aAFFlags = *GetAutoFmtFlags(); // use default values so far SwAutoFormat aFmt( this, aAFFlags, &pCrsr->GetMark()->nNode, &pCrsr->GetPoint()->nNode ); - //JP 30.09.96: das DoTable() verlaesst sich auf das PopCrsr - // und MoveCrsr! + //JP 30.09.96: DoTable() builds on PopCrsr and MoveCrsr! Pop( sal_False ); pCrsr = GetCrsr(); } @@ -2718,8 +2690,8 @@ void SwEditShell::SetAutoFmtFlags(SvxSwAutoFmtFlags * pFlags) pEditFlags->bAFmtByInpDelSpacesBetweenLines = pFlags->bAFmtByInpDelSpacesBetweenLines; - //JP 15.12.98: BulletZeichen und Font in die "normalen" kopieren, - // weil beim Autoformat nur mit diesen gearbeitet wird! + //JP 15.12.98: copy BulletChar and Font into "normal" ones + // because AutoFormat can only work with the latter! pEditFlags->cBullet = pFlags->cByInputBullet; pEditFlags->aBulletFont = pFlags->aByInputBulletFont; pEditFlags->cByInputBullet = pFlags->cByInputBullet; diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index ca20b2d2d997..62862fcfd157 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -33,27 +33,21 @@ #include #include -/************************************************************ - * Loeschen - ************************************************************/ - void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) { - // nur bei Selektion + // only for selections if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark()) return; - // besteht eine Selection in einer Tabelle ? - // dann nur den Inhalt der selektierten Boxen loeschen - // jetzt gibt es 2 Faelle die beachtet werden muessen: - // 1. Point und Mark stehen in einer Box, Selection normal loeschen - // 2. Point und Mark stehen in unterschiedlichen Boxen, alle - // selektierten Boxen suchen in den Inhalt loeschen + // Is the selection in a table? Then delete only the content of the selected boxes. + // Here, there are two cases: + // 1. Point and Mark are in one box, delete selection as usual + // 2. Point and Mare are in different boxes, search all selected boxes and delete content if( rPam.GetNode()->FindTableNode() && rPam.GetNode()->StartOfSectionNode() != rPam.GetNode(sal_False)->StartOfSectionNode() ) { - // in Tabellen das Undo gruppieren + // group the Undo in the table if( pUndo && !*pUndo ) { GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); @@ -68,37 +62,37 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) if( pEndSelPos->nNode.GetIndex() <= rEndNd.GetIndex() ) { *aDelPam.GetPoint() = *pEndSelPos; - pEndSelPos = 0; // Pointer als Flag missbrauchen + pEndSelPos = 0; // misuse a pointer as a flag } else { - // dann ans Ende der Section + // then go to the end of the selection aDelPam.GetPoint()->nNode = rEndNd; aDelPam.Move( fnMoveBackward, fnGoCntnt ); } - // geschuetze Boxen ueberspringen ! + // skip protected boxes if( !pNd->IsCntntNode() || !pNd->IsInProtectSect() ) { - // alles loeschen + // delete everything GetDoc()->DeleteAndJoin( aDelPam ); SaveTblBoxCntnt( aDelPam.GetPoint() ); } - if( !pEndSelPos ) // am Ende der Selection + if( !pEndSelPos ) // at the end of a selection break; aDelPam.DeleteMark(); - aDelPam.Move( fnMoveForward, fnGoCntnt ); // naechste Box + aDelPam.Move( fnMoveForward, fnGoCntnt ); // next box } while( pEndSelPos ); } else { - // alles loeschen + // delete everything GetDoc()->DeleteAndJoin( rPam ); SaveTblBoxCntnt( rPam.GetPoint() ); } - // Selection wird nicht mehr benoetigt. + // Selection is not needed anymore rPam.DeleteMark(); } @@ -112,7 +106,7 @@ long SwEditShell::Delete() StartAllAction(); sal_Bool bUndo = GetCrsr()->GetNext() != GetCrsr(); - if( bUndo ) // mehr als eine Selection ? + if( bUndo ) // more than one selection? { SwRewriter aRewriter; aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_MULTISEL)); @@ -124,7 +118,7 @@ long SwEditShell::Delete() DeleteSel( *PCURCRSR, &bUndo ); FOREACHPAM_END() - // falls eine Undo-Klammerung, dann hier beenden + // If undo container then close here if( bUndo ) { GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); @@ -223,14 +217,13 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) GetDoc()->SplitNode( *pPos, false ); } - // nur bei Selektion (nicht Textnodes haben Selection, - // aber Point/GetMark sind gleich + // Only for a selection (non-text nodes have selection but Point/GetMark are equal) if( !PCURCRSR->HasMark() || *PCURCRSR->GetPoint() == *PCURCRSR->GetMark() ) continue; if( bFirstMove ) { - // Anfangs-Position vom neuen Bereich merken + // Store start position of the new area aSttNdIdx = pPos->nNode.GetIndex()-1; nSttCntIdx = pPos->nContent.GetIndex(); bFirstMove = false; @@ -258,27 +251,26 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) } else { - // falls beim Move der Cursor "gewandert" ist, so setze hier auch - // seinen GetMark um, damit dieser nie in den Wald zeigt. + // If the cursor moved during move process, move also its GetMark pDestShell->GetCrsr()->SetMark(); pDestShell->GetCrsr()->DeleteMark(); } #if OSL_DEBUG_LEVEL > 0 -// pruefe ob die Indizies auch in den richtigen Nodes angemeldet sind +// check if the indices are registered in the correct nodes { - SwPaM* pCmp = (SwPaM*)pDestShell->GetCrsr(); // sicher den Pointer auf Cursor + SwPaM* pCmp = (SwPaM*)pDestShell->GetCrsr(); // store pointer to cursor do { OSL_ENSURE( pCmp->GetPoint()->nContent.GetIdxReg() - == pCmp->GetCntntNode(), "Point im falschen Node" ); + == pCmp->GetCntntNode(), "Point in wrong Node" ); OSL_ENSURE( pCmp->GetMark()->nContent.GetIdxReg() - == pCmp->GetCntntNode(sal_False), "Mark im falschen Node" ); + == pCmp->GetCntntNode(sal_False), "Mark in wrong Node" ); bool bTst = *pCmp->GetPoint() == *pCmp->GetMark(); (void) bTst; } while( pDestShell->GetCrsr() != ( pCmp = (SwPaM*)pCmp->GetNext() ) ); } #endif - // Undo-Klammerung hier beenden + // close Undo container here pDestShell->GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); pDestShell->EndAllAction(); @@ -287,13 +279,13 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) return (long)bRet; } - - // Ersetz einen selektierten Bereich in einem TextNode mit dem - // String. Ist fuers Suchen&Ersetzen gedacht. - // bRegExpRplc - ersetze Tabs (\\t) und setze den gefundenen String - // ein ( nicht \& ) - // z.B.: Fnd: "zzz", Repl: "xx\t\\t..&..\&" - // --> "xx\t..zzz..&" +/** Replace a selected area in a text node with a given string. + * + * Intended for "search & replace". + * + * @param bRegExpRplc if replace tabs (\\t) and replace with found string (not \&). + * E.g. [Fnd: "zzz", Repl: "xx\t\\t..&..\&"] --> "xx\t..zzz..&" + */ sal_Bool SwEditShell::Replace( const String& rNewStr, sal_Bool bRegExpRplc ) { SET_CURR_SHELL( this ); @@ -313,22 +305,21 @@ sal_Bool SwEditShell::Replace( const String& rNewStr, sal_Bool bRegExpRplc ) } FOREACHPAM_END() - // Undo-Klammerung hier beenden + // close Undo container here GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); EndAllAction(); } return bRet; } - - // Special-Methode fuer JOE's- Wizzards +/// special method for JOE's wizards sal_Bool SwEditShell::DelFullPara() { sal_Bool bRet = sal_False; if( !IsTableMode() ) { SwPaM* pCrsr = GetCrsr(); - // keine Mehrfach-Selection + // no multi selection if( pCrsr->GetNext() == pCrsr && !HasReadonlySel() ) { SET_CURR_SHELL( this ); diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 8008b5446a26..a4b8903d96ec 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -107,12 +107,11 @@ void SwEditShell::FillByEx(SwTxtFmtColl* pColl, sal_Bool bReset) const SfxItemSet* pSet = pCnt->GetpSwAttrSet(); if( pSet ) { - // JP 05.10.98: falls eines der Attribute Break/PageDesc/NumRule(auto) - // im ItemSet steht, so entferne die VORM setzen an der Collection. - // Ansonst wird zu viel gemacht oder falsche gemacht (NumRules!) + // JP 05.10.98: Special treatment if one of the attribues Break/PageDesc/NumRule(auto) is + // in the ItemSet. Otherwise there will be too much or wrong processing (NumRules!) // Bug 57568 - // AutoNumRules NICHT in die Vorlagen uebernehmen + // Do NOT copy AutoNumRules into the template const SfxPoolItem* pItem; const SwNumRule* pRule = 0; if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False ) || diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index ede37d080e52..279d3d1d3722 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -36,11 +36,7 @@ #include #include -/*-------------------------------------------------------------------- - Beschreibung: Feldtypen zu einer ResId zaehlen - wenn 0 alle zaehlen - --------------------------------------------------------------------*/ - +/// count field types with a ResId, if 0 count all sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) const { const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); @@ -62,10 +58,10 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) cons } } - // Alle Typen mit gleicher ResId + // all types with the same ResId sal_uInt16 nIdx = 0; for(sal_uInt16 i = 0; i < nSize; ++i) - { // Gleiche ResId -> Index erhoehen + { // same ResId -> increment index SwFieldType& rFldType = *((*pFldTypes)[i]); if(rFldType.Which() == nResId) nIdx++; @@ -73,10 +69,7 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) cons return nIdx; } -/*-------------------------------------------------------------------- - Beschreibung: Feldtypen zu einer ResId finden - wenn 0 alle finden - --------------------------------------------------------------------*/ +/// get field types with a ResId, if 0 get all SwFieldType* SwEditShell::GetFldType(sal_uInt16 nFld, sal_uInt16 nResId, sal_Bool bUsed ) const { const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); @@ -104,7 +97,7 @@ SwFieldType* SwEditShell::GetFldType(sal_uInt16 nFld, sal_uInt16 nResId, sal_Boo sal_uInt16 nIdx = 0; for(sal_uInt16 i = 0; i < nSize; ++i) - { // Gleiche ResId -> Index erhoehen + { // same ResId -> increment index SwFieldType* pFldType = (*pFldTypes)[i]; if(pFldType->Which() == nResId) { @@ -119,17 +112,13 @@ SwFieldType* SwEditShell::GetFldType(sal_uInt16 nFld, sal_uInt16 nResId, sal_Boo return 0; } -/*-------------------------------------------------------------------- - Beschreibung: Den ersten Typen mit ResId und Namen finden - --------------------------------------------------------------------*/ +/// get first type with given ResId and name SwFieldType* SwEditShell::GetFldType(sal_uInt16 nResId, const String& rName) const { return GetDoc()->GetFldType( nResId, rName, false ); } -/*-------------------------------------------------------------------- - Beschreibung: Feldtypen loeschen - --------------------------------------------------------------------*/ +/// delete field type void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId) { if( USHRT_MAX == nResId ) @@ -151,9 +140,7 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId) } } -/*-------------------------------------------------------------------- - Beschreibung: FieldType ueber Name loeschen - --------------------------------------------------------------------*/ +/// delete field type based on its name void SwEditShell::RemoveFldType(sal_uInt16 nResId, const String& rStr) { const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); @@ -164,7 +151,7 @@ void SwEditShell::RemoveFldType(sal_uInt16 nResId, const String& rStr) for(sal_uInt16 i = 0; i < nSize; ++i) { - // Gleiche ResId -> Index erhoehen + // same ResId -> increment index SwFieldType* pFldType = (*pFldTypes)[i]; if( pFldType->Which() == nResId ) { @@ -202,14 +189,7 @@ void SwEditShell::FieldToText( SwFieldType* pType ) EndUndo( UNDO_DELETE ); } -/************************************************************************* -|* -|* SwEditShell::Insert( SwField ) -|* -|* Beschreibung an der Cursorposition ein Feld einfuegen -|* Quelle: vgl. SwEditShell::Insert( String ) -|* -*************************************************************************/ +/// add a field at the cursor position void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints) { SET_CURR_SHELL( this ); @@ -220,24 +200,16 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints) ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND : nsSetAttrMode::SETATTR_DEFAULT; - FOREACHPAM_START(this) // fuer jeden PaM + FOREACHPAM_START(this) // for each PaM bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags)); OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed"); (void) bSuccess; - FOREACHPAM_END() // fuer jeden PaM + FOREACHPAM_END() EndAllAction(); } -/************************************************************************* -|* -|* SwEditShell::GetCurFld() -|* -|* Beschreibung Stehen die PaMs auf Feldern ? -|* Quelle: edtfrm.cxx: -|* -*************************************************************************/ - +/// Are the PaMs positioned on fields? inline SwTxtFld *GetDocTxtFld( const SwPosition* pPos ) { SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode(); @@ -249,8 +221,7 @@ inline SwTxtFld *GetDocTxtFld( const SwPosition* pPos ) SwField* SwEditShell::GetCurFld() const { - // Wenn es keine Selektionen gibt, gilt der Wert der aktuellen - // Cursor-Position. + // If there are no selections so take the value of the current cursor position. SwPaM* pCrsr = GetCrsr(); SwTxtFld *pTxtFld = GetDocTxtFld( pCrsr->Start() ); @@ -266,7 +237,7 @@ SwField* SwEditShell::GetCurFld() const pCrsr->Start()->nContent.GetIndex()) <= 1) { pCurFld = (SwField*)pTxtFld->GetFld().GetFld(); - // TabellenFormel ? wandel internen in externen Namen um + // Table formula? Convert internal into external name: if( RES_TABLEFLD == pCurFld->GetTyp()->Which() ) { const SwTableNode* pTblNd = IsCrsrInTbl(); @@ -281,17 +252,10 @@ SwField* SwEditShell::GetCurFld() const } -/************************************************************************* -|* -|* SwEditShell::UpdateFlds() -|* -|* Beschreibung Stehen die PaMs auf Feldern ? -|* -*************************************************************************/ +/// Are the PaMs positioned on fields? static SwTxtFld* lcl_FindInputFld( SwDoc* pDoc, SwField& rFld ) { - // suche das Feld ueber seine Addresse. Muss fuer InputFelder in - // geschuetzten Feldern erfolgen + // Search field via its address. For input fields this needs to be done in protected fields. SwTxtFld* pTFld = 0; if( RES_INPUTFLD == rFld.Which() || ( RES_SETEXPFLD == rFld.Which() && ((SwSetExpField&)rFld).GetInputFlag() ) ) @@ -317,8 +281,7 @@ void SwEditShell::UpdateFlds( SwField &rFld ) StartAllAction(); { - // Wenn es keine Selektionen gibt, gilt der Wert der aktuellen - // Cursor-Position. + // // If there are no selections so take the value of the current cursor position. SwMsgPoolItem* pMsgHnt = 0; SwRefMarkFldUpdate aRefMkHt( GetOut() ); sal_uInt16 nFldWhich = rFld.GetTyp()->Which(); @@ -340,36 +303,34 @@ void SwEditShell::UpdateFlds( SwField &rFld ) GetDoc()->UpdateFld(pTxtFld, rFld, pMsgHnt, sal_True); } - // bOkay (statt return wg. EndAllAction) wird false, - // 1) wenn nur ein Pam mehr als ein Feld enthaelt oder - // 2) bei gemischten Feldtypen + // bOkay (instead of return because of EndAllAction) becomes false, + // 1) if only one PaM has more than one field or + // 2) if there are mixed field types bool bOkay = true; sal_Bool bTblSelBreak = sal_False; - SwMsgPoolItem aHint( RES_TXTATR_FIELD ); // Such-Hint - FOREACHPAM_START(this) // fuer jeden PaM - if( PCURCRSR->HasMark() && bOkay ) // ... mit Selektion + SwMsgPoolItem aHint( RES_TXTATR_FIELD ); // Search-Hint + FOREACHPAM_START(this) // for each PaM + if( PCURCRSR->HasMark() && bOkay ) // ... with selection { - // Kopie des PaM + // copy of the PaM SwPaM aCurPam( *PCURCRSR->GetMark(), *PCURCRSR->GetPoint() ); SwPaM aPam( *PCURCRSR->GetPoint() ); SwPosition *pCurStt = aCurPam.Start(), *pCurEnd = aCurPam.End(); /* - * Fuer den Fall, dass zwei aneinanderliegende Felder in einem - * PaM liegen, hangelt sich aPam portionsweise bis zum Ende. - * aCurPam wird dabei nach jeder Schleifenrunde verkuerzt. - * Wenn aCurPam vollstaendig durchsucht wurde, ist Start = End - * und die Schleife terminiert. + * In case that there are two contiguous fields in a PaM, the aPam goes step by step + * to the end. aCurPam is reduced in each loop. If aCurPam was searched completely, + * the loop terminates because Start = End. */ - // Suche nach SwTxtFld ... + // Search for SwTxtFld ... while( bOkay && pCurStt->nContent != pCurEnd->nContent && aPam.Find( aHint, sal_False, fnMoveForward, &aCurPam ) ) { - // wenn nur ein Pam mehr als ein Feld enthaelt ... + // if only one PaM has more than one field ... if( aPam.Start()->nContent != pCurStt->nContent ) bOkay = false; @@ -378,7 +339,7 @@ void SwEditShell::UpdateFlds( SwField &rFld ) pFmtFld = (SwFmtFld*)&pTxtFld->GetFld(); SwField *pCurFld = pFmtFld->GetFld(); - // bei gemischten Feldtypen + // if there are mixed field types if( pCurFld->GetTyp()->Which() != rFld.GetTyp()->Which() ) bOkay = false; @@ -386,25 +347,20 @@ void SwEditShell::UpdateFlds( SwField &rFld ) bTblSelBreak = GetDoc()->UpdateFld(pTxtFld, rFld, pMsgHnt, sal_False); } - // Der Suchbereich wird um den gefundenen Bereich - // verkuerzt. + // The search area is reduced by the found area: pCurStt->nContent++; } } - if( bTblSelBreak ) // wenn Tabellen Selektion und Tabellen- - break; // Formel aktualisiert wurde -> beenden + if( bTblSelBreak ) // If table section and table formula are updated -> finish + break; - FOREACHPAM_END() // fuer jeden PaM + FOREACHPAM_END() } GetDoc()->SetModified(); EndAllAction(); } -/*-------------------------------------------------- - Liefert den logischen fuer die Datenbank zurueck - --------------------------------------------------*/ - SwDBData SwEditShell::GetDBData() const { return GetDoc()->GetDBData(); @@ -432,16 +388,14 @@ void SwEditShell::ChangeDBFields( const std::vector& rOldNames, GetDoc()->ChangeDBFields( rOldNames, rNewName ); } -/*-------------------------------------------------------------------- - Beschreibung: Alle Expression-Felder erneuern - --------------------------------------------------------------------*/ +/// Update all expression fields void SwEditShell::UpdateExpFlds(sal_Bool bCloseDB) { SET_CURR_SHELL( this ); StartAllAction(); GetDoc()->UpdateExpFlds(NULL, true); if (bCloseDB) - GetDoc()->GetNewDBMgr()->CloseAll(); // Alle Datenbankverbindungen dichtmachen + GetDoc()->GetNewDBMgr()->CloseAll(); // close all database connections EndAllAction(); } @@ -450,9 +404,7 @@ SwNewDBMgr* SwEditShell::GetNewDBMgr() const return GetDoc()->GetNewDBMgr(); } -/*-------------------------------------------------------------------- - Beschreibung: Feldtypen einfuegen - --------------------------------------------------------------------*/ +/// insert field type SwFieldType* SwEditShell::InsertFldType(const SwFieldType& rFldType) { return GetDoc()->InsertFldType(rFldType); diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 31045e0d24c9..b1be2890a680 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -25,7 +25,7 @@ #include #include #include -#include // fuer die UndoIds +#include // for UndoIds #include #include #include @@ -58,7 +58,7 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) return 0; - // dann alle gelinkten Bereiche auf der obersten Ebene + // then all linked areas on the topmost level SwDoc* pMyDoc = GetDoc(); const SwSectionFmts& rSectFmts = pMyDoc->GetSections(); sal_uInt16 n; @@ -73,7 +73,7 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const { case TOX_HEADER_SECTION: break; // ignore case TOX_CONTENT_SECTION: - OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); + OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); pNew = new SwGlblDocContent( (SwTOXBaseSection*)pSect ); break; @@ -86,14 +86,14 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const } } - // und als letztes die Dummies (sonstiger Text) einfuegen + // and finally add the dummies (other text) SwNode* pNd; sal_uLong nSttIdx = pMyDoc->GetNodes().GetEndOfExtras().GetIndex() + 2; for( n = 0; n < rArr.size(); ++n ) { const SwGlblDocContent& rNew = *rArr[ n ]; - // suche von StartPos bis rNew.DocPos nach einem Content Node. - // Existiert dieser, so muss ein DummyEintrag eingefuegt werden. + // Search from StartPos until rNew.DocPos for a content node. + // If one exists then a dummy entry is needed. for( ; nSttIdx < rNew.GetDocPos(); ++nSttIdx ) if( ( pNd = pMyDoc->GetNodes()[ nSttIdx ])->IsCntntNode() || pNd->IsSectionNode() || pNd->IsTableNode() ) @@ -102,16 +102,16 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const if( !rArr.insert( pNew ).second ) delete pNew; else - ++n; // auf die naechste Position + ++n; // to the next position break; } - // StartPosition aufs Ende setzen + // set StartPosition to the end nSttIdx = pMyDoc->GetNodes()[ rNew.GetDocPos() ]->EndOfSectionIndex(); ++nSttIdx; } - // sollte man das Ende auch noch setzen?? + // Should the end also be set? if( !rArr.empty() ) { sal_uLong nNdEnd = pMyDoc->GetNodes().GetEndOfContent().GetIndex(); @@ -259,7 +259,7 @@ sal_Bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr , sal_uLong nDelIdx = rDelPos.GetDocPos(); if( 1 == rArr.size() ) { - // ein Node muss aber da bleiben! + // we need at least one node! rPos.nNode = nDelIdx - 1; rPos.nContent.Assign( 0, 0 ); diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index f63912efa299..d769b9b56482 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -28,17 +28,13 @@ #include #include #include -#include // fuer die UndoIds +#include // for UndoIds #include -#include // fuers kopieren von Tabellen +#include // for table copying #include // SwTextBlocks #include #include // SwTextBlocks -/****************************************************************************** - * jetzt mit einem verkappten Reader/Writer/Dokument - ******************************************************************************/ - void SwEditShell::InsertGlossary( SwTextBlocks& rGlossary, const String& rStr ) { StartAllAction(); @@ -46,13 +42,7 @@ void SwEditShell::InsertGlossary( SwTextBlocks& rGlossary, const String& rStr ) EndAllAction(); } - -/****************************************************************************** - * aktuelle Selektion zum Textbaustein machen und ins - * Textbausteindokument einfuegen, einschliesslich Vorlagen - ******************************************************************************/ - - +/// convert current selection into text block and add to the text block document, incl. templates sal_uInt16 SwEditShell::MakeGlossary( SwTextBlocks& rBlks, const String& rName, const String& rShortName, sal_Bool bSaveRelFile, const String* pOnlyTxt ) { @@ -124,7 +114,7 @@ sal_uInt16 SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock, pCrsr->GetPoint()->nContent.Assign( pCntntNd, 0 ); pCrsr->SetMark(); - // dann bis zum Ende vom Nodes Array + // then until the end of the Node array pCrsr->GetPoint()->nNode = pMyDoc->GetNodes().GetEndOfContent().GetIndex()-1; pCntntNd = pCrsr->GetCntntNode(); if( pCntntNd ) @@ -163,14 +153,10 @@ sal_uInt16 SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock, return nRet; } -/****************************************************************************** - * kopiere alle Selectionen und das Doc - ******************************************************************************/ - - +/// copy all selections and the doc sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) { - OSL_ENSURE( pInsDoc, "kein Ins.Dokument" ); + OSL_ENSURE( pInsDoc, "no Ins.Document" ); SwNodes& rNds = pInsDoc->GetNodes(); @@ -178,7 +164,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) SwCntntNode * pNd = aIdx.GetNode().GetCntntNode(); SwPosition aPos( aIdx, SwIndex( pNd, pNd->Len() )); - // soll der Index auf Anfang returnt werden ? + // Should the index be reset to start? if( pSttNd ) { *pSttNd = aPos.nNode; @@ -192,18 +178,17 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) if( IsTableMode() ) { - // kopiere Teile aus einer Tabelle: lege eine Tabelle mit der Breite - // von der Originalen an und kopiere die selectierten Boxen. - // Die Groessen werden prozentual korrigiert. + // Copy parts of a table: create a table with the width of the original one and copy the + // selected boxes. The sizes are corrected on a percentage basis. - // lasse ueber das Layout die Boxen suchen + // search boxes using the layout SwTableNode* pTblNd; SwSelBoxes aBoxes; GetTblSel( *this, aBoxes ); if( !aBoxes.empty() && 0 != (pTblNd = (SwTableNode*)aBoxes[0] ->GetSttNd()->FindTableNode() )) { - // teste ob der TabellenName kopiert werden kann + // check if the table name can be copied sal_Bool bCpyTblNm = aBoxes.size() == pTblNd->GetTable().GetTabSortBoxes().size(); if( bCpyTblNm ) { @@ -255,23 +240,20 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) if( !pInsDoc->IsExpFldsLocked() ) pInsDoc->UpdateExpFlds(NULL, true); - // die gemerkte Node-Position wieder auf den richtigen Node + // set the saved Node position back to the correct Node if( bRet && pSttNd ) ++(*pSttNd); - return bRet; } -/*------------------------------------------------------------------------ - Beschreibung: Text innerhalb der Selektion erfragen - Returnwert: liefert sal_False, wenn der selektierte Bereich - zu gross ist, um in den Stringpuffer kopiert zu werden. -------------------------------------------------------------------------*/ - +/** Get text in a Selection + * + * @return sal_False if the selected area is too big for being copied into the string buffer + */ sal_Bool SwEditShell::GetSelectedText( String &rBuf, int nHndlParaBrk ) { - GetCrsr(); // ggfs. alle Cursor erzeugen lassen + GetCrsr(); // creates all cursors if needed if( IsSelOnePara() ) { rBuf = GetSelTxt(); @@ -304,7 +286,7 @@ sal_Bool SwEditShell::GetSelectedText( String &rBuf, int nHndlParaBrk ) SwReaderWriter::GetWriter( OUString(FILTER_TEXT), String(), xWrt ); if( xWrt.Is() ) { - // Selektierte Bereiche in ein ASCII Dokument schreiben + // write selected areas into a ASCII document SwWriter aWriter( aStream, *this); xWrt->SetShowProgress( sal_False ); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 8185efb40488..a335ba55ce2e 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -37,11 +37,11 @@ #include #include #include -#include // fuer SwTxtNode +#include // for SwTxtNode #include #include #include -#include // UNDO_START, UNDO_END +#include // UNDO_START, UNDO_END #include #include #include @@ -200,7 +200,7 @@ long SwEditShell::SplitNode( sal_Bool bAutoFormat, sal_Bool bCheckTableStart ) GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); FOREACHPAM_START(this) - // eine Tabellen Zelle wird jetzt zu einer normalen Textzelle! + // Here, a table cell becomes a normal text cell. GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode ); GetDoc()->SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart ); FOREACHPAM_END() @@ -235,12 +235,7 @@ sal_Bool SwEditShell::AppendTxtNode() return bRet; } -/****************************************************************************** - * liefert einen Pointer auf einen SwGrfNode; dieser wird von - * GetGraphic() und GetGraphicSize() verwendet. - ******************************************************************************/ - - +// the returned SwGrfNode pointer is used in GetGraphic() and GetGraphicSize() SwGrfNode * SwEditShell::_GetGrfNode() const { SwGrfNode *pGrfNode = 0; @@ -251,12 +246,9 @@ SwGrfNode * SwEditShell::_GetGrfNode() const return pGrfNode; } -/****************************************************************************** - * liefert Pointer auf eine Graphic, wenn CurCrsr->GetPoint() auf - * einen SwGrfNode zeigt (und GetMark nicht gesetzt ist - * oder auf die gleiche Graphic zeigt) - ******************************************************************************/ +// returns a Graphic pointer if CurCrsr->GetPoint() points to a SwGrfNode and +// GetMark is not set or points to the same Graphic const Graphic* SwEditShell::GetGraphic( sal_Bool bWait ) const { SwGrfNode* pGrfNode = _GetGrfNode(); @@ -311,12 +303,8 @@ sal_uInt16 SwEditShell::GetGraphicType() const return static_cast(pGrfNode ? pGrfNode->GetGrfObj().GetType() : GRAPHIC_NONE); } -/****************************************************************************** - * liefert die Groesse der Graphic, wenn CurCrsr->GetPoint() auf - * einen SwGrfNode zeigt (und GetMark nicht gesetzt ist - * oder auf die gleiche Graphic zeigt) - ******************************************************************************/ - +// returns the size of a graphic in if CurCrsr->GetPoint() points to a SwGrfNode and +// GetMark is not set or points to the same graphic sal_Bool SwEditShell::GetGrfSize(Size& rSz) const { SwNoTxtNode* pNoTxtNd; @@ -331,11 +319,8 @@ sal_Bool SwEditShell::GetGrfSize(Size& rSz) const return sal_False; } -/****************************************************************************** - * erneutes Einlesen, falls Graphic nicht Ok ist. Die - * aktuelle wird durch die neue ersetzt. - ******************************************************************************/ +/// Read again if graphic is not OK and replace old one void SwEditShell::ReRead( const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj ) { @@ -344,18 +329,12 @@ void SwEditShell::ReRead( const String& rGrfName, const String& rFltName, EndAllAction(); } - -/****************************************************************************** - * liefert den Namen und den FilterNamen einer Graphic, wenn der Cursor - * auf einer Graphic steht - * Ist ein String-Ptr != 0 dann returne den entsp. Namen - ******************************************************************************/ - - +/// Returns the name and the filter name of a graphic if the pointer is on a graphic. +/// If a String-pointer is != 0 then return corresponding name. void SwEditShell::GetGrfNms( String* pGrfName, String* pFltName, const SwFlyFrmFmt* pFmt ) const { - OSL_ENSURE( pGrfName || pFltName, "was wird denn nun erfragt?" ); + OSL_ENSURE( pGrfName || pFltName, "No parameters" ); if( pFmt ) GetDoc()->GetGrfNms( *pFmt, pGrfName, pFltName ); else @@ -402,24 +381,22 @@ void SwEditShell::ClearAutomaticContour() } } -/****************************************************************************** - * liefert Pointer auf ein SvInPlaceObjectRef, wenn CurCrsr->GetPoint() auf - * einen SwOLENode zeigt (und GetMark nicht gesetzt ist - * oder auf das gleiche SvInPlaceObjectRef zeigt) - * besorgt den Pointer vom Doc wenn das Objekt per Namen gesucht werden - * soll - ******************************************************************************/ - +/** Get OLE object at pointer. + * + * Returns a pointer to a SvInPlaceObjectRef if CurCrsr->GetPoint() points to a SwOLENode and + * GetMark is not set or points to the same object reference. Gets this pointer from the Doc + * if the object should be searched by name. + */ svt::EmbeddedObjectRef& SwEditShell::GetOLEObject() const { - OSL_ENSURE( CNT_OLE == GetCntType(), "GetOLEObj: kein OLENode." ); + OSL_ENSURE( CNT_OLE == GetCntType(), "GetOLEObj: no OLENode." ); OSL_ENSURE( !GetCrsr()->HasMark() || (GetCrsr()->HasMark() && GetCrsr()->GetPoint()->nNode == GetCrsr()->GetMark()->nNode), - "GetOLEObj: kein OLENode." ); + "GetOLEObj: no OLENode." ); SwOLENode *pOLENode = GetCrsr()->GetNode()->GetOLENode(); - OSL_ENSURE( pOLENode, "GetOLEObj: kein OLENode." ); + OSL_ENSURE( pOLENode, "GetOLEObj: no OLENode." ); SwOLEObj& rOObj = pOLENode->GetOLEObj(); return rOObj.GetObject(); } @@ -456,18 +433,13 @@ void SwEditShell::UpdateCharts( const String &rName ) GetDoc()->UpdateCharts( rName ); } - -/****************************************************************************** - * Aenderung des Tabellennamens - ******************************************************************************/ - +/// change table name void SwEditShell::SetTableName( SwFrmFmt& rTblFmt, const String &rNewName ) { GetDoc()->SetTableName( rTblFmt, rNewName ); } -// erfragen des akt. Wortes - +/// request current word String SwEditShell::GetCurWord() { const SwPaM& rPaM = *GetCrsr(); @@ -500,14 +472,13 @@ const SwDocStat& SwEditShell::GetUpdatedDocStat() // OPT: eddocinl.cxx - - // returne zum Namen die im Doc gesetzte Referenz +/// get the reference of a given name in the Doc const SwFmtRefMark* SwEditShell::GetRefMark( const String& rName ) const { return GetDoc()->GetRefMark( rName ); } - // returne die Namen aller im Doc gesetzten Referenzen +/// get the names of all references in a Doc sal_uInt16 SwEditShell::GetRefMarks( std::vector* pStrings ) const { return GetDoc()->GetRefMarks( pStrings ); @@ -586,9 +557,9 @@ void SwEditShell::ReplaceDropTxt( const String &rStr, SwPaM* pPaM ) String SwEditShell::Calculate() { - String aFormel; // die entgueltige Formel + String aFormel; // the final formula SwPaM *pPaMLast = (SwPaM*)GetCrsr()->GetNext(), - *pPaM = pPaMLast; // die Pointer auf Cursor + *pPaM = pPaMLast; // cursor pointers SwCalc aCalc( *GetDoc() ); const CharClass& rCC = GetAppCharClass(); @@ -659,8 +630,7 @@ sfx2::LinkManager& SwEditShell::GetLinkManager() void *SwEditShell::GetIMapInventor() const { - //Als eindeutige Identifikation sollte der Node, auf dem der Crsr steht - //genuegen. + // The node on which the cursor points should be sufficient as a unique identifier return (void*)GetCrsr()->GetNode(); } @@ -668,7 +638,7 @@ void *SwEditShell::GetIMapInventor() const // remove default parameter, because method is always called this default value Graphic SwEditShell::GetIMapGraphic() const { - //Liefert immer eine Graphic, wenn der Crsr in einem Fly steht. + // returns always a graphic if the cursor is in a Fly SET_CURR_SHELL( (ViewShell*)this ); Graphic aRet; SwPaM* pCrsr = GetCrsr(); @@ -705,7 +675,7 @@ Graphic SwEditShell::GetIMapGraphic() const sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, sal_Bool bKeepSelection ) { - // URL und Hinweistext (direkt oder via Selektion) notwendig + // URL and hint text (directly or via selection) necessary if( !rFmt.GetValue().Len() || ( !rStr.Len() && !HasSelection() ) ) return sal_False; StartAllAction(); @@ -717,7 +687,7 @@ sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, s SwPaM* pCrsr = GetCrsr(); if( pCrsr->HasMark() && *pCrsr->GetPoint() != *pCrsr->GetMark() ) { - // Selection vorhanden, MehrfachSelektion? + // Selection existent, multi selection? bool bDelTxt = true; if( pCrsr->GetNext() == pCrsr ) { @@ -726,7 +696,7 @@ sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, s if( sTxt == rStr ) bDelTxt = bInsTxt = false; } - else if( rFmt.GetValue() == rStr ) // Name und URL gleich? + else if( rFmt.GetValue() == rStr ) // Are Name and URL equal? bDelTxt = bInsTxt = false; if( bDelTxt ) @@ -790,9 +760,8 @@ sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr ) return rArr.size(); } - - // ist der Cursor in eine INetAttribut, dann wird das komplett - // geloescht; inclusive des Hinweistextes (wird beim Drag&Drop gebraucht) +/// If the cursor is in a INetAttribute then it will be deleted completely (incl. hint text, the +/// latter is needed for drag & drop) sal_Bool SwEditShell::DelINetAttrWithText() { sal_Bool bRet = SelectTxtAttr( RES_TXTATR_INETFMT, sal_False ); @@ -802,7 +771,7 @@ sal_Bool SwEditShell::DelINetAttrWithText() } -// setzen an den Textzeichenattributen das DontExpand-Flag +/// Set the DontExpand flag at the text character attributes bool SwEditShell::DontExpandFmt() { bool bRet = false; @@ -922,7 +891,7 @@ sal_uInt16 SwEditShell::GetLineCount( sal_Bool bActPos ) if( !bActPos ) aStart = 0; else if( rPtIdx > ( nTmpPos = GetDoc()->GetNodes().GetEndOfExtras().GetIndex()) ) - // BodyBereich => Start ist EndOfIcons + 1 + // BodyArea => Start is EndOfIcons + 1 aStart = nTmpPos + 1; else { @@ -1033,9 +1002,7 @@ void SwEditShell::SetLinkUpdMode( sal_uInt16 nMode ) getIDocumentSettingAccess()->setLinkUpdateMode( nMode ); } - -// Schnittstelle fuer die TextInputDaten - ( fuer die Texteingabe -// von japanischen/chinesischen Zeichen) +// Interface for TextInputData - (for text input of japanese/chinese characters) SwExtTextInput* SwEditShell::CreateExtTextInput(LanguageType eInputLanguage) { SwExtTextInput* pRet = GetDoc()->CreateExtTextInput( *GetCrsr() ); @@ -1094,11 +1061,11 @@ void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData ) if( !rData.IsOnlyCursorChanged() ) pInput->SetInputData( rData ); - // Cursor positionieren: + // position cursor const SwPosition& rStt = *pInput->Start(); xub_StrLen nNewCrsrPos = rStt.nContent.GetIndex() + rData.GetCursorPos(); - // zwar unschoen aber was hilfts + // ugly but works ShowCrsr(); long nDiff = nNewCrsrPos - rPos.nContent.GetIndex(); if( 0 > nDiff ) diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 4a77c702383f..010148680a89 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -41,12 +41,12 @@ #include #include // SwRootFrm #include -#include // fuer die UndoIds +#include // for the UndoIds #include // AdjHyphPos #include // HyphStart/End #include // SwShellCrsr -#include // SwWrongList -#include // Statusanzeige +#include // SwWrongList +#include // status display #include // StatLine-String #include #include @@ -95,7 +95,7 @@ public: inline sal_uInt16& GetCrsrCnt(){ return nCrsrCnt; } - // Der UI-Bauchladen: + // for the UI: void _Start( SwEditShell *pSh, SwDocPositions eStart, SwDocPositions eEnd ); void _End(bool bRestoreSelection = true); @@ -191,8 +191,8 @@ static SwSpellIter* pSpellIter = 0; static SwConvIter* pConvIter = 0; static SwHyphIter* pHyphIter = 0; -// Wir ersparen uns in Hyphenate ein GetFrm() -// Achtung: in txtedt.cxx stehen extern-Deklarationen auf diese Pointer! +// With that we save a GetFrm() in Hyphenate. +// Caution: There are external declaration to these pointers in txtedt.cxx! const SwTxtNode *pLinguNode; SwTxtFrm *pLinguFrm; @@ -203,7 +203,7 @@ const SwTxtNode *pLinguNode; SwLinguIter::SwLinguIter() : pSh( 0 ), pStart( 0 ), pEnd( 0 ), pCurr( 0 ), pCurrX( 0 ) { - // @@@ es fehlt: Sicherstellen der Reentrance, OSL_ENSURE( etc. + // TODO missing: ensurance of re-entrance, OSL_ENSURE( etc. } /************************************************************************* @@ -215,7 +215,7 @@ SwLinguIter::SwLinguIter() void SwLinguIter::_Start( SwEditShell *pShell, SwDocPositions eStart, SwDocPositions eEnd ) { - // es fehlt: Sicherstellen der Reentrance, Locking + // TODO missing: ensurance of re-entrance, locking if( pSh ) return; @@ -225,7 +225,7 @@ void SwLinguIter::_Start( SwEditShell *pShell, SwDocPositions eStart, SET_CURR_SHELL( pSh ); - OSL_ENSURE( !pEnd, "LinguStart ohne End?"); + OSL_ENSURE( !pEnd, "SwLinguIter::_Start without End?"); SwPaM *pCrsr = pSh->GetCrsr(); @@ -284,7 +284,7 @@ void SwLinguIter::_End(bool bRestoreSelection) if( !pSh ) return; - OSL_ENSURE( pEnd, "SwEditShell::SpellEnd() ohne Start?"); + OSL_ENSURE( pEnd, "SwLinguIter::_End without end?"); if(bRestoreSelection) { while( nCrsrCnt-- ) @@ -320,13 +320,7 @@ void SwSpellIter::Start( SwEditShell *pShell, SwDocPositions eStart, aLastPositions.clear(); } -/************************************************************************* - * SwSpellIter::Continue - *************************************************************************/ - -// SwSpellIter::Continue ist das alte Original von -// SwEditShell::SpellContinue() - +// This method is the origin of SwEditShell::SpellContinue() uno::Any SwSpellIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) { //!! @@ -338,7 +332,7 @@ uno::Any SwSpellIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) if( !pMySh ) return aSpellRet; - OSL_ENSURE( GetEnd(), "SwEditShell::SpellContinue() ohne Start?"); + OSL_ENSURE( GetEnd(), "SwSpellIter::Continue without start?"); uno::Reference< uno::XInterface > xSpellRet; bool bGoOn = true; @@ -412,7 +406,7 @@ uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) if( !pMySh ) return aConvRet; - OSL_ENSURE( GetEnd(), "SwConvIter::Continue() ohne Start?"); + OSL_ENSURE( GetEnd(), "SwConvIter::Continue() without Start?"); OUString aConvText; bool bGoOn = true; @@ -481,9 +475,8 @@ void SwHyphIter::ShowSelection() if( pMySh ) { pMySh->StartAction(); - // Ganz fatal: durch das EndAction() werden Formatierungen - // angeregt, die dazu fuehren koennen, dass im Hyphenator - // neue Worte eingestellt werden. Deswegen sichern! + // Caution! Due to EndAction() formatting is started which can lead to the fact that new + // words are added to/set in the Hyphenator. Thus: save! pMySh->EndAction(); } } @@ -509,14 +502,7 @@ void SwHyphIter::Start( SwEditShell *pShell, SwDocPositions eStart, SwDocPositio _Start( pShell, eStart, eEnd ); } -/************************************************************************* - * virtual SwHyphIter::End - *************************************************************************/ - -// Selektionen wiederherstellen - - - +// restore selections void SwHyphIter::End() { if( !GetSh() ) @@ -542,7 +528,7 @@ uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) do { SwPaM *pCrsr; do { - OSL_ENSURE( GetEnd(), "SwEditShell::SpellContinue() ohne Start?" ); + OSL_ENSURE( GetEnd(), "SwHyphIter::Continue without Start?" ); pCrsr = pMySh->GetCrsr(); if ( !pCrsr->HasMark() ) pCrsr->SetMark(); @@ -556,7 +542,7 @@ uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) { *pCrsr->GetMark() = *GetEnd(); - // Muss an der aktuellen Cursorpos das Wort getrennt werden ? + // Do we need to break the word at the current cursor position? const Point aCrsrPos( pMySh->GetCharRect().Pos() ); xHyphWord = pMySh->GetDoc()->Hyphenate( pCrsr, aCrsrPos, pPageCnt, pPageSt ); @@ -585,21 +571,16 @@ uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) return aHyphRet; } -/************************************************************************* - * SwHyphIter::HyphIgnore - *************************************************************************/ - -// Beschreibung: Trennstelle ignorieren - +/// ignore hyphenation void SwHyphIter::Ignore() { SwEditShell *pMySh = GetSh(); SwPaM *pCrsr = pMySh->GetCrsr(); - // Alten SoftHyphen loeschen + // delete old SoftHyphen DelSoftHyph( *pCrsr ); - // und weiter + // and continue pCrsr->Start()->nContent = pCrsr->End()->nContent; pCrsr->SetMark(); } @@ -652,18 +633,13 @@ void SwHyphIter::InsertSoftHyph( const xub_StrLen nHyphPos ) pSttPos->nContent += nHyphPos; SwPaM aRg( *pSttPos ); pDoc->InsertString( aRg, OUString(CHAR_SOFTHYPHEN) ); - // Durch das Einfuegen des SoftHyphs ist ein Zeichen hinzugekommen -//JP 18.07.95: warum, ist doch ein SwIndex, dieser wird doch mitverschoben !! -// pSttPos->nContent++; } - // Die Selektion wird wieder aufgehoben + // revoke selection pCrsr->DeleteMark(); pMySh->EndAction(); pCrsr->SetMark(); } -// --------------------- Methoden der SwEditShell ------------------------ - bool SwEditShell::HasLastSentenceGotGrammarChecked() const { bool bTextWasGrammarChecked = false; @@ -775,12 +751,7 @@ void SwEditShell::SpellEnd( SwConversionArgs *pConvArgs, bool bRestoreSelection } } -/************************************************************************* - * SwEditShell::SpellContinue - *************************************************************************/ - -// liefert Rueckgabewerte entsprechend SPL_ in splchk.hxx - +/// @returns SPL_ return values as in splchk.hxx uno::Any SwEditShell::SpellContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt, SwConversionArgs *pConvArgs ) @@ -802,9 +773,8 @@ uno::Any SwEditShell::SpellContinue( OSL_ENSURE( pConvArgs || pSpellIter, "SpellIter missing" ); OSL_ENSURE( !pConvArgs || pConvIter, "ConvIter missing" ); - //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen - // KEIN StartAction, da damit auch die Paints abgeschaltet - // werden !!!!! + //JP 18.07.95: prevent displaying selection on error messages. NO StartAction so that all + // Paints are also disabled. ++mnStartAction; OUString aRet; uno::Reference< uno::XInterface > xRet; @@ -822,7 +792,7 @@ uno::Any SwEditShell::SpellContinue( if( !aRet.isEmpty() || xRet.is() ) { - // dann die awt::Selection sichtbar machen + // then make awt::Selection again visible StartAction(); EndAction(); } @@ -832,31 +802,28 @@ uno::Any SwEditShell::SpellContinue( * SwEditShell::HyphStart *************************************************************************/ -/* Interaktive Trennung, BP 10.03.93 +/* Interactive Hyphenation (BP 10.03.93) * * 1) HyphStart - * - Aufheben aller Selektionen - * - Sichern des aktuellen Cursors - * - falls keine Selektion vorhanden: - * - neue Selektion bis zum Dokumentende + * - Revoke all Selections + * - Save current Cursor + * - if no selections existant: + * - create new selection reaching until document end * 2) HyphContinue - * - nLastHyphLen wird auf den Selektionsstart addiert - * - iteriert ueber alle selektierten Bereiche - * - pDoc->Hyphenate() iteriert ueber alle Nodes der Selektion - * - pTxtNode->Hyphenate() ruft das SwTxtFrm::Hyphenate zur EditShell - * - SwTxtFrm:Hyphenate() iteriert ueber die Zeilen des Pams - * - LineIter::Hyphenate() stellt den Hyphenator - * und den Pam auf das zu trennende Wort ein. - * - Es gibt nur zwei Returnwerte sal_True, wenn eine Trennstelle anliegt - * und sal_False, wenn der Pam abgearbeitet wurde. - * - Bei sal_True wird das selektierte Wort zur Anzeige gebracht und - * nLastHyphLen gesetzt. - * - Bei sal_False wird die aktuelle Selektion geloescht und die naechste - * zur aktuellen gewaehlt. Return HYPH_OK, wenn keine mehr vorhanden. - * 3) InsertSoftHyph (wird ggf. von der UI gerufen) - * - Der aktuelle Cursor wird plaziert und das Attribut eingefuegt. + * - add nLastHyphLen onto SelectionStart + * - iterate over all selected areas + * - pDoc->Hyphenate() iterates over all Nodes of a selection + * - pTxtNode->Hyphenate() calls SwTxtFrm::Hyphenate of the EditShell + * - SwTxtFrm:Hyphenate() iterates over all rows of the Pam + * - LineIter::Hyphenate() sets the Hyphenator and the Pam based on + * the to be separated word. + * - Returns sal_True if there is a hyphenation and sal_False if the Pam is processed. + * - If sal_True, show the selected word and set nLastHyphLen. + * - If sal_False, delete current selection and select next one. Returns HYPH_OK if no more. + * 3) InsertSoftHyph (might be called by UI if needed) + * - Place current cursor and add attribute. * 4) HyphEnd - * - Wiederherstellen des alten Cursors, EndAction + * - Restore old cursor, EndAction */ @@ -872,33 +839,18 @@ void SwEditShell::HyphStart( SwDocPositions eStart, SwDocPositions eEnd ) } } -/************************************************************************* - * SwEditShell::HyphEnd - *************************************************************************/ - -// Selektionen wiederherstellen - - - +/// restore selections void SwEditShell::HyphEnd() { if (pHyphIter->GetSh() == this) { - OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); + OSL_ENSURE( pHyphIter, "No Iterator" ); pHyphIter->End(); delete pHyphIter, pHyphIter = 0; } } -/************************************************************************* - * SwEditShell::HyphContinue - *************************************************************************/ - -// Returnwerte: (BP: ich wuerde es genau umdrehen, aber die UI wuenscht es so) -// HYPH_CONTINUE, wenn eine Trennstelle anliegt -// HYPH_OK, wenn der selektierte Bereich abgearbeitet wurde. - - +/// @returns HYPH_CONTINUE if hyphenation, HYPH_OK if selected area was processed. uno::Reference< uno::XInterface > SwEditShell::HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) { @@ -914,14 +866,13 @@ uno::Reference< uno::XInterface > *pPageCnt = nEndPage; ::StartProgress( STR_STATSTR_HYPHEN, 0, nEndPage, GetDoc()->GetDocShell()); } - else // Hiermit unterdruecken wir ein fuer allemal - *pPageSt = 1; // das StatLineStartPercent + else // here we once and for all suppress StatLineStartPercent + *pPageSt = 1; } - OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); - //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen - // KEIN StartAction, da damit auch die Paints abgeschaltet - // werden !!!!! + OSL_ENSURE( pHyphIter, "No Iterator" ); + //JP 18.07.95: prevent displaying selection on error messages. NO StartAction so that all + // Paints are also disabled. ++mnStartAction; uno::Reference< uno::XInterface > xRet; pHyphIter->Continue( pPageCnt, pPageSt ) >>= xRet; @@ -934,33 +885,22 @@ uno::Reference< uno::XInterface > } -/************************************************************************* - * SwEditShell::InsertSoftHyph - *************************************************************************/ - -// Zum Einfuegen des SoftHyphens, Position ist der Offset -// innerhalb des getrennten Wortes. - - +/** Insert soft hyphen + * + * @param nHyphPos Offset in the to be separated word + */ void SwEditShell::InsertSoftHyph( const xub_StrLen nHyphPos ) { OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); pHyphIter->InsertSoftHyph( nHyphPos ); } - -/************************************************************************* - * SwEditShell::HyphIgnore - *************************************************************************/ - -// Beschreibung: Trennstelle ignorieren - +/// ignore hyphenation void SwEditShell::HyphIgnore() { - OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" ); - //JP 18.07.95: verhinder bei Fehlermeldungen die Anzeige der Selektionen - // KEIN StartAction, da damit auch die Paints abgeschaltet - // werden !!!!! + OSL_ENSURE( pHyphIter, "No Iterator" ); + //JP 18.07.95: prevent displaying selection on error messages. NO StartAction so that all + // Paints are also disabled. ++mnStartAction; pHyphIter->Ignore(); --mnStartAction; @@ -968,15 +908,14 @@ void SwEditShell::HyphIgnore() pHyphIter->ShowSelection(); } -/************************************************************************* - * SwEditShell::GetCorrection() - * liefert eine Liste von Vorschlaegen fuer falsch geschriebene Worte, - * ein NULL-Pointer signalisiert, dass das Wort richtig geschrieben ist, - * eine leere Liste, dass das Wort zwar unbekannt ist, aber keine Alternativen - * geliefert werden koennen. - *************************************************************************/ - - +/** Get a list of potential corrections for misspelled word. + * + * If empty, word is unknown but there are no corrections available. + * If NULL then the word is not misspelled but correct. + * + * @brief SwEditShell::GetCorrection + * @return list or NULL pointer + */ uno::Reference< XSpellAlternatives > SwEditShell::GetCorrection( const Point* pPt, SwRect& rSelectRect ) { @@ -1031,7 +970,7 @@ uno::Reference< XSpellAlternatives > if ( xSpellAlt.is() ) // error found? { - //save the start and end positons of the line and the starting point + // save the start and end positons of the line and the starting point Push(); LeftMargin(); xub_StrLen nLineStart = GetCrsr()->GetPoint()->nContent.GetIndex(); @@ -1500,7 +1439,7 @@ bool SwSpellIter::SpellSentence(::svx::SpellPortions& rPortions, bool bIsGrammar if( !pMySh ) return false; - OSL_ENSURE( GetEnd(), "SwEditShell::SpellSentence() ohne Start?"); + OSL_ENSURE( GetEnd(), "SwSpellIter::SpellSentence without Start?"); uno::Reference< XSpellAlternatives > xSpellRet; linguistic2::ProofreadingResult aGrammarResult; diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 3fa8bf9d982c..4566903017e1 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -112,14 +112,11 @@ SwPaM& SwPamRanges::SetPam( sal_uInt16 nArrPos, SwPaM& rPam ) return rPam; } - - -// Numerierung Outline Regelwerk - +// Rule book for outline numbering void SwEditShell::SetOutlineNumRule(const SwNumRule& rRule) { - StartAllAction(); // Klammern fuers Updaten !! + StartAllAction(); // bracketing for updating! GetDoc()->SetOutlineNumRule(rRule); EndAllAction(); } @@ -130,18 +127,17 @@ const SwNumRule* SwEditShell::GetOutlineNumRule() const return GetDoc()->GetOutlineNumRule(); } -// setzt, wenn noch keine Numerierung, sonst wird geaendert -// arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren - -// Absaetze ohne Numerierung, aber mit Einzuegen +// Set if there is no numbering yet, else update. +// Works with old and new rules. Update only differences. +// paragraphs without numbering, with indentations bool SwEditShell::NoNum() { bool bRet = true; StartAllAction(); SwPaM* pCrsr = GetCrsr(); - if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? + if( pCrsr->GetNext() != pCrsr ) // Multiple selection? { GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); @@ -156,7 +152,7 @@ bool SwEditShell::NoNum() EndAllAction(); return bRet; } -// Loeschen, Splitten der Aufzaehlungsliste + sal_Bool SwEditShell::SelectionHasNumber() const { sal_Bool bResult = HasNumber(); @@ -281,12 +277,13 @@ sal_Bool SwEditShell::HasBullet() const } // <- #i29560# +/// delete, split list void SwEditShell::DelNumRules() { StartAllAction(); SwPaM* pCrsr = GetCrsr(); - if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? + if( pCrsr->GetNext() != pCrsr ) // multi-selection? { GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); @@ -300,28 +297,24 @@ void SwEditShell::DelNumRules() else GetDoc()->DelNumRules( *pCrsr ); - // rufe das AttrChangeNotify auf der UI-Seite. Sollte eigentlich - // ueberfluessig sein, aber VB hatte darueber eine Bugrep. + // Call AttrChangeNotify on the UI-side. Should actually be redundant but there was a bug once. CallChgLnk(); - // cursor can not be anymore in front of a label, - // because numbering/bullet is deleted. + // Cursor cannot be in front of a label anymore, because numbering/bullet is deleted. SetInFrontOfLabel( false ); GetDoc()->SetModified(); EndAllAction(); } -// Hoch-/Runterstufen - - +// up- & downgrading bool SwEditShell::NumUpDown( bool bDown ) { StartAllAction(); bool bRet = true; SwPaM* pCrsr = GetCrsr(); - if( pCrsr->GetNext() == pCrsr ) // keine Mehrfachselektion ? + if( pCrsr->GetNext() == pCrsr ) // no multiple selection ? bRet = GetDoc()->NumUpDown( *pCrsr, bDown ); else { @@ -431,7 +424,7 @@ bool SwEditShell::MoveParagraph( long nOffset ) SwPaM *pCrsr = GetCrsr(); if( !pCrsr->HasMark() ) { - // sorge dafuer, das Bound1 und Bound2 im gleichen Node stehen + // Ensures that Bound1 and Bound2 are in the same Node pCrsr->SetMark(); pCrsr->DeleteMark(); } @@ -471,7 +464,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) { StartAllAction(); - // auf alle Selektionen ?? + // On all selections? SwPaM* pCrsr = GetCrsr(); SwPaM aCrsr( *pCrsr->Start() ); aCrsr.SetMark(); @@ -486,11 +479,11 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) { if( bUpperLower ) { - // ueber die naechste Nummerierung + // on top of the next numbering long nOffset = 0; const SwNode* pNd; - if( bUpperLeft ) // verschiebe nach oben + if( bUpperLeft ) // move up { SwPosition aPos( *aCrsr.GetMark() ); if( GetDoc()->GotoPrevNum( aPos, false ) ) @@ -507,7 +500,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool bUpperLeft ) nOffset = nIdx - nStt; } } - else // verschiebe nach unten + else // move down { const SwNumRule* pOrig = aCrsr.GetNode(sal_False)->GetTxtNode()->GetNumRule(); if( aCrsr.GetNode()->IsTxtNode() && @@ -566,7 +559,7 @@ bool SwEditShell::OutlineUpDown( short nOffset ) bool bRet = true; SwPaM* pCrsr = GetCrsr(); - if( pCrsr->GetNext() == pCrsr ) // keine Mehrfachselektion ? + if( pCrsr->GetNext() == pCrsr ) // no multi selection? bRet = GetDoc()->OutlineUpDown( *pCrsr, nOffset ); else { @@ -683,7 +676,7 @@ bool SwEditShell::NumOrNoNum( sal_Bool bNumOn, bool bChkStart ) sal_Bool SwEditShell::IsNoNum( sal_Bool bChkStart ) const { - // ein Backspace im Absatz ohne Nummer wird zum Delete + // a Backspace in the paragraph without number becomes a Delete sal_Bool bResult = sal_False; SwPaM* pCrsr = GetCrsr(); @@ -703,7 +696,7 @@ sal_Bool SwEditShell::IsNoNum( sal_Bool bChkStart ) const sal_uInt8 SwEditShell::GetNumLevel() const { - // gebe die akt. Ebene zurueck, auf der sich der Point vom Cursor befindet + // return current level where the point of the cursor is sal_uInt8 nLevel = MAXLEVEL; //end,zhaojianwei SwPaM* pCrsr = GetCrsr(); @@ -741,7 +734,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule, GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPaM* pCrsr = GetCrsr(); - if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? + if( pCrsr->GetNext() != pCrsr ) // multiple selection ? { SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); @@ -790,7 +783,7 @@ void SwEditShell::SetNumRuleStart( sal_Bool bFlag, SwPaM* pPaM ) { StartAllAction(); SwPaM* pCrsr = pPaM ? pPaM : GetCrsr(); - if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? + if( pCrsr->GetNext() != pCrsr ) // multiple selection ? { GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); @@ -820,7 +813,7 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt, SwPaM* pPaM ) StartAllAction(); SwPaM* pCrsr = pPaM ? pPaM : GetCrsr(); - if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? + if( pCrsr->GetNext() != pCrsr ) // multiple selection ? { GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index c10e243abcd3..97e999ef2c48 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -155,13 +155,12 @@ sal_Bool SwEditShell::TableToText( sal_Unicode cCh ) StartAllAction(); - // verschiebe den akt. Cursor aus dem Tabellen Bereich - // angemeldet ist + // move current Cursor out of the listing area SwNodeIndex aTabIdx( *pTblNd ); pCrsr->DeleteMark(); pCrsr->GetPoint()->nNode = *pTblNd->EndOfSectionNode(); pCrsr->GetPoint()->nContent.Assign( 0, 0 ); - // SPoint und Mark aus dem Bereich verschieben !!! + // move sPoint and Mark out of the area! pCrsr->SetMark(); pCrsr->DeleteMark(); @@ -190,7 +189,7 @@ sal_Bool SwEditShell::IsTextToTableAvailable() const { bOnlyText = sal_True; - // pruefe ob in der Selection eine Tabelle liegt + // check if selection is in listing sal_uLong nStt = PCURCRSR->GetMark()->nNode.GetIndex(), nEnd = PCURCRSR->GetPoint()->nNode.GetIndex(); if( nStt > nEnd ) { sal_uLong n = nStt; nStt = nEnd; nEnd = n; } @@ -242,9 +241,7 @@ void SwEditShell::InsertDDETable( const SwInsertTableOptions& rInsTblOpts, EndAllAction(); } -/*-------------------------------------------------------------------- - Beschreibung: Tabellenfelder einer Tabelle updaten - --------------------------------------------------------------------*/ +/** update fields of a listing */ void SwEditShell::UpdateTable() { const SwTableNode* pTblNd = IsCrsrInTbl(); @@ -264,7 +261,8 @@ void SwEditShell::UpdateTable() } } - // Change Modus erfragen/setzen +// get/set Change Mode + TblChgMode SwEditShell::GetTblChgMode() const { TblChgMode eMode; @@ -280,7 +278,6 @@ void SwEditShell::SetTblChgMode( TblChgMode eMode ) { const SwTableNode* pTblNd = IsCrsrInTbl(); - // Keine Arme keine Kekse if( pTblNd ) { ((SwTable&)pTblNd->GetTable()).SetTblChgMode( eMode ); @@ -318,7 +315,7 @@ sal_Bool SwEditShell::GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const const SwTableBoxFmt* pTblFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt(); if( !n ) { - // Formeln in die externe Darstellung bringen! + // Convert formulae into external presentation const SwTable& rTbl = pSelBox->GetSttNd()->FindTableNode()->GetTable(); SwTableFmlUpdate aTblUpdate( (SwTable*)&rTbl ); @@ -354,7 +351,7 @@ void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet ) } while( false ); } - // beim setzen einer Formel keine Ueberpruefung mehr vornehmen! + // When setting a formula, do not check further! if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA )) ClearTblBoxCntnt(); @@ -482,13 +479,13 @@ sal_Bool SwEditShell::CanMergeTable( sal_Bool bWithPrev, sal_Bool* pChkNxtPrv ) bNew == pChkNd->GetTable().IsNewModel() && // Consider table in table case pChkNd->EndOfSectionIndex() == pTblNd->GetIndex() - 1 ) - *pChkNxtPrv = sal_True, bRet = sal_True; // mit Prev ist moeglich + *pChkNxtPrv = sal_True, bRet = sal_True; // using Prev is possible else { pChkNd = rNds[ pTblNd->EndOfSectionIndex() + 1 ]->GetTableNode(); if( pChkNd && !pChkNd->GetTable().ISA( SwDDETable ) && bNew == pChkNd->GetTable().IsNewModel() ) - *pChkNxtPrv = sal_False, bRet = sal_True; // mit Next ist moeglich + *pChkNxtPrv = sal_False, bRet = sal_True; // using Next is possible } } else @@ -512,7 +509,7 @@ sal_Bool SwEditShell::CanMergeTable( sal_Bool bWithPrev, sal_Bool* pChkNxtPrv ) return bRet; } - // setze das InsertDB als Tabelle Undo auf: +/** create InsertDB as table Undo */ void SwEditShell::AppendUndoForInsertFromDB( sal_Bool bIsTable ) { GetDoc()->AppendUndoForInsertFromDB( *GetCrsr(), bIsTable ); diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index d4f878185fc3..f91912903989 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -54,10 +54,7 @@ using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; -/*-------------------------------------------------------------------- - Beschreibung: Verzeichnismarkierung ins Dokument einfuegen/loeschen - --------------------------------------------------------------------*/ - +// Add/delete listing markers to a document void SwEditShell::Insert(const SwTOXMark& rMark) { @@ -94,11 +91,7 @@ void SwEditShell::DeleteTOXMark( SwTOXMark* pMark ) EndAllAction(); } - -/*-------------------------------------------------------------------- - Beschreibung: Alle Verzeichnismarkierungen am SPoint zusammensuchen - --------------------------------------------------------------------*/ - +/// Collect all listing markers sal_uInt16 SwEditShell::GetCurTOXMarks(SwTOXMarks& rMarks) const { return GetDoc()->GetCurTOXMark( *GetCrsr()->Start(), rMarks ); @@ -133,10 +126,7 @@ void SwEditShell::SetDefaultTOXBase(const SwTOXBase& rBase) GetDoc()->SetDefaultTOXBase(rBase); } -/*-------------------------------------------------------------------- - Beschreibung: Verzeichnis einfuegen, und Inhalt erzeugen - --------------------------------------------------------------------*/ - +/// Insert listing and create content void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) { SET_CURR_SHELL( this ); @@ -146,36 +136,33 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) ::StartProgress( STR_STATSTR_TOX_INSERT, 0, 0, pDocSh ); ::SetProgressText( STR_STATSTR_TOX_INSERT, pDocSh ); - // Einfuegen des Verzeichnisses + // Insert listing const SwTOXBaseSection* pTOX = mpDoc->InsertTableOf( *GetCrsr()->GetPoint(), rTOX, pSet, true ); - OSL_ENSURE(pTOX, "Kein aktuelles Verzeichnis"); + OSL_ENSURE(pTOX, "No current TOx"); - // Formatierung anstossen + // start formatting CalcLayout(); - // Seitennummern eintragen + // insert page numbering ((SwTOXBaseSection*)pTOX)->UpdatePageNum(); pTOX->SetPosAtStartEnd( *GetCrsr()->GetPoint() ); - // Fix fuer leere Verzeichnisse + // Fix for empty listing InvalidateWindows( maVisArea ); ::EndProgress( pDocSh ); EndAllAction(); } -/*-------------------------------------------------------------------- - Beschreibung: Verzeichnisinhalt erneuern - --------------------------------------------------------------------*/ - +/// update tables of content sal_Bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) { sal_Bool bRet = sal_False; - OSL_ENSURE( rTOX.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); + OSL_ENSURE( rTOX.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOX; - OSL_ENSURE(pTOX, "Keine aktuelles Verzeichnis"); + OSL_ENSURE(pTOX, "no current listing"); const SwSectionNode* pSectNd; if( pTOX && 0 != ( pSectNd = pTOX->GetFmt()->GetSectionNode() ) ) { @@ -191,17 +178,17 @@ sal_Bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pS pMyDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL); - // Verzeichnisrumpf erzeugen + // create listing stub pTOX->Update(pSet); - // Cursor korrigieren + // correct Cursor if( bInIndex ) pTOX->SetPosAtStartEnd( *GetCrsr()->GetPoint() ); - // Formatierung anstossen + // start formatting CalcLayout(); - // Seitennummern eintragen + // insert page numbering pTOX->UpdatePageNum(); pMyDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL); @@ -212,11 +199,7 @@ sal_Bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pS return bRet; } -/*-------------------------------------------------------------------- - Beschreibung: Aktuelles Verzeichnis vor oder in dem der Cursor - steht - --------------------------------------------------------------------*/ - +/// Get current listing before or at the Cursor const SwTOXBase* SwEditShell::GetCurTOX() const { return GetDoc()->GetCurTOX( *GetCrsr()->GetPoint() ); @@ -227,18 +210,14 @@ bool SwEditShell::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ) return GetDoc()->DeleteTOX( (SwTOXBase&)rTOXBase, bDelNodes ); } -/*-------------------------------------------------------------------- - Beschreibung: Typen der Verzeichnisse verwalten - --------------------------------------------------------------------*/ +// manage types of listings const SwTOXType* SwEditShell::GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const { return mpDoc->GetTOXType(eTyp, nId); } -/*-------------------------------------------------------------------- - Beschreibung: Schluessel fuer Stichwortverzeichnisse verwalten - --------------------------------------------------------------------*/ +// manage keys for the alphabetical index sal_uInt16 SwEditShell::GetTOIKeys( SwTOIKeyType eTyp, std::vector& rArr ) const { @@ -271,15 +250,14 @@ const SwTOXBase* SwEditShell::GetTOX( sal_uInt16 nPos ) const pSect->GetFmt()->GetSectionNode() && nCnt++ == nPos ) { - OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); + OSL_ENSURE( pSect->ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); return (SwTOXBaseSection*)pSect; } } return 0; } - - // nach einlesen einer Datei alle Verzeichnisse updaten +/** Update of all listings after reading-in a file */ void SwEditShell::SetUpdateTOX( sal_Bool bFlag ) { GetDoc()->SetUpdateTOX( bFlag ); diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index 5baad3c8a2e2..09537fe460da 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -106,24 +106,21 @@ bool SwEditShell::Undo(sal_uInt16 const nCount) StartAllAction(); { - // eigentlich muesste ja nur der aktuelle Cursor berarbeitet - // werden, d.H. falls ein Ring besteht, diesen temporaer aufheben, - // damit nicht bei Einfuge-Operationen innerhalb von Undo - // an allen Bereichen eingefuegt wird. + // Actually it should be enough to just work on the current Cursor, i.e. if there is a cycle + // cancel the latter temporarily, so that an insert during Undo is not done in all areas. KillPams(); - SetMark(); // Bound1 und Bound2 in den gleichen Node + SetMark(); // Bound1 and Bound2 in the same Node ClearMark(); - // JP 02.04.98: Cursor merken - beim Auto-Format/-Korrektur - // soll dieser wieder an die Position + // Keep Cursor - so that we're able to set it at + // the same position for autoformat or autocorrection SwUndoId nLastUndoId(UNDO_EMPTY); GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId); bool bRestoreCrsr = 1 == nCount && (UNDO_AUTOFORMAT == nLastUndoId || UNDO_AUTOCORRECT == nLastUndoId ); Push(); - //JP 18.09.97: gesicherten TabellenBoxPtr zerstoeren, eine autom. - // Erkennung darf nur noch fuer die neue "Box" erfolgen! + // Destroy stored TableBoxPtr. A dection is only permitted for the new "Box"! ClearTblBoxCntnt(); RedlineMode_t eOld = GetDoc()->GetRedlineMode(); @@ -149,7 +146,7 @@ bool SwEditShell::Undo(sal_uInt16 const nCount) GetDoc()->SetRedlineMode( eOld ); GetDoc()->CompressRedlines(); - // autom. Erkennung fuer die neue "Box" + // automatic detection of the new "Box" SaveTblBoxCntnt(); } EndAllAction(); @@ -169,16 +166,13 @@ bool SwEditShell::Redo(sal_uInt16 const nCount) StartAllAction(); { - // eigentlich muesste ja nur der aktuelle Cursor berarbeitet - // werden, d.H. falls ein Ring besteht, diesen temporaer aufheben, - // damit nicht bei Einfuge-Operationen innerhalb von Undo - // an allen Bereichen eingefuegt wird. + // Actually it should be enough to just work on the current Cursor, i.e. if there is a cycle + // cancel the latter temporarily, so that an insert during Undo is not done in all areas. KillPams(); - SetMark(); // Bound1 und Bound2 in den gleichen Node + SetMark(); // Bound1 and Bound2 in the same Node ClearMark(); - //JP 18.09.97: gesicherten TabellenBoxPtr zerstoeren, eine autom. - // Erkennung darf nur noch fuer die neue "Box" erfolgen! + // Destroy stored TableBoxPtr. A dection is only permitted for the new "Box"! ClearTblBoxCntnt(); RedlineMode_t eOld = GetDoc()->GetRedlineMode(); @@ -198,7 +192,7 @@ bool SwEditShell::Redo(sal_uInt16 const nCount) GetDoc()->SetRedlineMode( eOld ); GetDoc()->CompressRedlines(); - // autom. Erkennung fuer die neue "Box" + // automatic detection of the new "Box" SaveTblBoxCntnt(); } diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 48a7eaba531f..0c646f9aff2f 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -31,12 +31,7 @@ #include #include -/******************************************************** - * Ctor/Dtor - ********************************************************/ -// verkleideter Copy-Constructor - - +// masqueraded copy constructor SwEditShell::SwEditShell( SwEditShell& rEdSH, Window *pWindow ) : SwCrsrShell( rEdSH, pWindow ) { @@ -145,15 +140,12 @@ void SwEditShell::CalcLayout() EndAllAction(); } -/****************************************************************************** - * Inhaltsform bestimmen, holen - ******************************************************************************/ -// OPT: wird fuer jedes Attribut gerufen? - - +/** Get the content type of a shell + * + * @todo Is this called for every attribute? + */ sal_uInt16 SwEditShell::GetCntType() const { - // nur noch am SPoint ist der Inhalt interessant sal_uInt16 nRet = 0; if( IsTableMode() ) nRet = CNT_TXT; @@ -192,10 +184,7 @@ sal_Bool SwEditShell::HasOtherCnt() const return sal_False; } -/****************************************************************************** - * Zugriffsfunktionen fuer Filename-Behandlung - ******************************************************************************/ - +// access controll functions for file name handling SwActContext::SwActContext(SwEditShell *pShell) : pSh(pShell) @@ -222,16 +211,13 @@ SwMvContext::~SwMvContext() pSh->EndCrsrMove(); } - -SwFrmFmt *SwEditShell::GetTableFmt() // OPT: schnellster Test auf Tabelle? +SwFrmFmt *SwEditShell::GetTableFmt() // fastest test on a table { const SwTableNode* pTblNd = IsCrsrInTbl(); return pTblNd ? (SwFrmFmt*)pTblNd->GetTable().GetFrmFmt() : 0; } -// OPT: wieso 3x beim neuen Dokument - - +// TODO: Why is this called 3x for a new document? sal_uInt16 SwEditShell::GetTOXTypeCount(TOXTypes eTyp) const { return mpDoc->GetTOXTypeCount(eTyp); @@ -266,19 +252,23 @@ void SwEditShell::DelAllUndoObj() GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); } -// Zusammenfassen von Kontinuierlichen Insert/Delete/Overwrite von -// Charaktern. Default ist sdbcx::Group-Undo. - -// setzt Undoklammerung auf, liefert nUndoId der Klammerung - +// Combine continuous calls of Insert/Delete/Overwrite on characters. Default: sdbcx::Group-Undo. +/** open undo container + * + * @return nUndoId ID of the container + */ SwUndoId SwEditShell::StartUndo( SwUndoId eUndoId, const SwRewriter *pRewriter ) { return GetDoc()->GetIDocumentUndoRedo().StartUndo( eUndoId, pRewriter ); } -// schliesst Klammerung der nUndoId, nicht vom UI benutzt - - +/** close undo container + * + * not used by UI + * + * @param eUndoId ID of the undo container + * @param pRewriter ? +*/ SwUndoId SwEditShell::EndUndo(SwUndoId eUndoId, const SwRewriter *pRewriter) { return GetDoc()->GetIDocumentUndoRedo().EndUndo(eUndoId, pRewriter); } @@ -294,9 +284,7 @@ bool SwEditShell::GetFirstRedoInfo(OUString *const o_pStr) const SwUndoId SwEditShell::GetRepeatInfo(OUString *const o_pStr) const { return GetDoc()->GetIDocumentUndoRedo().GetRepeatInfo(o_pStr); } - - -// AutoKorrektur - JP 27.01.94 +/** Auto correction */ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Bool bInsert, sal_Unicode cChar ) { -- cgit v1.2.3