diff options
Diffstat (limited to 'sw/source/core/undo/untbl.cxx')
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 707 |
1 files changed, 367 insertions, 340 deletions
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index ccd35dbf064c..6029f6e7bfd0 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -28,12 +28,19 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <UndoTable.hxx> +#include <UndoRedline.hxx> +#include <UndoDelete.hxx> +#include <UndoSplitMove.hxx> +#include <UndoCore.hxx> #include <hintids.hxx> +#include <hints.hxx> #include <editeng/brkitem.hxx> #include <fmtornt.hxx> #include <fmtpdsc.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <editsh.hxx> #include <docary.hxx> #include <ndtxt.hxx> @@ -42,7 +49,6 @@ #include <cntfrm.hxx> #include <tblsel.hxx> #include <swundo.hxx> // fuer die UndoIds -#include <undobj.hxx> #include <rolbck.hxx> #include <ddefld.hxx> #include <tabcol.hxx> @@ -81,7 +87,6 @@ #define _DEBUG_REDLINE( pDoc ) lcl_DebugRedline( pDoc ); #endif -inline SwDoc& SwUndoIter::GetDoc() const { return *pAktPam->GetDoc(); } extern void ClearFEShellTabCols(); typedef SfxItemSet* SfxItemSetPtr; @@ -99,7 +104,7 @@ SV_DECL_PTRARR_DEL( SwTblToTxtSaves, SwTblToTxtSavePtr, 0, 10 ) struct _UndoTblCpyTbl_Entry { - ULONG nBoxIdx, nOffset; + sal_uLong nBoxIdx, nOffset; SfxItemSet* pBoxNumAttr; SwUndo* pUndo; @@ -124,25 +129,30 @@ class _SaveTable const SwTable* pSwTable; SfxItemSets aSets; SwFrmFmts aFrmFmts; - USHORT nLineCount; - BOOL bModifyBox : 1; - BOOL bSaveFormula : 1; - BOOL bNewModel : 1; + sal_uInt16 nLineCount; + sal_Bool bModifyBox : 1; + sal_Bool bSaveFormula : 1; + sal_Bool bNewModel : 1; public: - _SaveTable( const SwTable& rTbl, USHORT nLnCnt = USHRT_MAX, - BOOL bSaveFml = TRUE ); + _SaveTable( const SwTable& rTbl, sal_uInt16 nLnCnt = USHRT_MAX, + sal_Bool bSaveFml = sal_True ); ~_SaveTable(); +<<<<<<< local USHORT AddFmt( SwFrmFmt* pFmt, bool bIsLine ); void NewFrmFmt( const SwTableLine* , const SwTableBox*, USHORT nFmtPos, +======= + sal_uInt16 AddFmt( SwFrmFmt* pFmt, bool bIsLine ); + void NewFrmFmt( const SwClient* pLnBx, sal_Bool bIsLine, sal_uInt16 nFmtPos, +>>>>>>> other SwFrmFmt* pOldFmt ); - void RestoreAttr( SwTable& rTbl, BOOL bModifyBox = FALSE ); + void RestoreAttr( SwTable& rTbl, sal_Bool bModifyBox = sal_False ); void SaveCntntAttrs( SwDoc* pDoc ); - void CreateNew( SwTable& rTbl, BOOL bCreateFrms = TRUE, - BOOL bRestoreChart = TRUE ); - BOOL IsNewModel() const { return bNewModel; } + void CreateNew( SwTable& rTbl, sal_Bool bCreateFrms = sal_True, + sal_Bool bRestoreChart = sal_True ); + sal_Bool IsNewModel() const { return bNewModel; } }; class _SaveLine @@ -152,7 +162,7 @@ class _SaveLine _SaveLine* pNext; _SaveBox* pBox; - USHORT nItemSet; + sal_uInt16 nItemSet; public: @@ -170,9 +180,9 @@ class _SaveBox friend class _SaveLine; _SaveBox* pNext; - ULONG nSttNode; + sal_uLong nSttNode; long nRowSpan; - USHORT nItemSet; + sal_uInt16 nItemSet; union { SfxItemSets* pCntntAttrs; @@ -189,8 +199,8 @@ public: void CreateNew( SwTable& rTbl, SwTableLine& rParent, _SaveTable& rSTbl ); }; -void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos = 0 ); -void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos = 0 ); +void InsertSort( SvUShorts& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos = 0 ); +void InsertSort( SvULongs& rArr, sal_uLong nIdx, sal_uInt16* pInsPos = 0 ); #if defined( JP_DEBUG ) && defined(DBG_UTIL) #include "shellio.hxx" @@ -211,15 +221,15 @@ So we need to remember not only the start node position but the end node positio struct SwTblToTxtSave { - ULONG m_nSttNd; - ULONG m_nEndNd; + sal_uLong m_nSttNd; + sal_uLong m_nEndNd; xub_StrLen m_nCntnt; SwHistory* m_pHstry; // metadata references for first and last paragraph in cell ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart; ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd; - SwTblToTxtSave( SwDoc& rDoc, ULONG nNd, ULONG nEndIdx, xub_StrLen nCntnt ); + SwTblToTxtSave( SwDoc& rDoc, sal_uLong nNd, sal_uLong nEndIdx, xub_StrLen nCntnt ); ~SwTblToTxtSave() { delete m_pHstry; } }; @@ -229,7 +239,7 @@ SV_IMPL_PTRARR( SwUndoMoves, SwUndoMovePtr ) SV_IMPL_PTRARR( SwTblToTxtSaves, SwTblToTxtSavePtr ) SV_IMPL_PTRARR( _UndoTblCpyTbl_Entries, _UndoTblCpyTbl_EntryPtr ) -USHORT __FAR_DATA aSave_BoxCntntSet[] = { +sal_uInt16 __FAR_DATA aSave_BoxCntntSet[] = { RES_CHRATR_COLOR, RES_CHRATR_CROSSEDOUT, RES_CHRATR_FONT, RES_CHRATR_FONTSIZE, RES_CHRATR_POSTURE, RES_CHRATR_POSTURE, @@ -239,8 +249,8 @@ USHORT __FAR_DATA aSave_BoxCntntSet[] = { -SwUndoInsTbl::SwUndoInsTbl( const SwPosition& rPos, USHORT nCl, USHORT nRw, - USHORT nAdj, const SwInsertTableOptions& rInsTblOpts, +SwUndoInsTbl::SwUndoInsTbl( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt16 nRw, + sal_uInt16 nAdj, const SwInsertTableOptions& rInsTblOpts, const SwTableAutoFmt* pTAFmt, const SvUShorts* pColArr, const String & rName) @@ -276,9 +286,9 @@ SwUndoInsTbl::~SwUndoInsTbl() delete pAutoFmt; } -void SwUndoInsTbl::Undo( SwUndoIter& rUndoIter ) +void SwUndoInsTbl::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode ); SwTableNode* pTblNd = aIdx.GetNode().GetTableNode(); @@ -297,11 +307,11 @@ void SwUndoInsTbl::Undo( SwUndoIter& rUndoIter ) const SfxPoolItem *pItem; if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_PAGEDESC, - FALSE, &pItem ) ) + sal_False, &pItem ) ) pNextNd->SetAttr( *pItem ); if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_BREAK, - FALSE, &pItem ) ) + sal_False, &pItem ) ) pNextNd->SetAttr( *pItem ); } @@ -314,19 +324,18 @@ void SwUndoInsTbl::Undo( SwUndoIter& rUndoIter ) rDoc.GetNodes().Delete( aIdx, pTblNd->EndOfSectionIndex() - aIdx.GetIndex() + 1 ); - rUndoIter.pAktPam->DeleteMark(); - rUndoIter.pAktPam->GetPoint()->nNode = aIdx; - rUndoIter.pAktPam->GetPoint()->nContent.Assign( - rUndoIter.pAktPam->GetCntntNode(), 0 ); + SwPaM & rPam( rContext.GetCursorSupplier().CreateNewShellCursor() ); + rPam.DeleteMark(); + rPam.GetPoint()->nNode = aIdx; + rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), 0 ); } -void SwUndoInsTbl::Redo( SwUndoIter& rUndoIter ) +void SwUndoInsTbl::RedoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); - SwPosition aPos( *rUndoIter.pAktPam->GetPoint() ); - aPos.nNode = nSttNode; + SwPosition const aPos(SwNodeIndex(rDoc.GetNodes(), nSttNode)); const SwTable* pTbl = rDoc.InsertTable( aInsTblOpts, aPos, nRows, nCols, nAdjust, pAutoFmt, pColWidth ); @@ -347,7 +356,7 @@ void SwUndoInsTbl::Redo( SwUndoIter& rUndoIter ) rDoc.GetRedlineTbl().Count() )) { SwPaM aPam( *pTblNode->EndOfSectionNode(), *pTblNode, 1 ); - SwCntntNode* pCNd = aPam.GetCntntNode( FALSE ); + SwCntntNode* pCNd = aPam.GetCntntNode( sal_False ); if( pCNd ) aPam.GetMark()->nContent.Assign( pCNd, 0 ); @@ -365,11 +374,11 @@ void SwUndoInsTbl::Redo( SwUndoIter& rUndoIter ) } -void SwUndoInsTbl::Repeat( SwUndoIter& rUndoIter ) +void SwUndoInsTbl::RepeatImpl(::sw::RepeatContext & rContext) { - rUndoIter.GetDoc().InsertTable( aInsTblOpts, *rUndoIter.pAktPam->GetPoint(), - nRows, nCols, nAdjust, - pAutoFmt, pColWidth ); + rContext.GetDoc().InsertTable( + aInsTblOpts, *rContext.GetRepeatPaM().GetPoint(), + nRows, nCols, nAdjust, pAutoFmt, pColWidth ); } SwRewriter SwUndoInsTbl::GetRewriter() const @@ -385,7 +394,7 @@ SwRewriter SwUndoInsTbl::GetRewriter() const // ----------------------------------------------------- -SwTblToTxtSave::SwTblToTxtSave( SwDoc& rDoc, ULONG nNd, ULONG nEndIdx, xub_StrLen nCnt ) +SwTblToTxtSave::SwTblToTxtSave( SwDoc& rDoc, sal_uLong nNd, sal_uLong nEndIdx, xub_StrLen nCnt ) : m_nSttNd( nNd ), m_nEndNd( nEndIdx), m_nCntnt( nCnt ), m_pHstry( 0 ) { // Attributierung des gejointen Node merken. @@ -428,11 +437,11 @@ SwUndoTblToTxt::SwUndoTblToTxt( const SwTable& rTbl, sal_Unicode cCh ) : SwUndo( UNDO_TABLETOTEXT ), sTblNm( rTbl.GetFrmFmt()->GetName() ), pDDEFldType( 0 ), pHistory( 0 ), nSttNd( 0 ), nEndNd( 0 ), - nAdjust( static_cast<USHORT>(rTbl.GetFrmFmt()->GetHoriOrient().GetHoriOrient()) ), + nAdjust( static_cast<sal_uInt16>(rTbl.GetFrmFmt()->GetHoriOrient().GetHoriOrient()) ), cTrenner( cCh ), nHdlnRpt( rTbl.GetRowsToRepeat() ) { pTblSave = new _SaveTable( rTbl ); - pBoxSaves = new SwTblToTxtSaves( (BYTE)rTbl.GetTabSortBoxes().Count() ); + pBoxSaves = new SwTblToTxtSaves( (sal_uInt8)rTbl.GetTabSortBoxes().Count() ); if( rTbl.IsA( TYPE( SwDDETable ) ) ) pDDEFldType = (SwDDEFieldType*)((SwDDETable&)rTbl).GetDDEFldType()->Copy(); @@ -441,10 +450,10 @@ SwUndoTblToTxt::SwUndoTblToTxt( const SwTable& rTbl, sal_Unicode cCh ) pHistory = new SwHistory; const SwTableNode* pTblNd = rTbl.GetTableNode(); - ULONG nTblStt = pTblNd->GetIndex(), nTblEnd = pTblNd->EndOfSectionIndex(); + sal_uLong nTblStt = pTblNd->GetIndex(), nTblEnd = pTblNd->EndOfSectionIndex(); const SwSpzFrmFmts& rFrmFmtTbl = *pTblNd->GetDoc()->GetSpzFrmFmts(); - for( USHORT n = 0; n < rFrmFmtTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFrmFmtTbl.Count(); ++n ) { SwFrmFmt* pFmt = rFrmFmtTbl[ n ]; SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor(); @@ -474,10 +483,10 @@ SwUndoTblToTxt::~SwUndoTblToTxt() -void SwUndoTblToTxt::Undo( SwUndoIter& rUndoIter ) +void SwUndoTblToTxt::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); - SwPaM* pPam = rUndoIter.pAktPam; + SwDoc & rDoc = rContext.GetDoc(); + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); SwNodeIndex aFrmIdx( rDoc.GetNodes(), nSttNd ); SwNodeIndex aEndIdx( rDoc.GetNodes(), nEndNd ); @@ -506,20 +515,20 @@ void SwUndoTblToTxt::Undo( SwUndoIter& rUndoIter ) SwDDEFieldType* pNewType = (SwDDEFieldType*)rDoc.InsertFldType( *pDDEFldType); SwDDETable* pDDETbl = new SwDDETable( pTblNd->GetTable(), pNewType ); - pTblNd->SetNewTable( pDDETbl, FALSE ); // setze die DDE-Tabelle + pTblNd->SetNewTable( pDDETbl, sal_False ); // setze die DDE-Tabelle delete pDDEFldType, pDDEFldType = 0; } if( bCheckNumFmt ) { SwTableSortBoxes& rBxs = pTblNd->GetTable().GetTabSortBoxes(); - for( USHORT nBoxes = rBxs.Count(); nBoxes; ) - rDoc.ChkBoxNumFmt( *rBxs[ --nBoxes ], FALSE ); + for( sal_uInt16 nBoxes = rBxs.Count(); nBoxes; ) + rDoc.ChkBoxNumFmt( *rBxs[ --nBoxes ], sal_False ); } if( pHistory ) { - USHORT nTmpEnd = pHistory->GetTmpEnd(); + sal_uInt16 nTmpEnd = pHistory->GetTmpEnd(); pHistory->TmpRollback( &rDoc, 0 ); pHistory->SetTmpEnd( nTmpEnd ); } @@ -540,7 +549,7 @@ void SwUndoTblToTxt::Undo( SwUndoIter& rUndoIter ) } // steht im untbl.cxx und darf nur vom Undoobject gerufen werden -SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd, +SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd, const SwTblToTxtSaves& rSavedData ) { SwNodeIndex aSttIdx( *this, nSttNd ); @@ -555,7 +564,7 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd, Delete all Frames attached to the nodes in that range. */ SwNode* pNd; { - ULONG n, nTmpEnd = aEndIdx.GetIndex(); + sal_uLong n, nTmpEnd = aEndIdx.GetIndex(); for( n = pTblNd->GetIndex() + 1; n < nTmpEnd; ++n ) { if( ( pNd = (*this)[ n ] )->IsCntntNode() ) @@ -573,7 +582,7 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd, pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pLine, 0 ); SvULongs aBkmkArr( 0, 4 ); - for( USHORT n = rSavedData.Count(); n; ) + for( sal_uInt16 n = rSavedData.Count(); n; ) { SwTblToTxtSave* pSave = rSavedData[ --n ]; // if the start node was merged with last from prev. cell, @@ -617,7 +626,7 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd, if( pSave->m_pHstry ) { - USHORT nTmpEnd = pSave->m_pHstry->GetTmpEnd(); + sal_uInt16 nTmpEnd = pSave->m_pHstry->GetTmpEnd(); pSave->m_pHstry->TmpRollback( GetDoc(), 0 ); pSave->m_pHstry->SetTmpEnd( nTmpEnd ); } @@ -639,7 +648,7 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd, pSttNd->pStartOfSection = pTblNd; new SwEndNode( aEndIdx, *pSttNd ); - for( ULONG i = aSttIdx.GetIndex(); i < aEndIdx.GetIndex()-1; ++i ) + for( sal_uLong i = aSttIdx.GetIndex(); i < aEndIdx.GetIndex()-1; ++i ) { pNd = (*this)[ i ]; pNd->pStartOfSection = pSttNd; @@ -654,11 +663,10 @@ SwTableNode* SwNodes::UndoTableToText( ULONG nSttNd, ULONG nEndNd, } -void SwUndoTblToTxt::Redo( SwUndoIter& rUndoIter ) +void SwUndoTblToTxt::RedoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); - SwPaM* pPam = rUndoIter.pAktPam; - + SwDoc & rDoc = rContext.GetDoc(); + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->GetPoint()->nNode = nSttNd; pPam->GetPoint()->nContent.Assign( 0, 0 ); @@ -681,7 +689,7 @@ void SwUndoTblToTxt::Redo( SwUndoIter& rUndoIter ) if( !pCNd && 0 == ( pCNd = rDoc.GetNodes().GoNext( &aSaveIdx ) ) && 0 == ( pCNd = rDoc.GetNodes().GoPrevious( &aSaveIdx )) ) { - ASSERT( FALSE, "wo steht denn nun der TextNode" ); + ASSERT( sal_False, "wo steht denn nun der TextNode" ); } pPam->GetPoint()->nNode = aSaveIdx; @@ -692,19 +700,19 @@ void SwUndoTblToTxt::Redo( SwUndoIter& rUndoIter ) } -void SwUndoTblToTxt::Repeat( SwUndoIter& rUndoIter ) +void SwUndoTblToTxt::RepeatImpl(::sw::RepeatContext & rContext) { - SwTableNode* pTblNd = rUndoIter.pAktPam->GetNode()->FindTableNode(); + SwPaM *const pPam = & rContext.GetRepeatPaM(); + SwTableNode *const pTblNd = pPam->GetNode()->FindTableNode(); if( pTblNd ) { - // bewege den Cursor aus der Tabelle - SwPaM* pPam = rUndoIter.pAktPam; + // move cursor out of table pPam->GetPoint()->nNode = *pTblNd->EndOfSectionNode(); pPam->Move( fnMoveForward, fnGoCntnt ); pPam->SetMark(); pPam->DeleteMark(); - rUndoIter.GetDoc().TableToText( pTblNd, cTrenner ); + rContext.GetDoc().TableToText( pTblNd, cTrenner ); } } @@ -714,7 +722,7 @@ void SwUndoTblToTxt::SetRange( const SwNodeRange& rRg ) nEndNd = rRg.aEnd.GetIndex(); } -void SwUndoTblToTxt::AddBoxPos( SwDoc& rDoc, ULONG nNdIdx, ULONG nEndIdx, xub_StrLen nCntntIdx ) +void SwUndoTblToTxt::AddBoxPos( SwDoc& rDoc, sal_uLong nNdIdx, sal_uLong nEndIdx, xub_StrLen nCntntIdx ) { SwTblToTxtSave* pNew = new SwTblToTxtSave( rDoc, nNdIdx, nEndIdx, nCntntIdx ); pBoxSaves->Insert( pNew, pBoxSaves->Count() ); @@ -724,7 +732,7 @@ void SwUndoTblToTxt::AddBoxPos( SwDoc& rDoc, ULONG nNdIdx, ULONG nEndIdx, xub_St SwUndoTxtToTbl::SwUndoTxtToTbl( const SwPaM& rRg, const SwInsertTableOptions& rInsTblOpts, - sal_Unicode cCh, USHORT nAdj, + sal_Unicode cCh, sal_uInt16 nAdj, const SwTableAutoFmt* pAFmt ) : SwUndo( UNDO_TEXTTOTABLE ), SwUndRng( rRg ), aInsTblOpts( rInsTblOpts ), pDelBoxes( 0 ), pAutoFmt( 0 ), @@ -746,16 +754,16 @@ SwUndoTxtToTbl::~SwUndoTxtToTbl() delete pAutoFmt; } -void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) +void SwUndoTxtToTbl::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); - ULONG nTblNd = nSttNode; + sal_uLong nTblNd = nSttNode; if( nSttCntnt ) ++nTblNd; // Node wurde vorher gesplittet SwNodeIndex aIdx( rDoc.GetNodes(), nTblNd ); - SwTableNode* pTNd = rDoc.GetNodes()[ aIdx ]->GetTableNode(); - ASSERT( pTNd, "keinen Tabellen-Node gefunden" ); + SwTableNode *const pTNd = aIdx.GetNode().GetTableNode(); + OSL_ENSURE( pTNd, "SwUndoTxtToTbl: no TableNode" ); RemoveIdxFromSection( rDoc, nTblNd ); @@ -770,11 +778,11 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) if( pDelBoxes ) { SwTable& rTbl = pTNd->GetTable(); - for( USHORT n = pDelBoxes->Count(); n; ) + for( sal_uInt16 n = pDelBoxes->Count(); n; ) { SwTableBox* pBox = rTbl.GetTblBox( (*pDelBoxes)[ --n ] ); if( pBox ) - ::_DeleteBox( rTbl, pBox, 0, FALSE, FALSE ); + ::_DeleteBox( rTbl, pBox, 0, sal_False, sal_False ); else { ASSERT( !this, "Wo ist die Box geblieben?" ); } @@ -784,15 +792,16 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) SwNodeIndex aEndIdx( *pTNd->EndOfSectionNode() ); rDoc.TableToText( pTNd, 0x0b == cTrenner ? 0x09 : cTrenner ); - // am Start wieder zusammenfuegen ? - SwPosition* pPos = rUndoIter.pAktPam->GetPoint(); + // join again at start? + SwPaM aPam(rDoc.GetNodes().GetEndOfContent()); + SwPosition *const pPos = aPam.GetPoint(); if( nSttCntnt ) { pPos->nNode = nTblNd; - pPos->nContent.Assign( rDoc.GetNodes()[ pPos->nNode ]->GetCntntNode(), 0 ); - if( rUndoIter.pAktPam->Move( fnMoveBackward, fnGoCntnt)) + pPos->nContent.Assign(pPos->nNode.GetNode().GetCntntNode(), 0); + if (aPam.Move(fnMoveBackward, fnGoCntnt)) { - SwNodeIndex& rIdx = rUndoIter.pAktPam->GetPoint()->nNode; + SwNodeIndex & rIdx = aPam.GetPoint()->nNode; // dann die Crsr/etc. nochmal relativ verschieben RemoveIdxRel( rIdx.GetIndex()+1, *pPos ); @@ -801,7 +810,7 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) } } - // am Ende wieder zusammenfuegen ? + // join again at end? if( bSplitEnd ) { SwNodeIndex& rIdx = pPos->nNode; @@ -809,8 +818,8 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) SwTxtNode* pTxtNd = rIdx.GetNode().GetTxtNode(); if( pTxtNd && pTxtNd->CanJoinNext() ) { - rUndoIter.pAktPam->GetMark()->nContent.Assign( 0, 0 ); - rUndoIter.pAktPam->GetPoint()->nContent.Assign( 0, 0 ); + aPam.GetMark()->nContent.Assign( 0, 0 ); + aPam.GetPoint()->nContent.Assign( 0, 0 ); // dann die Crsr/etc. nochmal relativ verschieben pPos->nContent.Assign( pTxtNd, pTxtNd->GetTxt().Len() ); @@ -820,30 +829,31 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter ) } } - SetPaM( rUndoIter ); // manipulierten Bereich selectieren + AddUndoRedoPaM(rContext); } -void SwUndoTxtToTbl::Redo( SwUndoIter& rUndoIter ) +void SwUndoTxtToTbl::RedoImpl(::sw::UndoRedoContext & rContext) { - SetPaM( rUndoIter ); - RemoveIdxFromRange( *rUndoIter.pAktPam, FALSE ); - SetPaM( rUndoIter ); + SwPaM & rPam( AddUndoRedoPaM(rContext) ); + RemoveIdxFromRange(rPam, false); + SetPaM(rPam); - const SwTable* pTable = rUndoIter.GetDoc().TextToTable( - aInsTblOpts, *rUndoIter.pAktPam, cTrenner, - nAdjust, pAutoFmt ); + SwTable const*const pTable = rContext.GetDoc().TextToTable( + aInsTblOpts, rPam, cTrenner, nAdjust, pAutoFmt ); ((SwFrmFmt*)pTable->GetFrmFmt())->SetName( sTblNm ); } -void SwUndoTxtToTbl::Repeat( SwUndoIter& rUndoIter ) +void SwUndoTxtToTbl::RepeatImpl(::sw::RepeatContext & rContext) { - // keine TABLE IN TABLE - if( !rUndoIter.pAktPam->GetNode()->FindTableNode() ) - rUndoIter.GetDoc().TextToTable( aInsTblOpts, *rUndoIter.pAktPam, + // no Table In Table + if (!rContext.GetRepeatPaM().GetNode()->FindTableNode()) + { + rContext.GetDoc().TextToTable( aInsTblOpts, rContext.GetRepeatPaM(), cTrenner, nAdjust, pAutoFmt ); + } } void SwUndoTxtToTbl::AddFillBox( const SwTableBox& rBox ) @@ -862,8 +872,8 @@ SwHistory& SwUndoTxtToTbl::GetHistory() // ----------------------------------------------------- -SwUndoTblHeadline::SwUndoTblHeadline( const SwTable& rTbl, USHORT nOldHdl, - USHORT nNewHdl ) +SwUndoTblHeadline::SwUndoTblHeadline( const SwTable& rTbl, sal_uInt16 nOldHdl, + sal_uInt16 nNewHdl ) : SwUndo( UNDO_TABLEHEADLINE ), nOldHeadline( nOldHdl ), nNewHeadline( nNewHdl ) @@ -875,20 +885,18 @@ SwUndoTblHeadline::SwUndoTblHeadline( const SwTable& rTbl, USHORT nOldHdl, nTblNd = pSttNd->StartOfSectionIndex(); } - -void SwUndoTblHeadline::Undo( SwUndoIter& rUndoIter ) +void SwUndoTblHeadline::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwTableNode* pTNd = rDoc.GetNodes()[ nTblNd ]->GetTableNode(); ASSERT( pTNd, "keinen Tabellen-Node gefunden" ); rDoc.SetRowsToRepeat( pTNd->GetTable(), nOldHeadline ); } - -void SwUndoTblHeadline::Redo( SwUndoIter& rUndoIter ) +void SwUndoTblHeadline::RedoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwTableNode* pTNd = rDoc.GetNodes()[ nTblNd ]->GetTableNode(); ASSERT( pTNd, "keinen Tabellen-Node gefunden" ); @@ -896,24 +904,25 @@ void SwUndoTblHeadline::Redo( SwUndoIter& rUndoIter ) rDoc.SetRowsToRepeat( pTNd->GetTable(), nNewHeadline ); } - -void SwUndoTblHeadline::Repeat( SwUndoIter& rUndoIter ) +void SwUndoTblHeadline::RepeatImpl(::sw::RepeatContext & rContext) { - SwTableNode* pTblNd = rUndoIter.pAktPam->GetNode()->FindTableNode(); + SwTableNode *const pTblNd = + rContext.GetRepeatPaM().GetNode()->FindTableNode(); if( pTblNd ) - rUndoIter.GetDoc().SetRowsToRepeat( pTblNd->GetTable(), nNewHeadline ); + { + rContext.GetDoc().SetRowsToRepeat( pTblNd->GetTable(), nNewHeadline ); + } } -/* */ - +////////////////////////////////////////////////////////////////////////// -_SaveTable::_SaveTable( const SwTable& rTbl, USHORT nLnCnt, BOOL bSaveFml ) +_SaveTable::_SaveTable( const SwTable& rTbl, sal_uInt16 nLnCnt, sal_Bool bSaveFml ) : aTblSet( *rTbl.GetFrmFmt()->GetAttrSet().GetPool(), aTableSetRange ), pSwTable( &rTbl ), nLineCount( nLnCnt ), bSaveFormula( bSaveFml ) { - bModifyBox = FALSE; + bModifyBox = sal_False; bNewModel = rTbl.IsNewModel(); aTblSet.Put( rTbl.GetFrmFmt()->GetAttrSet() ); pLine = new _SaveLine( 0, *rTbl.GetTabLines()[ 0 ], *this ); @@ -921,7 +930,7 @@ _SaveTable::_SaveTable( const SwTable& rTbl, USHORT nLnCnt, BOOL bSaveFml ) _SaveLine* pLn = pLine; if( USHRT_MAX == nLnCnt ) nLnCnt = rTbl.GetTabLines().Count(); - for( USHORT n = 1; n < nLnCnt; ++n ) + for( sal_uInt16 n = 1; n < nLnCnt; ++n ) pLn = new _SaveLine( pLn, *rTbl.GetTabLines()[ n ], *this ); aFrmFmts.Remove( 0, aFrmFmts.Count() ); @@ -935,9 +944,9 @@ _SaveTable::~_SaveTable() } -USHORT _SaveTable::AddFmt( SwFrmFmt* pFmt, bool bIsLine ) +sal_uInt16 _SaveTable::AddFmt( SwFrmFmt* pFmt, bool bIsLine ) { - USHORT nRet = aFrmFmts.GetPos( pFmt ); + sal_uInt16 nRet = aFrmFmts.GetPos( pFmt ); if( USHRT_MAX == nRet ) { // Kopie vom ItemSet anlegen @@ -949,7 +958,7 @@ USHORT _SaveTable::AddFmt( SwFrmFmt* pFmt, bool bIsLine ) // errechnet werden! //JP 30.07.98: Bug 54295 - Formeln immer im Klartext speichern const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pSet->GetItemState( RES_BOXATR_FORMULA, TRUE, &pItem )) + if( SFX_ITEM_SET == pSet->GetItemState( RES_BOXATR_FORMULA, sal_True, &pItem )) { pSet->ClearItem( RES_BOXATR_VALUE ); if( pSwTable && bSaveFormula ) @@ -968,9 +977,9 @@ USHORT _SaveTable::AddFmt( SwFrmFmt* pFmt, bool bIsLine ) } -void _SaveTable::RestoreAttr( SwTable& rTbl, BOOL bMdfyBox ) +void _SaveTable::RestoreAttr( SwTable& rTbl, sal_Bool bMdfyBox ) { - USHORT n; + sal_uInt16 n; bModifyBox = bMdfyBox; @@ -983,7 +992,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, BOOL bMdfyBox ) if( pFmt->IsInCache() ) { SwFrm::GetCache().Delete( pFmt ); - pFmt->SetInCache( FALSE ); + pFmt->SetInCache( sal_False ); } // zur Sicherheit alle Tableframes invalidieren @@ -1000,7 +1009,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, BOOL bMdfyBox ) for( n = aSets.Count(); n; --n ) aFrmFmts.Insert( pFmt, aFrmFmts.Count() ); - USHORT nLnCnt = nLineCount; + sal_uInt16 nLnCnt = nLineCount; if( USHRT_MAX == nLnCnt ) nLnCnt = rTbl.GetTabLines().Count(); @@ -1017,7 +1026,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, BOOL bMdfyBox ) } aFrmFmts.Remove( 0, aFrmFmts.Count() ); - bModifyBox = FALSE; + bModifyBox = sal_False; } @@ -1027,10 +1036,10 @@ void _SaveTable::SaveCntntAttrs( SwDoc* pDoc ) } -void _SaveTable::CreateNew( SwTable& rTbl, BOOL bCreateFrms, - BOOL bRestoreChart ) +void _SaveTable::CreateNew( SwTable& rTbl, sal_Bool bCreateFrms, + sal_Bool bRestoreChart ) { - USHORT n; + sal_uInt16 n; _FndBox aTmpBox( 0, 0 ); //if( bRestoreChart ) @@ -1046,7 +1055,7 @@ void _SaveTable::CreateNew( SwTable& rTbl, BOOL bCreateFrms, if( pFmt->IsInCache() ) { SwFrm::GetCache().Delete( pFmt ); - pFmt->SetInCache( FALSE ); + pFmt->SetInCache( sal_False ); } // SwTableBox muss ein Format haben!! @@ -1061,7 +1070,7 @@ void _SaveTable::CreateNew( SwTable& rTbl, BOOL bCreateFrms, aFrmFmts.Remove( 0, aFrmFmts.Count() ); // die neuen Lines eintragen, die alten loeschen - USHORT nOldLines = nLineCount; + sal_uInt16 nOldLines = nLineCount; if( USHRT_MAX == nLineCount ) nOldLines = rTbl.GetTabLines().Count(); @@ -1077,8 +1086,8 @@ void _SaveTable::CreateNew( SwTable& rTbl, BOOL bCreateFrms, // TL_CHART2: notify chart about boxes to be removed const SwTableBoxes &rBoxes = pOld->GetTabBoxes(); - USHORT nBoxes = rBoxes.Count(); - for (USHORT k = 0; k < nBoxes; ++k) + sal_uInt16 nBoxes = rBoxes.Count(); + for (sal_uInt16 k = 0; k < nBoxes; ++k) { SwTableBox *pBox = rBoxes[k]; if (pPCD) @@ -1096,11 +1105,11 @@ void _SaveTable::CreateNew( SwTable& rTbl, BOOL bCreateFrms, { // remove remaining lines... - for (USHORT k1 = 0; k1 < nOldLines - n; ++k1) + for (sal_uInt16 k1 = 0; k1 < nOldLines - n; ++k1) { const SwTableBoxes &rBoxes = rTbl.GetTabLines()[n + k1]->GetTabBoxes(); - USHORT nBoxes = rBoxes.Count(); - for (USHORT k2 = 0; k2 < nBoxes; ++k2) + sal_uInt16 nBoxes = rBoxes.Count(); + for (sal_uInt16 k2 = 0; k2 < nBoxes; ++k2) { SwTableBox *pBox = rBoxes[k2]; // TL_CHART2: notify chart about boxes to be removed @@ -1124,8 +1133,13 @@ void _SaveTable::CreateNew( SwTable& rTbl, BOOL bCreateFrms, } +<<<<<<< local void _SaveTable::NewFrmFmt( const SwTableLine* pTblLn, const SwTableBox* pTblBx, USHORT nFmtPos, SwFrmFmt* pOldFmt ) +======= +void _SaveTable::NewFrmFmt( const SwClient* pLnBx, sal_Bool bIsLine, + sal_uInt16 nFmtPos, SwFrmFmt* pOldFmt ) +>>>>>>> other { SwDoc* pDoc = pOldFmt->GetDoc(); @@ -1152,7 +1166,7 @@ void _SaveTable::NewFrmFmt( const SwTableLine* pTblLn, const SwTableBox* pTblBx, pLast->ReinitializeFrmSizeAttrFlags(); if ( !pTblLn ) { - ((SwCellFrm*)pLast)->SetDerivedVert( FALSE ); + ((SwCellFrm*)pLast)->SetDerivedVert( sal_False ); ((SwCellFrm*)pLast)->CheckDirChange(); } } @@ -1188,7 +1202,7 @@ _SaveLine::_SaveLine( _SaveLine* pPrev, const SwTableLine& rLine, _SaveTable& rS pBox = new _SaveBox( 0, *rLine.GetTabBoxes()[ 0 ], rSTbl ); _SaveBox* pBx = pBox; - for( USHORT n = 1; n < rLine.GetTabBoxes().Count(); ++n ) + for( sal_uInt16 n = 1; n < rLine.GetTabBoxes().Count(); ++n ) pBx = new _SaveBox( pBx, *rLine.GetTabBoxes()[ n ], rSTbl ); } @@ -1202,10 +1216,14 @@ _SaveLine::~_SaveLine() void _SaveLine::RestoreAttr( SwTableLine& rLine, _SaveTable& rSTbl ) { +<<<<<<< local rSTbl.NewFrmFmt( &rLine, 0, nItemSet, rLine.GetFrmFmt() ); +======= + rSTbl.NewFrmFmt( &rLine, sal_True, nItemSet, rLine.GetFrmFmt() ); +>>>>>>> other _SaveBox* pBx = pBox; - for( USHORT n = 0; n < rLine.GetTabBoxes().Count(); ++n, pBx = pBx->pNext ) + for( sal_uInt16 n = 0; n < rLine.GetTabBoxes().Count(); ++n, pBx = pBx->pNext ) { if( !pBx ) { @@ -1274,7 +1292,7 @@ _SaveBox::_SaveBox( _SaveBox* pPrev, const SwTableBox& rBox, _SaveTable& rSTbl ) Ptrs.pLine = new _SaveLine( 0, *rBox.GetTabLines()[ 0 ], rSTbl ); _SaveLine* pLn = Ptrs.pLine; - for( USHORT n = 1; n < rBox.GetTabLines().Count(); ++n ) + for( sal_uInt16 n = 1; n < rBox.GetTabLines().Count(); ++n ) pLn = new _SaveLine( pLn, *rBox.GetTabLines()[ n ], rSTbl ); } } @@ -1292,7 +1310,11 @@ _SaveBox::~_SaveBox() void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) { +<<<<<<< local rSTbl.NewFrmFmt( 0, &rBox, nItemSet, rBox.GetFrmFmt() ); +======= + rSTbl.NewFrmFmt( &rBox, sal_False, nItemSet, rBox.GetFrmFmt() ); +>>>>>>> other if( ULONG_MAX == nSttNode ) // keine EndBox { @@ -1303,7 +1325,7 @@ void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) else { _SaveLine* pLn = Ptrs.pLine; - for( USHORT n = 0; n < rBox.GetTabLines().Count(); ++n, pLn = pLn->pNext ) + for( sal_uInt16 n = 0; n < rBox.GetTabLines().Count(); ++n, pLn = pLn->pNext ) { if( !pLn ) { @@ -1320,9 +1342,9 @@ void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) if( Ptrs.pCntntAttrs ) { SwNodes& rNds = rBox.GetFrmFmt()->GetDoc()->GetNodes(); - USHORT nSet = 0; - ULONG nEnd = rBox.GetSttNd()->EndOfSectionIndex(); - for( ULONG n = nSttNode + 1; n < nEnd; ++n ) + sal_uInt16 nSet = 0; + sal_uLong nEnd = rBox.GetSttNd()->EndOfSectionIndex(); + for( sal_uLong n = nSttNode + 1; n < nEnd; ++n ) { SwCntntNode* pCNd = rNds[ n ]->GetCntntNode(); if( pCNd ) @@ -1330,7 +1352,7 @@ void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl ) SfxItemSet* pSet = (*Ptrs.pCntntAttrs)[ nSet++ ]; if( pSet ) { - USHORT *pRstAttr = aSave_BoxCntntSet; + sal_uInt16 *pRstAttr = aSave_BoxCntntSet; while( *pRstAttr ) { pCNd->ResetAttr( *pRstAttr, *(pRstAttr+1) ); @@ -1360,9 +1382,9 @@ void _SaveBox::SaveCntntAttrs( SwDoc* pDoc ) } else { - ULONG nEnd = pDoc->GetNodes()[ nSttNode ]->EndOfSectionIndex(); - Ptrs.pCntntAttrs = new SfxItemSets( (BYTE)(nEnd - nSttNode - 1 ), 5 ); - for( ULONG n = nSttNode + 1; n < nEnd; ++n ) + sal_uLong nEnd = pDoc->GetNodes()[ nSttNode ]->EndOfSectionIndex(); + Ptrs.pCntntAttrs = new SfxItemSets( (sal_uInt8)(nEnd - nSttNode - 1 ), 5 ); + for( sal_uLong n = nSttNode + 1; n < nEnd; ++n ) { SwCntntNode* pCNd = pDoc->GetNodes()[ n ]->GetCntntNode(); if( pCNd ) @@ -1428,12 +1450,12 @@ void _SaveBox::CreateNew( SwTable& rTbl, SwTableLine& rParent, _SaveTable& rSTbl } -/* */ +////////////////////////////////////////////////////////////////////////// // UndoObject fuer Attribut Aenderung an der Tabelle -SwUndoAttrTbl::SwUndoAttrTbl( const SwTableNode& rTblNd, BOOL bClearTabCols ) +SwUndoAttrTbl::SwUndoAttrTbl( const SwTableNode& rTblNd, sal_Bool bClearTabCols ) : SwUndo( UNDO_TABLE_ATTR ), nSttNode( rTblNd.GetIndex() ) { @@ -1441,17 +1463,14 @@ SwUndoAttrTbl::SwUndoAttrTbl( const SwTableNode& rTblNd, BOOL bClearTabCols ) pSaveTbl = new _SaveTable( rTblNd.GetTable() ); } - SwUndoAttrTbl::~SwUndoAttrTbl() { delete pSaveTbl; } - - -void SwUndoAttrTbl::Undo( SwUndoIter& rUndoIter ) +void SwUndoAttrTbl::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwTableNode* pTblNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode(); ASSERT( pTblNd, "kein TabellenNode" ); @@ -1467,14 +1486,13 @@ void SwUndoAttrTbl::Undo( SwUndoIter& rUndoIter ) ClearFEShellTabCols(); } - -void SwUndoAttrTbl::Redo( SwUndoIter& rUndoIter ) +void SwUndoAttrTbl::RedoImpl(::sw::UndoRedoContext & rContext) { - Undo( rUndoIter ); + UndoImpl(rContext); } -/* */ +////////////////////////////////////////////////////////////////////////// // UndoObject fuer AutoFormat an der Tabelle @@ -1482,8 +1500,8 @@ void SwUndoAttrTbl::Redo( SwUndoIter& rUndoIter ) SwUndoTblAutoFmt::SwUndoTblAutoFmt( const SwTableNode& rTblNd, const SwTableAutoFmt& rAFmt ) : SwUndo( UNDO_TABLE_AUTOFMT ), - nSttNode( rTblNd.GetIndex() ), pUndos( 0 ), - bSaveCntntAttr( FALSE ) + nSttNode( rTblNd.GetIndex() ), + bSaveCntntAttr( sal_False ) { pSaveTbl = new _SaveTable( rTblNd.GetTable() ); @@ -1492,29 +1510,26 @@ SwUndoTblAutoFmt::SwUndoTblAutoFmt( const SwTableNode& rTblNd, // dann auch noch ueber die ContentNodes der EndBoxen und // und alle Absatz-Attribute zusammen sammeln pSaveTbl->SaveCntntAttrs( (SwDoc*)rTblNd.GetDoc() ); - bSaveCntntAttr = TRUE; + bSaveCntntAttr = sal_True; } } - SwUndoTblAutoFmt::~SwUndoTblAutoFmt() { - delete pUndos; delete pSaveTbl; } void SwUndoTblAutoFmt::SaveBoxCntnt( const SwTableBox& rBox ) { - SwUndoTblNumFmt* p = new SwUndoTblNumFmt( rBox ); - if( !pUndos ) - pUndos = new SwUndos( 8, 8 ); - pUndos->Insert( p, pUndos->Count() ); + ::boost::shared_ptr<SwUndoTblNumFmt> const p(new SwUndoTblNumFmt(rBox)); + m_Undos.push_back(p); } -void SwUndoTblAutoFmt::UndoRedo( BOOL bUndo, SwUndoIter& rUndoIter ) +void +SwUndoTblAutoFmt::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwTableNode* pTblNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode(); ASSERT( pTblNd, "kein TabellenNode" ); @@ -1524,37 +1539,39 @@ void SwUndoTblAutoFmt::UndoRedo( BOOL bUndo, SwUndoIter& rUndoIter ) if( bSaveCntntAttr ) pOrig->SaveCntntAttrs( &rDoc ); - if( pUndos && bUndo ) - for( USHORT n = pUndos->Count(); n; ) - pUndos->GetObject( --n )->Undo( rUndoIter ); + if (bUndo) + { + for (size_t n = m_Undos.size(); 0 < n; --n) + { + m_Undos.at(n-1)->UndoImpl(rContext); + } + } pSaveTbl->RestoreAttr( pTblNd->GetTable(), !bUndo ); delete pSaveTbl; pSaveTbl = pOrig; } -void SwUndoTblAutoFmt::Undo( SwUndoIter& rUndoIter ) +void SwUndoTblAutoFmt::UndoImpl(::sw::UndoRedoContext & rContext) { - UndoRedo( TRUE, rUndoIter ); + UndoRedo(true, rContext); } - -void SwUndoTblAutoFmt::Redo( SwUndoIter& rUndoIter ) +void SwUndoTblAutoFmt::RedoImpl(::sw::UndoRedoContext & rContext) { - UndoRedo( FALSE, rUndoIter ); + UndoRedo(false, rContext); } -/* */ - +////////////////////////////////////////////////////////////////////////// SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction, const SwSelBoxes& rBoxes, const SwTableNode& rTblNd, long nMn, long nMx, - USHORT nCnt, BOOL bFlg, BOOL bSmHght ) + sal_uInt16 nCnt, sal_Bool bFlg, sal_Bool bSmHght ) : SwUndo( nAction ), - aBoxes( rBoxes.Count() < 255 ? (BYTE)rBoxes.Count() : 255, 10 ), + aBoxes( rBoxes.Count() < 255 ? (sal_uInt8)rBoxes.Count() : 255, 10 ), nMin( nMn ), nMax( nMx ), nSttNode( rTblNd.GetIndex() ), nCurrBox( 0 ), nCount( nCnt ), nRelDiff( 0 ), nAbsDiff( 0 ), @@ -1568,7 +1585,7 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction, pSaveTbl = new _SaveTable( rTbl ); // und die Selektion merken - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) aBoxes.Insert( rBoxes[n]->GetSttIdx(), n ); } @@ -1577,13 +1594,13 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction, const SwSelBoxes& rBoxes, const SwTableNode& rTblNd ) : SwUndo( nAction ), - aBoxes( rBoxes.Count() < 255 ? (BYTE)rBoxes.Count() : 255, 10 ), + aBoxes( rBoxes.Count() < 255 ? (sal_uInt8)rBoxes.Count() : 255, 10 ), nMin( 0 ), nMax( 0 ), nSttNode( rTblNd.GetIndex() ), nCurrBox( 0 ), nCount( 0 ), nRelDiff( 0 ), nAbsDiff( 0 ), nSetColType( USHRT_MAX ), - bFlag( FALSE ), - bSameHeight( FALSE ) + bFlag( sal_False ), + bSameHeight( sal_False ) { Ptrs.pNewSttNds = 0; @@ -1591,7 +1608,7 @@ SwUndoTblNdsChg::SwUndoTblNdsChg( SwUndoId nAction, pSaveTbl = new _SaveTable( rTbl ); // und die Selektion merken - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) aBoxes.Insert( rBoxes[n]->GetSttIdx(), n ); } @@ -1600,7 +1617,7 @@ void SwUndoTblNdsChg::ReNewBoxes( const SwSelBoxes& rBoxes ) if( rBoxes.Count() != aBoxes.Count() ) { aBoxes.Remove( 0, aBoxes.Count() ); - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) aBoxes.Insert( rBoxes[n]->GetSttIdx(), n ); } } @@ -1620,11 +1637,11 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, { const SwTable& rTbl = rTblNd.GetTable(); const SwTableSortBoxes& rTblBoxes = rTbl.GetTabSortBoxes(); - USHORT n; - USHORT i; + sal_uInt16 n; + sal_uInt16 i; ASSERT( ! IsDelBox(), "falsche Action" ); - Ptrs.pNewSttNds = new SvULongs( (BYTE)(rTblBoxes.Count() - rOld.Count()), 5 ); + Ptrs.pNewSttNds = new SvULongs( (sal_uInt8)(rTblBoxes.Count() - rOld.Count()), 5 ); for( n = 0, i = 0; n < rOld.Count(); ++i ) { @@ -1650,7 +1667,7 @@ SwTableLine* lcl_FindTableLine( const SwTable& rTable, rBox.GetUpper()->GetUpper()->GetTabLines() : rTable.GetTabLines(); const SwTableLine* pLine = rBox.GetUpper(); - USHORT nLineNo = rTableLines.C40_GETPOS( SwTableLine, pLine ); + sal_uInt16 nLineNo = rTableLines.C40_GETPOS( SwTableLine, pLine ); pRet = rTableLines[nLineNo - 1]; return pRet; @@ -1677,12 +1694,12 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rTblBoxes = rTbl.GetTabSortBoxes(); ASSERT( ! IsDelBox(), "falsche Action" ); - Ptrs.pNewSttNds = new SvULongs( (BYTE)(rTblBoxes.Count() - rOld.Count()), 5 ); + Ptrs.pNewSttNds = new SvULongs( (sal_uInt8)(rTblBoxes.Count() - rOld.Count()), 5 ); ASSERT( rTbl.IsNewModel() || rOld.Count() + nCount * rBoxes.Count() == rTblBoxes.Count(), "unexpected boxes" ); ASSERT( rOld.Count() <= rTblBoxes.Count(), "more unexpected boxes" ); - for( USHORT n = 0, i = 0; i < rTblBoxes.Count(); ++i ) + for( sal_uInt16 n = 0, i = 0; i < rTblBoxes.Count(); ++i ) { if( ( n < rOld.Count() ) && ( rOld[ n ] == rTblBoxes[ i ] ) ) @@ -1693,7 +1710,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, else { // new box found: insert (obey sort order) - USHORT nInsPos; + sal_uInt16 nInsPos; const SwTableBox* pBox = rTblBoxes[ i ]; InsertSort( *Ptrs.pNewSttNds, pBox->GetSttIdx(), &nInsPos ); @@ -1704,15 +1721,15 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, const SwTableBox* pSourceBox = NULL; const SwTableBox* pCheckBox = NULL; const SwTableLine* pBoxLine = pBox->GetUpper(); - USHORT nLineDiff = lcl_FindParentLines(rTbl,*pBox).C40_GETPOS(SwTableLine,pBoxLine); - USHORT nLineNo = 0; - for( USHORT j = 0; j < rBoxes.Count(); ++j ) + sal_uInt16 nLineDiff = lcl_FindParentLines(rTbl,*pBox).C40_GETPOS(SwTableLine,pBoxLine); + sal_uInt16 nLineNo = 0; + for( sal_uInt16 j = 0; j < rBoxes.Count(); ++j ) { pCheckBox = rBoxes[j]; if( pCheckBox->GetUpper()->GetUpper() == pBox->GetUpper()->GetUpper() ) { const SwTableLine* pCheckLine = pCheckBox->GetUpper(); - USHORT nCheckLine = lcl_FindParentLines( rTbl, *pCheckBox ). + sal_uInt16 nCheckLine = lcl_FindParentLines( rTbl, *pCheckBox ). C40_GETPOS( SwTableLine, pCheckLine ); if( ( !pSourceBox || nCheckLine > nLineNo ) && nCheckLine < nLineDiff ) { @@ -1728,10 +1745,10 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, ASSERT( pSourceBox, "Splitted source box not found!" ); // find out how many nodes the source box used to have // (to help determine bNodesMoved flag below) - USHORT nNdsPos = 0; + sal_uInt16 nNdsPos = 0; while( rBoxes[ nNdsPos ] != pSourceBox ) ++nNdsPos; - ULONG nNodes = rNodeCnts[ nNdsPos ]; + sal_uLong nNodes = rNodeCnts[ nNdsPos ]; // When a new table cell is created, it either gets a new // node, or it gets node(s) from elsewhere. The undo must @@ -1745,7 +1762,7 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd, // The bNodesMoved flag is stored in a seperate array // which mirrors Ptrs.pNewSttNds, i.e. Ptrs.pNewSttNds[i] // and aMvBoxes[i] belong together. - BOOL bNodesMoved = + sal_Bool bNodesMoved = ( nNodes != ( pSourceBox->GetSttNd()->EndOfSectionIndex() - pSourceBox->GetSttIdx() ) ) && ( nNodes - 1 > nLineDiff ); @@ -1770,13 +1787,13 @@ void SwUndoTblNdsChg::SaveSection( SwStartNode* pSttNd ) } -void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) +void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode ); - SwTableNode* pTblNd = rDoc.GetNodes()[ aIdx ]->GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + SwTableNode *const pTblNd = aIdx.GetNode().GetTableNode(); + OSL_ENSURE( pTblNd, "SwUndoTblNdsChg: no TableNode" ); SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() ); aMsgHnt.eFlags = TBL_BOXPTR; @@ -1797,7 +1814,7 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) SwTableBoxes& rLnBoxes = pCpyBox->GetUpper()->GetTabBoxes(); // die Sections wieder herstellen - for( USHORT n = Ptrs.pDelSects->Count(); n; ) + for( sal_uInt16 n = Ptrs.pDelSects->Count(); n; ) { SwUndoSaveSection* pSave = (*Ptrs.pDelSects)[ --n ]; pSave->RestoreSection( &rDoc, &aIdx, SwTableBoxStartNode ); @@ -1817,10 +1834,10 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) aTmp.Insert( Ptrs.pNewSttNds, 0 ); // von hinten anfangen - for( USHORT n = aTmp.Count(); n; ) + for( sal_uInt16 n = aTmp.Count(); n; ) { // Box aus der Tabellen-Struktur entfernen - ULONG nIdx = aTmp[ --n ]; + sal_uLong nIdx = aTmp[ --n ]; SwTableBox* pBox = pTblNd->GetTable().GetTblBox( nIdx ); ASSERT( pBox, "Wo ist meine TabellenBox geblieben?" ); @@ -1837,8 +1854,8 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) SwNodeIndex aInsPos( *(pLine->GetTabBoxes()[0]->GetSttNd()), 2 ); // alle StartNode Indizies anpassen - USHORT i = n; - ULONG nSttIdx = aInsPos.GetIndex() - 2, + sal_uInt16 i = n; + sal_uLong nSttIdx = aInsPos.GetIndex() - 2, nNdCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex(); while( i && aTmp[ --i ] > nSttIdx ) aTmp[ i ] += nNdCnt; @@ -1846,7 +1863,7 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) // erst die Box loeschen delete pBox; // dann die Nodes verschieben, - rDoc.GetNodes()._MoveNodes( aRg, rDoc.GetNodes(), aInsPos, FALSE ); + rDoc.GetNodes()._MoveNodes( aRg, rDoc.GetNodes(), aInsPos, sal_False ); } else rDoc.DeleteSection( rDoc.GetNodes()[ nIdx ] ); @@ -1856,9 +1873,9 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) else { // Remove nodes from nodes array (backwards!) - for( USHORT n = Ptrs.pNewSttNds->Count(); n; ) + for( sal_uInt16 n = Ptrs.pNewSttNds->Count(); n; ) { - ULONG nIdx = (*Ptrs.pNewSttNds)[ --n ]; + sal_uLong nIdx = (*Ptrs.pNewSttNds)[ --n ]; SwTableBox* pBox = pTblNd->GetTable().GetTblBox( nIdx ); ASSERT( pBox, "Where's my table box?" ); // TL_CHART2: notify chart about box to be removed @@ -1869,7 +1886,7 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) } } // Remove boxes from table structure - for( USHORT n = 0; n < aDelBoxes.size(); ++n ) + for( sal_uInt16 n = 0; n < aDelBoxes.size(); ++n ) { SwTableBox* pCurrBox = aDelBoxes[n]; SwTableBoxes* pTBoxes = &pCurrBox->GetUpper()->GetTabBoxes(); @@ -1877,7 +1894,7 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) delete pCurrBox; } - pSaveTbl->CreateNew( pTblNd->GetTable(), TRUE, FALSE ); + pSaveTbl->CreateNew( pTblNd->GetTable(), sal_True, sal_False ); // TL_CHART2: need to inform chart of probably changed cell names rDoc.UpdateCharts( pTblNd->GetTable().GetFrmFmt()->GetName() ); @@ -1889,16 +1906,16 @@ void SwUndoTblNdsChg::Undo( SwUndoIter& rUndoIter ) } -void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) +void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwTableNode* pTblNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode(); ASSERT( pTblNd, "kein TabellenNode" ); CHECK_TABLE( pTblNd->GetTable() ) SwSelBoxes aSelBoxes; - for( USHORT n = 0; n < aBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n ) { SwTableBox* pBox = pTblNd->GetTable().GetTblBox( aBoxes[ n ] ); aSelBoxes.Insert( pBox ); @@ -1946,7 +1963,7 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) SwTable &rTable = pTblNd->GetTable(); if( nMax > nMin && rTable.IsNewModel() ) rTable.PrepareDeleteCol( nMin, nMax ); - rTable.DeleteSel( &rDoc, aSelBoxes, 0, this, TRUE, TRUE ); + rTable.DeleteSel( &rDoc, aSelBoxes, 0, this, sal_True, sal_True ); } else { @@ -1960,7 +1977,8 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) TblChgMode eOldMode = rTbl.GetTblChgMode(); rTbl.SetTblChgMode( (TblChgMode)nCount ); - rDoc.DoUndo( TRUE ); // wir brauchen die SaveSections! + // need the SaveSections! + rDoc.GetIDocumentUndoRedo().DoUndo( true ); SwUndoTblNdsChg* pUndo = 0; switch( nSetColType & 0xff ) @@ -1988,7 +2006,7 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) delete pUndo; } - rDoc.DoUndo( FALSE ); + rDoc.GetIDocumentUndoRedo().DoUndo( false ); rTbl.SetTblChgMode( eOldMode ); } @@ -2002,8 +2020,7 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) } -/* */ - +////////////////////////////////////////////////////////////////////////// SwUndoTblMerge::SwUndoTblMerge( const SwPaM& rTblSel ) : SwUndo( UNDO_TABLE_MERGE ), SwUndRng( rTblSel ), pHistory( 0 ) @@ -2015,7 +2032,6 @@ SwUndoTblMerge::SwUndoTblMerge( const SwPaM& rTblSel ) nTblNode = pTblNd->GetIndex(); } - SwUndoTblMerge::~SwUndoTblMerge() { delete pSaveTbl; @@ -2023,14 +2039,13 @@ SwUndoTblMerge::~SwUndoTblMerge() delete pHistory; } - -void SwUndoTblMerge::Undo( SwUndoIter& rUndoIter ) +void SwUndoTblMerge::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rUndoIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwNodeIndex aIdx( rDoc.GetNodes(), nTblNode ); - SwTableNode* pTblNd = rDoc.GetNodes()[ aIdx ]->GetTableNode(); - ASSERT( pTblNd, "kein TabellenNode" ); + SwTableNode *const pTblNd = aIdx.GetNode().GetTableNode(); + OSL_ENSURE( pTblNd, "SwUndoTblMerge: no TableNode" ); SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() ); aMsgHnt.eFlags = TBL_BOXPTR; @@ -2052,7 +2067,7 @@ CHECKTABLE(pTblNd->GetTable()) SwSelBoxes aSelBoxes; SwTxtFmtColl* pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); - USHORT n; + sal_uInt16 n; for( n = 0; n < aBoxes.Count(); ++n ) { @@ -2075,7 +2090,7 @@ CHECKTABLE(pTblNd->GetTable()) for( n = aNewSttNds.Count(); n; ) { // Box aus der Tabellen-Struktur entfernen - ULONG nIdx = aNewSttNds[ --n ]; + sal_uLong nIdx = aNewSttNds[ --n ]; if( !nIdx && n ) { @@ -2088,17 +2103,17 @@ CHECKTABLE(pTblNd->GetTable()) *pBox->GetSttNd()->EndOfSectionNode() ), pColl ); // das war der Trenner, -> die verschobenen herstellen - for( USHORT i = pMoves->Count(); i; ) + for( sal_uInt16 i = pMoves->Count(); i; ) { SwTxtNode* pTxtNd = 0; - USHORT nDelPos = 0; + sal_uInt16 nDelPos = 0; SwUndoMove* pUndo = (*pMoves)[ --i ]; if( !pUndo->IsMoveRange() ) { pTxtNd = rDoc.GetNodes()[ pUndo->GetDestSttNode() ]->GetTxtNode(); nDelPos = pUndo->GetDestSttCntnt() - 1; } - pUndo->Undo( rUndoIter ); + pUndo->UndoImpl(rContext); if( pUndo->IsMoveRange() ) { // den ueberfluessigen Node loeschen @@ -2148,7 +2163,7 @@ DUMPDOC( &rDoc, String( "d:\\tmp\\tab_") + String( aNewSttNds.Count() - i ) + SwNodeIndex aTmpIdx( *pBox->GetSttNd() ); rDoc.CorrAbs( SwNodeIndex( aTmpIdx, 1 ), SwNodeIndex( *aTmpIdx.GetNode().EndOfSectionNode() ), - SwPosition( aTmpIdx, SwIndex( 0, 0 )), TRUE ); + SwPosition( aTmpIdx, SwIndex( 0, 0 )), sal_True ); } delete pBox; @@ -2159,7 +2174,7 @@ DUMPDOC( &rDoc, "d:\\tmp\\tab_z.db" ) CHECKTABLE(pTblNd->GetTable()) - pSaveTbl->CreateNew( pTblNd->GetTable(), TRUE, FALSE ); + pSaveTbl->CreateNew( pTblNd->GetTable(), sal_True, sal_False ); // TL_CHART2: need to inform chart of probably changed cell names rDoc.UpdateCharts( pTblNd->GetTable().GetFrmFmt()->GetName() ); @@ -2171,7 +2186,7 @@ CHECKTABLE(pTblNd->GetTable()) } // nTblNode = pTblNd->GetIndex(); - SwPaM* pPam = rUndoIter.pAktPam; + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); pPam->GetPoint()->nNode = nSttNode; pPam->GetPoint()->nContent.Assign( pPam->GetCntntNode(), nSttCntnt ); @@ -2182,27 +2197,21 @@ CHECKTABLE(pTblNd->GetTable()) ClearFEShellTabCols(); } - -void SwUndoTblMerge::Redo( SwUndoIter& rUndoIter ) +void SwUndoTblMerge::RedoImpl(::sw::UndoRedoContext & rContext) { - SwPaM* pPam = rUndoIter.pAktPam; - SwDoc& rDoc = *pPam->GetDoc(); - - SetPaM( *pPam ); - rDoc.MergeTbl( *pPam ); + SwDoc & rDoc = rContext.GetDoc(); + SwPaM & rPam( AddUndoRedoPaM(rContext) ); + rDoc.MergeTbl(rPam); } void SwUndoTblMerge::MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& rPos ) { SwNodeIndex aTmp( rRg.aStart, -1 ), aTmp2( rPos, -1 ); SwUndoMove* pUndo = new SwUndoMove( pDoc, rRg, rPos ); - sal_Bool bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); pDoc->MoveNodeRange( rRg, rPos, (pSaveTbl->IsNewModel()) ? IDocumentContentOperations::DOC_NO_DELFRMS : IDocumentContentOperations::DOC_MOVEDEFAULT ); - if( bDoesUndo ) - pDoc->DoUndo( sal_True ); aTmp++; aTmp2++; pUndo->SetDestRange( aTmp2, rPos, aTmp ); @@ -2210,15 +2219,14 @@ void SwUndoTblMerge::MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& r pMoves->Insert( pUndo, pMoves->Count() ); } - void SwUndoTblMerge::SetSelBoxes( const SwSelBoxes& rBoxes ) { // die Selektion merken - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) InsertSort( aBoxes, rBoxes[n]->GetSttIdx() ); // als Trennung fuers einfuegen neuer Boxen nach dem Verschieben! - aNewSttNds.Insert( (ULONG)0, aNewSttNds.Count() ); + aNewSttNds.Insert( (sal_uLong)0, aNewSttNds.Count() ); // The new table model does not delete overlapped cells (by row span), // so the rBoxes array might be empty even some cells have been merged. @@ -2241,15 +2249,15 @@ void SwUndoTblMerge::SaveCollection( const SwTableBox& rBox ) pHistory->CopyFmtAttr( *pCNd->GetpSwAttrSet(), aIdx.GetIndex() ); } -/* */ +////////////////////////////////////////////////////////////////////////// SwUndoTblNumFmt::SwUndoTblNumFmt( const SwTableBox& rBox, const SfxItemSet* pNewSet ) : SwUndo( UNDO_TBLNUMFMT ), pBoxSet( 0 ), pHistory( 0 ), nFmtIdx( NUMBERFORMAT_TEXT ) { - bNewFmt = bNewFml = bNewValue = FALSE; + bNewFmt = bNewFml = bNewValue = sal_False; nNode = rBox.GetSttIdx(); nNdPos = rBox.IsValidNumTxtNd( 0 == pNewSet ); @@ -2281,21 +2289,21 @@ SwUndoTblNumFmt::SwUndoTblNumFmt( const SwTableBox& rBox, { const SfxPoolItem* pItem; if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_FORMAT, - FALSE, &pItem )) + sal_False, &pItem )) { - bNewFmt = TRUE; + bNewFmt = sal_True; nNewFmtIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); } if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_FORMULA, - FALSE, &pItem )) + sal_False, &pItem )) { - bNewFml = TRUE; + bNewFml = sal_True; aNewFml = ((SwTblBoxFormula*)pItem)->GetFormula(); } if( SFX_ITEM_SET == pNewSet->GetItemState( RES_BOXATR_VALUE, - FALSE, &pItem )) + sal_False, &pItem )) { - bNewValue = TRUE; + bNewValue = sal_True; fNewNum = ((SwTblBoxValue*)pItem)->GetValue(); } } @@ -2305,18 +2313,17 @@ SwUndoTblNumFmt::SwUndoTblNumFmt( const SwTableBox& rBox, DELETEZ( pHistory ); } - SwUndoTblNumFmt::~SwUndoTblNumFmt() { delete pHistory; delete pBoxSet; } -void SwUndoTblNumFmt::Undo( SwUndoIter& rIter ) +void SwUndoTblNumFmt::UndoImpl(::sw::UndoRedoContext & rContext) { ASSERT( pBoxSet, "Where's the stored item set?" ) - SwDoc& rDoc = rIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwStartNode* pSttNd = rDoc.GetNodes()[ nNode ]-> FindSttNodeByType( SwTableBoxStartNode ); ASSERT( pSttNd, "ohne StartNode kein TabellenBox" ); @@ -2357,12 +2364,12 @@ void SwUndoTblNumFmt::Undo( SwUndoIter& rIter ) if( pHistory ) { - USHORT nTmpEnd = pHistory->GetTmpEnd(); + sal_uInt16 nTmpEnd = pHistory->GetTmpEnd(); pHistory->TmpRollback( &rDoc, 0 ); pHistory->SetTmpEnd( nTmpEnd ); } - SwPaM* pPam = rIter.pAktPam; + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); pPam->GetPoint()->nNode = nNode + 1; pPam->GetPoint()->nContent.Assign( pTxtNd, 0 ); @@ -2405,19 +2412,19 @@ RedlineModeInternGuard::~RedlineModeInternGuard() -void SwUndoTblNumFmt::Redo( SwUndoIter& rIter ) +void SwUndoTblNumFmt::RedoImpl(::sw::UndoRedoContext & rContext) { // konnte die Box veraendert werden ? if( !pBoxSet ) return ; - SwDoc& rDoc = rIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); - SwPaM* pPam = rIter.pAktPam; pPam->DeleteMark(); pPam->GetPoint()->nNode = nNode; - SwNode* pNd = rDoc.GetNodes()[ pPam->GetPoint()->nNode ]; + SwNode * pNd = & pPam->GetPoint()->nNode.GetNode(); SwStartNode* pSttNd = pNd->FindSttNodeByType( SwTableBoxStartNode ); ASSERT( pSttNd, "ohne StartNode kein TabellenBox" ); SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTblBox( @@ -2505,7 +2512,8 @@ void SwUndoTblNumFmt::SetBox( const SwTableBox& rBox ) nNode = rBox.GetSttIdx(); } -/* */ + +////////////////////////////////////////////////////////////////////////// _UndoTblCpyTbl_Entry::_UndoTblCpyTbl_Entry( const SwTableBox& rBox ) : nBoxIdx( rBox.GetSttIdx() ), nOffset( 0 ), @@ -2532,16 +2540,16 @@ SwUndoTblCpyTbl::~SwUndoTblCpyTbl() delete pInsRowUndo; } -void SwUndoTblCpyTbl::Undo( SwUndoIter& rIter ) +void SwUndoTblCpyTbl::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); _DEBUG_REDLINE( &rDoc ) SwTableNode* pTblNd = 0; - for( USHORT n = pArr->Count(); n; ) + for( sal_uInt16 n = pArr->Count(); n; ) { _UndoTblCpyTbl_Entry* pEntry = (*pArr)[ --n ]; - ULONG nSttPos = pEntry->nBoxIdx + pEntry->nOffset; + sal_uLong nSttPos = pEntry->nBoxIdx + pEntry->nOffset; SwStartNode* pSNd = rDoc.GetNodes()[ nSttPos ]->StartOfSectionNode(); if( !pTblNd ) pTblNd = pSNd->FindTableNode(); @@ -2563,23 +2571,29 @@ void SwUndoTblCpyTbl::Undo( SwUndoIter& rIter ) // There are a couple of different situations to consider during redlining if( pEntry->pUndo ) { - SwUndoDelete *pUnDel = (SwUndoDelete*)pEntry->pUndo; - if( UNDO_REDLINE == pUnDel->GetId() ) + SwUndoDelete *const pUndoDelete = + dynamic_cast<SwUndoDelete*>(pEntry->pUndo); + SwUndoRedlineDelete *const pUndoRedlineDelete = + dynamic_cast<SwUndoRedlineDelete*>(pEntry->pUndo); + OSL_ASSERT(pUndoDelete || pUndoRedlineDelete); + if (pUndoRedlineDelete) { // The old content was not empty or he has been merged with the new content bDeleteCompleteParagraph = !pEntry->bJoin; // bJoin is set when merged // Set aTmpIdx to the beginning fo the old content - SwNodeIndex aTmpIdx( *pEndNode, pUnDel->NodeDiff()-1 ); + SwNodeIndex aTmpIdx( *pEndNode, + pUndoRedlineDelete->NodeDiff()-1 ); SwTxtNode *pTxt = aTmpIdx.GetNode().GetTxtNode(); if( pTxt ) { aPam.GetPoint()->nNode = *pTxt; - aPam.GetPoint()->nContent.Assign( pTxt, pUnDel->ContentStart() ); + aPam.GetPoint()->nContent.Assign( pTxt, + pUndoRedlineDelete->ContentStart() ); } else *aPam.GetPoint() = SwPosition( aTmpIdx ); } - else if( pUnDel->IsDelFullPara() ) + else if (pUndoDelete && pUndoDelete->IsDelFullPara()) { // When the old content was an empty paragraph, but could not be joined // with the new content (e.g. because of a section or table) @@ -2603,8 +2617,9 @@ void SwUndoTblCpyTbl::Undo( SwUndoIter& rIter ) if( pEntry->pUndo ) { - pEntry->pUndo->Undo( rIter ); + pEntry->pUndo->UndoImpl(rContext); delete pEntry->pUndo; + pEntry->pUndo = 0; } if( bShiftPam ) { @@ -2620,15 +2635,16 @@ void SwUndoTblCpyTbl::Undo( SwUndoIter& rIter ) else *aPam.GetPoint() = SwPosition( aTmpIdx ); } - pUndo = new SwUndoDelete( aPam, bDeleteCompleteParagraph, TRUE ); + pUndo = new SwUndoDelete( aPam, bDeleteCompleteParagraph, sal_True ); } else { pUndo = new SwUndoDelete( aPam, true ); if( pEntry->pUndo ) { - pEntry->pUndo->Undo( rIter ); + pEntry->pUndo->UndoImpl(rContext); delete pEntry->pUndo; + pEntry->pUndo = 0; } } pEntry->pUndo = pUndo; @@ -2664,23 +2680,27 @@ void SwUndoTblCpyTbl::Undo( SwUndoIter& rIter ) } if( pInsRowUndo ) - pInsRowUndo->Undo( rIter ); + { + pInsRowUndo->UndoImpl(rContext); + } _DEBUG_REDLINE( &rDoc ) } -void SwUndoTblCpyTbl::Redo( SwUndoIter& rIter ) +void SwUndoTblCpyTbl::RedoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); _DEBUG_REDLINE( &rDoc ) if( pInsRowUndo ) - pInsRowUndo->Redo( rIter ); + { + pInsRowUndo->RedoImpl(rContext); + } SwTableNode* pTblNd = 0; - for( USHORT n = 0; n < pArr->Count(); ++n ) + for( sal_uInt16 n = 0; n < pArr->Count(); ++n ) { _UndoTblCpyTbl_Entry* pEntry = (*pArr)[ n ]; - ULONG nSttPos = pEntry->nBoxIdx + pEntry->nOffset; + sal_uLong nSttPos = pEntry->nBoxIdx + pEntry->nOffset; SwStartNode* pSNd = rDoc.GetNodes()[ nSttPos ]->StartOfSectionNode(); if( !pTblNd ) pTblNd = pSNd->FindTableNode(); @@ -2692,10 +2712,10 @@ void SwUndoTblCpyTbl::Redo( SwUndoIter& rIter ) // b62341295: Redline for copying tables - Start. rDoc.GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)rDoc.GetDfltTxtFmtColl() ); SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode()); - SwUndo* pUndo = IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) ? 0 : new SwUndoDelete( aPam, TRUE ); + SwUndo* pUndo = IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) ? 0 : new SwUndoDelete( aPam, sal_True ); if( pEntry->pUndo ) { - pEntry->pUndo->Undo( rIter ); + pEntry->pUndo->UndoImpl(rContext); if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ) ) { // PrepareRedline has to be called with the beginning of the old content @@ -2703,8 +2723,12 @@ void SwUndoTblCpyTbl::Redo( SwUndoIter& rIter ) // by the Undo operation to this point. // Otherwise aInsIdx has been moved during the Undo operation if( pEntry->bJoin ) - pUndo = PrepareRedline( &rDoc, rBox, *rIter.pAktPam->GetPoint(), + { + SwPaM const& rLastPam = + rContext.GetCursorSupplier().GetCurrentShellCursor(); + pUndo = PrepareRedline( &rDoc, rBox, *rLastPam.GetPoint(), pEntry->bJoin, true ); + } else { SwPosition aTmpPos( aInsIdx ); @@ -2712,6 +2736,7 @@ void SwUndoTblCpyTbl::Redo( SwUndoIter& rIter ) } } delete pEntry->pUndo; + pEntry->pUndo = 0; } pEntry->pUndo = pUndo; // b62341295: Redline for copying tables - End. @@ -2747,7 +2772,7 @@ void SwUndoTblCpyTbl::Redo( SwUndoIter& rIter ) _DEBUG_REDLINE( &rDoc ) } -void SwUndoTblCpyTbl::AddBoxBefore( const SwTableBox& rBox, BOOL bDelCntnt ) +void SwUndoTblCpyTbl::AddBoxBefore( const SwTableBox& rBox, sal_Bool bDelCntnt ) { if( pArr->Count() && !bDelCntnt ) return; @@ -2764,7 +2789,7 @@ void SwUndoTblCpyTbl::AddBoxBefore( const SwTableBox& rBox, BOOL bDelCntnt ) SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode() ); if( !pDoc->IsRedlineOn() ) - pEntry->pUndo = new SwUndoDelete( aPam, TRUE ); + pEntry->pUndo = new SwUndoDelete( aPam, sal_True ); } pEntry->pBoxNumAttr = new SfxItemSet( pDoc->GetAttrPool(), @@ -2776,7 +2801,7 @@ void SwUndoTblCpyTbl::AddBoxBefore( const SwTableBox& rBox, BOOL bDelCntnt ) _DEBUG_REDLINE( pDoc ) } -void SwUndoTblCpyTbl::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, BOOL bDelCntnt ) +void SwUndoTblCpyTbl::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, sal_Bool bDelCntnt ) { _UndoTblCpyTbl_Entry* pEntry = (*pArr)[ pArr->Count() - 1 ]; @@ -2862,7 +2887,7 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, aCellEnd = SwPosition( SwNodeIndex( *rBox.GetSttNd()->EndOfSectionNode() )); SwPaM aTmpPam( aDeleteStart, aCellEnd ); - pUndo = new SwUndoDelete( aTmpPam, TRUE ); + pUndo = new SwUndoDelete( aTmpPam, sal_True ); } SwPosition aCellStart( SwNodeIndex( *rBox.GetSttNd(), 2 ) ); pTxt = aCellStart.nNode.GetNode().GetTxtNode(); @@ -2879,18 +2904,18 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, } -BOOL SwUndoTblCpyTbl::InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes, - USHORT nCnt ) +sal_Bool SwUndoTblCpyTbl::InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes, + sal_uInt16 nCnt ) { SwTableNode* pTblNd = (SwTableNode*)rTbl.GetTabSortBoxes()[0]-> GetSttNd()->FindTableNode(); SwTableSortBoxes aTmpLst( 0, 5 ); pInsRowUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSROW, rBoxes, *pTblNd, - 0, 0, nCnt, TRUE, FALSE ); + 0, 0, nCnt, sal_True, sal_False ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); - BOOL bRet = rTbl.InsertRow( rTbl.GetFrmFmt()->GetDoc(), rBoxes, nCnt, TRUE ); + sal_Bool bRet = rTbl.InsertRow( rTbl.GetFrmFmt()->GetDoc(), rBoxes, nCnt, sal_True ); if( bRet ) pInsRowUndo->SaveNewBoxes( *pTblNd, aTmpLst ); else @@ -2898,12 +2923,13 @@ BOOL SwUndoTblCpyTbl::InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes, return bRet; } -BOOL SwUndoTblCpyTbl::IsEmpty() const +sal_Bool SwUndoTblCpyTbl::IsEmpty() const { return !pInsRowUndo && !pArr->Count(); } -/* */ + +////////////////////////////////////////////////////////////////////////// SwUndoCpyTbl::SwUndoCpyTbl() : SwUndo( UNDO_CPYTBL ), pDel( 0 ), nTblNode( 0 ) @@ -2915,9 +2941,9 @@ SwUndoCpyTbl::~SwUndoCpyTbl() delete pDel; } -void SwUndoCpyTbl::Undo( SwUndoIter& rIter ) +void SwUndoCpyTbl::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc& rDoc = rIter.GetDoc(); + SwDoc & rDoc = rContext.GetDoc(); SwTableNode* pTNd = rDoc.GetNodes()[ nTblNode ]->GetTableNode(); // harte SeitenUmbrueche am nachfolgenden Node verschieben @@ -2928,29 +2954,29 @@ void SwUndoCpyTbl::Undo( SwUndoIter& rIter ) const SfxPoolItem *pItem; if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_PAGEDESC, - FALSE, &pItem ) ) + sal_False, &pItem ) ) pNextNd->SetAttr( *pItem ); if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_BREAK, - FALSE, &pItem ) ) + sal_False, &pItem ) ) pNextNd->SetAttr( *pItem ); } SwPaM aPam( *pTNd, *pTNd->EndOfSectionNode(), 0 , 1 ); - pDel = new SwUndoDelete( aPam, TRUE ); + pDel = new SwUndoDelete( aPam, sal_True ); } -void SwUndoCpyTbl::Redo( SwUndoIter& rIter ) +void SwUndoCpyTbl::RedoImpl(::sw::UndoRedoContext & rContext) { - pDel->Undo( rIter ); + pDel->UndoImpl(rContext); delete pDel, pDel = 0; } -/* */ +////////////////////////////////////////////////////////////////////////// SwUndoSplitTbl::SwUndoSplitTbl( const SwTableNode& rTblNd, - SwSaveRowSpan* pRowSp, USHORT eMode, BOOL bNewSize ) + SwSaveRowSpan* pRowSp, sal_uInt16 eMode, sal_Bool bNewSize ) : SwUndo( UNDO_SPLIT_TABLE ), nTblNode( rTblNd.GetIndex() ), nOffset( 0 ), mpSaveRowSpan( pRowSp ), pSavTbl( 0 ), pHistory( 0 ), nMode( eMode ), nFmlEnd( 0 ), bCalcNewSize( bNewSize ) @@ -2962,7 +2988,7 @@ SwUndoSplitTbl::SwUndoSplitTbl( const SwTableNode& rTblNd, // kein break; case HEADLINE_BORDERCOPY: case HEADLINE_BOXATTRCOPY: - pSavTbl = new _SaveTable( rTblNd.GetTable(), 1, FALSE ); + pSavTbl = new _SaveTable( rTblNd.GetTable(), 1, sal_False ); break; } } @@ -2974,10 +3000,10 @@ SwUndoSplitTbl::~SwUndoSplitTbl() delete mpSaveRowSpan; } -void SwUndoSplitTbl::Undo( SwUndoIter& rIter ) +void SwUndoSplitTbl::UndoImpl(::sw::UndoRedoContext & rContext) { - SwPaM* pPam = rIter.pAktPam; - SwDoc* pDoc = pPam->GetDoc(); + SwDoc *const pDoc = & rContext.GetDoc(); + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); SwNodeIndex& rIdx = pPam->GetPoint()->nNode; @@ -3004,7 +3030,7 @@ void SwUndoSplitTbl::Undo( SwUndoIter& rIter ) case HEADLINE_BOXATTRCOPY: case HEADLINE_BORDERCOPY: { - pSavTbl->CreateNew( rTbl, FALSE ); + pSavTbl->CreateNew( rTbl, sal_False ); pSavTbl->RestoreAttr( rTbl ); } break; @@ -3014,11 +3040,11 @@ void SwUndoSplitTbl::Undo( SwUndoIter& rIter ) { SwSelBoxes aSelBoxes; SwTableBox* pBox = rTbl.GetTblBox( nTblNode + nOffset + 1 ); - rTbl.SelLineFromBox( pBox, aSelBoxes, TRUE ); + rTbl.SelLineFromBox( pBox, aSelBoxes, sal_True ); _FndBox aTmpBox( 0, 0 ); aTmpBox.SetTableLines( aSelBoxes, rTbl ); aTmpBox.DelFrms( rTbl ); - rTbl.DeleteSel( pDoc, aSelBoxes, 0, 0, FALSE, FALSE ); + rTbl.DeleteSel( pDoc, aSelBoxes, 0, 0, sal_False, sal_False ); } break; } @@ -3039,10 +3065,10 @@ void SwUndoSplitTbl::Undo( SwUndoIter& rIter ) ClearFEShellTabCols(); } -void SwUndoSplitTbl::Redo( SwUndoIter& rIter ) +void SwUndoSplitTbl::RedoImpl(::sw::UndoRedoContext & rContext) { - SwPaM* pPam = rIter.pAktPam; - SwDoc* pDoc = pPam->GetDoc(); + SwDoc *const pDoc = & rContext.GetDoc(); + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); pPam->GetPoint()->nNode = nTblNode; @@ -3051,10 +3077,10 @@ void SwUndoSplitTbl::Redo( SwUndoIter& rIter ) ClearFEShellTabCols(); } -void SwUndoSplitTbl::Repeat( SwUndoIter& rIter ) +void SwUndoSplitTbl::RepeatImpl(::sw::RepeatContext & rContext) { - SwPaM* pPam = rIter.pAktPam; - SwDoc* pDoc = pPam->GetDoc(); + SwPaM *const pPam = & rContext.GetRepeatPaM(); + SwDoc *const pDoc = & rContext.GetDoc(); pDoc->SplitTable( *pPam->GetPoint(), nMode, bCalcNewSize ); ClearFEShellTabCols(); @@ -3069,11 +3095,12 @@ void SwUndoSplitTbl::SaveFormula( SwHistory& rHistory ) pHistory->Move( 0, &rHistory ); } -/* */ + +////////////////////////////////////////////////////////////////////////// SwUndoMergeTbl::SwUndoMergeTbl( const SwTableNode& rTblNd, const SwTableNode& rDelTblNd, - BOOL bWithPrv, USHORT nMd ) + sal_Bool bWithPrv, sal_uInt16 nMd ) : SwUndo( UNDO_MERGE_TABLE ), pSavTbl( 0 ), pHistory( 0 ), nMode( nMd ), bWithPrev( bWithPrv ) { @@ -3096,10 +3123,10 @@ SwUndoMergeTbl::~SwUndoMergeTbl() delete pHistory; } -void SwUndoMergeTbl::Undo( SwUndoIter& rIter ) +void SwUndoMergeTbl::UndoImpl(::sw::UndoRedoContext & rContext) { - SwPaM* pPam = rIter.pAktPam; - SwDoc* pDoc = pPam->GetDoc(); + SwDoc *const pDoc = & rContext.GetDoc(); + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); SwNodeIndex& rIdx = pPam->GetPoint()->nNode; @@ -3118,7 +3145,7 @@ void SwUndoMergeTbl::Undo( SwUndoIter& rIter ) aFndBox.DelFrms( *pTbl ); // ? TL_CHART2: notification or locking of controller required ? - SwTableNode* pNew = pDoc->GetNodes().SplitTable( rIdx, TRUE, FALSE ); + SwTableNode* pNew = pDoc->GetNodes().SplitTable( rIdx, sal_True, sal_False ); //Layout updaten aFndBox.MakeFrms( *pTbl ); @@ -3134,7 +3161,7 @@ void SwUndoMergeTbl::Undo( SwUndoIter& rIter ) pTbl = &pNew->GetTable(); pTbl->GetFrmFmt()->SetName( aName ); -// pSavTbl->CreateNew( *pTbl, FALSE ); +// pSavTbl->CreateNew( *pTbl, sal_False ); pSavTbl->RestoreAttr( *pTbl ); @@ -3163,10 +3190,10 @@ void SwUndoMergeTbl::Undo( SwUndoIter& rIter ) } } -void SwUndoMergeTbl::Redo( SwUndoIter& rIter ) +void SwUndoMergeTbl::RedoImpl(::sw::UndoRedoContext & rContext) { - SwPaM* pPam = rIter.pAktPam; - SwDoc* pDoc = pPam->GetDoc(); + SwDoc *const pDoc = & rContext.GetDoc(); + SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); pPam->GetPoint()->nNode = nTblNode; @@ -3180,10 +3207,10 @@ void SwUndoMergeTbl::Redo( SwUndoIter& rIter ) ClearFEShellTabCols(); } -void SwUndoMergeTbl::Repeat( SwUndoIter& rIter ) +void SwUndoMergeTbl::RepeatImpl(::sw::RepeatContext & rContext) { - SwPaM* pPam = rIter.pAktPam; - SwDoc* pDoc = pPam->GetDoc(); + SwDoc *const pDoc = & rContext.GetDoc(); + SwPaM *const pPam = & rContext.GetRepeatPaM(); pDoc->MergeTable( *pPam->GetPoint(), bWithPrev, nMode ); ClearFEShellTabCols(); @@ -3196,12 +3223,12 @@ void SwUndoMergeTbl::SaveFormula( SwHistory& rHistory ) pHistory->Move( 0, &rHistory ); } -/* */ +////////////////////////////////////////////////////////////////////////// -void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos ) +void InsertSort( SvUShorts& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos ) { - USHORT nO = rArr.Count(), nM, nU = 0; + sal_uInt16 nO = rArr.Count(), nM, nU = 0; if( nO > 0 ) { nO--; @@ -3210,7 +3237,7 @@ void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos ) nM = nU + ( nO - nU ) / 2; if( *(rArr.GetData() + nM) == nIdx ) { - ASSERT( FALSE, "Index ist schon vorhanden, darf nie sein!" ); + ASSERT( sal_False, "Index ist schon vorhanden, darf nie sein!" ); return; } if( *(rArr.GetData() + nM) < nIdx ) @@ -3226,9 +3253,9 @@ void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos ) *pInsPos = nU; } -void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos ) +void InsertSort( SvULongs& rArr, sal_uLong nIdx, sal_uInt16* pInsPos ) { - USHORT nO = rArr.Count(), nM, nU = 0; + sal_uInt16 nO = rArr.Count(), nM, nU = 0; if( nO > 0 ) { nO--; @@ -3237,7 +3264,7 @@ void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos ) nM = nU + ( nO - nU ) / 2; if( *(rArr.GetData() + nM) == nIdx ) { - ASSERT( FALSE, "Index ist schon vorhanden, darf nie sein!" ); + ASSERT( sal_False, "Index ist schon vorhanden, darf nie sein!" ); return; } if( *(rArr.GetData() + nM) < nIdx ) @@ -3277,7 +3304,7 @@ void CheckTable( const SwTable& rTbl ) { const SwNodes& rNds = rTbl.GetFrmFmt()->GetDoc()->GetNodes(); const SwTableSortBoxes& rSrtArr = pTblNd->GetTable().GetTabSortBoxes(); - for( USHORT n = 0; n < rSrtArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rSrtArr.Count(); ++n ) { const SwTableBox* pBox = rSrtArr[ n ]; const SwNode* pNd = pBox->GetSttNd(); |