From e7540edefe1cf5b7f52ddb9b7b4824479da9234b Mon Sep 17 00:00:00 2001 From: Philipp Riemer Date: Mon, 9 Jul 2012 02:46:07 +0200 Subject: fdo#39468: translate German comments (=> sw/source/core/crsr) (removed some old internal StarDivision bug-refs) Conflicts: sw/source/core/crsr/findtxt.cxx sw/source/core/crsr/pam.cxx Change-Id: Ib88500bf3cae5f6d8cfccd50769c27819999c5fe --- sw/source/core/crsr/callnk.cxx | 2 +- sw/source/core/crsr/crbm.cxx | 2 +- sw/source/core/crsr/crsrsh.cxx | 523 ++++++++++++++++++--------------------- sw/source/core/crsr/crstrvl.cxx | 269 ++++++++++---------- sw/source/core/crsr/findattr.cxx | 259 +++++++++---------- sw/source/core/crsr/findcoll.cxx | 11 +- sw/source/core/crsr/findfmt.cxx | 17 +- sw/source/core/crsr/findtxt.cxx | 57 ++--- sw/source/core/crsr/pam.cxx | 146 ++++------- sw/source/core/crsr/paminit.cxx | 4 +- sw/source/core/crsr/swcrsr.cxx | 240 ++++++++---------- sw/source/core/crsr/trvlcol.cxx | 2 +- sw/source/core/crsr/trvlfnfl.cxx | 44 ++-- sw/source/core/crsr/trvlreg.cxx | 22 +- sw/source/core/crsr/trvltbl.cxx | 123 +++++---- sw/source/core/crsr/unocrsr.cxx | 12 +- sw/source/core/crsr/viscrs.cxx | 6 +- 17 files changed, 783 insertions(+), 956 deletions(-) (limited to 'sw') diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index e2101b50b70b..66c0b265f851 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -235,7 +235,7 @@ SwCallLink::~SwCallLink() 0 != ( pFlyFrm = pFrm->FindFlyFrm() ) && !rShell.IsTableMode() ) { const SwNodeIndex* pIndex = pFlyFrm->GetFmt()->GetCntnt().GetCntntIdx(); - OSL_ENSURE( pIndex, "Fly ohne Cntnt" ); + OSL_ENSURE( pIndex, "Fly without Cntnt" ); if (!pIndex) return; diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index d1dfe8f0b768..08b80ae8f47a 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -111,7 +111,7 @@ namespace EndAction(); return pMark; } -// setzt CurCrsr.SPoint +// set CurCrsr.SPoint bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark, bool bAtStart) { diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 246ad75a1bd1..7e4056ea1e6a 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -354,7 +354,7 @@ sal_Bool SwCrsrShell::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMo if( IsTableMode() ) return bLeft ? GoPrevCell() : GoNextCell(); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed sal_Bool bRet = sal_False; // #i27615# Handle cursor in front of label. @@ -461,7 +461,7 @@ void SwCrsrShell::UpdateMarkedListLevel() sal_Bool SwCrsrShell::UpDown( sal_Bool bUp, sal_uInt16 nCnt ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed sal_Bool bTableMode = IsTableMode(); SwShellCrsr* pTmpCrsr = getShellCrsr( true ); @@ -475,7 +475,7 @@ sal_Bool SwCrsrShell::UpDown( sal_Bool bUp, sal_uInt16 nCnt ) if( bRet ) { - eMvState = MV_UPDOWN; // Status fuers Crsr-Travelling - GetCrsrOfst + eMvState = MV_UPDOWN; // status for Crsr travelling - GetCrsrOfst if( !ActionPend() ) { CrsrFlag eUpdtMode = SwCrsrShell::SCROLLWIN; @@ -488,12 +488,11 @@ sal_Bool SwCrsrShell::UpDown( sal_Bool bUp, sal_uInt16 nCnt ) return bRet; } - sal_Bool SwCrsrShell::LRMargin( sal_Bool bLeft, sal_Bool bAPI) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SET_CURR_SHELL( this ); - eMvState = MV_LEFTMARGIN; // Status fuers Crsr-Travelling - GetCrsrOfst + eMvState = MV_LEFTMARGIN; // status for Crsr travelling - GetCrsrOfst const sal_Bool bTableMode = IsTableMode(); SwShellCrsr* pTmpCrsr = getShellCrsr( true ); @@ -533,14 +532,14 @@ sal_Bool SwCrsrShell::IsAtLRMargin( sal_Bool bLeft, sal_Bool bAPI ) const sal_Bool SwCrsrShell::SttEndDoc( sal_Bool bStt ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwShellCrsr* pTmpCrsr = pBlockCrsr ? &pBlockCrsr->getShellCrsr() : pCurCrsr; sal_Bool bRet = pTmpCrsr->SttEndDoc( bStt ); if( bRet ) { if( bStt ) - pTmpCrsr->GetPtPos().Y() = 0; // expl. 0 setzen (TabellenHeader) + pTmpCrsr->GetPtPos().Y() = 0; // set to 0 explicitly (table header) if( pBlockCrsr ) { pBlockCrsr->clearPoints(); @@ -568,10 +567,10 @@ sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) { sal_Bool bRet = sal_False; - // Springe beim Selektieren nie ueber Section-Grenzen !! + // never jump of section borders at selection if( !pCurCrsr->HasMark() || !pCurCrsr->IsNoCntnt() ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SET_CURR_SHELL( this ); SwCrsrSaveState aSaveState( *pCurCrsr ); @@ -592,7 +591,7 @@ sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage ) sal_Bool SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwCursor* pTmpCrsr = getShellCrsr( true ); sal_Bool bRet = pTmpCrsr->MovePara( fnWhichPara, fnPosPara ); if( bRet ) @@ -614,7 +613,7 @@ sal_Bool SwCrsrShell::MoveSection( SwWhichSection fnWhichSect, } -// Positionieren des Cursors +// position cursor SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt ) @@ -678,12 +677,11 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock ) if( MV_RIGHTMARGIN == aTmpState.eState ) eMvState = MV_RIGHTMARGIN; - // steht neu Pos im Header/Footer ? + // is the new position in header or footer? SwFrm* pFrm = lcl_IsInHeaderFooter( aPos.nNode, aPt ); if( IsTableMode() && !pFrm && aPos.nNode.GetNode().StartOfSectionNode() == pCrsr->GetPoint()->nNode.GetNode().StartOfSectionNode() ) - // gleiche Tabellenzelle und nicht im Header/Footer - // -> zurueck + // same table column and not in header/footer -> back return bRet; // Toggle the Header/Footer mode if needed @@ -701,8 +699,7 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock ) } if( !pCrsr->HasMark() ) { - // steht an der gleichen Position und wenn im Header/Footer, - // dann im gleichen + // is at the same position and if in header/footer -> in the same if( aPos == *pCrsr->GetPoint() && bOldInFrontOfLabel == bNewInFrontOfLabel ) { @@ -713,7 +710,7 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock ) } else if( aPos.nNode.GetNode().IsCntntNode() ) { - // im gleichen Frame gelandet? + // in the same frame? SwFrm* pOld = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm( GetLayout(), &aCharRect.Pos(), 0, sal_False ); SwFrm* pNew = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm( @@ -725,18 +722,17 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock ) } else { - // SSelection ueber nicht erlaubte Sections oder wenn im Header/Footer - // dann in verschiedene + // SSelection over not allowed sections or if in header/footer -> different if( !CheckNodesRange( aPos.nNode, pCrsr->GetMark()->nNode, sal_True ) || ( pFrm && !pFrm->Frm().IsInside( pCrsr->GetMkPos() ) )) return bRet; - // steht an der gleichen Position und nicht im Header/Footer + // is at same position but not in header/footer if( aPos == *pCrsr->GetPoint() ) return bRet; } - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwCrsrSaveState aSaveState( *pCrsr ); *pCrsr->GetPoint() = aPos; @@ -758,7 +754,7 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock ) { if( FindValidCntntNode( bOnlyText ) ) { - // Cursor in einen gueltigen Content stellen + // position cursor in a valid content if( aPos == *pCrsr->GetPoint() ) bRet = CRSR_POSOLD; else @@ -769,14 +765,14 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock ) } else { - // es gibt keinen gueltigen Inhalt -> Cursor verstecken - pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken - eMvState = MV_NONE; // Status fuers Crsr-Travelling + // there is no valid content -> hide cursor + pVisCrsr->Hide(); // always hide visible cursor + eMvState = MV_NONE; // status for Crsr travelling bAllProtect = sal_True; if( GetDoc()->GetDocShell() ) { GetDoc()->GetDocShell()->SetReadOnlyUI( sal_True ); - CallChgLnk(); // UI bescheid sagen! + CallChgLnk(); // notify UI } } } @@ -828,7 +824,7 @@ void SwCrsrShell::CrsrToBlockCrsr() void SwCrsrShell::ClearMark() { - // ist ueberhaupt ein GetMark gesetzt ? + // is there any GetMark? if( pTblCrsr ) { while( pCurCrsr->GetNext() != pCurCrsr ) @@ -837,9 +833,8 @@ void SwCrsrShell::ClearMark() if( pCurCrsr->HasMark() ) { - // falls doch nicht alle Indizies richtig verschoben werden - // (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom - // Mark aufs Nodes-Array setzen + // move content part from mark to nodes array if not all indices + // were moved correctly (e.g. when deleting header/footer) SwPosition& rPos = *pCurCrsr->GetMark(); rPos.nNode.Assign( pDoc->GetNodes(), 0 ); rPos.nContent.Assign( 0, 0 ); @@ -855,9 +850,8 @@ void SwCrsrShell::ClearMark() { if( !pCurCrsr->HasMark() ) return; - // falls doch nicht alle Indizies richtig verschoben werden - // (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom - // Mark aufs Nodes-Array setzen + // move content part from mark to nodes array if not all indices + // were moved correctly (e.g. when deleting header/footer) SwPosition& rPos = *pCurCrsr->GetMark(); rPos.nNode.Assign( pDoc->GetNodes(), 0 ); rPos.nContent.Assign( 0, 0 ); @@ -870,35 +864,38 @@ void SwCrsrShell::ClearMark() void SwCrsrShell::NormalizePam(sal_Bool bPointFirst) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed pCurCrsr->Normalize(bPointFirst); } void SwCrsrShell::SwapPam() { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed pCurCrsr->Exchange(); } +//TODO: provide documentation +/** Search in the selected area for a Selection that covers the given point. -// suche innerhalb der Selektierten-Bereiche nach einer Selektion, die -// den angebenen SPoint umschliesst -// Ist das Flag bTstOnly gesetzt, dann wird nur getestet, ob dort eine -// SSelection besteht; des akt. Cursr wird nicht umgesetzt! -// Ansonsten wird er auf die gewaehlte SSelection gesetzt. - + If only a test run is made, then it checks if a SSelection exists but does + not move the current cursor. In a normal run the cursor will be moved to the + chosen SSelection. + @param rPt The point to search at. + @param bTstOnly Should I only do a test run? If true so do not move cursor. + @param bTstHit ??? +*/ sal_Bool SwCrsrShell::ChgCurrPam( const Point & rPt, sal_Bool bTstOnly, sal_Bool bTstHit ) { SET_CURR_SHELL( this ); - // Pruefe ob der SPoint in einer Tabellen-Selektion liegt + // check if the SPoint is in a table selection if( bTstOnly && pTblCrsr ) return pTblCrsr->IsInside( rPt ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen - // Suche die Position rPt im Dokument + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed + // search position in document SwPosition aPtPos( *pCurCrsr->GetPoint() ); Point aPt( rPt ); @@ -907,17 +904,17 @@ sal_Bool SwCrsrShell::ChgCurrPam( const Point & rPt, if ( !GetLayout()->GetCrsrOfst( &aPtPos, aPt, &aTmpState ) && bTstHit ) return sal_False; - // suche in allen Selektionen nach dieser Position - SwShellCrsr* pCmp = (SwShellCrsr*)pCurCrsr; // sicher den Pointer auf Cursor + // search in all selections for this position + SwShellCrsr* pCmp = (SwShellCrsr*)pCurCrsr; // keep the pointer on cursor do { if( pCmp->HasMark() && *pCmp->Start() <= aPtPos && *pCmp->End() > aPtPos ) { - if( bTstOnly || pCurCrsr == pCmp ) // ist der aktuelle. - return sal_True; // return ohne Update + if( bTstOnly || pCurCrsr == pCmp ) // is the current + return sal_True; // return without update pCurCrsr = pCmp; - UpdateCrsr(); // Cursor steht schon richtig + UpdateCrsr(); // cursor is already at the right position return sal_True; } } while( pCurCrsr != @@ -928,7 +925,7 @@ sal_Bool SwCrsrShell::ChgCurrPam( const Point & rPt, void SwCrsrShell::KillPams() { - // keiner zum loeschen vorhanden? + // Does any exist for deletion? if( !pTblCrsr && !pBlockCrsr && pCurCrsr->GetNext() == pCurCrsr ) return; @@ -938,7 +935,7 @@ void SwCrsrShell::KillPams() if( pTblCrsr ) { - // Cursor Ring loeschen + // delete the ring of cursors pCurCrsr->DeleteMark(); *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint(); pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos(); @@ -1033,7 +1030,7 @@ bool SwCrsrShell::SetInFrontOfLabel( sal_Bool bNew ) sal_Bool SwCrsrShell::GotoPage( sal_uInt16 nPage ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwCrsrSaveState aSaveState( *pCurCrsr ); sal_Bool bRet = GetLayout()->SetCurrPage( pCurCrsr, nPage ) && !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | @@ -1048,7 +1045,7 @@ void SwCrsrShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, sal_Bool bAtCrsrPos, const sal_Bool bCalcFrm ) { SET_CURR_SHELL( this ); - // Seitennummer: die erste sichtbare Seite oder die am Cursor + // page number: first visible page or the one at the cursor const SwCntntFrm* pCFrm; const SwPageFrm *pPg = 0; @@ -1059,8 +1056,7 @@ void SwCrsrShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, while( pPg && pPg->IsEmptyPage() ) pPg = (const SwPageFrm *)pPg->GetNext(); } - // Abfrage auf pPg muss fuer den Sonderfall Writerstart mit - // standard.vor sein. + // pPg has to exist with a default of 1 for the special case "Writerstart" rnPhyNum = pPg? pPg->GetPhyPageNum() : 1; rnVirtNum = pPg? pPg->GetVirtPageNum() : 1; } @@ -1070,7 +1066,7 @@ sal_uInt16 SwCrsrShell::GetNextPrevPageNum( sal_Bool bNext ) { SET_CURR_SHELL( this ); - // Seitennummer: die erste sichtbare Seite oder die am Cursor + // page number: first visible page or the one at the cursor const SwPageFrm *pPg = Imp()->GetFirstVisPage(); if( pPg ) { @@ -1101,8 +1097,7 @@ sal_uInt16 SwCrsrShell::GetNextPrevPageNum( sal_Bool bNext ) pPg = (const SwPageFrm *)pPg->GetPrev(); } } - // Abfrage auf pPg muss fuer den Sonderfall Writerstart mit - // standard.vor sein. + // pPg has to exist with a default of 1 for the special case "Writerstart" return pPg ? pPg->GetPhyPageNum() : USHRT_MAX; } @@ -1110,24 +1105,22 @@ sal_uInt16 SwCrsrShell::GetNextPrevPageNum( sal_Bool bNext ) sal_uInt16 SwCrsrShell::GetPageCnt() { SET_CURR_SHELL( this ); - // gebe die Anzahl der Seiten zurueck + // return number of pages return GetLayout()->GetPageNum(); } -// Gehe zur naechsten SSelection - - +/// go to the next SSelection sal_Bool SwCrsrShell::GoNextCrsr() { - // besteht ueberhaupt ein Ring ? + // is there a ring of cursors? if( pCurCrsr->GetNext() == pCurCrsr ) return sal_False; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed pCurCrsr = dynamic_cast(pCurCrsr->GetNext()); - // Bug 24086: auch alle anderen anzeigen + // #i24086#: show also all others if( !ActionPend() ) { UpdateCrsr(); @@ -1136,20 +1129,18 @@ sal_Bool SwCrsrShell::GoNextCrsr() return sal_True; } -// gehe zur vorherigen SSelection - - +/// go to the previous SSelection sal_Bool SwCrsrShell::GoPrevCrsr() { - // besteht ueberhaupt ein Ring ? + // is there a ring of cursors? if( pCurCrsr->GetNext() == pCurCrsr ) return sal_False; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed pCurCrsr = dynamic_cast(pCurCrsr->GetPrev()); - // Bug 24086: auch alle anderen anzeigen + // #i24086#: show also all others if( !ActionPend() ) { UpdateCrsr(); @@ -1164,18 +1155,18 @@ void SwCrsrShell::Paint( const Rectangle &rRect) { SET_CURR_SHELL( this ); - // beim Painten immer alle Cursor ausschalten + // always switch off all cursors when painting SwRect aRect( rRect ); sal_Bool bVis = sal_False; - // ist Cursor sichtbar, dann verstecke den SV-Cursor - if( pVisCrsr->IsVisible() && !aRect.IsOver( aCharRect ) ) //JP 18.06.97: ??? + // if a cursor is visible then hide the SV cursor + if( pVisCrsr->IsVisible() && !aRect.IsOver( aCharRect ) ) { bVis = sal_True; pVisCrsr->Hide(); } - // Bereich neu painten + // re-paint area ViewShell::Paint( rRect ); if( bHasFocus && !bBasicHideCrsr ) @@ -1184,7 +1175,7 @@ void SwCrsrShell::Paint( const Rectangle &rRect) if( !ActionPend() ) { - // damit nicht rechts/unten die Raender abgeschnitten werden + // so that right/bottom borders will not be cropped pAktCrsr->Invalidate( VisArea() ); pAktCrsr->Show(); } @@ -1192,7 +1183,7 @@ void SwCrsrShell::Paint( const Rectangle &rRect) pAktCrsr->Invalidate( aRect ); } - if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen + if( bSVCrsrVis && bVis ) // also show SV cursor again pVisCrsr->Show(); } @@ -1201,9 +1192,9 @@ void SwCrsrShell::Paint( const Rectangle &rRect) void SwCrsrShell::VisPortChgd( const SwRect & rRect ) { SET_CURR_SHELL( this ); - sal_Bool bVis; // beim Scrollen immer alle Cursor ausschalten + sal_Bool bVis; // switch off all cursors when scrolling - // ist Cursor sichtbar, dann verstecke den SV-Cursor + // if a cursor is visible then hide the SV cursor if( sal_True == ( bVis = pVisCrsr->IsVisible() )) pVisCrsr->Hide(); @@ -1211,13 +1202,12 @@ void SwCrsrShell::VisPortChgd( const SwRect & rRect ) aOldRBPos.X() = VisArea().Right(); aOldRBPos.Y() = VisArea().Bottom(); - //Damit es es keine Probleme mit dem SV-Cursor gibt, wird in - //ViewShell::VisPo.. ein Update() auf das Window gerufen. - //Waehrend des Paintens duerfen aber nun wieder keine Selectionen - //angezeigt werden, deshalb wird der Aufruf hier geklammert. - ViewShell::VisPortChgd( rRect ); // Bereich verschieben + // For not having problems with the SV cursor, Update() is called for the + // Window in ViewShell::VisPo... + // During painting no selections should be shown, thus the call is encapsulated. <- TODO: old artefact? + ViewShell::VisPortChgd( rRect ); // move area - if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen + if( bSVCrsrVis && bVis ) // show SV cursor again pVisCrsr->Show(); if( nCrsrMove ) @@ -1226,12 +1216,12 @@ void SwCrsrShell::VisPortChgd( const SwRect & rRect ) bVisPortChgd = sal_False; } -// aktualisiere den Crsrs, d.H. setze ihn wieder in den Content. -// Das sollte nur aufgerufen werden, wenn der Cursor z.B. beim -// Loeschen von Rahmen irgendwohin gesetzt wurde. Die Position -// ergibt sich aus seiner aktuellen Position im Layout !! - +/** Set the cursor back into content. + This should only be called if the cursor was move somewhere else (e.g. when + deleting a border). The new position is calculated from its current position + in the layout. +*/ void SwCrsrShell::UpdateCrsrPos() { SET_CURR_SHELL( this ); @@ -1258,8 +1248,7 @@ void SwCrsrShell::UpdateCrsrPos() SizeChgNotify(); } -// JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen -// stehen, so mussen diese daraus verschoben werden +// #i65475# - if Point/Mark in hidden sections, move them out static void lcl_CheckHiddenSection( SwNodeIndex& rIdx ) { const SwSectionNode* pSectNd = rIdx.GetNode().FindSectionNode(); @@ -1320,7 +1309,7 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd ) { if ( eFlags & SwCrsrShell::READONLY ) bIgnoreReadonly = sal_True; - return; // wenn nicht, dann kein Update !! + return; // if not then no update } sal_Bool bInHeader= sal_True; @@ -1711,12 +1700,12 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd ) if( !bFirst && aOld == aCharRect ) break; - // falls das Layout meint, nach dem 100 durchlauf ist man immer noch - // im Fluss, sollte man die akt. Pos. als gegeben hinnehmen! - // siehe Bug: 29658 + // if the layout says that we are after the 100th iteration still in + // flow then we should always take the current position for granted. + // (see bug: 29658) if( !--nLoopCnt ) { - OSL_ENSURE( !this, "Endlosschleife? CharRect != OldCharRect "); + OSL_ENSURE( !this, "endless loop? CharRect != OldCharRect "); break; } aOld = aCharRect; @@ -1739,8 +1728,8 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd ) (HasSelection() || eFlags & SwCrsrShell::READONLY || !IsCrsrReadonly() || GetViewOptions()->IsSelectionInReadonly()) ) { - //JP 30.04.99: so that EndAction, in case of scrolling, doesn't - // show the SV-Cursor again, save and reset the flag here + // in case of scrolling this EndAction doesn't show the SV cursor + // again, thus save and reset the flag here sal_Bool bSav = bSVCrsrVis; bSVCrsrVis = sal_False; MakeSelVisible(); bSVCrsrVis = bSav; @@ -1909,9 +1898,7 @@ void SwCrsrShell::RefreshBlockCursor() } } -// erzeuge eine Kopie vom Cursor und speicher diese im Stack - - +/// create a copy of the cursor and save it in the stack void SwCrsrShell::Push() { pCrsrStk = new SwShellCrsr( *this, *pCurCrsr->GetPoint(), @@ -1924,45 +1911,42 @@ void SwCrsrShell::Push() } } -/* - * Loescht einen Cursor (gesteuert durch bOldCrsr) - * - vom Stack oder ( bOldCrsr = sal_True ) - * - den aktuellen und der auf dem Stack stehende wird zum aktuellen - * - * Return: es war auf dem Stack noch einer vorhanden - */ - +/** delete cursor + @param bOldCrsr If so delete from stack, if delete current + and assign the one from stack as the new current cursor. + @return if there was one on the stack, otherwise +*/ sal_Bool SwCrsrShell::Pop( sal_Bool bOldCrsr ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed - // noch weitere vorhanden ? + // are there any left? if( 0 == pCrsrStk ) return sal_False; SwShellCrsr *pTmp = 0, *pOldStk = pCrsrStk; - // der Nachfolger wird der Aktuelle + // the successor becomes the current one if( pCrsrStk->GetNext() != pCrsrStk ) { pTmp = dynamic_cast(pCrsrStk->GetNext()); } - if( bOldCrsr ) // loesche vom Stack - delete pCrsrStk; // + if( bOldCrsr ) // delete from stack + delete pCrsrStk; - pCrsrStk = pTmp; // neu zuweisen + pCrsrStk = pTmp; // assign new one if( !bOldCrsr ) { SwCrsrSaveState aSaveState( *pCurCrsr ); - // wurde die sichtbare SSelection nicht veraendert + // If the visible SSelection was not changed if( pOldStk->GetPtPos() == pCurCrsr->GetPtPos() || pOldStk->GetPtPos() == pCurCrsr->GetMkPos() ) { - // "Selektions-Rechtecke" verschieben + // move "Selections Rectangles" pCurCrsr->Insert( pOldStk, 0 ); pOldStk->Remove( 0, pOldStk->Count() ); } @@ -1974,7 +1958,7 @@ sal_Bool SwCrsrShell::Pop( sal_Bool bOldCrsr ) pCurCrsr->GetMkPos() = pOldStk->GetMkPos(); } else - // keine Selection also alte aufheben und auf die alte Pos setzen + // no selection so revoke old one and set to old position pCurCrsr->DeleteMark(); *pCurCrsr->GetPoint() = *pOldStk->GetPoint(); pCurCrsr->GetPtPos() = pOldStk->GetPtPos(); @@ -1983,32 +1967,30 @@ sal_Bool SwCrsrShell::Pop( sal_Bool bOldCrsr ) if( !pCurCrsr->IsInProtectTable( sal_True ) && !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) - UpdateCrsr(); // akt. Cursor Updaten + UpdateCrsr(); // update current cursor } return sal_True; } -/* - * Verbinde zwei Cursor miteinander. - * Loesche vom Stack den obersten und setzen dessen GetMark im Aktuellen. - */ - +/** Combine two cursors + Delete topmost from stack and use its GetMark in the current. +*/ void SwCrsrShell::Combine() { - // noch weitere vorhanden ? + // any others left? if( 0 == pCrsrStk ) return; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwCrsrSaveState aSaveState( *pCurCrsr ); - if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde + if( pCrsrStk->HasMark() ) // only if GetMark was set { bool const bResult = CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, sal_True ); - OSL_ENSURE(bResult, "StackCrsr & act. Crsr not in same Section."); + OSL_ENSURE(bResult, "StackCrsr & current Crsr not in same Section."); (void) bResult; // non-debug: unused - // kopiere das GetMark + // copy GetMark if( !pCurCrsr->HasMark() ) pCurCrsr->SetMark(); *pCurCrsr->GetMark() = *pCrsrStk->GetMark(); @@ -2025,7 +2007,7 @@ void SwCrsrShell::Combine() if( !pCurCrsr->IsInProtectTable( sal_True ) && !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) - UpdateCrsr(); // akt. Cursor Updaten + UpdateCrsr(); // update current cursor } @@ -2034,13 +2016,13 @@ void SwCrsrShell::HideCrsrs() if( !bHasFocus || bBasicHideCrsr ) return; - // ist Cursor sichtbar, dann verstecke den SV-Cursor + // if cursor is visible then hide SV cursor if( pVisCrsr->IsVisible() ) { SET_CURR_SHELL( this ); pVisCrsr->Hide(); } - // hebe die Invertierung der SSelection auf + // revoke inversion of SSelection SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr; pAktCrsr->Hide(); } @@ -2056,11 +2038,10 @@ void SwCrsrShell::ShowCrsrs( sal_Bool bCrsrVis ) SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr; pAktCrsr->Show(); - if( bSVCrsrVis && bCrsrVis ) // auch SV-Cursor wieder anzeigen + if( bSVCrsrVis && bCrsrVis ) // also show SV cursor again pVisCrsr->Show(); } -// Methoden zum Anzeigen bzw. Verstecken des sichtbaren Text-Cursors void SwCrsrShell::ShowCrsr() @@ -2105,8 +2086,7 @@ void SwCrsrShell::ShGetFcs( sal_Bool bUpdate ) } } -// gebe den aktuellen Frame, in dem der Cursor steht, zurueck - +/** Get current frame in which the cursor is positioned. */ SwCntntFrm *SwCrsrShell::GetCurrFrm( const sal_Bool bCalcFrm ) const { SET_CURR_SHELL( (ViewShell*)this ); @@ -2130,11 +2110,12 @@ SwCntntFrm *SwCrsrShell::GetCurrFrm( const sal_Bool bCalcFrm ) const return pRet; } +//TODO: provide documentation +/** forward all attribute/format changes at the current node to the Link -// alle Attribut/Format-Aenderungen am akt. Node werden an den -// Link weitergeleitet. - - + @param pOld ??? + @param pNew ??? +*/ void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { const sal_uInt16 nWhich = pOld ? @@ -2147,10 +2128,10 @@ void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) ( nWhich < RES_MSG_BEGIN || nWhich >= RES_MSG_END || nWhich == RES_FMT_CHG || nWhich == RES_UPDATE_ATTR || nWhich == RES_ATTRSET_CHG )) - // die Messages werden nicht weitergemeldet - //MA 07. Apr. 94 fix(6681): RES_UPDATE_ATTR wird implizit vom - //SwTxtNode::Insert(SwTxtHint*, sal_uInt16) abgesetzt; hier wird reagiert und - //vom Insert brauch nicht mehr die Keule RES_FMT_CHG versandt werden. + // messages are not forwarded + // #i6681#: RES_UPDATE_ATTR is implicitly unset in + // SwTxtNode::Insert(SwTxtHint*, sal_uInt16); we react here and thus do + // not need to send the expensive RES_FMT_CHG in Insert. CallChgLnk(); if( aGrfArrivedLnk.IsSet() && @@ -2158,11 +2139,10 @@ void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) aGrfArrivedLnk.Call( this ); } +/** Does the current cursor create a selection? -// Abfrage, ob der aktuelle Cursor eine Selektion aufspannt, -// also, ob GetMark gesetzt und SPoint und GetMark unterschiedlich sind. - - + This means checking if GetMark is set and if SPoint and GetMark differ. +*/ sal_Bool SwCrsrShell::HasSelection() const { const SwPaM* pCrsr = getShellCrsr( true ); @@ -2174,21 +2154,19 @@ sal_Bool SwCrsrShell::HasSelection() const void SwCrsrShell::CallChgLnk() { - // innerhalb von Start-/End-Action kein Call, sondern nur merken, - // das sich etwas geaendert hat. Wird bei EndAction beachtet. + // Do not make any call in start/end action but just remember the change. + // This will be taken care of in the end action. if( BasicActionPend() ) - bChgCallFlag = sal_True; // das Change merken + bChgCallFlag = sal_True; // remember change else if( aChgLnk.IsSet() ) { if( bCallChgLnk ) aChgLnk.Call( this ); - bChgCallFlag = sal_False; // Flag zuruecksetzen + bChgCallFlag = sal_False; // reset flag } } -// returne den am akt.Cursor selektierten Text eines Nodes. - - +/// get selected text of a node at current cursor String SwCrsrShell::GetSelTxt() const { String aTxt; @@ -2206,9 +2184,7 @@ String SwCrsrShell::GetSelTxt() const return aTxt; } -// gebe nur den Text ab der akt. Cursor Position zurueck (bis zum NodeEnde) - - +/// get text only from current cursor position (until end of node) String SwCrsrShell::GetText() const { String aTxt; @@ -2223,10 +2199,14 @@ String SwCrsrShell::GetText() const return aTxt; } -// hole vom Start/Ende der akt. SSelection das nte Zeichen +/** get the nth character of the current SSelection + + @param bEnd Start counting from the end? From start otherwise. + @param nOffset position of the character +*/ sal_Unicode SwCrsrShell::GetChar( sal_Bool bEnd, long nOffset ) { - if( IsTableMode() ) // im TabelleMode nicht moeglich + if( IsTableMode() ) // not possible in table mode return 0; const SwPosition* pPos = !pCurCrsr->HasMark() ? pCurCrsr->GetPoint() @@ -2245,17 +2225,19 @@ sal_Unicode SwCrsrShell::GetChar( sal_Bool bEnd, long nOffset ) return cCh; } -// erweiter die akt. SSelection am Anfang/Ende um n Zeichen - +/** extend current SSelection by n characters + @param bEnd Start counting from the end? From start otherwise. + @param nCount Number of characters. +*/ sal_Bool SwCrsrShell::ExtendSelection( sal_Bool bEnd, xub_StrLen nCount ) { if( !pCurCrsr->HasMark() || IsTableMode() ) - return sal_False; // keine Selektion + return sal_False; // no selection SwPosition* pPos = bEnd ? pCurCrsr->End() : pCurCrsr->Start(); SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode(); - OSL_ENSURE( pTxtNd, "kein TextNode, wie soll erweitert werden?" ); + OSL_ENSURE( pTxtNd, "no text node; how should this then be extended?" ); xub_StrLen nPos = pPos->nContent.GetIndex(); if( bEnd ) @@ -2263,14 +2245,14 @@ sal_Bool SwCrsrShell::ExtendSelection( sal_Bool bEnd, xub_StrLen nCount ) if( ( nPos + nCount ) <= pTxtNd->GetTxt().Len() ) nPos = nPos + nCount; else - return sal_False; // nicht mehr moeglich + return sal_False; // not possible } else if( nPos >= nCount ) nPos = nPos - nCount; else - return sal_False; // nicht mehr moeglich + return sal_False; // not possible anymore - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed pPos->nContent = nPos; UpdateCrsr(); @@ -2278,9 +2260,11 @@ sal_Bool SwCrsrShell::ExtendSelection( sal_Bool bEnd, xub_StrLen nCount ) return sal_True; } -// setze nur den sichtbaren Cursor an die angegebene Dokument-Pos. -// returnt sal_False: wenn der SPoint vom Layout korrigiert wurde. +/** Move visible cursor to given position in document. + @param rPt The position to move the visible cursor to. + @return if SPoint was corrected by the layout. +*/ sal_Bool SwCrsrShell::SetVisCrsr( const Point &rPt ) { SET_CURR_SHELL( this ); @@ -2294,7 +2278,7 @@ sal_Bool SwCrsrShell::SetVisCrsr( const Point &rPt ) SetInFrontOfLabel( sal_False ); // #i27615# - // nur in TextNodes anzeigen !! + // show only in TextNodes SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode(); if( !pTxtNd ) return sal_False; @@ -2312,11 +2296,11 @@ sal_Bool SwCrsrShell::SetVisCrsr( const Point &rPt ) pFrm->GetCharRect( aCharRect, aPos, &aTmpState ); - if( aTmp == aCharRect && // BUG 10137: bleibt der Cursor auf der - pVisCrsr->IsVisible() ) // Position nicht hidden & showen + // #i10137# + if( aTmp == aCharRect && pVisCrsr->IsVisible() ) return sal_True; - pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken + pVisCrsr->Hide(); // always hide visible cursor if( IsScrollMDI( this, aCharRect )) { MakeVisible( aCharRect ); @@ -2333,7 +2317,7 @@ sal_Bool SwCrsrShell::SetVisCrsr( const Point &rPt ) } pVisCrsr->SetDragCrsr( sal_True ); - pVisCrsr->Show(); // wieder anzeigen + pVisCrsr->Show(); // show again } return bRet; } @@ -2356,9 +2340,10 @@ sal_Bool SwCrsrShell::IsOverHeaderFooterPos( const Point& rPt ) const return GetDoc()->IsInHeaderFooter( aPam.GetPoint()->nNode ); } +/** Get the number of elements in the ring of cursors - // returne die Anzahl der Cursor im Ring (Flag besagt ob man nur - // aufgepspannte haben will - sprich etwas selektiert ist (Basic)) + @param bAll If get only spanned ones (= with selections) (Basic). +*/ sal_uInt16 SwCrsrShell::GetCrsrCnt( sal_Bool bAll ) const { Ring* pTmp = GetCrsr()->GetNext(); @@ -2380,7 +2365,7 @@ sal_Bool SwCrsrShell::IsStartOfDoc() const if( pCurCrsr->GetPoint()->nContent.GetIndex() ) return sal_False; - // Hinter EndOfIcons kommt die Content-Section (EndNd+StNd+CntntNd) + // after EndOfIcons comes the content selection (EndNd+StNd+CntntNd) SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfExtras(), 2 ); if( !aIdx.GetNode().IsCntntNode() ) GetDoc()->GetNodes().GoNext( &aIdx ); @@ -2399,11 +2384,13 @@ sal_Bool SwCrsrShell::IsEndOfDoc() const pCNd->Len() == pCurCrsr->GetPoint()->nContent.GetIndex(); } +/** Invalidate cursors -// loesche alle erzeugten Crsr, setze den Tabellen-Crsr und den letzten -// Cursor auf seinen TextNode (oder StartNode?). -// Beim naechsten ::GetCrsr werden sie wieder alle erzeugt -// Wird fuers Drag&Drop / ClipBorad-Paste in Tabellen benoetigt. + Delete all created cursors, set table crsr and last crsr to their TextNode + (or StartNode?). They will then all re-created at the next ::GetCrsr() call. + + This is needed for Drag&Drop/ Clipboard-paste in tables. +*/ sal_Bool SwCrsrShell::ParkTblCrsr() { if( !pTblCrsr ) @@ -2414,7 +2401,7 @@ sal_Bool SwCrsrShell::ParkTblCrsr() while( pCurCrsr->GetNext() != pCurCrsr ) delete pCurCrsr->GetNext(); - // vom Cursor !immer! SPoint und Mark umsetzen + // *always* move cursor's SPoint and Mark pCurCrsr->SetMark(); *pCurCrsr->GetMark() = *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint(); pCurCrsr->DeleteMark(); @@ -2422,13 +2409,6 @@ sal_Bool SwCrsrShell::ParkTblCrsr() return sal_True; } -/*********************************************************************** -#* Class : SwCrsrShell -#* Methode : ParkCrsr -#* Beschreibung: Vernichtet Selektionen und zus. Crsr aller Shell der -#* verbleibende Crsr der Shell wird geparkt. -#***********************************************************************/ - void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) { const SwPosition *pStt = pDelRg->Start(), @@ -2436,18 +2416,14 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) SwPaM *pTmpDel = 0, *pTmp = *ppDelRing; - // durchsuche den gesamten Ring + // search over the whole ring sal_Bool bGoNext; do { const SwPosition *pTmpStt = pTmp->Start(), *pTmpEnd = pTmp->GetPoint() == pTmpStt ? pTmp->GetMark() : pTmp->GetPoint(); - /* - * liegt ein SPoint oder GetMark innerhalb vom Crsr-Bereich - * muss der alte Bereich aufgehoben werden. - * Beim Vergleich ist darauf zu achten, das End() nicht mehr zum - * Bereich gehoert ! - */ + // If a SPoint or GetMark are in a cursor area than cancel the old area. + // During comparison keep in mind that End() is outside the area. if( *pStt <= *pTmpStt ) { if( *pEnd > *pTmpStt || @@ -2459,7 +2435,7 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) pTmpDel = pTmp; bGoNext = sal_True; - if( pTmpDel ) // ist der Pam im Bereich ?? loesche ihn + if( pTmpDel ) // is the pam in area -> delete { sal_Bool bDelete = sal_True; if( *ppDelRing == pTmpDel ) @@ -2473,11 +2449,11 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) } } else - bDelete = sal_False; // StackCrsr nie loeschen !! + bDelete = sal_False; // never delete the StackCrsr } if( bDelete ) - delete pTmpDel; // hebe alten Bereich auf + delete pTmpDel; // invalidate old area else { pTmpDel->GetPoint()->nContent.Assign( 0, 0 ); @@ -2487,33 +2463,43 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) } pTmpDel = 0; } - else if( !pTmp->HasMark() ) // sorge auf jedenfall dafuer, das - { // nicht benutzte Indizies beachtet werden! - pTmp->SetMark(); // SPoint liegt nicht im Bereich, - pTmp->DeleteMark(); // aber vielleicht GetMark, also setzen + else if( !pTmp->HasMark() ) + { + // Take care that not used indices are considered. + // SPoint is not in area but maybe GetMark is, thus set it. + pTmp->SetMark(); + pTmp->DeleteMark(); } if( bGoNext ) pTmp = (SwPaM*)pTmp->GetNext(); } while( !bGoNext || *ppDelRing != pTmp ); } +//TODO: provide documentation +/** Remove selections and additional cursors of all shells. + + The remaining cursor of the shell is parked. + + @param rIdx ??? +*/ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) { SwNode *pNode = &rIdx.GetNode(); - // erzeuge einen neuen Pam + // create a new PaM SwPaM * pNew = new SwPaM( *GetCrsr()->GetPoint() ); if( pNode->GetStartNode() ) { if( ( pNode = pNode->StartOfSectionNode())->IsTableNode() ) { - // der angegebene Node steht in einer Tabelle, also Parke - // den Crsr auf dem Tabellen-Node (ausserhalb der Tabelle) + // the given node is in a table, thus park cursor to table node + // (outside of the table) pNew->GetPoint()->nNode = *pNode->StartOfSectionNode(); } - else // also auf dem StartNode selbst. - // Dann immer ueber seinen EndNode den StartNode erfragen !!! - // (StartOfSection vom StartNode ist der Parent !) + else + // Also on the start node itself. Then we need to request the start + // node always via its end node! (StartOfSelection of StartNode is + // the parent) pNew->GetPoint()->nNode = *pNode->EndOfSectionNode()->StartOfSectionNode(); } else @@ -2521,7 +2507,7 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) pNew->SetMark(); pNew->GetPoint()->nNode = *pNode->EndOfSectionNode(); - //Alle Shells wollen etwas davon haben. + // take care of all shells ViewShell *pTmp = this; do { if( pTmp->IsA( TYPE( SwCrsrShell ))) @@ -2533,8 +2519,8 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) pSh->_ParkPams( pNew, &pSh->pCurCrsr ); if( pSh->pTblCrsr ) { - // setze den Tabellen Cursor immer auf 0, den aktuellen - // immer auf den Anfang der Tabelle + // set table cursor always to 0 and the current one always to + // the beginning of the table SwPaM* pTCrsr = pSh->GetTblCrs(); SwNode* pTblNd = pTCrsr->GetPoint()->nNode.GetNode().FindTableNode(); if ( pTblNd ) @@ -2553,12 +2539,11 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) //========================================================================= -/* - * der Copy-Constructor - * Cursor-Position kopieren, in den Ring eingetragen. - * Alle Ansichten eines Dokumentes stehen im Ring der Shells. - */ +/** Copy constructor + Copy cursor position and add it to the ring. + All views of a document are in the ring of the shell. +*/ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) : ViewShell( rShell, pInitWin ), SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ), @@ -2568,7 +2553,7 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) nMarkedListLevel( 0 ) { SET_CURR_SHELL( this ); - // Nur die Position vom aktuellen Cursor aus der Copy-Shell uebernehmen + // only keep the position of the current cursor of the copy shell pCurCrsr = new SwShellCrsr( *this, *(rShell.pCurCrsr->GetPoint()) ); pCurCrsr->GetCntntNode()->Add( this ); @@ -2581,11 +2566,7 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) mbMacroExecAllowed = rShell.IsMacroExecAllowed(); } - -/* - * der normale Constructor - */ - +/// default constructor SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, const SwViewOption *pInitOpt ) : ViewShell( rDoc, pInitWin, pInitOpt ), @@ -2596,10 +2577,7 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, nMarkedListLevel( 0 ) { SET_CURR_SHELL( this ); - /* - * Erzeugen des initialen Cursors, wird auf die erste - * Inhaltsposition gesetzt - */ + // create initial cursor and set it to first content position SwNodes& rNds = rDoc.GetNodes(); SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() ); @@ -2607,8 +2585,8 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, pCurCrsr = new SwShellCrsr( *this, SwPosition( aNodeIdx, SwIndex( pCNd, 0 ))); - // melde die Shell beim akt. Node als abhaengig an, dadurch koennen alle - // Attribut-Aenderungen ueber den Link weiter gemeldet werden. + // Register shell as dependent at current node. As a result all attribute + // changes can be forwarded via the Link. pCNd->Add( this ); bAllProtect = bVisPortChgd = bChgCallFlag = bInCMvVisportChgd = @@ -2625,8 +2603,7 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, SwCrsrShell::~SwCrsrShell() { - // wenn es nicht die letzte View so sollte zu mindest das - // Feld noch geupdatet werden. + // if it is not the last view then at least the field should be updated if( GetNext() != this ) CheckTblBoxCntnt( pCurCrsr->GetPoint() ); else @@ -2636,14 +2613,12 @@ SwCrsrShell::~SwCrsrShell() delete pBlockCrsr; delete pTblCrsr; - /* - * Freigabe der Cursor - */ + // release cursors while(pCurCrsr->GetNext() != pCurCrsr) delete pCurCrsr->GetNext(); delete pCurCrsr; - // Stack freigeben + // free stack if( pCrsrStk ) { while( pCrsrStk->GetNext() != pCrsrStk ) @@ -2651,9 +2626,8 @@ SwCrsrShell::~SwCrsrShell() delete pCrsrStk; } - // JP 27.07.98: Bug 54025 - ggfs. den HTML-Parser, der als Client in - // der CursorShell haengt keine Chance geben, sich an den - // TextNode zu haengen. + // #i54025# - do not give a HTML parser that might potentially hang as + // a client at the cursor shell the chance to hang itself on a TextNode if( GetRegisteredIn() ) GetRegisteredInNonConst()->Remove( this ); } @@ -2667,9 +2641,10 @@ SwShellCrsr* SwCrsrShell::getShellCrsr( bool bBlock ) return pCurCrsr; } -//Sollte fuer das Clipboard der WaitPtr geschaltet werden? -//Warten bei TableMode, Mehrfachselektion und mehr als x Selektieren Absaetzen. +/** Should WaitPtr be switched on for the clipboard? + Wait for TableMode, multiple selections and more than x selected paragraphs. +*/ sal_Bool SwCrsrShell::ShouldWait() const { if ( IsTableMode() || GetCrsrCnt() > 1 ) @@ -2691,10 +2666,10 @@ sal_uInt16 SwCrsrShell::UpdateTblSelBoxes() return pTblCrsr ? pTblCrsr->GetBoxesCount() : 0; } -// zeige das akt. selektierte "Object" an +/// show the current selected "object" void SwCrsrShell::MakeSelVisible() { - OSL_ENSURE( bHasFocus, "kein Focus aber Cursor sichtbar machen?" ); + OSL_ENSURE( bHasFocus, "no focus but cursor should be made visible?" ); if( aCrsrHeight.Y() < aCharRect.Height() && aCharRect.Height() > VisArea().Height() ) { SwRect aTmp( aCharRect ); @@ -2726,28 +2701,26 @@ void SwCrsrShell::MakeSelVisible() } } - -// suche eine gueltige ContentPosition (nicht geschuetzt/nicht versteckt) +/// search a valid content position (not protected/hidden) sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText ) { - if( pTblCrsr ) // was soll ich jetzt machen ?? + if( pTblCrsr ) { - OSL_ENSURE( !this, "TabellenSelection nicht aufgehoben!" ); + OSL_ENSURE( !this, "Did not remove table selection!" ); return sal_False; } - //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt + // #i45129# - everything is allowed in UI-readonly if( !bAllProtect && GetDoc()->GetDocShell() && GetDoc()->GetDocShell()->IsReadOnlyUI() ) return sal_True; - // dann raus da! if( pCurCrsr->HasMark() ) ClearMark(); - // als erstes mal auf Rahmen abpruefen + // first check for frames SwNodeIndex& rNdIdx = pCurCrsr->GetPoint()->nNode; - sal_uLong nNdIdx = rNdIdx.GetIndex(); // sichern + sal_uLong nNdIdx = rNdIdx.GetIndex(); // keep backup SwNodes& rNds = pDoc->GetNodes(); SwCntntNode* pCNd = rNdIdx.GetNode().GetCntntNode(); const SwCntntFrm * pFrm; @@ -2756,7 +2729,7 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText ) !IsReadOnlyAvailable() && pFrm->IsProtected() && nNdIdx < rNds.GetEndOfExtras().GetIndex() ) { - // geschuetzter Rahmen ueberspringen + // skip protected frame SwPaM aPam( *pCurCrsr->GetPoint() ); aPam.SetMark(); aPam.GetMark()->nNode = rNds.GetEndOfContent(); @@ -2769,16 +2742,16 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText ) pCNd = ::GetNode( aPam, bFirst, fnMoveBackward, sal_False ); } - if( !pCNd ) // sollte nie passieren !!! + if( !pCNd ) // should *never* happen { - rNdIdx = nNdIdx; // alten Node zurueck + rNdIdx = nNdIdx; // back to old node return sal_False; } *pCurCrsr->GetPoint() = *aPam.GetPoint(); } else if( bOnlyText && pCNd && pCNd->IsNoTxtNode() ) { - // dann auf den Anfang vom Doc stellen + // set to beginning of document rNdIdx = pDoc->GetNodes().GetEndOfExtras(); pCurCrsr->GetPoint()->nContent.Assign( pDoc->GetNodes().GoNext( &rNdIdx ), 0 ); @@ -2819,7 +2792,7 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText ) } } - // in einem geschuetzten Bereich + // in a protected frame const SwSectionNode* pSectNd = rNdIdx.GetNode().FindSectionNode(); if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() || ( !IsReadOnlyAvailable() && @@ -2838,13 +2811,12 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText ) while( 0 != ( pCNd = (rNds.*funcGoSection)( &rNdIdx, sal_True, !IsReadOnlyAvailable() )) ) { - // in eine Tabelle verschoben -> pruefe ob die - // vielleicht geschuetzt ist + // moved inside a table -> check if it is protected if( pCNd->FindTableNode() ) { SwCallLink aTmp( *this ); SwCrsrSaveState aSaveState( *pCurCrsr ); - aTmp.nNdTyp = 0; // im DTOR nichts machen! + aTmp.nNdTyp = 0; // don't do anything in DTOR if( !pCurCrsr->IsInProtectTable( sal_True, sal_True ) ) { const SwSectionNode* pSNd = pCNd->FindSectionNode(); @@ -2853,26 +2825,26 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText ) pSNd->GetSection().IsProtectFlag() )) { bOk = sal_True; - break; // eine nicht geschuetzte Zelle gef. + break; // found non-protected cell } - continue; // dann weiter suchen + continue; // continue search } } else { bOk = sal_True; - break; // eine nicht geschuetzte Zelle gef. + break; // found non-protected cell } } if( bOk && rNdIdx.GetIndex() < rNds.GetEndOfExtras().GetIndex() ) { - // Teste mal auf Fly - kann auch noch geschuetzt sein!! + // also check for Fly - might be protected as well if( 0 == (pFrm = pCNd->getLayoutFrm( GetLayout(),0,0,sal_False)) || ( !IsReadOnlyAvailable() && pFrm->IsProtected() ) || ( bOnlyText && pCNd->IsNoTxtNode() ) ) { - // dann weiter suchen! + // continue search bOk = sal_False; bWeiter = sal_True; } @@ -2896,9 +2868,7 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText ) else { pCNd = rNdIdx.GetNode().GetCntntNode(); - - // falls Cursor im versteckten Bereich ist, auf jedenfall schon mal - // verschieben!! + // if cursor in hidden frame, always move it if( !pCNd || !pCNd->getLayoutFrm( GetLayout(),0,0,sal_False) ) { SwCrsrMoveState aTmpState( MV_NONE ); @@ -2942,18 +2912,16 @@ sal_Bool SwCrsrShell::IsCrsrReadonly() const return sal_False; } - -// darf der Cursor in ReadOnlyBereiche? +/// is the cursor allowed to enter ReadOnly sections? void SwCrsrShell::SetReadOnlyAvailable( sal_Bool bFlag ) { - // im GlobalDoc darf NIE umgeschaltet werden + // *never* switch in GlobalDoc if( (!GetDoc()->GetDocShell() || !GetDoc()->GetDocShell()->IsA( SwGlobalDocShell::StaticType() )) && bFlag != bSetCrsrInReadOnly ) { - // wenn das Flag ausgeschaltet wird, dann muessen erstmal alle - // Selektionen aufgehoben werden. Denn sonst wird sich darauf - // verlassen, das nichts geschuetztes selektiert ist! + // If the flag is switched off then all selections need to be + // invalidated. Otherwise we would trust that nothing protected is selected. if( !bFlag ) { ClearMark(); @@ -3066,7 +3034,6 @@ bool SwCrsrShell::SelectHiddenRange() return bRet; } - // die Suchfunktionen sal_uLong SwCrsrShell::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnde, sal_Bool& bCancel, @@ -3075,7 +3042,7 @@ sal_uLong SwCrsrShell::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchIn if( pTblCrsr ) GetCrsr(); delete pTblCrsr, pTblCrsr = 0; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed sal_uLong nRet = pCurCrsr->Find( rSearchOpt, bSearchInNotes, eStart, eEnde, bCancel, eRng, bReplace ); if( nRet || bCancel ) UpdateCrsr(); @@ -3090,7 +3057,7 @@ sal_uLong SwCrsrShell::Find( const SwTxtFmtColl& rFmtColl, if( pTblCrsr ) GetCrsr(); delete pTblCrsr, pTblCrsr = 0; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed sal_uLong nRet = pCurCrsr->Find( rFmtColl, eStart, eEnde, bCancel, eRng, pReplFmt ); if( nRet ) UpdateCrsr(); @@ -3106,7 +3073,7 @@ sal_uLong SwCrsrShell::Find( const SfxItemSet& rSet, sal_Bool bNoCollections, if( pTblCrsr ) GetCrsr(); delete pTblCrsr, pTblCrsr = 0; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed sal_uLong nRet = pCurCrsr->Find( rSet, bNoCollections, eStart, eEnde, bCancel, eRng, pSearchOpt, rReplSet ); if( nRet ) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index d229c3d13998..955e50bbedf5 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -76,20 +76,19 @@ using namespace ::com::sun::star; - -// zum naechsten/vorhergehenden Punkt auf gleicher Ebene +/// go to next/previous point on the same level sal_Bool SwCrsrShell::GotoNextNum() { sal_Bool bRet = GetDoc()->GotoNextNum( *pCurCrsr->GetPoint() ); if( bRet ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); if( !ActionPend() ) { SET_CURR_SHELL( this ); - // dann versuche den Cursor auf die Position zu setzen, - // auf halber Heohe vom Char-SRectangle + // try to set cursor onto this position, at half of the char- + // SRectangle's height Point aPt( pCurCrsr->GetPtPos() ); SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, pCurCrsr->GetPoint() ); @@ -123,13 +122,13 @@ sal_Bool SwCrsrShell::GotoPrevNum() sal_Bool bRet = GetDoc()->GotoPrevNum( *pCurCrsr->GetPoint() ); if( bRet ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); if( !ActionPend() ) { SET_CURR_SHELL( this ); - // dann versuche den Cursor auf die Position zu setzen, - // auf halber Heohe vom Char-SRectangle + // try to set cursor onto this position, at half of the char- + // SRectangle's height Point aPt( pCurCrsr->GetPtPos() ); SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, pCurCrsr->GetPoint() ); @@ -157,21 +156,20 @@ sal_Bool SwCrsrShell::GotoPrevNum() return bRet; } -// springe aus dem Content zum Header - +/// jump from content to header sal_Bool SwCrsrShell::GotoHeaderTxt() { const SwFrm* pFrm = GetCurrFrm()->FindPageFrm(); while( pFrm && !pFrm->IsHeaderFrm() ) pFrm = pFrm->GetLower(); - // Header gefunden, dann suche den 1.Cntnt-Frame + // found header, search 1. content frame while( pFrm && !pFrm->IsCntntFrm() ) pFrm = pFrm->GetLower(); if( pFrm ) { SET_CURR_SHELL( this ); - // hole den Header-Frame - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + // get header frame + SwCallLink aLk( *this ); // watch Crsr-Moves SwCursor *pTmpCrsr = getShellCrsr( true ); SwCrsrSaveState aSaveState( *pTmpCrsr ); pFrm->Calc(); @@ -185,9 +183,7 @@ sal_Bool SwCrsrShell::GotoHeaderTxt() return 0 != pFrm; } - -// springe aus dem Content zum Footer - +/// jump from content to footer sal_Bool SwCrsrShell::GotoFooterTxt() { const SwPageFrm* pFrm = GetCurrFrm()->FindPageFrm(); @@ -197,7 +193,7 @@ sal_Bool SwCrsrShell::GotoFooterTxt() while( pLower && !pLower->IsFooterFrm() ) pLower = pLower->GetLower(); - // Header gefunden, dann suche den 1.Cntnt-Frame + // found footer, search 1. content frame while( pLower && !pLower->IsCntntFrm() ) pLower = pLower->GetLower(); @@ -205,8 +201,8 @@ sal_Bool SwCrsrShell::GotoFooterTxt() { SwCursor *pTmpCrsr = getShellCrsr( true ); SET_CURR_SHELL( this ); - // hole eine Position im Footer - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + // get position in footer + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pTmpCrsr ); pLower->Calc(); Point aPt( pLower->Frm().Pos() + pLower->Prt().Pos() ); @@ -233,7 +229,7 @@ sal_Bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, sal_Bool bInHeader ) if( USHRT_MAX == nDescNo ) { - // dann den akt. nehmen + // take the current one const SwPageFrm* pPage = GetCurrFrm()->FindPageFrm(); if( pPage ) for( sal_uInt16 i = 0; i < pMyDoc->GetPageDescCnt(); ++i ) @@ -246,13 +242,13 @@ sal_Bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, sal_Bool bInHeader ) if( USHRT_MAX != nDescNo && nDescNo < pMyDoc->GetPageDescCnt() ) { - //dann teste mal, ob ueberhaupt das Attribut vorhanden ist. + // check if the attribute exists const SwPageDesc& rDesc = const_cast(pMyDoc) ->GetPageDesc( nDescNo ); const SwFmtCntnt* pCnt = 0; if( bInHeader ) { - // gespiegelte Seiten??? erstmal nicht beachten + // mirrored pages? ignore for now const SwFmtHeader& rHd = rDesc.GetMaster().GetHeader(); if( rHd.GetHeaderFmt() ) pCnt = &rHd.GetHeaderFmt()->GetCntnt(); @@ -276,8 +272,8 @@ sal_Bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, sal_Bool bInHeader ) if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False ) )) { - // dann kann der Cursor ja auch hinein gesetzt werden - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + // then we can set the cursor in here + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); ClearMark(); @@ -296,8 +292,7 @@ sal_Bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, sal_Bool bInHeader ) return bRet; } -// springe zum naechsten Verzeichnis - +/// jump to the next index sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName ) { sal_Bool bRet = sal_False; @@ -331,7 +326,7 @@ sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName ) } if( pFnd ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pCurCrsr->GetPoint()->nNode = *pFnd; pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 ); @@ -342,9 +337,7 @@ sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName ) return bRet; } -// springe zum vorherigen Verzeichnis - - +/// jump to previous index sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName ) { sal_Bool bRet = sal_False; @@ -379,7 +372,7 @@ sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName ) if( pFnd ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pCurCrsr->GetPoint()->nNode = *pFnd; pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 ); @@ -390,8 +383,7 @@ sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName ) return bRet; } -// springe zum Verzeichnis vom TOXMark - +/// jump to index of TOXMark sal_Bool SwCrsrShell::GotoTOXMarkBase() { sal_Bool bRet = sal_False; @@ -400,9 +392,8 @@ sal_Bool SwCrsrShell::GotoTOXMarkBase() sal_uInt16 nCnt = GetDoc()->GetCurTOXMark( *pCurCrsr->GetPoint(), aMarks ); if( nCnt ) { - // dann nehme den 1. und hole den Verzeichnis-Typ. - // Suche in seiner Abhaengigkeitsliste nach dem eigentlichem - // Verzeichnis + // Take the 1. and get the index type. Search in its dependency list + // for the actual index const SwTOXType* pType = aMarks[0]->GetTOXType(); SwIterator aIter( *pType ); const SwSectionNode* pSectNd; @@ -424,7 +415,7 @@ sal_Bool SwCrsrShell::GotoTOXMarkBase() 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) && ( IsReadOnlyAvailable() || !pCFrm->IsProtected() )) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pCurCrsr->GetPoint()->nNode = *pCNd; pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 ); @@ -440,9 +431,8 @@ sal_Bool SwCrsrShell::GotoTOXMarkBase() return bRet; } - - // springe zur naechsten (vorherigen) Tabellenformel - // optional auch nur zu kaputten Formeln springen +/// Jump to next/previous table formula +/// Optionally it is possible to also jump to broken formulas sal_Bool SwCrsrShell::GotoNxtPrvTblFormula( sal_Bool bNext, sal_Bool bOnlyErrors ) { if( IsTableMode() ) @@ -469,7 +459,7 @@ sal_Bool SwCrsrShell::GotoNxtPrvTblFormula( sal_Bool bNext, sal_Bool bOnlyErrors } if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() ) - // auch beim Einsammeln wird nur der erste Frame benutzt! + // also at collection use only the first frame aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) ); { @@ -508,7 +498,7 @@ sal_Bool SwCrsrShell::GotoNxtPrvTblFormula( sal_Bool bNext, sal_Bool bOnlyErrors if( bFnd ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); aFndGEF.GetPosOfContent( rPos ); @@ -522,7 +512,7 @@ sal_Bool SwCrsrShell::GotoNxtPrvTblFormula( sal_Bool bNext, sal_Bool bOnlyErrors return bFnd; } -// springe zum naechsten (vorherigen) Verzeichniseintrag +/// jump to next/previous index marker sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext ) { if( IsTableMode() ) @@ -538,7 +528,7 @@ sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext ) _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos ); if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() ) - // auch beim Einsammeln wird nur der erste Frame benutzt! + // also at collection use only the first frame aCurGEF.SetBodyPos( *rPos.nNode.GetNode(). GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) ); { @@ -556,7 +546,7 @@ sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext ) 0 != ( pCFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False )) && ( IsReadOnlyAvailable() || !pCFrm->IsProtected() )) { - SwNodeIndex aNdIndex( *pTxtNd ); // UNIX benoetigt dieses Obj. + SwNodeIndex aNdIndex( *pTxtNd ); // UNIX needs this object _SetGetExpFld aCmp( aNdIndex, *pTxtTOX, 0 ); aCmp.SetBodyPos( *pCFrm ); @@ -572,7 +562,7 @@ sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext ) if( bFnd ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); aFndGEF.GetPosOfContent( rPos ); @@ -585,20 +575,17 @@ sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext ) return bFnd; } -/*-------------------------------------------------------------------- - Beschreibung: Traveling zwischen Markierungen - --------------------------------------------------------------------*/ - +/// traveling between marks const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir, IsReadOnlyAvailable() ); - // Position setzen + // set position SwPosition& rPos = *GetCrsr()->GetPoint(); rPos.nNode = rNewMark.GetTxtTOXMark()->GetTxtNode(); rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), @@ -611,13 +598,12 @@ const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart, return rNewMark; } -// springe zum naechsten / vorherigen FeldTypen - +/// jump to next/previous field type void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType, sal_uInt16 nSubType, sal_Bool bInReadOnly, sal_Bool bChkInpFlag = sal_False ) { - // es muss immer der 1. Frame gesucht werden + // always search the 1. frame Point aPt; SwTxtFld* pTxtFld; SwIterator aIter(rFldType); @@ -646,7 +632,7 @@ void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType, sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, sal_uInt16 nSubType, sal_uInt16 nResType ) { - // sortierte Liste aller Felder + // sorted list of all fields _SetGetExpFlds aSrtLst( 64 ); if (pFldType) @@ -654,16 +640,16 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() ) return sal_False; - // Modify-Object gefunden, trage alle Felder ins Array ein + // found Modify object, add all fields to array ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, IsReadOnlyAvailable() ); if( RES_INPUTFLD == pFldType->Which() ) { - // es gibt noch versteckte InputFelder in den SetExp. Feldern + // there are hidden input fields in the set exp. fields const SwFldTypes& rFldTypes = *pDoc->GetFldTypes(); const sal_uInt16 nSize = rFldTypes.size(); - // Alle Typen abklappern + // iterate over all types for( sal_uInt16 i=0; i < nSize; ++i ) if( RES_SETEXPFLD == ( pFldType = rFldTypes[ i ] )->Which() ) ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, @@ -675,28 +661,27 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, const SwFldTypes& rFldTypes = *pDoc->GetFldTypes(); const sal_uInt16 nSize = rFldTypes.size(); - // Alle Typen abklappern + // iterate over all types for( sal_uInt16 i=0; i < nSize; ++i ) if( nResType == ( pFldType = rFldTypes[ i ] )->Which() ) ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, IsReadOnlyAvailable() ); } - // keine Felder gefunden? + // found no fields? if( !aSrtLst.Count() ) return sal_False; sal_uInt16 nPos; SwCursor* pCrsr = getShellCrsr( true ); { - // JP 19.08.98: es muss immer ueber das Feld gesucht werden, damit - // auch immer das richtige gefunden wird, wenn welche in - // Rahmen stehen, die in einem Absatz verankert sind, - // in dem ein Feld steht - siehe auch Bug 55247 + // (1998): Always use field for search so that the right one is found as + // well some are in frames that are anchored to a paragraph that has a + // field const SwPosition& rPos = *pCrsr->GetPoint(); SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode(); - OSL_ENSURE( pTNd, "Wo ist mein CntntNode?" ); + OSL_ENSURE( pTNd, "No CntntNode" ); SwTxtFld * pTxtFld = static_cast( pTNd->GetTxtAttrForCharAt(rPos.nContent.GetIndex(), @@ -715,7 +700,7 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, _SetGetExpFld aSrch( rPos.nNode, pTxtFld, &rPos.nContent ); if( rPos.nNode.GetIndex() < pDoc->GetNodes().GetEndOfExtras().GetIndex() ) { - // auch beim Einsammeln wird nur der erste Frame benutzt! + // also at collection use only the first frame Point aPt; aSrch.SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) ); } @@ -727,15 +712,15 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, delete pTxtFld; } - if( bFound ) // stehe auf einem ? + if( bFound ) { if( bNext ) { if( ++nPos >= aSrtLst.Count() ) - return sal_False; // schon am Ende + return sal_False; // already at the end } else if( !nPos-- ) - return sal_False; // weiter nach vorne geht nicht + return sal_False; // no more steps forward possible } else if( bNext ? nPos >= aSrtLst.Count() : !nPos--) return sal_False; @@ -744,7 +729,7 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCrsr ); rFnd.GetPosOfContent( *pCrsr->GetPoint() ); @@ -762,7 +747,7 @@ sal_Bool SwCrsrShell::GotoFld( const SwFmtFld& rFld ) if( rFld.GetTxtFld() ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCursor* pCrsr = getShellCrsr( true ); SwCrsrSaveState aSaveState( *pCrsr ); @@ -784,7 +769,7 @@ void SwCrsrShell::GotoOutline( sal_uInt16 nIdx ) SwCursor* pCrsr = getShellCrsr( true ); SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCrsr ); const SwNodes& rNds = GetDoc()->GetNodes(); @@ -802,7 +787,7 @@ sal_Bool SwCrsrShell::GotoOutline( const String& rName ) SwCursor* pCrsr = getShellCrsr( true ); SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCrsr ); sal_Bool bRet = sal_False; @@ -814,9 +799,8 @@ sal_Bool SwCrsrShell::GotoOutline( const String& rName ) return bRet; } - - -sal_Bool SwCrsrShell::GotoNextOutline() // naechster Node mit Outline-Num. +/// jump to next node with outline num. +sal_Bool SwCrsrShell::GotoNextOutline() { SwCursor* pCrsr = getShellCrsr( true ); const SwNodes& rNds = GetDoc()->GetNodes(); @@ -832,7 +816,7 @@ sal_Bool SwCrsrShell::GotoNextOutline() // naechster Node mit Outline-Nu pNd = rNds.GetOutLineNds()[ nPos ]; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCrsr ); pCrsr->GetPoint()->nNode = *pNd; pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 ); @@ -843,8 +827,8 @@ sal_Bool SwCrsrShell::GotoNextOutline() // naechster Node mit Outline-Nu return bRet; } - -sal_Bool SwCrsrShell::GotoPrevOutline() // vorheriger Node mit Outline-Num. +/// jump to previous node with outline num. +sal_Bool SwCrsrShell::GotoPrevOutline() { SwCursor* pCrsr = getShellCrsr( true ); const SwNodes& rNds = GetDoc()->GetNodes(); @@ -856,14 +840,14 @@ sal_Bool SwCrsrShell::GotoPrevOutline() // vorheriger Node mit Outline-N sal_Bool bRet = sal_False; if( nPos ) { - --nPos; // davor + --nPos; // before pNd = rNds.GetOutLineNds()[ nPos ]; if( pNd->GetIndex() > pCrsr->GetPoint()->nNode.GetIndex() ) return sal_False; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCrsr ); pCrsr->GetPoint()->nNode = *pNd; pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 ); @@ -875,9 +859,7 @@ sal_Bool SwCrsrShell::GotoPrevOutline() // vorheriger Node mit Outline-N return bRet; } - - // suche die "Outline-Position" vom vorherigen Outline-Node mit dem - // Level. +/// search "outline position" before previous outline node at given level sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel ) { SwPaM* pCrsr = getShellCrsr( true ); @@ -886,9 +868,9 @@ sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel ) SwNode* pNd = pCrsr->GetNode(); sal_uInt16 nPos; if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos )) - nPos++; // steht auf der Position, fuers while zum Naechsten + nPos++; // is at correct position; take next for while - while( nPos-- ) // immer den davor testen ! + while( nPos-- ) // check the one in front of the current { pNd = rNds.GetOutLineNds()[ nPos ]; @@ -896,7 +878,7 @@ sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel ) return nPos; } - return USHRT_MAX; // davor keiner mehr also Ende + return USHRT_MAX; // no more left } @@ -905,15 +887,15 @@ sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, { const SwNodes& rNds = GetDoc()->GetNodes(); const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds(); - if( !rOutlNds.Count() ) // wie jetzt ??? + if( !rOutlNds.Count() ) return sal_False; SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves - if( nSttPos > nEndPos ) // sollte jemand das vertauscht haben? + if( nSttPos > nEndPos ) // parameters switched? { - OSL_ENSURE( !this, "Start- > Ende-Position im Array" ); + OSL_ENSURE( !this, "Start > End for array access" ); sal_uInt16 nTmp = nSttPos; nSttPos = nEndPos; nEndPos = nTmp; @@ -930,28 +912,28 @@ sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, pEndNd = rOutlNds[ nEndPos ]; const int nNxtLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei if( nNxtLevel <= nLevel ) - break; // EndPos steht jetzt auf dem naechsten + break; // EndPos is now on the next one } } - // ohne Children, dann aber zumindest auf den naechsten + // if without children then set onto next one else if( ++nEndPos < rOutlNds.Count() ) pEndNd = rOutlNds[ nEndPos ]; - if( nEndPos == rOutlNds.Count() ) // kein Ende gefunden + if( nEndPos == rOutlNds.Count() ) // no end found pEndNd = &rNds.GetEndOfContent(); KillPams(); SwCrsrSaveState aSaveState( *pCurCrsr ); - // Jetzt das Ende ans Ende vom voherigen ContentNode setzen + // set end to the end of the previous content node pCurCrsr->GetPoint()->nNode = *pSttNd; pCurCrsr->GetPoint()->nContent.Assign( pSttNd->GetCntntNode(), 0 ); pCurCrsr->SetMark(); pCurCrsr->GetPoint()->nNode = *pEndNd; - pCurCrsr->Move( fnMoveBackward, fnGoNode ); // ans Ende vom Vorgaenger + pCurCrsr->Move( fnMoveBackward, fnGoNode ); // end of predecessor - // und schon ist alles selektiert + // and everything is already selected sal_Bool bRet = !pCurCrsr->IsSelOvr(); if( bRet ) UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); @@ -959,12 +941,12 @@ sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, } -// springe zu dieser Refmark +/// jump to reference marker sal_Bool SwCrsrShell::GotoRefMark( const String& rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); sal_uInt16 nPos; @@ -1078,7 +1060,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, if( bRet && bSetCrsr ) { SwCrsrSaveState aSaveState( *pCurCrsr ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves pCurCrsr->DeleteMark(); *pCurCrsr->GetPoint() = aPos; if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | @@ -1116,14 +1098,14 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, if( bSetCrsr ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pCurCrsr->DeleteMark(); *pCurCrsr->GetPoint() = aPos; if( pCurCrsr->IsSelOvr() ) { - // Click-Felder in geschuetzten Bereichen zulassen - // Nur Platzhalter geht nicht! + // allow click fields in protected sections + // only placeholder is not possible if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos || RES_JUMPEDITFLD == pFld->Which() ) pFld = 0; @@ -1134,8 +1116,8 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, else if( RES_TABLEFLD == pFld->Which() && ((SwTblField*)pFld)->IsIntrnlName() ) { - // erzeuge aus der internen (fuer CORE) - // die externe (fuer UI) Formel + // create from internal (for CORE) the external + // (for UI) formula const SwTableNode* pTblNd = pTxtNd->FindTableNode(); if( pTblNd ) // steht in einer Tabelle ((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() ); @@ -1166,7 +1148,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, { if( aTmpState.bFtnNoInfo ) { - // stehe ueber dem Zeichen der Fussnote (??) + // over the footnote's char bRet = sal_True; if( bSetCrsr ) { @@ -1183,7 +1165,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, bRet = sal_True; if( bSetCrsr ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode(); SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection( @@ -1248,7 +1230,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, bRet = sal_True; if( bSetCrsr ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pCurCrsr->DeleteMark(); *pCurCrsr->GetPoint() = aPos; @@ -1288,14 +1270,14 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, { pTxtAttr = pTxtNd->GetTxtAttrAt( aPos.nContent.GetIndex(), RES_TXTATR_INETFMT); - // nur INetAttrs mit URLs "erkennen" + // "detect" only INetAttrs with URLs if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() ) { bRet = sal_True; if( bSetCrsr ) { SwCrsrSaveState aSaveState( *pCurCrsr ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves pCurCrsr->DeleteMark(); *pCurCrsr->GetPoint() = aPos; if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | @@ -1364,13 +1346,12 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, SwFrm* pF = pTxtNd->getLayoutFrm( GetLayout(), &aPt ); if( pF ) { - // dann aber den CellFrame + // then the CellFrame pFrm = (SwCntntFrm*)pF; while( pF && !pF->IsCellFrm() ) pF = pF->GetUpper(); } - // es wurde ein if( aTmpState.bPosCorr ) { if( pF && !pF->Frm().IsInside( aPt )) @@ -1379,10 +1360,10 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, else if( !pF ) pF = pFrm; - if( pF ) // nur dann ist es gueltig!! + if( pF ) // only then it is valid { - // erzeuge aus der internen (fuer CORE) - // die externe (fuer UI) Formel + // create from internal (for CORE) the external + // (for UI) formula rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML; #ifdef DBG_UTIL if( RES_BOXATR_VALUE == pItem->Which() ) @@ -1394,7 +1375,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, bRet = sal_True; if( bSetCrsr ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); *pCurCrsr->GetPoint() = aPos; if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | @@ -1430,7 +1411,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, { const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i]; xub_StrLen nAttrStart = *pHt->GetStart(); - if( nAttrStart > n ) // ueber den Bereich hinaus + if( nAttrStart > n ) // over the section break; if( 0 != pHt->GetEnd() && ( @@ -1447,9 +1428,9 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, pTxtNd->GetpSwAttrSet()->Count() ) { SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() ); - // aus dem Format-Set alle entfernen, die im TextSet auch gesetzt sind + // remove all from format set that are also in TextSet aFmtSet.Differentiate( aSet ); - // jetzt alle zusammen "mergen" + // now merge all together aSet.Put( aFmtSet ); } } @@ -1463,11 +1444,11 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt, rCntntAtPos.sStr += String::CreateFromInt32( aPos.nContent.GetIndex()); rCntntAtPos.sStr += ')'; rCntntAtPos.sStr.AppendAscii( - RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " )); + RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " )); // translation *might be* "paragraph template" rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName(); if( pTxtNd->GetCondFmtColl() ) rCntntAtPos.sStr.AppendAscii( - RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " )) + RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " )) // translation *might be* "conditional template" += pTxtNd->GetCondFmtColl()->GetName(); if( aSet.Count() ) @@ -1540,7 +1521,7 @@ const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const return pPostItFld; } -// befindet sich der Node in einem geschuetzten Bereich? +/// is the node in a protected section? sal_Bool SwContentAtPos::IsInProtectSect() const { const SwTxtNode* pNd = 0; @@ -1627,7 +1608,7 @@ sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand, if( pTxtAttr ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pCurCrsr->DeleteMark(); @@ -1655,7 +1636,7 @@ sal_Bool SwCrsrShell::GotoINetAttr( const SwTxtINetFmt& rAttr ) SwCursor* pCrsr = getShellCrsr( true ); SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCrsr ); pCrsr->GetPoint()->nNode = *rAttr.GetpTxtNode(); @@ -1693,7 +1674,7 @@ sal_Bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode, if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) && !aPos.nNode.GetNode().IsProtect()) { - // Start-Position im geschuetzten Bereich? + // start position in protected section? rRect = aFPos.aCrsr; rOrient = aFPos.eOrient; bRet = sal_True; @@ -1718,13 +1699,13 @@ sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen + SwCallLink aLk( *this ); // watch Crsr-Moves StartAction(); SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode(); SwUndoId nUndoId = UNDO_INS_FROM_SHADOWCRSR; - // Werden nur die Absatzattribute Adjust oder LRSpace gesetzt, - // dann sollte der naechste Aufruf die NICHT wieder entfernen. + // If only the paragraph attributes "Adjust" or "LRSpace" are set, + // then the following should not delete those again. if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt && ( FILL_INDENT == aFPos.eMode || ( text::HoriOrientation::NONE != aFPos.eOrient && @@ -1793,7 +1774,7 @@ sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) GetDoc()->InsertItemSet( *pCurCrsr, aSet, 0 ); } else { - OSL_ENSURE( !this, "wo ist mein CntntNode?" ); + OSL_ENSURE( !this, "No CntntNode" ); } break; @@ -1814,7 +1795,7 @@ sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) GetDoc()->InsertString( *pCurCrsr, sInsert ); } } - // kein break - Ausrichtung muss noch gesetzt werden + // no break - still need to set orientation case FILL_MARGIN: if( text::HoriOrientation::NONE != aFPos.eOrient ) { @@ -1850,7 +1831,7 @@ const SwRedline* SwCrsrShell::SelNextRedline() if( !IsTableMode() ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pFnd = GetDoc()->SelNextRedline( *pCurCrsr ); @@ -1868,7 +1849,7 @@ const SwRedline* SwCrsrShell::SelPrevRedline() if( !IsTableMode() ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pFnd = GetDoc()->SelPrevRedline( *pCurCrsr ); @@ -1883,7 +1864,7 @@ const SwRedline* SwCrsrShell::SelPrevRedline() const SwRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect ) { const SwRedline* pFnd = 0; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); pFnd = GetDoc()->GetRedlineTbl()[ nArrPos ]; @@ -1972,10 +1953,8 @@ const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect if( pTmp && bCheck ) { - // checke auf Ueberlappungen. Das kann durch - // FmtColl-Redlines kommen, die auf den gesamten Absatz - // aus gedehnt werden. - + // Check for overlaps. These can happen when FmtColl- + // Redlines were streched over a whole paragraph SwPaM* pCur = pCurCrsr; SwPaM* pNextPam = (SwPaM*)pCur->GetNext(); SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End(); @@ -1988,7 +1967,7 @@ const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect switch( ::ComparePosition( *pCStt, *pCEnd, *pNStt, *pNEnd )) { - case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2 + case POS_INSIDE: // Pos1 is completely in Pos2 if( !pCur->HasMark() ) { pCur->SetMark(); @@ -1999,16 +1978,16 @@ const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect *pCEnd = *pNEnd; break; - case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1 - case POS_EQUAL: // Pos1 ist genauso gross wie Pos2 + case POS_OUTSIDE: // Pos2 is completely in Pos1 + case POS_EQUAL: // Pos1 has same size as Pos2 break; - case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang + case POS_OVERLAP_BEFORE: // Pos1 overlaps Pos2 at beginning if( !pCur->HasMark() ) pCur->SetMark(); *pCEnd = *pNEnd; break; - case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende + case POS_OVERLAP_BEHIND: // Pos1 overlaps Pos2 at end if( !pCur->HasMark() ) { pCur->SetMark(); @@ -2024,7 +2003,7 @@ const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect if( bDel ) { - // den brauchen wir nicht mehr + // not needed anymore SwPaM* pPrevPam = (SwPaM*)pNextPam->GetPrev(); delete pNextPam; pNextPam = pPrevPam; @@ -2042,7 +2021,7 @@ const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect { if( pTmp ) { - // neuen Cursor erzeugen + // create new cursor CreateCrsr(); bCheck = sal_True; } diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 3d172a4e36ed..eb05b4902e56 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -86,11 +86,11 @@ const SwTxtAttr* GetFrwrdTxtHint( const SwpHints& rHtsArr, sal_uInt16& rPos, while( rPos < rHtsArr.Count() ) { const SwTxtAttr *pTxtHt = rHtsArr.GetStart( rPos++ ); - // der Start vom Attribut muss innerhalb des Bereiches liegen !! + // the start of an attribute has to be in the section if( *pTxtHt->GetStart() >= nCntntPos ) - return pTxtHt; // gueltiges TextAttribut + return pTxtHt; // valid text attribute } - return 0; // kein gueltiges TextAttribut + return 0; // invalid text attribute } @@ -99,13 +99,12 @@ const SwTxtAttr* GetBkwrdTxtHint( const SwpHints& rHtsArr, sal_uInt16& rPos, { while( rPos > 0 ) { - //Hack mit cast fuer das Update const SwTxtAttr *pTxtHt = rHtsArr.GetStart( --rPos ); - // der Start vom Attribut muss innerhalb des Bereiches liegen !! + // the start of an attribute has to be in the section if( *pTxtHt->GetStart() < nCntntPos ) - return pTxtHt; // gueltiges TextAttribut + return pTxtHt; // valid text attribute } - return 0; // kein gueltiges TextAttribut + return 0; // invalid text attribute } @@ -123,7 +122,7 @@ void lcl_SetAttrPam( SwPaM & rPam, xub_StrLen nStart, const xub_StrLen* pEnde, rPam.GetPoint()->nContent.Assign( pCNd, nStart ); rPam.SetMark(); // Point == GetMark - // Point zeigt auf das Ende vom SuchBereich oder Ende vom Attribut + // Point points to end of search area or end of attribute if( pEnde ) { if( bTstEnde && *pEnde > nCntntPos ) @@ -133,13 +132,20 @@ void lcl_SetAttrPam( SwPaM & rPam, xub_StrLen nStart, const xub_StrLen* pEnde, } } -//------------------ Suche nach einem Text Attribut ----------------------- - -// diese Funktion sucht in einem TextNode nach dem vorgegebenen Attribut. -// Wird es gefunden, dann hat der SwPaM den Bereich der das Attribut -// umspannt, unter Beachtung des Suchbereiches +// TODO: provide documentation +/** search for a text attribute + This function searches in a text node for a given attribute. + If that is found then the SwPaM contains the section that surrounds the + attribute (w.r.t. the search area). + @param rTxtNd Text node to search in. + @param rPam ??? + @param rCmpItem ??? + @param fnMove ??? + @param bValue ??? + @return Returns if found, otherwise. +*/ sal_Bool lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam, const SfxPoolItem& rCmpItem, SwMoveFn fnMove, sal_Bool bValue ) @@ -161,9 +167,7 @@ sal_Bool lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam, return sal_False; } - -//------------------ Suche nach mehren Text Attributen ------------------- - +/// search for multiple text attributes struct _SwSrchChrAttr { sal_uInt16 nWhich; @@ -191,7 +195,7 @@ public: void SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ); - // wieviele Attribute ueberhaupt ?? + /// how many attributes are there in total? sal_uInt16 Count() const { return aCmpSet.Count(); } int Found() const { return nFound == aCmpSet.Count(); } int CheckStack(); @@ -217,7 +221,7 @@ SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, int bFwd, bForward = 0 != bFwd; - // Bestimmen den Bereich des Fnd/Stack-Arrays (Min/Max) + // determine area of Fnd/Stack array (Min/Max) SfxItemIter aIter( aCmpSet ); nArrStart = aCmpSet.GetWhichByPos( aIter.GetFirstPos() ); nArrLen = aCmpSet.GetWhichByPos( aIter.GetLastPos() ) - nArrStart+1; @@ -269,12 +273,11 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) while( sal_True ) { - // nur testen, ob vorhanden ist ? if( IsInvalidItem( pItem ) ) { nWhich = aCmpSet.GetWhichByPos( aIter.GetCurPos() ); if( RES_TXTATR_END <= nWhich ) - break; // Ende der TextAttribute + break; // end of text attributes if( SFX_ITEM_SET == rSet.GetItemState( nWhich, !bNoColls, &pFndItem ) && !CmpAttr( *pFndItem, rSet.GetPool()->GetDefaultItem( nWhich ) )) @@ -287,7 +290,7 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) else { if( RES_TXTATR_END <= (nWhich = pItem->Which() )) - break; // Ende der TextAttribute + break; // end of text attributes if( CmpAttr( rSet.Get( nWhich, !bNoColls ), *pItem ) ) { @@ -329,9 +332,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) } const SfxPoolItem* pItem; -// -------------------------------------------------------------- -// Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht -// -------------------------------------------------------------- + // here we explicitly also search in character templates sal_uInt16 nWhch = rAttr.Which(); SfxWhichIter* pIter = NULL; const SfxPoolItem* pTmpItem = NULL; @@ -363,23 +364,20 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) sal_uInt16 n; _SwSrchChrAttr* pCmp; - // loesche erstmal alle, die bis zu der Start Position schon wieder - // ungueltig sind: - + // first delete all up to start position that are already invalid _SwSrchChrAttr* pArrPtr; if( nFound ) for( pArrPtr = pFndArr, n = 0; n < nArrLen; ++n, ++pArrPtr ) if( pArrPtr->nWhich && pArrPtr->nEnd <= aTmp.nStt ) { - pArrPtr->nWhich = 0; // geloescht + pArrPtr->nWhich = 0; // deleted nFound--; } - // loesche erstmal alle, die bis zu der Start Position schon wieder - // ungueltig sind. Und verschiebe alle die "offen" sind, heisst ueber - // die Start Position ragen, vom Stack in den FndSet - + // delete all up to start position that are already invalid and + // move all "open" ones (= stick out over start position) from stack + // into FndSet if( nStackCnt ) for( pArrPtr = pStackArr, n=0; n < nArrLen; ++n, ++pArrPtr ) { @@ -388,7 +386,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) if( pArrPtr->nEnd <= aTmp.nStt ) { - pArrPtr->nWhich = 0; // geloescht + pArrPtr->nWhich = 0; // deleted if( !--nStackCnt ) break; } @@ -396,7 +394,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) { if( ( pCmp = &pFndArr[ n ])->nWhich ) { - if( pCmp->nEnd < pArrPtr->nEnd ) // erweitern + if( pCmp->nEnd < pArrPtr->nEnd ) // extend pCmp->nEnd = pArrPtr->nEnd; } else @@ -414,23 +412,23 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) if( SFX_ITEM_DONTCARE == eState ) { - // wird Attribut gueltig ? + // Will the attribute become valid? if( !CmpAttr( aCmpSet.GetPool()->GetDefaultItem( nWhch ), *pTmpItem )) { - // suche das Attribut und erweiter es gegebenenfalls + // search attribute and extend if needed if( !( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich ) { - *pCmp = aTmp; // nicht gefunden, eintragen + *pCmp = aTmp; // not found, insert nFound++; } - else if( pCmp->nEnd < aTmp.nEnd ) // erweitern ? + else if( pCmp->nEnd < aTmp.nEnd ) // extend? pCmp->nEnd = aTmp.nEnd; bContinue = sal_True; } } - // wird Attribut gueltig ? + // Will the attribute become valid? else if( CmpAttr( *pItem, *pTmpItem ) ) { pFndArr[ nWhch - nArrStart ] = aTmp; @@ -438,20 +436,19 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) bContinue = sal_True; } - // tja, dann muss es auf den Stack + // then is has to go on the stack if( !bContinue && ( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich ) { - // vorhanden, auf den Stack. Aber nur wenn es noch grosser ist + // exists on stack, only if it is even bigger if( pCmp->nEnd > aTmp.nEnd ) { OSL_ENSURE( !pStackArr[ nWhch - nArrStart ].nWhich, - "Stack-Platz ist noch belegt" ); + "slot on stack is still in use" ); if( aTmp.nStt <= pCmp->nStt ) pCmp->nStt = aTmp.nEnd; else pCmp->nEnd = aTmp.nStt; - // --------- pStackArr[ nWhch - nArrStart ] = *pCmp; nStackCnt++; @@ -487,9 +484,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) } const SfxPoolItem* pItem; -// -------------------------------------------------------------- -// Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht -// -------------------------------------------------------------- + // here we explicitly also search in character templates sal_uInt16 nWhch = rAttr.Which(); SfxWhichIter* pIter = NULL; const SfxPoolItem* pTmpItem = NULL; @@ -521,22 +516,19 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) sal_uInt16 n; _SwSrchChrAttr* pCmp; - // loesche erstmal alle, die bis zu der Start Position schon wieder - // ungueltig sind: - + // first delete all up to start position that are already invalid _SwSrchChrAttr* pArrPtr; if( nFound ) for( pArrPtr = pFndArr, n = 0; n < nArrLen; ++n, ++pArrPtr ) if( pArrPtr->nWhich && pArrPtr->nStt >= aTmp.nEnd ) { - pArrPtr->nWhich = 0; // geloescht + pArrPtr->nWhich = 0; // deleted nFound--; } - // loesche erstmal alle, die bis zu der Start Position schon wieder - // ungueltig sind. Und verschiebe alle die "offen" sind, heisst ueber - // die Start Position ragen, vom Stack in den FndSet - + // delete all up to start position that are already invalid and + // move all "open" ones (= stick out over start position) from stack + // into FndSet if( nStackCnt ) for( pArrPtr = pStackArr, n = 0; n < nArrLen; ++n, ++pArrPtr ) { @@ -545,7 +537,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) if( pArrPtr->nStt >= aTmp.nEnd ) { - pArrPtr->nWhich = 0; // geloescht + pArrPtr->nWhich = 0; // deleted if( !--nStackCnt ) break; } @@ -553,7 +545,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) { if( ( pCmp = &pFndArr[ n ])->nWhich ) { - if( pCmp->nStt > pArrPtr->nStt ) // erweitern + if( pCmp->nStt > pArrPtr->nStt ) // extend pCmp->nStt = pArrPtr->nStt; } else @@ -570,23 +562,23 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) sal_Bool bContinue = sal_False; if( SFX_ITEM_DONTCARE == eState ) { - // wird Attribut gueltig ? + // Will the attribute become valid? if( !CmpAttr( aCmpSet.GetPool()->GetDefaultItem( nWhch ), *pTmpItem ) ) { - // suche das Attribut und erweiter es gegebenenfalls + // search attribute and extend if needed if( !( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich ) { - *pCmp = aTmp; // nicht gefunden, eintragen + *pCmp = aTmp; // not found, insert nFound++; } - else if( pCmp->nStt > aTmp.nStt ) // erweitern ? + else if( pCmp->nStt > aTmp.nStt ) // extend? pCmp->nStt = aTmp.nStt; bContinue = sal_True; } } - // wird Attribut gueltig ? + // Will the attribute become valid? else if( CmpAttr( *pItem, *pTmpItem )) { pFndArr[ nWhch - nArrStart ] = aTmp; @@ -594,20 +586,19 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) bContinue = sal_True; } - // tja, dann muss es auf den Stack + // then is has to go on the stack if( !bContinue && ( pCmp = &pFndArr[ nWhch - nArrStart ])->nWhich ) { - // vorhanden, auf den Stack. Aber nur wenn es noch grosser ist + // exists on stack, only if it is even bigger if( pCmp->nStt < aTmp.nStt ) { OSL_ENSURE( !pStackArr[ nWhch - nArrStart ].nWhich, - "Stack-Platz ist noch belegt" ); + "slot on stack is still in use" ); if( aTmp.nEnd <= pCmp->nEnd ) pCmp->nEnd = aTmp.nStt; else pCmp->nStt = aTmp.nEnd; -// --------- pStackArr[ nWhch - nArrStart ] = *pCmp; nStackCnt++; @@ -671,15 +662,14 @@ int SwAttrCheckArr::CheckStack() if( bForward ? pArrPtr->nEnd <= nSttPos : pArrPtr->nStt >= nEndPos ) { - pArrPtr->nWhich = 0; // geloescht + pArrPtr->nWhich = 0; // deleted if( !--nStackCnt ) return nFound == aCmpSet.Count(); } else if( bForward ? pArrPtr->nStt < nEndPos : pArrPtr->nEnd > nSttPos ) { - // alle die "offen" sind, heisst ueber die Start Position ragen, - // im FndSet setzen - OSL_ENSURE( !pFndArr[ n ].nWhich, "Array-Platz ist noch belegt" ); + // move all "open" ones (= stick out over start position) into FndSet + OSL_ENSURE( !pFndArr[ n ].nWhich, "slot in array is already in use" ); pFndArr[ n ] = *pArrPtr; pArrPtr->nWhich = 0; nFound++; @@ -706,13 +696,11 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, return sal_True; } - // dann gehe mal durch das nach "Start" sortierte Array const SwpHints& rHtArr = rTxtNd.GetSwpHints(); const SwTxtAttr* pAttr; sal_uInt16 nPos = 0; - // sollte jetzt schon alles vorhanden sein, dann teste, mit welchem - // das wieder beendet wird. + // if everything is already there then check with which it will be ended if( rCmpArr.Found() ) { for( ; nPos < rHtArr.Count(); ++nPos ) @@ -720,18 +708,18 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, { if( rCmpArr.GetNdStt() < *pAttr->GetStart() ) { - // dann haben wir unser Ende: + // found end lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), pAttr->GetStart(), sal_True ); return sal_True; } - // ansonsten muessen wir weiter suchen + // continue search break; } if( nPos == rHtArr.Count() && rCmpArr.Found() ) { - // dann haben wir unseren Bereich + // found nEndPos = rCmpArr.GetNdEnd(); lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_True ); return sal_True; @@ -741,8 +729,7 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, for( ; nPos < rHtArr.Count(); ++nPos ) if( rCmpArr.SetAttrFwd( *( pAttr = rHtArr.GetStart( nPos )) ) ) { - // sollten noch mehr auf der gleichen Position anfangen ?? - // auch die noch mit testen !! + // Do multiple start at that position? Do also check those: nSttPos = *pAttr->GetStart(); while( ++nPos < rHtArr.Count() && nSttPos == *( pAttr = rHtArr.GetStart( nPos ))->GetStart() && @@ -751,7 +738,7 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, if( !rCmpArr.Found() ) continue; - // dann haben wir den Bereich zusammen + // then we have our search area if( (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) ) return sal_False; lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_True ); @@ -780,13 +767,11 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, return sal_True; } - // dann gehe mal durch das nach "Start" sortierte Array const SwpHints& rHtArr = rTxtNd.GetSwpHints(); const SwTxtAttr* pAttr; sal_uInt16 nPos = rHtArr.Count(); - // sollte jetzt schon alles vorhanden sein, dann teste, mit welchem - // das wieder beendet wird. + // if everything is already there then check with which it will be ended if( rCmpArr.Found() ) { while( nPos ) @@ -795,19 +780,19 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, nSttPos = *pAttr->GetAnyEnd(); if( nSttPos < rCmpArr.GetNdEnd() ) { - // dann haben wir unser Ende: + // found end nEndPos = rCmpArr.GetNdEnd(); lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False ); return sal_True; } - // ansonsten muessen wir weiter suchen + // continue search break; } if( !nPos && rCmpArr.Found() ) { - // dann haben wir unseren Bereich + // found nEndPos = rCmpArr.GetNdEnd(); lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_False ); return sal_True; @@ -817,8 +802,7 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, while( nPos ) if( rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetEnd( --nPos )) ) ) { - // sollten noch mehr auf der gleichen Position anfangen ?? - // auch die noch mit testen !! + // Do multiple start at that position? Do also check those: if( nPos ) { nEndPos = *pAttr->GetAnyEnd(); @@ -830,8 +814,7 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, if( !rCmpArr.Found() ) continue; - - // dann haben wir den Bereich zusammen + // then we have our search area if( (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) ) return sal_False; lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False ); @@ -848,7 +831,7 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, sal_Bool bNoColls ) { - // nur die harte Attributierung suchen ? + // search only hard attribution? if( bNoColls && !rCNd.HasSwAttrSet() ) return sal_False; @@ -860,7 +843,6 @@ int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, sal_Bool bNo while( sal_True ) { - // nur testen, ob vorhanden ist ? if( IsInvalidItem( pItem )) { nWhich = rCmpSet.GetWhichByPos( aIter.GetCurPos() ); @@ -880,14 +862,14 @@ int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, sal_Bool bNo break; pItem = aIter.NextItem(); } - return sal_True; // wurde gefunden + return sal_True; // found } sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove, const SwPaM *pRegion, sal_Bool bInReadOnly ) { - // stelle fest welches Attribut gesucht wird: + // determine which attribute is searched: sal_uInt16 nWhich = rAttr.Which(); int bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich); @@ -900,7 +882,7 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove const SfxPoolItem* pItem; SwpFmts aFmtArr; - // Wenn am Anfang/Ende, aus dem Node moven + // if at beginning/end then move it out of the node if( bSrchForward ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len() : !pPam->GetPoint()->nContent.GetIndex() ) @@ -919,13 +901,13 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove { if( bCharAttr ) { - if( !pNode->IsTxtNode() ) // CharAttr sind nur in TextNodes + if( !pNode->IsTxtNode() ) // CharAttr are only in text nodes continue; if( ((SwTxtNode*)pNode)->HasHints() && lcl_Search( *(SwTxtNode*)pNode, *pPam, rAttr, fnMove, bValue )) { - // setze auf die Werte vom Attribut + // set to the values of the attribute SetMark(); *GetPoint() = *pPam->GetPoint(); *GetMark() = *pPam->GetMark(); @@ -933,25 +915,24 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove break; } else if (isTXTATR(nWhich)) - continue; // --> also weiter + continue; } - // keine harte Attributierung, dann pruefe, ob die Vorlage schon - // mal nach dem Attribut befragt wurde + // no hard attribution, so check if node was asked for this attr before if( !pNode->HasSwAttrSet() ) { const SwFmt* pTmpFmt = pNode->GetFmtColl(); if( aFmtArr.Count() && aFmtArr.Seek_Entry( pTmpFmt )) - continue; // die Collection wurde schon mal befragt + continue; // collection was requested earlier aFmtArr.Insert( pTmpFmt ); } if( SFX_ITEM_SET == pNode->GetSwAttrSet().GetItemState( nWhich, sal_True, &pItem ) && ( !bValue || *pItem == rAttr ) ) { - // FORWARD: Point an das Ende, GetMark zum Anfanf vom Node - // BACKWARD: Point zum Anfang, GetMark an das Ende vom Node - // und immer nach der Logik: inkl. Start, exkl. End !!! + // FORWARD: SPoint at the end, GetMark at the beginning of the node + // BACKWARD: SPoint at the beginning, GetMark at the end of the node + // always: incl. start and incl. end *GetPoint() = *pPam->GetPoint(); SetMark(); pNode->MakeEndIndex( &GetPoint()->nContent ); @@ -960,7 +941,7 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove } } - // beim rueckwaerts Suchen noch Point und Mark vertauschen + // if backward search, switch point and mark if( bFound && !bSrchForward ) Exchange(); @@ -982,18 +963,17 @@ sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove SwCntntNode * pNode; SwpFmts aFmtArr; - // teste doch mal welche Text/Char-Attribute gesucht werden + // check which text/char attributes are searched SwAttrCheckArr aCmpArr( rSet, bSrchForward, bNoColls ); SfxItemSet aOtherSet( GetDoc()->GetAttrPool(), RES_PARATR_BEGIN, RES_GRFATR_END-1 ); - aOtherSet.Put( rSet, sal_False ); // alle Invalid-Items erhalten! + aOtherSet.Put( rSet, sal_False ); // got all invalid items FnSearchAttr fnSearch = bSrchForward ? (&::lcl_SearchForward) : (&::lcl_SearchBackward); - // Wenn am Anfang/Ende, aus dem Node moven - // Wenn am Anfang/Ende, aus dem Node moven + // if at beginning/end then move it out of the node if( bMoveFirst && ( bSrchForward ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len() @@ -1014,41 +994,40 @@ sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove { if( aCmpArr.Count() ) { - if( !pNode->IsTxtNode() ) // CharAttr sind nur in TextNodes + if( !pNode->IsTxtNode() ) // CharAttr are only in text nodes continue; if( (!aOtherSet.Count() || lcl_Search( *pNode, aOtherSet, bNoColls )) && (*fnSearch)( *(SwTxtNode*)pNode, aCmpArr, *pPam )) { - // setze auf die Werte vom Attribut + // set to the values of the attribute SetMark(); *GetPoint() = *pPam->GetPoint(); *GetMark() = *pPam->GetMark(); bFound = sal_True; break; } - continue; // TextAttribute + continue; // text attribute } if( !aOtherSet.Count() ) continue; - // keine harte Attributierung, dann pruefe, ob die Vorlage schon - // mal nach dem Attribut befragt wurde + // no hard attribution, so check if node was asked for this attr before if( !pNode->HasSwAttrSet() ) { const SwFmt* pTmpFmt = pNode->GetFmtColl(); if( aFmtArr.Count() && aFmtArr.Seek_Entry( pTmpFmt )) - continue; // die Collection wurde schon mal befragt + continue; // collection was requested earlier aFmtArr.Insert( pTmpFmt ); } if( lcl_Search( *pNode, aOtherSet, bNoColls )) { - // FORWARD: Point an das Ende, GetMark zum Anfanf vom Node - // BACKWARD: Point zum Anfang, GetMark an das Ende vom Node - // und immer nach der Logik: inkl. Start, exkl. End !!! + // FORWARD: SPoint at the end, GetMark at the beginning of the node + // BACKWARD: SPoint at the beginning, GetMark at the end of the node + // always: incl. start and incl. end *GetPoint() = *pPam->GetPoint(); SetMark(); pNode->MakeEndIndex( &GetPoint()->nContent ); @@ -1057,7 +1036,7 @@ sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove } } - // beim rueckwaerts Suchen noch Point und Mark vertauschen + // if backward search, switch point and mark if( bFound && !bSrchForward ) Exchange(); @@ -1065,9 +1044,7 @@ sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove return bFound; } -//------------------ Methoden vom SwCursor --------------------------- - -// Parameter fuer das Suchen vom Attributen +/// parameters for search for attributes struct SwFindParaAttr : public SwFindParas { sal_Bool bValue; @@ -1092,8 +1069,7 @@ struct SwFindParaAttr : public SwFindParas int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, sal_Bool bInReadOnly ) { - // String ersetzen ?? (nur wenn Text angegeben oder nicht attributiert - // gesucht wird) + // replace string (only if text given and search is not parameterized)? sal_Bool bReplaceTxt = pSearchOpt && ( !pSearchOpt->replaceString.isEmpty() || !pSet->Count() ); sal_Bool bReplaceAttr = pReplSet && pReplSet->Count(); @@ -1101,7 +1077,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, if( bInReadOnly && (bReplaceAttr || bReplaceTxt )) bInReadOnly = sal_False; - // wir suchen nach Attributen, soll zusaetzlich Text gesucht werden ? + // We search for attributes, should we search for text as well? { SwPaM aRegion( *pRegion->GetMark(), *pRegion->GetPoint() ); SwPaM* pTextRegion = &aRegion; @@ -1109,22 +1085,22 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, while( sal_True ) { - if( pSet->Count() ) // gibts ueberhaupt Attributierung? + if( pSet->Count() ) // any attributes? { - // zuerst die Attributierung + // first attributes if( !aSrchPam.Find( *pSet, bValue, fnMove, &aRegion, bInReadOnly, bMoveFirst ) ) return FIND_NOT_FOUND; bMoveFirst = sal_True; if( !pSearchOpt ) - break; // ok, nur Attribute, also gefunden + break; // ok, only attributes, so found pTextRegion = &aSrchPam; } else if( !pSearchOpt ) return FIND_NOT_FOUND; - // dann darin den Text + // then search in text of it if( !pSTxt ) { SearchOptions aTmp( *pSearchOpt ); @@ -1141,12 +1117,12 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, // todo/mba: searching for attributes in Outliner text?! sal_Bool bSearchInNotes = sal_False; - // Bug 24665: suche im richtigen Bereich weiter (pTextRegion!) + // continue search in correct section (pTextRegion) if( aSrchPam.Find( *pSearchOpt, bSearchInNotes, *pSTxt, fnMove, pTextRegion, bInReadOnly ) && - *aSrchPam.GetMark() != *aSrchPam.GetPoint() ) // gefunden ? - break; // also raus + *aSrchPam.GetMark() != *aSrchPam.GetPoint() ) + break; // found else if( !pSet->Count() ) - return FIND_NOT_FOUND; // nur Text und nicht gefunden + return FIND_NOT_FOUND; // only text and nothing found *aRegion.GetMark() = *aSrchPam.GetPoint(); } @@ -1163,8 +1139,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, SwIndex& rSttCntIdx = pCrsr->Start()->nContent; xub_StrLen nSttCnt = rSttCntIdx.GetIndex(); - // damit die Region auch verschoben wird, in den Shell-Cursr-Ring - // mit aufnehmen !! + // add to shell-cursor-ring so that the regions will be moved enventually Ring *pPrevRing = 0; if( bRegExp ) { @@ -1181,7 +1156,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, if( bRegExp ) { - // und die Region wieder herausnehmen: + // and remove region again Ring *p, *pNext = (Ring*)pRegion; do { p = pNext; @@ -1194,11 +1169,9 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, if( bReplaceAttr ) { - // --- Ist die Selection noch da ?????? - - //JP 13.07.95: alle gesuchten Attribute werden, wenn nicht im - // ReplaceSet angegeben, auf Default zurueck gesetzt - + // is the selection still existent? + // all searched attributes are reset to default if + // they are not in ReplaceSet if( !pSet->Count() ) { pCrsr->GetDoc()->InsertItemSet( *pCrsr, *pReplSet, 0 ); @@ -1212,7 +1185,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, const SfxPoolItem* pItem = aIter.GetCurItem(); while( sal_True ) { - // alle die nicht gesetzt sind mit Pool-Defaults aufuellen + // reset all that are not set with pool defaults if( !IsInvalidItem( pItem ) && SFX_ITEM_SET != pReplSet->GetItemState( pItem->Which(), sal_False )) aSet.Put( pPool->GetDefaultItem( pItem->Which() )); @@ -1239,15 +1212,13 @@ int SwFindParaAttr::IsReplaceMode() const ( pReplSet && pReplSet->Count() ); } -// Suchen nach Attributen - - +/// search for attributes sal_uLong SwCursor::Find( const SfxItemSet& rSet, sal_Bool bNoCollections, SwDocPositions nStart, SwDocPositions nEnde, sal_Bool& bCancel, FindRanges eFndRngs, const SearchOptions* pSearchOpt, const SfxItemSet* pReplSet ) { - // OLE-Benachrichtigung abschalten !! + // switch off OLE-notifications SwDoc* pDoc = GetDoc(); Link aLnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index 756e21698ba9..4563e09f556b 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -37,9 +37,7 @@ #include #include -//------------------ Methoden der CrsrShell --------------------------- - -// Parameter fuer das Suchen vom FormatCollections +/// parameters for a search for FormatCollections struct SwFindParaFmtColl : public SwFindParas { const SwTxtFmtColl *pFmtColl, *pReplColl; @@ -77,15 +75,12 @@ int SwFindParaFmtColl::IsReplaceMode() const return 0 != pReplColl; } - -// Suchen nach Format-Collections - - +/// search for Format-Collections sal_uLong SwCursor::Find( const SwTxtFmtColl& rFmtColl, SwDocPositions nStart, SwDocPositions nEnde, sal_Bool& bCancel, FindRanges eFndRngs, const SwTxtFmtColl* pReplFmtColl ) { - // OLE-Benachrichtigung abschalten !! + // switch off OLE-notifications SwDoc* pDoc = GetDoc(); Link aLnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); diff --git a/sw/source/core/crsr/findfmt.cxx b/sw/source/core/crsr/findfmt.cxx index e148f01111ef..09dc12a0a9fd 100644 --- a/sw/source/core/crsr/findfmt.cxx +++ b/sw/source/core/crsr/findfmt.cxx @@ -37,7 +37,7 @@ sal_Bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove, sal_Bool bSrchForward = fnMove == fnMoveForward; SwPaM* pPam = MakeRegion( fnMove, pRegion ); - // Wenn am Anfang/Ende, aus dem Node moven + // if at beginning/end then move it out of the node if( bSrchForward ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len() : !pPam->GetPoint()->nContent.GetIndex() ) @@ -59,18 +59,19 @@ sal_Bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove, { if( 0 != ( bFound = (pNode->GetFmtColl() == &rFmt) )) { - // wurde die FormatCollection gefunden, dann handelt es sich auf - // jedenfall um einen SwCntntNode !! + // if a FormatCollection is found then it is definitely a SwCntntNode - // FORWARD: SPoint an das Ende, GetMark zum Anfanf vom Node - // BACKWARD: SPoint zum Anfang, GetMark an das Ende vom Node - // und immer nach der Logik: inkl. Start, exkl. End !!! + // FORWARD: SPoint at the end, GetMark at the beginning of the node + // BACKWARD: SPoint at the beginning, GetMark at the end of the node + // always: incl. start and incl. end *GetPoint() = *pPam->GetPoint(); SetMark(); pNode->MakeEndIndex( &GetPoint()->nContent ); GetMark()->nContent = 0; - if( !bSrchForward ) // rueckwaerts Suche? - Exchange(); // SPoint und GetMark tauschen + + // if backward search, switch point and mark + if( !bSrchForward ) + Exchange(); break; } } diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 261e8378332d..cc5f2e130cda 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -132,15 +132,14 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, case RES_TXTATR_META: case RES_TXTATR_METAFIELD: { - // JP 06.05.98: mit Bug 50100 werden sie als Trenner erwuenscht und nicht - // mehr zum Wort dazu gehoerend. - // MA 23.06.98: mit Bug 51215 sollen sie konsequenterweise auch am - // Satzanfang und -ende ignoriert werden wenn sie Leer sind. - // Dazu werden sie schlicht entfernt. Fuer den Anfang entfernen - // wir sie einfach. - // Fuer das Ende merken wir uns die Ersetzungen und entferenen - // hinterher alle am Stringende (koenten ja 'normale' 0x7f drinstehen - sal_Bool bEmpty = RES_TXTATR_FIELD != pHt->Which() || + // (1998) they are desired as separators and + // belong not any longer to a word. + // they should also be ignored at a + // beginning/end of a sentence if blank. Those are + // simply removed if first. If at the end, we keep the + // replacement and remove afterwards all at a string's + // end (might be normal 0x7f). + sal_Bool bEmpty = RES_TXTATR_FIELD != pHt->Which() || !(static_cast(pHt) ->GetFld().GetFld()->ExpandField(true).Len()); if ( bEmpty && nStart == nAkt ) @@ -233,8 +232,7 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode; SwIndex& rCntntIdx = pPam->GetPoint()->nContent; - // Wenn am Anfang/Ende, aus dem Node moven - // beim leeren Node nicht weiter + // If a beginning/end, from out of node; stop if empty node if( bSrchForward ? ( rCntntIdx.GetIndex() == pPam->GetCntntNode()->Len() && rCntntIdx.GetIndex() ) @@ -250,14 +248,9 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes rCntntIdx.Assign( pNd, nTmpPos ); } - /* - * Ist bFound == sal_True, dann wurde der String gefunden und in - * nStart und nEnde steht der gefundenen String - */ + // If bFound is true then the string was found and is between nStart and nEnd sal_Bool bFound = sal_False; - /* - * StartPostion im Text oder Anfangsposition - */ + // start position in text or initial position sal_Bool bFirst = sal_True; SwCntntNode * pNode; @@ -487,15 +480,15 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt, if( nSearchScript == nCurrScript && (rSTxt.*fnMove->fnSearch)( sCleanStr, &nStart, &nEnde, 0 )) { - // setze den Bereich richtig + // set section correctly *GetPoint() = *pPam->GetPoint(); SetMark(); - // Start und Ende wieder korrigieren !! + // adjust start and end if( !aFltArr.empty() ) { xub_StrLen n, nNew; - // bei Rueckwaertssuche die Positionen temp. vertauschen + // if backward search, switch positions temporarily if( !bSrchForward ) { n = nStart; nStart = nEnde; nEnde = n; } for( n = 0, nNew = nStart; @@ -509,14 +502,15 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt, ; nEnde = nNew; - // bei Rueckwaertssuche die Positionen temp. vertauschen + // if backward search, switch positions temporarily if( !bSrchForward ) { n = nStart; nStart = nEnde; nEnde = n; } } - GetMark()->nContent = nStart; // Startposition setzen + GetMark()->nContent = nStart; GetPoint()->nContent = nEnde; - if( !bSrchForward ) // rueckwaerts Suche? - Exchange(); // Point und Mark tauschen + // if backward search, switch point and mark + if( !bSrchForward ) + Exchange(); bFound = sal_True; break; } @@ -548,7 +542,7 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt, return bFound; } -// Parameter fuers Suchen und Ersetzen von Text +/// parameters for search and replace in text struct SwFindParaText : public SwFindParas { const SearchOptions& rSearchOpt; @@ -578,14 +572,13 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove, sal_Bool bFnd = (sal_Bool)pCrsr->Find( rSearchOpt, bSearchInNotes, aSTxt, fnMove, pRegion, bInReadOnly ); - if( bFnd && bReplace ) // String ersetzen ?? + if( bFnd && bReplace ) // replace string { - // Replace-Methode vom SwDoc benutzen + // use replace method in SwDoc const bool bRegExp(SearchAlgorithms_REGEXP == rSearchOpt.algorithmType); SwIndex& rSttCntIdx = pCrsr->Start()->nContent; xub_StrLen nSttCnt = rSttCntIdx.GetIndex(); - // damit die Region auch verschoben wird, in den Shell-Cursr-Ring - // mit aufnehmen !! + // add to shell-cursor-ring so that the regions will be moved enventually Ring *pPrev(0); if( bRegExp ) { @@ -602,7 +595,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove, if( bRegExp ) { - // und die Region wieder herausnehmen: + // and remove region again Ring *p, *pNext = (Ring*)pRegion; do { p = pNext; @@ -628,7 +621,7 @@ sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNot sal_Bool& bCancel, FindRanges eFndRngs, int bReplace ) { - // OLE-Benachrichtigung abschalten !! + // switch off OLE-notifications SwDoc* pDoc = GetDoc(); Link aLnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index ebbe3dea0cdc..1010cdd3a903 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -52,21 +52,12 @@ #include -// fuer den dummen ?MSC-? Compiler +// for the dump "MSC-" compiler inline xub_StrLen GetSttOrEnd( sal_Bool bCondition, const SwCntntNode& rNd ) { return bCondition ? 0 : rNd.Len(); } -/************************************************************************* -|* -|* SwPosition -|* -|* Beschreibung PAM.DOC -|* -*************************************************************************/ - - SwPosition::SwPosition( const SwNodeIndex & rNodeIndex, const SwIndex & rCntnt ) : nNode( rNodeIndex ), nContent( rCntnt ) { @@ -238,16 +229,16 @@ sal_Bool lcl_ChkOneRange( CHKSECTION eSec, sal_Bool bChkSections, if( !bChkSections ) return sal_True; - // suche die umspannende Section + // search the surrounding section const SwNodes& rNds = rBaseEnd.GetNodes(); const SwNode *pTmp, *pNd = rNds[ nStt ]; if( !pNd->IsStartNode() ) pNd = pNd->StartOfSectionNode(); if( pNd == rNds[ nEnd ]->StartOfSectionNode() ) - return sal_True; // der gleiche StartNode, die selbe Section + return sal_True; // same StartNode, same section - // steht schon auf einem GrundSection Node ? Fehler !!! + // already on a base node => error if( !pNd->StartOfSectionIndex() ) return sal_False; @@ -289,7 +280,7 @@ sal_Bool CheckNodesRange( const SwNodeIndex& rStt, return lcl_ChkOneRange( eSec, bChkSection, rNds.GetEndOfRedlines(), nStt, nEnd ); - return sal_False; // liegt irgendwo dazwischen, FEHLER + return sal_False; // somewhere in between => error } @@ -342,14 +333,6 @@ SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, sal_Bool bChk ) // ---------------------------------------------------------------------- -/************************************************************************* -|* -|* SwPointAndMark -|* -|* Beschreibung PAM.DOC -|* -*************************************************************************/ - SwPaM::SwPaM( const SwPosition& rPos, SwPaM* pRing ) : Ring( pRing ) , m_Bound1( rPos ) @@ -519,9 +502,7 @@ void SwPaM::Exchange() } #endif -// Bewegen des Cursors - - +/// movement of cursor sal_Bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo ) { sal_Bool bRet = (*fnGo)( *this, fnMove ); @@ -531,42 +512,34 @@ sal_Bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo ) return bRet; } +/** make a new region -/************************************************************************* -|* -|* void SwPaM::MakeRegion( SwMoveFn, SwPaM*, const SwPaM* ) -|* -|* Beschreibung Setzt den 1. SwPaM auf den uebergebenen SwPaM -|* oder setzt auf den Anfang oder Ende vom Document. -|* SPoint bleibt auf der Position stehen, GetMark aendert -|* sich entsprechend ! -|* -|* Parameter SwDirection gibt an, ob an Anfang / Ende -|* SwPaM * der zu setzende Bereich -|* const SwPaM& der enventuell vorgegeben Bereich -|* Return-Werte SwPaM* der entsprehend neu gesetzte Bereich -|* -*************************************************************************/ + Sets the first SwPaM onto the given SwPaM, or to the beginning or end of a + document. SPoint stays at its position, GetMark will be changed respectively. + @param fnMove Contains information if beginning or end of document. + @param pOrigRg The given region. + @return Newly created area. +*/ SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg ) { SwPaM* pPam; if( pOrigRg == 0 ) { pPam = new SwPaM( *m_pPoint ); - pPam->SetMark(); // setze Anfang fest - pPam->Move( fnMove, fnGoSection); // an Anfang / Ende vom Node + pPam->SetMark(); // set beginning + pPam->Move( fnMove, fnGoSection); // to beginning or end of a node - // stelle SPoint wieder auf alte Position, GetMark auf das "Ende" + // set SPoint onto its old position; set GetMark to the "end" pPam->Exchange(); } else { - pPam = new SwPaM( *(SwPaM*)pOrigRg ); // die Suchregion ist vorgegeben - // sorge dafuer, dass SPoint auf dem "echten" StartPunkt steht - // FORWARD --> SPoint immer kleiner als GetMark - // BACKWARD --> SPoint immer groesser als GetMark + pPam = new SwPaM( *(SwPaM*)pOrigRg ); // given search area + // make sure that SPoint is on the "real" start position + // FORWARD: SPoint always smaller than GetMark + // BACKWARD: SPoint always bigger than GetMark if( (pPam->GetMark()->*fnMove->fnCmpOp)( *pPam->GetPoint() ) ) pPam->Exchange(); } @@ -585,10 +558,9 @@ SwPaM & SwPaM::Normalize(sal_Bool bPointFirst) return *this; } +/// return page number at cursor (for reader and page bound frames) sal_uInt16 SwPaM::GetPageNum( sal_Bool bAtPoint, const Point* pLayPos ) { - // return die Seitennummer am Cursor - // (fuer Reader + Seitengebundene Rahmen) const SwCntntFrm* pCFrm; const SwPageFrm *pPg; const SwCntntNode *pNd ; @@ -626,8 +598,7 @@ const SwFrm* lcl_FindEditInReadonlyFrm( const SwFrm& rFrm ) return pRet; } -// steht in etwas geschuetztem oder in die Selektion umspannt -// etwas geschuetztes. +/// is in protected section or selection surrounds something protected sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const { sal_Bool bRet = sal_False; @@ -681,8 +652,7 @@ sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const bRet = sal_True; } - // oder sollte eine geschuetzte Section innerhalb der - // Selektion liegen? + // protected section in selection if( !bRet ) { sal_uLong nSttIdx = GetMark()->nNode.GetIndex(), @@ -694,8 +664,8 @@ sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const nEndIdx = nTmp; } - // wenn ein geschuetzter Bereich zwischen den Nodes stehen soll, - // muss die Selektion selbst schon x Nodes umfassen. + // If a protected section should be between nodes, then the + // selection needs to contain already x nodes. // (TxtNd, SectNd, TxtNd, EndNd, TxtNd ) if( nSttIdx + 3 < nEndIdx ) { @@ -759,15 +729,10 @@ sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const return bRet; } -//-------------------- Suche nach Formaten( FormatNamen ) ----------------- - -// die Funktion gibt in Suchrichtung den folgenden Node zurueck. -// Ist in der Richtung keiner mehr vorhanden oder ist dieser ausserhalb -// des Bereiches, wird ein 0 Pointer returnt. -// Das rbFirst gibt an, ob es man zu erstenmal einen Node holt. Ist das der -// Fall, darf die Position vom Pam nicht veraendert werden! - - +/// This function returns the next node in direction of search. If there is no +/// left or the next is out of the area, then a null-pointer is returned. +/// @param rbFirst If than first time request. If so than the position of +/// the PaM must not be changed! SwCntntNode* GetNode( SwPaM & rPam, sal_Bool& rbFirst, SwMoveFn fnMove, sal_Bool bInReadOnly ) { @@ -798,7 +763,7 @@ SwCntntNode* GetNode( SwPaM & rPam, sal_Bool& rbFirst, SwMoveFn fnMove, } } - if( !pNd ) // steht Cursor auf keinem ContentNode ? + if( !pNd ) // is the cursor not on a CntntNode? { SwPosition aPos( *rPam.GetPoint() ); sal_Bool bSrchForward = fnMove == fnMoveForward; @@ -813,23 +778,22 @@ SwCntntNode* GetNode( SwPaM & rPam, sal_Bool& rbFirst, SwMoveFn fnMove, if( pNd ) { aPos.nContent.Assign( pNd, ::GetSttOrEnd( bSrchForward,*pNd )); - // liegt Position immer noch im Bereich ? + // is the position still in the area if( (aPos.*fnMove->fnCmpOp)( *rPam.GetMark() ) ) { - // nur in der AutoTextSection koennen Node stehen, die - // nicht angezeigt werden !! + // only in AutoTextSection can be nodes that are hidden if( 0 == ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout() ) ) || ( !bInReadOnly && pFrm->IsProtected() ) || ( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow() ) ) { pNd = 0; - continue; // suche weiter + continue; } *(SwPosition*)rPam.GetPoint() = aPos; } else - pNd = 0; // kein gueltiger Node + pNd = 0; // no valid node break; } break; @@ -841,14 +805,11 @@ SwCntntNode* GetNode( SwPaM & rPam, sal_Bool& rbFirst, SwMoveFn fnMove, // ---------------------------------------------------------------------- -// hier folgen die Move-Methoden ( Foward, Backward; Content, Node, Doc ) - - void GoStartDoc( SwPosition * pPos ) { SwNodes& rNodes = pPos->nNode.GetNodes(); pPos->nNode = *rNodes.GetEndOfContent().StartOfSectionNode(); - // es muss immer ein ContentNode gefunden werden !! + // we always need to find a ContentNode! SwCntntNode* pCNd = rNodes.GoNext( &pPos->nNode ); if( pCNd ) pCNd->MakeStartIndex( &pPos->nContent ); @@ -867,30 +828,28 @@ void GoEndDoc( SwPosition * pPos ) void GoStartSection( SwPosition * pPos ) { - // springe zum Anfang der Section + // jump to section's beginning SwNodes& rNodes = pPos->nNode.GetNodes(); sal_uInt16 nLevel = rNodes.GetSectionLevel( pPos->nNode ); if( pPos->nNode < rNodes.GetEndOfContent().StartOfSectionIndex() ) nLevel--; do { rNodes.GoStartOfSection( &pPos->nNode ); } while( nLevel-- ); - // steht jetzt schon auf einem CntntNode + // already on a CntntNode pPos->nNode.GetNode().GetCntntNode()->MakeStartIndex( &pPos->nContent ); } -// gehe an das Ende der akt. Grund-Section - - +/// go to the end of the current base section void GoEndSection( SwPosition * pPos ) { - // springe zum Anfang/Ende der Section + // jump to section's beginning/end SwNodes& rNodes = pPos->nNode.GetNodes(); sal_uInt16 nLevel = rNodes.GetSectionLevel( pPos->nNode ); if( pPos->nNode < rNodes.GetEndOfContent().StartOfSectionIndex() ) nLevel--; do { rNodes.GoEndOfSection( &pPos->nNode ); } while( nLevel-- ); - // steht jetzt auf einem EndNode, also zum vorherigen CntntNode + // now on a EndNode, thus to the previous CntntNode if( GoPreviousNds( &pPos->nNode, sal_True ) ) pPos->nNode.GetNode().GetCntntNode()->MakeEndIndex( &pPos->nContent ); } @@ -955,14 +914,13 @@ sal_Bool GoInCntntCellsSkipHidden( SwPaM & rPam, SwMoveFn fnMove ) -// --------- Funktionsdefinitionen fuer die SwCrsrShell -------------- sal_Bool GoPrevPara( SwPaM & rPam, SwPosPara aPosPara ) { if( rPam.Move( fnMoveBackward, fnGoNode ) ) { - // steht immer auf einem ContentNode ! + // always on a CntntNode SwPosition& rPos = *rPam.GetPoint(); SwCntntNode * pNd = rPos.nNode.GetNode().GetCntntNode(); rPos.nContent.Assign( pNd, @@ -981,14 +939,14 @@ sal_Bool GoCurrPara( SwPaM & rPam, SwPosPara aPosPara ) { xub_StrLen nOld = rPos.nContent.GetIndex(), nNew = aPosPara == fnMoveForward ? 0 : pNd->Len(); - // stand er schon auf dem Anfang/Ende dann zum naechsten/vorherigen + // if already at beginning/end then to the next/previous if( nOld != nNew ) { rPos.nContent.Assign( pNd, nNew ); return sal_True; } } - // den Node noch etwas bewegen ( auf den naechsten/vorh. CntntNode) + // move node to next/previous CntntNode if( ( aPosPara==fnParaStart && 0 != ( pNd = GoPreviousNds( &rPos.nNode, sal_True ))) || ( aPosPara==fnParaEnd && 0 != ( pNd = @@ -1006,7 +964,7 @@ sal_Bool GoNextPara( SwPaM & rPam, SwPosPara aPosPara ) { if( rPam.Move( fnMoveForward, fnGoNode ) ) { - // steht immer auf einem ContentNode ! + // always on a CntntNode SwPosition& rPos = *rPam.GetPoint(); SwCntntNode * pNd = rPos.nNode.GetNode().GetCntntNode(); rPos.nContent.Assign( pNd, @@ -1021,14 +979,14 @@ sal_Bool GoNextPara( SwPaM & rPam, SwPosPara aPosPara ) sal_Bool GoCurrSection( SwPaM & rPam, SwMoveFn fnMove ) { SwPosition& rPos = *rPam.GetPoint(); - SwPosition aSavePos( rPos ); // eine Vergleichsposition + SwPosition aSavePos( rPos ); // position for comparison SwNodes& rNds = aSavePos.nNode.GetNodes(); (rNds.*fnMove->fnSection)( &rPos.nNode ); SwCntntNode *pNd; if( 0 == ( pNd = rPos.nNode.GetNode().GetCntntNode()) && 0 == ( pNd = (*fnMove->fnNds)( &rPos.nNode, sal_True )) ) { - rPos = aSavePos; // Cusror nicht veraendern + rPos = aSavePos; // do not change cursor return sal_False; } @@ -1041,14 +999,14 @@ sal_Bool GoCurrSection( SwPaM & rPam, SwMoveFn fnMove ) sal_Bool GoNextSection( SwPaM & rPam, SwMoveFn fnMove ) { SwPosition& rPos = *rPam.GetPoint(); - SwPosition aSavePos( rPos ); // eine Vergleichsposition + SwPosition aSavePos( rPos ); // position for comparison SwNodes& rNds = aSavePos.nNode.GetNodes(); rNds.GoEndOfSection( &rPos.nNode ); - // kein weiterer ContentNode vorhanden ? + // no other CntntNode existent? if( !GoInCntnt( rPam, fnMoveForward ) ) { - rPos = aSavePos; // Cusror nicht veraendern + rPos = aSavePos; // do not change cursor return sal_False; } (rNds.*fnMove->fnSection)( &rPos.nNode ); @@ -1062,14 +1020,14 @@ sal_Bool GoNextSection( SwPaM & rPam, SwMoveFn fnMove ) sal_Bool GoPrevSection( SwPaM & rPam, SwMoveFn fnMove ) { SwPosition& rPos = *rPam.GetPoint(); - SwPosition aSavePos( rPos ); // eine Vergleichsposition + SwPosition aSavePos( rPos ); // position for comparison SwNodes& rNds = aSavePos.nNode.GetNodes(); rNds.GoStartOfSection( &rPos.nNode ); - // kein weiterer ContentNode vorhanden ? + // no further CntntNode existent? if( !GoInCntnt( rPam, fnMoveBackward )) { - rPos = aSavePos; // Cusror nicht veraendern + rPos = aSavePos; // do not change cursor return sal_False; } (rNds.*fnMove->fnSection)( &rPos.nNode ); diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx index 43af4977ec35..2093c3e9420a 100644 --- a/sw/source/core/crsr/paminit.cxx +++ b/sw/source/core/crsr/paminit.cxx @@ -62,7 +62,7 @@ SwWhichSection fnSectionNext = &GoNextSection; SwPosSection fnSectionStart = &aFwrd; SwPosSection fnSectionEnd = &aBwrd; -// Travelling in Tabellen +// Travelling in tables sal_Bool GotoPrevTable( SwPaM&, SwPosTable, sal_Bool bInReadOnly ); sal_Bool GotoCurrTable( SwPaM&, SwPosTable, sal_Bool bInReadOnly ); sal_Bool GotoNextTable( SwPaM&, SwPosTable, sal_Bool bInReadOnly ); @@ -73,7 +73,7 @@ SwWhichTable fnTableNext = &GotoNextTable; SwPosTable fnTableStart = &aFwrd; SwPosTable fnTableEnd = &aBwrd; -// Travelling in Bereichen +// Travelling in regions sal_Bool GotoPrevRegion( SwPaM&, SwPosRegion, sal_Bool bInReadOnly ); sal_Bool GotoCurrRegion( SwPaM&, SwPosRegion, sal_Bool bInReadOnly ); sal_Bool GotoCurrRegionAndSkip( SwPaM&, SwPosRegion, sal_Bool bInReadOnly ); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 3be9d91205fd..a3e98d3db1ac 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -164,10 +164,8 @@ sal_Bool SwCursor::IsSkipOverProtectSections() const return !IsReadOnlyAvailable(); } - -// Das CreateNewSavePos ist virtual, damit abgeleitete Klassen vom Cursor -// gegebenenfalls eigene SaveObjecte anlegen und in den virtuellen -// Check-Routinen verwenden koennen. +// CreateNewSavePos is virtual so that derived classes of cursor can implement +// own SaveObjects if needed and validate them in the virtual check routines. void SwCursor::SaveState() { _SwCursor_SavePos* pNew = CreateNewSavePos(); @@ -190,8 +188,7 @@ _SwCursor_SavePos* SwCursor::CreateNewSavePos() const return new _SwCursor_SavePos( *this ); } -// stelle fest, ob sich der Point ausserhalb des Content-Bereichs -// vom Nodes-Array befindet +/// determine if point is outside of the node-array's content area sal_Bool SwCursor::IsNoCntnt() const { return GetPoint()->nNode.GetIndex() < @@ -235,13 +232,11 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) return sal_True; } -// neu: Bereiche ueberpruefen -// Anfang if( pSavePos->nNode != GetPoint()->nNode.GetIndex() && - //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt + // (1997) in UI-ReadOnly everything is allowed ( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() )) { - // teste doch mal die neuen Sections: + // check new sections SwNodeIndex& rPtIdx = GetPoint()->nNode; const SwSectionNode* pSectNd = rPtIdx.GetNode().FindSectionNode(); if( pSectNd && @@ -250,12 +245,12 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) { if( 0 == ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) ) { - // dann wars das schon + // then we're already done RestoreSavePos(); return sal_True; } - // dann setze den Cursor auf die neue Position: + // set cursor to new position: SwNodeIndex aIdx( rPtIdx ); xub_StrLen nCntntPos = pSavePos->nCntnt; int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex(); @@ -282,23 +277,22 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) rPtIdx = aIdx; if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) ) { - // dann auf den Anfang vom Doc + // then to the beginning of the document rPtIdx = rNds.GetEndOfExtras(); pCNd = rNds.GoNext( &rPtIdx ); } } } - // ContentIndex noch anmelden: + // register ContentIndex: xub_StrLen nTmpPos = bIsValidPos ? (bGoNxt ? 0 : pCNd->Len()) : nCntntPos; GetPoint()->nContent.Assign( pCNd, nTmpPos ); if( !bIsValidPos || !bValidNodesRange || - // sollten wir in einer Tabelle gelandet sein? IsInProtectTable( sal_True ) ) return sal_True; } - // oder sollte eine geschuetzte Section innerhalb der Selektion liegen? + // is there a protected section in the section? if( HasMark() && bSkipOverProtectSections) { sal_uLong nSttIdx = GetMark()->nNode.GetIndex(), @@ -318,12 +312,11 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) if( rProtect.IsCntntProtected() ) { const SwFmtCntnt& rCntnt = pFmt->GetCntnt(sal_False); - OSL_ENSURE( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" ); + OSL_ENSURE( rCntnt.GetCntntIdx(), "No SectionNode?" ); sal_uLong nIdx = rCntnt.GetCntntIdx()->GetIndex(); if( nSttIdx <= nIdx && nEndIdx >= nIdx ) { - // ist es keine gelinkte Section, dann kann sie auch - // nicht mitselektiert werden + // if it is no linked section then we cannot select it const SwSection& rSect = *pFmt->GetSection(); if( CONTENT_SECTION == rSect.GetType() ) { @@ -336,8 +329,6 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) } } -// Ende -// neu: Bereiche ueberpruefen const SwNode* pNd = &GetPoint()->nNode.GetNode(); if( pNd->IsCntntNode() && !dynamic_cast(this) ) @@ -374,11 +365,10 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) rPtIdx = *pCNd; pNd = pCNd; - // ContentIndex noch anmelden: + // register ContentIndex: xub_StrLen nTmpPos = bGoNxt ? 0 : pCNd->Len(); GetPoint()->nContent.Assign( pCNd, nTmpPos ); - // sollten wir in einer Tabelle gelandet sein? if( IsInProtectTable( sal_True ) ) pFrm = 0; } @@ -388,11 +378,11 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) { DeleteMark(); RestoreSavePos(); - return sal_True; // ohne Frames geht gar nichts! + return sal_True; // we need a frame } } - // darf der Cursor in geschuetzen "Nodes" stehen? + // is the cursor allowed to be in a protected node? if( 0 == ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) && !IsAtValidPos() ) { DeleteMark(); @@ -403,13 +393,12 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) if( !HasMark() ) return sal_False; - //JP 19.08.98: teste mal auf ungueltige Selektion - sprich ueber - // GrundSections: + // check for invalid sections if( !::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, sal_True )) { DeleteMark(); RestoreSavePos(); - return sal_True; // ohne Frames geht gar nichts! + return sal_True; // we need a frame } const SwTableNode* pPtNd = pNd->FindTableNode(); @@ -419,25 +408,26 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) { DeleteMark(); RestoreSavePos(); - return sal_True; // ohne Frames geht gar nichts! + return sal_True; // we need a frame } const SwTableNode* pMrkNd = pNd->FindTableNode(); - // beide in keinem oder beide im gleichen TableNode + // both in no or in same table node if( ( !pMrkNd && !pPtNd ) || pPtNd == pMrkNd ) return sal_False; - // in unterschiedlichen Tabellen oder nur Mark in der Tabelle + // in different tables or only mark in table if( ( pPtNd && pMrkNd ) || pMrkNd ) - { // dann lasse das nicht zu, alte Pos zurueck + { + // not allowed, so go back to old position RestoreSavePos(); - // Crsr bleibt an der alten Position + // Crsr stays at old position return sal_True; } - // ACHTUNG: dieses kann nicht im TableMode geschehen !! - if( pPtNd ) // nur Point in Tabelle, dann gehe hinter/vor diese + // Note: this cannot happen in TableMode + if( pPtNd ) // if only Point in Table then go behind/in front of table { if( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) { @@ -445,12 +435,11 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) (( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) ? pSavePos->nNode : GetMark()->nNode.GetIndex()); - do { - // in Schleife fuer Tabelle hinter Tabelle + do { // loop for table after table sal_uLong nSEIdx = pPtNd->EndOfSectionIndex(); - sal_uLong nSttEndTbl = nSEIdx + 1; // dflt. Sel. nach unten + sal_uLong nSttEndTbl = nSEIdx + 1; - if( bSelTop ) // Sel. nach oben + if( bSelTop ) nSttEndTbl = rNds[ nSEIdx ]->StartOfSectionIndex() - 1; GetPoint()->nNode = nSttEndTbl; @@ -459,7 +448,6 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) if( pMyNd->IsSectionNode() || ( pMyNd->IsEndNode() && pMyNd->StartOfSectionNode()->IsSectionNode() ) ) { - // die lassen wir zu: pMyNd = bSelTop ? rNds.GoPrevSection( &GetPoint()->nNode,sal_True,sal_False ) : rNds.GoNextSection( &GetPoint()->nNode,sal_True,sal_False ); @@ -472,7 +460,8 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) continue; } - if( pMyNd->IsCntntNode() && // ist es ein ContentNode ?? + // we permit these + if( pMyNd->IsCntntNode() && ::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, sal_True )) { @@ -495,11 +484,11 @@ sal_Bool SwCursor::IsSelOvr( int eFlags ) } while( sal_True ); } - // dann verbleibe auf der alten Position + // stay on old position RestoreSavePos(); - return sal_True; // Crsr bleibt an der alten Position + return sal_True; } - return sal_False; // was bleibt noch ?? + return sal_False; } #if defined( UNX ) @@ -551,17 +540,15 @@ sal_Bool SwCursor::IsInProtectTable( sal_Bool bMove, sal_Bool bChgCrsr ) if( bChgCrsr ) // restore the last save position RestoreSavePos(); - return sal_True; // Crsr bleibt an der alten Position + return sal_True; // Crsr stays at old position } - // wir stehen in einer geschuetzten TabellenZelle - // von Oben nach Unten Traveln ? + // We are in a protected table cell. Traverse top to bottom? if( pSavePos->nNode < GetPoint()->nNode.GetIndex() ) { - // suche die naechste "gueltige" Box - - // folgt nach dem EndNode der Zelle ein weiterer StartNode, dann - // gibt es auch eine naechste Zelle + // search next valid box + // if there is another StartNode after the EndNode of a cell then + // there is another cell #if defined( UNX ) SwNodeIndex* pCellStt = new SwNodeIndex( *GetNode()-> FindTableBoxStartNode()->EndOfSectionNode(), 1 ); @@ -582,7 +569,7 @@ GoNextCell: } while( bProt ); SetNextCrsr: - if( !bProt ) // eine freie Zelle gefunden + if( !bProt ) // found free cell { GetPoint()->nNode = IDX; #if defined( UNX ) @@ -597,31 +584,30 @@ SetNextCrsr: return IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ); } - // am Ende der Tabelle, also setze hinter diese - IDX++; // auf den naechsten Node + // end of table, so go to next node + IDX++; SwNode* pNd; if( ( pNd = &IDX.GetNode())->IsEndNode() || HasMark()) { - // Tabelle allein in einem FlyFrame oder SSelection, - // dann verbleibe auf der alten Position + // if only table in FlyFrame or SSelection then stay on old position if( bChgCrsr ) RestoreSavePos(); #if defined( UNX ) delete pCellStt; #endif - return sal_True; // Crsr bleibt an der alten Position + return sal_True; } else if( pNd->IsTableNode() && IDX++ ) goto GoNextCell; - bProt = sal_False; // Index steht jetzt auf einem ContentNode + bProt = sal_False; // index is now on a content node goto SetNextCrsr; } - // suche die vorherige "gueltige" Box + // search for the previous valid box { - // liegt vor dem StartNode der Zelle ein weiterer EndNode, dann - // gibt es auch eine vorherige Zelle + // if there is another EndNode in front of the StartNode than there + // exists a previous cell #if defined( UNX ) SwNodeIndex* pCellStt = new SwNodeIndex( *GetNode()->FindTableBoxStartNode(), -1 ); @@ -643,7 +629,7 @@ GoPrevCell: } while( bProt ); SetPrevCrsr: - if( !bProt ) // eine freie Zelle gefunden + if( !bProt ) // found free cell { GetPoint()->nNode = IDX; #if defined( UNX ) @@ -658,28 +644,27 @@ SetPrevCrsr: return IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ); } - // am Start der Tabelle, also setze vor diese - IDX--; // auf den naechsten Node + // at the beginning of a table, so go to next node + IDX--; if( ( pNd = &IDX.GetNode())->IsStartNode() || HasMark() ) { - // Tabelle allein in einem FlyFrame oder Selektion, - // dann verbleibe auf der alten Position + // if only table in FlyFrame or SSelection then stay on old position if( bChgCrsr ) RestoreSavePos(); #if defined( UNX ) delete pCellStt; #endif - return sal_True; // Crsr bleibt an der alten Position + return sal_True; } else if( pNd->StartOfSectionNode()->IsTableNode() && IDX-- ) goto GoPrevCell; - bProt = sal_False; // Index steht jetzt auf einem ContentNode + bProt = sal_False; // index is now on a content node goto SetPrevCrsr; } } -// sal_True: an die Position kann der Cursor gesetzt werden +/// Return if cursor can be set to this position sal_Bool SwCursor::IsAtValidPos( sal_Bool bPoint ) const { const SwDoc* pDoc = GetDoc(); @@ -692,7 +677,7 @@ sal_Bool SwCursor::IsAtValidPos( sal_Bool bPoint ) const return sal_False; } - //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt + // #i45129# - in UI-ReadOnly everything is allowed if( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() ) return sal_True; @@ -710,7 +695,7 @@ sal_Bool SwCursor::IsAtValidPos( sal_Bool bPoint ) const void SwCursor::SaveTblBoxCntnt( const SwPosition* ) {} -// setze den SRange fuer das Suchen im Dokument +/// set range for search in document SwMoveFnCollection* SwCursor::MakeFindRange( SwDocPositions nStart, SwDocPositions nEnd, SwPaM* pRange ) const { @@ -718,8 +703,7 @@ SwMoveFnCollection* SwCursor::MakeFindRange( SwDocPositions nStart, FillFindPos( nStart, *pRange->GetMark() ); FillFindPos( nEnd, *pRange->GetPoint() ); - // bestimme die Richtung, in der zu suchen ist - // ( GetPoint > GetMark -> vorwaerts, sonst rueckwaerts ) + // determine direction of search return ( DOCPOS_START == nStart || DOCPOS_OTHERSTART == nStart || (DOCPOS_CURR == nStart && (DOCPOS_END == nEnd || DOCPOS_OTHEREND == nEnd ) )) @@ -755,8 +739,8 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, do { aRegion.SetMark(); - // egal in welche Richtung, SPoint ist immer groesser als Mark, - // wenn der Suchbereich gueltig ist !! + // independent from search direction: SPoint is always bigger than mark + // if the search area is valid SwPosition *pSttPos = aRegion.GetMark(), *pEndPos = aRegion.GetPoint(); *pSttPos = *pTmpCrsr->Start(); @@ -767,7 +751,7 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, if( !nCrsrCnt && !pPHdl && !bIsUnoCrsr ) pPHdl = new _PercentHdl( aRegion ); - // solange gefunden und nicht auf gleicher Position haengen bleibt + // as long as found and not at same position while( *pSttPos <= *pEndPos && 0 != ( nFndRet = rParas.Find( pCurCrsr, fnMove, &aRegion, bInReadOnly )) && @@ -777,9 +761,7 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, { if( !( FIND_NO_RING & nFndRet )) { - // Bug 24084: Ring richtig herum aufbauen -> gleiche Mimik - // wie beim CreateCrsr !!!! - + // #i24084# - create ring similar to the one in CreateCrsr SwCursor* pNew = pCurCrsr->Create( pFndRing ); if( !pFndRing ) pFndRing = pNew; @@ -818,14 +800,15 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, } if( bSrchBkwrd ) - // bewege pEndPos vor den gefundenen Bereich + // move pEndPos in front of the found area *pEndPos = *pCurCrsr->Start(); else - // bewege pSttPos hinter den gefundenen Bereich + // move pSttPos behind the found area *pSttPos = *pCurCrsr->End(); - if( *pSttPos == *pEndPos ) // im Bereich, aber am Ende - break; // fertig + if( *pSttPos == *pEndPos ) + // in area but at the end => done + break; if( !nCrsrCnt && pPHdl ) { @@ -844,7 +827,7 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, } while( pTmpCrsr != pSaveCrsr ); - if( nFound && !pFndRing ) // falls kein Ring aufgebaut werden soll + if( nFound && !pFndRing ) // if no ring should be created pFndRing = pCurCrsr->Create(); delete pPHdl; @@ -872,7 +855,8 @@ int lcl_MakeSelFwrd( const SwNode& rSttNd, const SwNode& rEndNd, } else if( rSttNd.GetIndex() > rPam.GetPoint()->nNode.GetIndex() || rPam.GetPoint()->nNode.GetIndex() >= rEndNd.GetIndex() ) - return sal_False; // steht nicht in dieser Section + // not in this section + return sal_False; rPam.SetMark(); rPam.GetPoint()->nNode = rEndNd; @@ -904,7 +888,7 @@ int lcl_MakeSelBkwrd( const SwNode& rSttNd, const SwNode& rEndNd, } else if( rEndNd.GetIndex() > rPam.GetPoint()->nNode.GetIndex() || rPam.GetPoint()->nNode.GetIndex() >= rSttNd.GetIndex() ) - return sal_False; // steht nicht in dieser Section + return sal_False; // not in this section rPam.SetMark(); rPam.GetPoint()->nNode = rEndNd; @@ -916,10 +900,8 @@ int lcl_MakeSelBkwrd( const SwNode& rSttNd, const SwNode& rEndNd, return *rPam.GetPoint() < *rPam.GetMark(); } - -// diese Methode "sucht" fuer alle Anwendungsfaelle, denn in SwFindParas -// steht immer die richtigen Parameter und die entsprechende Find-Methode - +// this method "searches" for all use cases because in SwFindParas is always the +// correct parameters and respective search method sal_uLong SwCursor::FindAll( SwFindParas& rParas, SwDocPositions nStart, SwDocPositions nEnde, FindRanges eFndRngs, sal_Bool& bCancel ) @@ -927,7 +909,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, bCancel = sal_False; SwCrsrSaveState aSaveState( *this ); - // Region erzeugen, ohne das diese in den Ring aufgenommen wird ! + // create region without adding it to the ring SwPaM aRegion( *GetPoint() ); SwMoveFn fnMove = MakeFindRange( nStart, nEnde, &aRegion ); @@ -938,18 +920,17 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, SwCursor* pFndRing = 0; SwNodes& rNds = GetDoc()->GetNodes(); - // suche in Bereichen ? + // search in sections? if( FND_IN_SEL & eFndRngs ) { - // String nicht im Bereich gefunden, dann erhalte alle Bereiche, - // der Cursor beleibt unveraendert + // if string was not found in region then get all sections (cursors + // stays unchanged) if( 0 == ( nFound = lcl_FindSelection( rParas, this, fnMove, pFndRing, aRegion, eFndRngs, bInReadOnly, bCancel ) )) return nFound; - // der String wurde ein- bis mehrmals gefunden. Das steht alles - // im neuen Crsr-Ring. Darum hebe erstmal den alten Ring auf + // found string at least once; it's all in new Crsr ring thus delete old one while( GetNext() != this ) delete GetNext(); @@ -961,14 +942,14 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, } else if( FND_IN_OTHER & eFndRngs ) { - // Cursor als Kopie vom akt. und in den Ring aufnehmen - // Verkettung zeigt immer auf den zuerst erzeugten, also vorwaerts + // put cursor as copy of current into ring + // chaining points always to first created, so forward SAL_WNODEPRECATED_DECLARATIONS_PUSH std::auto_ptr< SwCursor > pSav( Create( this ) ); // save the current cursor SAL_WNODEPRECATED_DECLARATIONS_POP - // wenn schon ausserhalb vom Bodytext, suche von der Position, - // ansonsten beginne mit der 1. GrundSection + // if already outside of body text search from this position or start at + // 1. base section if( bMvBkwrd ? lcl_MakeSelBkwrd( rNds.GetEndOfExtras(), *rNds.GetEndOfPostIts().StartOfSectionNode(), @@ -985,7 +966,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, if( !nFound ) { - // den alten wieder zurueck + // put back the old one *GetPoint() = *pSav->GetPoint(); if( pSav->HasMark() ) { @@ -1000,17 +981,16 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, if( !( FND_IN_SELALL & eFndRngs )) { - // es sollte nur einer gesucht werden, also fuege in dazu - // egal in welche Richtung, SPoint ist immer groesser als Mark, - // wenn der Suchbereich gueltig ist !! + // there should only be a single one, thus add it + // independent from search direction: SPoint is always bigger than + // mark if the search area is valid *GetPoint() = *pFndRing->GetPoint(); SetMark(); *GetMark() = *pFndRing->GetMark(); } else { - // es wurde ein- bis mehrmals gefunden. Das steht alles - // im neuen Crsr-Ring. Darum hebe erstmal den alten Ring auf + // found string at least once; it's all in new Crsr ring thus delete old one while( GetNext() != this ) delete GetNext(); @@ -1041,7 +1021,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, if( !nFound ) { - // den alten wieder zurueck + // put back the old one *GetPoint() = *pSav->GetPoint(); if( pSav->HasMark() ) { @@ -1064,9 +1044,8 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, } else { - // ist ein GetMark gesetzt, dann wird bei gefundenem Object - // der GetMark beibehalten !! Dadurch kann ein Bereich mit der Suche - // aufgespannt werden. + // if a GetMark is set then keep the GetMark of the found object + // This allows spanning an area with this search. SwPosition aMarkPos( *GetMark() ); int bMarkPos = HasMark() && !eFndRngs; @@ -1621,7 +1600,7 @@ sal_Bool SwCursor::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, const SwCntntFrm* pSttFrm = // may side-effect bLeft! DoSetBidiLevelLeftRight(bLeft, bVisualAllowed, bInsertCrsr); - // kann der Cursor n-mal weiterverschoben werden ? + // can the cursor be moved n times? SwCrsrSaveState aSave( *this ); SwMoveFn fnMove = bLeft ? fnMoveBackward : fnMoveForward; @@ -1777,8 +1756,8 @@ sal_Bool SwCursor::UpDown( sal_Bool bUp, sal_uInt16 nCnt, SwTableCursor* pTblCrsr = dynamic_cast(this); sal_Bool bAdjustTableCrsr = sal_False; - // vom Tabellen Crsr Point/Mark in der gleichen Box ?? - // dann stelle den Point an den Anfang der Box + // If the point/mark of the table cursor in the same box then set cursor to + // beginning of the box if( pTblCrsr && GetNode( sal_True )->StartOfSectionNode() == GetNode( sal_False )->StartOfSectionNode() ) { @@ -1808,8 +1787,7 @@ sal_Bool SwCursor::UpDown( sal_Bool bUp, sal_uInt16 nCnt, aPt.X() - pFrm->Frm().Left(); } - // Bei Fussnoten ist auch die Bewegung in eine andere Fussnote erlaubt. - // aber keine Selection!! + // It is allowed to move footnotes in other footnotes but not sections const sal_Bool bChkRange = pFrm->IsInFtn() && !HasMark() ? sal_False : sal_True; const SwPosition aOldPos( *GetPoint() ); @@ -1842,13 +1820,13 @@ sal_Bool SwCursor::UpDown( sal_Bool bUp, sal_uInt16 nCnt, --nCnt; } + // iterate over whole number of items? if( !nCnt && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | - nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) // die gesamte Anzahl durchlaufen ? + nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) { if( !pTblCrsr ) { - // dann versuche den Cursor auf die Position zu setzen, - // auf halber Heohe vom Char-Rectangle + // try to position the cursor at half of the char-rect's height pFrm = GetCntntNode()->getLayoutFrm( GetDoc()->GetCurrentLayout(), &aPt, GetPoint() ); SwCrsrMoveState eTmpState( MV_UPDOWN ); eTmpState.bSetInReadOnly = bInReadOnly; @@ -1912,9 +1890,8 @@ sal_Bool SwCursor::IsAtLeftRightMargin( sal_Bool bLeft, sal_Bool bAPI ) const sal_Bool SwCursor::SttEndDoc( sal_Bool bStt ) { SwCrsrSaveState aSave( *this ); - - // Springe beim Selektieren nie ueber Section-Grenzen !! - // kann der Cursor weiterverschoben werden ? + // Never jump over section boundaries during selection! + // Can the cursor still moved on? SwMoveFn fnMove = bStt ? fnMoveBackward : fnMoveForward; sal_Bool bRet = (!HasMark() || !IsNoCntnt() ) && Move( fnMove, fnGoDoc ) && @@ -1932,8 +1909,8 @@ sal_Bool SwCursor::GoPrevNextCell( sal_Bool bNext, sal_uInt16 nCnt ) if( !pTblNd ) return sal_False; - // liegt vor dem StartNode der Cell ein weiterer EndNode, dann - // gibt es auch eine vorherige Celle + // If there is another EndNode in front of the cell's StartNode then there + // exists a previous cell SwCrsrSaveState aSave( *this ); SwNodeIndex& rPtIdx = GetPoint()->nNode; @@ -2000,7 +1977,7 @@ sal_Bool SwCursor::GotoTable( const String& rName ) SwTable* pTmpTbl = SwTable::FindTable( GetDoc()->FindTblFmtByName( rName ) ); if( pTmpTbl ) { - // eine Tabelle im normalen NodesArr + // a table in a normal nodes array SwCrsrSaveState aSave( *this ); GetPoint()->nNode = *pTmpTbl->GetTabSortBoxes()[ 0 ]-> GetSttNd()->FindTableNode(); @@ -2017,7 +1994,7 @@ sal_Bool SwCursor::GotoTblBox( const String& rName ) const SwTableNode* pTblNd = GetPoint()->nNode.GetNode().FindTableNode(); if( pTblNd ) { - // erfrage die Box, mit dem Nanen + // retrieve box by name const SwTableBox* pTblBox = pTblNd->GetTable().GetTblBox( rName ); if( pTblBox && pTblBox->GetSttNd() && ( !pTblBox->GetFrmFmt()->GetProtect().IsCntntProtected() || @@ -2158,7 +2135,7 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) { if( bParked ) { - // wieder in den Inhalt schieben + // move back into content Exchange(); Move( fnMoveForward ); Exchange(); @@ -2168,12 +2145,12 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr ) bChg = sal_False; - // temp Kopie anlegen, damit alle Boxen, fuer die schon Cursor - // existieren, entfernt werden koennen. + // create temporary copies so that all boxes that + // have already cursors can be removed SwSelBoxes aTmp; aTmp.Insert( &aSelBoxes ); - //Jetzt die Alten und die neuen abgleichen. + // compare old and new ones SwNodes& rNds = pAktCrsr->GetDoc()->GetNodes(); sal_uInt16 nPos; const SwStartNode* pSttNd; @@ -2331,11 +2308,10 @@ sal_Bool SwTableCursor::IsCrsrMovedUpdt() return sal_True; } - -// Parke den Tabellen-Cursor auf dem StartNode der Boxen. +/// park table cursor on the boxes' start node void SwTableCursor::ParkCrsr() { - // Index aus dem TextNode abmelden + // de-register index from text node SwNode* pNd = &GetPoint()->nNode.GetNode(); if( !pNd->IsStartNode() ) pNd = pNd->StartOfSectionNode(); diff --git a/sw/source/core/crsr/trvlcol.cxx b/sw/source/core/crsr/trvlcol.cxx index bd65ad13b974..c2e6133aa53f 100644 --- a/sw/source/core/crsr/trvlcol.cxx +++ b/sw/source/core/crsr/trvlcol.cxx @@ -90,7 +90,7 @@ sal_Bool SwCrsrShell::MoveColumn( SwWhichColumn fnWhichCol, SwPosColumn fnPosCol if( pCnt ) { SET_CURR_SHELL( this ); - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwCrsrSaveState aSaveState( *pCurCrsr ); pCnt->Calc(); // ??? diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index b1d9d1eb5011..0baf7f24c8ed 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -37,7 +37,7 @@ sal_Bool SwCrsrShell::CallCrsrFN( FNCrsr fnCrsr ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCursor* pCrsr = getShellCrsr( true ); sal_Bool bRet = (pCrsr->*fnCrsr)(); if( bRet ) @@ -48,7 +48,7 @@ sal_Bool SwCrsrShell::CallCrsrFN( FNCrsr fnCrsr ) sal_Bool SwCursor::GotoFtnTxt() { - // springe aus dem Content zur Fussnote + // jump from content to footnote sal_Bool bRet = sal_False; SwTxtNode* pTxtNd = GetPoint()->nNode.GetNode().GetTxtNode(); @@ -124,11 +124,11 @@ sal_Bool SwCrsrShell::GotoFtnTxt() sal_Bool SwCursor::GotoFtnAnchor() { - // springe aus der Fussnote zum Anker + // jump from footnote to anchor const SwNode* pSttNd = GetNode()->FindFootnoteStartNode(); if( pSttNd ) { - // durchsuche alle Fussnoten im Dokument nach diesem StartIndex + // search in all footnotes in document for this StartIndex const SwTxtFtn* pTxtFtn; const SwFtnIdxs& rFtnArr = pSttNd->GetDoc()->GetFtnIdxs(); for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n ) @@ -151,12 +151,12 @@ sal_Bool SwCursor::GotoFtnAnchor() sal_Bool SwCrsrShell::GotoFtnAnchor() { - // springe aus der Fussnote zum Anker - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + // jump from footnote to anchor + SwCallLink aLk( *this ); // watch Crsr-Moves sal_Bool bRet = pCurCrsr->GotoFtnAnchor(); if( bRet ) { - // BUG 5996: Tabellen-Kopfzeile sonderbehandeln + // special treatment for table header row pCurCrsr->GetPtPos() = Point(); UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | SwCrsrShell::READONLY ); @@ -183,15 +183,14 @@ sal_Bool SwCursor::GotoNextFtnAnchor() if( rFtnArr.SeekEntry( GetPoint()->nNode, &nPos )) { - // es gibt eine Fussnote mit dem Index, suche also die - // naechstgelegene + // there is a footnote with this index, so search also for the next one if( nPos < rFtnArr.Count() ) { sal_uLong nNdPos = GetPoint()->nNode.GetIndex(); xub_StrLen nCntPos = GetPoint()->nContent.GetIndex(); pTxtFtn = rFtnArr[ nPos ]; - // suche vorewaerts zur naechsten + // search forwards if( CmpLE( *pTxtFtn, nNdPos, nCntPos ) ) { pTxtFtn = 0; @@ -199,13 +198,13 @@ sal_Bool SwCursor::GotoNextFtnAnchor() { pTxtFtn = rFtnArr[ nPos ]; if( !CmpLE( *pTxtFtn, nNdPos, nCntPos ) ) - break; // gefunden + break; // found pTxtFtn = 0; } } else if( nPos ) { - // suche rueckwaerts zur vorherigen + // search backwards pTxtFtn = 0; while( nPos ) { @@ -213,7 +212,7 @@ sal_Bool SwCursor::GotoNextFtnAnchor() if( CmpLE( *pTxtFtn, nNdPos, nCntPos ) ) { pTxtFtn = rFtnArr[ ++nPos ]; - break; // gefunden + break; // found } } } @@ -243,13 +242,12 @@ sal_Bool SwCursor::GotoPrevFtnAnchor() if( rFtnArr.SeekEntry( GetPoint()->nNode, &nPos ) ) { - // es gibt eine Fussnote mit dem Index, suche also die - // naechstgelegene + // there is a footnote with this index, so search also for the next one sal_uLong nNdPos = GetPoint()->nNode.GetIndex(); xub_StrLen nCntPos = GetPoint()->nContent.GetIndex(); pTxtFtn = rFtnArr[ nPos ]; - // suche vorwaerts zur naechsten + // search forwards if( CmpL( *pTxtFtn, nNdPos, nCntPos )) { for( ++nPos; nPos < rFtnArr.Count(); ++nPos ) @@ -264,13 +262,13 @@ sal_Bool SwCursor::GotoPrevFtnAnchor() } else if( nPos ) { - // suche rueckwaerts zur vorherigen + // search backwards pTxtFtn = 0; while( nPos ) { pTxtFtn = rFtnArr[ --nPos ]; if( CmpL( *pTxtFtn, nNdPos, nCntPos )) - break; // gefunden + break; // found pTxtFtn = 0; } } @@ -303,9 +301,7 @@ sal_Bool SwCrsrShell::GotoPrevFtnAnchor() return CallCrsrFN( &SwCursor::GotoPrevFtnAnchor ); } -// springe aus dem Rahmen zum Anker - - +/// jump from border to anchor sal_Bool SwCrsrShell::GotoFlyAnchor() { SET_CURR_SHELL( this ); @@ -314,13 +310,13 @@ sal_Bool SwCrsrShell::GotoFlyAnchor() pFrm = pFrm->GetUpper(); } while( pFrm && !pFrm->IsFlyFrm() ); - if( !pFrm ) // ist kein FlyFrame + if( !pFrm ) // no FlyFrame return sal_False; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves SwCrsrSaveState aSaveState( *pCurCrsr ); - // springe in den BodyFrame, der am naechsten vom Fly liegt + // jump in BodyFrame closest to FlyFrame SwRect aTmpRect( aCharRect ); if( !pFrm->Frm().IsInside( aTmpRect )) aTmpRect = pFrm->Frm(); diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index 4bde9d58babd..84ab0f0d675e 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -42,13 +42,13 @@ sal_Bool GotoPrevRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, 0 == ( pNd = aIdx.GetNode().StartOfSectionNode()->GetSectionNode()) ) aIdx--; - if( pNd ) // gibt einen weiteren SectionNode ? + if( pNd ) // is there another section node? { if( pNd->GetSection().IsHiddenFlag() || ( !bInReadOnly && pNd->GetSection().IsProtectFlag() )) { - // geschuetzte/versteckte ueberspringen wir + // skip protected or hidden ones aIdx.Assign( *pNd, - 1 ); } else if( fnPosRegion == fnMoveForward ) @@ -98,13 +98,13 @@ sal_Bool GotoNextRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, 0 == ( pNd = aIdx.GetNode().GetSectionNode()) ) aIdx++; - if( pNd ) // gibt einen weiteren SectionNode ? + if( pNd ) // is there another section node? { if( pNd->GetSection().IsHiddenFlag() || ( !bInReadOnly && pNd->GetSection().IsProtectFlag() )) { - // geschuetzte/versteckte ueberspringen wir + // skip protected or hidden ones aIdx.Assign( *pNd->EndOfSectionNode(), +1 ); } else if( fnPosRegion == fnMoveForward ) @@ -186,7 +186,7 @@ sal_Bool GotoCurrRegionAndSkip( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, do { SwCntntNode* pCNd; - if( bMoveBackward ) // ans Ende vom Bereich + if( bMoveBackward ) // to the end of the section { SwNodeIndex aIdx( *pNd->EndOfSectionNode() ); pCNd = pNd->GetNodes().GoPrevSection( &aIdx, sal_True, !bInReadOnly ); @@ -208,10 +208,10 @@ sal_Bool GotoCurrRegionAndSkip( SwPaM& rCurCrsr, SwPosRegion fnPosRegion, if( &pPos->nNode.GetNode() != pCurrNd || pPos->nContent.GetIndex() != nCurrCnt ) - // es gab eine Veraenderung + // there was a change return sal_True; - // dann versuche mal den "Parent" dieser Section + // try also the parent of this section SwSection* pParent = pNd->GetSection().GetParent(); pNd = pParent ? pParent->GetFmt()->GetSectionNode() : 0; } while( pNd ); @@ -232,7 +232,7 @@ sal_Bool SwCursor::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosReg sal_Bool SwCrsrShell::MoveRegion( SwWhichRegion fnWhichRegion, SwPosRegion fnPosRegion ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves;call Link if needed sal_Bool bRet = !pTblCrsr && pCurCrsr->MoveRegion( fnWhichRegion, fnPosRegion ); if( bRet ) UpdateCrsr(); @@ -254,7 +254,7 @@ sal_Bool SwCursor::GotoRegion( const String& rName ) 0 != ( pIdx = pFmt->GetCntnt().GetCntntIdx() ) && pIdx->GetNode().GetNodes().IsDocNodes() ) { - // ein Bereich im normalen NodesArr + // area in normal nodes array SwCrsrSaveState aSaveState( *this ); GetPoint()->nNode = *pIdx; @@ -267,11 +267,11 @@ sal_Bool SwCursor::GotoRegion( const String& rName ) sal_Bool SwCrsrShell::GotoRegion( const String& rName ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves;call Link if needed sal_Bool bRet = !pTblCrsr && pCurCrsr->GotoRegion( rName ); if( bRet ) UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); // und den akt. Updaten + SwCrsrShell::READONLY ); return bRet; } diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index f4724ecd5871..90ba1d727c3a 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -33,7 +33,7 @@ #include #include #include -#include //EndAllAction gibts nur an der EditShell +#include #include #include #include @@ -48,8 +48,7 @@ #include #include - -// setze Crsr in die naechsten/vorherigen Celle +/// set cursor into next/previous cell sal_Bool SwCrsrShell::GoNextCell( sal_Bool bAppendLine ) { sal_Bool bRet = sal_False; @@ -58,7 +57,7 @@ sal_Bool SwCrsrShell::GoNextCell( sal_Bool bAppendLine ) if( IsTableMode() || 0 != ( pTblNd = IsCrsrInTbl() )) { SwCursor* pCrsr = pTblCrsr ? pTblCrsr : pCurCrsr; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves bRet = sal_True; // Check if we have to move the cursor to a covered cell before @@ -81,27 +80,24 @@ sal_Bool SwCrsrShell::GoNextCell( sal_Bool bAppendLine ) SwNodeIndex aCellStt( *pTableBoxStartNode->EndOfSectionNode(), 1 ); - // folgt nach dem EndNode der Cell ein weiterer StartNode, dann - // gibt es auch eine naechste Celle - + // if there is another StartNode after the EndNode of a cell then + // there is another cell if( !aCellStt.GetNode().IsStartNode() ) { if( pCrsr->HasMark() || !bAppendLine ) bRet = sal_False; else { - // auf besonderen Wunsch: keine Line mehr vorhanden, dann - // mache doch eine neue: + // if there is no list anymore then create new one if ( !pTableBox ) pTableBox = pTblNd->GetTable().GetTblBox( pCrsr->GetPoint()->nNode.GetNode(). StartOfSectionIndex() ); - OSL_ENSURE( pTableBox, "Box steht nicht in dieser Tabelle" ); + OSL_ENSURE( pTableBox, "Box is not in this table" ); SwSelBoxes aBoxes; - //Das Dokument veraendert sich evtl. ohne Action wuerden die Sichten - //nichts mitbekommen. + // the document might change; w/o Action views would not be notified ((SwEditShell*)this)->StartAllAction(); bRet = pDoc->InsertRow( pTblNd->GetTable(). SelLineFromBox( pTableBox, aBoxes, sal_False )); @@ -109,7 +105,7 @@ sal_Bool SwCrsrShell::GoNextCell( sal_Bool bAppendLine ) } } if( bRet && 0 != ( bRet = pCrsr->GoNextCell() )) - UpdateCrsr(); // und den akt. Updaten + UpdateCrsr(); } return bRet; } @@ -121,10 +117,10 @@ sal_Bool SwCrsrShell::GoPrevCell() if( IsTableMode() || IsCrsrInTbl() ) { SwCursor* pCrsr = pTblCrsr ? pTblCrsr : pCurCrsr; - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves bRet = pCrsr->GoPrevCell(); if( bRet ) - UpdateCrsr(); // und den akt. Updaten + UpdateCrsr(); // update current cursor } return bRet; } @@ -143,7 +139,7 @@ const SwFrm* lcl_FindMostUpperCellFrm( const SwFrm* pFrm ) sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple ) { - // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen + // check if the current cursor's SPoint/Mark are in a table SwFrm *pFrm = GetCurrFrm(); if( !pFrm->IsInTab() ) return sal_False; @@ -157,7 +153,7 @@ sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple ) const SwTableBox* pStt = 0; const SwTableBox* pEnd = 0; - // lasse ueber das Layout die Boxen suchen + // search box based on layout SwSelBoxes aBoxes; SwTblSearchType eType = bRow ? nsSwTblSearchType::TBLSEARCH_ROW : nsSwTblSearchType::TBLSEARCH_COL; const bool bCheckProtected = !IsReadOnlyAvailable(); @@ -232,7 +228,7 @@ sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple ) } } - // noch kein Tabellen-Cursor vorhanden, dann erzeuge einen + // if no table cursor exists, create one if( !pTblCrsr ) { pTblCrsr = new SwShellTableCrsr( *this, *pCurCrsr->GetPoint() ); @@ -242,25 +238,27 @@ sal_Bool SwCrsrShell::_SelTblRowOrCol( bool bRow, bool bRowSimple ) pTblCrsr->DeleteMark(); - // dann setze mal Anfang und Ende der Spalte + // set start and end of a column pTblCrsr->GetPoint()->nNode = *pEnd->GetSttNd(); pTblCrsr->Move( fnMoveForward, fnGoCntnt ); pTblCrsr->SetMark(); pTblCrsr->GetPoint()->nNode = *pStt->GetSttNd()->EndOfSectionNode(); pTblCrsr->Move( fnMoveBackward, fnGoCntnt ); - // set PtPos 'close' to the reference table, otherwise we might get problems with the - // repeated headlines check in UpdateCrsr(): + // set PtPos 'close' to the reference table, otherwise we might get problems + // with the repeated headlines check in UpdateCrsr(): if ( !bRow ) - pTblCrsr->GetPtPos() = pMasterTabFrm->IsVertical() ? pMasterTabFrm->Frm().TopRight() : pMasterTabFrm->Frm().TopLeft(); + pTblCrsr->GetPtPos() = pMasterTabFrm->IsVertical() + ? pMasterTabFrm->Frm().TopRight() + : pMasterTabFrm->Frm().TopLeft(); - UpdateCrsr(); // und den akt. Updaten + UpdateCrsr(); return sal_True; } sal_Bool SwCrsrShell::SelTbl() { - // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen + // check if the current cursor's SPoint/Mark are in a table SwFrm *pFrm = GetCurrFrm(); if( !pFrm->IsInTab() ) return sal_False; @@ -287,7 +285,7 @@ sal_Bool SwCrsrShell::SelTbl() pTblCrsr->GetMkPos() = pMasterTabFrm->IsVertical() ? pMasterTabFrm->Frm().TopRight() : pMasterTabFrm->Frm().TopLeft(); pTblCrsr->GetPoint()->nNode = *pTblNd->EndOfSectionNode(); pTblCrsr->Move( fnMoveBackward, fnGoCntnt ); - UpdateCrsr(); // und den akt. Updaten + UpdateCrsr(); return sal_True; } @@ -326,17 +324,17 @@ sal_Bool SwCrsrShell::SelTblBox() // select the complete box with our shiny new pTblCrsr // 1. delete mark, and move point to first content node in box - // 2. set mark, and move point to last content node in box - // 3. exchange pTblCrsr->DeleteMark(); *(pTblCrsr->GetPoint()) = SwPosition( *pStartNode ); pTblCrsr->Move( fnMoveForward, fnGoNode ); + // 2. set mark, and move point to last content node in box pTblCrsr->SetMark(); *(pTblCrsr->GetPoint()) = SwPosition( *(pStartNode->EndOfSectionNode()) ); pTblCrsr->Move( fnMoveBackward, fnGoNode ); + // 3. exchange pTblCrsr->Exchange(); // with some luck, UpdateCrsr() will now update everything that @@ -353,7 +351,7 @@ sal_Bool SwCrsrShell::SelTblBox() // false - could not find a suitable cell bool lcl_FindNextCell( SwNodeIndex& rIdx, sal_Bool bInReadOnly ) { - // ueberpruefe geschuetzte Zellen + // check protected cells SwNodeIndex aTmp( rIdx, 2 ); // TableNode + StartNode // the resulting cell should be in that table: @@ -479,7 +477,7 @@ bool lcl_FindPrevCell( SwNodeIndex& rIdx, sal_Bool bInReadOnly ) (bInReadOnly || !pFrm->IsProtected() ) ) { rIdx = *pCNd; - return true; // Ok, nicht geschuetzt + return true; // ok, not protected } aTmp.Assign( *pCNd->StartOfSectionNode(), - 1 ); } @@ -516,24 +514,24 @@ sal_Bool GotoPrevTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl, 0 == ( pTblNd = aIdx.GetNode().StartOfSectionNode()->GetTableNode()) ) aIdx--; - if( pTblNd ) // gibt einen weiteren TableNode ? + if( pTblNd ) // any further table node? { - if( fnPosTbl == fnMoveForward ) // an Anfang ? + if( fnPosTbl == fnMoveForward ) // at the beginning? { aIdx = *aIdx.GetNode().StartOfSectionNode(); if( !lcl_FindNextCell( aIdx, bInReadOnly )) { - // Tabelle ueberspringen + // skip table aIdx.Assign( *pTblNd, -1 ); continue; } } else { - // ueberpruefe geschuetzte Zellen + // check protected cells if( !lcl_FindNextCell( aIdx, bInReadOnly )) { - // Tabelle ueberspringen + // skip table aIdx.Assign( *pTblNd, -1 ); continue; } @@ -569,13 +567,13 @@ sal_Bool GotoNextTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl, while( aIdx.GetIndex() < nLastNd && 0 == ( pTblNd = aIdx.GetNode().GetTableNode()) ) aIdx++; - if( pTblNd ) // gibt einen weiteren TableNode ? + if( pTblNd ) // any further table node? { - if( fnPosTbl == fnMoveForward ) // an Anfang ? + if( fnPosTbl == fnMoveForward ) // at the beginning? { if( !lcl_FindNextCell( aIdx, bInReadOnly )) { - // Tabelle ueberspringen + // skip table aIdx.Assign( *pTblNd->EndOfSectionNode(), + 1 ); continue; } @@ -583,10 +581,10 @@ sal_Bool GotoNextTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl, else { aIdx = *aIdx.GetNode().EndOfSectionNode(); - // ueberpruefe geschuetzte Zellen + // check protected cells if( !lcl_FindNextCell( aIdx, bInReadOnly )) { - // Tabelle ueberspringen + // skip table aIdx.Assign( *pTblNd->EndOfSectionNode(), + 1 ); continue; } @@ -616,7 +614,7 @@ sal_Bool GotoCurrTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl, return sal_False; SwTxtNode* pTxtNode = 0; - if( fnPosTbl == fnMoveBackward ) // ans Ende der Tabelle + if( fnPosTbl == fnMoveBackward ) // to the end of the table { SwNodeIndex aIdx( *pTblNd->EndOfSectionNode() ); if( !lcl_FindPrevCell( aIdx, bInReadOnly )) @@ -648,7 +646,7 @@ sal_Bool SwCursor::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl ) sal_Bool bRet = sal_False; SwTableCursor* pTblCrsr = dynamic_cast(this); - if( pTblCrsr || !HasMark() ) // nur wenn kein Mark oder ein TblCrsr + if( pTblCrsr || !HasMark() ) { SwCrsrSaveState aSaveState( *this ); bRet = (*fnWhichTbl)( *this, fnPosTbl, IsReadOnlyAvailable() ) && @@ -660,16 +658,16 @@ sal_Bool SwCursor::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl ) sal_Bool SwCrsrShell::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen + SwCallLink aLk( *this ); // watch Crsr-Moves; call Link if needed SwShellCrsr* pCrsr = pTblCrsr ? pTblCrsr : pCurCrsr; sal_Bool bCheckPos, bRet; sal_uLong nPtNd = 0; xub_StrLen nPtCnt = 0; - if( !pTblCrsr && pCurCrsr->HasMark() ) // wenn Mark und kein TblCrsr, + if ( !pTblCrsr && pCurCrsr->HasMark() ) { - // dann auf jedenfall in den Tabellen-Modus schalten + // switch to table mode pTblCrsr = new SwShellTableCrsr( *this, *pCurCrsr->GetPoint() ); pCurCrsr->DeleteMark(); pCurCrsr->SwSelPaintRects::Hide(); @@ -688,8 +686,7 @@ sal_Bool SwCrsrShell::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl ) if( bRet ) { - //JP 28.10.97: Bug 45028 - die "oberste" Position setzen fuer - // wiederholte Kopfzeilen + // #i45028# - set "top" position for repeated headline rows pCrsr->GetPtPos() = Point(); UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); @@ -722,8 +719,7 @@ sal_Bool SwCrsrShell::IsTblComplexForChart() const SwTableNode* pTNd = pCurCrsr->GetPoint()->nNode.GetNode().FindTableNode(); if( pTNd ) { - // wir stehen in der Tabelle, dann teste mal, ob die Tabelle oder die - // Selektion ausgeglichen ist. + // in a table; check if table or section is balanced String sSel; if( pTblCrsr ) sSel = GetBoxNms(); @@ -752,7 +748,7 @@ String SwCrsrShell::GetBoxNms() const pFrm = pFrm->GetUpper(); } while ( pFrm && !pFrm->IsCellFrm() ); - OSL_ENSURE( pFrm, "kein Frame zur Box" ); + OSL_ENSURE( pFrm, "no frame for this box" ); if( !pFrm ) return sNm; @@ -787,13 +783,13 @@ String SwCrsrShell::GetBoxNms() const sal_Bool SwCrsrShell::GotoTable( const String& rName ) { - SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, + SwCallLink aLk( *this ); // watch Crsr-Moves sal_Bool bRet = !pTblCrsr && pCurCrsr->GotoTable( rName ); if( bRet ) { pCurCrsr->GetPtPos() = Point(); UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE | - SwCrsrShell::READONLY ); // und den akt. Updaten + SwCrsrShell::READONLY ); } return bRet; } @@ -804,13 +800,12 @@ sal_Bool SwCrsrShell::CheckTblBoxCntnt( const SwPosition* pPos ) if( !pBoxIdx || !pBoxPtr || IsSelTblCells() || !IsAutoUpdateCells() ) return sal_False; - // ueberpruefe, ob der Box Inhalt mit dem angegebenen Format der Box - // ueber einstimmt. Wenn nicht, setze neu + // check if box content is consistent with given box format, reset if not SwTableBox* pChkBox = 0; SwStartNode* pSttNd = 0; if( !pPos ) { - // gesicherte Position heraus holen. + // get stored position if( pBoxIdx && pBoxPtr && 0 != ( pSttNd = pBoxIdx->GetNode().GetStartNode() ) && SwTableBoxStartNode == pSttNd->GetStartNodeType() && @@ -824,25 +819,22 @@ sal_Bool SwCrsrShell::CheckTblBoxCntnt( const SwPosition* pPos ) pChkBox = pSttNd->FindTableNode()->GetTable().GetTblBox( pSttNd->GetIndex() ); } - - // Box mehr als 1 Absatz? + // box has more than one paragraph if( pChkBox && pSttNd->GetIndex() + 2 != pSttNd->EndOfSectionIndex() ) pChkBox = 0; - // jetzt sollten wir mal die Pointer zerstoeren, bevor eine erneute - // Actionklammerung kommt. + // destroy pointer before next action starts if( !pPos && !pChkBox ) ClearTblBoxCntnt(); - // liegt der Cursor nicht mehr in dem Bereich ? + // cursor not anymore in this section? if( pChkBox && !pPos && ( pCurCrsr->HasMark() || pCurCrsr->GetNext() != pCurCrsr || pSttNd->GetIndex() + 1 == pCurCrsr->GetPoint()->nNode.GetIndex() )) pChkBox = 0; - //JP 12.01.99: hat sich der Inhalt der Box ueberhaupt veraendert? - // Ist wichtig, wenn z.B. Undo nicht den richtigen Inhalt wieder - // herstellen konnte. + // Did the content of a box change at all? This is important if e.g. Undo + // could not restore the content properly. if( pChkBox ) { const SwTxtNode* pNd = GetDoc()->GetNodes()[ @@ -856,8 +848,7 @@ sal_Bool SwCrsrShell::CheckTblBoxCntnt( const SwPosition* pPos ) if( pChkBox ) { - // jetzt sollten wir mal die Pointer zerstoeren, bevor ein weiterer - // aufruf kommt. + // destroy pointer before next action starts ClearTblBoxCntnt(); StartAction(); GetDoc()->ChkBoxNumFmt( *pChkBox, sal_True ); @@ -882,7 +873,7 @@ void SwCrsrShell::SaveTblBoxCntnt( const SwPosition* pPos ) if( pSttNd && pBoxIdx ) { if( pSttNd == &pBoxIdx->GetNode() ) - pSttNd = 0; // die haben wir schon + pSttNd = 0; else bCheckBox = sal_True; } @@ -891,7 +882,7 @@ void SwCrsrShell::SaveTblBoxCntnt( const SwPosition* pPos ) if( bCheckBox ) { - // pBoxIdx Checken + // check pBoxIdx SwPosition aPos( *pBoxIdx ); CheckTblBoxCntnt( &aPos ); } diff --git a/sw/source/core/crsr/unocrsr.cxx b/sw/source/core/crsr/unocrsr.cxx index 75f5b096fbe1..10df370c7b05 100644 --- a/sw/source/core/crsr/unocrsr.cxx +++ b/sw/source/core/crsr/unocrsr.cxx @@ -49,23 +49,23 @@ SwUnoCrsr::~SwUnoCrsr() SwDoc* pDoc = GetDoc(); if( !pDoc->IsInDtor() ) { - // dann muss der Cursor aus dem Array ausgetragen werden + // then remove cursor from array SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl(); sal_uInt16 nDelPos = rTbl.GetPos( this ); if( USHRT_MAX != nDelPos ) rTbl.Remove( nDelPos ); else { - OSL_ENSURE( !this, "UNO Cursor nicht mehr im Array" ); + OSL_ENSURE( !this, "UNO cursor not anymore in array" ); } } - // den gesamten Ring loeschen! + // delete the whole ring while( GetNext() != this ) { Ring* pNxt = GetNext(); - pNxt->MoveTo( 0 ); // ausketten - delete pNxt; // und loeschen + pNxt->MoveTo( 0 ); // remove from chain + delete pNxt; // and delete } } @@ -211,7 +211,7 @@ SwUnoTableCrsr::SwUnoTableCrsr(const SwPosition& rPos) SwUnoTableCrsr::~SwUnoTableCrsr() { while( aTblSel.GetNext() != &aTblSel ) - delete aTblSel.GetNext(); // und loeschen + delete aTblSel.GetNext(); } sal_Bool SwUnoTableCrsr::IsSelOvr( int eFlags ) diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 638676037ef5..a7e2aa62b1d8 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -143,7 +143,7 @@ void SwVisCrsr::Hide() void SwVisCrsr::Timeout() { - OSL_ENSURE( !bIsDragCrsr, "Timer vorher abschalten" ); + OSL_ENSURE( !bIsDragCrsr, "stop timer before" ); if( bIsVisible ) { if ( !pCrsrShell->GetWin() ) // SwFrmFmt::GetGraphic suspends Win temporarily! @@ -674,7 +674,7 @@ void SwShellTableCrsr::FillRects() while( pFrm && !pFrm->IsCellFrm() ) pFrm = pFrm->GetUpper(); - OSL_ENSURE( pFrm, "Node nicht in einer Tabelle" ); + OSL_ENSURE( pFrm, "Node not in a table" ); while ( pFrm ) { @@ -709,7 +709,7 @@ sal_Bool SwShellTableCrsr::IsInside( const Point& rPt ) const SwFrm* pFrm = pCNd->getLayoutFrm( GetShell()->GetLayout(), &GetPtPos() ); while( pFrm && !pFrm->IsCellFrm() ) pFrm = pFrm->GetUpper(); - OSL_ENSURE( pFrm, "Node nicht in einer Tabelle" ); + OSL_ENSURE( pFrm, "Node not in a table" ); if( pFrm && pFrm->Frm().IsInside( rPt ) ) return sal_True; } -- cgit