summaryrefslogtreecommitdiff
path: root/sw/source/core/docnode/ndtbl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/docnode/ndtbl.cxx')
-rw-r--r--sw/source/core/docnode/ndtbl.cxx1065
1 files changed, 548 insertions, 517 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 0c6d01b6005c..6cefc2cef949 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -52,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>
@@ -62,7 +64,12 @@
#include <fldbas.hxx>
#include <poolfmt.hxx>
#include <tabfrm.hxx>
-#include <undobj.hxx>
+#include <UndoCore.hxx>
+#include <UndoRedline.hxx>
+#include <UndoDelete.hxx>
+#include <UndoNumbering.hxx>
+#include <UndoTable.hxx>
+#include <hints.hxx>
#include <tblafmt.hxx>
#include <swcache.hxx>
#include <ddefld.hxx>
@@ -106,20 +113,20 @@ 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 );
-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 )
@@ -140,7 +147,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 ];
@@ -152,7 +159,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 );
@@ -169,7 +176,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 );
@@ -182,7 +189,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] )
{
@@ -198,14 +205,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 ));
@@ -217,7 +224,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() ) )
@@ -233,20 +240,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;
OSL_ENSURE( 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() )
{
@@ -268,7 +275,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;
@@ -281,7 +288,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 )
@@ -294,7 +301,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 );
@@ -304,7 +311,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();
@@ -327,18 +334,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 )
{
OSL_ENSURE( nRows, "Tabelle ohne Zeile?" );
OSL_ENSURE( nCols, "Tabelle ohne Spalten?" );
@@ -357,10 +364,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));
}
@@ -370,12 +377,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;
@@ -407,7 +414,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 );
@@ -423,12 +430,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;
@@ -440,7 +447,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 ]
@@ -449,14 +456,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 );
@@ -479,27 +486,27 @@ 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 );
}
SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 );
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 );
@@ -517,7 +524,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
@@ -528,7 +535,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!
@@ -565,10 +572,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)
{
@@ -587,9 +594,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 );
@@ -601,17 +608,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;
}
@@ -637,7 +644,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;
@@ -651,15 +658,15 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
pEnd = aOriginal.GetPoint();
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 );
@@ -669,7 +676,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 )
{
@@ -691,14 +698,14 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() )
{
- OSL_ENSURE( FALSE, "Kein Bereich" );
+ OSL_ENSURE( 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();
@@ -710,7 +717,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 ));
/* 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
@@ -720,7 +727,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 );
@@ -734,18 +741,18 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
SwTable * pNdTbl = &pTblNd->GetTable();
OSL_ENSURE( 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;
@@ -757,10 +764,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 );
}
@@ -770,21 +777,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 );
@@ -803,8 +810,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();
@@ -824,7 +831,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
@@ -846,7 +853,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;
@@ -857,11 +864,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 );
{
@@ -873,7 +880,9 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
}
if( pUndo )
- EndUndo( UNDO_TEXTTOTABLE, NULL );
+ {
+ GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, NULL );
+ }
SetModified();
SetFieldsDirty(true, NULL, 0);
@@ -898,7 +907,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 );
@@ -923,13 +932,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( static_cast<USHORT>(aFInfo.GetFrm()->IsVertical() ?
+ aPosArr.Insert(
+ static_cast<sal_uInt16>(aFInfo.GetFrm()->IsVertical() ?
aFInfo.GetFrm()->Prt().Bottom() :
aFInfo.GetFrm()->Prt().Right()),
aPosArr.Count() );
@@ -944,7 +954,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
if( pSet )
{
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 );
@@ -953,7 +963,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 )
@@ -1024,7 +1034,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 )
{
@@ -1035,7 +1045,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
@@ -1048,13 +1058,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 ] );
@@ -1093,11 +1103,12 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
const SwPosition *pStt = aOriginal.GetMark();
const SwPosition *pEnd = aOriginal.GetPoint();
- SwUndoTxtToTbl* pUndo = 0;
- if( DoesUndo() )
+// SwUndoTxtToTbl* pUndo = 0;
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ if (bUndo)
{
// das Splitten vom TextNode nicht in die Undohistory aufnehmen
- DoUndo( FALSE );
+ GetIDocumentUndoRedo().DoUndo(false);
}
::PaMCorrAbs( aOriginal, *pEnd );
@@ -1107,7 +1118,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 )
{
@@ -1129,14 +1140,14 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() )
{
- OSL_ENSURE( FALSE, "Kein Bereich" );
+ OSL_ENSURE( 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();
@@ -1156,7 +1167,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 );
@@ -1179,7 +1190,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
delete pBoxFmt;
}
- ULONG nIdx = pTblNd->GetIndex();
+ sal_uLong nIdx = pTblNd->GetIndex();
aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
SetModified();
@@ -1281,7 +1292,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;
SwNodeIndex aNodeIndex = rTableNodes.begin()->begin()->aStart;
// delete frames of all contained content nodes
@@ -1302,7 +1313,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
if( pSet )
{
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 );
@@ -1311,7 +1322,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 )
@@ -1361,18 +1372,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 ] );
@@ -1396,10 +1407,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
@@ -1412,9 +1423,9 @@ BOOL SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh )
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 );
}
@@ -1423,13 +1434,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;
}
@@ -1457,9 +1468,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 )
{
OSL_ENSURE( pPara, "die Parameter fehlen" );
_DelTabPara aPara( *(_DelTabPara*)pPara );
@@ -1467,11 +1478,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 )
{
OSL_ENSURE( pPara, "die Parameter fehlen" );
@@ -1491,7 +1502,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() )
{
@@ -1531,19 +1542,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
@@ -1572,9 +1583,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 )
@@ -1590,7 +1601,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,
@@ -1630,7 +1641,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();
@@ -1645,69 +1656,71 @@ 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 !!
OSL_ENSURE( 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;
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;
@@ -1715,60 +1728,62 @@ 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 !!
OSL_ENSURE( 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;
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;
@@ -1779,13 +1794,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:
@@ -1796,7 +1811,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 );
@@ -1806,7 +1821,7 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor )
}
if( !aFndBox.GetLines().Count() )
- return FALSE;
+ return sal_False;
SwEditShell* pESh = GetEditShell();
if( pESh )
@@ -1836,7 +1851,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 );
@@ -1848,13 +1863,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
@@ -1878,20 +1893,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
@@ -1904,26 +1919,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 !!
OSL_ENSURE( 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;
@@ -1940,21 +1955,21 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
}
// 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() )
@@ -1964,22 +1979,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 )
@@ -1996,13 +2011,14 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
*aSavePaM.GetMark() = SwPosition( *pTblNd );
aSavePaM.Move( fnMoveBackward, fnGoNode );
}
- ::PaMCorrAbs( SwNodeIndex( *pTblNd ),
- SwNodeIndex( *pTblNd->EndOfSectionNode() ),
- *aSavePaM.GetMark() );
+ {
+ SwPaM const tmpPaM(*pTblNd, *pTblNd->EndOfSectionNode());
+ ::PaMCorrAbs(tmpPaM, *aSavePaM.GetMark());
+ }
// 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 )
{
@@ -2010,17 +2026,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;
}
}
}
@@ -2029,7 +2045,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
{
@@ -2047,9 +2063,10 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
*aSavePaM.GetMark() = SwPosition( *pTblNd );
aSavePaM.Move( fnMoveBackward, fnGoNode );
}
- ::PaMCorrAbs( SwNodeIndex( *pTblNd ),
- SwNodeIndex( *pTblNd->EndOfSectionNode() ),
- *aSavePaM.GetMark() );
+ {
+ SwPaM const tmpPaM(*pTblNd, *pTblNd->EndOfSectionNode());
+ ::PaMCorrAbs(tmpPaM, *aSavePaM.GetMark());
+ }
// harte SeitenUmbrueche am nachfolgenden Node verschieben
SwCntntNode* pNextNd = GetNodes()[ pTblNd->EndOfSectionIndex()+1 ]->GetCntntNode();
@@ -2058,11 +2075,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 );
}
@@ -2071,43 +2088,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;
@@ -2119,33 +2138,31 @@ 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 !!
OSL_ENSURE( 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;
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() -
@@ -2154,33 +2171,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;
@@ -2190,7 +2209,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();
@@ -2199,7 +2218,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 );
@@ -2209,15 +2228,15 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam )
}
// --> FME 2004-10-08 #i33394#
- StartUndo( UNDO_TABLE_MERGE, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_MERGE, NULL );
// <--
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;
@@ -2230,13 +2249,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;
}
@@ -2259,7 +2284,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
@@ -2273,7 +2298,9 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam )
SetModified();
SetFieldsDirty( true, NULL, 0 );
if( pUndo )
- AppendUndo( pUndo );
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
}
else if( pUndo )
delete pUndo;
@@ -2284,7 +2311,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam )
::ClearFEShellTabCols();
SetRedlineMode_intern( eOld );
}
- EndUndo( UNDO_TABLE_MERGE, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_MERGE, NULL );
return nRet;
}
@@ -2331,7 +2358,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx )
OSL_ENSURE( pNode, "Kein Contentnode oder Copy-Node und neuer Node identisch.");
- BOOL bBefore = rIdx < GetIndex();
+ sal_Bool bBefore = rIdx < GetIndex();
SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
@@ -2398,7 +2425,7 @@ void SwTableNode::DelFrms()
SwClient *pLast = aIter.GoStart();
while ( pLast )
{
- BOOL bAgain = FALSE;
+ sal_Bool bAgain = sal_False;
if ( pLast->IsA( TYPE(SwFrm) ) )
{
SwTabFrm *pFrm = (SwTabFrm*)pLast;
@@ -2424,7 +2451,7 @@ void SwTableNode::DelFrms()
// <--
pFrm->Cut();
delete pFrm;
- bAgain = TRUE;
+ bAgain = sal_True;
}
}
pLast = bAgain ? aIter.GoStart() : aIter++;
@@ -2432,7 +2459,7 @@ void SwTableNode::DelFrms()
}
-void SwTableNode::SetNewTable( SwTable* pNewTable, BOOL bNewFrames )
+void SwTableNode::SetNewTable( SwTable* pNewTable, sal_Bool bNewFrames )
{
DelFrms();
delete pTable;
@@ -2467,7 +2494,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
if( pShCrsr )
aPt = pShCrsr->GetPtPos();
- const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, FALSE );
+ const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, sal_False );
do {
pTmpFrm = pTmpFrm->GetUpper();
} while ( !pTmpFrm->IsCellFrm() );
@@ -2485,9 +2512,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 );
@@ -2516,7 +2543,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;
@@ -2624,7 +2651,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() )
@@ -2643,7 +2670,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)();
@@ -2667,7 +2694,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;
@@ -2689,7 +2716,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, BOOL bCurRowOnly,
if( pShCrsr )
aPt = pShCrsr->GetPtPos();
- const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, FALSE );
+ const SwFrm* pTmpFrm = pCNd->GetFrm( &aPt, 0, sal_False );
do {
pTmpFrm = pTmpFrm->GetUpper();
} while ( !pTmpFrm->IsCellFrm() );
@@ -2728,9 +2755,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.
@@ -2743,7 +2770,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;
@@ -2781,17 +2808,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();
OSL_ENSURE( 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 ];
@@ -2819,7 +2846,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 )
@@ -2864,7 +2891,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor*
}
}
- EndUndo( UNDO_TABLE_ATTR, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_ATTR, NULL );
::ClearFEShellTabCols();
}
@@ -2873,27 +2900,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 );
@@ -2907,7 +2934,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)
@@ -2922,13 +2949,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() )
{
@@ -2945,15 +2972,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() )
{
@@ -2973,29 +3000,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
@@ -3009,13 +3036,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
@@ -3046,7 +3073,7 @@ BOOL lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara )
}
else
{
-USHORT aTableSplitBoxSetRange[] = {
+sal_uInt16 aTableSplitBoxSetRange[] = {
RES_LR_SPACE, RES_UL_SPACE,
RES_BACKGROUND, RES_SHADOW,
RES_PROTECT, RES_PROTECT,
@@ -3080,12 +3107,12 @@ USHORT 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();
@@ -3093,7 +3120,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
@@ -3101,11 +3128,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 );
@@ -3130,16 +3159,17 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode,
aFndBox.SetTableLines( rTbl );
aFndBox.DelFrms( rTbl );
- 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 );
}
@@ -3150,12 +3180,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 );
@@ -3172,11 +3202,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 );
}
@@ -3215,7 +3245,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
@@ -3224,19 +3254,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() )
@@ -3246,7 +3276,7 @@ BOOL lcl_ChgTblSize( SwTable& rTbl )
if( !bLocked ) // und gegebenenfalls Lock wieder freigeben
pFmt->UnlockModify();
- return TRUE;
+ return sal_True;
}
class _SplitTable_Para
@@ -3259,7 +3289,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 )
@@ -3268,7 +3298,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 )
@@ -3279,15 +3309,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() );
@@ -3297,16 +3327,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() );
@@ -3319,18 +3349,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();
@@ -3343,7 +3373,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 !!
@@ -3388,20 +3418,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
@@ -3436,11 +3466,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 )
@@ -3448,11 +3478,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 );
@@ -3461,11 +3491,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;
}
@@ -3478,7 +3507,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 )
{
@@ -3494,8 +3523,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();
OSL_ENSURE( pDelTblNd, "wo ist der TableNode geblieben?" );
@@ -3504,7 +3533,7 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev,
OSL_ENSURE( pTblNd, "wo ist der TableNode geblieben?" );
if( !pDelTblNd || !pTblNd )
- return FALSE;
+ return sal_False;
pDelTblNd->DelFrms();
@@ -3557,12 +3586,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();
@@ -3602,7 +3631,7 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev,
//Layout updaten
aFndBox.MakeFrms( rTbl );
- return TRUE;
+ return sal_True;
}
// -------------------------------------------------------------------
@@ -3613,8 +3642,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 ),
@@ -3624,16 +3653,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;
@@ -3644,7 +3673,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() )
@@ -3653,16 +3682,16 @@ BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara )
SwDoc* pDoc = pSetBox->GetFrmFmt()->GetDoc();
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();
@@ -3685,17 +3714,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 )
{
OSL_ENSURE( 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 );
@@ -3704,7 +3733,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 );
@@ -3719,18 +3748,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];
@@ -3743,7 +3773,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;
@@ -3755,22 +3785,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 )
{
OSL_ENSURE( 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 );
@@ -3779,7 +3811,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() &&
@@ -3791,30 +3823,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 )
@@ -3825,11 +3857,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
@@ -3838,10 +3870,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 )
@@ -3851,7 +3883,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 ));
}
@@ -3873,7 +3905,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 )
@@ -3881,7 +3913,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 ) &&
@@ -3895,20 +3927,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:
@@ -3918,7 +3951,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:
@@ -3927,15 +3960,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 )
@@ -3948,30 +3980,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 );
}
@@ -3979,16 +4011,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();
@@ -4001,7 +4033,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;
}
}
@@ -4040,20 +4072,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 )
{
nWhich1 = RES_BOXATR_FORMAT;
@@ -4066,7 +4098,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate )
pBoxFmt->ResetFmtAttr( nWhich1, RES_BOXATR_VALUE );
}
else
- bChgd = FALSE;
+ bChgd = sal_False;
}
if( bChgd )
@@ -4074,8 +4106,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();
@@ -4095,10 +4127,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();
@@ -4135,20 +4166,20 @@ void SwDoc::ClearLineNumAttrs( SwPosition & rPos )
RES_PARATR_BEGIN, RES_PARATR_END - 1,
0);
pTxtNode->SwCntntNode::GetAttr( rSet );
- if ( SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE , FALSE , &pFmtItem ) )
+ if ( SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE , sal_False , &pFmtItem ) )
{
SwUndoDelNum * pUndo;
- if( DoesUndo() )
+ if( GetIDocumentUndoRedo().DoesUndo() )
{
- ClearRedo();
- AppendUndo( pUndo = new SwUndoDelNum( aPam ) );
+ GetIDocumentUndoRedo().ClearRedo();
+ GetIDocumentUndoRedo().AppendUndo( pUndo = new SwUndoDelNum( aPam ) );
}
else
pUndo = 0;
SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 );
aRegH.RegisterInModify( pTxtNode , *pTxtNode );
if ( pUndo )
- pUndo->AddNode( *pTxtNode , FALSE );
+ pUndo->AddNode( *pTxtNode , sal_False );
String aStyle = String::CreateFromAscii("");
SfxStringItem * pNewItem = (SfxStringItem*)pFmtItem->Clone();
pNewItem->SetValue( aStyle );
@@ -4163,7 +4194,7 @@ void SwDoc::ClearLineNumAttrs( SwPosition & rPos )
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() )
{
@@ -4172,20 +4203,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;
@@ -4207,41 +4237,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
@@ -4253,43 +4289,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();
@@ -4328,7 +4359,6 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
if( bDelCpyDoc )
{
- delete pRefForDocSh;
if( pCpyDoc->release() == 0 )
delete pCpyDoc;
}
@@ -4337,11 +4367,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 )
@@ -4362,20 +4394,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;
}
}
@@ -4383,8 +4416,7 @@ BOOL SwDoc::_UnProtectTblCells( SwTable& rTbl )
{
if( bChgd )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -4393,9 +4425,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 )
{
@@ -4407,23 +4439,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
@@ -4433,7 +4465,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
pBoxFmt->ResetFmtAttr( RES_PROTECT );
aNewFmts.Insert( pBoxFmt, aNewFmts.Count() );
}
- bChgd = TRUE;
+ bChgd = sal_True;
}
}
@@ -4441,8 +4473,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
{
if( bChgd )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -4451,26 +4482,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(),
@@ -4487,18 +4518,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 ) );
@@ -4512,22 +4543,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;
}
}