summaryrefslogtreecommitdiff
path: root/sw/source/core/undo/untbl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/undo/untbl.cxx')
-rw-r--r--sw/source/core/undo/untbl.cxx695
1 files changed, 352 insertions, 343 deletions
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 0f51798d22b9..07e2e7a9ad47 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -29,12 +29,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>
@@ -43,7 +50,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>
@@ -77,7 +83,6 @@
#define _DEBUG_REDLINE( pDoc )
#endif
-inline SwDoc& SwUndoIter::GetDoc() const { return *pAktPam->GetDoc(); }
extern void ClearFEShellTabCols();
typedef SfxItemSet* SfxItemSetPtr;
@@ -95,7 +100,7 @@ SV_DECL_PTRARR_DEL( SwTblToTxtSaves, SwTblToTxtSavePtr, 0, 10 )
struct _UndoTblCpyTbl_Entry
{
- ULONG nBoxIdx, nOffset;
+ sal_uLong nBoxIdx, nOffset;
SfxItemSet* pBoxNumAttr;
SwUndo* pUndo;
@@ -120,25 +125,25 @@ 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();
- USHORT AddFmt( SwFrmFmt* pFmt, bool bIsLine );
- void NewFrmFmt( const SwClient* pLnBx, BOOL bIsLine, USHORT nFmtPos,
+ sal_uInt16 AddFmt( SwFrmFmt* pFmt, bool bIsLine );
+ void NewFrmFmt( const SwClient* pLnBx, sal_Bool bIsLine, sal_uInt16 nFmtPos,
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
@@ -148,7 +153,7 @@ class _SaveLine
_SaveLine* pNext;
_SaveBox* pBox;
- USHORT nItemSet;
+ sal_uInt16 nItemSet;
public:
@@ -166,9 +171,9 @@ class _SaveBox
friend class _SaveLine;
_SaveBox* pNext;
- ULONG nSttNode;
+ sal_uLong nSttNode;
long nRowSpan;
- USHORT nItemSet;
+ sal_uInt16 nItemSet;
union
{
SfxItemSets* pCntntAttrs;
@@ -185,8 +190,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 OSL_DEBUG_LEVEL > 1
#include "shellio.hxx"
@@ -204,15 +209,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; }
};
@@ -222,7 +227,7 @@ SV_IMPL_PTRARR( SwUndoMoves, SwUndoMovePtr )
SV_IMPL_PTRARR( SwTblToTxtSaves, SwTblToTxtSavePtr )
SV_IMPL_PTRARR( _UndoTblCpyTbl_Entries, _UndoTblCpyTbl_EntryPtr )
-USHORT aSave_BoxCntntSet[] = {
+sal_uInt16 aSave_BoxCntntSet[] = {
RES_CHRATR_COLOR, RES_CHRATR_CROSSEDOUT,
RES_CHRATR_FONT, RES_CHRATR_FONTSIZE,
RES_CHRATR_POSTURE, RES_CHRATR_POSTURE,
@@ -232,8 +237,8 @@ USHORT 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)
@@ -269,9 +274,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();
@@ -290,11 +295,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 );
}
@@ -307,19 +312,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 );
@@ -340,7 +344,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 );
@@ -358,11 +362,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
@@ -378,7 +382,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.
@@ -421,11 +425,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();
@@ -434,10 +438,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();
@@ -467,10 +471,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 );
@@ -499,20 +503,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 );
}
@@ -533,7 +537,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 );
@@ -548,7 +552,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() )
@@ -566,7 +570,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,
@@ -610,7 +614,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 );
}
@@ -632,7 +636,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;
@@ -647,11 +651,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 );
@@ -674,7 +677,7 @@ void SwUndoTblToTxt::Redo( SwUndoIter& rUndoIter )
if( !pCNd && 0 == ( pCNd = rDoc.GetNodes().GoNext( &aSaveIdx ) ) &&
0 == ( pCNd = rDoc.GetNodes().GoPrevious( &aSaveIdx )) )
{
- OSL_ENSURE( FALSE, "wo steht denn nun der TextNode" );
+ OSL_ENSURE( sal_False, "wo steht denn nun der TextNode" );
}
pPam->GetPoint()->nNode = aSaveIdx;
@@ -685,19 +688,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 );
}
}
@@ -707,7 +710,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() );
@@ -717,7 +720,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 ),
@@ -739,15 +742,15 @@ 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();
+ SwTableNode *const pTNd = aIdx.GetNode().GetTableNode();
OSL_ENSURE( pTNd, "keinen Tabellen-Node gefunden" );
RemoveIdxFromSection( rDoc, nTblNd );
@@ -763,11 +766,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 {
OSL_ENSURE( !this, "Wo ist die Box geblieben?" );
}
@@ -777,15 +780,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 );
@@ -794,7 +798,7 @@ void SwUndoTxtToTbl::Undo( SwUndoIter& rUndoIter )
}
}
- // am Ende wieder zusammenfuegen ?
+ // join again at end?
if( bSplitEnd )
{
SwNodeIndex& rIdx = pPos->nNode;
@@ -802,8 +806,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() );
@@ -813,30 +817,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 )
@@ -855,8 +860,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 )
@@ -868,20 +873,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();
OSL_ENSURE( 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();
OSL_ENSURE( pTNd, "keinen Tabellen-Node gefunden" );
@@ -889,24 +892,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 );
@@ -914,7 +918,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() );
@@ -928,9 +932,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
@@ -942,7 +946,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 )
@@ -961,9 +965,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;
@@ -976,7 +980,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
@@ -993,7 +997,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();
@@ -1010,7 +1014,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, BOOL bMdfyBox )
}
aFrmFmts.Remove( 0, aFrmFmts.Count() );
- bModifyBox = FALSE;
+ bModifyBox = sal_False;
}
@@ -1020,10 +1024,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 )
@@ -1039,7 +1043,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!!
@@ -1054,7 +1058,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();
@@ -1070,8 +1074,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)
@@ -1089,11 +1093,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
@@ -1117,8 +1121,8 @@ void _SaveTable::CreateNew( SwTable& rTbl, BOOL bCreateFrms,
}
-void _SaveTable::NewFrmFmt( const SwClient* pLnBx, BOOL bIsLine,
- USHORT nFmtPos, SwFrmFmt* pOldFmt )
+void _SaveTable::NewFrmFmt( const SwClient* pLnBx, sal_Bool bIsLine,
+ sal_uInt16 nFmtPos, SwFrmFmt* pOldFmt )
{
SwDoc* pDoc = pOldFmt->GetDoc();
@@ -1145,7 +1149,7 @@ void _SaveTable::NewFrmFmt( const SwClient* pLnBx, BOOL bIsLine,
((SwFrm*)pLast)->ReinitializeFrmSizeAttrFlags();
if ( !bIsLine )
{
- ((SwCellFrm*)pLast)->SetDerivedVert( FALSE );
+ ((SwCellFrm*)pLast)->SetDerivedVert( sal_False );
((SwCellFrm*)pLast)->CheckDirChange();
}
}
@@ -1178,7 +1182,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 );
}
@@ -1192,10 +1196,10 @@ _SaveLine::~_SaveLine()
void _SaveLine::RestoreAttr( SwTableLine& rLine, _SaveTable& rSTbl )
{
- rSTbl.NewFrmFmt( &rLine, TRUE, nItemSet, rLine.GetFrmFmt() );
+ rSTbl.NewFrmFmt( &rLine, sal_True, nItemSet, rLine.GetFrmFmt() );
_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 )
{
@@ -1264,7 +1268,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 );
}
}
@@ -1282,7 +1286,7 @@ _SaveBox::~_SaveBox()
void _SaveBox::RestoreAttr( SwTableBox& rBox, _SaveTable& rSTbl )
{
- rSTbl.NewFrmFmt( &rBox, FALSE, nItemSet, rBox.GetFrmFmt() );
+ rSTbl.NewFrmFmt( &rBox, sal_False, nItemSet, rBox.GetFrmFmt() );
if( ULONG_MAX == nSttNode ) // keine EndBox
{
@@ -1293,7 +1297,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 )
{
@@ -1310,9 +1314,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 )
@@ -1320,7 +1324,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) );
@@ -1350,9 +1354,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 )
@@ -1418,12 +1422,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() )
{
@@ -1431,17 +1435,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();
OSL_ENSURE( pTblNd, "kein TabellenNode" );
@@ -1457,14 +1458,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
@@ -1472,8 +1472,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() );
@@ -1482,29 +1482,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();
OSL_ENSURE( pTblNd, "kein TabellenNode" );
@@ -1514,37 +1511,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 ),
@@ -1558,7 +1557,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 );
}
@@ -1567,13 +1566,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;
@@ -1581,7 +1580,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 );
}
@@ -1590,7 +1589,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 );
}
}
@@ -1610,11 +1609,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;
OSL_ENSURE( ! 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 )
{
@@ -1640,7 +1639,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;
@@ -1667,12 +1666,12 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
const SwTableSortBoxes& rTblBoxes = rTbl.GetTabSortBoxes();
OSL_ENSURE( ! IsDelBox(), "falsche Action" );
- Ptrs.pNewSttNds = new SvULongs( (BYTE)(rTblBoxes.Count() - rOld.Count()), 5 );
+ Ptrs.pNewSttNds = new SvULongs( (sal_uInt8)(rTblBoxes.Count() - rOld.Count()), 5 );
OSL_ENSURE( rTbl.IsNewModel() || rOld.Count() + nCount * rBoxes.Count() == rTblBoxes.Count(),
"unexpected boxes" );
OSL_ENSURE( 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 ] ) )
@@ -1683,7 +1682,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 );
@@ -1694,15 +1693,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 )
{
@@ -1718,10 +1717,10 @@ void SwUndoTblNdsChg::SaveNewBoxes( const SwTableNode& rTblNd,
OSL_ENSURE( 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
@@ -1735,7 +1734,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 );
@@ -1760,12 +1759,12 @@ 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();
+ SwTableNode *const pTblNd = aIdx.GetNode().GetTableNode();
OSL_ENSURE( pTblNd, "kein TabellenNode" );
SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
@@ -1787,7 +1786,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 );
@@ -1807,10 +1806,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 );
OSL_ENSURE( pBox, "Wo ist meine TabellenBox geblieben?" );
@@ -1827,8 +1826,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;
@@ -1836,7 +1835,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 ] );
@@ -1846,9 +1845,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 );
OSL_ENSURE( pBox, "Where's my table box?" );
// TL_CHART2: notify chart about box to be removed
@@ -1859,7 +1858,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();
@@ -1867,7 +1866,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() );
@@ -1879,16 +1878,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();
OSL_ENSURE( 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 );
@@ -1936,7 +1935,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
{
@@ -1950,7 +1949,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 )
@@ -1978,7 +1978,7 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter )
delete pUndo;
}
- rDoc.DoUndo( FALSE );
+ rDoc.GetIDocumentUndoRedo().DoUndo( false );
rTbl.SetTblChgMode( eOldMode );
}
@@ -1992,8 +1992,7 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter )
}
-/* */
-
+//////////////////////////////////////////////////////////////////////////
SwUndoTblMerge::SwUndoTblMerge( const SwPaM& rTblSel )
: SwUndo( UNDO_TABLE_MERGE ), SwUndRng( rTblSel ), pHistory( 0 )
@@ -2005,7 +2004,6 @@ SwUndoTblMerge::SwUndoTblMerge( const SwPaM& rTblSel )
nTblNode = pTblNd->GetIndex();
}
-
SwUndoTblMerge::~SwUndoTblMerge()
{
delete pSaveTbl;
@@ -2013,13 +2011,12 @@ 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();
+ SwTableNode *const pTblNd = aIdx.GetNode().GetTableNode();
OSL_ENSURE( pTblNd, "kein TabellenNode" );
SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
@@ -2041,7 +2038,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 )
{
@@ -2063,7 +2060,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 )
{
@@ -2076,17 +2073,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
@@ -2132,7 +2129,7 @@ CHECKTABLE(pTblNd->GetTable())
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;
@@ -2142,7 +2139,7 @@ CHECKTABLE(pTblNd->GetTable())
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() );
@@ -2154,7 +2151,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 );
@@ -2165,27 +2162,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 );
@@ -2193,15 +2184,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.
@@ -2224,15 +2214,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 );
@@ -2264,21 +2254,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();
}
}
@@ -2288,18 +2278,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)
{
OSL_ENSURE( pBoxSet, "Where's the stored item set?" );
- SwDoc& rDoc = rIter.GetDoc();
+ SwDoc & rDoc = rContext.GetDoc();
SwStartNode* pSttNd = rDoc.GetNodes()[ nNode ]->
FindSttNodeByType( SwTableBoxStartNode );
OSL_ENSURE( pSttNd, "ohne StartNode kein TabellenBox" );
@@ -2340,12 +2329,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 );
@@ -2388,19 +2377,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 );
OSL_ENSURE( pSttNd, "ohne StartNode kein TabellenBox" );
SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTblBox(
@@ -2488,7 +2477,8 @@ void SwUndoTblNumFmt::SetBox( const SwTableBox& rBox )
nNode = rBox.GetSttIdx();
}
-/* */
+
+//////////////////////////////////////////////////////////////////////////
_UndoTblCpyTbl_Entry::_UndoTblCpyTbl_Entry( const SwTableBox& rBox )
: nBoxIdx( rBox.GetSttIdx() ), nOffset( 0 ),
@@ -2515,16 +2505,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();
@@ -2546,23 +2536,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)
@@ -2586,8 +2582,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 )
{
@@ -2603,15 +2600,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;
@@ -2647,23 +2645,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();
@@ -2675,10 +2677,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
@@ -2686,8 +2688,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 );
@@ -2695,6 +2701,7 @@ void SwUndoTblCpyTbl::Redo( SwUndoIter& rIter )
}
}
delete pEntry->pUndo;
+ pEntry->pUndo = 0;
}
pEntry->pUndo = pUndo;
// b62341295: Redline for copying tables - End.
@@ -2730,7 +2737,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;
@@ -2747,7 +2754,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(),
@@ -2759,7 +2766,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 ];
@@ -2845,7 +2852,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();
@@ -2862,18 +2869,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
@@ -2881,12 +2888,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 )
@@ -2898,9 +2906,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
@@ -2911,29 +2919,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 )
@@ -2945,7 +2953,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;
}
}
@@ -2957,10 +2965,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;
@@ -2987,7 +2995,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;
@@ -2997,11 +3005,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;
}
@@ -3022,10 +3030,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;
@@ -3034,10 +3042,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();
@@ -3052,11 +3060,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 )
{
@@ -3079,10 +3088,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;
@@ -3101,7 +3110,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 );
@@ -3117,7 +3126,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 );
@@ -3146,10 +3155,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;
@@ -3163,10 +3172,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();
@@ -3179,12 +3188,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--;
@@ -3193,7 +3202,7 @@ void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos )
nM = nU + ( nO - nU ) / 2;
if( *(rArr.GetData() + nM) == nIdx )
{
- OSL_ENSURE( FALSE, "Index already exists. This should never happen." );
+ OSL_ENSURE( sal_False, "Index already exists. This should never happen." );
return;
}
if( *(rArr.GetData() + nM) < nIdx )
@@ -3209,9 +3218,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--;
@@ -3220,7 +3229,7 @@ void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos )
nM = nU + ( nO - nU ) / 2;
if( *(rArr.GetData() + nM) == nIdx )
{
- OSL_ENSURE( FALSE, "Index ist schon vorhanden, darf nie sein!" );
+ OSL_ENSURE( sal_False, "Index ist schon vorhanden, darf nie sein!" );
return;
}
if( *(rArr.GetData() + nM) < nIdx )
@@ -3243,7 +3252,7 @@ void CheckTable( const SwTable& rTbl )
{
const SwNodes& rNds = rTbl.GetFrmFmt()->GetDoc()->GetNodes();
const SwTableSortBoxes& rSrtArr = rTbl.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();