Translate German comments and translate some english comments spelling errors

This commit is contained in:
Philipp Weissenbacher
2011-11-25 00:45:15 +01:00
committed by Thorsten Behrens
parent b0c3f12261
commit 5aff8df530
2 changed files with 203 additions and 222 deletions

View File

@@ -53,12 +53,12 @@
#include <doc.hxx> #include <doc.hxx>
#include <IDocumentUndoRedo.hxx> #include <IDocumentUndoRedo.hxx>
#include <docsh.hxx> #include <docsh.hxx>
#include <rootfrm.hxx> //Damit der RootDtor gerufen wird. #include <rootfrm.hxx> // So that the RootDtor is called.
#include <poolfmt.hxx> #include <poolfmt.hxx>
#include <viewsh.hxx> // fuer MakeDrawView #include <viewsh.hxx> // for MakeDrawView
#include <drawdoc.hxx> #include <drawdoc.hxx>
#include <UndoDraw.hxx> #include <UndoDraw.hxx>
#include <swundo.hxx> // fuer die UndoIds #include <swundo.hxx> // for the UndoIds
#include <dcontact.hxx> #include <dcontact.hxx>
#include <dview.hxx> #include <dview.hxx>
#include <mvsave.hxx> #include <mvsave.hxx>
@@ -219,7 +219,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
SwDrawContact* pNewContact = 0; SwDrawContact* pNewContact = 0;
if( bNoGroup ) if( bNoGroup )
{ {
//Ankerattribut aufheben. // Revoke anchor attribute.
SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj); SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj);
const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() ); const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() );
@@ -234,7 +234,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
static_cast<SwAnchoredDrawObject*>(pMyContact->GetAnchoredObj( pObj )); static_cast<SwAnchoredDrawObject*>(pMyContact->GetAnchoredObj( pObj ));
bGroupMembersNotPositioned = pAnchoredDrawObj->NotYetPositioned(); bGroupMembersNotPositioned = pAnchoredDrawObj->NotYetPositioned();
} }
//ContactObjekte und Formate vernichten. // Destroy ContactObjects and formats.
for( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i ) for( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i )
{ {
pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
@@ -249,7 +249,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
#endif #endif
pFmt = (SwDrawFrmFmt*)pContact->GetFmt(); pFmt = (SwDrawFrmFmt*)pContact->GetFmt();
//loescht sich selbst! // Deletes itself!
pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() ); pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() );
pObj->SetUserCall( 0 ); pObj->SetUserCall( 0 );
@@ -458,13 +458,13 @@ sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
? 0 ? 0
: new SwUndoDrawDelete( (sal_uInt16)rMrkList.GetMarkCount() ); : new SwUndoDrawDelete( (sal_uInt16)rMrkList.GetMarkCount() );
//ContactObjekte vernichten, Formate sicherstellen. // Destroy ContactObjects, save formats.
for( i = 0; i < rMrkList.GetMarkCount(); ++i ) for( i = 0; i < rMrkList.GetMarkCount(); ++i )
{ {
const SdrMark& rMark = *rMrkList.GetMark( i ); const SdrMark& rMark = *rMrkList.GetMark( i );
pObj = rMark.GetMarkedSdrObj(); pObj = rMark.GetMarkedSdrObj();
SwDrawContact *pContact = (SwDrawContact*)pObj->GetUserCall(); SwDrawContact *pContact = (SwDrawContact*)pObj->GetUserCall();
if( pContact ) // natuerlich nicht bei gruppierten Objekten if( pContact ) // of course not for grouped objects
{ {
SwDrawFrmFmt *pFmt = (SwDrawFrmFmt*)pContact->GetFmt(); SwDrawFrmFmt *pFmt = (SwDrawFrmFmt*)pContact->GetFmt();
// before delete of selection is performed, marked // before delete of selection is performed, marked
@@ -475,7 +475,7 @@ sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
{ {
OSL_FAIL( "<SwDrawVirtObj> is still marked for delete. application will crash!" ); OSL_FAIL( "<SwDrawVirtObj> is still marked for delete. application will crash!" );
} }
//loescht sich selbst! // Deletes itself!
pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() ); pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() );
pObj->SetUserCall( 0 ); pObj->SetUserCall( 0 );
@@ -518,14 +518,14 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
{ {
if( pFmt->getIDocumentLayoutAccess()->GetCurrentViewShell() ) //swmod 071107//swmod 071225 if( pFmt->getIDocumentLayoutAccess()->GetCurrentViewShell() ) //swmod 071107//swmod 071225
{ {
// Schauen, ob es ein SdrObject dafuer gibt // See if there is an SdrObject for it
SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *pFrmFmt ); SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *pFrmFmt );
if( pFly ) if( pFly )
nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum(); nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum();
} }
else else
{ {
// Schauen, ob es ein SdrObject dafuer gibt // See if there is an SdrObject for it
SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *pFrmFmt ); SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *pFrmFmt );
if( pContact ) if( pContact )
nOrdNum = pContact->GetMaster()->GetOrdNum(); nOrdNum = pContact->GetMaster()->GetOrdNum();
@@ -533,7 +533,7 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
} }
else if( RES_DRAWFRMFMT == pFmt->Which() ) else if( RES_DRAWFRMFMT == pFmt->Which() )
{ {
// Schauen, ob es ein SdrObject dafuer gibt // See if there is an SdrObject for it
SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement( *pFrmFmt ); SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement( *pFrmFmt );
if( pContact ) if( pContact )
nOrdNum = pContact->GetMaster()->GetOrdNum(); nOrdNum = pContact->GetMaster()->GetOrdNum();
@@ -544,9 +544,9 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
} }
/*************************************************************************/ /*************************************************************************/
// Wird auch vom Sw3-Reader gerufen, wenn ein Fehler beim Einlesen // Is also called by the Sw3 Reader, if there was an error when reading the
// des Drawing Layers auftrat. In diesem Fall wird der Layer komplett // drawing layer. If it is called by the Sw3 Reader the layer is rebuilt
// neu aufgebaut. // from scratch.
#include <svx/sxenditm.hxx> #include <svx/sxenditm.hxx>
@@ -554,14 +554,14 @@ void SwDoc::InitDrawModel()
{ {
RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::InitDrawModel" ); RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::InitDrawModel" );
//!!Achtung im sw3-Reader (sw3imp.cxx) gibt es aehnlichen Code, der // !! Attention: there is similar code in the Sw3 Reader (sw3imp.cxx) that
//mitgepfelgt werden muss. // also has to be maintained!!
if ( pDrawModel ) if ( pDrawModel )
ReleaseDrawModel(); ReleaseDrawModel();
//DrawPool und EditEnginePool anlegen, diese gehoeren uns und werden // Setup DrawPool and EditEnginePool. Ownership is ours and only gets passed
//dem Drawing nur mitgegeben. Im ReleaseDrawModel werden die Pools wieder // to the Drawing.
//zerstoert. // The pools are destroyed in the ReleaseDrawModel.
// for loading the drawing items. This must be loaded without RefCounts! // for loading the drawing items. This must be loaded without RefCounts!
SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() ); SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() );
// change DefaultItems for the SdrEdgeObj distance items to TWIPS. // change DefaultItems for the SdrEdgeObj distance items to TWIPS.
@@ -589,8 +589,7 @@ void SwDoc::InitDrawModel()
GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT )); GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));
RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create DrawDocument" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create DrawDocument" );
//Das SdrModel gehoert dem Dokument, wir haben immer zwei Layer und eine // The document owns the SdrModel. We always have two layers and one page.
//Seite.
pDrawModel = new SwDrawDocument( this ); pDrawModel = new SwDrawDocument( this );
pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() ); pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() );
@@ -632,9 +631,8 @@ void SwDoc::InitDrawModel()
SetCalcFieldValueHdl(&rOutliner); SetCalcFieldValueHdl(&rOutliner);
SetCalcFieldValueHdl(&pDrawModel->GetHitTestOutliner()); SetCalcFieldValueHdl(&pDrawModel->GetHitTestOutliner());
//JP 16.07.98: Bug 50193 - Linkmanager am Model setzen, damit // Set the LinkManager in the model so that linked graphics can be inserted.
// dort ggfs. verlinkte Grafiken eingefuegt werden koennen // The WinWord import needs it too.
//JP 28.01.99: der WinWord Import benoetigt ihn auch
pDrawModel->SetLinkManager( &GetLinkManager() ); pDrawModel->SetLinkManager( &GetLinkManager() );
pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) ); pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) );
@@ -788,18 +786,18 @@ void SwDoc::ReleaseDrawModel()
{ {
if ( pDrawModel ) if ( pDrawModel )
{ {
//!!Den code im sw3io fuer Einfuegen Dokument mitpflegen!! // !! Also maintain the code in the sw3io for inserting documents!!
delete pDrawModel; pDrawModel = 0; delete pDrawModel; pDrawModel = 0;
SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool(); SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool();
OSL_ENSURE( pSdrPool, "missing Pool" ); OSL_ENSURE( pSdrPool, "missing pool" );
SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool(); SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
OSL_ENSURE( !pEEgPool->GetSecondaryPool(), "i don't accept additional pools"); OSL_ENSURE( !pEEgPool->GetSecondaryPool(), "I don't accept additional pools");
pSdrPool->Delete(); //Erst die Items vernichten lassen, pSdrPool->Delete(); // First have the items destroyed,
//dann erst die Verkettung loesen // then destroy the chain!
GetAttrPool().SetSecondaryPool( 0 ); //Der ist ein muss! GetAttrPool().SetSecondaryPool( 0 ); // This one's a must!
pSdrPool->SetSecondaryPool( 0 ); //Der ist sicherer pSdrPool->SetSecondaryPool( 0 ); // That one's safer
SfxItemPool::Free(pSdrPool); SfxItemPool::Free(pSdrPool);
SfxItemPool::Free(pEEgPool); SfxItemPool::Free(pEEgPool);
} }
@@ -821,7 +819,7 @@ SdrModel* SwDoc::_MakeDrawModel()
pTmp = (ViewShell*) pTmp->GetNext(); pTmp = (ViewShell*) pTmp->GetNext();
} while ( pTmp != pCurrentView ); } while ( pTmp != pCurrentView );
//Broadcast, damit die FormShell mit der DrawView verbunden werden kann // Broadcast, so that the FormShell can be connected to the DrawView
if( GetDocShell() ) if( GetDocShell() )
{ {
SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED ); SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED );
@@ -840,7 +838,7 @@ void SwDoc::DrawNotifyUndoHdl()
/************************************************************************* /*************************************************************************
* *
* Am Outliner Link auf Methode fuer Felddarstellung in Editobjekten setzen * In the Outliner, set a link to the method for field display in edit objects.
* *
*************************************************************************/ *************************************************************************/
@@ -851,7 +849,7 @@ void SwDoc::SetCalcFieldValueHdl(Outliner* pOutliner)
/************************************************************************* /*************************************************************************
|* |*
|* Felder bzw URLs im Outliner erkennen und Darstellung festlegen |* Recognise fields/URLs in the Outliner and set how they are displayed.
|* |*
\************************************************************************/ \************************************************************************/
@@ -865,7 +863,7 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
if (pField && pField->ISA(SvxDateField)) if (pField && pField->ISA(SvxDateField))
{ {
/****************************************************************** /******************************************************************
* Date-Field * Date field
******************************************************************/ ******************************************************************/
pInfo->SetRepresentation( pInfo->SetRepresentation(
((const SvxDateField*) pField)->GetFormatted( ((const SvxDateField*) pField)->GetFormatted(
@@ -874,12 +872,12 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
else if (pField && pField->ISA(SvxURLField)) else if (pField && pField->ISA(SvxURLField))
{ {
/****************************************************************** /******************************************************************
* URL-Field * URL field
******************************************************************/ ******************************************************************/
switch ( ((const SvxURLField*) pField)->GetFormat() ) switch ( ((const SvxURLField*) pField)->GetFormat() )
{ {
case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App??? case SVXURLFORMAT_APPDEFAULT: //!!! Can be set in App???
case SVXURLFORMAT_REPR: case SVXURLFORMAT_REPR:
{ {
pInfo->SetRepresentation( pInfo->SetRepresentation(
@@ -913,14 +911,14 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
else if (pField && pField->ISA(SdrMeasureField)) else if (pField && pField->ISA(SdrMeasureField))
{ {
/****************************************************************** /******************************************************************
* Measure-Field * Measure field
******************************************************************/ ******************************************************************/
pInfo->ClearFldColor(); pInfo->ClearFldColor();
} }
else if ( pField && pField->ISA(SvxExtTimeField)) else if ( pField && pField->ISA(SvxExtTimeField))
{ {
/****************************************************************** /******************************************************************
* Time-Field * Time field
******************************************************************/ ******************************************************************/
pInfo->SetRepresentation( pInfo->SetRepresentation(
((const SvxExtTimeField*) pField)->GetFormatted( ((const SvxExtTimeField*) pField)->GetFormatted(
@@ -928,7 +926,7 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
} }
else else
{ {
OSL_FAIL("unbekannter Feldbefehl"); OSL_FAIL("unknown field command");
pInfo->SetRepresentation( String( '?' ) ); pInfo->SetRepresentation( String( '?' ) );
} }
} }

View File

@@ -29,7 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove // MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx" #include "precompiled_sw.hxx"
#include <string.h> // fuer strchr() #include <string.h> // for strchr()
#include <hintids.hxx> #include <hintids.hxx>
#include <vcl/sound.hxx> #include <vcl/sound.hxx>
@@ -44,26 +44,26 @@
#include <fmtcntnt.hxx> #include <fmtcntnt.hxx>
#include <fmtpdsc.hxx> #include <fmtpdsc.hxx>
#include <txtftn.hxx> #include <txtftn.hxx>
#include <acorrect.hxx> // Autokorrektur #include <acorrect.hxx> // AutoCorrect
#include <IMark.hxx> // fuer SwBookmark #include <IMark.hxx> // for SwBookmark
#include <cntfrm.hxx> // fuers Spell #include <cntfrm.hxx> // for Spell
#include <crsrsh.hxx> #include <crsrsh.hxx>
#include <doc.hxx> #include <doc.hxx>
#include <UndoManager.hxx> #include <UndoManager.hxx>
#include <docsh.hxx> #include <docsh.hxx>
#include <docary.hxx> #include <docary.hxx>
#include <doctxm.hxx> // beim Move: Verzeichnisse korrigieren #include <doctxm.hxx> // when moving: correct directories
#include <ftnidx.hxx> #include <ftnidx.hxx>
#include <ftninfo.hxx> #include <ftninfo.hxx>
#include <mdiexp.hxx> // Statusanzeige #include <mdiexp.hxx> // status bar
#include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete #include <mvsave.hxx> // structures to save when moving/deleting
#include <ndtxt.hxx> #include <ndtxt.hxx>
#include <pam.hxx> #include <pam.hxx>
#include <redline.hxx> #include <redline.hxx>
#include <rootfrm.hxx> // fuers UpdateFtn #include <rootfrm.hxx> // for UpdateFtn
#include <splargs.hxx> // fuer Spell #include <splargs.hxx> // for Spell
#include <swtable.hxx> #include <swtable.hxx>
#include <swundo.hxx> // fuer die UndoIds #include <swundo.hxx> // for the UndoIds
#include <txtfrm.hxx> #include <txtfrm.hxx>
#include <hints.hxx> #include <hints.hxx>
#include <UndoSplitMove.hxx> #include <UndoSplitMove.hxx>
@@ -179,9 +179,9 @@ void lcl_SkipAttr( const SwTxtNode *pNode, SwIndex &rIdx, xub_StrLen &rStart )
{ {
if( !lcl_MayOverwrite( pNode, rStart ) ) if( !lcl_MayOverwrite( pNode, rStart ) )
{ {
// ueberspringe alle SonderAttribute // skip all special attributes
do { do {
// "Beep" bei jedem ausgelassenen // "Beep" for every single one we skip
Sound::Beep(SOUND_ERROR); Sound::Beep(SOUND_ERROR);
rIdx++; rIdx++;
} while( (rStart = rIdx.GetIndex()) < pNode->GetTxt().Len() } while( (rStart = rIdx.GetIndex()) < pNode->GetTxt().Len()
@@ -195,7 +195,7 @@ void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx,
SwPosition aPos( rSttIdx ); SwPosition aPos( rSttIdx );
for( sal_uInt16 n = 0; n < rArr.Count(); ++n ) for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
{ {
// neuen Anker anlegen // create new anchor
_SaveFly& rSave = rArr[n]; _SaveFly& rSave = rArr[n];
SwFrmFmt* pFmt = rSave.pFrmFmt; SwFrmFmt* pFmt = rSave.pFrmFmt;
@@ -272,18 +272,18 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
if (pAPos && if (pAPos &&
((FLY_AT_PARA == pAnchor->GetAnchorId()) || ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
(FLY_AT_CHAR == pAnchor->GetAnchorId())) && (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
// nicht verschieben, wenn die InsPos im CntntBereich vom Fly ist // do not move, if the InsPos is in the CntntArea of the Fly
( 0 == ( pCntntIdx = pFmt->GetCntnt().GetCntntIdx() ) || ( 0 == ( pCntntIdx = pFmt->GetCntnt().GetCntntIdx() ) ||
!( *pCntntIdx < rInsPos && !( *pCntntIdx < rInsPos &&
rInsPos < pCntntIdx->GetNode().EndOfSectionIndex() )) ) rInsPos < pCntntIdx->GetNode().EndOfSectionIndex() )) )
{ {
if( !bMoveAllFlys && rEndNdIdx == pAPos->nNode ) if( !bMoveAllFlys && rEndNdIdx == pAPos->nNode )
{ {
// wenn nur teil vom EndNode oder der EndNode und SttNode // Do not touch chaos::Anchor, if only a part of the EndNode
// identisch sind, chaos::Anchor nicht anfassen // or the whole EndNode is identical with the SttNode
if( rSttNdIdx != pAPos->nNode ) if( rSttNdIdx != pAPos->nNode )
{ {
// Anker nur an Anfang/Ende haengen // Only attach an anchor to the beginning or end
SwPosition aPos( rSttNdIdx ); SwPosition aPos( rSttNdIdx );
SwFmtAnchor aAnchor( *pAnchor ); SwFmtAnchor aAnchor( *pAnchor );
aAnchor.SetAnchor( &aPos ); aAnchor.SetAnchor( &aPos );
@@ -305,8 +305,8 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
} }
} }
// loesche und verschiebe alle "Fly's am Absatz", die in der SSelection // Delete and move all Flys at the paragraph, that are within the selection.
// liegen. Steht am SPoint ein Fly, wird dieser auf den Mark verschoben. // If there is a Fly at the SPoint, it is moved onto the Mark.
void DelFlyInRange( const SwNodeIndex& rMkNdIdx, void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
const SwNodeIndex& rPtNdIdx ) const SwNodeIndex& rPtNdIdx )
{ {
@@ -326,7 +326,7 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx ? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx
: rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx )) : rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx ))
{ {
// nur den Anker verschieben ?? // Only move the Anchor??
if( rPtNdIdx == pAPos->nNode ) if( rPtNdIdx == pAPos->nNode )
{ {
SwFmtAnchor aAnch( pFmt->GetAnchor() ); SwFmtAnchor aAnch( pFmt->GetAnchor() );
@@ -336,15 +336,14 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
} }
else else
{ {
// wird der Fly geloescht muss auch im seinem Inhalt alle // If the Fly is deleted, all Flys in it's content have to be deleted too.
// Flys geloescht werden !!
const SwFmtCntnt &rCntnt = pFmt->GetCntnt(); const SwFmtCntnt &rCntnt = pFmt->GetCntnt();
if( rCntnt.GetCntntIdx() ) if( rCntnt.GetCntntIdx() )
{ {
DelFlyInRange( *rCntnt.GetCntntIdx(), DelFlyInRange( *rCntnt.GetCntntIdx(),
SwNodeIndex( *rCntnt.GetCntntIdx()-> SwNodeIndex( *rCntnt.GetCntntIdx()->
GetNode().EndOfSectionNode() )); GetNode().EndOfSectionNode() ));
// Position kann sich verschoben haben ! // Position could have been moved!
if( i > rTbl.Count() ) if( i > rTbl.Count() )
i = rTbl.Count(); i = rTbl.Count();
else if( pFmt != rTbl[i] ) else if( pFmt != rTbl[i] )
@@ -380,7 +379,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
SwTxtFtn* pSrch; SwTxtFtn* pSrch;
const SwNode* pFtnNd; const SwNode* pFtnNd;
// loesche/sicher erstmal alle, die dahinter stehen // Delete/save all that come after it
while( nPos < rFtnArr.Count() && ( pFtnNd = while( nPos < rFtnArr.Count() && ( pFtnNd =
&( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex() &( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex()
<= rEndNd.GetIndex() ) <= rEndNd.GetIndex() )
@@ -393,11 +392,11 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
nFtnSttIdx >= pEndCnt->GetIndex() )) nFtnSttIdx >= pEndCnt->GetIndex() ))
: ( &rEndNd.GetNode() == pFtnNd )) : ( &rEndNd.GetNode() == pFtnNd ))
{ {
++nPos; // weiter suchen ++nPos; // continue searching
} }
else else
{ {
// dann weg damit // delete it
if( bDelFtn ) if( bDelFtn )
{ {
SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode(); SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode();
@@ -427,7 +426,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
{ {
if( bDelFtn ) if( bDelFtn )
{ {
// dann weg damit // delete it
SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode(); SwTxtNode& rTxtNd = (SwTxtNode&)pSrch->GetTxtNode();
SwIndex aIdx( &rTxtNd, nFtnSttIdx ); SwIndex aIdx( &rTxtNd, nFtnSttIdx );
rTxtNd.EraseText( aIdx, 1 ); rTxtNd.EraseText( aIdx, 1 );
@@ -585,8 +584,8 @@ void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
{ {
if( pREnd->nNode > rRg.aStart && pREnd->nNode < rRg.aEnd ) if( pREnd->nNode > rRg.aStart && pREnd->nNode < rRg.aEnd )
{ {
// Kopie erzeugen und Ende vom Original ans Ende des // Create a copy and set the end of the original to the end of the MoveArea.
// MoveBereiches setzen. Die Kopie wird mit verschoben // The copy is moved too.
SwRedline* pNewRedl = new SwRedline( *pTmp ); SwRedline* pNewRedl = new SwRedline( *pTmp );
SwPosition* pTmpPos = pNewRedl->Start(); SwPosition* pTmpPos = pNewRedl->Start();
pTmpPos->nNode = rRg.aStart; pTmpPos->nNode = rRg.aStart;
@@ -615,13 +614,13 @@ void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
if( pREnd->nNode < rRg.aEnd || if( pREnd->nNode < rRg.aEnd ||
( pREnd->nNode == rRg.aEnd && !pREnd->nContent.GetIndex()) ) ( pREnd->nNode == rRg.aEnd && !pREnd->nContent.GetIndex()) )
{ {
// gesamt verschieben // move everything
_SaveRedline* pSave = new _SaveRedline( pTmp, rRg.aStart ); _SaveRedline* pSave = new _SaveRedline( pTmp, rRg.aStart );
rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() ); rArr.C40_INSERT( _SaveRedline, pSave, rArr.Count() );
} }
else else
{ {
// aufsplitten // split
SwRedline* pNewRedl = new SwRedline( *pTmp ); SwRedline* pNewRedl = new SwRedline( *pTmp );
SwPosition* pTmpPos = pNewRedl->End(); SwPosition* pTmpPos = pNewRedl->End();
pTmpPos->nNode = rRg.aEnd; pTmpPos->nNode = rRg.aEnd;
@@ -709,22 +708,22 @@ void _SaveRedlEndPosForRestore::_Restore()
} }
} }
// Loeschen einer vollstaendigen Section des NodesArray. // Delete a full Section of the NodeArray.
// Der uebergebene Node steht irgendwo in der gewuenschten Section // The passed Node is located somewhere in the designated Section.
void SwDoc::DeleteSection( SwNode *pNode ) void SwDoc::DeleteSection( SwNode *pNode )
{ {
OSL_ENSURE( pNode, "Kein Node uebergeben." ); OSL_ENSURE( pNode, "Didn't pass a Node." );
SwStartNode* pSttNd = pNode->IsStartNode() ? (SwStartNode*)pNode SwStartNode* pSttNd = pNode->IsStartNode() ? (SwStartNode*)pNode
: pNode->StartOfSectionNode(); : pNode->StartOfSectionNode();
SwNodeIndex aSttIdx( *pSttNd ), aEndIdx( *pNode->EndOfSectionNode() ); SwNodeIndex aSttIdx( *pSttNd ), aEndIdx( *pNode->EndOfSectionNode() );
// dann loesche mal alle Fly's, text::Bookmarks, ... // delete all Flys, text::Bookmarks, ...
DelFlyInRange( aSttIdx, aEndIdx ); DelFlyInRange( aSttIdx, aEndIdx );
DeleteRedline( *pSttNd, true, USHRT_MAX ); DeleteRedline( *pSttNd, true, USHRT_MAX );
_DelBookmarks(aSttIdx, aEndIdx); _DelBookmarks(aSttIdx, aEndIdx);
{ {
// alle Crsr/StkCrsr/UnoCrsr aus dem Loeschbereich verschieben // move all Crsr/StkCrsr/UnoCrsr out of the to-be-deleted area
SwNodeIndex aMvStt( aSttIdx, 1 ); SwNodeIndex aMvStt( aSttIdx, 1 );
CorrAbs( aMvStt, aEndIdx, SwPosition( aSttIdx ), sal_True ); CorrAbs( aMvStt, aEndIdx, SwPosition( aSttIdx ), sal_True );
} }
@@ -739,12 +738,12 @@ void SwDoc::SetModified(SwPaM &rPaM)
} }
/************************************************************************* /*************************************************************************
* SwDoc::Overwrite() * SwDoc::Overwrite()
************************************************************************/ ************************************************************************/
bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
{ {
SwPosition& rPt = *(SwPosition*)rRg.GetPoint(); SwPosition& rPt = *(SwPosition*)rRg.GetPoint();
if( pACEWord ) // Aufnahme in die Autokorrektur if( pACEWord ) // Add to AutoCorrect
{ {
if( 1 == rStr.Len() ) if( 1 == rStr.Len() )
pACEWord->CheckChar( rPt, rStr.GetChar( 0 ) ); pACEWord->CheckChar( rPt, rStr.GetChar( 0 ) );
@@ -774,7 +773,7 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
for( xub_StrLen nCnt = 0; nCnt < rStr.Len(); ++nCnt ) for( xub_StrLen nCnt = 0; nCnt < rStr.Len(); ++nCnt )
{ {
// hinter das Zeichen (zum aufspannen der Attribute !!) // start behind the characters (to fix the attributes!)
nStart = rIdx.GetIndex(); nStart = rIdx.GetIndex();
if ( nStart < pNode->GetTxt().Len() ) if ( nStart < pNode->GetTxt().Len() )
{ {
@@ -803,7 +802,7 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
} }
else else
{ {
// hinter das Zeichen (zum Aufspannen der Attribute !!) // start behind the characters (to fix the attributes!)
if( nStart < pNode->GetTxt().Len() ) if( nStart < pNode->GetTxt().Len() )
rIdx++; rIdx++;
pNode->InsertText( c, rIdx, INS_EMPTYEXPAND ); pNode->InsertText( c, rIdx, INS_EMPTYEXPAND );
@@ -848,7 +847,7 @@ bool SwDoc::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
SwNodeIndex aIdx( rPaM.Start()->nNode ); SwNodeIndex aIdx( rPaM.Start()->nNode );
sal_Bool bJoinTxt = aIdx.GetNode().IsTxtNode(); sal_Bool bJoinTxt = aIdx.GetNode().IsTxtNode();
sal_Bool bOneNode = rPaM.GetPoint()->nNode == rPaM.GetMark()->nNode; sal_Bool bOneNode = rPaM.GetPoint()->nNode == rPaM.GetMark()->nNode;
aIdx--; // vor den Move Bereich !! aIdx--; // in front of the move area!
bool bRet = MoveRange( rPaM, rPos, eMvFlags ); bool bRet = MoveRange( rPaM, rPos, eMvFlags );
if( bRet && !bOneNode ) if( bRet && !bOneNode )
@@ -859,7 +858,7 @@ bool SwDoc::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
SwNodeIndex aNxtIdx( aIdx ); SwNodeIndex aNxtIdx( aIdx );
if( pTxtNd && pTxtNd->CanJoinNext( &aNxtIdx ) ) if( pTxtNd && pTxtNd->CanJoinNext( &aNxtIdx ) )
{ {
{ // Block wegen SwIndex in den Node !! { // Add Block to the Node, because of SwIndex
CorrRel( aNxtIdx, SwPosition( aIdx, SwIndex( pTxtNd, CorrRel( aNxtIdx, SwPosition( aIdx, SwIndex( pTxtNd,
pTxtNd->GetTxt().Len() ) ), 0, sal_True ); pTxtNd->GetTxt().Len() ) ), 0, sal_True );
} }
@@ -869,17 +868,17 @@ bool SwDoc::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
return bRet; return bRet;
} }
// mst: it seems that this is mostly used by SwDoc internals; the only // It seems that this is mostly used by SwDoc internals; the only
// way to call this from the outside seems to be the special case in // way to call this from the outside seems to be the special case in
// SwDoc::CopyRange (but i have not managed to actually hit that case) // SwDoc::CopyRange (but I have not managed to actually hit that case).
bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
{ {
// keine Moves-Abfangen // do not intercept moves
const SwPosition *pStt = rPaM.Start(), *pEnd = rPaM.End(); const SwPosition *pStt = rPaM.Start(), *pEnd = rPaM.End();
if( !rPaM.HasMark() || *pStt >= *pEnd || (*pStt <= rPos && rPos < *pEnd)) if( !rPaM.HasMark() || *pStt >= *pEnd || (*pStt <= rPos && rPos < *pEnd))
return false; return false;
// sicher die absatzgebundenen Flys, damit sie verschoben werden koennen. // Save the paragraph-bound Flys, so that they can be moved.
_SaveFlyArr aSaveFlyArr; _SaveFlyArr aSaveFlyArr;
_SaveFlyInRange( rPaM, rPos.nNode, aSaveFlyArr, 0 != ( DOC_MOVEALLFLYS & eMvFlags ) ); _SaveFlyInRange( rPaM, rPos.nNode, aSaveFlyArr, 0 != ( DOC_MOVEALLFLYS & eMvFlags ) );
@@ -906,7 +905,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
int bUpdateFtn = sal_False; int bUpdateFtn = sal_False;
SwFtnIdxs aTmpFntIdx; SwFtnIdxs aTmpFntIdx;
// falls Undo eingeschaltet, erzeuge das UndoMove-Objekt // if Undo is switched on, create the UndoMove object
SwUndoMove * pUndoMove = 0; SwUndoMove * pUndoMove = 0;
if (GetIDocumentUndoRedo().DoesUndo()) if (GetIDocumentUndoRedo().DoesUndo())
{ {
@@ -924,21 +923,17 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
sal_Bool bSplit = sal_False; sal_Bool bSplit = sal_False;
SwPaM aSavePam( rPos, rPos ); SwPaM aSavePam( rPos, rPos );
// stelle den SPoint an den Anfang vom Bereich (Definition) // Move the SPoint to the beginning of the area (according to it's definition)
if( rPaM.GetPoint() == pEnd ) if( rPaM.GetPoint() == pEnd )
rPaM.Exchange(); rPaM.Exchange();
// in der EditShell wird nach dem Move ein JoinNext erzeugt, wenn // If there is a TextNode before and after the Move, create a JoinNext in the EditShell.
// vor und nach dem Move ein Text-Node steht.
SwTxtNode* pSrcNd = rPaM.GetPoint()->nNode.GetNode().GetTxtNode(); SwTxtNode* pSrcNd = rPaM.GetPoint()->nNode.GetNode().GetTxtNode();
sal_Bool bCorrSavePam = pSrcNd && pStt->nNode != pEnd->nNode; sal_Bool bCorrSavePam = pSrcNd && pStt->nNode != pEnd->nNode;
// werden ein oder mehr TextNodes bewegt, so wird // If one ore more TextNodes are moved, create a SplitNode in the SwNodes::Move.
// im SwNodes::Move ein SplitNode erzeugt. Dieser Updated aber nicht // However, this does not update the cursor. So we create a TextNode to keep
// den Cursor. Um das zu verhindern, wird hier ein TextNode angelegt, // updating the indices. After the Move the Node is optionally deleted.
// um die Updaterei der Indizies zu erhalten. Nach dem Move wird
// evt. der Node geloescht.
SwTxtNode * pTNd = rPos.nNode.GetNode().GetTxtNode(); SwTxtNode * pTNd = rPos.nNode.GetNode().GetTxtNode();
if( pTNd && rPaM.GetPoint()->nNode != rPaM.GetMark()->nNode && if( pTNd && rPaM.GetPoint()->nNode != rPaM.GetMark()->nNode &&
( rPos.nContent.GetIndex() || ( pTNd->Len() && bCorrSavePam )) ) ( rPos.nContent.GetIndex() || ( pTNd->Len() && bCorrSavePam )) )
@@ -955,7 +950,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
if( !aBkmkArr.empty() ) if( !aBkmkArr.empty() )
_RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True ); _RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
// jetzt noch den Pam berichtigen !! // correct the PaM!
if( rPos.nNode == rPaM.GetMark()->nNode ) if( rPos.nNode == rPaM.GetMark()->nNode )
{ {
rPaM.GetMark()->nNode = rPos.nNode.GetIndex()-1; rPaM.GetMark()->nNode = rPos.nNode.GetIndex()-1;
@@ -963,18 +958,18 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
} }
} }
// setze den Pam um einen "Inhalt" zurueck; dadurch steht er immer // Put back the Pam by one "content"; so that it's always outside of
// ausserhalb des manipulierten Bereiches. Falls kein Inhalt mehr vor- // the manipulated area.
// handen, dann auf den StartNode (es ist immer einer vorhanden !!!) // If there's no content anymore, set it to the StartNode (that's
// always there).
sal_Bool bNullCntnt = !aSavePam.Move( fnMoveBackward, fnGoCntnt ); sal_Bool bNullCntnt = !aSavePam.Move( fnMoveBackward, fnGoCntnt );
if( bNullCntnt ) if( bNullCntnt )
{ {
aSavePam.GetPoint()->nNode--; aSavePam.GetPoint()->nNode--;
} }
// kopiere alle Bookmarks, die im Move Bereich stehen in ein // Copy all Bookmarks that are within the Move area into an array,
// Array, das alle Angaben auf die Position als Offset speichert. // that saves the positon as an offset.
// Die neue Zuordung erfolgt nach dem Moven.
::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks; ::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks;
_DelBookmarks( _DelBookmarks(
pStt->nNode, pStt->nNode,
@@ -983,8 +978,8 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
&pStt->nContent, &pStt->nContent,
&pEnd->nContent); &pEnd->nContent);
// falls durch die vorherigen Loeschungen (z.B. der Fussnoten) kein // If there is no area anymore due to the above deletions (e.g. the footnotes
// Bereich mehr existiert, ist das immernoch ein gueltiger Move! // got deleted), it's still a valid Move!
if( *rPaM.GetPoint() != *rPaM.GetMark() ) if( *rPaM.GetPoint() != *rPaM.GetMark() )
{ {
// now do the actual move // now do the actual move
@@ -1002,39 +997,39 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
OSL_ENSURE( *aSavePam.GetMark() == rPos || OSL_ENSURE( *aSavePam.GetMark() == rPos ||
( aSavePam.GetMark()->nNode.GetNode().GetCntntNode() == NULL ), ( aSavePam.GetMark()->nNode.GetNode().GetCntntNode() == NULL ),
"PaM wurde nicht verschoben, am Anfang/Ende keine ContentNodes?" ); "PaM was not moved. Aren't there ContentNodes at the beginning/end?" );
*aSavePam.GetMark() = rPos; *aSavePam.GetMark() = rPos;
rPaM.SetMark(); // um den neuen Bereich eine Sel. aufspannen rPaM.SetMark(); // create a Sel. around the new area
pTNd = aSavePam.GetNode()->GetTxtNode(); pTNd = aSavePam.GetNode()->GetTxtNode();
if (GetIDocumentUndoRedo().DoesUndo()) if (GetIDocumentUndoRedo().DoesUndo())
{ {
// korrigiere erstmal den Content vom SavePam // correct the SavePam's Content first
if( bNullCntnt ) if( bNullCntnt )
{ {
aSavePam.GetPoint()->nContent = 0; aSavePam.GetPoint()->nContent = 0;
} }
// die Methode SwEditShell::Move() fuegt nach dem Move den Text-Node // The method SwEditShell::Move() merges the TextNode after the Move,
// zusammen, in dem der rPaM steht. Wurde der Inhalt nach hinten // where the rPaM is located.
// geschoben und liegt der SPoint vom SavePam im naechsten Node, so // If the Content was moved to the back and the SavePam's SPoint is
// muss beim Speichern vom Undo-Object das beachtet werden !! // in the next Node, we have to deal with this when saving the Undo object!
SwTxtNode * pPamTxtNd = 0; SwTxtNode * pPamTxtNd = 0;
// wird ans SwUndoMove weitergegeben, das dann beim Undo JoinNext // Is passed to SwUndoMove, which happens when subsequently calling Undo JoinNext.
// aufruft. (falls es hier nicht moeglich ist). // If it's not possible to call Undo JoinNext here.
sal_Bool bJoin = bSplit && pTNd; sal_Bool bJoin = bSplit && pTNd;
bCorrSavePam = bCorrSavePam && bCorrSavePam = bCorrSavePam &&
0 != ( pPamTxtNd = rPaM.GetNode()->GetTxtNode() ) 0 != ( pPamTxtNd = rPaM.GetNode()->GetTxtNode() )
&& pPamTxtNd->CanJoinNext() && pPamTxtNd->CanJoinNext()
&& (*rPaM.GetPoint() <= *aSavePam.GetPoint()); && (*rPaM.GetPoint() <= *aSavePam.GetPoint());
// muessen am SavePam 2 Nodes zusammengefasst werden ?? // Do two Nodes have to be joined at the SavePam?
if( bJoin && pTNd->CanJoinNext() ) if( bJoin && pTNd->CanJoinNext() )
{ {
pTNd->JoinNext(); pTNd->JoinNext();
// kein temp. sdbcx::Index bei && // No temporary sdbcx::Index when using &&.
// es sollten wohl nur die Indexwerte verglichen werden. // We probably only want to compare the indices.
if( bCorrSavePam && rPaM.GetPoint()->nNode.GetIndex()+1 == if( bCorrSavePam && rPaM.GetPoint()->nNode.GetIndex()+1 ==
aSavePam.GetPoint()->nNode.GetIndex() ) aSavePam.GetPoint()->nNode.GetIndex() )
{ {
@@ -1047,7 +1042,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
aSavePam.GetPoint()->nNode++; aSavePam.GetPoint()->nNode++;
} }
// zwischen SPoint und GetMark steht jetzt der neu eingefuegte Bereich // The newly inserted area is now inbetween SPoint and GetMark.
pUndoMove->SetDestRange( aSavePam, *rPaM.GetPoint(), pUndoMove->SetDestRange( aSavePam, *rPaM.GetPoint(),
bJoin, bCorrSavePam ); bJoin, bCorrSavePam );
GetIDocumentUndoRedo().AppendUndo( pUndoMove ); GetIDocumentUndoRedo().AppendUndo( pUndoMove );
@@ -1055,7 +1050,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
else else
{ {
bool bRemove = true; bool bRemove = true;
// muessen am SavePam 2 Nodes zusammengefasst werden ?? // Do two Nodes have to be joined at the SavePam?
if( bSplit && pTNd ) if( bSplit && pTNd )
{ {
if( pTNd->CanJoinNext()) if( pTNd->CanJoinNext())
@@ -1077,7 +1072,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
} }
} }
// setze jetzt wieder die text::Bookmarks in das Dokument // Insert the text::Bookmarks back into the Document.
*rPaM.GetMark() = *aSavePam.Start(); *rPaM.GetMark() = *aSavePam.Start();
for( for(
::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin(); ::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin();
@@ -1089,7 +1084,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
&rPaM.GetMark()->nContent); &rPaM.GetMark()->nContent);
*rPaM.GetPoint() = *aSavePam.End(); *rPaM.GetPoint() = *aSavePam.End();
// verschiebe die Flys an die neue Position // Move the Flys to the new position.
_RestFlyInRange( aSaveFlyArr, rPaM.Start()->nNode, &(rPos.nNode) ); _RestFlyInRange( aSaveFlyArr, rPaM.Start()->nNode, &(rPos.nNode) );
// restore redlines (if DOC_MOVEREDLINES is used) // restore redlines (if DOC_MOVEREDLINES is used)
@@ -1116,17 +1111,14 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
SwMoveFlags eMvFlags ) SwMoveFlags eMvFlags )
{ {
// bewegt alle Nodes an die neue Position. Dabei werden die // Moves all Nodes to the new position.
// text::Bookmarks mit verschoben !! (zur Zeit ohne Undo) // text::Bookmarks is moved too (currently without Undo support)
// falls durchs Move Fussnoten in den Sonderbereich kommen sollten,
// dann entferne sie jetzt.
//JP 13.07.95:
// ansonsten bei allen Fussnoten, die verschoben werden, die Frames
// loeschen und nach dem Move wieder aufbauen lassen (Fussnoten koennen
// die Seite wechseln). Zusaetzlich muss natuerlich die Sortierung
// der FtnIdx-Array wieder korrigiert werden.
// If footnotes are being introduced to the special area, remove them now.
//
// Or else delete the Frames for all footnotes that are being moved
// and have it rebuild after the Move (footnotes can change pages).
// Additionally we have to correct the FtnIdx array's sorting.
int bUpdateFtn = sal_False; int bUpdateFtn = sal_False;
SwFtnIdxs aTmpFntIdx; SwFtnIdxs aTmpFntIdx;
@@ -1147,8 +1139,8 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
{ {
lcl_SaveRedlines( rRange, aSaveRedl ); lcl_SaveRedlines( rRange, aSaveRedl );
// suche alle Redlines, die an der InsPos aufhoeren. Diese muessen // Find all RedLines that end at the InsPos.
// nach dem Move wieder an die "alte" Position verschoben werden // These have to be moved back to the "old" position after the Move.
sal_uInt16 nRedlPos = GetRedlinePos( rPos.GetNode(), USHRT_MAX ); sal_uInt16 nRedlPos = GetRedlinePos( rPos.GetNode(), USHRT_MAX );
if( USHRT_MAX != nRedlPos ) if( USHRT_MAX != nRedlPos )
{ {
@@ -1166,29 +1158,29 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
} }
} }
// kopiere alle Bookmarks, die im Move Bereich stehen in ein // Copy all Bookmarks that are within the Move area into an array
// Array, das alle Angaben auf die Position als Offset speichert. // that stores all references to positions as an offset.
// Die neue Zuordung erfolgt nach dem Moven. // The final mapping happens after the Move.
::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks; ::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks;
_DelBookmarks(rRange.aStart, rRange.aEnd, &aSaveBkmks); _DelBookmarks(rRange.aStart, rRange.aEnd, &aSaveBkmks);
// sicher die absatzgebundenen Flys, damit verschoben werden koennen. // Save the paragraph-bound Flys, so that they can be moved.
_SaveFlyArr aSaveFlyArr; _SaveFlyArr aSaveFlyArr;
if( GetSpzFrmFmts()->Count() ) if( GetSpzFrmFmts()->Count() )
_SaveFlyInRange( rRange, aSaveFlyArr ); _SaveFlyInRange( rRange, aSaveFlyArr );
// vor die Position setzen, damit er nicht weitergeschoben wird // Set it to before the Position, so that it cannot be moved further.
SwNodeIndex aIdx( rPos, -1 ); SwNodeIndex aIdx( rPos, -1 );
SwNodeIndex* pSaveInsPos = 0; SwNodeIndex* pSaveInsPos = 0;
if( pUndo ) if( pUndo )
pSaveInsPos = new SwNodeIndex( rRange.aStart, -1 ); pSaveInsPos = new SwNodeIndex( rRange.aStart, -1 );
// verschiebe die Nodes // move the Nodes
sal_Bool bNoDelFrms = 0 != (DOC_NO_DELFRMS & eMvFlags); sal_Bool bNoDelFrms = 0 != (DOC_NO_DELFRMS & eMvFlags);
if( GetNodes()._MoveNodes( rRange, GetNodes(), rPos, !bNoDelFrms ) ) if( GetNodes()._MoveNodes( rRange, GetNodes(), rPos, !bNoDelFrms ) )
{ {
aIdx++; // wieder auf alte Position aIdx++; // again back to old position
if( pSaveInsPos ) if( pSaveInsPos )
(*pSaveInsPos)++; (*pSaveInsPos)++;
} }
@@ -1198,11 +1190,11 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
delete pUndo, pUndo = 0; delete pUndo, pUndo = 0;
} }
// verschiebe die Flys an die neue Position // move the Flys to the new position
if( aSaveFlyArr.Count() ) if( aSaveFlyArr.Count() )
_RestFlyInRange( aSaveFlyArr, aIdx, NULL ); _RestFlyInRange( aSaveFlyArr, aIdx, NULL );
// setze jetzt wieder die text::Bookmarks in das Dokument // Add the text::Bookmarks back to the Document
for( for(
::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin(); ::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin();
pBkmk != aSaveBkmks.end(); pBkmk != aSaveBkmks.end();
@@ -1332,22 +1324,20 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
SwDoc* pDoc = rPam.GetDoc(); SwDoc* pDoc = rPam.GetDoc();
if( bJoinPrev ) if( bJoinPrev )
{ {
// N.B.: we do not need to handle xmlids in this case, because // We do not need to handle xmlids in this case, because
// it is only invoked if one paragraph is completely empty // it is only invoked if one paragraph is completely empty
// (see lcl_GetJoinFlags) // (see lcl_GetJoinFlags)
{ {
// falls PageBreaks geloescht / gesetzt werden, darf das // If PageBreaks are deleted/set, it must not be added to the Undo history!
// nicht in die Undo-History aufgenommen werden !! // Also, deleteing the Node is not added to the Undo histroy!
// (das loeschen vom Node geht auch am Undo vorbei !!!)
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
/* PageBreaks, PageDesc, ColumnBreaks */ /* PageBreaks, PageDesc, ColumnBreaks */
// Sollte an der Logik zum Kopieren der PageBreak's ... // If we need to change something about the logic to copy the PageBreaks,
// etwas geaendert werden, muss es auch im SwUndoDelete // PageDesc, etc. we also have to change SwUndoDelete.
// geandert werden. Dort wird sich das AUTO-PageBreak // There, we copy the AUTO PageBreak from the GetMarkNode!
// aus dem GetMarkNode kopiert.!!!
/* Der GetMarkNode */ /* The GetMarkNode */
if( ( pTxtNd = aIdx.GetNode().GetTxtNode())->HasSwAttrSet() ) if( ( pTxtNd = aIdx.GetNode().GetTxtNode())->HasSwAttrSet() )
{ {
const SfxPoolItem* pItem; const SfxPoolItem* pItem;
@@ -1360,7 +1350,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
pTxtNd->ResetAttr( RES_PAGEDESC ); pTxtNd->ResetAttr( RES_PAGEDESC );
} }
/* Der PointNode */ /* The PointNode */
if( pOldTxtNd->HasSwAttrSet() ) if( pOldTxtNd->HasSwAttrSet() )
{ {
const SfxPoolItem* pItem; const SfxPoolItem* pItem;
@@ -1387,18 +1377,18 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
SwPosition aAlphaPos( aIdx, aAlphaIdx ); SwPosition aAlphaPos( aIdx, aAlphaIdx );
pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, sal_True ); pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, sal_True );
// verschiebe noch alle Bookmarks/TOXMarks // move all Bookmarks/TOXMarks
if( !aBkmkArr.empty() ) if( !aBkmkArr.empty() )
::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() ); ::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() );
// falls der uebergebene PaM nicht im Crsr-Ring steht, // If the passed PaM is not in the Crsr ring,
// gesondert behandeln (z.B. Aufruf aus dem Auto-Format) // treat it seperately (e.g. when it's being called from AutoFormat)
if( pOldTxtNd == rPam.GetBound( sal_True ).nContent.GetIdxReg() ) if( pOldTxtNd == rPam.GetBound( sal_True ).nContent.GetIdxReg() )
rPam.GetBound( sal_True ) = aAlphaPos; rPam.GetBound( sal_True ) = aAlphaPos;
if( pOldTxtNd == rPam.GetBound( sal_False ).nContent.GetIdxReg() ) if( pOldTxtNd == rPam.GetBound( sal_False ).nContent.GetIdxReg() )
rPam.GetBound( sal_False ) = aAlphaPos; rPam.GetBound( sal_False ) = aAlphaPos;
} }
// jetzt nur noch den Node loeschen // delete the Node, at last!
pDoc->GetNodes().Delete( aOldIdx, 1 ); pDoc->GetNodes().Delete( aOldIdx, 1 );
} }
else else
@@ -1426,7 +1416,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
if( pDelNd->HasSwAttrSet() ) if( pDelNd->HasSwAttrSet() )
{ {
// nur die Zeichenattribute kopieren // only copy the character attributes
SfxItemSet aTmpSet( pDoc->GetAttrPool(), aCharFmtSetRange ); SfxItemSet aTmpSet( pDoc->GetAttrPool(), aCharFmtSetRange );
aTmpSet.Put( *pDelNd->GetpSwAttrSet() ); aTmpSet.Put( *pDelNd->GetpSwAttrSet() );
pTxtNd->SetAttr( aTmpSet ); pTxtNd->SetAttr( aTmpSet );
@@ -1488,7 +1478,7 @@ bool lcl_DoWithBreaks(SwDoc & rDoc, SwPaM & rPam,
return (rDoc.*pFunc)(rPam, bForceJoinNext); return (rDoc.*pFunc)(rPam, bForceJoinNext);
} }
// N.B.: deletion must be split into several parts if the text node // Deletion must be split into several parts if the text node
// contains a text attribute with end and with dummy character // contains a text attribute with end and with dummy character
// and the selection does not contain the text attribute completely, // and the selection does not contain the text attribute completely,
// but overlaps its start (left), where the dummy character is. // but overlaps its start (left), where the dummy character is.
@@ -1533,7 +1523,7 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool )
if (GetIDocumentUndoRedo().DoesUndo()) if (GetIDocumentUndoRedo().DoesUndo())
{ {
//JP 06.01.98: MUSS noch optimiert werden!!! // Still needs to be optimised!
SetRedlineMode( SetRedlineMode(
(RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE )); (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ));
@@ -1571,7 +1561,7 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool )
} }
} }
} }
//JP 06.01.98: MUSS noch optimiert werden!!! // Still needs to be optimised!
SetRedlineMode( eOld ); SetRedlineMode( eOld );
} }
return true; return true;
@@ -1605,9 +1595,8 @@ bool SwDoc::DeleteAndJoinImpl( SwPaM & rPam,
bool SwDoc::DeleteRangeImpl(SwPaM & rPam, const bool) bool SwDoc::DeleteRangeImpl(SwPaM & rPam, const bool)
{ {
// move all cursors out of the deleted range. // Move all cursors out of the deleted range, but first copy the
// but first copy the given PaM, because it could be a cursor that // passed PaM, because it could be a cursor that would be moved!
// would be moved!
SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() ); ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
@@ -1629,7 +1618,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
if( pACEWord ) if( pACEWord )
{ {
// ggfs. das gesicherte Word fuer die Ausnahme // if necessary the saved Word for the exception
if( pACEWord->IsDeleted() || pStt->nNode != pEnd->nNode || if( pACEWord->IsDeleted() || pStt->nNode != pEnd->nNode ||
pStt->nContent.GetIndex() + 1 != pEnd->nContent.GetIndex() || pStt->nContent.GetIndex() + 1 != pEnd->nContent.GetIndex() ||
!pACEWord->CheckDelChar( *pStt )) !pACEWord->CheckDelChar( *pStt ))
@@ -1637,7 +1626,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
} }
{ {
// loesche alle leeren TextHints an der Mark-Position // Delete all empty TextHints at the Mark's position
SwTxtNode* pTxtNd = rPam.GetMark()->nNode.GetNode().GetTxtNode(); SwTxtNode* pTxtNd = rPam.GetMark()->nNode.GetNode().GetTxtNode();
SwpHints* pHts; SwpHints* pHts;
if( pTxtNd && 0 != ( pHts = pTxtNd->GetpSwpHints()) && pHts->Count() ) if( pTxtNd && 0 != ( pHts = pTxtNd->GetpSwpHints()) && pHts->Count() )
@@ -1659,9 +1648,9 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
} }
{ {
// Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt // Send DataChanged before deletion, so that we still know
// man noch mit, welche Objecte sich im Bereich befinden. // which objects are in the area.
// Danach koennen sie vor/hinter der Position befinden. // Afterwards they could be before/after the Position.
SwDataChanged aTmp( rPam, 0 ); SwDataChanged aTmp( rPam, 0 );
} }
@@ -1694,8 +1683,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
if( !IsIgnoreRedline() && GetRedlineTbl().Count() ) if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
DeleteRedline( rPam, true, USHRT_MAX ); DeleteRedline( rPam, true, USHRT_MAX );
// loesche und verschiebe erstmal alle "Fly's am Absatz", die in der // Delete and move all "Flys at the paragraph", which are within the Selection
// Selection liegen
DelFlyInRange(rPam.GetMark()->nNode, rPam.GetPoint()->nNode); DelFlyInRange(rPam.GetMark()->nNode, rPam.GetPoint()->nNode);
_DelBookmarks( _DelBookmarks(
pStt->nNode, pStt->nNode,
@@ -1713,13 +1701,13 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
SwTxtNode * pStartTxtNode( pCNd->GetTxtNode() ); SwTxtNode * pStartTxtNode( pCNd->GetTxtNode() );
if ( pStartTxtNode ) if ( pStartTxtNode )
{ {
// verschiebe jetzt noch den Inhalt in den neuen Node // now move the Content to the new Node
sal_Bool bOneNd = pStt->nNode == pEnd->nNode; sal_Bool bOneNd = pStt->nNode == pEnd->nNode;
xub_StrLen nLen = ( bOneNd ? pEnd->nContent.GetIndex() xub_StrLen nLen = ( bOneNd ? pEnd->nContent.GetIndex()
: pCNd->Len() ) : pCNd->Len() )
- pStt->nContent.GetIndex(); - pStt->nContent.GetIndex();
// falls schon leer, dann nicht noch aufrufen // Don't call again, if already empty
if( nLen ) if( nLen )
{ {
pStartTxtNode->EraseText( pStt->nContent, nLen ); pStartTxtNode->EraseText( pStt->nContent, nLen );
@@ -1731,15 +1719,15 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
} }
} }
if( bOneNd ) // das wars schon if( bOneNd ) // that's it
break; break;
aSttIdx++; aSttIdx++;
} }
else else
{ {
// damit beim loeschen keine Indizies mehr angemeldet sind, // So that there are no indices left registered when deleted,
// wird hier der SwPaM aus dem Content entfernt !! // we remove a SwPaM from the Content here.
pStt->nContent.Assign( 0, 0 ); pStt->nContent.Assign( 0, 0 );
} }
} }
@@ -1750,7 +1738,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
SwTxtNode * pEndTxtNode( pCNd->GetTxtNode() ); SwTxtNode * pEndTxtNode( pCNd->GetTxtNode() );
if( pEndTxtNode ) if( pEndTxtNode )
{ {
// falls schon leer, dann nicht noch aufrufen // if already empty, don't call again
if( pEnd->nContent.GetIndex() ) if( pEnd->nContent.GetIndex() )
{ {
SwIndex aIdx( pCNd, 0 ); SwIndex aIdx( pCNd, 0 );
@@ -1765,8 +1753,8 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
} }
else else
{ {
// damit beim Loeschen keine Indizies mehr angemeldet sind, // So that there are no indices left registered when deleted,
// wird hier der SwPaM aus dem Content entfernt !! // we remove a SwPaM from the Content here.
pEnd->nContent.Assign( 0, 0 ); pEnd->nContent.Assign( 0, 0 );
} }
} }
@@ -1778,18 +1766,18 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
if( aSttIdx != nEnde ) if( aSttIdx != nEnde )
{ {
// loesche jetzt die Nodes in das NodesArary // delete the Nodes into the NodesArary
GetNodes().Delete( aSttIdx, nEnde - aSttIdx.GetIndex() ); GetNodes().Delete( aSttIdx, nEnde - aSttIdx.GetIndex() );
} }
// falls der Node geloescht wurde, in dem der Cursor stand, so // If the Node that contained the Cursor has been deleted,
// muss der Content im akt. Content angemeldet werden !!! // the Content has to be assigned to the current Content.
pStt->nContent.Assign( pStt->nNode.GetNode().GetCntntNode(), pStt->nContent.Assign( pStt->nNode.GetNode().GetCntntNode(),
pStt->nContent.GetIndex() ); pStt->nContent.GetIndex() );
// der PaM wird korrigiert, denn falls ueber Nodegrenzen geloescht // If we deleted across Node boundaries we have to correct the PaM,
// wurde, so stehen sie in unterschieden Nodes. Auch die Selektion // because they are in different Nodes now.
// wird aufgehoben ! // Also, the Selection is revoked.
*pEnd = *pStt; *pEnd = *pStt;
rPam.DeleteMark(); rPam.DeleteMark();
@@ -1883,8 +1871,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
case ND_TEXTNODE: case ND_TEXTNODE:
if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( GetCurrentLayout() )) ) if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( GetCurrentLayout() )) )
{ {
// geschutze Cellen/Flys ueberspringen, ausgeblendete // skip protected and hidden Cells and Flys
//ebenfalls
if( pCntFrm->IsProtected() ) if( pCntFrm->IsProtected() )
{ {
nCurrNd = pNd->EndOfSectionIndex(); nCurrNd = pNd->EndOfSectionIndex();
@@ -1935,7 +1922,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
( pConvArgs && ( pConvArgs &&
((SwTxtNode*)pNd)->Convert( *pConvArgs ))) ((SwTxtNode*)pNd)->Convert( *pConvArgs )))
{ {
// Abbrechen und Position merken // Cancel and remember position
pSttPos->nNode = nCurrNd; pSttPos->nNode = nCurrNd;
pEndPos->nNode = nCurrNd; pEndPos->nNode = nCurrNd;
nCurrNd = nEndNd; nCurrNd = nEndNd;
@@ -2057,8 +2044,8 @@ SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCrsrPos,
: SwInterHyphInfo( rCrsrPos ), pNode(0), : SwInterHyphInfo( rCrsrPos ), pNode(0),
pPageCnt( pPageCount ), pPageSt( pPageStart ) pPageCnt( pPageCount ), pPageSt( pPageStart )
{ {
// Folgende Bedingungen muessen eingehalten werden: // The following constraints have to be met:
// 1) es gibt mindestens eine Selektion // 1) there is at least one Selection
// 2) SPoint() == Start() // 2) SPoint() == Start()
OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind"); OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind");
OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(), OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(),
@@ -2067,11 +2054,11 @@ SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCrsrPos,
const SwPosition *pPoint = pPam->GetPoint(); const SwPosition *pPoint = pPam->GetPoint();
nNode = pPoint->nNode.GetIndex(); nNode = pPoint->nNode.GetIndex();
// Start einstellen // Set start
pStart = pPoint->nNode.GetNode().GetTxtNode(); pStart = pPoint->nNode.GetNode().GetTxtNode();
nPamStart = pPoint->nContent.GetIndex(); nPamStart = pPoint->nContent.GetIndex();
// Ende und Laenge einstellen. // Set End and Length
const SwPosition *pMark = pPam->GetMark(); const SwPosition *pMark = pPam->GetMark();
pEnd = pMark->nNode.GetNode().GetTxtNode(); pEnd = pMark->nNode.GetNode().GetTxtNode();
nPamLen = pMark->nContent.GetIndex(); nPamLen = pMark->nContent.GetIndex();
@@ -2097,15 +2084,14 @@ void SwHyphArgs::SetPam( SwPaM *pPam ) const
pPam->GetMark()->nContent.Assign( pNode->GetCntntNode(), pPam->GetMark()->nContent.Assign( pNode->GetCntntNode(),
nWordStart + nWordLen ); nWordStart + nWordLen );
OSL_ENSURE( nNode == pNode->GetIndex(), OSL_ENSURE( nNode == pNode->GetIndex(),
"SwHyphArgs::SetPam: Pam desaster" ); "SwHyphArgs::SetPam: Pam disaster" );
} }
} }
// liefert sal_True zurueck, wenn es weitergehen soll. // Returns sal_True if we can proceed.
sal_Bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs ) sal_Bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs )
{ {
// Hyphenate liefert sal_True zurueck, wenn eine Trennstelle anliegt // Hyphenate returns sal_True, if there is a disconnection point and set pPam.
// und stellt pPam ein.
SwTxtNode *pNode = rpNd->GetTxtNode(); SwTxtNode *pNode = rpNd->GetTxtNode();
SwHyphArgs *pHyphArgs = (SwHyphArgs*)pArgs; SwHyphArgs *pHyphArgs = (SwHyphArgs*)pArgs;
if( pNode ) if( pNode )
@@ -2167,7 +2153,7 @@ sal_Bool lcl_GetTokenToParaBreak( String& rStr, String& rRet, sal_Bool bRegExpRp
RTL_CONSTASCII_STRINGPARAM( "\\n" ))); RTL_CONSTASCII_STRINGPARAM( "\\n" )));
while( STRING_NOTFOUND != ( nPos = rStr.Search( sPara, nPos )) ) while( STRING_NOTFOUND != ( nPos = rStr.Search( sPara, nPos )) )
{ {
// wurde das escaped? // Has this been escaped?
if( nPos && '\\' == rStr.GetChar( nPos-1 )) if( nPos && '\\' == rStr.GetChar( nPos-1 ))
{ {
if( ++nPos >= rStr.Len() ) if( ++nPos >= rStr.Len() )
@@ -2225,7 +2211,7 @@ bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr,
return ReplaceRangeImpl(rPam, rStr, bRegExReplace); // original pam! return ReplaceRangeImpl(rPam, rStr, bRegExReplace); // original pam!
} }
// N.B.: deletion must be split into several parts if the text node // Deletion must be split into several parts if the text node
// contains a text attribute with end and with dummy character // contains a text attribute with end and with dummy character
// and the selection does not contain the text attribute completely, // and the selection does not contain the text attribute completely,
// but overlaps its start (left), where the dummy character is. // but overlaps its start (left), where the dummy character is.
@@ -2266,7 +2252,7 @@ bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr,
return bRet; return bRet;
} }
// N.B.: it is possible to call Replace with a PaM that spans 2 paragraphs: // It's possible to call Replace with a PaM that spans 2 paragraphs:
// search with regex for "$", then replace _all_ // search with regex for "$", then replace _all_
bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr, bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
const bool bRegExReplace ) const bool bRegExReplace )
@@ -2278,9 +2264,9 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev ); lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev );
{ {
// dann eine Kopie vom Cursor erzeugen um alle Pams aus den // Create a copy of the Cursor in order to move all Pams from
// anderen Sichten aus dem Loeschbereich zu verschieben // the other views out of the deletion area.
// ABER NICHT SICH SELBST !! // Except for itself!
SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() ); ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
@@ -2292,7 +2278,7 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
"invalid range: Point and Mark on different nodes" ); "invalid range: Point and Mark on different nodes" );
sal_Bool bOneNode = pStt->nNode == pEnd->nNode; sal_Bool bOneNode = pStt->nNode == pEnd->nNode;
// eigenes Undo ???? // Own Undo?
String sRepl( rStr ); String sRepl( rStr );
SwTxtNode* pTxtNd = pStt->nNode.GetNode().GetTxtNode(); SwTxtNode* pTxtNd = pStt->nNode.GetNode().GetTxtNode();
xub_StrLen nStt = pStt->nContent.GetIndex(), xub_StrLen nStt = pStt->nContent.GetIndex(),
@@ -2309,10 +2295,10 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
{ {
GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
// Bug 68584 - if any Redline will change (split!) the node // If any Redline will change (split!) the node
const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
//JP 06.01.98: MUSS noch optimiert werden!!! // Needs to be optimised!
SetRedlineMode( SetRedlineMode(
(RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE )); (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ));
@@ -2327,7 +2313,7 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
if( sRepl.Len() ) if( sRepl.Len() )
{ {
// Attribute des 1. Zeichens ueber den ReplaceText setzen // Apply the first character's attributes to the ReplaceText
SfxItemSet aSet( GetAttrPool(), SfxItemSet aSet( GetAttrPool(),
RES_CHRATR_BEGIN, RES_TXTATR_WITHEND_END - 1, RES_CHRATR_BEGIN, RES_TXTATR_WITHEND_END - 1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
@@ -2344,7 +2330,7 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
if( aDelPam.GetPoint() != aDelPam.End() ) if( aDelPam.GetPoint() != aDelPam.End() )
aDelPam.Exchange(); aDelPam.Exchange();
// das Ende merken // Remember the End
SwNodeIndex aPtNd( aDelPam.GetPoint()->nNode, -1 ); SwNodeIndex aPtNd( aDelPam.GetPoint()->nNode, -1 );
xub_StrLen nPtCnt = aDelPam.GetPoint()->nContent.GetIndex(); xub_StrLen nPtCnt = aDelPam.GetPoint()->nContent.GetIndex();
@@ -2401,7 +2387,7 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
*aDelPam.GetPoint() = *rPam.GetPoint(); *aDelPam.GetPoint() = *rPam.GetPoint();
GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
// Bug 68584 - if any Redline will change (split!) the node // If any Redline will change (split!) the node
const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
SwIndex& rIdx = aDelPam.GetPoint()->nContent; SwIndex& rIdx = aDelPam.GetPoint()->nContent;
@@ -2410,8 +2396,8 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
rPam.GetPoint()->nNode = 0; rPam.GetPoint()->nNode = 0;
rPam.GetPoint()->nContent = rIdx; rPam.GetPoint()->nContent = rIdx;
*rPam.GetMark() = *rPam.GetPoint(); *rPam.GetMark() = *rPam.GetPoint();
//JP 06.01.98: MUSS noch optimiert werden!!! // Needs to be optimised!
SetRedlineMode( eOld ); SetRedlineMode( eOld );
*rPam.GetPoint() = pBkmk->GetMarkPos(); *rPam.GetPoint() = pBkmk->GetMarkPos();
if(pBkmk->IsExpanded()) if(pBkmk->IsExpanded())
@@ -2440,8 +2426,7 @@ SetRedlineMode( eOld );
SwNodeIndex aPtNd( pStt->nNode, -1 ); SwNodeIndex aPtNd( pStt->nNode, -1 );
xub_StrLen nPtCnt = pStt->nContent.GetIndex(); xub_StrLen nPtCnt = pStt->nContent.GetIndex();
// die Werte nochmal setzen, falls schohn Rahmen oder Fussnoten // Set the values again, if Frames or footnotes on the Text have been removed.
// auf dem Text entfernt wurden!
nStt = nPtCnt; nStt = nPtCnt;
nEnd = bOneNode ? pEnd->nContent.GetIndex() nEnd = bOneNode ? pEnd->nContent.GetIndex()
: pTxtNd->GetTxt().Len(); : pTxtNd->GetTxt().Len();
@@ -2500,8 +2485,7 @@ SetRedlineMode( eOld );
return true; return true;
} }
// speicher die akt. Werte fuer die automatische Aufnahme von Ausnahmen // Save the current values to add them as automatic entries to to AutoCorrect.
// in die Autokorrektur
void SwDoc::SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew ) void SwDoc::SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew )
{ {
if( pNew != pACEWord ) if( pNew != pACEWord )
@@ -2524,11 +2508,10 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
return sal_False; return sal_False;
} }
// harte SeitenUmbrueche am nachfolgenden Node verschieben // Move hard page brakes to the following Node.
sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False; sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False;
/* #i9185# This whould lead to a segmentation fault if not catched /* #i9185# This whould lead to a segmentation fault if not caught above. */
above. */
sal_uLong nNextNd = rEnd.nNode.GetIndex() + 1; sal_uLong nNextNd = rEnd.nNode.GetIndex() + 1;
SwTableNode *const pTblNd = GetNodes()[ nNextNd ]->GetTableNode(); SwTableNode *const pTblNd = GetNodes()[ nNextNd ]->GetTableNode();
@@ -2595,14 +2578,14 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
if( rPam.GetPoint() != &rEnd ) if( rPam.GetPoint() != &rEnd )
rPam.Exchange(); rPam.Exchange();
// versuche hinters Ende zu verschieben // Try to move past the End
if( !rPam.Move( fnMoveForward, fnGoNode ) ) if( !rPam.Move( fnMoveForward, fnGoNode ) )
{ {
// na gut, dann an den Anfang // Fair enough, at the Beginning then
rPam.Exchange(); rPam.Exchange();
if( !rPam.Move( fnMoveBackward, fnGoNode )) if( !rPam.Move( fnMoveBackward, fnGoNode ))
{ {
OSL_FAIL( "kein Node mehr vorhanden" ); OSL_FAIL( "no more Nodes" );
return sal_False; return sal_False;
} }
} }
@@ -2616,9 +2599,9 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True ); CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True );
} }
// was ist mit Fly's ?? // What's with Flys?
{ {
// stehen noch FlyFrames rum, loesche auch diese // If there are FlyFrames left, delete these too
for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n ) for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
{ {
SwFrmFmt* pFly = (*GetSpzFrmFmts())[n]; SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];