diff options
Diffstat (limited to 'sw/source/core/docnode/ndtbl.cxx')
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 1118 |
1 files changed, 604 insertions, 514 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index f403dcf09dd6..fbd54bcee102 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1,3 +1,4 @@ + /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,6 +30,10 @@ #include "precompiled_sw.hxx" #include <com/sun/star/chart2/XChartDocument.hpp> +<<<<<<< local +======= + +>>>>>>> other #include <hintids.hxx> #include <editeng/lrspitem.hxx> #include <editeng/brkitem.hxx> @@ -47,6 +52,8 @@ #include <pagefrm.hxx> #include <tabcol.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> +#include <UndoManager.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swcrsr.hxx> @@ -58,7 +65,11 @@ #include <fldbas.hxx> #include <poolfmt.hxx> #include <tabfrm.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoRedline.hxx> +#include <UndoDelete.hxx> +#include <UndoTable.hxx> +#include <hints.hxx> #include <tblafmt.hxx> #include <swcache.hxx> #include <ddefld.hxx> @@ -110,14 +121,14 @@ const sal_Unicode T2T_PARA = 0x0a; extern void ClearFEShellTabCols(); // steht im gctable.cxx -extern BOOL lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); +extern sal_Bool lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); #ifdef DEL_TABLE_REDLINES class lcl_DelRedlines { SwDoc* pDoc; public: - lcl_DelRedlines( const SwTableNode& rNd, BOOL bCheckForOwnRedline ); + lcl_DelRedlines( const SwTableNode& rNd, sal_Bool bCheckForOwnRedline ); lcl_DelRedlines( SwPaM& rPam ); ~lcl_DelRedlines() { pDoc->EndUndo(UNDO_EMPTY, NULL); } @@ -125,24 +136,24 @@ public: lcl_DelRedlines::lcl_DelRedlines( SwPaM & rPam) : pDoc( rPam.GetDoc() ) { - pDoc->StartUndo(UNDO_EMPTY, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) pDoc->AcceptRedline( rPam, true ); } #endif -void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, BYTE nId ) +void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, sal_uInt8 nId ) { - BOOL bTop = FALSE, bBottom = FALSE, bLeft = FALSE, bRight = FALSE; + sal_Bool bTop = sal_False, bBottom = sal_False, bLeft = sal_False, bRight = sal_False; switch ( nId ) { - case 0: bTop = bBottom = bLeft = TRUE; break; - case 1: bTop = bBottom = bLeft = bRight = TRUE; break; - case 2: bBottom = bLeft = TRUE; break; - case 3: bBottom = bLeft = bRight = TRUE; break; + case 0: bTop = bBottom = bLeft = sal_True; break; + case 1: bTop = bBottom = bLeft = bRight = sal_True; break; + case 2: bBottom = bLeft = sal_True; break; + case 3: bBottom = bLeft = bRight = sal_True; break; } - const BOOL bHTML = rFmt.getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE); + const sal_Bool bHTML = rFmt.getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE); Color aCol( bHTML ? COL_GRAY : COL_BLACK ); SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 ); if ( bHTML ) @@ -163,7 +174,7 @@ void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, BYTE nId ) rFmt.SetFmtAttr( aBox ); } -void lcl_SetDfltBoxAttr( SwTableBox& rBox, SvPtrarr &rBoxFmtArr, BYTE nId, +void lcl_SetDfltBoxAttr( SwTableBox& rBox, SvPtrarr &rBoxFmtArr, sal_uInt8 nId, const SwTableAutoFmt* pAutoFmt = 0 ) { SvPtrarr* pArr = (SvPtrarr*)rBoxFmtArr[ nId ]; @@ -175,7 +186,7 @@ void lcl_SetDfltBoxAttr( SwTableBox& rBox, SvPtrarr &rBoxFmtArr, BYTE nId, SwTableBoxFmt* pNewBoxFmt = 0; SwFrmFmt* pBoxFmt = rBox.GetFrmFmt(); - for( USHORT n = 0; n < pArr->Count(); n += 2 ) + for( sal_uInt16 n = 0; n < pArr->Count(); n += 2 ) if( pArr->GetObject( n ) == pBoxFmt ) { pNewBoxFmt = (SwTableBoxFmt*)pArr->GetObject( n + 1 ); @@ -192,7 +203,7 @@ void lcl_SetDfltBoxAttr( SwTableBox& rBox, SvPtrarr &rBoxFmtArr, BYTE nId, if( pAutoFmt ) pAutoFmt->UpdateToSet( nId, (SfxItemSet&)pNewBoxFmt->GetAttrSet(), SwTableAutoFmt::UPDATE_BOX, - pDoc->GetNumberFormatter( TRUE ) ); + pDoc->GetNumberFormatter( sal_True ) ); else ::lcl_SetDfltBoxAttr( *pNewBoxFmt, nId ); @@ -205,7 +216,7 @@ void lcl_SetDfltBoxAttr( SwTableBox& rBox, SvPtrarr &rBoxFmtArr, BYTE nId, } SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr, - USHORT nCols, BYTE nId ) + sal_uInt16 nCols, sal_uInt8 nId ) { if ( !rBoxFmtArr[nId] ) { @@ -221,14 +232,14 @@ SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr, SwTableBoxFmt *lcl_CreateAFmtBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr, const SwTableAutoFmt& rAutoFmt, - USHORT nCols, BYTE nId ) + sal_uInt16 nCols, sal_uInt8 nId ) { if( !rBoxFmtArr[nId] ) { SwTableBoxFmt* pBoxFmt = rDoc.MakeTableBoxFmt(); rAutoFmt.UpdateToSet( nId, (SfxItemSet&)pBoxFmt->GetAttrSet(), SwTableAutoFmt::UPDATE_BOX, - rDoc.GetNumberFormatter( TRUE ) ); + rDoc.GetNumberFormatter( sal_True ) ); if( USHRT_MAX != nCols ) pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX / nCols, 0 )); @@ -240,7 +251,7 @@ SwTableBoxFmt *lcl_CreateAFmtBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr, SwTableNode* SwDoc::IsIdxInTbl(const SwNodeIndex& rIdx) { SwTableNode* pTableNd = 0; - ULONG nIndex = rIdx.GetIndex(); + sal_uLong nIndex = rIdx.GetIndex(); do { SwNode* pNd = (SwNode*)GetNodes()[ nIndex ]->StartOfSectionNode(); if( 0 != ( pTableNd = pNd->GetTableNode() ) ) @@ -256,20 +267,20 @@ SwTableNode* SwDoc::IsIdxInTbl(const SwNodeIndex& rIdx) // fuege in der Line, vor der InsPos eine neue Box ein. -BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, +sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd, SwTableLine* pLine, SwTableBoxFmt* pBoxFmt, SwTxtFmtColl* pTxtColl, const SfxItemSet* pAutoAttr, - USHORT nInsPos, - USHORT nCnt ) + sal_uInt16 nInsPos, + sal_uInt16 nCnt ) { if( !nCnt ) - return FALSE; + return sal_False; ASSERT( pLine, "keine gueltige Zeile" ); // Index hinter die letzte Box der Line - ULONG nIdxPos = 0; + sal_uLong nIdxPos = 0; SwTableBox *pPrvBox = 0, *pNxtBox = 0; if( pLine->GetTabBoxes().Count() ) { @@ -288,7 +299,7 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, if( !pPrvBox && !pNxtBox ) { - BOOL bSetIdxPos = TRUE; + sal_Bool bSetIdxPos = sal_True; if( pTblNd->GetTable().GetTabLines().Count() && !nInsPos ) { const SwTableLine* pTblLn = pLine; @@ -301,7 +312,7 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, while( ( pNxtBox = pLine->GetTabBoxes()[0])->GetTabLines().Count() ) pLine = pNxtBox->GetTabLines()[0]; nIdxPos = pNxtBox->GetSttIdx(); - bSetIdxPos = FALSE; + bSetIdxPos = sal_False; } } if( bSetIdxPos ) @@ -314,7 +325,7 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, nIdxPos = pPrvBox->GetSttNd()->EndOfSectionIndex() + 1; SwNodeIndex aEndIdx( *this, nIdxPos ); - for( USHORT n = 0; n < nCnt; ++n ) + for( sal_uInt16 n = 0; n < nCnt; ++n ) { SwStartNode* pSttNd = new SwStartNode( aEndIdx, ND_STARTNODE, SwTableBoxStartNode ); @@ -324,7 +335,7 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, pPrvBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); SwTableBoxes & rTabBoxes = pLine->GetTabBoxes(); - USHORT nRealInsPos = nInsPos + n; + sal_uInt16 nRealInsPos = nInsPos + n; if (nRealInsPos > rTabBoxes.Count()) nRealInsPos = rTabBoxes.Count(); @@ -348,18 +359,18 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, pTNd->ChgFmtColl( pTxtColl ); } } - return TRUE; + return sal_True; } // --------------- einfuegen einer neuen Tabelle -------------- const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, - const SwPosition& rPos, USHORT nRows, - USHORT nCols, sal_Int16 eAdjust, + const SwPosition& rPos, sal_uInt16 nRows, + sal_uInt16 nCols, sal_Int16 eAdjust, const SwTableAutoFmt* pTAFmt, const SvUShorts* pColArr, - BOOL bCalledFromShell, - BOOL bNewModel ) + sal_Bool bCalledFromShell, + sal_Bool bNewModel ) { ASSERT( nRows, "Tabelle ohne Zeile?" ); ASSERT( nCols, "Tabelle ohne Spalten?" ); @@ -378,10 +389,10 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, String aTblName = GetUniqueTblName(); - if( DoesUndo() ) + if( GetIDocumentUndoRedo().DoesUndo() ) { - ClearRedo(); - AppendUndo( new SwUndoInsTbl( rPos, nCols, nRows, static_cast<USHORT>(eAdjust), + GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsTbl( rPos, nCols, nRows, static_cast<sal_uInt16>(eAdjust), rInsTblOpts, pTAFmt, pColArr, aTblName)); } @@ -391,12 +402,12 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, SwTxtFmtColl *pBodyColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE ), *pHeadColl = pBodyColl; - BOOL bDfltBorders = 0 != ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER ); + sal_Bool bDfltBorders = 0 != ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER ); if( (rInsTblOpts.mnInsMode & tabopts::HEADLINE) && (1 != nRows || !bDfltBorders) ) pHeadColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ); - const USHORT nRowsToRepeat = + const sal_uInt16 nRowsToRepeat = tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ? rInsTblOpts.mnRowsToRepeat : 0; @@ -428,7 +439,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, const SwAttrSet & aNdSet = pCntntNd->GetSwAttrSet(); const SfxPoolItem *pItem = NULL; - if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, TRUE, &pItem ) + if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem ) && pItem != NULL) { pTableFmt->SetFmtAttr( *pItem ); @@ -444,12 +455,12 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, SwTwips nWidth = USHRT_MAX; if( pColArr ) { - USHORT nSttPos = (*pColArr)[ 0 ]; - USHORT nLastPos = (*pColArr)[ USHORT(pColArr->Count()-1)]; + sal_uInt16 nSttPos = (*pColArr)[ 0 ]; + sal_uInt16 nLastPos = (*pColArr)[ sal_uInt16(pColArr->Count()-1)]; if( text::HoriOrientation::NONE == eAdjust ) { - USHORT nFrmWidth = nLastPos; - nLastPos = (*pColArr)[ USHORT(pColArr->Count()-2)]; + sal_uInt16 nFrmWidth = nLastPos; + nLastPos = (*pColArr)[ sal_uInt16(pColArr->Count()-2)]; pTableFmt->SetFmtAttr( SvxLRSpaceItem( nSttPos, nFrmWidth - nLastPos, 0, 0, RES_LR_SPACE ) ); } nWidth = nLastPos - nSttPos; @@ -461,7 +472,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, } pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth )); if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) ) - pTableFmt->SetFmtAttr( SwFmtLayoutSplit( FALSE )); + pTableFmt->SetFmtAttr( SwFmtLayoutSplit( sal_False )); // verschiebe ggfs. die harten PageDesc/PageBreak Attribute: SwCntntNode* pNextNd = GetNodes()[ pTblNd->EndOfSectionIndex()+1 ] @@ -470,14 +481,14 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, { const SfxItemSet* pNdSet = pNextNd->GetpSwAttrSet(); const SfxPoolItem *pItem; - if( SFX_ITEM_SET == pNdSet->GetItemState( RES_PAGEDESC, FALSE, + if( SFX_ITEM_SET == pNdSet->GetItemState( RES_PAGEDESC, sal_False, &pItem ) ) { pTableFmt->SetFmtAttr( *pItem ); pNextNd->ResetAttr( RES_PAGEDESC ); pNdSet = pNextNd->GetpSwAttrSet(); } - if( pNdSet && SFX_ITEM_SET == pNdSet->GetItemState( RES_BREAK, FALSE, + if( pNdSet && SFX_ITEM_SET == pNdSet->GetItemState( RES_BREAK, sal_False, &pItem ) ) { pTableFmt->SetFmtAttr( *pItem ); @@ -500,8 +511,8 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, } else { - const USHORT nBoxArrLen = pTAFmt ? 16 : 4; - for( USHORT i = 0; i < nBoxArrLen; ++i ) + const sal_uInt16 nBoxArrLen = pTAFmt ? 16 : 4; + for( sal_uInt16 i = 0; i < nBoxArrLen; ++i ) aBoxFmtArr.Insert( (void*)0, i ); } // --> OD 2008-02-25 #refactorlists# @@ -511,19 +522,19 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, SwNodeIndex aNdIdx( *pTblNd, 1 ); // auf den ersten Box-StartNode SwTableLines& rLines = pNdTbl->GetTabLines(); - for( USHORT n = 0; n < nRows; ++n ) + for( sal_uInt16 n = 0; n < nRows; ++n ) { SwTableLine* pLine = new SwTableLine( pLineFmt, nCols, 0 ); rLines.C40_INSERT( SwTableLine, pLine, n ); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( USHORT i = 0; i < nCols; ++i ) + for( sal_uInt16 i = 0; i < nCols; ++i ) { SwTableBoxFmt *pBoxF; if( pTAFmt ) { - BYTE nId = static_cast<BYTE>(!n ? 0 : (( n+1 == nRows ) + sal_uInt8 nId = static_cast<sal_uInt8>(!n ? 0 : (( n+1 == nRows ) ? 12 : (4 * (1 + ((n-1) & 1 ))))); - nId = nId + static_cast<BYTE>( !i ? 0 : + nId = nId + static_cast<sal_uInt8>( !i ? 0 : ( i+1 == nCols ? 3 : (1 + ((i-1) & 1)))); pBoxF = ::lcl_CreateAFmtBoxFmt( *this, aBoxFmtArr, *pTAFmt, nCols, nId ); @@ -541,7 +552,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, } else if( bDfltBorders ) { - BYTE nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 ); + sal_uInt8 nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 ); pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId); } else @@ -552,7 +563,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, // Positionen der Spalten!! (nicht deren Breite!) if( pColArr ) { - nWidth = (*pColArr)[ USHORT(i + 1) ] - (*pColArr)[ i ]; + nWidth = (*pColArr)[ sal_uInt16(i + 1) ] - (*pColArr)[ i ]; if( pBoxF->GetFrmSize().GetWidth() != nWidth ) { if( pBoxF->GetDepends() ) // neues Format erzeugen! @@ -589,10 +600,10 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, } SwTableNode* SwNodes::InsertTable( const SwNodeIndex& rNdIdx, - USHORT nBoxes, + sal_uInt16 nBoxes, SwTxtFmtColl* pCntntTxtColl, - USHORT nLines, - USHORT nRepeat, + sal_uInt16 nLines, + sal_uInt16 nRepeat, SwTxtFmtColl* pHeadlineTxtColl, const SwAttrSet * pAttrSet) { @@ -611,9 +622,9 @@ SwTableNode* SwNodes::InsertTable( const SwNodeIndex& rNdIdx, SwNodeIndex aIdx( *pEndNd ); SwTxtFmtColl* pTxtColl = pHeadlineTxtColl; - for( USHORT nL = 0; nL < nLines; ++nL ) + for( sal_uInt16 nL = 0; nL < nLines; ++nL ) { - for( USHORT nB = 0; nB < nBoxes; ++nB ) + for( sal_uInt16 nB = 0; nB < nBoxes; ++nB ) { SwStartNode* pSttNd = new SwStartNode( aIdx, ND_STARTNODE, SwTableBoxStartNode ); @@ -626,17 +637,17 @@ SwTableNode* SwNodes::InsertTable( const SwNodeIndex& rNdIdx, const SfxPoolItem* pItem = NULL; if ( NULL != pAttrSet ) { - static const USHORT aPropagateItems[] = { + static const sal_uInt16 aPropagateItems[] = { RES_PARATR_ADJUST, RES_CHRATR_FONT, RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONTSIZE, 0 }; - const USHORT* pIdx = aPropagateItems; + const sal_uInt16* pIdx = aPropagateItems; while ( *pIdx != 0 ) { if ( SFX_ITEM_SET != pTmpNd->GetSwAttrSet().GetItemState( *pIdx ) && - SFX_ITEM_SET == pAttrSet->GetItemState( *pIdx, TRUE, &pItem ) ) + SFX_ITEM_SET == pAttrSet->GetItemState( *pIdx, sal_True, &pItem ) ) static_cast<SwCntntNode *>(pTmpNd)->SetAttr(*pItem); ++pIdx; } @@ -662,7 +673,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, // pruefe ob in der Selection eine Tabelle liegt const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End(); { - ULONG nCnt = pStt->nNode.GetIndex(); + sal_uLong nCnt = pStt->nNode.GetIndex(); for( ; nCnt <= pEnd->nNode.GetIndex(); ++nCnt ) if( !GetNodes()[ nCnt ]->IsTxtNode() ) return 0; @@ -680,15 +691,15 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, #endif SwUndoTxtToTbl* pUndo = 0; - if( DoesUndo() ) + if( GetIDocumentUndoRedo().DoesUndo() ) { - StartUndo( UNDO_TEXTTOTABLE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE, NULL ); pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, - static_cast<USHORT>(eAdjust), pTAFmt ); - AppendUndo( pUndo ); + static_cast<sal_uInt16>(eAdjust), pTAFmt ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); // das Splitten vom TextNode nicht in die Undohistory aufnehmen - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo( false ); } ::PaMCorrAbs( aOriginal, *pEnd ); @@ -698,7 +709,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, if( pStt->nContent.GetIndex() ) SplitNode( *pStt, false ); - BOOL bEndCntnt = 0 != pEnd->nContent.GetIndex(); + sal_Bool bEndCntnt = 0 != pEnd->nContent.GetIndex(); // nicht splitten am Ende der Zeile (aber am Ende vom Doc!!) if( bEndCntnt ) { @@ -720,14 +731,14 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() ) { - ASSERT( FALSE, "Kein Bereich" ); + ASSERT( sal_False, "Kein Bereich" ); aRg.aEnd++; } // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen: SwNode2Layout aNode2Layout( aRg.aStart.GetNode() ); - DoUndo( 0 != pUndo ); + GetIDocumentUndoRedo().DoUndo( 0 != pUndo ); // dann erstelle die Box/Line/Table-Struktur SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt(); @@ -739,7 +750,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, // die Tabelle bekommt USHRT_MAX als default SSize pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX )); if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) ) - pTableFmt->SetFmtAttr( SwFmtLayoutSplit( FALSE )); + pTableFmt->SetFmtAttr( SwFmtLayoutSplit( sal_False )); /* #106283# If the first node in the selection is a context node and if it has an item FRAMEDIR set (no default) propagate the item to the @@ -749,7 +760,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, const SwAttrSet & aNdSet = pSttCntntNd->GetSwAttrSet(); const SfxPoolItem *pItem = NULL; - if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, TRUE, &pItem ) + if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem ) && pItem != NULL) { pTableFmt->SetFmtAttr( *pItem ); @@ -763,18 +774,18 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, SwTable * pNdTbl = &pTblNd->GetTable(); ASSERT( pNdTbl, "kein Tabellen-Node angelegt." ) - const USHORT nRowsToRepeat = + const sal_uInt16 nRowsToRepeat = tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ? rInsTblOpts.mnRowsToRepeat : 0; pNdTbl->SetRowsToRepeat( nRowsToRepeat ); - BOOL bUseBoxFmt = FALSE; + sal_Bool bUseBoxFmt = sal_False; if( !pBoxFmt->GetDepends() ) { // die Formate an den Boxen haben schon die richtige Size, es darf // also nur noch die richtige Umrandung/AutoFmt gesetzt werden. - bUseBoxFmt = TRUE; + bUseBoxFmt = sal_True; pTableFmt->SetFmtAttr( pBoxFmt->GetFrmSize() ); delete pBoxFmt; eAdjust = text::HoriOrientation::NONE; @@ -786,10 +797,10 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, if( pTAFmt || ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) ) { - BYTE nBoxArrLen = pTAFmt ? 16 : 4; + sal_uInt8 nBoxArrLen = pTAFmt ? 16 : 4; SvPtrarr aBoxFmtArr( nBoxArrLen, 0 ); { - for( BYTE i = 0; i < nBoxArrLen; ++i ) + for( sal_uInt8 i = 0; i < nBoxArrLen; ++i ) aBoxFmtArr.Insert( (void*)0, i ); } @@ -801,21 +812,21 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, SwTableBoxFmt *pBoxF = 0; SwTableLines& rLines = pNdTbl->GetTabLines(); - USHORT nRows = rLines.Count(); - for( USHORT n = 0; n < nRows; ++n ) + sal_uInt16 nRows = rLines.Count(); + for( sal_uInt16 n = 0; n < nRows; ++n ) { SwTableBoxes& rBoxes = rLines[ n ]->GetTabBoxes(); - USHORT nCols = rBoxes.Count(); - for( USHORT i = 0; i < nCols; ++i ) + sal_uInt16 nCols = rBoxes.Count(); + for( sal_uInt16 i = 0; i < nCols; ++i ) { SwTableBox* pBox = rBoxes[ i ]; - BOOL bChgSz = FALSE; + sal_Bool bChgSz = sal_False; if( pTAFmt ) { - BYTE nId = static_cast<BYTE>(!n ? 0 : (( n+1 == nRows ) + sal_uInt8 nId = static_cast<sal_uInt8>(!n ? 0 : (( n+1 == nRows ) ? 12 : (4 * (1 + ((n-1) & 1 ))))); - nId = nId + static_cast<BYTE>(!i ? 0 : + nId = nId + static_cast<sal_uInt8>(!i ? 0 : ( i+1 == nCols ? 3 : (1 + ((i-1) & 1)))); if( bUseBoxFmt ) ::lcl_SetDfltBoxAttr( *pBox, aBoxFmtArr, nId, pTAFmt ); @@ -834,8 +845,8 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, SwTableAutoFmt::UPDATE_CHAR, 0 ); if( aCharSet.Count() ) { - ULONG nSttNd = pBox->GetSttIdx()+1; - ULONG nEndNd = pBox->GetSttNd()->EndOfSectionIndex(); + sal_uLong nSttNd = pBox->GetSttIdx()+1; + sal_uLong nEndNd = pBox->GetSttNd()->EndOfSectionIndex(); for( ; nSttNd < nEndNd; ++nSttNd ) { SwCntntNode* pNd = GetNodes()[ nSttNd ]->GetCntntNode(); @@ -855,7 +866,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, } else { - BYTE nId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 ); + sal_uInt8 nId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 ); if( bUseBoxFmt ) ::lcl_SetDfltBoxAttr( *pBox, aBoxFmtArr, nId ); else @@ -877,7 +888,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, if( bUseBoxFmt ) { - for( BYTE i = 0; i < nBoxArrLen; ++i ) + for( sal_uInt8 i = 0; i < nBoxArrLen; ++i ) { SvPtrarr* pArr = (SvPtrarr*)aBoxFmtArr[ i ]; delete pArr; @@ -888,11 +899,11 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, // JP 03.04.97: Inhalt der Boxen auf Zahlen abpruefen if( IsInsTblFormatNum() ) { - for( USHORT nBoxes = pNdTbl->GetTabSortBoxes().Count(); nBoxes; ) - ChkBoxNumFmt( *pNdTbl->GetTabSortBoxes()[ --nBoxes ], FALSE ); + for( sal_uInt16 nBoxes = pNdTbl->GetTabSortBoxes().Count(); nBoxes; ) + ChkBoxNumFmt( *pNdTbl->GetTabSortBoxes()[ --nBoxes ], sal_False ); } - ULONG nIdx = pTblNd->GetIndex(); + sal_uLong nIdx = pTblNd->GetIndex(); aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 ); { @@ -904,7 +915,9 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, } if( pUndo ) - EndUndo( UNDO_TEXTTOTABLE, NULL ); + { + GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, NULL ); + } SetModified(); SetFieldsDirty(true, NULL, 0); @@ -929,7 +942,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, SwTable * pTable = &pTblNd->GetTable(); SwTableLine* pLine; SwTableBox* pBox; - USHORT nBoxes, nLines, nMaxBoxes = 0; + sal_uInt16 nBoxes, nLines, nMaxBoxes = 0; SwNodeIndex aSttIdx( *pTblNd, 1 ); SwNodeIndex aEndIdx( rRange.aEnd, -1 ); @@ -954,14 +967,14 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, { if( *pTxt == cCh ) { - aPosArr.Insert( static_cast<USHORT>( - aFInfo.GetCharPos( nChPos+1, FALSE )), + aPosArr.Insert( static_cast<sal_uInt16>( + aFInfo.GetCharPos( nChPos+1, sal_False )), aPosArr.Count() ); } } aPosArr.Insert( /*aFInfo.GetFrm()->Frm().Left() +*/ - static_cast<USHORT>(aFInfo.GetFrm()->IsVertical() ? + static_cast<sal_uInt16>(aFInfo.GetFrm()->IsVertical() ? aFInfo.GetFrm()->Prt().Bottom() : aFInfo.GetFrm()->Prt().Right()), aPosArr.Count() ); @@ -979,7 +992,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, // erfolgen, denn sonst stehen sie falsch in der History !!! // SwRegHistory aRegH( pTxtNd, *pTxtNd, pHistory ); const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE, &pItem ) ) + if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pItem ) ) { if( !nLines ) pTblFmt->SetFmtAttr( *pItem ); @@ -988,7 +1001,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, } if( pSet && SFX_ITEM_SET == pSet->GetItemState( - RES_PAGEDESC, FALSE, &pItem ) && + RES_PAGEDESC, sal_False, &pItem ) && ((SwFmtPageDesc*)pItem)->GetPageDesc() ) { if( !nLines ) @@ -1059,7 +1072,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, } // die Tabelle ausgleichen, leere Sections einfuegen - USHORT n; + sal_uInt16 n; for( n = 0; n < pTable->GetTabLines().Count(); ++n ) { @@ -1070,7 +1083,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, nBoxes, nMaxBoxes - nBoxes ); if( pUndo ) - for( USHORT i = nBoxes; i < nMaxBoxes; ++i ) + for( sal_uInt16 i = nBoxes; i < nMaxBoxes; ++i ) pUndo->AddFillBox( *pCurrLine->GetTabBoxes()[ i ] ); // fehlen der 1. Line Boxen, dann kann man das Breiten Array @@ -1083,13 +1096,13 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, if( aPosArr.Count() ) { SwTableLines& rLns = pTable->GetTabLines(); - USHORT nLastPos = 0; + sal_uInt16 nLastPos = 0; for( n = 0; n < aPosArr.Count(); ++n ) { SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt(); pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, aPosArr[ n ] - nLastPos )); - for( USHORT nTmpLine = 0; nTmpLine < rLns.Count(); ++nTmpLine ) + for( sal_uInt16 nTmpLine = 0; nTmpLine < rLns.Count(); ++nTmpLine ) //JP 24.06.98: hier muss ein Add erfolgen, da das BoxFormat // von der rufenden Methode noch gebraucht wird! pNewFmt->Add( rLns[ nTmpLine ]->GetTabBoxes()[ n ] ); @@ -1134,11 +1147,19 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > lcl_DelRedlines aDelRedl( aOriginal ); #endif - SwUndoTxtToTbl* pUndo = 0; - if( DoesUndo() ) +// SwUndoTxtToTbl* pUndo = 0; + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { +<<<<<<< local +======= +// GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE ); +// pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, eAdjust, pTAFmt ); +// GetIDocumentUndoRedo().AppendUndo(pUndo); + +>>>>>>> other // das Splitten vom TextNode nicht in die Undohistory aufnehmen - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } ::PaMCorrAbs( aOriginal, *pEnd ); @@ -1148,7 +1169,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > if( pStt->nContent.GetIndex() ) SplitNode( *pStt, false ); - BOOL bEndCntnt = 0 != pEnd->nContent.GetIndex(); + sal_Bool bEndCntnt = 0 != pEnd->nContent.GetIndex(); // nicht splitten am Ende der Zeile (aber am Ende vom Doc!!) if( bEndCntnt ) { @@ -1170,14 +1191,14 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() ) { - ASSERT( FALSE, "Kein Bereich" ); + ASSERT( sal_False, "Kein Bereich" ); aRg.aEnd++; } // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen: SwNode2Layout aNode2Layout( aRg.aStart.GetNode() ); - DoUndo( 0 != pUndo ); + GetIDocumentUndoRedo().DoUndo(bUndo); // dann erstelle die Box/Line/Table-Struktur SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt(); @@ -1188,6 +1209,11 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > pLineFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT )); // die Tabelle bekommt USHRT_MAX als default SSize pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX )); +<<<<<<< local +======= +// if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) ) +// pTableFmt->SetAttr( SwFmtLayoutSplit( sal_False )); +>>>>>>> other /* #106283# If the first node in the selection is a context node and if it has an item FRAMEDIR set (no default) propagate the item to the @@ -1197,7 +1223,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > const SwAttrSet & aNdSet = pSttCntntNd->GetSwAttrSet(); const SfxPoolItem *pItem = NULL; - if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, TRUE, &pItem ) + if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem ) && pItem != NULL) { pTableFmt->SetFmtAttr( *pItem ); @@ -1210,21 +1236,54 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > SwTable * pNdTbl = &pTblNd->GetTable(); ASSERT( pNdTbl, "kein Tabellen-Node angelegt." ) +<<<<<<< local pNdTbl->RegisterToFormat( *pTableFmt ); +======= + pTableFmt->Add( pNdTbl ); // das Frame-Format setzen + +// const sal_uInt16 nRowsToRepeat = +// tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ? +// rInsTblOpts.mnRowsToRepeat : +// 0; +// pNdTbl->SetRowsToRepeat( nRowsToRepeat ); +>>>>>>> other - BOOL bUseBoxFmt = FALSE; + sal_Bool bUseBoxFmt = sal_False; if( !pBoxFmt->GetDepends() ) { // die Formate an den Boxen haben schon die richtige Size, es darf // also nur noch die richtige Umrandung/AutoFmt gesetzt werden. - bUseBoxFmt = TRUE; + bUseBoxFmt = sal_True; pTableFmt->SetFmtAttr( pBoxFmt->GetFrmSize() ); delete pBoxFmt; } +<<<<<<< local ULONG nIdx = pTblNd->GetIndex(); +======= + //Orientation am Fmt der Table setzen +// pTableFmt->SetAttr( SwFmtHoriOrient( 0, eAdjust ) ); +// pTableFmt->Add( pNdTbl ); // das Frame-Format setzen + + + sal_uLong nIdx = pTblNd->GetIndex(); +>>>>>>> other aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 ); +<<<<<<< local +======= + { +// SwPaM& rTmp = (SwPaM&)rRange; // Point immer an den Anfang +// rTmp.DeleteMark(); +// rTmp.GetPoint()->nNode = *pTblNd; +// SwCntntNode* pCNd = GetNodes().GoNext( &rTmp.GetPoint()->nNode ); +// rTmp.GetPoint()->nContent.Assign( pCNd, 0 ); + } + +// if( pUndo ) +// GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE ); + +>>>>>>> other SetModified(); SetFieldsDirty( true, NULL, 0 ); return pNdTbl; @@ -1327,7 +1386,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, SwTable * pTable = &pTblNd->GetTable(); SwTableLine* pLine; SwTableBox* pBox; - USHORT nBoxes, nLines, nMaxBoxes = 0; + sal_uInt16 nBoxes, nLines, nMaxBoxes = 0; // SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0; @@ -1355,7 +1414,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, // erfolgen, denn sonst stehen sie falsch in der History !!! // SwRegHistory aRegH( pTxtNd, *pTxtNd, pHistory ); const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE, &pItem ) ) + if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pItem ) ) { if( !nLines ) pTblFmt->SetFmtAttr( *pItem ); @@ -1364,7 +1423,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, } if( pSet && SFX_ITEM_SET == pSet->GetItemState( - RES_PAGEDESC, FALSE, &pItem ) && + RES_PAGEDESC, sal_False, &pItem ) && ((SwFmtPageDesc*)pItem)->GetPageDesc() ) { if( !nLines ) @@ -1434,18 +1493,18 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, } // die Tabelle ausgleichen, leere Sections einfuegen - USHORT n; + sal_uInt16 n; if( aPosArr.Count() ) { SwTableLines& rLns = pTable->GetTabLines(); - USHORT nLastPos = 0; + sal_uInt16 nLastPos = 0; for( n = 0; n < aPosArr.Count(); ++n ) { SwTableBoxFmt *pNewFmt = pDoc->MakeTableBoxFmt(); pNewFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, aPosArr[ n ] - nLastPos )); - for( USHORT nLines2 = 0; nLines2 < rLns.Count(); ++nLines2 ) + for( sal_uInt16 nLines2 = 0; nLines2 < rLns.Count(); ++nLines2 ) //JP 24.06.98: hier muss ein Add erfolgen, da das BoxFormat // von der rufenden Methode noch gebraucht wird! pNewFmt->Add( rLns[ nLines2 ]->GetTabBoxes()[ n ] ); @@ -1469,10 +1528,10 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, //---------------- Tabelle -> Text ----------------------- -BOOL SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) +sal_Bool SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) { if( !pTblNd ) - return FALSE; + return sal_False; // --> FME 2004-09-28 #i34471# // If this is trigged by SwUndoTblToTxt::Repeat() nobody ever deleted @@ -1483,15 +1542,15 @@ BOOL SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) // <-- #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, FALSE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_False ); #endif SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode() ); SwUndoTblToTxt* pUndo = 0; SwNodeRange* pUndoRg = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoRg = new SwNodeRange( aRg.aStart, -1, aRg.aEnd, +1 ); pUndo = new SwUndoTblToTxt( pTblNd->GetTable(), cCh ); } @@ -1500,13 +1559,13 @@ BOOL SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) aMsgHnt.eFlags = TBL_BOXNAME; UpdateTblFlds( &aMsgHnt ); - BOOL bRet = GetNodes().TableToText( aRg, cCh, pUndo ); + sal_Bool bRet = GetNodes().TableToText( aRg, cCh, pUndo ); if( pUndoRg ) { pUndoRg->aStart++; pUndoRg->aEnd--; pUndo->SetRange( *pUndoRg ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); delete pUndoRg; } @@ -1534,9 +1593,9 @@ struct _DelTabPara // forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen // koennen. -BOOL lcl_DelBox( const SwTableBox*&, void *pPara ); +sal_Bool lcl_DelBox( const SwTableBox*&, void *pPara ); -BOOL lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) { ASSERT( pPara, "die Parameter fehlen" ); _DelTabPara aPara( *(_DelTabPara*)pPara ); @@ -1544,11 +1603,11 @@ BOOL lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) if( rpLine->GetUpper() ) // gibt es noch eine uebergeordnete Box ?? // dann gebe den letzten TextNode zurueck ((_DelTabPara*)pPara)->pLastNd = aPara.pLastNd; - return TRUE; + return sal_True; } -BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) { ASSERT( pPara, "die Parameter fehlen" ); @@ -1568,7 +1627,7 @@ BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) 0 != ( pCurTxtNd = aDelRg.aStart.GetNode().GetTxtNode() )) { // Join the current text node with the last from the previous box if possible - ULONG nNdIdx = aDelRg.aStart.GetIndex(); + sal_uLong nNdIdx = aDelRg.aStart.GetIndex(); aDelRg.aStart--; if( pDelPara->pLastNd == &aDelRg.aStart.GetNode() ) { @@ -1608,19 +1667,19 @@ BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) if( pDelPara->pLastNd && pDelPara->pLastNd->HasSwAttrSet() ) pDelPara->pLastNd->ResetAttr( RES_PARATR_ADJUST ); } - return TRUE; + return sal_True; } -BOOL SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, +sal_Bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, SwUndoTblToTxt* pUndo ) { // ist eine Tabelle selektiert ? SwTableNode* pTblNd; if( rRange.aStart.GetIndex() >= rRange.aEnd.GetIndex() || - 0 == ( pTblNd = (*this)[ rRange.aStart ]->GetTableNode()) || + 0 == ( pTblNd = rRange.aStart.GetNode().GetTableNode()) || &rRange.aEnd.GetNode() != pTblNd->EndOfSectionNode() ) - return FALSE; + return sal_False; // stand die Tabelle ganz alleine in einer Section ? // dann ueber den Upper der Tabelle die Frames anlegen @@ -1649,9 +1708,9 @@ BOOL SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, // was ist mit UNDO??? const SfxItemSet& rTblSet = pTblNd->pTable->GetFrmFmt()->GetAttrSet(); const SfxPoolItem *pBreak, *pDesc; - if( SFX_ITEM_SET != rTblSet.GetItemState( RES_PAGEDESC, FALSE, &pDesc )) + if( SFX_ITEM_SET != rTblSet.GetItemState( RES_PAGEDESC, sal_False, &pDesc )) pDesc = 0; - if( SFX_ITEM_SET != rTblSet.GetItemState( RES_BREAK, FALSE, &pBreak )) + if( SFX_ITEM_SET != rTblSet.GetItemState( RES_BREAK, sal_False, &pBreak )) pBreak = 0; if( pBreak || pDesc ) @@ -1667,7 +1726,7 @@ BOOL SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, SectionUp( &aDelRg ); // loesche die Section und damit die Tabelle // #i28006# - ULONG nStt = aDelRg.aStart.GetIndex(), nEnd = aDelRg.aEnd.GetIndex(); + sal_uLong nStt = aDelRg.aStart.GetIndex(), nEnd = aDelRg.aEnd.GetIndex(); if( !pFrmNd ) { pNode2Layout->RestoreUpperFrms( *this, @@ -1707,7 +1766,7 @@ BOOL SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, // #i28006# Fly frames have to be restored even if the table was // #alone in the section const SwSpzFrmFmts& rFlyArr = *GetDoc()->GetSpzFrmFmts(); - for( USHORT n = 0; n < rFlyArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFlyArr.Count(); ++n ) { SwFrmFmt *const pFmt = (SwFrmFmt*)rFlyArr[n]; const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); @@ -1722,73 +1781,75 @@ BOOL SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, } } - return TRUE; + return sal_True; } // ----- einfuegen von Spalten/Zeilen ------------------------ -BOOL SwDoc::InsertCol( const SwCursor& rCursor, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertCol( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bBehind ) { if( !::CheckSplitCells( rCursor, nCnt + 1, nsSwTblSearchType::TBLSEARCH_COL ) ) - return FALSE; + return sal_False; // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; ::GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_COL ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( aBoxes.Count() ) bRet = InsertCol( aBoxes, nCnt, bBehind ); return bRet; } -BOOL SwDoc::InsertCol( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; SwTable& rTbl = pTblNd->GetTable(); if( rTbl.ISA( SwDDETable )) - return FALSE; + return sal_False; #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - DoUndo( FALSE ); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSCOL, rBoxes, *pTblNd, - 0, 0, nCnt, bBehind, FALSE ); + 0, 0, nCnt, bBehind, sal_False ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); } - SwTableFmlUpdate aMsgHnt( &rTbl ); - aMsgHnt.eFlags = TBL_BOXPTR; - UpdateTblFlds( &aMsgHnt ); - - BOOL bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind ); - if( bRet ) + bool bRet(false); { - SetModified(); - ::ClearFEShellTabCols(); - SetFieldsDirty( true, NULL, 0 ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + + SwTableFmlUpdate aMsgHnt( &rTbl ); + aMsgHnt.eFlags = TBL_BOXPTR; + UpdateTblFlds( &aMsgHnt ); + + bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind ); + if (bRet) + { + SetModified(); + ::ClearFEShellTabCols(); + SetFieldsDirty( true, NULL, 0 ); + } } if( pUndo ) { - DoUndo( TRUE ); if( bRet ) { - ClearRedo(); pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -1796,64 +1857,66 @@ BOOL SwDoc::InsertCol( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) return bRet; } -BOOL SwDoc::InsertRow( const SwCursor& rCursor, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertRow( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bBehind ) { // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( aBoxes.Count() ) bRet = InsertRow( aBoxes, nCnt, bBehind ); return bRet; } -BOOL SwDoc::InsertRow( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; SwTable& rTbl = pTblNd->GetTable(); if( rTbl.ISA( SwDDETable )) - return FALSE; + return sal_False; #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - DoUndo( FALSE ); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSROW,rBoxes, *pTblNd, - 0, 0, nCnt, bBehind, FALSE ); + 0, 0, nCnt, bBehind, sal_False ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); } - SwTableFmlUpdate aMsgHnt( &rTbl ); - aMsgHnt.eFlags = TBL_BOXPTR; - UpdateTblFlds( &aMsgHnt ); - - BOOL bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind ); - if( bRet ) + bool bRet(false); { - SetModified(); - ::ClearFEShellTabCols(); - SetFieldsDirty( true, NULL, 0 ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + + SwTableFmlUpdate aMsgHnt( &rTbl ); + aMsgHnt.eFlags = TBL_BOXPTR; + UpdateTblFlds( &aMsgHnt ); + + bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind ); + if (bRet) + { + SetModified(); + ::ClearFEShellTabCols(); + SetFieldsDirty( true, NULL, 0 ); + } } if( pUndo ) { - DoUndo( TRUE ); if( bRet ) { - ClearRedo(); pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -1864,13 +1927,13 @@ BOOL SwDoc::InsertRow( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) // ----- loeschen von Spalten/Zeilen ------------------------ -BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) +sal_Bool SwDoc::DeleteRow( const SwCursor& rCursor ) { // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW ); if( ::HasProtectedCells( aBoxes )) - return FALSE; + return sal_False; // die Crsr aus dem Loeschbereich entfernen. // Der Cursor steht danach: @@ -1881,7 +1944,7 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) SwTableNode* pTblNd = rCursor.GetNode()->FindTableNode(); if( pTblNd->GetTable().ISA( SwDDETable )) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -1891,7 +1954,7 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; SwEditShell* pESh = GetEditShell(); if( pESh ) @@ -1921,7 +1984,7 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) pDelBox = pLn->GetTabBoxes()[ pLn->GetTabBoxes().Count() - 1 ]; } SwTableBox* pNextBox = pDelLine->FindNextBox( pTblNd->GetTable(), - pDelBox, TRUE ); + pDelBox, sal_True ); while( pNextBox && pNextBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) pNextBox = pNextBox->FindNextBox( pTblNd->GetTable(), pNextBox ); @@ -1933,13 +1996,13 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) while( !pDelBox->GetSttNd() ) pDelBox = pDelBox->GetTabLines()[0]->GetTabBoxes()[0]; pNextBox = pDelLine->FindPreviousBox( pTblNd->GetTable(), - pDelBox, TRUE ); + pDelBox, sal_True ); while( pNextBox && pNextBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) pNextBox = pNextBox->FindPreviousBox( pTblNd->GetTable(), pNextBox ); } - ULONG nIdx; + sal_uLong nIdx; if( pNextBox ) // dann den Cursor hier hinein nIdx = pNextBox->GetSttIdx() + 1; else // ansonsten hinter die Tabelle @@ -1963,20 +2026,20 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) // dann loesche doch die Zeilen - StartUndo(UNDO_ROW_DELETE, NULL); - BOOL bResult = DeleteRowCol( aBoxes ); - EndUndo(UNDO_ROW_DELETE, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_ROW_DELETE, NULL); + sal_Bool bResult = DeleteRowCol( aBoxes ); + GetIDocumentUndoRedo().EndUndo(UNDO_ROW_DELETE, NULL); return bResult; } -BOOL SwDoc::DeleteCol( const SwCursor& rCursor ) +sal_Bool SwDoc::DeleteCol( const SwCursor& rCursor ) { // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_COL ); if( ::HasProtectedCells( aBoxes )) - return FALSE; + return sal_False; // die Crsr muessen noch aus dem Loesch Bereich entfernt // werden. Setze sie immer hinter/auf die Tabelle; ueber die @@ -1989,26 +2052,26 @@ BOOL SwDoc::DeleteCol( const SwCursor& rCursor ) } // dann loesche doch die Spalten - StartUndo(UNDO_COL_DELETE, NULL); - BOOL bResult = DeleteRowCol( aBoxes, true ); - EndUndo(UNDO_COL_DELETE, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_COL_DELETE, NULL); + sal_Bool bResult = DeleteRowCol( aBoxes, true ); + GetIDocumentUndoRedo().EndUndo(UNDO_COL_DELETE, NULL); return bResult; } -BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) +sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) { if( ::HasProtectedCells( rBoxes )) - return FALSE; + return sal_False; // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; if( pTblNd->GetTable().ISA( SwDDETable )) - return FALSE; + return sal_False; ::ClearFEShellTabCols(); SwSelBoxes aSelBoxes; @@ -2025,25 +2088,25 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) } #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif // soll die gesamte Tabelle geloescht werden ?? - const ULONG nTmpIdx1 = pTblNd->GetIndex(); - const ULONG nTmpIdx2 = aSelBoxes[ aSelBoxes.Count()-1 ]->GetSttNd()-> + const sal_uLong nTmpIdx1 = pTblNd->GetIndex(); + const sal_uLong nTmpIdx2 = aSelBoxes[ aSelBoxes.Count()-1 ]->GetSttNd()-> EndOfSectionIndex()+1; if( pTblNd->GetTable().GetTabSortBoxes().Count() == aSelBoxes.Count() && aSelBoxes[0]->GetSttIdx()-1 == nTmpIdx1 && nTmpIdx2 == pTblNd->EndOfSectionIndex() ) { - BOOL bNewTxtNd = FALSE; + sal_Bool bNewTxtNd = sal_False; // steht diese auch noch alleine in einem FlyFrame ? SwNodeIndex aIdx( *pTblNd, -1 ); const SwStartNode* pSttNd = aIdx.GetNode().GetStartNode(); if( pSttNd ) { - const ULONG nTblEnd = pTblNd->EndOfSectionIndex() + 1; - const ULONG nSectEnd = pSttNd->EndOfSectionIndex(); + const sal_uLong nTblEnd = pTblNd->EndOfSectionIndex() + 1; + const sal_uLong nSectEnd = pSttNd->EndOfSectionIndex(); if( nTblEnd == nSectEnd ) { if( SwFlyStartNode == pSttNd->GetStartNodeType() ) @@ -2053,22 +2116,22 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) { // Ok, das ist das gesuchte FlyFormat DelLayoutFmt( pFmt ); - return TRUE; + return sal_True; } } // kein Fly ?? also Kopf- oder Fusszeile: dann immer einen // TextNode ueberig lassen. // Undo koennen wir dann vergessen !! - bNewTxtNd = TRUE; + bNewTxtNd = sal_True; } } // kein Fly ?? also Kopf- oder Fusszeile: dann immer einen // TextNode ueberig lassen. aIdx++; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwPaM aPaM( *pTblNd->EndOfSectionNode(), aIdx.GetNode() ); if( bNewTxtNd ) @@ -2091,8 +2154,8 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) } // harte SeitenUmbrueche am nachfolgenden Node verschieben - BOOL bSavePageBreak = FALSE, bSavePageDesc = FALSE; - ULONG nNextNd = pTblNd->EndOfSectionIndex()+1; + sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False; + sal_uLong nNextNd = pTblNd->EndOfSectionIndex()+1; SwCntntNode* pNextNd = GetNodes()[ nNextNd ]->GetCntntNode(); if( pNextNd ) { @@ -2105,17 +2168,17 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) SwFrmFmt* pTableFmt = pTblNd->GetTable().GetFrmFmt(); const SfxPoolItem *pItem; if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_PAGEDESC, - FALSE, &pItem ) ) + sal_False, &pItem ) ) { pNextNd->SetAttr( *pItem ); - bSavePageDesc = TRUE; + bSavePageDesc = sal_True; } if( SFX_ITEM_SET == pTableFmt->GetItemState( RES_BREAK, - FALSE, &pItem ) ) + sal_False, &pItem ) ) { pNextNd->SetAttr( *pItem ); - bSavePageBreak = TRUE; + bSavePageBreak = sal_True; } } } @@ -2124,7 +2187,7 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) pUndo->SetTblDelLastNd(); pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc ); pUndo->SetTableName(pTblNd->GetTable().GetFrmFmt()->GetName()); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else { @@ -2154,11 +2217,11 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) SwFrmFmt* pTableFmt = pTblNd->GetTable().GetFrmFmt(); 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 ); } @@ -2167,43 +2230,45 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) } SetModified(); SetFieldsDirty( true, NULL, 0 ); - return TRUE; + return sal_True; } SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - DoUndo( FALSE ); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_DELBOX, aSelBoxes, *pTblNd, - nMin, nMax, 0, FALSE, FALSE ); + nMin, nMax, 0, sal_False, sal_False ); } - SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() ); - aMsgHnt.eFlags = TBL_BOXPTR; - UpdateTblFlds( &aMsgHnt ); - - if( rTable.IsNewModel() ) + bool bRet(false); { - if( bColumn ) - rTable.PrepareDeleteCol( nMin, nMax ); - rTable.FindSuperfluousRows( aSelBoxes ); - if( pUndo ) - pUndo->ReNewBoxes( aSelBoxes ); - } - const BOOL bRet = rTable.DeleteSel( this, aSelBoxes, 0, pUndo, TRUE, TRUE ); - if( bRet ) - { - SetModified(); - SetFieldsDirty( true, NULL, 0 ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + + SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() ); + aMsgHnt.eFlags = TBL_BOXPTR; + UpdateTblFlds( &aMsgHnt ); + + if (rTable.IsNewModel()) + { + if (bColumn) + rTable.PrepareDeleteCol( nMin, nMax ); + rTable.FindSuperfluousRows( aSelBoxes ); + if (pUndo) + pUndo->ReNewBoxes( aSelBoxes ); + } + bRet = rTable.DeleteSel( this, aSelBoxes, 0, pUndo, sal_True, sal_True ); + if (bRet) + { + SetModified(); + SetFieldsDirty( true, NULL, 0 ); + } } if( pUndo ) { - DoUndo( TRUE ); if( bRet ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -2215,37 +2280,35 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) // ---------- teilen / zusammenfassen von Boxen in der Tabelle -------- -BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt, +sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 nCnt, sal_Bool bSameHeight ) { // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; SwTable& rTbl = pTblNd->GetTable(); if( rTbl.ISA( SwDDETable )) - return FALSE; + return sal_False; #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif SvULongs aNdsCnts; SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - BOOL bDoUndo = DoesUndo(); - if( bDoUndo ) + if (GetIDocumentUndoRedo().DoesUndo()) { - DoUndo( FALSE ); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_SPLIT, rBoxes, *pTblNd, 0, 0, nCnt, bVert, bSameHeight ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); if( !bVert ) { - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { const SwStartNode* pSttNd = rBoxes[ n ]->GetSttNd(); aNdsCnts.Insert( pSttNd->EndOfSectionIndex() - @@ -2254,33 +2317,35 @@ BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt, } } - SwTableFmlUpdate aMsgHnt( &rTbl ); - aMsgHnt.eFlags = TBL_BOXPTR; - UpdateTblFlds( &aMsgHnt ); + bool bRet(false); + { + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); - BOOL bRet; - if( bVert ) - bRet = rTbl.SplitCol( this, rBoxes, nCnt ); - else - bRet = rTbl.SplitRow( this, rBoxes, nCnt, bSameHeight ); + SwTableFmlUpdate aMsgHnt( &rTbl ); + aMsgHnt.eFlags = TBL_BOXPTR; + UpdateTblFlds( &aMsgHnt ); - if( bRet ) - { - SetModified(); - SetFieldsDirty( true, NULL, 0 ); + if (bVert) + bRet = rTbl.SplitCol( this, rBoxes, nCnt ); + else + bRet = rTbl.SplitRow( this, rBoxes, nCnt, bSameHeight ); + + if (bRet) + { + SetModified(); + SetFieldsDirty( true, NULL, 0 ); + } } - DoUndo( bDoUndo ); if( pUndo ) { if( bRet ) { - ClearRedo(); if( bVert ) pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); else pUndo->SaveNewBoxes( *pTblNd, aTmpLst, rBoxes, aNdsCnts ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -2290,7 +2355,7 @@ BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt, } -USHORT SwDoc::MergeTbl( SwPaM& rPam ) +sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam ) { // pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen SwTableNode* pTblNd = rPam.GetNode()->FindTableNode(); @@ -2299,7 +2364,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) SwTable& rTable = pTblNd->GetTable(); if( rTable.ISA(SwDDETable) ) return TBLMERGE_NOSELECTION; - USHORT nRet = TBLMERGE_NOSELECTION; + sal_uInt16 nRet = TBLMERGE_NOSELECTION; if( !rTable.IsNewModel() ) { nRet =::CheckMergeSel( rPam ); @@ -2309,7 +2374,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) } // --> FME 2004-10-08 #i33394# - StartUndo( UNDO_TABLE_MERGE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_MERGE, NULL ); // <-- #ifdef DEL_TABLE_REDLINES @@ -2319,9 +2384,9 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) RedlineMode_t eOld = GetRedlineMode(); SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - SwUndoTblMerge* pUndo = 0; - if( DoesUndo() ) - pUndo = new SwUndoTblMerge( rPam ); + SwUndoTblMerge *const pUndo( (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoTblMerge( rPam ) + : 0 ); // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; @@ -2334,13 +2399,19 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) if( pUndo ) { delete pUndo; - if( UNDO_REDLINE == GetUndoIds(NULL, NULL) ) + SwUndoId nLastUndoId(UNDO_EMPTY); + if (GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId) + && (UNDO_REDLINE == nLastUndoId)) { - SwUndoRedline* pU = (SwUndoRedline*)RemoveLastUndo( UNDO_REDLINE ); + // FIXME: why is this horrible cleanup necessary? + SwUndoRedline *const pU = dynamic_cast<SwUndoRedline*>( + GetUndoManager().RemoveLastUndo()); if( pU->GetRedlSaveCount() ) { - SwUndoIter aUndoIter( &rPam, UNDO_REDLINE ); - pU->Undo( aUndoIter ); + SwEditShell *const pEditShell(GetEditShell(0)); + OSL_ASSERT(pEditShell); + ::sw::UndoRedoContext context(*this, *pEditShell); + static_cast<SfxUndoAction *>(pU)->UndoWithContext(context); } delete pU; } @@ -2363,7 +2434,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) SwPaM* pTmp = &rPam; while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() )) for( int i = 0; i < 2; ++i ) - pTmp->GetBound( (BOOL)i ) = *rPam.GetPoint(); + pTmp->GetBound( (sal_Bool)i ) = *rPam.GetPoint(); } // dann fuege sie zusammen @@ -2377,7 +2448,9 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) SetModified(); SetFieldsDirty( true, NULL, 0 ); if( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } } else if( pUndo ) delete pUndo; @@ -2388,7 +2461,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) ::ClearFEShellTabCols(); SetRedlineMode_intern( eOld ); } - EndUndo( UNDO_TABLE_MERGE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_MERGE, NULL ); return nRet; } @@ -2435,7 +2508,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx ) ASSERT( pNode, "Kein Contentnode oder Copy-Node und neuer Node identisch."); - BOOL bBefore = rIdx < GetIndex(); + sal_Bool bBefore = rIdx < GetIndex(); SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() ); @@ -2502,7 +2575,12 @@ void SwTableNode::DelFrms() SwTabFrm *pFrm = aIter.First(); while ( pFrm ) { +<<<<<<< local BOOL bAgain = FALSE; +======= + sal_Bool bAgain = sal_False; + if ( pLast->IsA( TYPE(SwFrm) ) ) +>>>>>>> other { if ( !pFrm->IsFollow() ) { @@ -2526,7 +2604,7 @@ void SwTableNode::DelFrms() // <-- pFrm->Cut(); delete pFrm; - bAgain = TRUE; + bAgain = sal_True; } } pFrm = bAgain ? aIter.First() : aIter.Next(); @@ -2534,7 +2612,7 @@ void SwTableNode::DelFrms() } -void SwTableNode::SetNewTable( SwTable* pNewTable, BOOL bNewFrames ) +void SwTableNode::SetNewTable( SwTable* pNewTable, sal_Bool bNewFrames ) { DelFrms(); delete pTable; @@ -2569,7 +2647,11 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr, if( pShCrsr ) aPt = pShCrsr->GetPtPos(); +<<<<<<< local const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, FALSE ); +======= + const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, sal_False ); +>>>>>>> other do { pTmpFrm = pTmpFrm->GetUpper(); } while ( !pTmpFrm->IsCellFrm() ); @@ -2587,9 +2669,9 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr, //Fix-Punkte setzen, LeftMin in Dokumentkoordinaten die anderen relativ. SWRECTFN( pTab ) const SwPageFrm* pPage = pTab->FindPageFrm(); - const ULONG nLeftMin = (pTab->Frm().*fnRect->fnGetLeft)() - + const sal_uLong nLeftMin = (pTab->Frm().*fnRect->fnGetLeft)() - (pPage->Frm().*fnRect->fnGetLeft)(); - const ULONG nRightMax = (pTab->Frm().*fnRect->fnGetRight)() - + const sal_uLong nRightMax = (pTab->Frm().*fnRect->fnGetRight)() - (pPage->Frm().*fnRect->fnGetLeft)(); rFill.SetLeftMin ( nLeftMin ); @@ -2618,7 +2700,7 @@ bool FuzzyCompare::operator() ( long s1, long s2 ) const bool lcl_IsFrmInColumn( const SwCellFrm& rFrm, SwSelBoxes& rBoxes ) { - for( USHORT i = 0; i < rBoxes.Count(); ++i ) + for( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) { if ( rFrm.GetTabBox() == rBoxes[ i ] ) return true; @@ -2729,7 +2811,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , // calculate hidden flags for entry nUpperBorder/nLowerBorder: long nTmpVal = nUpperBorder; - for ( BYTE i = 0; i < 2; ++i ) + for ( sal_uInt8 i = 0; i < 2; ++i ) { aHiddenIter = aHidden.find( nTmpVal ); if ( aHiddenIter == aHidden.end() ) @@ -2748,7 +2830,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , } // transfer calculated values from BoundaryMap and HiddenMap into rFill: - USHORT nIdx = 0; + sal_uInt16 nIdx = 0; for ( aIter = aBoundaries.begin(); aIter != aBoundaries.end(); ++aIter ) { const long nTabTop = (pTab->*fnRect->fnGetPrtTop)(); @@ -2772,7 +2854,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , rFill.SetLastRowAllowedToChange( !pTab->HasFollowFlowLine() ); } -void SwDoc::SetTabCols( const SwTabCols &rNew, BOOL bCurRowOnly, +void SwDoc::SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly, const SwCursor* pCrsr, const SwCellFrm* pBoxFrm ) { const SwTableBox* pBox = 0; @@ -2794,7 +2876,11 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, BOOL bCurRowOnly, if( pShCrsr ) aPt = pShCrsr->GetPtPos(); +<<<<<<< local const SwFrm* pTmpFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &aPt, 0, FALSE ); +======= + const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, sal_False ); +>>>>>>> other do { pTmpFrm = pTmpFrm->GetUpper(); } while ( !pTmpFrm->IsCellFrm() ); @@ -2833,9 +2919,9 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, BOOL bCurRowOnly, SwTabCols aOld( rNew.Count() ); const SwPageFrm* pPage = pTab->FindPageFrm(); - const ULONG nLeftMin = (pTab->Frm().*fnRect->fnGetLeft)() - + const sal_uLong nLeftMin = (pTab->Frm().*fnRect->fnGetLeft)() - (pPage->Frm().*fnRect->fnGetLeft)(); - const ULONG nRightMax = (pTab->Frm().*fnRect->fnGetRight)() - + const sal_uLong nRightMax = (pTab->Frm().*fnRect->fnGetRight)() - (pPage->Frm().*fnRect->fnGetLeft)(); //Fix-Punkte setzen, LeftMin in Dokumentkoordinaten die anderen relativ. @@ -2848,7 +2934,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, BOOL bCurRowOnly, SetTabCols(rTab, rNew, aOld, pBox, bCurRowOnly ); } -void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor*, +void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCursor*, const SwCellFrm* pBoxFrm ) { const SwTableBox* pBox; @@ -2886,17 +2972,17 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* GetTabRows( aOld, 0, pBoxFrm ); - StartUndo( UNDO_TABLE_ATTR, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_ATTR, NULL ); // check for differences between aOld and rNew: - const USHORT nCount = rNew.Count(); + const sal_uInt16 nCount = rNew.Count(); const SwTable* pTable = pTab->GetTable(); ASSERT( pTable, "My colleague told me, this couldn't happen" ); - for ( USHORT i = 0; i <= nCount; ++i ) + for ( sal_uInt16 i = 0; i <= nCount; ++i ) { - const USHORT nIdxStt = bVert ? nCount - i : i - 1; - const USHORT nIdxEnd = bVert ? nCount - i - 1 : i; + const sal_uInt16 nIdxStt = bVert ? nCount - i : i - 1; + const sal_uInt16 nIdxEnd = bVert ? nCount - i - 1 : i; const long nOldRowStart = i == 0 ? 0 : aOld[ nIdxStt ]; const long nOldRowEnd = i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ]; @@ -2924,7 +3010,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* if ( pFrm->IsCellFrm() && pFrm->FindTabFrm() == pTab ) { const long nLowerBorder = (pFrm->Frm().*fnRect->fnGetBottom)(); - const ULONG nTabTop = (pTab->*fnRect->fnGetPrtTop)(); + const sal_uLong nTabTop = (pTab->*fnRect->fnGetPrtTop)(); if ( abs( (*fnRect->fnYInc)( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY ) { if ( !bCurColOnly || pFrm == pBoxFrm ) @@ -2969,7 +3055,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* } } - EndUndo( UNDO_TABLE_ATTR, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_ATTR, NULL ); ::ClearFEShellTabCols(); } @@ -2978,27 +3064,27 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* * Direktzugriff fuer UNO * --------------------------------------------------*/ void SwDoc::SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld, - const SwTableBox *pStart, BOOL bCurRowOnly ) + const SwTableBox *pStart, sal_Bool bCurRowOnly ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *rTab.GetTableNode(), TRUE )); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoAttrTbl( *rTab.GetTableNode(), sal_True )); } rTab.SetTabCols( rNew, rOld, pStart, bCurRowOnly ); ::ClearFEShellTabCols(); SetModified(); } -void SwDoc::SetRowsToRepeat( SwTable &rTable, USHORT nSet ) +void SwDoc::SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet ) { if( nSet == rTable.GetRowsToRepeat() ) return; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoTblHeadline( rTable, rTable.GetRowsToRepeat() , nSet) ); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoTblHeadline(rTable, rTable.GetRowsToRepeat(), nSet) ); } SwMsgPoolItem aChg( RES_TBLHEADLINECHG ); @@ -3012,7 +3098,7 @@ void SwDoc::SetRowsToRepeat( SwTable &rTable, USHORT nSet ) // Splittet eine Tabelle in der Grund-Zeile, in der der Index steht. // Alle GrundZeilen dahinter wandern in eine neue Tabelle/-Node. -// Ist das Flag bCalcNewSize auf TRUE, wird fuer beide neuen Tabellen +// Ist das Flag bCalcNewSize auf sal_True, wird fuer beide neuen Tabellen // die neue Size aus dem Max der Boxen errechnet; vorrausgesetzt, // die Size ist "absolut" gesetzt (USHRT_MAX) @@ -3027,13 +3113,13 @@ void SwCollectTblLineBoxes::AddBox( const SwTableBox& rBox ) aPosArr.Insert( nWidth, aPosArr.Count() ); SwTableBox* p = (SwTableBox*)&rBox; aBoxes.Insert( p, aBoxes.Count() ); - nWidth = nWidth + (USHORT)rBox.GetFrmFmt()->GetFrmSize().GetWidth(); + nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth(); } const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox ) { const SwTableBox* pRet = 0; - USHORT n; + sal_uInt16 n; if( aPosArr.Count() ) { @@ -3050,15 +3136,15 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox ) if( n >= aPosArr.Count() ) --n; - nWidth = nWidth + (USHORT)rBox.GetFrmFmt()->GetFrmSize().GetWidth(); + nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth(); pRet = aBoxes[ n ]; } return pRet; } -BOOL SwCollectTblLineBoxes::Resize( USHORT nOffset, USHORT nOldWidth ) +sal_Bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth ) { - USHORT n; + sal_uInt16 n; if( aPosArr.Count() ) { @@ -3078,29 +3164,29 @@ BOOL SwCollectTblLineBoxes::Resize( USHORT nOffset, USHORT nOldWidth ) // dann die Positionen der neuen Size anpassen for( n = 0; n < aPosArr.Count(); ++n ) { - ULONG nSize = nWidth; + sal_uLong nSize = nWidth; nSize *= ( aPosArr[ n ] - nOffset ); nSize /= nOldWidth; - aPosArr[ n ] = USHORT( nSize ); + aPosArr[ n ] = sal_uInt16( nSize ); } } return 0 != aPosArr.Count(); } -BOOL lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ) { SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara; if( pSplPara->IsGetValues() ) ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_Box_CollectBox, pPara ); else ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, pPara ); - return TRUE; + return sal_True; } -BOOL lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ) { SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara; - USHORT nLen = rpBox->GetTabLines().Count(); + sal_uInt16 nLen = rpBox->GetTabLines().Count(); if( nLen ) { // dann mit der richtigen Line weitermachen @@ -3114,13 +3200,13 @@ BOOL lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ) } else pSplPara->AddBox( *rpBox ); - return TRUE; + return sal_True; } -BOOL lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ) { SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara; - USHORT nLen = rpBox->GetTabLines().Count(); + sal_uInt16 nLen = rpBox->GetTabLines().Count(); if( nLen ) { // dann mit der richtigen Line weitermachen @@ -3151,7 +3237,7 @@ BOOL lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ) } else { -USHORT __FAR_DATA aTableSplitBoxSetRange[] = { +sal_uInt16 __FAR_DATA aTableSplitBoxSetRange[] = { RES_LR_SPACE, RES_UL_SPACE, RES_BACKGROUND, RES_SHADOW, RES_PROTECT, RES_PROTECT, @@ -3185,12 +3271,12 @@ USHORT __FAR_DATA aTableSplitBoxSetRange[] = { pBox->GetSttNd()->CheckSectionCondColl(); } } - return TRUE; + return sal_True; } -BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, - BOOL bCalcNewSize ) +sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, + sal_Bool bCalcNewSize ) { SwNode* pNd = &rPos.nNode.GetNode(); SwTableNode* pTNd = pNd->FindTableNode(); @@ -3198,7 +3284,7 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, return 0; if( pTNd->GetTable().ISA( SwDDETable )) - return FALSE; + return sal_False; SwTable& rTbl = pTNd->GetTable(); rTbl.SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen @@ -3206,11 +3292,13 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, SwTableFmlUpdate aMsgHnt( &rTbl ); SwHistory aHistory; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) + { aMsgHnt.pHistory = &aHistory; + } { - ULONG nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); + sal_uLong nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); // Suche die Grund-Line dieser Box: SwTableBox* pBox = rTbl.GetTblBox( nSttIdx ); @@ -3238,16 +3326,17 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, // TL_CHART2: need to inform chart of probably changed cell names //pDoc->UpdateCharts( rTbl.GetFrmFmt()->GetName() ); - SwTableNode* pNew = GetNodes().SplitTable( rPos.nNode, FALSE, bCalcNewSize ); + SwTableNode* pNew = GetNodes().SplitTable( rPos.nNode, sal_False, bCalcNewSize ); if( pNew ) { SwSaveRowSpan* pSaveRowSp = pNew->GetTable().CleanUpTopRowSpan( rTbl.GetTabLines().Count() ); SwUndoSplitTbl* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoSplitTbl( *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize )); + pUndo = new SwUndoSplitTbl( + *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize); + GetIDocumentUndoRedo().AppendUndo(pUndo); if( aHistory.Count() ) pUndo->SaveFormula( aHistory ); } @@ -3258,12 +3347,12 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, // an der aktuellen als obere case HEADLINE_BORDERCOPY: { - SwCollectTblLineBoxes aPara( FALSE, eHdlnMode ); + SwCollectTblLineBoxes aPara( sal_False, eHdlnMode ); SwTableLine* pLn = rTbl.GetTabLines()[ rTbl.GetTabLines().Count() - 1 ]; pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aPara ); - aPara.SetValues( TRUE ); + aPara.SetValues( sal_True ); pLn = pNew->GetTable().GetTabLines()[ 0 ]; pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aPara ); @@ -3280,11 +3369,11 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, if( HEADLINE_BOXATRCOLLCOPY == eHdlnMode && pUndo ) pHst = pUndo->GetHistory(); - SwCollectTblLineBoxes aPara( TRUE, eHdlnMode, pHst ); + SwCollectTblLineBoxes aPara( sal_True, eHdlnMode, pHst ); SwTableLine* pLn = rTbl.GetTabLines()[ 0 ]; pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aPara ); - aPara.SetValues( TRUE ); + aPara.SetValues( sal_True ); pLn = pNew->GetTable().GetTabLines()[ 0 ]; pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aPara ); } @@ -3323,7 +3412,7 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, return 0 != pNew; } -BOOL lcl_ChgTblSize( SwTable& rTbl ) +sal_Bool lcl_ChgTblSize( SwTable& rTbl ) { // das Attribut darf nicht ueber das Modify an der // Tabelle gesetzt werden, denn sonst werden alle @@ -3332,19 +3421,19 @@ BOOL lcl_ChgTblSize( SwTable& rTbl ) SwFmtFrmSize aTblMaxSz( pFmt->GetFrmSize() ); if( USHRT_MAX == aTblMaxSz.GetWidth() ) - return FALSE; + return sal_False; - BOOL bLocked = pFmt->IsModifyLocked(); + sal_Bool bLocked = pFmt->IsModifyLocked(); pFmt->LockModify(); aTblMaxSz.SetWidth( 0 ); SwTableLines& rLns = rTbl.GetTabLines(); - for( USHORT nLns = 0; nLns < rLns.Count(); ++nLns ) + for( sal_uInt16 nLns = 0; nLns < rLns.Count(); ++nLns ) { SwTwips nMaxLnWidth = 0; SwTableBoxes& rBoxes = rLns[ nLns ]->GetTabBoxes(); - for( USHORT nBox = 0; nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox ) nMaxLnWidth += rBoxes[nBox]->GetFrmFmt()->GetFrmSize().GetWidth(); if( nMaxLnWidth > aTblMaxSz.GetWidth() ) @@ -3354,7 +3443,7 @@ BOOL lcl_ChgTblSize( SwTable& rTbl ) if( !bLocked ) // und gegebenenfalls Lock wieder freigeben pFmt->UnlockModify(); - return TRUE; + return sal_True; } class _SplitTable_Para @@ -3367,7 +3456,7 @@ public: _SplitTable_Para( SwTableNode* pNew, SwTable& rOld ) : aSrc( 16, 16 ), aDest( 16, 16 ), pNewTblNd( pNew ), rOldTbl( rOld ) {} - USHORT SrcFmt_GetPos( void* pFmt ) const + sal_uInt16 SrcFmt_GetPos( void* pFmt ) const { return aSrc.GetPos( pFmt ); } void DestFmt_Insert( void* pFmt ) @@ -3376,7 +3465,7 @@ public: void SrcFmt_Insert( void* pFmt ) { aSrc.Insert( pFmt, aSrc.Count() ); } - SwFrmFmt* DestFmt_Get( USHORT nPos ) const + SwFrmFmt* DestFmt_Get( sal_uInt16 nPos ) const { return (SwFrmFmt*)aDest[ nPos ]; } void ChgBox( SwTableBox* pBox ) @@ -3387,15 +3476,15 @@ public: }; -BOOL lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara ); +sal_Bool lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara ); -BOOL lcl_SplitTable_CpyLine( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_SplitTable_CpyLine( const SwTableLine*& rpLine, void* pPara ) { SwTableLine* pLn = (SwTableLine*)rpLine; _SplitTable_Para& rPara = *(_SplitTable_Para*)pPara; SwFrmFmt *pSrcFmt = pLn->GetFrmFmt(); - USHORT nPos = rPara.SrcFmt_GetPos( pSrcFmt ); + sal_uInt16 nPos = rPara.SrcFmt_GetPos( pSrcFmt ); if( USHRT_MAX == nPos ) { rPara.DestFmt_Insert( pLn->ClaimFrmFmt() ); @@ -3405,16 +3494,16 @@ BOOL lcl_SplitTable_CpyLine( const SwTableLine*& rpLine, void* pPara ) pLn->ChgFrmFmt( (SwTableLineFmt*)rPara.DestFmt_Get( nPos ) ); pLn->GetTabBoxes().ForEach( &lcl_SplitTable_CpyBox, pPara ); - return TRUE; + return sal_True; } -BOOL lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara ) { SwTableBox* pBox = (SwTableBox*)rpBox; _SplitTable_Para& rPara = *(_SplitTable_Para*)pPara; SwFrmFmt *pSrcFmt = pBox->GetFrmFmt(); - USHORT nPos = rPara.SrcFmt_GetPos( pSrcFmt ); + sal_uInt16 nPos = rPara.SrcFmt_GetPos( pSrcFmt ); if( USHRT_MAX == nPos ) { rPara.DestFmt_Insert( pBox->ClaimFrmFmt() ); @@ -3427,18 +3516,18 @@ BOOL lcl_SplitTable_CpyBox( const SwTableBox*& rpBox, void* pPara ) rPara.ChgBox( pBox ); else pBox->GetTabLines().ForEach( &lcl_SplitTable_CpyLine, pPara ); - return TRUE; + return sal_True; } -SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, BOOL bAfter, - BOOL bCalcNewSize ) +SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, sal_Bool bAfter, + sal_Bool bCalcNewSize ) { SwNode* pNd = &rPos.GetNode(); SwTableNode* pTNd = pNd->FindTableNode(); if( !pTNd || pNd->IsTableNode() ) return 0; - ULONG nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); + sal_uLong nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); // Suche die Grund-Line dieser Box: SwTable& rTbl = pTNd->GetTable(); @@ -3451,7 +3540,7 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, BOOL bAfter, pLine = pLine->GetUpper()->GetUpper(); // in pLine steht jetzt die GrundLine. - USHORT nLinePos = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine ); + sal_uInt16 nLinePos = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine ); if( USHRT_MAX == nLinePos || ( bAfter ? ++nLinePos >= rTbl.GetTabLines().Count() : !nLinePos )) return 0; // nicht gefunden oder letze Line !! @@ -3496,20 +3585,20 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, BOOL bAfter, SwChartDataProvider *pPCD = rTbl.GetFrmFmt()->getIDocumentChartDataProviderAccess()->GetChartDataProvider(); if( pPCD ) { - for (USHORT k = nLinePos; k < rTbl.GetTabLines().Count(); ++k) + for (sal_uInt16 k = nLinePos; k < rTbl.GetTabLines().Count(); ++k) { - USHORT nLineIdx = (rTbl.GetTabLines().Count() - 1) - k + nLinePos; - USHORT nBoxCnt = rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes().Count(); - for (USHORT j = 0; j < nBoxCnt; ++j) + sal_uInt16 nLineIdx = (rTbl.GetTabLines().Count() - 1) - k + nLinePos; + sal_uInt16 nBoxCnt = rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes().Count(); + for (sal_uInt16 j = 0; j < nBoxCnt; ++j) { - USHORT nIdx = nBoxCnt - 1 - j; + sal_uInt16 nIdx = nBoxCnt - 1 - j; pPCD->DeleteBox( &rTbl, *rTbl.GetTabLines()[ nLineIdx ]->GetTabBoxes()[nIdx] ); } } } // // ...und loeschen - USHORT nDeleted = rTbl.GetTabLines().Count() - nLinePos; + sal_uInt16 nDeleted = rTbl.GetTabLines().Count() - nLinePos; rTbl.GetTabLines().Remove( nLinePos, nDeleted ); // und die betr. Boxen verschieben. Dabei die Formate eindeutig @@ -3544,11 +3633,11 @@ SwTableNode* SwNodes::SplitTable( const SwNodeIndex& rPos, BOOL bAfter, // und die Umkehrung davon. rPos muss in der Tabelle stehen, die bestehen // bleibt. Das Flag besagt ob die aktuelle mit der davor oder dahinter // stehenden vereint wird. -BOOL SwDoc::MergeTable( const SwPosition& rPos, BOOL bWithPrev, USHORT nMode ) +sal_Bool SwDoc::MergeTable( const SwPosition& rPos, sal_Bool bWithPrev, sal_uInt16 nMode ) { SwTableNode* pTblNd = rPos.nNode.GetNode().FindTableNode(), *pDelTblNd; if( !pTblNd ) - return FALSE; + return sal_False; SwNodes& rNds = GetNodes(); if( bWithPrev ) @@ -3556,11 +3645,11 @@ BOOL SwDoc::MergeTable( const SwPosition& rPos, BOOL bWithPrev, USHORT nMode ) else pDelTblNd = rNds[ pTblNd->EndOfSectionIndex() + 1 ]->GetTableNode(); if( !pDelTblNd ) - return FALSE; + return sal_False; if( pTblNd->GetTable().ISA( SwDDETable ) || pDelTblNd->GetTable().ISA( SwDDETable )) - return FALSE; + return sal_False; // MIB 9.7.97: HTML-Layout loeschen pTblNd->GetTable().SetHTMLTableLayout( 0 ); @@ -3569,11 +3658,10 @@ BOOL SwDoc::MergeTable( const SwPosition& rPos, BOOL bWithPrev, USHORT nMode ) // beide Tabellen vorhanden, also kanns losgehen SwUndoMergeTbl* pUndo = 0; SwHistory* pHistory = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoMergeTbl( *pTblNd, *pDelTblNd, - bWithPrev, nMode )); + pUndo = new SwUndoMergeTbl( *pTblNd, *pDelTblNd, bWithPrev, nMode ); + GetIDocumentUndoRedo().AppendUndo(pUndo); pHistory = new SwHistory; } @@ -3586,7 +3674,7 @@ BOOL SwDoc::MergeTable( const SwPosition& rPos, BOOL bWithPrev, USHORT nMode ) // das eigentliche Mergen SwNodeIndex aIdx( bWithPrev ? *pTblNd : *pDelTblNd ); - BOOL bRet = rNds.MergeTable( aIdx, !bWithPrev, nMode, pHistory ); + sal_Bool bRet = rNds.MergeTable( aIdx, !bWithPrev, nMode, pHistory ); if( pHistory ) { @@ -3602,8 +3690,8 @@ BOOL SwDoc::MergeTable( const SwPosition& rPos, BOOL bWithPrev, USHORT nMode ) return bRet; } -BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, - USHORT nMode, SwHistory* ) +sal_Bool SwNodes::MergeTable( const SwNodeIndex& rPos, sal_Bool bWithPrev, + sal_uInt16 nMode, SwHistory* ) { SwTableNode* pDelTblNd = rPos.GetNode().GetTableNode(); ASSERT( pDelTblNd, "wo ist der TableNode geblieben?" ); @@ -3612,7 +3700,7 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, ASSERT( pTblNd, "wo ist der TableNode geblieben?" ); if( !pDelTblNd || !pTblNd ) - return FALSE; + return sal_False; pDelTblNd->DelFrms(); @@ -3665,12 +3753,12 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, } // die Lines und Boxen ruebermoven - USHORT nOldSize = rTbl.GetTabLines().Count(); + sal_uInt16 nOldSize = rTbl.GetTabLines().Count(); rTbl.GetTabLines().Insert( &rDelTbl.GetTabLines(), nOldSize ); rDelTbl.GetTabLines().Remove( 0, rDelTbl.GetTabLines().Count() ); rTbl.GetTabSortBoxes().Insert( &rDelTbl.GetTabSortBoxes() ); - rDelTbl.GetTabSortBoxes().Remove( (USHORT)0, rDelTbl.GetTabSortBoxes().Count() ); + rDelTbl.GetTabSortBoxes().Remove( (sal_uInt16)0, rDelTbl.GetTabSortBoxes().Count() ); // die vordere Tabelle bleibt immer stehen, die hintere wird geloescht SwEndNode* pTblEndNd = pDelTblNd->EndOfSectionNode(); @@ -3710,7 +3798,7 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, //Layout updaten aFndBox.MakeFrms( rTbl ); - return TRUE; + return sal_True; } // ------------------------------------------------------------------- @@ -3721,8 +3809,8 @@ struct _SetAFmtTabPara { SwTableAutoFmt& rTblFmt; SwUndoTblAutoFmt* pUndo; - USHORT nEndBox, nCurBox; - BYTE nAFmtLine, nAFmtBox; + sal_uInt16 nEndBox, nCurBox; + sal_uInt8 nAFmtLine, nAFmtBox; _SetAFmtTabPara( const SwTableAutoFmt& rNew ) : rTblFmt( (SwTableAutoFmt&)rNew ), pUndo( 0 ), @@ -3732,16 +3820,16 @@ struct _SetAFmtTabPara // forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen // koennen. -BOOL lcl_SetAFmtBox( const _FndBox*&, void *pPara ); -BOOL lcl_SetAFmtLine( const _FndLine*&, void *pPara ); +sal_Bool lcl_SetAFmtBox( const _FndBox*&, void *pPara ); +sal_Bool lcl_SetAFmtLine( const _FndLine*&, void *pPara ); -BOOL lcl_SetAFmtLine( const _FndLine*& rpLine, void *pPara ) +sal_Bool lcl_SetAFmtLine( const _FndLine*& rpLine, void *pPara ) { ((_FndLine*&)rpLine)->GetBoxes().ForEach( &lcl_SetAFmtBox, pPara ); - return TRUE; + return sal_True; } -BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) +sal_Bool lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) { _SetAFmtTabPara* pSetPara = (_SetAFmtTabPara*)pPara; @@ -3752,7 +3840,7 @@ BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) else if( pSetPara->nCurBox == pSetPara->nEndBox ) pSetPara->nAFmtBox = 3; else - pSetPara->nAFmtBox = (BYTE)(1 + ((pSetPara->nCurBox-1) & 1)); + pSetPara->nAFmtBox = (sal_uInt8)(1 + ((pSetPara->nCurBox-1) & 1)); } if( rpBox->GetBox()->GetSttNd() ) @@ -3764,16 +3852,16 @@ BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) SfxItemSet aCharSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 ); // <-- SfxItemSet aBoxSet( pDoc->GetAttrPool(), aTableBoxSetRange ); - BYTE nPos = pSetPara->nAFmtLine * 4 + pSetPara->nAFmtBox; + sal_uInt8 nPos = pSetPara->nAFmtLine * 4 + pSetPara->nAFmtBox; pSetPara->rTblFmt.UpdateToSet( nPos, aCharSet, SwTableAutoFmt::UPDATE_CHAR, 0 ); pSetPara->rTblFmt.UpdateToSet( nPos, aBoxSet, SwTableAutoFmt::UPDATE_BOX, - pDoc->GetNumberFormatter( TRUE ) ); + pDoc->GetNumberFormatter( sal_True ) ); if( aCharSet.Count() ) { - ULONG nSttNd = pSetBox->GetSttIdx()+1; - ULONG nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex(); + sal_uLong nSttNd = pSetBox->GetSttIdx()+1; + sal_uLong nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex(); for( ; nSttNd < nEndNd; ++nSttNd ) { SwCntntNode* pNd = pDoc->GetNodes()[ nSttNd ]->GetCntntNode(); @@ -3796,17 +3884,17 @@ BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) if( !rpBox->GetUpper()->GetUpper() ) // eine BaseLine ++pSetPara->nCurBox; - return TRUE; + return sal_True; } // AutoFormat fuer die Tabelle/TabellenSelection -BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew ) +sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew ) { ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -3815,7 +3903,7 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; pTblNd->GetTable().SetHTMLTableLayout( 0 ); @@ -3830,18 +3918,19 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe // Undo abschalten, Attribute werden sich vorher gemerkt SwUndoTblAutoFmt* pUndo = 0; - if( DoesUndo() ) + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew ) ); - DoUndo( FALSE ); + pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + GetIDocumentUndoRedo().DoUndo(false); } _SetAFmtTabPara aPara( rNew ); _FndLines& rFLns = pFndBox->GetLines(); _FndLine* pLine; - for( USHORT n = 0; n < rFLns.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFLns.Count(); ++n ) { pLine = rFLns[n]; @@ -3854,7 +3943,7 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe else if( n+1 == rFLns.Count() ) aPara.nAFmtLine = 3; else - aPara.nAFmtLine = (BYTE)(1 + ((n-1) & 1 )); + aPara.nAFmtLine = (sal_uInt8)(1 + ((n-1) & 1 )); aPara.nAFmtBox = 0; aPara.nCurBox = 0; @@ -3866,22 +3955,24 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe } if( pUndo ) - DoUndo( TRUE ); + { + GetIDocumentUndoRedo().DoUndo(bUndo); + } SetModified(); SetFieldsDirty( true, NULL, 0 ); - return TRUE; + return sal_True; } // Erfrage wie attributiert ist -BOOL SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) +sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) { ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -3890,7 +3981,7 @@ BOOL SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) pTblNd->GetTable().GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; _FndBox* pFndBox = &aFndBox; while( 1 == pFndBox->GetLines().Count() && @@ -3902,30 +3993,30 @@ BOOL SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) _FndLines& rFLns = pFndBox->GetLines(); - USHORT aLnArr[4]; + sal_uInt16 aLnArr[4]; aLnArr[0] = 0; aLnArr[1] = 1 < rFLns.Count() ? 1 : 0; aLnArr[2] = 2 < rFLns.Count() ? 2 : aLnArr[1]; aLnArr[3] = rFLns.Count() - 1; - for( BYTE nLine = 0; nLine < 4; ++nLine ) + for( sal_uInt8 nLine = 0; nLine < 4; ++nLine ) { _FndLine& rLine = *rFLns[ aLnArr[ nLine ] ]; - USHORT aBoxArr[4]; + sal_uInt16 aBoxArr[4]; aBoxArr[0] = 0; aBoxArr[1] = 1 < rLine.GetBoxes().Count() ? 1 : 0; aBoxArr[2] = 2 < rLine.GetBoxes().Count() ? 2 : aBoxArr[1]; aBoxArr[3] = rLine.GetBoxes().Count() - 1; - for( BYTE nBox = 0; nBox < 4; ++nBox ) + for( sal_uInt8 nBox = 0; nBox < 4; ++nBox ) { SwTableBox* pFBox = rLine.GetBoxes()[ aBoxArr[ nBox ] ]->GetBox(); // immer auf die 1. runterfallen while( !pFBox->GetSttNd() ) pFBox = pFBox->GetTabLines()[0]->GetTabBoxes()[0]; - BYTE nPos = nLine * 4 + nBox; + sal_uInt8 nPos = nLine * 4 + nBox; SwNodeIndex aIdx( *pFBox->GetSttNd(), 1 ); SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode(); if( !pCNd ) @@ -3936,11 +4027,11 @@ BOOL SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) SwTableAutoFmt::UPDATE_CHAR, 0 ); rGet.UpdateFromSet( nPos, pFBox->GetFrmFmt()->GetAttrSet(), SwTableAutoFmt::UPDATE_BOX, - GetNumberFormatter( TRUE ) ); + GetNumberFormatter( sal_True ) ); } } - return TRUE; + return sal_True; } String SwDoc::GetUniqueTblName() const @@ -3949,10 +4040,10 @@ String SwDoc::GetUniqueTblName() const String aName( aId ); xub_StrLen nNmLen = aName.Len(); - USHORT nNum, nTmp, nFlagSize = ( pTblFrmFmtTbl->Count() / 8 ) +2; - USHORT n; + sal_uInt16 nNum, nTmp, nFlagSize = ( pTblFrmFmtTbl->Count() / 8 ) +2; + sal_uInt16 n; - BYTE* pSetFlags = new BYTE[ nFlagSize ]; + sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ]; memset( pSetFlags, 0, nFlagSize ); for( n = 0; n < pTblFrmFmtTbl->Count(); ++n ) @@ -3962,7 +4053,7 @@ String SwDoc::GetUniqueTblName() const pFmt->GetName().Match( aName ) == nNmLen ) { // Nummer bestimmen und das Flag setzen - nNum = static_cast<USHORT>(pFmt->GetName().Copy( nNmLen ).ToInt32()); + nNum = static_cast<sal_uInt16>(pFmt->GetName().Copy( nNmLen ).ToInt32()); if( nNum-- && nNum < pTblFrmFmtTbl->Count() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } @@ -3984,7 +4075,7 @@ String SwDoc::GetUniqueTblName() const return aName += String::CreateFromInt32( ++nNum ); } -SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, BOOL bAll ) const +SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, sal_Bool bAll ) const { const SwFmt* pRet = 0; if( bAll ) @@ -3992,7 +4083,7 @@ SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, BOOL bAll ) const else { // dann nur die, die im Doc gesetzt sind - for( USHORT n = 0; n < pTblFrmFmtTbl->Count(); ++n ) + for( sal_uInt16 n = 0; n < pTblFrmFmtTbl->Count(); ++n ) { const SwFrmFmt* pFmt = (*pTblFrmFmtTbl)[ n ]; if( !pFmt->IsDefault() && IsUsed( *pFmt ) && @@ -4006,20 +4097,21 @@ SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, BOOL bAll ) const return (SwTableFmt*)pRet; } -BOOL SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, USHORT eType, +sal_Bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType, SwTwips nAbsDiff, SwTwips nRelDiff ) { SwTableNode* pTblNd = (SwTableNode*)rAktBox.GetSttNd()->FindTableNode(); SwUndo* pUndo = 0; if( nsTblChgWidthHeightType::WH_FLAG_INSDEL & eType && pTblNd->GetTable().ISA( SwDDETable )) - return FALSE; + return sal_False; SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() ); aMsgHnt.eFlags = TBL_BOXPTR; UpdateTblFlds( &aMsgHnt ); - BOOL bRet = FALSE; + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + sal_Bool bRet = sal_False; switch( eType & 0xff ) { case nsTblChgWidthHeightType::WH_COL_LEFT: @@ -4029,7 +4121,7 @@ BOOL SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, USHORT eType, { bRet = pTblNd->GetTable().SetColWidth( rAktBox, eType, nAbsDiff, nRelDiff, - DoesUndo() ? &pUndo : 0 ); + (bUndo) ? &pUndo : 0 ); } break; case nsTblChgWidthHeightType::WH_ROW_TOP: @@ -4038,15 +4130,14 @@ BOOL SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, USHORT eType, case nsTblChgWidthHeightType::WH_CELL_BOTTOM: bRet = pTblNd->GetTable().SetRowHeight( rAktBox, eType, nAbsDiff, nRelDiff, - DoesUndo() ? &pUndo : 0 ); + (bUndo) ? &pUndo : 0 ); break; } + GetIDocumentUndoRedo().DoUndo(bUndo); // SetColWidth can turn it off if( pUndo ) { - ClearRedo(); - AppendUndo( pUndo ); - DoUndo( TRUE ); // im SetColWidth kann es abgeschaltet werden! + GetIDocumentUndoRedo().AppendUndo( pUndo ); } if( bRet ) @@ -4059,30 +4150,30 @@ BOOL SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, USHORT eType, } -void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) +void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate ) { //JP 09.07.97: Optimierung: wenn die Box schon sagt, das es Text // sein soll, dann bleibt das auch Text! const SfxPoolItem* pNumFmtItem = 0; if( SFX_ITEM_SET == rBox.GetFrmFmt()->GetItemState( RES_BOXATR_FORMAT, - FALSE, &pNumFmtItem ) && GetNumberFormatter()->IsTextFormat( + sal_False, &pNumFmtItem ) && GetNumberFormatter()->IsTextFormat( ((SwTblBoxNumFormat*)pNumFmtItem)->GetValue() )) return ; SwUndoTblNumFmt* pUndo = 0; - BOOL bIsEmptyTxtNd, bChgd = TRUE; + sal_Bool bIsEmptyTxtNd, bChgd = sal_True; sal_uInt32 nFmtIdx; double fNumber; if( rBox.HasNumCntnt( fNumber, nFmtIdx, bIsEmptyTxtNd ) ) { if( !rBox.IsNumberChanged() ) - bChgd = FALSE; + bChgd = sal_False; else { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_TABLE_AUTOFMT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL ); pUndo = new SwUndoTblNumFmt( rBox ); pUndo->SetNumFmt( nFmtIdx, fNumber ); } @@ -4090,16 +4181,16 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt(); SfxItemSet aBoxSet( GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE ); - BOOL bSetNumFmt = IsInsTblFormatNum(), bLockModify = TRUE; + sal_Bool bSetNumFmt = IsInsTblFormatNum(), bLockModify = sal_True; if( bSetNumFmt ) { if( !IsInsTblChangeNumFormat() ) { if( !pNumFmtItem ) - bSetNumFmt = FALSE; + bSetNumFmt = sal_False; else { - ULONG nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)-> + sal_uLong nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)-> GetValue(); SvNumberFormatter* pNumFmtr = GetNumberFormatter(); @@ -4112,7 +4203,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) else // eingstelltes und vorgegebenes NumFormat // stimmen nicht ueberein -> als Text einfuegen - bLockModify = bSetNumFmt = FALSE; + bLockModify = bSetNumFmt = sal_False; } } @@ -4151,20 +4242,20 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) const SfxPoolItem* pValueItem = 0, *pFmtItem = 0; SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt(); if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMAT, - FALSE, &pFmtItem ) || + sal_False, &pFmtItem ) || SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_VALUE, - FALSE, &pValueItem )) + sal_False, &pValueItem )) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_TABLE_AUTOFMT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL ); pUndo = new SwUndoTblNumFmt( rBox ); } pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt(); // alle Zahlenformate entfernen - USHORT nWhich1 = RES_BOXATR_FORMULA; + sal_uInt16 nWhich1 = RES_BOXATR_FORMULA; if( !bIsEmptyTxtNd ) //JP 15.01.99: dieser Teil wurde doch schon oben abgeprueft! /* && pFmtItem && !GetNumberFormatter()-> @@ -4180,7 +4271,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) pBoxFmt->ResetFmtAttr( nWhich1, RES_BOXATR_VALUE ); } else - bChgd = FALSE; + bChgd = sal_False; } if( bChgd ) @@ -4188,8 +4279,8 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) if( pUndo ) { pUndo->SetBox( rBox ); - AppendUndo( pUndo ); - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } const SwTableNode* pTblNd = rBox.GetSttNd()->FindTableNode(); @@ -4209,10 +4300,9 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoTblNumFmt( rBox, &rSet ) ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoTblNumFmt(rBox, &rSet) ); } SwFrmFmt* pBoxFmt = rBox.ClaimFrmFmt(); @@ -4235,7 +4325,7 @@ void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet ) void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) { SwStartNode* pSttNd; - if( 0 != ( pSttNd = GetNodes()[ rNode ]-> + if( 0 != ( pSttNd = rNode.GetNode(). FindSttNodeByType( SwTableBoxStartNode )) && 2 == pSttNd->EndOfSectionIndex() - pSttNd->GetIndex() ) { @@ -4244,20 +4334,19 @@ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) const SfxPoolItem* pFmtItem = 0; const SfxItemSet& rSet = pBox->GetFrmFmt()->GetAttrSet(); - if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, FALSE, &pFmtItem ) || - SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA, FALSE ) || - SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE, FALSE )) + if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, sal_False, &pFmtItem ) || + SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA, sal_False ) || + SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE, sal_False )) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoTblNumFmt( *pBox ) ); + GetIDocumentUndoRedo().AppendUndo(new SwUndoTblNumFmt(*pBox)); } SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt(); //JP 01.09.97: TextFormate bleiben erhalten! - USHORT nWhich1 = RES_BOXATR_FORMAT; + sal_uInt16 nWhich1 = RES_BOXATR_FORMAT; if( pFmtItem && GetNumberFormatter()->IsTextFormat( ((SwTblBoxNumFormat*)pFmtItem)->GetValue() )) nWhich1 = RES_BOXATR_FORMULA; @@ -4279,41 +4368,47 @@ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) // in eine bestehende TblSelektion gefuellt wird. // Gerufen wird es von: edglss.cxx/fecopy.cxx -BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, - const SwTable* pCpyTbl, BOOL bCpyName, BOOL bCorrPos ) +sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, + const SwTable* pCpyTbl, sal_Bool bCpyName, sal_Bool bCorrPos ) { - BOOL bRet; + sal_Bool bRet; const SwTableNode* pSrcTblNd = pCpyTbl ? pCpyTbl->GetTableNode() : rBoxes[ 0 ]->GetSttNd()->FindTableNode(); - SwTableNode* pInsTblNd = GetNodes()[ rInsPos.nNode ]->FindTableNode(); + SwTableNode * pInsTblNd = rInsPos.nNode.GetNode().FindTableNode(); + bool const bUndo( GetIDocumentUndoRedo().DoesUndo() ); if( !pCpyTbl && !pInsTblNd ) { SwUndoCpyTbl* pUndo = 0; - if( DoesUndo() ) + if (bUndo) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoCpyTbl; - DoUndo( FALSE ); } - bRet = pSrcTblNd->GetTable().MakeCopy( this, rInsPos, rBoxes, - TRUE, bCpyName ); + { + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + bRet = pSrcTblNd->GetTable().MakeCopy( this, rInsPos, rBoxes, + sal_True, bCpyName ); + } + if( pUndo ) { if( !bRet ) + { delete pUndo; + pUndo = 0; + } else { pInsTblNd = GetNodes()[ rInsPos.nNode.GetIndex() - 1 ]->FindTableNode(); pUndo->SetTableSttIdx( pInsTblNd->GetIndex() ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } - DoUndo( TRUE ); } } else @@ -4325,43 +4420,38 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, nsRedlineMode_t::REDLINE_SHOW_DELETE)); SwUndoTblCpyTbl* pUndo = 0; - if( DoesUndo() ) + if (bUndo) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoTblCpyTbl; - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } SwDoc* pCpyDoc = (SwDoc*)pSrcTblNd->GetDoc(); - SfxObjectShellRef* pRefForDocSh = 0; - BOOL bDelCpyDoc = pCpyDoc == this; + sal_Bool bDelCpyDoc = pCpyDoc == this; if( bDelCpyDoc ) { // kopiere die Tabelle erstmal in ein temp. Doc pCpyDoc = new SwDoc; pCpyDoc->acquire(); - pRefForDocSh = new SfxObjectShellRef(); - pCpyDoc->SetRefForDocShell( pRefForDocSh ); SwPosition aPos( SwNodeIndex( pCpyDoc->GetNodes().GetEndOfContent() )); - if( !pSrcTblNd->GetTable().MakeCopy( pCpyDoc, aPos, rBoxes, TRUE, TRUE )) + if( !pSrcTblNd->GetTable().MakeCopy( pCpyDoc, aPos, rBoxes, sal_True, sal_True )) { - delete pRefForDocSh; if( pCpyDoc->release() == 0 ) delete pCpyDoc; if( pUndo ) { - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); delete pUndo; + pUndo = 0; } - return FALSE; + return sal_False; } aPos.nNode -= 1; // auf den EndNode der Tabelle pSrcTblNd = aPos.nNode.GetNode().FindTableNode(); - - pCpyDoc->SetRefForDocShell( NULL ); } const SwStartNode* pSttNd = rInsPos.nNode.GetNode().FindTableBoxStartNode(); @@ -4400,7 +4490,6 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if( bDelCpyDoc ) { - delete pRefForDocSh; if( pCpyDoc->release() == 0 ) delete pCpyDoc; } @@ -4409,11 +4498,13 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, { // falls die Tabelle nicht kopiert werden konnte, das Undo-Object // wieder loeschen + GetIDocumentUndoRedo().DoUndo(bUndo); if( !bRet && pUndo->IsEmpty() ) delete pUndo; else - AppendUndo( pUndo ); - DoUndo( TRUE ); + { + GetIDocumentUndoRedo().AppendUndo(pUndo); + } } if( bCorrPos ) @@ -4434,20 +4525,21 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, -BOOL SwDoc::_UnProtectTblCells( SwTable& rTbl ) +sal_Bool SwDoc::_UnProtectTblCells( SwTable& rTbl ) { - BOOL bChgd = FALSE; - SwUndoAttrTbl* pUndo = DoesUndo() ? new SwUndoAttrTbl( *rTbl.GetTableNode() ) - : 0; + sal_Bool bChgd = sal_False; + SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoAttrTbl( *rTbl.GetTableNode() ) + : 0; SwTableSortBoxes& rSrtBox = rTbl.GetTabSortBoxes(); - for( USHORT i = rSrtBox.Count(); i; ) + for( sal_uInt16 i = rSrtBox.Count(); i; ) { SwFrmFmt *pBoxFmt = rSrtBox[ --i ]->GetFrmFmt(); if( pBoxFmt->GetProtect().IsCntntProtected() ) { pBoxFmt->ResetFmtAttr( RES_PROTECT ); - bChgd = TRUE; + bChgd = sal_True; } } @@ -4455,8 +4547,7 @@ BOOL SwDoc::_UnProtectTblCells( SwTable& rTbl ) { if( bChgd ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -4465,9 +4556,9 @@ BOOL SwDoc::_UnProtectTblCells( SwTable& rTbl ) } -BOOL SwDoc::UnProtectCells( const String& rName ) +sal_Bool SwDoc::UnProtectCells( const String& rName ) { - BOOL bChgd = FALSE; + sal_Bool bChgd = sal_False; SwTableFmt* pFmt = FindTblFmtByName( rName ); if( pFmt ) { @@ -4479,23 +4570,23 @@ BOOL SwDoc::UnProtectCells( const String& rName ) return bChgd; } -BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) +sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) { - BOOL bChgd = FALSE; + sal_Bool bChgd = sal_False; if( rBoxes.Count() ) { - SwUndoAttrTbl* pUndo = DoesUndo() + SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) ? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() ) : 0; SvPtrarr aFmts( 16 ), aNewFmts( 16 ); - for( USHORT i = rBoxes.Count(); i; ) + for( sal_uInt16 i = rBoxes.Count(); i; ) { SwTableBox* pBox = rBoxes[ --i ]; SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); if( pBoxFmt->GetProtect().IsCntntProtected() ) { - USHORT nFnd = aFmts.GetPos( pBoxFmt ); + sal_uInt16 nFnd = aFmts.GetPos( pBoxFmt ); if( USHRT_MAX != nFnd ) pBox->ChgFrmFmt( (SwTableBoxFmt*)aNewFmts[ nFnd ] ); else @@ -4505,7 +4596,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) pBoxFmt->ResetFmtAttr( RES_PROTECT ); aNewFmts.Insert( pBoxFmt, aNewFmts.Count() ); } - bChgd = TRUE; + bChgd = sal_True; } } @@ -4513,8 +4604,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) { if( bChgd ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -4523,26 +4613,26 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) return bChgd; } -BOOL SwDoc::UnProtectTbls( const SwPaM& rPam ) +sal_Bool SwDoc::UnProtectTbls( const SwPaM& rPam ) { - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); - BOOL bChgd = FALSE, bHasSel = rPam.HasMark() || + sal_Bool bChgd = sal_False, bHasSel = rPam.HasMark() || rPam.GetNext() != (SwPaM*)&rPam; SwFrmFmts& rFmts = *GetTblFrmFmts(); SwTable* pTbl; const SwTableNode* pTblNd; - for( USHORT n = rFmts.Count(); n ; ) + for( sal_uInt16 n = rFmts.Count(); n ; ) if( 0 != (pTbl = SwTable::FindTable( rFmts[ --n ] )) && 0 != (pTblNd = pTbl->GetTableNode() ) && pTblNd->GetNodes().IsDocNodes() ) { - ULONG nTblIdx = pTblNd->GetIndex(); + sal_uLong nTblIdx = pTblNd->GetIndex(); // dann ueberpruefe ob Tabelle in der Selection liegt if( bHasSel ) { - int bFound = FALSE; + int bFound = sal_False; SwPaM* pTmp = (SwPaM*)&rPam; do { const SwPosition *pStt = pTmp->Start(), @@ -4559,18 +4649,18 @@ BOOL SwDoc::UnProtectTbls( const SwPaM& rPam ) bChgd |= _UnProtectTblCells( *pTbl ); } - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); if( bChgd ) SetModified(); return bChgd; } -BOOL SwDoc::HasTblAnyProtection( const SwPosition* pPos, +sal_Bool SwDoc::HasTblAnyProtection( const SwPosition* pPos, const String* pTblName, - BOOL* pFullTblProtection ) + sal_Bool* pFullTblProtection ) { - BOOL bHasProtection = FALSE; + sal_Bool bHasProtection = sal_False; SwTable* pTbl = 0; if( pTblName ) pTbl = SwTable::FindTable( FindTblFmtByName( *pTblName ) ); @@ -4584,22 +4674,22 @@ BOOL SwDoc::HasTblAnyProtection( const SwPosition* pPos, if( pTbl ) { SwTableSortBoxes& rSrtBox = pTbl->GetTabSortBoxes(); - for( USHORT i = rSrtBox.Count(); i; ) + for( sal_uInt16 i = rSrtBox.Count(); i; ) { SwFrmFmt *pBoxFmt = rSrtBox[ --i ]->GetFrmFmt(); if( pBoxFmt->GetProtect().IsCntntProtected() ) { if( !bHasProtection ) { - bHasProtection = TRUE; + bHasProtection = sal_True; if( !pFullTblProtection ) break; - *pFullTblProtection = TRUE; + *pFullTblProtection = sal_True; } } else if( bHasProtection && pFullTblProtection ) { - *pFullTblProtection = FALSE; + *pFullTblProtection = sal_False; break; } } @@ -4609,14 +4699,14 @@ BOOL SwDoc::HasTblAnyProtection( const SwPosition* pPos, #ifdef DEL_TABLE_REDLINES lcl_DelRedlines::lcl_DelRedlines( const SwTableNode& rNd, - BOOL bCheckForOwnRedline ) + sal_Bool bCheckForOwnRedline ) : pDoc( (SwDoc*)rNd.GetNodes().GetDoc() ) { pDoc->StartUndo(UNDO_EMPTY, NULL); const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); if( !pDoc->IsIgnoreRedline() && rTbl.Count() ) { - BOOL bDelete = TRUE; + sal_Bool bDelete = sal_True; if( bCheckForOwnRedline ) { sal_uInt16 nRedlPos = pDoc->GetRedlinePos( rNd, USHRT_MAX ); @@ -4635,7 +4725,7 @@ lcl_DelRedlines::lcl_DelRedlines( const SwTableNode& rNd, if( pEnd->nNode >= nEndNd && pRedline->GetAuthor() == pDoc->GetRedlineAuthor() ) { - bDelete = FALSE; + bDelete = sal_False; break; } } |