diff options
Diffstat (limited to 'sw/source/core/docnode')
-rw-r--r-- | sw/source/core/docnode/makefile.mk | 82 | ||||
-rw-r--r-- | sw/source/core/docnode/ndcopy.cxx | 246 | ||||
-rw-r--r-- | sw/source/core/docnode/ndindex.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/docnode/ndnotxt.cxx | 64 | ||||
-rw-r--r-- | sw/source/core/docnode/ndnum.cxx | 28 | ||||
-rw-r--r-- | sw/source/core/docnode/ndsect.cxx | 216 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 1079 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl1.cxx | 348 | ||||
-rw-r--r-- | sw/source/core/docnode/node.cxx | 258 | ||||
-rw-r--r-- | sw/source/core/docnode/node2lay.cxx | 54 | ||||
-rw-r--r-- | sw/source/core/docnode/nodes.cxx | 343 | ||||
-rw-r--r-- | sw/source/core/docnode/section.cxx | 171 | ||||
-rw-r--r-- | sw/source/core/docnode/swbaslnk.cxx | 88 |
13 files changed, 1447 insertions, 1536 deletions
diff --git a/sw/source/core/docnode/makefile.mk b/sw/source/core/docnode/makefile.mk deleted file mode 100644 index d3e5df64b6cd..000000000000 --- a/sw/source/core/docnode/makefile.mk +++ /dev/null @@ -1,82 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=docnode - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/cancellablejob.obj \ - $(SLO)$/finalthreadmanager.obj \ - $(SLO)$/ndcopy.obj \ - $(SLO)$/ndtbl.obj \ - $(SLO)$/node.obj \ - $(SLO)$/observablethread.obj \ - $(SLO)$/retrieveinputstream.obj \ - $(SLO)$/retrievedinputstreamdata.obj \ - $(SLO)$/swbaslnk.obj \ - $(SLO)$/threadmanager.obj - -SLOFILES = \ - $(SLO)$/ndindex.obj \ - $(SLO)$/ndcopy.obj \ - $(SLO)$/ndnotxt.obj \ - $(SLO)$/ndnum.obj \ - $(SLO)$/ndsect.obj \ - $(SLO)$/ndtbl.obj \ - $(SLO)$/ndtbl1.obj \ - $(SLO)$/node.obj \ - $(SLO)$/node2lay.obj \ - $(SLO)$/nodes.obj \ - $(SLO)$/section.obj \ - $(SLO)$/swbaslnk.obj \ - $(SLO)$/retrievedinputstreamdata.obj \ - $(SLO)$/observablethread.obj \ - $(SLO)$/cancellablejob.obj \ - $(SLO)$/retrieveinputstream.obj \ - $(SLO)$/retrieveinputstreamconsumer.obj \ - $(SLO)$/threadlistener.obj \ - $(SLO)$/threadmanager.obj \ - $(SLO)$/swthreadmanager.obj \ - $(SLO)$/swthreadjoiner.obj \ - $(SLO)$/pausethreadstarting.obj \ - $(SLO)$/finalthreadmanager.obj - - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 9c2ce7af3139..61e1f8eabeaa 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -28,16 +28,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <editeng/brkitem.hxx> #define _ZFORLIST_DECLARE_TABLE #include <hintids.hxx> - - -#include <editeng/brkitem.hxx> #include <fmtpdsc.hxx> #include <fmtanchr.hxx> #include <fmtcntnt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <fldbas.hxx> @@ -79,10 +78,10 @@ namespace nNewIdx is the new position of interest. */ - static void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const ULONG nNewIdx, ULONG& rDelCount ) + static void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const sal_uLong nNewIdx, sal_uLong& rDelCount ) { - ULONG nStart = rPam.Start()->nNode.GetIndex(); - ULONG nEnd = rPam.End()->nNode.GetIndex(); + sal_uLong nStart = rPam.Start()->nNode.GetIndex(); + sal_uLong nEnd = rPam.End()->nNode.GetIndex(); if( rLastIdx.GetIndex() < nNewIdx ) // Moving forward? { do // count "non-copy" nodes @@ -113,9 +112,9 @@ namespace const SwPosition& rOrigStt, const SwPosition& rCpyStt, SwPosition& rChgPos, - ULONG nDelCount ) + sal_uLong nDelCount ) { - ULONG nNdOff = rOrigPos.nNode.GetIndex(); + sal_uLong nNdOff = rOrigPos.nNode.GetIndex(); nNdOff -= rOrigStt.nNode.GetIndex(); nNdOff -= nDelCount; xub_StrLen nCntntPos = rOrigPos.nContent.GetIndex(); @@ -142,8 +141,7 @@ namespace const SwDoc* pSrcDoc = rPam.GetDoc(); SwDoc* pDestDoc = rCpyPam.GetDoc(); const IDocumentMarkAccess* const pSrcMarkAccess = pSrcDoc->getIDocumentMarkAccess(); - bool bDoesUndo = pDestDoc->DoesUndo(); - pDestDoc->DoUndo(false); + ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo()); const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); SwPosition* pCpyStt = rCpyPam.Start(); @@ -169,7 +167,7 @@ namespace } // We have to count the "non-copied" nodes.. SwNodeIndex aCorrIdx(rStt.nNode); - ULONG nDelCount = 0; + sal_uLong nDelCount = 0; for(mark_vector_t::const_iterator ppMark = vMarksToCopy.begin(); ppMark != vMarksToCopy.end(); ++ppMark) @@ -209,7 +207,6 @@ namespace pNewMetadatable->RegisterAsCopyOf(*pMetadatable); } } - pDestDoc->DoUndo(bDoesUndo); } } @@ -289,37 +286,37 @@ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const } -BOOL lcl_SrchNew( const _MapTblFrmFmt& rMap, void * pPara ) +sal_Bool lcl_SrchNew( const _MapTblFrmFmt& rMap, void * pPara ) { if( rMap.pOld != *(const SwFrmFmt**)pPara ) - return TRUE; + return sal_True; *((const SwFrmFmt**)pPara) = rMap.pNew; - return FALSE; // abbrechen, Pointer gefunden + return sal_False; // abbrechen, Pointer gefunden } struct _CopyTable { SwDoc* pDoc; - ULONG nOldTblSttIdx; + sal_uLong nOldTblSttIdx; _MapTblFrmFmts& rMapArr; SwTableLine* pInsLine; SwTableBox* pInsBox; SwTableNode *pTblNd; const SwTable *pOldTable; - _CopyTable( SwDoc* pDc, _MapTblFrmFmts& rArr, ULONG nOldStt, + _CopyTable( SwDoc* pDc, _MapTblFrmFmts& rArr, sal_uLong nOldStt, SwTableNode& rTblNd, const SwTable* pOldTbl ) : pDoc(pDc), nOldTblSttIdx(nOldStt), rMapArr(rArr), pInsLine(0), pInsBox(0), pTblNd(&rTblNd), pOldTable( pOldTbl ) {} }; -BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ); +sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ); -BOOL lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ); +sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ); -BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) { _CopyTable* pCT = (_CopyTable*)pPara; @@ -328,7 +325,7 @@ BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) if( pBoxFmt == rpBox->GetFrmFmt() ) // ein neues anlegen ?? { const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMULA, FALSE, + if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMULA, sal_False, &pItem ) && ((SwTblBoxFormula*)pItem)->IsIntrnlName() ) { ((SwTblBoxFormula*)pItem)->PtrToBoxNm( pCT->pOldTable ); @@ -339,12 +336,12 @@ BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) if( rpBox->GetSttIdx() ) { - SvNumberFormatter* pN = pCT->pDoc->GetNumberFormatter( FALSE ); + SvNumberFormatter* pN = pCT->pDoc->GetNumberFormatter( sal_False ); if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == pBoxFmt-> - GetItemState( RES_BOXATR_FORMAT, FALSE, &pItem ) ) + GetItemState( RES_BOXATR_FORMAT, sal_False, &pItem ) ) { - ULONG nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); - ULONG nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); + sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); + sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); if( nNewIdx != nOldIdx ) pBoxFmt->SetFmtAttr( SwTblBoxNumFormat( nNewIdx )); @@ -355,7 +352,7 @@ BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) pCT->rMapArr.Count() ); } - USHORT nLines = rpBox->GetTabLines().Count(); + sal_uInt16 nLines = rpBox->GetTabLines().Count(); SwTableBox* pNewBox; if( nLines ) pNewBox = new SwTableBox( pBoxFmt, nLines, pCT->pInsLine ); @@ -380,10 +377,10 @@ BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara ) else if( pNewBox->IsInHeadline( &pCT->pTblNd->GetTable() )) // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen pNewBox->GetSttNd()->CheckSectionCondColl(); - return TRUE; + return sal_True; } -BOOL lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ) { _CopyTable* pCT = (_CopyTable*)pPara; SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rpLine->GetFrmFmt(); @@ -410,7 +407,7 @@ BOOL lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara ) } pCT->pInsLine = pNewLine; ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_CopyTblBox, pCT ); - return TRUE; + return sal_True; } SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const @@ -440,7 +437,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const if( !pDoc->IsCopyIsMove() ) { const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts(); - for( USHORT n = rTblFmts.Count(); n; ) + for( sal_uInt16 n = rTblFmts.Count(); n; ) if( rTblFmts[ --n ]->GetName() == sTblName ) { sTblName = pDoc->GetUniqueTblName(); @@ -475,7 +472,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const // tauschen am Node den Tabellen-Pointer aus SwDDETable* pNewTable = new SwDDETable( pTblNd->GetTable(), pDDEType ); - pTblNd->SetNewTable( pNewTable, FALSE ); + pTblNd->SetNewTable( pNewTable, sal_False ); } // dann kopiere erstmal den Inhalt der Tabelle, die Zuordnung der // Boxen/Lines und das anlegen der Frames erfolgt spaeter @@ -487,7 +484,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const // We have to make sure that the table node of the SwTable is accessible, even // without any content in aSortCntBoxes. #i26629# pTblNd->GetTable().SetTableNode( pTblNd ); - rNds._Copy( aRg, aInsPos, FALSE ); + rNds._Copy( aRg, aInsPos, sal_False ); pTblNd->GetTable().SetTableNode( 0 ); // Sonderbehandlung fuer eine einzelne Box @@ -527,10 +524,10 @@ void SwTxtNode::CopyCollFmt( SwTxtNode& rDestNd ) { // Sonderbehandlung fuer unsere Break-Attribute const SfxPoolItem* pAttr; - if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE, &pAttr ) ) + if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pAttr ) ) aPgBrkSet.Put( *pAttr ); - if( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, FALSE, &pAttr ) ) + if( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, sal_False, &pAttr ) ) aPgBrkSet.Put( *pAttr ); } @@ -546,12 +543,12 @@ void SwTxtNode::CopyCollFmt( SwTxtNode& rDestNd ) // ----- Copy-Methode vom SwDoc ------ // verhinder das Kopieren in Fly's, die im Bereich verankert sind. -BOOL lcl_ChkFlyFly( SwDoc* pDoc, ULONG nSttNd, ULONG nEndNd, - ULONG nInsNd ) +sal_Bool lcl_ChkFlyFly( SwDoc* pDoc, sal_uLong nSttNd, sal_uLong nEndNd, + sal_uLong nInsNd ) { const SwSpzFrmFmts& rFrmFmtTbl = *pDoc->GetSpzFrmFmts(); - for( USHORT n = 0; n < rFrmFmtTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFrmFmtTbl.Count(); ++n ) { SwFrmFmt const*const pFmt = rFrmFmtTbl[n]; SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor(); @@ -572,15 +569,15 @@ BOOL lcl_ChkFlyFly( SwDoc* pDoc, ULONG nSttNd, ULONG nEndNd, if( pSNd->GetIndex() < nInsNd && nInsNd < pSNd->EndOfSectionIndex() ) - return TRUE; // nicht kopieren !! + return sal_True; // nicht kopieren !! if( lcl_ChkFlyFly( pDoc, pSNd->GetIndex(), pSNd->EndOfSectionIndex(), nInsNd ) ) - return TRUE; // nicht kopieren !! + return sal_True; // nicht kopieren !! } } - return FALSE; + return sal_False; } void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam ) @@ -594,10 +591,10 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam ) SwPaM* pDelPam = 0; const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); // We have to count the "non-copied" nodes - ULONG nDelCount = 0; + sal_uLong nDelCount = 0; SwNodeIndex aCorrIdx( pStt->nNode ); - USHORT n = 0; + sal_uInt16 n = 0; pSrcDoc->GetRedline( *pStt, &n ); for( ; n < rTbl.Count(); ++n ) { @@ -647,18 +644,16 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam ) RedlineMode_t eOld = pDestDoc->GetRedlineMode(); pDestDoc->SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bDoesUndo = pDestDoc->DoesUndo(); - pDestDoc->DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo()); do { pDestDoc->DeleteAndJoin( *(SwPaM*)pDelPam->GetNext() ); if( pDelPam->GetNext() == pDelPam ) break; delete pDelPam->GetNext(); - } while( TRUE ); + } while( sal_True ); delete pDelPam; - pDestDoc->DoUndo( bDoesUndo ); pDestDoc->SetRedlineMode_intern( eOld ); } } @@ -693,7 +688,7 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const if( pDoc == this ) { // Start-/EndNode noch korrigieren - ULONG nStt = pStt->nNode.GetIndex(), + sal_uLong nStt = pStt->nNode.GetIndex(), nEnd = pEnd->nNode.GetIndex(), nDiff = nEnd - nStt +1; SwNode* pNd = GetNodes()[ nStt ]; @@ -737,49 +732,50 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const "please tell me what you did to get here!"); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bDoUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); // Auf jedenfall Undo abschalten // dann kopiere den Bereich im unteren DokumentBereich, // (mit Start/End-Nodes geklammert) und verschiebe diese // dann an die gewuenschte Stelle. SwUndoCpyDoc* pUndo = 0; SwPaM aPam( rPos ); // UndoBereich sichern - if( bDoUndo ) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { - pDoc->ClearRedo(); + pDoc->GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoCpyDoc( aPam ); } - SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection( + { + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection( SwNodeIndex( GetNodes().GetEndOfAutotext() )); - aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode(); - // copy without Frames - pDoc->CopyImpl( rPam, *aPam.GetPoint(), false, bCopyAll, 0 ); - - aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext(); - aPam.SetMark(); - SwCntntNode* pNode = pDoc->GetNodes().GoPrevious( &aPam.GetMark()->nNode ); - pNode->MakeEndIndex( &aPam.GetMark()->nContent ); - - aPam.GetPoint()->nNode = *aPam.GetNode()->StartOfSectionNode(); - pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode ); - pNode->MakeStartIndex( &aPam.GetPoint()->nContent ); - // move to desired position - pDoc->MoveRange( aPam, rPos, DOC_MOVEDEFAULT ); - - pNode = aPam.GetCntntNode(); - *aPam.GetPoint() = rPos; // Cursor umsetzen fuers Undo ! - aPam.SetMark(); // auch den Mark umsetzen !! - aPam.DeleteMark(); // aber keinen Bereich makieren !! - pDoc->DeleteSection( pNode ); // Bereich wieder loeschen - - // falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich - pDoc->DoUndo( bDoUndo ); - if( bDoUndo ) + aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode(); + // copy without Frames + pDoc->CopyImpl( rPam, *aPam.GetPoint(), false, bCopyAll, 0 ); + + aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext(); + aPam.SetMark(); + SwCntntNode* pNode = + pDoc->GetNodes().GoPrevious( &aPam.GetMark()->nNode ); + pNode->MakeEndIndex( &aPam.GetMark()->nContent ); + + aPam.GetPoint()->nNode = *aPam.GetNode()->StartOfSectionNode(); + pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode ); + pNode->MakeStartIndex( &aPam.GetPoint()->nContent ); + // move to desired position + pDoc->MoveRange( aPam, rPos, DOC_MOVEDEFAULT ); + + pNode = aPam.GetCntntNode(); + *aPam.GetPoint() = rPos; // Cursor umsetzen fuers Undo ! + aPam.SetMark(); // auch den Mark umsetzen !! + aPam.DeleteMark(); // aber keinen Bereich makieren !! + pDoc->DeleteSection( pNode ); // Bereich wieder loeschen + } + + // if Undo is enabled, store the insertion range + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { pUndo->SetInsertRange( aPam ); - pDoc->AppendUndo( pUndo ); + pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo); } if( pRedlineRange ) @@ -889,11 +885,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, SwTblNumFmtMerge aTNFM( *this, *pDoc ); - if( pDoc->DoesUndo() ) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { - pDoc->ClearRedo(); pUndo = new SwUndoCpyDoc( aCpyPam ); - pDoc->AppendUndo( pUndo ); + pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo ); } RedlineMode_t eOld = pDoc->GetRedlineMode(); @@ -903,7 +898,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, // bewege den Pam von der Insert-Position ein zurueck, dadurch wird // die Position nicht "verschoben" aCpyPam.SetMark(); - BOOL bCanMoveBack = aCpyPam.Move( fnMoveBackward, fnGoCntnt ); + sal_Bool bCanMoveBack = aCpyPam.Move( fnMoveBackward, fnGoCntnt ); if( !bCanMoveBack ) aCpyPam.GetPoint()->nNode--; @@ -917,7 +912,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, ( ( pDestTxtNd && !pDestTxtNd->GetTxt().Len() ) || ( !bOneNode && !rPos.nContent.GetIndex() ) ); bool bCopyBookmarks = true; - BOOL bStartIsTxtNode = 0 != pSttTxtNd; + sal_Bool bStartIsTxtNode = 0 != pSttTxtNd; // #i104585# copy outline num rule to clipboard (for ASCII filter) if (pDoc->IsClipBoard() && GetOutlineNumRule()) @@ -959,7 +954,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, if( !bCopyCollFmt || bColumnSel || pStt->nContent.GetIndex() ) { SwIndex aDestIdx( rPos.nContent ); - BOOL bCopyOk = FALSE; + sal_Bool bCopyOk = sal_False; if( !pDestTxtNd ) { if( pStt->nContent.GetIndex() || bOneNode ) @@ -968,7 +963,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, else { pDestTxtNd = static_cast<SwTxtNode*>(pSttTxtNd->MakeCopy( pDoc, aInsPos )); - bCopyOk = TRUE; + bCopyOk = sal_True; } aDestIdx.Assign( pDestTxtNd, 0 ); bCopyCollFmt = true; @@ -976,10 +971,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, else if( !bOneNode || bColumnSel ) { xub_StrLen nCntntEnd = pEnd->nContent.GetIndex(); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); - pDoc->SplitNode( rPos, false ); - pDoc->DoUndo( bDoesUndo ); + { + ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); + pDoc->SplitNode( rPos, false ); + } if( bCanMoveBack && rPos == *aCpyPam.GetPoint() ) { @@ -994,7 +989,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, // korrigiere den Bereich wieder !! if( bEndEqualIns ) { - BOOL bChg = pEnd != rPam.GetPoint(); + sal_Bool bChg = pEnd != rPam.GetPoint(); if( bChg ) rPam.Exchange(); rPam.Move( fnMoveBackward, fnGoCntnt ); @@ -1025,12 +1020,12 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, if (pAttrSet != NULL) { const SfxPoolItem * pItem = NULL; - aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem); + aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, sal_False, &pItem); if (SFX_ITEM_SET == aNumRuleState) aNumRuleItem = *((SwNumRuleItem *) pItem); aListIdState = - pAttrSet->GetItemState(RES_PARATR_LIST_ID, FALSE, &pItem); + pAttrSet->GetItemState(RES_PARATR_LIST_ID, sal_False, &pItem); if (SFX_ITEM_SET == aListIdState) { aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() ); @@ -1102,14 +1097,14 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, else if( rPos.nContent.GetIndex() ) { // Insertion in the middle of a text node, it has to be split // (and joined from undo) - bStartIsTxtNode = TRUE; + bStartIsTxtNode = sal_True; // splitte den TextNode, bei dem Eingefuegt wird. xub_StrLen nCntntEnd = pEnd->nContent.GetIndex(); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); - pDoc->SplitNode( rPos, false ); - pDoc->DoUndo( bDoesUndo ); + { + ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); + pDoc->SplitNode( rPos, false ); + } if( bCanMoveBack && rPos == *aCpyPam.GetPoint() ) { @@ -1159,7 +1154,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, // will ensure that this node will be deleted during Undo // using JoinNext. DBG_ASSERT( !bStartIsTxtNode, "Oops, undo may be instable now." ); - bStartIsTxtNode = TRUE; + bStartIsTxtNode = sal_True; } /* #107213# Save numrule at destination */ @@ -1176,12 +1171,12 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, const SfxPoolItem * pItem = NULL; aNumRuleState = - pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem); + pAttrSet->GetItemState(RES_PARATR_NUMRULE, sal_False, &pItem); if (SFX_ITEM_SET == aNumRuleState) aNumRuleItem = *((SwNumRuleItem *) pItem); aListIdState = - pAttrSet->GetItemState(RES_PARATR_LIST_ID, FALSE, &pItem); + pAttrSet->GetItemState(RES_PARATR_LIST_ID, sal_False, &pItem); if (SFX_ITEM_SET == aListIdState) aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() ); } @@ -1233,22 +1228,22 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, if( pSttTxtNd && bCopyCollFmt && pDestTxtNd->HasSwAttrSet() ) { aBrkSet.Put( *pDestTxtNd->GetpSwAttrSet() ); - if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_BREAK, FALSE ) ) + if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_BREAK, sal_False ) ) pDestTxtNd->ResetAttr( RES_BREAK ); - if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_PAGEDESC, FALSE ) ) + if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_PAGEDESC, sal_False ) ) pDestTxtNd->ResetAttr( RES_PAGEDESC ); } if( aInsPos == pEnd->nNode ) { SwNodeIndex aSaveIdx( aInsPos, -1 ); - CopyWithFlyInFly( aRg, 0,aInsPos, bMakeNewFrms, FALSE ); + CopyWithFlyInFly( aRg, 0,aInsPos, bMakeNewFrms, sal_False ); aSaveIdx++; pEnd->nNode = aSaveIdx; pEnd->nContent.Assign( aSaveIdx.GetNode().GetTxtNode(), 0 ); } else - CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, FALSE ); + CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, sal_False ); bCopyBookmarks = false; @@ -1259,7 +1254,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, pDestTxtNd->SetAttr( aBrkSet ); } } - } while( FALSE ); + } while( sal_False ); // Position ummelden ( falls verschoben / im anderen Node ) rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(), @@ -1268,7 +1263,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, if( rPos.nNode != aInsPos ) { aCpyPam.GetMark()->nNode = aInsPos; - aCpyPam.GetMark()->nContent.Assign( aCpyPam.GetCntntNode(FALSE), 0 ); + aCpyPam.GetMark()->nContent.Assign( aCpyPam.GetCntntNode(sal_False), 0 ); rPos = *aCpyPam.GetMark(); } else @@ -1285,8 +1280,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, lcl_DeleteRedlines( rPam, aCpyPam ); // falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich - if( pDoc->DoesUndo() ) - pUndo->SetInsertRange( aCpyPam, TRUE, bStartIsTxtNode ); + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) + { + pUndo->SetInsertRange( aCpyPam, sal_True, bStartIsTxtNode ); + } if( pCpyRange ) { @@ -1314,16 +1311,16 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, // ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, - const SwNodeIndex& rInsPos, BOOL bMakeNewFrms, - BOOL bDelRedlines, BOOL bCopyFlyAtFly ) const + const SwNodeIndex& rInsPos, sal_Bool bMakeNewFrms, + sal_Bool bDelRedlines, sal_Bool bCopyFlyAtFly ) const { SwDoc* pDest = rInsPos.GetNode().GetDoc(); _SaveRedlEndPosForRestore aRedlRest( rInsPos, 0 ); SwNodeIndex aSavePos( rInsPos, -1 ); - BOOL bEndIsEqualEndPos = rInsPos == rRg.aEnd; - GetNodes()._CopyNodes( rRg, rInsPos, bMakeNewFrms, TRUE ); + sal_Bool bEndIsEqualEndPos = rInsPos == rRg.aEnd; + GetNodes()._CopyNodes( rRg, rInsPos, bMakeNewFrms, sal_True ); aSavePos++; if( bEndIsEqualEndPos ) ((SwNodeIndex&)rRg.aEnd) = aSavePos; @@ -1349,11 +1346,10 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte } #endif - // Undo abschalten - BOOL bUndo = pDest->DoesUndo(); - pDest->DoUndo( FALSE ); - CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly ); - pDest->DoUndo( bUndo ); + { + ::sw::UndoGuard const undoGuard(pDest->GetIDocumentUndoRedo()); + CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly ); + } SwNodeRange aCpyRange( aSavePos, rInsPos ); @@ -1398,9 +1394,9 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, // beibehalten. SwDoc *const pDest = rStartIdx.GetNode().GetDoc(); _ZSortFlys aArr; - USHORT nArrLen = GetSpzFrmFmts()->Count(); + sal_uInt16 nArrLen = GetSpzFrmFmts()->Count(); - for ( USHORT n = 0; n < nArrLen; ++n ) + for ( sal_uInt16 n = 0; n < nArrLen; ++n ) { SwFrmFmt const*const pFmt = (*GetSpzFrmFmts())[n]; SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor(); @@ -1440,7 +1436,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, //last node information is only necessary to know for the last TextNode SwNodeIndex aTmp( pAPos->nNode ); ++aTmp;//goto next node - while( rNodes[aTmp ]->IsEndNode() ) + while (aTmp.GetNode().IsEndNode()) { if( aTmp == rNodes.GetEndOfContent().GetIndex() ) { @@ -1470,7 +1466,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, //die Chains entsprechend aufgebaut werden koennen. SvPtrarr aNewArr( 10, 10 ); - for ( USHORT n = 0; n < aArr.Count(); ++n ) + for ( sal_uInt16 n = 0; n < aArr.Count(); ++n ) { const _ZSortFly& rZSortFly = aArr[ n ]; @@ -1490,7 +1486,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, { // First, determine number of anchor text node in the copied range. // Note: The anchor text node *have* to be inside the copied range. - ULONG nAnchorTxtNdNumInRange( 0L ); + sal_uLong nAnchorTxtNdNumInRange( 0L ); bool bAnchorTxtNdFound( false ); SwNodeIndex aIdx( rRg.aStart ); while ( !bAnchorTxtNdFound && aIdx <= rRg.aEnd ) @@ -1565,7 +1561,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, // ueberpruefe Rekursion: Inhalt in "seinen eigenen" Frame // kopieren. Dann nicht kopieren - BOOL bMakeCpy = TRUE; + sal_Bool bMakeCpy = sal_True; if( pDest == this ) { const SwFmtCntnt& rCntnt = rZSortFly.GetFmt()->GetCntnt(); @@ -1575,7 +1571,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, pSNd->GetIndex() < rStartIdx.GetIndex() && rStartIdx.GetIndex() < pSNd->EndOfSectionIndex() ) { - bMakeCpy = FALSE; + bMakeCpy = sal_False; aArr.Remove( n, 1 ); --n; } @@ -1592,13 +1588,13 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg, ASSERT( aArr.Count() == aNewArr.Count(), "Missing new Flys" ); if ( aArr.Count() == aNewArr.Count() ) { - for ( USHORT n = 0; n < aArr.Count(); ++n ) + for ( sal_uInt16 n = 0; n < aArr.Count(); ++n ) { const SwFrmFmt *pFmt = aArr[n].GetFmt(); const SwFmtChain &rChain = pFmt->GetChain(); int nCnt = 0 != rChain.GetPrev(); nCnt += rChain.GetNext() ? 1: 0; - for ( USHORT k = 0; nCnt && k < aArr.Count(); ++k ) + for ( sal_uInt16 k = 0; nCnt && k < aArr.Count(); ++k ) { const _ZSortFly &rTmp = aArr[k]; const SwFrmFmt *pTmp = rTmp.GetFmt(); diff --git a/sw/source/core/docnode/ndindex.cxx b/sw/source/core/docnode/ndindex.cxx index cd7288430479..a6b718df2d09 100644 --- a/sw/source/core/docnode/ndindex.cxx +++ b/sw/source/core/docnode/ndindex.cxx @@ -47,7 +47,7 @@ SwNodeRange::SwNodeRange( const SwNodeRange &rRange ) : aStart( rRange.aStart ), aEnd( rRange.aEnd ) {} -SwNodeRange::SwNodeRange( SwNodes& rNds, ULONG nSttIdx, ULONG nEndIdx ) +SwNodeRange::SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx, sal_uLong nEndIdx ) : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx ) {} @@ -63,7 +63,7 @@ SwNodeRange::SwNodeRange( const SwNode& rS, long nSttDiff, {} -SwNodeIndex::SwNodeIndex( SwNodes& rNds, ULONG nIdx ) +SwNodeIndex::SwNodeIndex( SwNodes& rNds, sal_uLong nIdx ) : pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 ) { rNds.RegisterIndex( *this ); @@ -135,7 +135,7 @@ SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd ) return *this; } -SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, ULONG nIdx ) +SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx ) { if( &pNd->GetNodes() != &rNds ) { diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index 985c4c8e4709..6ad9605a18f2 100644 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -50,14 +50,14 @@ // <-- SwNoTxtNode::SwNoTxtNode( const SwNodeIndex & rWhere, - const BYTE nNdType, + const sal_uInt8 nNdType, SwGrfFmtColl *pGrfColl, SwAttrSet* pAutoAttr ) : SwCntntNode( rWhere, nNdType, pGrfColl ), pContour( 0 ), - bAutomaticContour( FALSE ), - bContourMapModeValid( TRUE ), - bPixelContour( FALSE ) + bAutomaticContour( sal_False ), + bContourMapModeValid( sal_True ), + bPixelContour( sal_False ) { // soll eine Harte-Attributierung gesetzt werden? if( pAutoAttr ) @@ -93,19 +93,19 @@ void SwNoTxtNode::NewAttrSet( SwAttrPool& rPool ) // bei Grafiken und OLE-Objekten -BOOL SwNoTxtNode::RestorePersistentData() +sal_Bool SwNoTxtNode::RestorePersistentData() { - return TRUE; + return sal_True; } -BOOL SwNoTxtNode::SavePersistentData() +sal_Bool SwNoTxtNode::SavePersistentData() { - return TRUE; + return sal_True; } -void SwNoTxtNode::SetContour( const PolyPolygon *pPoly, BOOL bAutomatic ) +void SwNoTxtNode::SetContour( const PolyPolygon *pPoly, sal_Bool bAutomatic ) { delete pContour; if ( pPoly ) @@ -113,8 +113,8 @@ void SwNoTxtNode::SetContour( const PolyPolygon *pPoly, BOOL bAutomatic ) else pContour = 0; bAutomaticContour = bAutomatic; - bContourMapModeValid = TRUE; - bPixelContour = FALSE; + bContourMapModeValid = sal_True; + bPixelContour = sal_False; } @@ -122,9 +122,9 @@ void SwNoTxtNode::CreateContour() { ASSERT( !pContour, "Contour available." ); pContour = new PolyPolygon(SvxContourDlg::CreateAutoContour(GetGraphic())); - bAutomaticContour = TRUE; - bContourMapModeValid = TRUE; - bPixelContour = FALSE; + bAutomaticContour = sal_True; + bContourMapModeValid = sal_True; + bPixelContour = sal_False; } const PolyPolygon *SwNoTxtNode::HasContour() const @@ -132,7 +132,7 @@ const PolyPolygon *SwNoTxtNode::HasContour() const if( !bContourMapModeValid ) { const MapMode aGrfMap( GetGraphic().GetPrefMapMode() ); - BOOL bPixelGrf = aGrfMap.GetMapUnit() == MAP_PIXEL; + sal_Bool bPixelGrf = aGrfMap.GetMapUnit() == MAP_PIXEL; const MapMode aContourMap( bPixelGrf ? MAP_PIXEL : MAP_100TH_MM ); if( bPixelGrf ? !bPixelContour : aGrfMap != aContourMap ) { @@ -141,13 +141,13 @@ const PolyPolygon *SwNoTxtNode::HasContour() const OutputDevice* pOutDev = (bPixelGrf || bPixelContour) ? Application::GetDefaultDevice() : 0; - USHORT nPolyCount = pContour->Count(); - for( USHORT j=0; j<nPolyCount; j++ ) + sal_uInt16 nPolyCount = pContour->Count(); + for( sal_uInt16 j=0; j<nPolyCount; j++ ) { Polygon& rPoly = (*pContour)[j]; - USHORT nCount = rPoly.GetSize(); - for( USHORT i=0 ; i<nCount; i++ ) + sal_uInt16 nCount = rPoly.GetSize(); + for( sal_uInt16 i=0 ; i<nCount; i++ ) { if( bPixelGrf ) rPoly[i] = pOutDev->LogicToPixel( rPoly[i], @@ -161,8 +161,8 @@ const PolyPolygon *SwNoTxtNode::HasContour() const } } } - ((SwNoTxtNode *)this)->bContourMapModeValid = TRUE; - ((SwNoTxtNode *)this)->bPixelContour = FALSE; + ((SwNoTxtNode *)this)->bContourMapModeValid = sal_True; + ((SwNoTxtNode *)this)->bPixelContour = sal_False; } return pContour; @@ -181,13 +181,13 @@ void SwNoTxtNode::SetContourAPI( const PolyPolygon *pPoly ) pContour = new PolyPolygon( *pPoly ); else pContour = 0; - bContourMapModeValid = FALSE; + bContourMapModeValid = sal_False; } -BOOL SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const +sal_Bool SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const { if( !pContour ) - return FALSE; + return sal_False; rContour = *pContour; if( bContourMapModeValid ) @@ -200,13 +200,13 @@ BOOL SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const if( aGrfMap.GetMapUnit() != MAP_PIXEL && aGrfMap != aContourMap ) { - USHORT nPolyCount = rContour.Count(); - for( USHORT j=0; j<nPolyCount; j++ ) + sal_uInt16 nPolyCount = rContour.Count(); + for( sal_uInt16 j=0; j<nPolyCount; j++ ) { Polygon& rPoly = (*pContour)[j]; - USHORT nCount = rPoly.GetSize(); - for( USHORT i=0 ; i<nCount; i++ ) + sal_uInt16 nCount = rPoly.GetSize(); + for( sal_uInt16 i=0 ; i<nCount; i++ ) { rPoly[i] = OutputDevice::LogicToLogic( rPoly[i], aGrfMap, aContourMap ); @@ -215,12 +215,12 @@ BOOL SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const } } - return TRUE; + return sal_True; } -BOOL SwNoTxtNode::IsPixelContour() const +sal_Bool SwNoTxtNode::IsPixelContour() const { - BOOL bRet; + sal_Bool bRet; if( bContourMapModeValid ) { const MapMode aGrfMap( GetGraphic().GetPrefMapMode() ); @@ -240,7 +240,7 @@ Graphic SwNoTxtNode::GetGraphic() const Graphic aRet; if ( GetGrfNode() ) { - ((SwGrfNode*)this)->SwapIn( TRUE ); + ((SwGrfNode*)this)->SwapIn( sal_True ); aRet = ((SwGrfNode*)this)->GetGrf(); } else diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index 1d1203a70e9b..6e00748b618e 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -37,11 +37,11 @@ #include <docary.hxx> _SV_IMPL_SORTAR_ALG( SwOutlineNodes, SwNodePtr ) -BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const +sal_Bool SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, sal_uInt16* pFndPos ) const { - ULONG nIdx = rSrch->GetIndex(); + sal_uLong nIdx = rSrch->GetIndex(); - USHORT nO = Count(), nM, nU = 0; + sal_uInt16 nO = Count(), nM, nU = 0; if( nO > 0 ) { //JP 17.03.98: aufgrund des Bug 48592 - wo unter anderem nach Undo/Redo @@ -49,7 +49,7 @@ BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const // jetzt mal einen Check eingebaut. #ifdef DBG_UTIL { - for( USHORT n = 1; n < nO; ++n ) + for( sal_uInt16 n = 1; n < nO; ++n ) if( &(*this)[ n-1 ]->GetNodes() != &(*this)[ n ]->GetNodes() ) { @@ -66,7 +66,7 @@ BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const { if( pFndPos ) *pFndPos = nM; - return TRUE; + return sal_True; } else if( (*this)[ nM ]->GetIndex() < nIdx ) nU = nM + 1; @@ -74,7 +74,7 @@ BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const { if( pFndPos ) *pFndPos = nU; - return FALSE; + return sal_False; } else nO = nM - 1; @@ -82,7 +82,7 @@ BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const } if( pFndPos ) *pFndPos = nU; - return FALSE; + return sal_False; } void SwNodes::UpdateOutlineNode(SwNode & rNd) @@ -91,7 +91,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) if (pTxtNd && pTxtNd->IsOutlineStateChanged()) { - BOOL bFound = pOutlineNds->Seek_Entry(pTxtNd); + sal_Bool bFound = pOutlineNds->Seek_Entry(pTxtNd); if (pTxtNd->IsOutline()) { @@ -124,12 +124,12 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) } } -//void SwNodes::UpdateOutlineNode( const SwNode& rNd, BYTE nOldLevel, //#outline level,removed by zhaojianwei -// BYTE nNewLevel ) +//void SwNodes::UpdateOutlineNode( const SwNode& rNd, sal_uInt8 nOldLevel, //#outline level,removed by zhaojianwei +// sal_uInt8 nNewLevel ) //{ // const SwNodePtr pSrch = (SwNodePtr)&rNd; -// USHORT nSttPos; -// BOOL bSeekIdx = pOutlineNds->Seek_Entry( pSrch, &nSttPos ); +// sal_uInt16 nSttPos; +// sal_Bool bSeekIdx = pOutlineNds->Seek_Entry( pSrch, &nSttPos ); // // //if( NO_NUMBERING == nOldLevel ) //#outline level,zhaojianwei // if( 0 == nOldLevel ) //<-end, zhaojianwei @@ -138,7 +138,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) // //ASSERT( !bSeekIdx, "Der Node ist schon als OutlineNode vorhanden" ); // // //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen -// ULONG nNd = rNd.GetIndex(); +// sal_uLong nNd = rNd.GetIndex(); // if( nNd < GetEndOfRedlines().GetIndex() && // nNd > GetEndOfRedlines().StartOfSectionNode()->GetIndex() ) // return ; @@ -207,7 +207,7 @@ void SwNodes::UpdtOutlineIdx( const SwNode& rNd ) return; const SwNodePtr pSrch = (SwNodePtr)&rNd; - USHORT nPos; + sal_uInt16 nPos; pOutlineNds->Seek_Entry( pSrch, &nPos ); if( nPos == pOutlineNds->Count() ) // keine zum Updaten vorhanden ? return; diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 306560272c6f..d61ad4f0b763 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -38,11 +38,13 @@ #include <txtftn.hxx> #include <fmtclds.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <section.hxx> -#include <undobj.hxx> +#include <UndoSection.hxx> +#include <UndoDelete.hxx> #include <swundo.hxx> #include <calc.hxx> #include <swtable.hxx> @@ -58,9 +60,7 @@ #include <node2lay.hxx> #include <doctxm.hxx> #include <fmtftntx.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif // --> OD 2005-12-01 #i27138# #include <viewsh.hxx> #include <txtfrm.hxx> @@ -91,8 +91,8 @@ bool lcl_IsInSameTblBox( SwNodes& _rNds, do { if ( _bPrev - ? !_rNds.GoPrevSection( &aChkIdx, FALSE, FALSE ) - : !_rNds.GoNextSection( &aChkIdx, FALSE, FALSE ) ) + ? !_rNds.GoPrevSection( &aChkIdx, sal_False, sal_False ) + : !_rNds.GoNextSection( &aChkIdx, sal_False, sal_False ) ) { ASSERT( false, "<lcl_IsInSameTblBox(..)> - no previous/next!" ); return false; @@ -122,8 +122,8 @@ bool lcl_IsInSameTblBox( SwNodes& _rNds, // dann suche den StartNode der Box const SwTableSortBoxes& rSortBoxes = pTblNd->GetTable().GetTabSortBoxes(); - ULONG nIdx = _rNd.GetIndex(); - for( USHORT n = 0; n < rSortBoxes.Count(); ++n ) + sal_uLong nIdx = _rNd.GetIndex(); + for( sal_uInt16 n = 0; n < rSortBoxes.Count(); ++n ) { const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd(); if ( pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex() ) @@ -141,14 +141,14 @@ void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSectionData& rSectionData, const SwNode& rStt, const SwNode& rEnd ) { SwNodeIndex aIdx( rStt ); - if( !rNds.GoPrevSection( &aIdx, TRUE, FALSE ) || - !CheckNodesRange( rStt, aIdx, TRUE ) || + if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) || + !CheckNodesRange( rStt, aIdx, sal_True ) || // OD 04.11.2003 #i21457# !lcl_IsInSameTblBox( rNds, rStt, true )) { aIdx = rEnd; - if( !rNds.GoNextSection( &aIdx, TRUE, FALSE ) || - !CheckNodesRange( rEnd, aIdx, TRUE ) || + if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) || + !CheckNodesRange( rEnd, aIdx, sal_True ) || // OD 04.11.2003 #i21457# !lcl_IsInSameTblBox( rNds, rEnd, false )) { @@ -163,7 +163,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, SfxItemSet const*const pAttr, bool const bUpdate) { const SwNode* pPrvNd = 0; - USHORT nRegionRet = 0; + sal_uInt16 nRegionRet = 0; if( rRange.HasMark() && 0 == ( nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd ) )) { @@ -188,12 +188,12 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, } SwUndoInsSection* pUndoInsSect = 0; - if( DoesUndo() ) + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { - ClearRedo(); pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBase); - AppendUndo( pUndoInsSect ); - DoUndo( FALSE ); + GetIDocumentUndoRedo().AppendUndo( pUndoInsSect ); + GetIDocumentUndoRedo().DoUndo(false); } SwSectionFmt* const pFmt = MakeSectionFmt( 0 ); @@ -235,7 +235,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, pSttPos->nNode.GetNode().GetTxtNode(); if (pTNd) { - pUndoInsSect->SaveSplitNode( pTNd, TRUE ); + pUndoInsSect->SaveSplitNode( pTNd, sal_True ); } } @@ -246,7 +246,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, if (pTNd && (pTNd->GetTxt().Len() != pEndPos->nContent.GetIndex())) { - pUndoInsSect->SaveSplitNode( pTNd, FALSE ); + pUndoInsSect->SaveSplitNode( pTNd, sal_False ); } } } @@ -315,7 +315,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, { if( pUndoInsSect && pCNd->IsTxtNode() ) { - pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, TRUE ); + pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, sal_True ); } SplitNode( *pPos, false ); pNewSectNode = GetNodes().InsertTextSection( @@ -355,10 +355,10 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, rNewSect.SetCondHidden( aCalc.Calculate( rNewSect.GetCondition() ).GetBool() ); } - BOOL bUpdateFtn = FALSE; + sal_Bool bUpdateFtn = sal_False; if( GetFtnIdxs().Count() && pAttr ) { - USHORT nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get( + sal_uInt16 nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get( RES_FTN_AT_TXTEND )).GetValue(); if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal || FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ) || @@ -366,7 +366,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, pAttr->Get( RES_END_AT_TXTEND )).GetValue() ) || FTNEND_ATTXTEND_OWNNUMANDFMT == nVal )) { - bUpdateFtn = TRUE; + bUpdateFtn = sal_True; } } @@ -374,7 +374,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, { pUndoInsSect->SetSectNdPos( pNewSectNode->GetIndex() ); pUndoInsSect->SetUpdtFtnFlag( bUpdateFtn ); - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); } if (rNewData.IsLinkType()) @@ -391,10 +391,10 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, return &pNewSectNode->GetSection(); } -USHORT SwDoc::IsInsRegionAvailable( const SwPaM& rRange, +sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange, const SwNode** ppSttNd ) const { - USHORT nRet = 1; + sal_uInt16 nRet = 1; if( rRange.HasMark() ) { // teste ob es sich um eine gueltige Selektion handelt @@ -416,7 +416,7 @@ USHORT SwDoc::IsInsRegionAvailable( const SwPaM& rRange, pCNd->Len() ) { SwNodeIndex aIdx( pStt->nNode, -1 ); - ULONG nCmp = pEnd->nNode.GetIndex(); + sal_uLong nCmp = pEnd->nNode.GetIndex(); const SwStartNode* pPrvNd; const SwEndNode* pNxtNd; while( 0 != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) && @@ -523,42 +523,40 @@ SwSectionFmt* SwDoc::MakeSectionFmt( SwSectionFmt *pDerivedFrom ) return pNew; } -void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) +void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes ) { - USHORT nPos = pSectionFmtTbl->GetPos( pFmt ); + sal_uInt16 nPos = pSectionFmtTbl->GetPos( pFmt ); - StartUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_DELSECTION, NULL); if( USHRT_MAX != nPos ) { - const SwNodeIndex* pIdx = pFmt->GetCntnt( FALSE ).GetCntntIdx(); + const SwNodeIndex* pIdx = pFmt->GetCntnt( sal_False ).GetCntntIdx(); const SfxPoolItem* pFtnEndAtTxtEnd; if( SFX_ITEM_SET != pFmt->GetItemState( - RES_FTN_AT_TXTEND, TRUE, &pFtnEndAtTxtEnd ) || + RES_FTN_AT_TXTEND, sal_True, &pFtnEndAtTxtEnd ) || SFX_ITEM_SET != pFmt->GetItemState( - RES_END_AT_TXTEND, TRUE, &pFtnEndAtTxtEnd )) + RES_END_AT_TXTEND, sal_True, &pFtnEndAtTxtEnd )) pFtnEndAtTxtEnd = 0; const SwSectionNode* pSectNd; - if( DoesUndo() ) + if( GetIDocumentUndoRedo().DoesUndo() ) { - ClearRedo(); if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) { SwNodeIndex aUpdIdx( *pIdx ); - ClearRedo(); SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd ); - AppendUndo( new SwUndoDelete( aPaM )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( aPaM )); if( pFtnEndAtTxtEnd ) GetFtnIdxs().UpdateFtn( aUpdIdx ); SetModified(); //#126178# start/end undo have to be pairs! - EndUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); return ; } - AppendUndo( MakeUndoDelSection( *pFmt ) ); + GetIDocumentUndoRedo().AppendUndo( MakeUndoDelSection( *pFmt ) ); } else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) @@ -569,7 +567,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) GetFtnIdxs().UpdateFtn( aUpdIdx ); SetModified(); //#126178# start/end undo have to be pairs! - EndUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); return ; } @@ -587,7 +585,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) // zu loeschen! pSectionFmtTbl->Remove( nPos ); //FEATURE::CONDCOLL - ULONG nCnt = 0, nSttNd = 0; + sal_uLong nCnt = 0, nSttNd = 0; if( pIdx && &GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) { @@ -613,7 +611,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) //FEATURE::CONDCOLL } - EndUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); SetModified(); } @@ -630,16 +628,16 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, if (pSection->DataEquals(rNewData)) { // die Attribute ueberpruefen - BOOL bOnlyAttrChg = FALSE; + sal_Bool bOnlyAttrChg = sal_False; if( pAttr && pAttr->Count() ) { SfxItemIter aIter( *pAttr ); - USHORT nWhich = aIter.GetCurItem()->Which(); - while( TRUE ) + sal_uInt16 nWhich = aIter.GetCurItem()->Which(); + while( sal_True ) { if( pFmt->GetFmtAttr( nWhich ) != *aIter.GetCurItem() ) { - bOnlyAttrChg = TRUE; + bOnlyAttrChg = sal_True; break; } @@ -651,23 +649,17 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, if( bOnlyAttrChg ) { - const BOOL bDoesUndo = DoesUndo(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( MakeUndoUpdateSection( *pFmt, true ) ); - // --> FME 2004-10-13 #i32968# - // Inserting columns in the section causes MakeFrmFmt to put two - // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); - // <-- + GetIDocumentUndoRedo().AppendUndo( + MakeUndoUpdateSection( *pFmt, true ) ); } + // #i32968# Inserting columns in the section causes MakeFrmFmt + // to put two objects of type SwUndoFrmFmt on the undo stack. + // We don't want them. + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); pFmt->SetFmtAttr( *pAttr ); SetModified(); - - // --> FME 2004-10-13 #i32968# - DoUndo( bDoesUndo ); - // <-- } return; } @@ -692,17 +684,13 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, } } - const BOOL bDoesUndo = DoesUndo(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( MakeUndoUpdateSection( *pFmt, false ) ); - // --> FME 2004-10-13 #i32968# - // Inserting columns in the section causes MakeFrmFmt to put two - // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); - // <-- + GetIDocumentUndoRedo().AppendUndo(MakeUndoUpdateSection(*pFmt, false)); } + // #i32968# Inserting columns in the section causes MakeFrmFmt to put two + // objects of type SwUndoFrmFmt on the undo stack. We don't want them. + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); // #56167# Der LinkFileName koennte auch nur aus Separatoren bestehen String sCompareString = sfx2::cTokenSeperator; @@ -720,9 +708,9 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, sSectName.Erase(); /// OD 04.10.2002 #102894# - NOTE - /// In SwSection::operator=(..) class member bCondHiddenFlag is always set to TRUE. + /// In SwSection::operator=(..) class member bCondHiddenFlag is always set to sal_True. /// IMHO this have to be changed, but I can't estimate the consequences: - /// Either it is set to TRUE using corresponding method <SwSection.SetCondHidden(..)>, + /// Either it is set to sal_True using corresponding method <SwSection.SetCondHidden(..)>, /// or it is set to the value of SwSection which is assigned to it. /// Discussion with AMA results that the adjustment to the assignment operator /// could be very risky -> see notes in bug #102894#. @@ -747,9 +735,9 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, /// OD 04.10.2002 #102894# /// Because on using SwSection::operator=() to set up <pSection> /// with <rNewData> and the above given note, the hidden condition flag - /// has to be set to FALSE, if hidden condition flag of <pFmt->GetSection()> - /// (SwSection before the changes) is FALSE (already saved in <bOldCondHidden>) - /// and new calculated condition is TRUE. + /// has to be set to sal_False, if hidden condition flag of <pFmt->GetSection()> + /// (SwSection before the changes) is sal_False (already saved in <bOldCondHidden>) + /// and new calculated condition is sal_True. /// This is necessary, because otherwise the <SetCondHidden> would have /// no effect. bool bCalculatedCondHidden = @@ -770,10 +758,6 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, } SetModified(); - - // --> FME 2004-10-13 #i32968# - DoUndo( bDoesUndo ); - // <-- } /* -----------------19.02.99 09:31------------------- @@ -786,12 +770,12 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, * --------------------------------------------------*/ // und dann waren da noch die Fussnoten: -void lcl_DeleteFtn( SwSectionNode *pNd, ULONG nStt, ULONG nEnd ) +void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd ) { SwFtnIdxs& rFtnArr = pNd->GetDoc()->GetFtnIdxs(); if( rFtnArr.Count() ) { - USHORT nPos; + sal_uInt16 nPos; rFtnArr.SeekEntry( SwNodeIndex( *pNd ), &nPos ); SwTxtFtn* pSrch; @@ -879,7 +863,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, // aInsPos is at the moment the Position where my EndNode will be inserted const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode(); // This StartNode should be in front of me, but if not, I wanna survive - ULONG nMyIndex = pSectNd->GetIndex(); + sal_uLong nMyIndex = pSectNd->GetIndex(); if( pStartNode->GetIndex() > nMyIndex ) // Suspicious! { const SwNode* pTemp; @@ -936,7 +920,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, // Hier bietet sich als Optimierung an, vorhandene Frames nicht zu // zerstoeren und wieder neu anzulegen, sondern nur umzuhaengen. - BOOL bInsFrm = bCreateFrms && !pSectNd->GetSection().IsHidden() && + sal_Bool bInsFrm = bCreateFrms && !pSectNd->GetSection().IsHidden() && GetDoc()->GetRootFrm(); SwNode2Layout *pNode2Layout = NULL; if( bInsFrm ) @@ -948,10 +932,10 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, } // jetzt noch bei allen im Bereich den richtigen StartNode setzen - ULONG nEnde = pSectNd->EndOfSectionIndex(); - ULONG nStart = pSectNd->GetIndex()+1; - ULONG nSkipIdx = ULONG_MAX; - for( ULONG n = nStart; n < nEnde; ++n ) + sal_uLong nEnde = pSectNd->EndOfSectionIndex(); + sal_uLong nStart = pSectNd->GetIndex()+1; + sal_uLong nSkipIdx = ULONG_MAX; + for( sal_uLong n = nStart; n < nEnde; ++n ) { SwNode* pNd = (*this)[n]; @@ -991,7 +975,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, { if( pNode2Layout ) { - ULONG nIdx = pSectNd->GetIndex(); + sal_uLong nIdx = pSectNd->GetIndex(); pNode2Layout->RestoreUpperFrms( pSectNd->GetNodes(), nIdx, nIdx + 1 ); delete pNode2Layout; } @@ -1090,14 +1074,13 @@ SwSectionNode::~SwSectionNode() if ( pLast->IsA( TYPE(SwFrm) ) ) { SwSectionFrm *pSectFrm = (SwSectionFrm*)pLast; - SwSectionFrm::MoveCntntAndDelete( pSectFrm, TRUE ); + SwSectionFrm::MoveCntntAndDelete( pSectFrm, sal_True ); pLast = aIter.GoStart(); } else pLast = aIter++; } } - SwDoc* pDoc = GetDoc(); SwSectionFmt* pFmt = m_pSection->GetFmt(); if( pFmt ) @@ -1108,12 +1091,6 @@ SwSectionNode::~SwSectionNode() pFmt->ResetFmtAttr( RES_CNTNT ); pFmt->UnlockModify(); } - - BOOL bUndo = pDoc->DoesUndo(); - // verhinder beim Loeschen aus der Undo/Redo-History einen rekursiven Aufruf - if( bUndo && &pDoc->GetNodes() != &GetNodes() ) - pDoc->DoUndo( FALSE ); - pDoc->DoUndo( bUndo ); } @@ -1135,14 +1112,14 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx ) if( GetSection().IsHidden() || IsCntntHidden() ) { SwNodeIndex aIdx( *EndOfSectionNode() ); - SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, TRUE, FALSE ); + SwCntntNode* pCNd = rNds.GoNextSection( &aIdx, sal_True, sal_False ); if( !pCNd ) { aIdx = *this; - if( 0 == ( pCNd = rNds.GoPrevSection( &aIdx, TRUE, FALSE )) ) + if( 0 == ( pCNd = rNds.GoPrevSection( &aIdx, sal_True, sal_False )) ) return ; } - pCNd = rNds[ aIdx ]->GetCntntNode(); + pCNd = aIdx.GetNode().GetCntntNode(); pCNd->MakeFrms( (SwCntntNode&)rIdx.GetNode() ); } else @@ -1262,11 +1239,11 @@ void SwSectionNode::MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx ) void SwSectionNode::DelFrms() { - ULONG nStt = GetIndex()+1, nEnd = EndOfSectionIndex(); + sal_uLong nStt = GetIndex()+1, nEnd = EndOfSectionIndex(); if( nStt >= nEnd ) { // unser Flag muessen wir noch aktualisieren - // pSection->bHiddenFlag = TRUE; + // pSection->bHiddenFlag = sal_True; return ; } @@ -1282,14 +1259,14 @@ void SwSectionNode::DelFrms() // Fly/TblBox-Frame keinen Lower !!! { SwNodeIndex aIdx( *this ); - if( !rNds.GoPrevSection( &aIdx, TRUE, FALSE ) || - !CheckNodesRange( *this, aIdx, TRUE ) || + if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) || + !CheckNodesRange( *this, aIdx, sal_True ) || // OD 04.11.2003 #i21457# !lcl_IsInSameTblBox( rNds, *this, true )) { aIdx = *EndOfSectionNode(); - if( !rNds.GoNextSection( &aIdx, TRUE, FALSE ) || - !CheckNodesRange( *EndOfSectionNode(), aIdx, TRUE ) || + if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) || + !CheckNodesRange( *EndOfSectionNode(), aIdx, sal_True ) || // OD 04.11.2003 #i21457# !lcl_IsInSameTblBox( rNds, *EndOfSectionNode(), false )) { @@ -1344,16 +1321,16 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c pNewSect->SetCondition( GetSection().GetCondition() ); pNewSect->SetLinkFileName( GetSection().GetLinkFileName() ); if( !pNewSect->IsHiddenFlag() && GetSection().IsHidden() ) - pNewSect->SetHidden( TRUE ); + pNewSect->SetHidden( sal_True ); if( !pNewSect->IsProtectFlag() && GetSection().IsProtect() ) - pNewSect->SetProtect( TRUE ); + pNewSect->SetProtect( sal_True ); // --> FME 2004-06-22 #114856# edit in readonly sections if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() ) - pNewSect->SetEditInReadonly( TRUE ); + pNewSect->SetEditInReadonly( sal_True ); // <-- SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // (wo stehe in denn nun ??) - rNds._Copy( aRg, aInsPos, FALSE ); + rNds._Copy( aRg, aInsPos, sal_False ); // loesche alle Frames vom kopierten Bereich, diese werden beim // erzeugen des SectionFrames angelegt ! @@ -1365,7 +1342,8 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c : CREATE_NONE ); // falls als Server aus dem Undo kopiert wird, wieder eintragen - if (m_pSection->IsServer() && (pDoc->GetUndoNds() == &rNds)) + if (m_pSection->IsServer() + && pDoc->GetIDocumentUndoRedo().IsUndoNodes(rNds)) { pNewSect->SetRefObject( m_pSection->GetObject() ); pDoc->GetLinkManager().InsertServer( pNewSect->GetObject() ); @@ -1377,12 +1355,12 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c return pSectNd; } -BOOL SwSectionNode::IsCntntHidden() const +sal_Bool SwSectionNode::IsCntntHidden() const { ASSERT( !m_pSection->IsHidden(), "That's simple: Hidden Section => Hidden Content" ); SwNodeIndex aTmp( *this, 1 ); - ULONG nEnd = EndOfSectionIndex(); + sal_uLong nEnd = EndOfSectionIndex(); while( aTmp < nEnd ) { if( aTmp.GetNode().IsSectionNode() ) @@ -1395,12 +1373,12 @@ BOOL SwSectionNode::IsCntntHidden() const else { if( aTmp.GetNode().IsCntntNode() || aTmp.GetNode().IsTableNode() ) - return FALSE; // Nicht versteckter Inhalt wurde gefunden + return sal_False; // Nicht versteckter Inhalt wurde gefunden ASSERT( aTmp.GetNode().IsEndNode(), "EndNode expected" ); } aTmp++; } - return TRUE; // Alles versteckt + return sal_True; // Alles versteckt } @@ -1428,8 +1406,8 @@ void SwSectionNode::NodesArrChgd() : pDoc->GetDfltFrmFmt() ); // jetzt noch bei allen im Bereich den richtigen StartNode setzen - ULONG nStart = GetIndex()+1, nEnde = EndOfSectionIndex(); - for( ULONG n = nStart; n < nEnde; ++n ) + sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex(); + for( sal_uLong n = nStart; n < nEnde; ++n ) // die Verschachtelung der Formate herstellen! if( 0 != ( pSectNd = rNds[ n ]->GetSectionNode() ) ) { @@ -1475,22 +1453,22 @@ String SwDoc::GetUniqueSectionName( const String* pChkStr ) const String aName( aId ); xub_StrLen nNmLen = aName.Len(); - USHORT nNum = 0; - USHORT nTmp, nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2; - BYTE* pSetFlags = new BYTE[ nFlagSize ]; + sal_uInt16 nNum = 0; + sal_uInt16 nTmp, nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2; + sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ]; memset( pSetFlags, 0, nFlagSize ); const SwSectionNode* pSectNd; - USHORT n; + sal_uInt16 n; for( n = 0; n < pSectionFmtTbl->Count(); ++n ) - if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( FALSE ) )) + if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( sal_False ) )) { const String& rNm = pSectNd->GetSection().GetSectionName(); if( rNm.Match( aName ) == nNmLen ) { // Nummer bestimmen und das Flag setzen - nNum = static_cast<USHORT>(rNm.Copy( nNmLen ).ToInt32()); + nNum = static_cast<sal_uInt16>(rNm.Copy( nNmLen ).ToInt32()); if( nNum-- && nNum < pSectionFmtTbl->Count() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 588ef88f7740..29ecd0ef79f4 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1,3 +1,4 @@ + /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,6 @@ #include <com/sun/star/chart2/XChartDocument.hpp> -#ifdef WTC -#define private public -#endif #include <hintids.hxx> #include <editeng/lrspitem.hxx> @@ -53,6 +51,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> @@ -64,7 +64,11 @@ #include <fldbas.hxx> #include <poolfmt.hxx> #include <tabfrm.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoRedline.hxx> +#include <UndoDelete.hxx> +#include <UndoTable.hxx> +#include <hints.hxx> #include <tblafmt.hxx> #include <swcache.hxx> #include <ddefld.hxx> @@ -83,9 +87,7 @@ #include <section.hxx> #include <frmtool.hxx> #include <node2lay.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include "docsh.hxx" #include <tabcol.hxx> #include <unochart.hxx> @@ -122,14 +124,14 @@ const sal_Unicode T2T_PARA = 0x0a; extern void ClearFEShellTabCols(); // steht im gctable.cxx -extern BOOL lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); +extern sal_Bool lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); #ifdef DEL_TABLE_REDLINES class lcl_DelRedlines { SwDoc* pDoc; public: - lcl_DelRedlines( const SwTableNode& rNd, BOOL bCheckForOwnRedline ); + lcl_DelRedlines( const SwTableNode& rNd, sal_Bool bCheckForOwnRedline ); lcl_DelRedlines( SwPaM& rPam ); ~lcl_DelRedlines() { pDoc->EndUndo(UNDO_EMPTY, NULL); } @@ -137,24 +139,24 @@ public: lcl_DelRedlines::lcl_DelRedlines( SwPaM & rPam) : pDoc( rPam.GetDoc() ) { - pDoc->StartUndo(UNDO_EMPTY, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) pDoc->AcceptRedline( rPam, true ); } #endif -void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, BYTE nId ) +void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, sal_uInt8 nId ) { - BOOL bTop = FALSE, bBottom = FALSE, bLeft = FALSE, bRight = FALSE; + sal_Bool bTop = sal_False, bBottom = sal_False, bLeft = sal_False, bRight = sal_False; switch ( nId ) { - case 0: bTop = bBottom = bLeft = TRUE; break; - case 1: bTop = bBottom = bLeft = bRight = TRUE; break; - case 2: bBottom = bLeft = TRUE; break; - case 3: bBottom = bLeft = bRight = TRUE; break; + case 0: bTop = bBottom = bLeft = sal_True; break; + case 1: bTop = bBottom = bLeft = bRight = sal_True; break; + case 2: bBottom = bLeft = sal_True; break; + case 3: bBottom = bLeft = bRight = sal_True; break; } - const BOOL bHTML = rFmt.getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE); + const sal_Bool bHTML = rFmt.getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE); Color aCol( bHTML ? COL_GRAY : COL_BLACK ); SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 ); if ( bHTML ) @@ -175,7 +177,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 ]; @@ -187,7 +189,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 ); @@ -204,7 +206,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 ); @@ -217,7 +219,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] ) { @@ -233,14 +235,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 )); @@ -252,7 +254,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() ) ) @@ -268,20 +270,20 @@ SwTableNode* SwDoc::IsIdxInTbl(const SwNodeIndex& rIdx) // fuege in der Line, vor der InsPos eine neue Box ein. -BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, +sal_Bool SwNodes::InsBoxen( SwTableNode* pTblNd, SwTableLine* pLine, SwTableBoxFmt* pBoxFmt, SwTxtFmtColl* pTxtColl, const SfxItemSet* pAutoAttr, - USHORT nInsPos, - USHORT nCnt ) + sal_uInt16 nInsPos, + sal_uInt16 nCnt ) { if( !nCnt ) - return FALSE; + return sal_False; ASSERT( pLine, "keine gueltige Zeile" ); // Index hinter die letzte Box der Line - ULONG nIdxPos = 0; + sal_uLong nIdxPos = 0; SwTableBox *pPrvBox = 0, *pNxtBox = 0; if( pLine->GetTabBoxes().Count() ) { @@ -300,7 +302,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; @@ -313,7 +315,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 ) @@ -326,7 +328,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 ); @@ -336,7 +338,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(); @@ -360,18 +362,18 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, pTNd->ChgFmtColl( pTxtColl ); } } - return TRUE; + return sal_True; } // --------------- einfuegen einer neuen Tabelle -------------- const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, - const SwPosition& rPos, USHORT nRows, - USHORT nCols, sal_Int16 eAdjust, + const SwPosition& rPos, sal_uInt16 nRows, + sal_uInt16 nCols, sal_Int16 eAdjust, const SwTableAutoFmt* pTAFmt, const SvUShorts* pColArr, - BOOL bCalledFromShell, - BOOL bNewModel ) + sal_Bool bCalledFromShell, + sal_Bool bNewModel ) { ASSERT( nRows, "Tabelle ohne Zeile?" ); ASSERT( nCols, "Tabelle ohne Spalten?" ); @@ -390,10 +392,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)); } @@ -403,12 +405,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; @@ -440,7 +442,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 ); @@ -456,12 +458,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; @@ -473,7 +475,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 ] @@ -482,14 +484,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 ); @@ -512,8 +514,8 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, } else { - const USHORT nBoxArrLen = pTAFmt ? 16 : 4; - for( USHORT i = 0; i < nBoxArrLen; ++i ) + const sal_uInt16 nBoxArrLen = pTAFmt ? 16 : 4; + for( sal_uInt16 i = 0; i < nBoxArrLen; ++i ) aBoxFmtArr.Insert( (void*)0, i ); } // --> OD 2008-02-25 #refactorlists# @@ -523,19 +525,19 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, SwNodeIndex aNdIdx( *pTblNd, 1 ); // auf den ersten Box-StartNode SwTableLines& rLines = pNdTbl->GetTabLines(); - for( USHORT n = 0; n < nRows; ++n ) + for( sal_uInt16 n = 0; n < nRows; ++n ) { SwTableLine* pLine = new SwTableLine( pLineFmt, nCols, 0 ); rLines.C40_INSERT( SwTableLine, pLine, n ); SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( USHORT i = 0; i < nCols; ++i ) + for( sal_uInt16 i = 0; i < nCols; ++i ) { SwTableBoxFmt *pBoxF; if( pTAFmt ) { - BYTE nId = static_cast<BYTE>(!n ? 0 : (( n+1 == nRows ) + sal_uInt8 nId = static_cast<sal_uInt8>(!n ? 0 : (( n+1 == nRows ) ? 12 : (4 * (1 + ((n-1) & 1 ))))); - nId = nId + static_cast<BYTE>( !i ? 0 : + nId = nId + static_cast<sal_uInt8>( !i ? 0 : ( i+1 == nCols ? 3 : (1 + ((i-1) & 1)))); pBoxF = ::lcl_CreateAFmtBoxFmt( *this, aBoxFmtArr, *pTAFmt, nCols, nId ); @@ -553,7 +555,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 @@ -564,7 +566,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! @@ -601,10 +603,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) { @@ -623,9 +625,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 ); @@ -638,17 +640,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; } @@ -674,7 +676,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; @@ -692,15 +694,15 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, #endif SwUndoTxtToTbl* pUndo = 0; - if( DoesUndo() ) + if( GetIDocumentUndoRedo().DoesUndo() ) { - StartUndo( UNDO_TEXTTOTABLE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE, NULL ); pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, - static_cast<USHORT>(eAdjust), pTAFmt ); - AppendUndo( pUndo ); + static_cast<sal_uInt16>(eAdjust), pTAFmt ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); // das Splitten vom TextNode nicht in die Undohistory aufnehmen - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo( false ); } ::PaMCorrAbs( aOriginal, *pEnd ); @@ -710,7 +712,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 ) { @@ -732,14 +734,14 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() ) { - ASSERT( FALSE, "Kein Bereich" ); + ASSERT( sal_False, "Kein Bereich" ); aRg.aEnd++; } // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen: SwNode2Layout aNode2Layout( aRg.aStart.GetNode() ); - DoUndo( 0 != pUndo ); + GetIDocumentUndoRedo().DoUndo( 0 != pUndo ); // dann erstelle die Box/Line/Table-Struktur SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt(); @@ -751,7 +753,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, // die Tabelle bekommt USHRT_MAX als default SSize pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX )); if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) ) - pTableFmt->SetFmtAttr( SwFmtLayoutSplit( FALSE )); + pTableFmt->SetFmtAttr( SwFmtLayoutSplit( sal_False )); /* #106283# If the first node in the selection is a context node and if it has an item FRAMEDIR set (no default) propagate the item to the @@ -761,7 +763,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 ); @@ -775,18 +777,18 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, SwTable * pNdTbl = &pTblNd->GetTable(); ASSERT( pNdTbl, "kein Tabellen-Node angelegt." ) - const USHORT nRowsToRepeat = + const sal_uInt16 nRowsToRepeat = tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ? rInsTblOpts.mnRowsToRepeat : 0; pNdTbl->SetRowsToRepeat( nRowsToRepeat ); - BOOL bUseBoxFmt = FALSE; + sal_Bool bUseBoxFmt = sal_False; if( !pBoxFmt->GetDepends() ) { // die Formate an den Boxen haben schon die richtige Size, es darf // also nur noch die richtige Umrandung/AutoFmt gesetzt werden. - bUseBoxFmt = TRUE; + bUseBoxFmt = sal_True; pTableFmt->SetFmtAttr( pBoxFmt->GetFrmSize() ); delete pBoxFmt; eAdjust = text::HoriOrientation::NONE; @@ -798,10 +800,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 ); } @@ -813,21 +815,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 ); @@ -846,8 +848,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(); @@ -867,7 +869,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 @@ -889,7 +891,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; @@ -900,11 +902,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 ); { @@ -916,7 +918,9 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, } if( pUndo ) - EndUndo( UNDO_TEXTTOTABLE, NULL ); + { + GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, NULL ); + } SetModified(); SetFieldsDirty(true, NULL, 0); @@ -941,7 +945,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 ); @@ -966,14 +970,14 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, { if( *pTxt == cCh ) { - aPosArr.Insert( static_cast<USHORT>( - aFInfo.GetCharPos( nChPos+1, FALSE )), + aPosArr.Insert( static_cast<sal_uInt16>( + aFInfo.GetCharPos( nChPos+1, sal_False )), aPosArr.Count() ); } } aPosArr.Insert( /*aFInfo.GetFrm()->Frm().Left() +*/ - static_cast<USHORT>(aFInfo.GetFrm()->IsVertical() ? + static_cast<sal_uInt16>(aFInfo.GetFrm()->IsVertical() ? aFInfo.GetFrm()->Prt().Bottom() : aFInfo.GetFrm()->Prt().Right()), aPosArr.Count() ); @@ -991,7 +995,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, // erfolgen, denn sonst stehen sie falsch in der History !!! // SwRegHistory aRegH( pTxtNd, *pTxtNd, pHistory ); const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE, &pItem ) ) + if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pItem ) ) { if( !nLines ) pTblFmt->SetFmtAttr( *pItem ); @@ -1000,7 +1004,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 ) @@ -1071,7 +1075,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 ) { @@ -1082,7 +1086,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 @@ -1095,13 +1099,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 ] ); @@ -1146,15 +1150,16 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > lcl_DelRedlines aDelRedl( aOriginal ); #endif - SwUndoTxtToTbl* pUndo = 0; - if( DoesUndo() ) +// SwUndoTxtToTbl* pUndo = 0; + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { -// StartUndo( UNDO_TEXTTOTABLE ); +// GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE ); // pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, eAdjust, pTAFmt ); -// AppendUndo( pUndo ); +// GetIDocumentUndoRedo().AppendUndo(pUndo); // das Splitten vom TextNode nicht in die Undohistory aufnehmen - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } ::PaMCorrAbs( aOriginal, *pEnd ); @@ -1164,7 +1169,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > if( pStt->nContent.GetIndex() ) SplitNode( *pStt, false ); - BOOL bEndCntnt = 0 != pEnd->nContent.GetIndex(); + sal_Bool bEndCntnt = 0 != pEnd->nContent.GetIndex(); // nicht splitten am Ende der Zeile (aber am Ende vom Doc!!) if( bEndCntnt ) { @@ -1186,14 +1191,14 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > if( aRg.aEnd.GetIndex() == aRg.aStart.GetIndex() ) { - ASSERT( FALSE, "Kein Bereich" ); + ASSERT( sal_False, "Kein Bereich" ); aRg.aEnd++; } // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen: SwNode2Layout aNode2Layout( aRg.aStart.GetNode() ); - DoUndo( 0 != pUndo ); + GetIDocumentUndoRedo().DoUndo(bUndo); // dann erstelle die Box/Line/Table-Struktur SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt(); @@ -1205,7 +1210,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > // die Tabelle bekommt USHRT_MAX als default SSize pTableFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX )); // if( !(rInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT) ) -// pTableFmt->SetAttr( SwFmtLayoutSplit( FALSE )); +// pTableFmt->SetAttr( SwFmtLayoutSplit( sal_False )); /* #106283# If the first node in the selection is a context node and if it has an item FRAMEDIR set (no default) propagate the item to the @@ -1215,7 +1220,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 ); @@ -1230,18 +1235,18 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > ASSERT( pNdTbl, "kein Tabellen-Node angelegt." ) pTableFmt->Add( pNdTbl ); // das Frame-Format setzen -// 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 = HORI_NONE; @@ -1252,7 +1257,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > // pTableFmt->Add( pNdTbl ); // das Frame-Format setzen - ULONG nIdx = pTblNd->GetIndex(); + sal_uLong nIdx = pTblNd->GetIndex(); aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 ); { @@ -1264,7 +1269,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > } // if( pUndo ) -// EndUndo( UNDO_TEXTTOTABLE ); +// GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE ); SetModified(); SetFieldsDirty( true, NULL, 0 ); @@ -1368,7 +1373,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, SwTable * pTable = &pTblNd->GetTable(); SwTableLine* pLine; SwTableBox* pBox; - USHORT nBoxes, nLines, nMaxBoxes = 0; + sal_uInt16 nBoxes, nLines, nMaxBoxes = 0; // SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0; @@ -1396,7 +1401,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, // erfolgen, denn sonst stehen sie falsch in der History !!! // SwRegHistory aRegH( pTxtNd, *pTxtNd, pHistory ); const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE, &pItem ) ) + if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False, &pItem ) ) { if( !nLines ) pTblFmt->SetFmtAttr( *pItem ); @@ -1405,7 +1410,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 ) @@ -1475,18 +1480,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 ] ); @@ -1510,10 +1515,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 @@ -1524,15 +1529,15 @@ BOOL SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) // <-- #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, FALSE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_False ); #endif SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode() ); SwUndoTblToTxt* pUndo = 0; SwNodeRange* pUndoRg = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoRg = new SwNodeRange( aRg.aStart, -1, aRg.aEnd, +1 ); pUndo = new SwUndoTblToTxt( pTblNd->GetTable(), cCh ); } @@ -1541,13 +1546,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; } @@ -1575,9 +1580,9 @@ struct _DelTabPara // forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen // koennen. -BOOL lcl_DelBox( const SwTableBox*&, void *pPara ); +sal_Bool lcl_DelBox( const SwTableBox*&, void *pPara ); -BOOL lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) { ASSERT( pPara, "die Parameter fehlen" ); _DelTabPara aPara( *(_DelTabPara*)pPara ); @@ -1585,11 +1590,11 @@ BOOL lcl_DelLine( const SwTableLine*& rpLine, void* pPara ) if( rpLine->GetUpper() ) // gibt es noch eine uebergeordnete Box ?? // dann gebe den letzten TextNode zurueck ((_DelTabPara*)pPara)->pLastNd = aPara.pLastNd; - return TRUE; + return sal_True; } -BOOL lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_DelBox( const SwTableBox*& rpBox, void* pPara ) { ASSERT( pPara, "die Parameter fehlen" ); @@ -1609,7 +1614,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() ) { @@ -1649,19 +1654,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 @@ -1690,9 +1695,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 ) @@ -1708,7 +1713,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, @@ -1748,7 +1753,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(); @@ -1763,73 +1768,75 @@ BOOL SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh, } } - return TRUE; + return sal_True; } // ----- einfuegen von Spalten/Zeilen ------------------------ -BOOL SwDoc::InsertCol( const SwCursor& rCursor, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertCol( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bBehind ) { if( !::CheckSplitCells( rCursor, nCnt + 1, nsSwTblSearchType::TBLSEARCH_COL ) ) - return FALSE; + return sal_False; // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; ::GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_COL ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( aBoxes.Count() ) bRet = InsertCol( aBoxes, nCnt, bBehind ); return bRet; } -BOOL SwDoc::InsertCol( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; SwTable& rTbl = pTblNd->GetTable(); if( rTbl.ISA( SwDDETable )) - return FALSE; + return sal_False; #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - DoUndo( FALSE ); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSCOL, rBoxes, *pTblNd, - 0, 0, nCnt, bBehind, FALSE ); + 0, 0, nCnt, bBehind, sal_False ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); } - SwTableFmlUpdate aMsgHnt( &rTbl ); - aMsgHnt.eFlags = TBL_BOXPTR; - UpdateTblFlds( &aMsgHnt ); - - BOOL bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind ); - if( bRet ) + bool bRet(false); { - SetModified(); - ::ClearFEShellTabCols(); - SetFieldsDirty( true, NULL, 0 ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + + SwTableFmlUpdate aMsgHnt( &rTbl ); + aMsgHnt.eFlags = TBL_BOXPTR; + UpdateTblFlds( &aMsgHnt ); + + bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind ); + if (bRet) + { + SetModified(); + ::ClearFEShellTabCols(); + SetFieldsDirty( true, NULL, 0 ); + } } if( pUndo ) { - DoUndo( TRUE ); if( bRet ) { - ClearRedo(); pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -1837,64 +1844,66 @@ BOOL SwDoc::InsertCol( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) return bRet; } -BOOL SwDoc::InsertRow( const SwCursor& rCursor, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertRow( const SwCursor& rCursor, sal_uInt16 nCnt, sal_Bool bBehind ) { // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; GetTblSel( rCursor, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( aBoxes.Count() ) bRet = InsertRow( aBoxes, nCnt, bBehind ); return bRet; } -BOOL SwDoc::InsertRow( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) +sal_Bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; SwTable& rTbl = pTblNd->GetTable(); if( rTbl.ISA( SwDDETable )) - return FALSE; + return sal_False; #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - DoUndo( FALSE ); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSROW,rBoxes, *pTblNd, - 0, 0, nCnt, bBehind, FALSE ); + 0, 0, nCnt, bBehind, sal_False ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); } - SwTableFmlUpdate aMsgHnt( &rTbl ); - aMsgHnt.eFlags = TBL_BOXPTR; - UpdateTblFlds( &aMsgHnt ); - - BOOL bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind ); - if( bRet ) + bool bRet(false); { - SetModified(); - ::ClearFEShellTabCols(); - SetFieldsDirty( true, NULL, 0 ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + + SwTableFmlUpdate aMsgHnt( &rTbl ); + aMsgHnt.eFlags = TBL_BOXPTR; + UpdateTblFlds( &aMsgHnt ); + + bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind ); + if (bRet) + { + SetModified(); + ::ClearFEShellTabCols(); + SetFieldsDirty( true, NULL, 0 ); + } } if( pUndo ) { - DoUndo( TRUE ); if( bRet ) { - ClearRedo(); pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -1905,13 +1914,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: @@ -1922,7 +1931,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 ); @@ -1932,7 +1941,7 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; SwEditShell* pESh = GetEditShell(); if( pESh ) @@ -1962,7 +1971,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 ); @@ -1974,13 +1983,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 @@ -2004,20 +2013,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 @@ -2030,26 +2039,26 @@ BOOL SwDoc::DeleteCol( const SwCursor& rCursor ) } // dann loesche doch die Spalten - StartUndo(UNDO_COL_DELETE, NULL); - BOOL bResult = DeleteRowCol( aBoxes, true ); - EndUndo(UNDO_COL_DELETE, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_COL_DELETE, NULL); + sal_Bool bResult = DeleteRowCol( aBoxes, true ); + GetIDocumentUndoRedo().EndUndo(UNDO_COL_DELETE, NULL); return bResult; } -BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) +sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) { if( ::HasProtectedCells( rBoxes )) - return FALSE; + return sal_False; // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; if( pTblNd->GetTable().ISA( SwDDETable )) - return FALSE; + return sal_False; ::ClearFEShellTabCols(); SwSelBoxes aSelBoxes; @@ -2066,25 +2075,25 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) } #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif // soll die gesamte Tabelle geloescht werden ?? - const ULONG nTmpIdx1 = pTblNd->GetIndex(); - const ULONG nTmpIdx2 = aSelBoxes[ aSelBoxes.Count()-1 ]->GetSttNd()-> + const sal_uLong nTmpIdx1 = pTblNd->GetIndex(); + const sal_uLong nTmpIdx2 = aSelBoxes[ aSelBoxes.Count()-1 ]->GetSttNd()-> EndOfSectionIndex()+1; if( pTblNd->GetTable().GetTabSortBoxes().Count() == aSelBoxes.Count() && aSelBoxes[0]->GetSttIdx()-1 == nTmpIdx1 && nTmpIdx2 == pTblNd->EndOfSectionIndex() ) { - BOOL bNewTxtNd = FALSE; + sal_Bool bNewTxtNd = sal_False; // steht diese auch noch alleine in einem FlyFrame ? SwNodeIndex aIdx( *pTblNd, -1 ); const SwStartNode* pSttNd = aIdx.GetNode().GetStartNode(); if( pSttNd ) { - const ULONG nTblEnd = pTblNd->EndOfSectionIndex() + 1; - const ULONG nSectEnd = pSttNd->EndOfSectionIndex(); + const sal_uLong nTblEnd = pTblNd->EndOfSectionIndex() + 1; + const sal_uLong nSectEnd = pSttNd->EndOfSectionIndex(); if( nTblEnd == nSectEnd ) { if( SwFlyStartNode == pSttNd->GetStartNodeType() ) @@ -2094,22 +2103,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 ) @@ -2132,8 +2141,8 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) } // harte SeitenUmbrueche am nachfolgenden Node verschieben - BOOL bSavePageBreak = FALSE, bSavePageDesc = FALSE; - ULONG nNextNd = pTblNd->EndOfSectionIndex()+1; + sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False; + sal_uLong nNextNd = pTblNd->EndOfSectionIndex()+1; SwCntntNode* pNextNd = GetNodes()[ nNextNd ]->GetCntntNode(); if( pNextNd ) { @@ -2146,17 +2155,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; } } } @@ -2165,7 +2174,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 { @@ -2195,11 +2204,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 ); } @@ -2208,43 +2217,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() ) - { - 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 ) + bool bRet(false); { - 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; @@ -2256,37 +2267,35 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) // ---------- teilen / zusammenfassen von Boxen in der Tabelle -------- -BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt, +sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 nCnt, sal_Bool bSameHeight ) { // uebers SwDoc fuer Undo !! ASSERT( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; SwTable& rTbl = pTblNd->GetTable(); if( rTbl.ISA( SwDDETable )) - return FALSE; + return sal_False; #ifdef DEL_TABLE_REDLINES - lcl_DelRedlines aDelRedl( *pTblNd, TRUE ); + lcl_DelRedlines aDelRedl( *pTblNd, sal_True ); #endif SvULongs aNdsCnts; SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - BOOL bDoUndo = DoesUndo(); - if( bDoUndo ) + if (GetIDocumentUndoRedo().DoesUndo()) { - DoUndo( FALSE ); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_SPLIT, rBoxes, *pTblNd, 0, 0, nCnt, bVert, bSameHeight ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); if( !bVert ) { - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { const SwStartNode* pSttNd = rBoxes[ n ]->GetSttNd(); aNdsCnts.Insert( pSttNd->EndOfSectionIndex() - @@ -2295,33 +2304,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; @@ -2331,7 +2342,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(); @@ -2340,7 +2351,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 ); @@ -2350,7 +2361,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) } // --> FME 2004-10-08 #i33394# - StartUndo( UNDO_TABLE_MERGE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_MERGE, NULL ); // <-- #ifdef DEL_TABLE_REDLINES @@ -2360,9 +2371,9 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) RedlineMode_t eOld = GetRedlineMode(); SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - SwUndoTblMerge* pUndo = 0; - if( DoesUndo() ) - pUndo = new SwUndoTblMerge( rPam ); + SwUndoTblMerge *const pUndo( (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoTblMerge( rPam ) + : 0 ); // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; @@ -2375,13 +2386,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; } @@ -2404,7 +2421,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 @@ -2418,7 +2435,9 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) SetModified(); SetFieldsDirty( true, NULL, 0 ); if( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } } else if( pUndo ) delete pUndo; @@ -2429,7 +2448,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) ::ClearFEShellTabCols(); SetRedlineMode_intern( eOld ); } - EndUndo( UNDO_TABLE_MERGE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_MERGE, NULL ); return nRet; } @@ -2476,7 +2495,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx ) ASSERT( pNode, "Kein Contentnode oder Copy-Node und neuer Node identisch."); - BOOL bBefore = rIdx < GetIndex(); + sal_Bool bBefore = rIdx < GetIndex(); SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() ); @@ -2543,7 +2562,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; @@ -2569,7 +2588,7 @@ void SwTableNode::DelFrms() // <-- pFrm->Cut(); delete pFrm; - bAgain = TRUE; + bAgain = sal_True; } } pLast = bAgain ? aIter.GoStart() : aIter++; @@ -2577,7 +2596,7 @@ void SwTableNode::DelFrms() } -void SwTableNode::SetNewTable( SwTable* pNewTable, BOOL bNewFrames ) +void SwTableNode::SetNewTable( SwTable* pNewTable, sal_Bool bNewFrames ) { DelFrms(); delete pTable; @@ -2612,7 +2631,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() ); @@ -2630,9 +2649,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 ); @@ -2661,7 +2680,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; @@ -2772,7 +2791,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() ) @@ -2791,7 +2810,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)(); @@ -2815,7 +2834,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; @@ -2837,7 +2856,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() ); @@ -2876,9 +2895,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. @@ -2891,7 +2910,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; @@ -2929,17 +2948,17 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* GetTabRows( aOld, 0, pBoxFrm ); - StartUndo( UNDO_TABLE_ATTR, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_ATTR, NULL ); // check for differences between aOld and rNew: - const USHORT nCount = rNew.Count(); + const sal_uInt16 nCount = rNew.Count(); const SwTable* pTable = pTab->GetTable(); ASSERT( pTable, "My colleague told me, this couldn't happen" ); - for ( USHORT i = 0; i <= nCount; ++i ) + for ( sal_uInt16 i = 0; i <= nCount; ++i ) { - const USHORT nIdxStt = bVert ? nCount - i : i - 1; - const USHORT nIdxEnd = bVert ? nCount - i - 1 : i; + const sal_uInt16 nIdxStt = bVert ? nCount - i : i - 1; + const sal_uInt16 nIdxEnd = bVert ? nCount - i - 1 : i; const long nOldRowStart = i == 0 ? 0 : aOld[ nIdxStt ]; const long nOldRowEnd = i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ]; @@ -2967,7 +2986,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 ) @@ -3012,7 +3031,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* } } - EndUndo( UNDO_TABLE_ATTR, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_ATTR, NULL ); ::ClearFEShellTabCols(); } @@ -3021,27 +3040,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 ); @@ -3055,7 +3074,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) @@ -3070,13 +3089,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() ) { @@ -3093,15 +3112,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() ) { @@ -3121,29 +3140,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 @@ -3157,13 +3176,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 @@ -3194,7 +3213,7 @@ BOOL lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ) } else { -USHORT __FAR_DATA aTableSplitBoxSetRange[] = { +sal_uInt16 __FAR_DATA aTableSplitBoxSetRange[] = { RES_LR_SPACE, RES_UL_SPACE, RES_BACKGROUND, RES_SHADOW, RES_PROTECT, RES_PROTECT, @@ -3228,12 +3247,12 @@ USHORT __FAR_DATA aTableSplitBoxSetRange[] = { pBox->GetSttNd()->CheckSectionCondColl(); } } - return TRUE; + return sal_True; } -BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, - BOOL bCalcNewSize ) +sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, + sal_Bool bCalcNewSize ) { SwNode* pNd = &rPos.nNode.GetNode(); SwTableNode* pTNd = pNd->FindTableNode(); @@ -3241,7 +3260,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 @@ -3249,11 +3268,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 ); @@ -3281,16 +3302,17 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, // TL_CHART2: need to inform chart of probably changed cell names //pDoc->UpdateCharts( rTbl.GetFrmFmt()->GetName() ); - SwTableNode* pNew = GetNodes().SplitTable( rPos.nNode, FALSE, bCalcNewSize ); + SwTableNode* pNew = GetNodes().SplitTable( rPos.nNode, sal_False, bCalcNewSize ); if( pNew ) { SwSaveRowSpan* pSaveRowSp = pNew->GetTable().CleanUpTopRowSpan( rTbl.GetTabLines().Count() ); SwUndoSplitTbl* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoSplitTbl( *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize )); + pUndo = new SwUndoSplitTbl( + *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize); + GetIDocumentUndoRedo().AppendUndo(pUndo); if( aHistory.Count() ) pUndo->SaveFormula( aHistory ); } @@ -3301,12 +3323,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 ); @@ -3323,11 +3345,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 ); } @@ -3366,7 +3388,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 @@ -3375,19 +3397,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() ) @@ -3397,7 +3419,7 @@ BOOL lcl_ChgTblSize( SwTable& rTbl ) if( !bLocked ) // und gegebenenfalls Lock wieder freigeben pFmt->UnlockModify(); - return TRUE; + return sal_True; } class _SplitTable_Para @@ -3410,7 +3432,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 ) @@ -3419,7 +3441,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 ) @@ -3430,15 +3452,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() ); @@ -3448,16 +3470,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() ); @@ -3470,18 +3492,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(); @@ -3494,7 +3516,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 !! @@ -3539,20 +3561,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 @@ -3587,11 +3609,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 ) @@ -3599,11 +3621,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 ); @@ -3612,11 +3634,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; } @@ -3629,7 +3650,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 ) { @@ -3645,8 +3666,8 @@ BOOL SwDoc::MergeTable( const SwPosition& rPos, BOOL bWithPrev, USHORT nMode ) return bRet; } -BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, - USHORT nMode, SwHistory* ) +sal_Bool SwNodes::MergeTable( const SwNodeIndex& rPos, sal_Bool bWithPrev, + sal_uInt16 nMode, SwHistory* ) { SwTableNode* pDelTblNd = rPos.GetNode().GetTableNode(); ASSERT( pDelTblNd, "wo ist der TableNode geblieben?" ); @@ -3655,7 +3676,7 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, ASSERT( pTblNd, "wo ist der TableNode geblieben?" ); if( !pDelTblNd || !pTblNd ) - return FALSE; + return sal_False; pDelTblNd->DelFrms(); @@ -3708,12 +3729,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(); @@ -3753,7 +3774,7 @@ BOOL SwNodes::MergeTable( const SwNodeIndex& rPos, BOOL bWithPrev, //Layout updaten aFndBox.MakeFrms( rTbl ); - return TRUE; + return sal_True; } // ------------------------------------------------------------------- @@ -3764,8 +3785,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 ), @@ -3775,16 +3796,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; @@ -3795,7 +3816,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() ) @@ -3807,16 +3828,16 @@ BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) SfxItemSet aCharSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 ); // <-- SfxItemSet aBoxSet( pDoc->GetAttrPool(), aTableBoxSetRange ); - BYTE nPos = pSetPara->nAFmtLine * 4 + pSetPara->nAFmtBox; + sal_uInt8 nPos = pSetPara->nAFmtLine * 4 + pSetPara->nAFmtBox; pSetPara->rTblFmt.UpdateToSet( nPos, aCharSet, SwTableAutoFmt::UPDATE_CHAR, 0 ); pSetPara->rTblFmt.UpdateToSet( nPos, aBoxSet, SwTableAutoFmt::UPDATE_BOX, - pDoc->GetNumberFormatter( TRUE ) ); + pDoc->GetNumberFormatter( sal_True ) ); if( aCharSet.Count() ) { - ULONG nSttNd = pSetBox->GetSttIdx()+1; - ULONG nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex(); + sal_uLong nSttNd = pSetBox->GetSttIdx()+1; + sal_uLong nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex(); for( ; nSttNd < nEndNd; ++nSttNd ) { SwCntntNode* pNd = pDoc->GetNodes()[ nSttNd ]->GetCntntNode(); @@ -3839,17 +3860,17 @@ BOOL lcl_SetAFmtBox( const _FndBox*& rpBox, void *pPara ) if( !rpBox->GetUpper()->GetUpper() ) // eine BaseLine ++pSetPara->nCurBox; - return TRUE; + return sal_True; } // AutoFormat fuer die Tabelle/TabellenSelection -BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew ) +sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew ) { ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -3858,7 +3879,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 ); @@ -3873,18 +3894,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]; @@ -3897,7 +3919,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; @@ -3909,22 +3931,24 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe } if( pUndo ) - DoUndo( TRUE ); + { + GetIDocumentUndoRedo().DoUndo(bUndo); + } SetModified(); SetFieldsDirty( true, NULL, 0 ); - return TRUE; + return sal_True; } // Erfrage wie attributiert ist -BOOL SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) +sal_Bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet ) { ASSERT( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -3933,7 +3957,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() && @@ -3945,30 +3969,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 ) @@ -3979,11 +4003,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 @@ -3992,10 +4016,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 ) @@ -4005,7 +4029,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 )); } @@ -4027,7 +4051,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 ) @@ -4035,7 +4059,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 ) && @@ -4049,20 +4073,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: @@ -4072,7 +4097,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: @@ -4081,15 +4106,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 ) @@ -4102,30 +4126,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 ); } @@ -4133,16 +4157,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(); @@ -4155,7 +4179,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; } } @@ -4194,20 +4218,20 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) const SfxPoolItem* pValueItem = 0, *pFmtItem = 0; SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt(); if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMAT, - FALSE, &pFmtItem ) || + sal_False, &pFmtItem ) || SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_VALUE, - FALSE, &pValueItem )) + sal_False, &pValueItem )) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_TABLE_AUTOFMT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL ); pUndo = new SwUndoTblNumFmt( rBox ); } pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt(); // alle Zahlenformate entfernen - USHORT nWhich1 = RES_BOXATR_FORMULA; + sal_uInt16 nWhich1 = RES_BOXATR_FORMULA; if( !bIsEmptyTxtNd ) //JP 15.01.99: dieser Teil wurde doch schon oben abgeprueft! /* && pFmtItem && !GetNumberFormatter()-> @@ -4223,7 +4247,7 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) pBoxFmt->ResetFmtAttr( nWhich1, RES_BOXATR_VALUE ); } else - bChgd = FALSE; + bChgd = sal_False; } if( bChgd ) @@ -4231,8 +4255,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(); @@ -4252,10 +4276,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(); @@ -4278,7 +4301,7 @@ void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet ) void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) { SwStartNode* pSttNd; - if( 0 != ( pSttNd = GetNodes()[ rNode ]-> + if( 0 != ( pSttNd = rNode.GetNode(). FindSttNodeByType( SwTableBoxStartNode )) && 2 == pSttNd->EndOfSectionIndex() - pSttNd->GetIndex() ) { @@ -4287,20 +4310,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; @@ -4322,41 +4344,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 @@ -4368,43 +4396,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(); @@ -4443,7 +4466,6 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if( bDelCpyDoc ) { - delete pRefForDocSh; if( pCpyDoc->release() == 0 ) delete pCpyDoc; } @@ -4452,11 +4474,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 ) @@ -4477,20 +4501,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; } } @@ -4498,8 +4523,7 @@ BOOL SwDoc::_UnProtectTblCells( SwTable& rTbl ) { if( bChgd ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -4508,9 +4532,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 ) { @@ -4522,23 +4546,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 @@ -4548,7 +4572,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) pBoxFmt->ResetFmtAttr( RES_PROTECT ); aNewFmts.Insert( pBoxFmt, aNewFmts.Count() ); } - bChgd = TRUE; + bChgd = sal_True; } } @@ -4556,8 +4580,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) { if( bChgd ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -4566,26 +4589,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(), @@ -4602,18 +4625,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 ) ); @@ -4627,22 +4650,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; } } @@ -4652,14 +4675,14 @@ BOOL SwDoc::HasTblAnyProtection( const SwPosition* pPos, #ifdef DEL_TABLE_REDLINES lcl_DelRedlines::lcl_DelRedlines( const SwTableNode& rNd, - BOOL bCheckForOwnRedline ) + sal_Bool bCheckForOwnRedline ) : pDoc( (SwDoc*)rNd.GetNodes().GetDoc() ) { pDoc->StartUndo(UNDO_EMPTY, NULL); const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); if( !pDoc->IsIgnoreRedline() && rTbl.Count() ) { - BOOL bDelete = TRUE; + sal_Bool bDelete = sal_True; if( bCheckForOwnRedline ) { sal_uInt16 nRedlPos = pDoc->GetRedlinePos( rNd, USHRT_MAX ); @@ -4678,7 +4701,7 @@ lcl_DelRedlines::lcl_DelRedlines( const SwTableNode& rNd, if( pEnd->nNode >= nEndNd && pRedline->GetAuthor() == pDoc->GetRedlineAuthor() ) { - bDelete = FALSE; + bDelete = sal_False; break; } } diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index c561f10d0a3f..3d8b57df4101 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -29,10 +29,6 @@ #include "precompiled_sw.hxx" -#ifdef WTC -#define private public -#endif - #include "hintids.hxx" #include <editeng/lrspitem.hxx> #include <editeng/boxitem.hxx> @@ -49,7 +45,8 @@ #include <cntfrm.hxx> #include <txtfrm.hxx> #include <svx/svxids.hrc> -#include "doc.hxx" +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include "pam.hxx" #include "swcrsr.hxx" #include "viscrs.hxx" @@ -59,7 +56,8 @@ #include "swtblfmt.hxx" #include "docary.hxx" #include "ndindex.hxx" -#include "undobj.hxx" +#include <UndoTable.hxx> + using namespace ::com::sun::star; @@ -69,30 +67,30 @@ extern void ClearFEShellTabCols(); //siehe auch swtable.cxx #define COLFUZZY 20L -inline BOOL IsSame( long nA, long nB ) { return Abs(nA-nB) <= COLFUZZY; } +inline sal_Bool IsSame( long nA, long nB ) { return Abs(nA-nB) <= COLFUZZY; } class SwTblFmtCmp { public: SwFrmFmt *pOld, *pNew; - INT16 nType; + sal_Int16 nType; - SwTblFmtCmp( SwFrmFmt *pOld, SwFrmFmt *pNew, INT16 nType ); + SwTblFmtCmp( SwFrmFmt *pOld, SwFrmFmt *pNew, sal_Int16 nType ); - static SwFrmFmt *FindNewFmt( SvPtrarr &rArr, SwFrmFmt*pOld, INT16 nType ); + static SwFrmFmt *FindNewFmt( SvPtrarr &rArr, SwFrmFmt*pOld, sal_Int16 nType ); static void Delete( SvPtrarr &rArr ); }; -SwTblFmtCmp::SwTblFmtCmp( SwFrmFmt *pO, SwFrmFmt *pN, INT16 nT ) +SwTblFmtCmp::SwTblFmtCmp( SwFrmFmt *pO, SwFrmFmt *pN, sal_Int16 nT ) : pOld ( pO ), pNew ( pN ), nType( nT ) { } -SwFrmFmt *SwTblFmtCmp::FindNewFmt( SvPtrarr &rArr, SwFrmFmt *pOld, INT16 nType ) +SwFrmFmt *SwTblFmtCmp::FindNewFmt( SvPtrarr &rArr, SwFrmFmt *pOld, sal_Int16 nType ) { - for ( USHORT i = 0; i < rArr.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rArr.Count(); ++i ) { SwTblFmtCmp *pCmp = (SwTblFmtCmp*)rArr[i]; if ( pCmp->pOld == pOld && pCmp->nType == nType ) @@ -103,14 +101,14 @@ SwFrmFmt *SwTblFmtCmp::FindNewFmt( SvPtrarr &rArr, SwFrmFmt *pOld, INT16 nType ) void SwTblFmtCmp::Delete( SvPtrarr &rArr ) { - for ( USHORT i = 0; i < rArr.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rArr.Count(); ++i ) delete (SwTblFmtCmp*)rArr[i]; } void lcl_GetStartEndCell( const SwCursor& rCrsr, SwLayoutFrm *&prStart, SwLayoutFrm *&prEnd ) { - ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ), + ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( sal_False ), "Tabselection nicht auf Cnt." ); Point aPtPos, aMkPos; @@ -123,7 +121,7 @@ void lcl_GetStartEndCell( const SwCursor& rCrsr, // robust: SwCntntNode* pPointNd = rCrsr.GetCntntNode(); - SwCntntNode* pMarkNd = rCrsr.GetCntntNode(FALSE); + SwCntntNode* pMarkNd = rCrsr.GetCntntNode(sal_False); SwFrm* pPointFrm = pPointNd ? pPointNd->GetFrm( &aPtPos ) : 0; SwFrm* pMarkFrm = pMarkNd ? pMarkNd->GetFrm( &aMkPos ) : 0; @@ -132,8 +130,8 @@ void lcl_GetStartEndCell( const SwCursor& rCrsr, prEnd = pMarkFrm ? pMarkFrm->GetUpper() : 0; } -BOOL lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes, - BOOL bAllCrsr = FALSE ) +sal_Bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes, + sal_Bool bAllCrsr = sal_False ) { const SwTableCursor* pTblCrsr = dynamic_cast<const SwTableCursor*>(&rCursor); @@ -179,17 +177,17 @@ inline void InsertLine( SvPtrarr& rLineArr, SwTableLine* pLine ) //----------------------------------------------------------------------------- -BOOL lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed ) +sal_Bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed ) { const SwTableLine *pTmp = pAssumed->GetUpper() ? pAssumed->GetUpper()->GetUpper() : 0; while ( pTmp ) { if ( pTmp == pLine ) - return TRUE; + return sal_True; pTmp = pTmp->GetUpper() ? pTmp->GetUpper()->GetUpper() : 0; } - return FALSE; + return sal_False; } //----------------------------------------------------------------------------- @@ -197,20 +195,20 @@ struct LinesAndTable { SvPtrarr &rLines; const SwTable &rTable; - BOOL bInsertLines; + sal_Bool bInsertLines; LinesAndTable( SvPtrarr &rL, const SwTable &rTbl ) : - rLines( rL ), rTable( rTbl ), bInsertLines( TRUE ) {} + rLines( rL ), rTable( rTbl ), bInsertLines( sal_True ) {} }; -BOOL _FindLine( const _FndLine*& rpLine, void* pPara ); +sal_Bool _FindLine( const _FndLine*& rpLine, void* pPara ); -BOOL _FindBox( const _FndBox*& rpBox, void* pPara ) +sal_Bool _FindBox( const _FndBox*& rpBox, void* pPara ) { if ( rpBox->GetLines().Count() ) { - ((LinesAndTable*)pPara)->bInsertLines = TRUE; + ((LinesAndTable*)pPara)->bInsertLines = sal_True; ((_FndBox*)rpBox)->GetLines().ForEach( _FindLine, pPara ); if ( ((LinesAndTable*)pPara)->bInsertLines ) { @@ -219,24 +217,24 @@ BOOL _FindBox( const _FndBox*& rpBox, void* pPara ) : ((LinesAndTable*)pPara)->rTable.GetTabLines(); if ( rpBox->GetLines().Count() == rLines.Count() ) { - for ( USHORT i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) ::InsertLine( ((LinesAndTable*)pPara)->rLines, (SwTableLine*)rLines[i] ); } else - ((LinesAndTable*)pPara)->bInsertLines = FALSE; + ((LinesAndTable*)pPara)->bInsertLines = sal_False; } } else if ( rpBox->GetBox() ) ::InsertLine( ((LinesAndTable*)pPara)->rLines, (SwTableLine*)rpBox->GetBox()->GetUpper() ); - return TRUE; + return sal_True; } -BOOL _FindLine( const _FndLine*& rpLine, void* pPara ) +sal_Bool _FindLine( const _FndLine*& rpLine, void* pPara ) { ((_FndLine*)rpLine)->GetBoxes().ForEach( _FindBox, pPara ); - return TRUE; + return sal_True; } void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLines ) @@ -263,10 +261,10 @@ void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLine // (Not for row split) if ( bRemoveLines ) { - for ( USHORT i = 0; i < rArr.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rArr.Count(); ++i ) { SwTableLine *pUpLine = (SwTableLine*)rArr[i]; - for ( USHORT k = 0; k < rArr.Count(); ++k ) + for ( sal_uInt16 k = 0; k < rArr.Count(); ++k ) { if ( k != i && ::lcl_IsAnLower( pUpLine, (SwTableLine*)rArr[k] ) ) { @@ -304,7 +302,7 @@ void lcl_ProcessRowSize( SvPtrarr &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSi { lcl_ProcessRowAttr( rFmtCmp, pLine, rNew ); SwTableBoxes &rBoxes = pLine->GetTabBoxes(); - for ( USHORT i = 0; i < rBoxes.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rBoxes.Count(); ++i ) ::lcl_ProcessBoxSize( rFmtCmp, rBoxes[i], rNew ); } @@ -317,7 +315,7 @@ void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize { SwFmtFrmSize aSz( rNew ); aSz.SetHeight( rNew.GetHeight() ? rNew.GetHeight() / rLines.Count() : 0 ); - for ( USHORT i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) ::lcl_ProcessRowSize( rFmtCmp, rLines[i], aSz ); } } @@ -337,15 +335,14 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew ) if( aRowArr.Count() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } - SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); + SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 ); - for( USHORT i = 0; i < aRowArr.Count(); ++i ) + for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i ) ::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew ); SwTblFmtCmp::Delete( aFmtCmp ); @@ -373,7 +370,7 @@ void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const rpSz = &(SwFmtRowSplit&)((SwTableLine*)aRowArr[0])-> GetFrmFmt()->GetRowSplit(); - for ( USHORT i = 1; i < aRowArr.Count() && rpSz; ++i ) + for ( sal_uInt16 i = 1; i < aRowArr.Count() && rpSz; ++i ) { if ( (*rpSz).GetValue() != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetRowSplit().GetValue() ) rpSz = 0; @@ -398,14 +395,13 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew ) if( aRowArr.Count() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } - SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); - for ( USHORT i = 0; i < aRowArr.Count(); ++i ) + SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 ); + for ( sal_uInt16 i = 0; i < aRowArr.Count(); ++i ) ::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], rNew ); SwTblFmtCmp::Delete( aFmtCmp ); @@ -433,7 +429,7 @@ void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const rpSz = &(SwFmtFrmSize&)((SwTableLine*)aRowArr[0])-> GetFrmFmt()->GetFrmSize(); - for ( USHORT i = 1; i < aRowArr.Count() && rpSz; ++i ) + for ( sal_uInt16 i = 1; i < aRowArr.Count() && rpSz; ++i ) { if ( *rpSz != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetFrmSize() ) rpSz = 0; @@ -444,9 +440,9 @@ void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const } } -BOOL SwDoc::BalanceRowHeight( const SwCursor& rCursor, BOOL bTstOnly ) +sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); if( pTblNd ) { @@ -458,7 +454,7 @@ BOOL SwDoc::BalanceRowHeight( const SwCursor& rCursor, BOOL bTstOnly ) if( !bTstOnly ) { long nHeight = 0; - USHORT i; + sal_uInt16 i; for ( i = 0; i < aRowArr.Count(); ++i ) { @@ -472,20 +468,20 @@ BOOL SwDoc::BalanceRowHeight( const SwCursor& rCursor, BOOL bTstOnly ) } SwFmtFrmSize aNew( ATT_MIN_SIZE, 0, nHeight ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoAttrTbl(*pTblNd)); } - SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); + SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 ); for( i = 0; i < aRowArr.Count(); ++i ) ::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], aNew ); SwTblFmtCmp::Delete( aFmtCmp ); SetModified(); } - bRet = TRUE; + bRet = sal_True; } } return bRet; @@ -504,15 +500,14 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew if( aRowArr.Count() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } - SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); + SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 ); - for( USHORT i = 0; i < aRowArr.Count(); ++i ) + for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i ) ::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew ); SwTblFmtCmp::Delete( aFmtCmp ); @@ -524,9 +519,9 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew /****************************************************************************** * SwTwips SwDoc::GetRowBackground() const ******************************************************************************/ -BOOL SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const +sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); if( pTblNd ) { @@ -537,11 +532,11 @@ BOOL SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) c { rToFill = ((SwTableLine*)aRowArr[0])->GetFrmFmt()->GetBackground(); - bRet = TRUE; - for ( USHORT i = 1; i < aRowArr.Count(); ++i ) + bRet = sal_True; + for ( sal_uInt16 i = 1; i < aRowArr.Count(); ++i ) if ( rToFill != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetBackground() ) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -600,10 +595,9 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) if( aUnions.Count() ) { SwTable& rTable = pTblNd->GetTable(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) ); } SvPtrarr aFmtCmp( 255, 255 ); @@ -616,13 +610,13 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) const SvxBorderLine* pBottom = 0; const SvxBorderLine* pHori = 0; const SvxBorderLine* pVert = 0; - BOOL bHoriValid = TRUE, bVertValid = TRUE, - bTopValid = TRUE, bBottomValid = TRUE, - bLeftValid = TRUE, bRightValid = TRUE; + sal_Bool bHoriValid = sal_True, bVertValid = sal_True, + bTopValid = sal_True, bBottomValid = sal_True, + bLeftValid = sal_True, bRightValid = sal_True; // JP 21.07.95: die Flags im BoxInfo-Item entscheiden, wann eine // BorderLine gueltig ist!! - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, FALSE, + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, sal_False, (const SfxPoolItem**)&pSetBoxInfo) ) { pHori = pSetBoxInfo->GetHori(); @@ -638,7 +632,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) bRightValid = pSetBoxInfo->IsValid(VALID_RIGHT); } - if( SFX_ITEM_SET == rSet.GetItemState( RES_BOX, FALSE, + if( SFX_ITEM_SET == rSet.GetItemState( RES_BOX, sal_False, (const SfxPoolItem**)&pSetBox) ) { pLeft = pSetBox->GetLeft(); @@ -649,17 +643,17 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) else { // nicht gesetzt, also keine gueltigen Werte - bTopValid = bBottomValid = bLeftValid = bRightValid = FALSE; + bTopValid = bBottomValid = bLeftValid = bRightValid = sal_False; pSetBox = 0; } - BOOL bFirst = TRUE; - for ( USHORT i = 0; i < aUnions.Count(); ++i ) + sal_Bool bFirst = sal_True; + for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) { SwSelUnion *pUnion = aUnions[i]; SwTabFrm *pTab = pUnion->GetTable(); const SwRect &rUnion = pUnion->GetUnion(); - const BOOL bLast = i == aUnions.Count() - 1 ? TRUE : FALSE; + const sal_Bool bLast = i == aUnions.Count() - 1 ? sal_True : sal_False; SvPtrarr aCellArr( 255, 255 ); ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); @@ -672,7 +666,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) //handelt doch keine Aussenkanten sein. //Aussenkanten werden links, rechts, oben und unten gesetzt. //Innenkanten werden nur oben und links gesetzt. - for ( USHORT j = 0; j < aCellArr.Count(); ++j ) + for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j ) { SwCellFrm *pCell = (SwCellFrm*)aCellArr[j]; const sal_Bool bVert = pTab->IsVertical(); @@ -710,7 +704,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) SvxBoxItem aBox( pCell->GetFmt()->GetBox() ); - INT16 nType = 0; + sal_Int16 nType = 0; //Obere Kante if( bTopValid ) @@ -774,10 +768,10 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) if( pSetBox ) { - static USHORT __READONLY_DATA aBorders[] = { + static sal_uInt16 __READONLY_DATA aBorders[] = { BOX_LINE_BOTTOM, BOX_LINE_TOP, BOX_LINE_RIGHT, BOX_LINE_LEFT }; - const USHORT* pBrd = aBorders; + const sal_uInt16* pBrd = aBorders; for( int k = 0; k < 4; ++k, ++pBrd ) aBox.SetDistance( pSetBox->GetDistance( *pBrd ), *pBrd ); } @@ -795,7 +789,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) } } - bFirst = FALSE; + bFirst = sal_False; } SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout(); @@ -805,7 +799,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm(); pTableLayout->BordersChanged( - pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), TRUE ); + pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), sal_True ); } SwTblFmtCmp::Delete( aFmtCmp ); ::ClearFEShellTabCols(); @@ -832,7 +826,7 @@ void lcl_SetLineStyle( SvxBorderLine *pToSet, } void SwDoc::SetTabLineStyle( const SwCursor& rCursor, - const Color* pColor, BOOL bSetLine, + const Color* pColor, sal_Bool bSetLine, const SvxBorderLine* pBorderLine ) { SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode(); @@ -849,20 +843,19 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, if( aUnions.Count() ) { SwTable& rTable = pTblNd->GetTable(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } - for( USHORT i = 0; i < aUnions.Count(); ++i ) + for( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) { SwSelUnion *pUnion = aUnions[i]; SwTabFrm *pTab = pUnion->GetTable(); SvPtrarr aCellArr( 255, 255 ); ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab ); - for ( USHORT j = 0; j < aCellArr.Count(); ++j ) + for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j ) { SwCellFrm *pCell = ( SwCellFrm* )aCellArr[j]; @@ -902,7 +895,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm(); pTableLayout->BordersChanged( - pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), TRUE ); + pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), sal_True ); } ::ClearFEShellTabCols(); SetModified(); @@ -927,28 +920,28 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX )); SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER)); - BOOL bTopSet = FALSE, - bBottomSet = FALSE, - bLeftSet = FALSE, - bRightSet = FALSE, - bHoriSet = FALSE, - bVertSet = FALSE, - bDistanceSet = FALSE; + sal_Bool bTopSet = sal_False, + bBottomSet = sal_False, + bLeftSet = sal_False, + bRightSet = sal_False, + bHoriSet = sal_False, + bVertSet = sal_False, + bDistanceSet = sal_False; aSetBoxInfo.ResetFlags(); - for ( USHORT i = 0; i < aUnions.Count(); ++i ) + for ( sal_uInt16 i = 0; i < aUnions.Count(); ++i ) { SwSelUnion *pUnion = aUnions[i]; const SwTabFrm *pTab = pUnion->GetTable(); const SwRect &rUnion = pUnion->GetUnion(); - const BOOL bFirst = i == 0 ? TRUE : FALSE; - const BOOL bLast = i == aUnions.Count() - 1 ? TRUE : FALSE; + const sal_Bool bFirst = i == 0 ? sal_True : sal_False; + const sal_Bool bLast = i == aUnions.Count() - 1 ? sal_True : sal_False; SvPtrarr aCellArr( 255, 255 ); ::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab ); - for ( USHORT j = 0; j < aCellArr.Count(); ++j ) + for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j ) { const SwCellFrm *pCell = (const SwCellFrm*)aCellArr[j]; const sal_Bool bVert = pTab->IsVertical(); @@ -985,14 +978,14 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if (aSetBoxInfo.IsValid(VALID_TOP)) { if ( !bTopSet ) - { bTopSet = TRUE; + { bTopSet = sal_True; aSetBox.SetLine( rBox.GetTop(), BOX_LINE_TOP ); } else if ((aSetBox.GetTop() && rBox.GetTop() && !(*aSetBox.GetTop() == *rBox.GetTop())) || - ((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR-Ausdruck ist TRUE, wenn genau einer der beiden Pointer 0 ist + ((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR-Ausdruck ist sal_True, wenn genau einer der beiden Pointer 0 ist { - aSetBoxInfo.SetValid(VALID_TOP, FALSE ); + aSetBoxInfo.SetValid(VALID_TOP, sal_False ); aSetBox.SetLine( 0, BOX_LINE_TOP ); } } @@ -1004,14 +997,14 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if (aSetBoxInfo.IsValid(VALID_LEFT)) { if ( !bLeftSet ) - { bLeftSet = TRUE; + { bLeftSet = sal_True; aSetBox.SetLine( rBox.GetLeft(), BOX_LINE_LEFT ); } else if ((aSetBox.GetLeft() && rBox.GetLeft() && !(*aSetBox.GetLeft() == *rBox.GetLeft())) || ((!aSetBox.GetLeft()) ^ (!rBox.GetLeft()))) { - aSetBoxInfo.SetValid(VALID_LEFT, FALSE ); + aSetBoxInfo.SetValid(VALID_LEFT, sal_False ); aSetBox.SetLine( 0, BOX_LINE_LEFT ); } } @@ -1021,13 +1014,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if (aSetBoxInfo.IsValid(VALID_VERT)) { if ( !bVertSet ) - { bVertSet = TRUE; + { bVertSet = sal_True; aSetBoxInfo.SetLine( rBox.GetLeft(), BOXINFO_LINE_VERT ); } else if ((aSetBoxInfo.GetVert() && rBox.GetLeft() && !(*aSetBoxInfo.GetVert() == *rBox.GetLeft())) || ((!aSetBoxInfo.GetVert()) ^ (!rBox.GetLeft()))) - { aSetBoxInfo.SetValid( VALID_VERT, FALSE ); + { aSetBoxInfo.SetValid( VALID_VERT, sal_False ); aSetBoxInfo.SetLine( 0, BOXINFO_LINE_VERT ); } } @@ -1037,13 +1030,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if ( aSetBoxInfo.IsValid(VALID_RIGHT) && bRightOver ) { if ( !bRightSet ) - { bRightSet = TRUE; + { bRightSet = sal_True; aSetBox.SetLine( rBox.GetRight(), BOX_LINE_RIGHT ); } else if ((aSetBox.GetRight() && rBox.GetRight() && !(*aSetBox.GetRight() == *rBox.GetRight())) || (!aSetBox.GetRight() ^ !rBox.GetRight())) - { aSetBoxInfo.SetValid( VALID_RIGHT, FALSE ); + { aSetBoxInfo.SetValid( VALID_RIGHT, sal_False ); aSetBox.SetLine( 0, BOX_LINE_RIGHT ); } } @@ -1054,13 +1047,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if ( aSetBoxInfo.IsValid(VALID_BOTTOM) ) { if ( !bBottomSet ) - { bBottomSet = TRUE; + { bBottomSet = sal_True; aSetBox.SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM ); } else if ((aSetBox.GetBottom() && rBox.GetBottom() && !(*aSetBox.GetBottom() == *rBox.GetBottom())) || (!aSetBox.GetBottom() ^ !rBox.GetBottom())) - { aSetBoxInfo.SetValid( VALID_BOTTOM, FALSE ); + { aSetBoxInfo.SetValid( VALID_BOTTOM, sal_False ); aSetBox.SetLine( 0, BOX_LINE_BOTTOM ); } } @@ -1072,14 +1065,14 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if (aSetBoxInfo.IsValid(VALID_HORI)) { if ( !bHoriSet ) - { bHoriSet = TRUE; + { bHoriSet = sal_True; aSetBoxInfo.SetLine( rBox.GetBottom(), BOXINFO_LINE_HORI ); } else if ((aSetBoxInfo.GetHori() && rBox.GetBottom() && !(*aSetBoxInfo.GetHori() == *rBox.GetBottom())) || ((!aSetBoxInfo.GetHori()) ^ (!rBox.GetBottom()))) { - aSetBoxInfo.SetValid( VALID_HORI, FALSE ); + aSetBoxInfo.SetValid( VALID_HORI, sal_False ); aSetBoxInfo.SetLine( 0, BOXINFO_LINE_HORI ); } } @@ -1088,14 +1081,14 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const // Abstand zum Text if (aSetBoxInfo.IsValid(VALID_DISTANCE)) { - static USHORT __READONLY_DATA aBorders[] = { + static sal_uInt16 __READONLY_DATA aBorders[] = { BOX_LINE_BOTTOM, BOX_LINE_TOP, BOX_LINE_RIGHT, BOX_LINE_LEFT }; - const USHORT* pBrd = aBorders; + const sal_uInt16* pBrd = aBorders; if( !bDistanceSet ) // bei 1. Durchlauf erstmal setzen { - bDistanceSet = TRUE; + bDistanceSet = sal_True; for( int k = 0; k < 4; ++k, ++pBrd ) aSetBox.SetDistance( rBox.GetDistance( *pBrd ), *pBrd ); @@ -1106,8 +1099,8 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const if( aSetBox.GetDistance( *pBrd ) != rBox.GetDistance( *pBrd ) ) { - aSetBoxInfo.SetValid( VALID_DISTANCE, FALSE ); - aSetBox.SetDistance( (USHORT) 0 ); + aSetBoxInfo.SetValid( VALID_DISTANCE, sal_False ); + aSetBox.SetDistance( (sal_uInt16) 0 ); break; } } @@ -1129,17 +1122,16 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) { SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwSelBoxes aBoxes; - if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes, TRUE ) ) + if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes, sal_True ) ) { SwTable& rTable = pTblNd->GetTable(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) ); } - SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aBoxes.Count()) ), 255 ); - for ( USHORT i = 0; i < aBoxes.Count(); ++i ) + SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aBoxes.Count()) ), 255 ); + for ( sal_uInt16 i = 0; i < aBoxes.Count(); ++i ) { SwTableBox *pBox = aBoxes[i]; @@ -1162,7 +1154,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm(); pTableLayout->Resize( - pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), TRUE ); + pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), sal_True ); } SwTblFmtCmp::Delete( aFmtCmp ); SetModified(); @@ -1176,17 +1168,17 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) #* Update : JP 29.04.98 #***********************************************************************/ -BOOL SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const +sal_Bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwSelBoxes aBoxes; if( pTblNd && lcl_GetBoxSel( rCursor, aBoxes )) { - bRet = TRUE; - BOOL bOneFound = FALSE; - const USHORT nWhich = rToFill.Which(); - for( USHORT i = 0; i < aBoxes.Count(); ++i ) + bRet = sal_True; + sal_Bool bOneFound = sal_False; + const sal_uInt16 nWhich = rToFill.Which(); + for( sal_uInt16 i = 0; i < aBoxes.Count(); ++i ) { switch ( nWhich ) { @@ -1197,10 +1189,10 @@ BOOL SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const if( !bOneFound ) { (SvxBrushItem&)rToFill = rBack; - bOneFound = TRUE; + bOneFound = sal_True; } else if( rToFill != rBack ) - bRet = FALSE; + bRet = sal_False; } break; @@ -1211,14 +1203,14 @@ BOOL SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const if( !bOneFound ) { (SvxFrameDirectionItem&)rToFill = rDir; - bOneFound = TRUE; + bOneFound = sal_True; } else if( rToFill != rDir ) - bRet = FALSE; + bRet = sal_False; } } - if ( FALSE == bRet ) + if ( sal_False == bRet ) break; } } @@ -1231,7 +1223,7 @@ BOOL SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const #* Datum : MA 18. Dec. 96 #* Update : JP 29.04.98 #***********************************************************************/ -void SwDoc::SetBoxAlign( const SwCursor& rCursor, USHORT nAlign ) +void SwDoc::SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign ) { ASSERT( nAlign == text::VertOrientation::NONE || nAlign == text::VertOrientation::CENTER || @@ -1240,18 +1232,18 @@ void SwDoc::SetBoxAlign( const SwCursor& rCursor, USHORT nAlign ) SetBoxAttr( rCursor, aVertOri ); } -USHORT SwDoc::GetBoxAlign( const SwCursor& rCursor ) const +sal_uInt16 SwDoc::GetBoxAlign( const SwCursor& rCursor ) const { - USHORT nAlign = USHRT_MAX; + sal_uInt16 nAlign = USHRT_MAX; SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); SwSelBoxes aBoxes; if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes )) - for( USHORT i = 0; i < aBoxes.Count(); ++i ) + for( sal_uInt16 i = 0; i < aBoxes.Count(); ++i ) { const SwFmtVertOrient &rOri = aBoxes[i]->GetFrmFmt()->GetVertOrient(); if( USHRT_MAX == nAlign ) - nAlign = static_cast<USHORT>(rOri.GetVertOrient()); + nAlign = static_cast<sal_uInt16>(rOri.GetVertOrient()); else if( rOri.GetVertOrient() != nAlign ) { nAlign = USHRT_MAX; @@ -1268,7 +1260,7 @@ USHORT SwDoc::GetBoxAlign( const SwCursor& rCursor ) const #* Datum : MA 20. Feb. 95 #* Update : JP 29.04.98 #***********************************************************************/ -USHORT lcl_CalcCellFit( const SwLayoutFrm *pCell ) +sal_uInt16 lcl_CalcCellFit( const SwLayoutFrm *pCell ) { SwTwips nRet = 0; const SwFrm *pFrm = pCell->Lower(); //Die ganze Zelle. @@ -1294,7 +1286,7 @@ USHORT lcl_CalcCellFit( const SwLayoutFrm *pCell ) //Um Rechenungenauikeiten, die spaeter bei SwTable::SetTabCols enstehen, //auszugleichen, addieren wir noch ein bischen. nRet += COLFUZZY; - return (USHORT)Max( long(MINLAY), nRet ); + return (sal_uInt16)Max( long(MINLAY), nRet ); } /*Die Zelle ist in der Selektion, wird aber nicht von den TabCols beschrieben. @@ -1311,15 +1303,15 @@ USHORT lcl_CalcCellFit( const SwLayoutFrm *pCell ) void lcl_CalcSubColValues( SvUShorts &rToFill, const SwTabCols &rCols, const SwLayoutFrm *pCell, const SwLayoutFrm *pTab, - BOOL bWishValues ) + sal_Bool bWishValues ) { - const USHORT nWish = bWishValues ? + const sal_uInt16 nWish = bWishValues ? ::lcl_CalcCellFit( pCell ) : - MINLAY + USHORT(pCell->Frm().Width() - pCell->Prt().Width()); + MINLAY + sal_uInt16(pCell->Frm().Width() - pCell->Prt().Width()); SWRECTFN( pTab ) - for ( USHORT i = 0 ; i <= rCols.Count(); ++i ) + for ( sal_uInt16 i = 0 ; i <= rCols.Count(); ++i ) { long nColLeft = i == 0 ? rCols.GetLeft() : rCols[i-1]; long nColRight = i == rCols.Count() ? rCols.GetRight() : rCols[i]; @@ -1327,7 +1319,7 @@ void lcl_CalcSubColValues( SvUShorts &rToFill, const SwTabCols &rCols, nColRight += rCols.GetLeftMin(); //Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen. - if ( rCols.GetLeftMin() != USHORT((pTab->Frm().*fnRect->fnGetLeft)()) ) + if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) ) { const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin(); nColLeft += nDiff; @@ -1347,8 +1339,8 @@ void lcl_CalcSubColValues( SvUShorts &rToFill, const SwTabCols &rCols, if ( nWidth && pCell->Frm().Width() ) { long nTmp = nWidth * nWish / pCell->Frm().Width(); - if ( USHORT(nTmp) > rToFill[i] ) - rToFill[i] = USHORT(nTmp); + if ( sal_uInt16(nTmp) > rToFill[i] ) + rToFill[i] = sal_uInt16(nTmp); } } } @@ -1357,27 +1349,27 @@ void lcl_CalcSubColValues( SvUShorts &rToFill, const SwTabCols &rCols, *Es wird nicht ueber die Eintrage in den TabCols itereriert, sondern *quasi ueber die Zwischenraeume, die ja die Zellen beschreiben. * - *bWishValues == TRUE: Es werden zur aktuellen Selektion bzw. zur aktuellen + *bWishValues == sal_True: Es werden zur aktuellen Selektion bzw. zur aktuellen * Zelle die Wunschwerte aller betroffen Zellen ermittelt. * Sind mehrere Zellen in einer Spalte, so wird der * groesste Wunschwert als Ergebnis geliefert. * Fuer die TabCol-Eintraege, zu denen keine Zellen * ermittelt wurden, werden 0-en eingetragen. * - *bWishValues == FALSE: Die Selektion wird senkrecht ausgedehnt. Zu jeder + *bWishValues == sal_False: Die Selektion wird senkrecht ausgedehnt. Zu jeder * Spalte in den TabCols, die sich mit der Selektion * schneidet wird der Minimalwert ermittelt. */ void lcl_CalcColValues( SvUShorts &rToFill, const SwTabCols &rCols, const SwLayoutFrm *pStart, const SwLayoutFrm *pEnd, - BOOL bWishValues ) + sal_Bool bWishValues ) { SwSelUnions aUnions; ::MakeSelUnions( aUnions, pStart, pEnd, bWishValues ? nsSwTblSearchType::TBLSEARCH_NONE : nsSwTblSearchType::TBLSEARCH_COL ); - for ( USHORT i2 = 0; i2 < aUnions.Count(); ++i2 ) + for ( sal_uInt16 i2 = 0; i2 < aUnions.Count(); ++i2 ) { SwSelUnion *pSelUnion = aUnions[i2]; const SwTabFrm *pTab = pSelUnion->GetTable(); @@ -1394,11 +1386,11 @@ void lcl_CalcColValues( SvUShorts &rToFill, const SwTabCols &rCols, const long nCLeft = (pCell->Frm().*fnRect->fnGetLeft)(); const long nCRight = (pCell->Frm().*fnRect->fnGetRight)(); - BOOL bNotInCols = TRUE; + sal_Bool bNotInCols = sal_True; - for ( USHORT i = 0; i <= rCols.Count(); ++i ) + for ( sal_uInt16 i = 0; i <= rCols.Count(); ++i ) { - USHORT nFit = rToFill[i]; + sal_uInt16 nFit = rToFill[i]; long nColLeft = i == 0 ? rCols.GetLeft() : rCols[i-1]; long nColRight = i == rCols.Count() ? rCols.GetRight() : rCols[i]; @@ -1415,7 +1407,7 @@ void lcl_CalcColValues( SvUShorts &rToFill, const SwTabCols &rCols, //Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen. long nLeftA = nColLeft; long nRightA = nColRight; - if ( rCols.GetLeftMin() != USHORT((pTab->Frm().*fnRect->fnGetLeft)()) ) + if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frm().*fnRect->fnGetLeft)()) ) { const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin(); nLeftA += nDiff; @@ -1425,15 +1417,15 @@ void lcl_CalcColValues( SvUShorts &rToFill, const SwTabCols &rCols, //Wir wollen nicht allzu genau hinsehen. if ( ::IsSame(nCLeft, nLeftA) && ::IsSame(nCRight, nRightA)) { - bNotInCols = FALSE; + bNotInCols = sal_False; if ( bWishValues ) { - const USHORT nWish = ::lcl_CalcCellFit( pCell ); + const sal_uInt16 nWish = ::lcl_CalcCellFit( pCell ); if ( nWish > nFit ) nFit = nWish; } else - { const USHORT nMin = MINLAY + USHORT(pCell->Frm().Width() - + { const sal_uInt16 nMin = MINLAY + sal_uInt16(pCell->Frm().Width() - pCell->Prt().Width()); if ( !nFit || nMin < nFit ) nFit = nMin; @@ -1453,7 +1445,7 @@ void lcl_CalcColValues( SvUShorts &rToFill, const SwTabCols &rCols, } -void SwDoc::AdjustCellWidth( const SwCursor& rCursor, BOOL bBalance ) +void SwDoc::AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance ) { // pruefe ob vom aktuellen Crsr der Point/Mark in einer Tabelle stehen SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode(); @@ -1478,17 +1470,17 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, BOOL bBalance ) if ( ! aTabCols.Count() ) return; - const BYTE nTmp = (BYTE)Max( USHORT(255), USHORT(aTabCols.Count() + 1) ); + const sal_uInt8 nTmp = (sal_uInt8)Max( sal_uInt16(255), sal_uInt16(aTabCols.Count() + 1) ); SvUShorts aWish( nTmp, nTmp ), aMins( nTmp, nTmp ); - USHORT i; + sal_uInt16 i; for ( i = 0; i <= aTabCols.Count(); ++i ) { - aWish.Insert( USHORT(0), aWish.Count() ); - aMins.Insert( USHORT(0), aMins.Count() ); + aWish.Insert( sal_uInt16(0), aWish.Count() ); + aMins.Insert( sal_uInt16(0), aMins.Count() ); } - ::lcl_CalcColValues( aWish, aTabCols, pStart, pEnd, TRUE ); + ::lcl_CalcColValues( aWish, aTabCols, pStart, pEnd, sal_True ); //Es ist Robuster wenn wir die Min-Werte fuer die ganze Tabelle berechnen. const SwTabFrm *pTab = pStart->ImplFindTabFrm(); @@ -1496,25 +1488,25 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, BOOL bBalance ) pEnd = (SwLayoutFrm*)pTab->FindLastCntnt()->GetUpper(); while( !pEnd->IsCellFrm() ) pEnd = pEnd->GetUpper(); - ::lcl_CalcColValues( aMins, aTabCols, pStart, pEnd, FALSE ); + ::lcl_CalcColValues( aMins, aTabCols, pStart, pEnd, sal_False ); if( bBalance ) { //Alle Spalten, die makiert sind haben jetzt einen Wunschwert //eingtragen. Wir addieren die aktuellen Werte, teilen das Ergebnis //durch die Anzahl und haben eine Wunschwert fuer den ausgleich. - USHORT nWish = 0, nCnt = 0; + sal_uInt16 nWish = 0, nCnt = 0; for ( i = 0; i <= aTabCols.Count(); ++i ) { int nDiff = aWish[i]; if ( nDiff ) { if ( i == 0 ) - nWish = static_cast<USHORT>( nWish + aTabCols[i] - aTabCols.GetLeft() ); + nWish = static_cast<sal_uInt16>( nWish + aTabCols[i] - aTabCols.GetLeft() ); else if ( i == aTabCols.Count() ) - nWish = static_cast<USHORT>(nWish + aTabCols.GetRight() - aTabCols[i-1] ); + nWish = static_cast<sal_uInt16>(nWish + aTabCols.GetRight() - aTabCols[i-1] ); else - nWish = static_cast<USHORT>(nWish + aTabCols[i] - aTabCols[i-1] ); + nWish = static_cast<sal_uInt16>(nWish + aTabCols[i] - aTabCols[i-1] ); ++nCnt; } } @@ -1524,14 +1516,14 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, BOOL bBalance ) aWish[i] = nWish; } - const USHORT nOldRight = static_cast<USHORT>(aTabCols.GetRight()); + const sal_uInt16 nOldRight = static_cast<sal_uInt16>(aTabCols.GetRight()); //Um die Impl. einfach zu gestalten, aber trotzdem in den meissten Faellen //den Platz richtig auszunutzen laufen wir zweimal. //Problem: Erste Spalte wird breiter, die anderen aber erst danach //schmaler. Die Wunschbreite der ersten Spalte wuerde abgelehnt, weil //mit ihr die max. Breite der Tabelle ueberschritten wuerde. - for ( USHORT k= 0; k < 2; ++k ) + for ( sal_uInt16 k= 0; k < 2; ++k ) { for ( i = 0; i <= aTabCols.Count(); ++i ) { @@ -1564,20 +1556,20 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, BOOL bBalance ) nDiff -= nTmpD; nTabRight -= nTmpD; } - for ( USHORT i2 = i; i2 < aTabCols.Count(); ++i2 ) + for ( sal_uInt16 i2 = i; i2 < aTabCols.Count(); ++i2 ) aTabCols[i2] += nDiff; aTabCols.SetRight( nTabRight ); } } } - const USHORT nNewRight = static_cast<USHORT>(aTabCols.GetRight()); + const sal_uInt16 nNewRight = static_cast<sal_uInt16>(aTabCols.GetRight()); SwFrmFmt *pFmt = pTblNd->GetTable().GetFrmFmt(); const sal_Int16 nOriHori = pFmt->GetHoriOrient().GetHoriOrient(); //So, die richtige Arbeit koennen wir jetzt der SwTable ueberlassen. - SetTabCols( aTabCols, FALSE, 0, (SwCellFrm*)pBoxFrm ); + SetTabCols( aTabCols, sal_False, 0, (SwCellFrm*)pBoxFrm ); // i54248: lijian/fme // alignment might have been changed in SetTabCols, restore old value: diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 1eb673f241d4..f8d7170099ee 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -163,7 +163,7 @@ int Put( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, const SwCntntNode& rNo // --> FME 2007-4-12 #i76273# Robust: Save the style name items: SfxItemSet* pStyleNames = 0; - if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, FALSE ) ) + if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, sal_False ) ) { pStyleNames = new SfxItemSet( *aNewSet.GetPool(), RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME ); pStyleNames->Put( aNewSet ); @@ -213,7 +213,7 @@ int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, // --> FME 2007-4-12 #i76273# Robust: Save the style name items: SfxItemSet* pStyleNames = 0; - if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, FALSE ) ) + if ( SFX_ITEM_SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, sal_False ) ) { pStyleNames = new SfxItemSet( *aNewSet.GetPool(), RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME ); pStyleNames->Put( aNewSet ); @@ -241,28 +241,28 @@ int Put_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, return nRet; } -USHORT ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, - const SwCntntNode& rNode, USHORT nWhich, +sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, + const SwCntntNode& rNode, sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew ) { SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet ); if( rNode.GetModifyAtAttr() ) aNewSet.SetModifyAtAttr( &rNode ); - const USHORT nRet = aNewSet.ClearItem_BC( nWhich, pOld, pNew ); + const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich, pOld, pNew ); if ( nRet ) GetNewAutoStyle( mrpAttrSet, rNode, aNewSet ); return nRet; } -USHORT ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, +sal_uInt16 ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, const SwCntntNode& rNode, - USHORT nWhich1, USHORT nWhich2, + sal_uInt16 nWhich1, sal_uInt16 nWhich2, SwAttrSet* pOld, SwAttrSet* pNew ) { SwAttrSet aNewSet( (SwAttrSet&)*mrpAttrSet ); if( rNode.GetModifyAtAttr() ) aNewSet.SetModifyAtAttr( &rNode ); - const USHORT nRet = aNewSet.ClearItem_BC( nWhich1, nWhich2, pOld, pNew ); + const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich1, nWhich2, pOld, pNew ); if ( nRet ) GetNewAutoStyle( mrpAttrSet, rNode, aNewSet ); return nRet; @@ -295,13 +295,13 @@ USHORT ClearItem_BC( boost::shared_ptr<const SfxItemSet>& mrpAttrSet, *******************************************************************/ -USHORT SwNode::GetSectionLevel() const +sal_uInt16 SwNode::GetSectionLevel() const { // EndNode einer Grund-Section ?? diese sind immer 0 !! if( IsEndNode() && 0 == pStartOfSection->StartOfSectionIndex() ) return 0; - USHORT nLevel; + sal_uInt16 nLevel; const SwNode* pNode = IsStartNode() ? this : pStartOfSection; for( nLevel = 1; 0 != pNode->StartOfSectionIndex(); ++nLevel ) pNode = pNode->pStartOfSection; @@ -340,10 +340,10 @@ USHORT SwNode::GetSectionLevel() const long SwNode::nSerial = 0; #endif -SwNode::SwNode( const SwNodeIndex &rWhere, const BYTE nNdType ) +SwNode::SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType ) : nNodeType( nNdType ), pStartOfSection( 0 ) { - bSetNumLSpace = bIgnoreDontExpand = FALSE; + bSetNumLSpace = bIgnoreDontExpand = sal_False; nAFmtNumLvl = 0; SwNodes& rNodes = (SwNodes&)rWhere.GetNodes(); @@ -374,10 +374,10 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const BYTE nNdType ) #endif } -SwNode::SwNode( SwNodes& rNodes, ULONG nPos, const BYTE nNdType ) +SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNdType ) : nNodeType( nNdType ), pStartOfSection( 0 ) { - bSetNumLSpace = bIgnoreDontExpand = FALSE; + bSetNumLSpace = bIgnoreDontExpand = sal_False; nAFmtNumLvl = 0; SwNode* pInsNd = this; // der MAC kann this nicht einfuegen !! @@ -431,9 +431,9 @@ SwTableNode* SwNode::FindTableNode() // liegt der Node im Sichtbarenbereich der Shell ? -BOOL SwNode::IsInVisibleArea( ViewShell* pSh ) const +sal_Bool SwNode::IsInVisibleArea( ViewShell* pSh ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const SwCntntNode* pNd; if( ND_STARTNODE & nNodeType ) @@ -450,7 +450,7 @@ BOOL SwNode::IsInVisibleArea( ViewShell* pSh ) const pNd = GetCntntNode(); const SwFrm* pFrm; - if( pNd && 0 != ( pFrm = pNd->GetFrm( 0, 0, FALSE ) ) ) + if( pNd && 0 != ( pFrm = pNd->GetFrm( 0, 0, sal_False ) ) ) { if( !pSh ) // dann die Shell vom Doc besorgen: @@ -467,14 +467,14 @@ BOOL SwNode::IsInVisibleArea( ViewShell* pSh ) const } while ( pFrm && !pFrm->IsValid() ); if( !pFrm || pSh->VisArea().IsOver( pFrm->Frm() ) ) - bRet = TRUE; + bRet = sal_True; } } return bRet; } -BOOL SwNode::IsInProtectSect() const +sal_Bool SwNode::IsInProtectSect() const { const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this; const SwSectionNode* pSectNd = pNd->FindSectionNode(); @@ -484,12 +484,12 @@ BOOL SwNode::IsInProtectSect() const // befindet sich der Node in irgendetwas geschuetzten ? // (Bereich/Rahmen/Tabellenzellen/... incl. des Ankers bei // Rahmen/Fussnoten/..) -BOOL SwNode::IsProtect() const +sal_Bool SwNode::IsProtect() const { const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this; const SwStartNode* pSttNd = pNd->FindSectionNode(); if( pSttNd && ((SwSectionNode*)pSttNd)->GetSection().IsProtectFlag() ) - return TRUE; + return sal_True; if( 0 != ( pSttNd = FindTableBoxStartNode() ) ) { @@ -501,18 +501,18 @@ BOOL SwNode::IsProtect() const GetTblBox( pSttNd->GetIndex() ); //Robust #149568 if( pBox && pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) - return TRUE; + return sal_True; } SwFrmFmt* pFlyFmt = GetFlyFmt(); if( pFlyFmt ) { if( pFlyFmt->GetProtect().IsCntntProtected() ) - return TRUE; + return sal_True; const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor(); return rAnchor.GetCntntAnchor() ? rAnchor.GetCntntAnchor()->nNode.GetNode().IsProtect() - : FALSE; + : sal_False; } if( 0 != ( pSttNd = FindFootnoteStartNode() ) ) @@ -523,13 +523,13 @@ BOOL SwNode::IsProtect() const return pTFtn->GetTxtNode().IsProtect(); } - return FALSE; + return sal_False; } // suche den PageDesc, mit dem dieser Node formatiert ist. Wenn das // Layout vorhanden ist wird ueber das gesucht, ansonsten gibt es nur // die harte Tour ueber die Nodes nach vorne suchen!! -const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, +const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay, sal_uInt32* pPgDescNdIdx ) const { // OD 18.03.2003 #106329# @@ -587,7 +587,7 @@ const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, // dann erstmal den richtigen Anker finden const SwFrmFmt* pFmt = 0; const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts(); - USHORT n; + sal_uInt16 n; for( n = 0; n < rFmts.Count(); ++n ) { @@ -641,7 +641,7 @@ const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, if( n >= rFmts.Count() ) { ASSERT( !this, "Fly-Section aber kein Format gefunden" ); - return FALSE; + return sal_False; } } } @@ -664,7 +664,7 @@ const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, 0 != ( pSttNd = pNd->FindFooterStartNode() )) { // dann in den PageDescs diesen StartNode suchen - USHORT nId; + sal_uInt16 nId; UseOnPage eAskUse; if( SwHeaderStartNode == pSttNd->GetStartNodeType()) { @@ -677,7 +677,7 @@ const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, eAskUse = nsUseOnPage::PD_FOOTERSHARE; } - for( USHORT n = pDoc->GetPageDescCnt(); n && !pPgDesc; ) + for( sal_uInt16 n = pDoc->GetPageDescCnt(); n && !pPgDesc; ) { const SwPageDesc& rPgDsc = pDoc->GetPageDesc( --n ); const SwFrmFmt* pFmt = &rPgDsc.GetMaster(); @@ -712,7 +712,7 @@ const SwPageDesc* SwNode::FindPageDesc( BOOL bCalcLay, // der Anker kann nur im Bodytext sein const SwTxtFtn* pTxtFtn; const SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs(); - for( USHORT n = 0; n < rFtnArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n ) if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() && (SwNode*)pSttNd == &pTxtFtn->GetStartNode()->GetNode() ) @@ -796,7 +796,7 @@ SwFrmFmt* SwNode::GetFlyFmt() const { // dann gibts noch harten steinigen Weg uebers Dokument: const SwSpzFrmFmts& rFrmFmtTbl = *GetDoc()->GetSpzFrmFmts(); - for( USHORT n = 0; n < rFrmFmtTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFrmFmtTbl.Count(); ++n ) { SwFrmFmt* pFmt = rFrmFmtTbl[n]; const SwFmtCntnt& rCntnt = pFmt->GetCntnt(); @@ -835,21 +835,21 @@ SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) return eTyp == pTmp->GetStartNodeType() ? pTmp : 0; } -const SwTxtNode* SwNode::FindOutlineNodeOfLevel( BYTE nLvl ) const +const SwTxtNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const { const SwTxtNode* pRet = 0; const SwOutlineNodes& rONds = GetNodes().GetOutLineNds(); if( MAXLEVEL > nLvl && rONds.Count() ) { - USHORT nPos; + sal_uInt16 nPos; SwNode* pNd = (SwNode*)this; - BOOL bCheckFirst = FALSE; + sal_Bool bCheckFirst = sal_False; if( !rONds.Seek_Entry( pNd, &nPos )) { if( nPos ) nPos = nPos-1; else - bCheckFirst = TRUE; + bCheckFirst = sal_True; } if( bCheckFirst ) @@ -862,8 +862,8 @@ const SwTxtNode* SwNode::FindOutlineNodeOfLevel( BYTE nLvl ) const const SwCntntNode* pCNd = GetCntntNode(); Point aPt( 0, 0 ); - const SwFrm* pFrm = pRet->GetFrm( &aPt, 0, FALSE ), - * pMyFrm = pCNd ? pCNd->GetFrm( &aPt, 0, FALSE ) : 0; + const SwFrm* pFrm = pRet->GetFrm( &aPt, 0, sal_False ), + * pMyFrm = pCNd ? pCNd->GetFrm( &aPt, 0, sal_False ) : 0; const SwPageFrm* pPgFrm = pFrm ? pFrm->FindPageFrm() : 0; if( pPgFrm && pMyFrm && pPgFrm->Frm().Top() > pMyFrm->Frm().Top() ) @@ -896,11 +896,11 @@ inline sal_Bool IsValidNextPrevNd( const SwNode& rNd ) ND_TABLENODE == rNd.StartOfSectionNode()->GetNodeType() ); } -BYTE SwNode::HasPrevNextLayNode() const +sal_uInt8 SwNode::HasPrevNextLayNode() const { // assumption: <this> node is a node inside the document nodes array section. - BYTE nRet = 0; + sal_uInt8 nRet = 0; if( IsValidNextPrevNd( *this )) { SwNodeIndex aIdx( *this, -1 ); @@ -952,7 +952,7 @@ BYTE SwNode::HasPrevNextLayNode() const *******************************************************************/ -SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const BYTE nNdType, +SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType, SwStartNodeType eSttNd ) : SwNode( rWhere, nNdType ), eSttNdTyp( eSttNd ) { @@ -960,7 +960,7 @@ SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const BYTE nNdType, pEndOfSection = (SwEndNode*)this; } -SwStartNode::SwStartNode( SwNodes& rNodes, ULONG nPos ) +SwStartNode::SwStartNode( SwNodes& rNodes, sal_uLong nPos ) : SwNode( rNodes, nPos, ND_STARTNODE ), eSttNdTyp( SwNormalStartNode ) { // erstmal temporaer, bis der EndNode eingefuegt wird. @@ -972,7 +972,7 @@ void SwStartNode::CheckSectionCondColl() const { //FEATURE::CONDCOLL SwNodeIndex aIdx( *this ); - ULONG nEndIdx = EndOfSectionIndex(); + sal_uLong nEndIdx = EndOfSectionIndex(); const SwNodes& rNds = GetNodes(); SwCntntNode* pCNd; while( 0 != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx ) @@ -1018,7 +1018,7 @@ SwEndNode::SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd ) pStartOfSection->pEndOfSection = this; } -SwEndNode::SwEndNode( SwNodes& rNds, ULONG nPos, SwStartNode& rSttNd ) +SwEndNode::SwEndNode( SwNodes& rNds, sal_uLong nPos, SwStartNode& rSttNd ) : SwNode( rNds, nPos, ND_ENDNODE ) { pStartOfSection = &rSttNd; @@ -1032,7 +1032,7 @@ SwEndNode::SwEndNode( SwNodes& rNds, ULONG nPos, SwStartNode& rSttNd ) // -------------------- -SwCntntNode::SwCntntNode( const SwNodeIndex &rWhere, const BYTE nNdType, +SwCntntNode::SwCntntNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType, SwFmtColl *pColl ) : SwModify( pColl ), // CrsrsShell, FrameFmt, SwNode( rWhere, nNdType ), @@ -1062,7 +1062,7 @@ SwCntntNode::~SwCntntNode() void SwCntntNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) { - USHORT nWhich = pOldValue ? pOldValue->Which() : + sal_uInt16 nWhich = pOldValue ? pOldValue->Which() : pNewValue ? pNewValue->Which() : 0 ; switch( nWhich ) @@ -1119,7 +1119,7 @@ void SwCntntNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) if( GetNodes().IsDocNodes() && IsTxtNode() ) { if( SFX_ITEM_SET == ((SwAttrSetChg*)pOldValue)->GetChgSet()->GetItemState( - RES_CHRATR_HIDDEN, FALSE ) ) + RES_CHRATR_HIDDEN, sal_False ) ) { ((SwTxtNode*)this)->SetCalcHiddenCharFlags(); } @@ -1129,7 +1129,7 @@ void SwCntntNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) case RES_UPDATE_ATTR: if( GetNodes().IsDocNodes() && IsTxtNode() ) { - const USHORT nTmp = ((SwUpdateAttr*)pNewValue)->nWhichAttr; + const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->nWhichAttr; if ( RES_ATTRSET_CHG == nTmp ) { // anybody wants to do some optimization here? @@ -1142,17 +1142,17 @@ void SwCntntNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) SwModify::Modify( pOldValue, pNewValue ); } -BOOL SwCntntNode::InvalidateNumRule() +sal_Bool SwCntntNode::InvalidateNumRule() { SwNumRule* pRule = 0; const SfxPoolItem* pItem; if( GetNodes().IsDocNodes() && - 0 != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, TRUE )) && + 0 != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, sal_True )) && ((SwNumRuleItem*)pItem)->GetValue().Len() && 0 != (pRule = GetDoc()->FindNumRulePtr( ((SwNumRuleItem*)pItem)->GetValue() ) ) ) { - pRule->SetInvalidRule( TRUE ); + pRule->SetInvalidRule( sal_True ); } return 0 != pRule; } @@ -1160,14 +1160,14 @@ BOOL SwCntntNode::InvalidateNumRule() SwCntntFrm *SwCntntNode::GetFrm( const Point* pPoint, const SwPosition *pPos, - const BOOL bCalcFrm ) const + const sal_Bool bCalcFrm ) const { return (SwCntntFrm*) ::GetFrmOfModify( *(SwModify*)this, FRM_CNTNT, pPoint, pPos, bCalcFrm ); } -SwRect SwCntntNode::FindLayoutRect( const BOOL bPrtArea, const Point* pPoint, - const BOOL bCalcFrm ) const +SwRect SwCntntNode::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint, + const sal_Bool bCalcFrm ) const { SwRect aRet; SwCntntFrm* pFrm = (SwCntntFrm*)::GetFrmOfModify( *(SwModify*)this, @@ -1177,8 +1177,8 @@ SwRect SwCntntNode::FindLayoutRect( const BOOL bPrtArea, const Point* pPoint, return aRet; } -SwRect SwCntntNode::FindPageFrmRect( const BOOL bPrtArea, const Point* pPoint, - const BOOL bCalcFrm ) const +SwRect SwCntntNode::FindPageFrmRect( const sal_Bool bPrtArea, const Point* pPoint, + const sal_Bool bCalcFrm ) const { SwRect aRet; SwFrm* pFrm = ::GetFrmOfModify( *(SwModify*)this, @@ -1209,7 +1209,7 @@ SwFmtColl *SwCntntNode::ChgFmtColl( SwFmtColl *pNewColl ) //FEATURE::CONDCOLL // HACK: hier muss die entsprechend der neuen Vorlage die Bedingungen // neu ueberprueft werden! - if( TRUE /*pNewColl */ ) + if( sal_True /*pNewColl */ ) { SetCondFmtColl( 0 ); } @@ -1227,15 +1227,15 @@ SwFmtColl *SwCntntNode::ChgFmtColl( SwFmtColl *pNewColl ) if ( IsInCache() ) { SwFrm::GetCache().Delete( this ); - SetInCache( FALSE ); + SetInCache( sal_False ); } return pOldColl; } -BOOL SwCntntNode::GoNext(SwIndex * pIdx, USHORT nMode ) const +sal_Bool SwCntntNode::GoNext(SwIndex * pIdx, sal_uInt16 nMode ) const { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( pIdx->GetIndex() < Len() ) { if( !IsTxtNode() ) @@ -1267,23 +1267,23 @@ BOOL SwCntntNode::GoNext(SwIndex * pIdx, USHORT nMode ) const if( 1 == nDone ) *pIdx = nPos; else - bRet = FALSE; + bRet = sal_False; } else if( nPos < rTNd.GetTxt().Len() ) (*pIdx)++; else - bRet = FALSE; + bRet = sal_False; } } else - bRet = FALSE; + bRet = sal_False; return bRet; } -BOOL SwCntntNode::GoPrevious(SwIndex * pIdx, USHORT nMode ) const +sal_Bool SwCntntNode::GoPrevious(SwIndex * pIdx, sal_uInt16 nMode ) const { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( pIdx->GetIndex() > 0 ) { if( !IsTxtNode() ) @@ -1315,16 +1315,16 @@ BOOL SwCntntNode::GoPrevious(SwIndex * pIdx, USHORT nMode ) const if( 1 == nDone ) *pIdx = nPos; else - bRet = FALSE; + bRet = sal_False; } else if( nPos ) (*pIdx)--; else - bRet = FALSE; + bRet = sal_False; } } else - bRet = FALSE; + bRet = sal_False; return bRet; } @@ -1416,7 +1416,7 @@ void SwCntntNode::DelFrms() { SwCntntFrm* pMaster = (SwTxtFrm*)pFrm->FindMaster(); pMaster->SetFollow( pFrm->GetFollow() ); - pFrm->_SetIsFollow( FALSE ); + pFrm->_SetIsFollow( sal_False ); } pFrm->SetFollow( 0 );//Damit er nicht auf dumme Gedanken kommt. //Andernfalls kann es sein, dass ein Follow @@ -1472,7 +1472,7 @@ SwCntntNode *SwCntntNode::JoinPrev() // erfrage vom Modify Informationen -BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const +sal_Bool SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const { switch( rInfo.Which() ) { @@ -1480,7 +1480,7 @@ BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const if( &GetNodes() == ((SwAutoFmtGetDocNode&)rInfo).pNodes ) { ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = this; - return FALSE; + return sal_False; } break; // --> OD 2008-02-19 #refactorlists# @@ -1489,7 +1489,7 @@ BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const // if( IsTxtNode()) // { // SwTxtNode * pTxtNode = (SwTxtNode*)this; -// pItem = (SwNumRuleItem*)GetNoCondAttr(RES_PARATR_NUMRULE, TRUE ); +// pItem = (SwNumRuleItem*)GetNoCondAttr(RES_PARATR_NUMRULE, sal_True ); // if (0 != pItem && // pItem->GetValue().Len() && @@ -1500,20 +1500,20 @@ BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const // } // } -// return TRUE; +// return sal_True; // <-- case RES_FINDNEARESTNODE: if( ((SwFmtPageDesc&)GetAttr( RES_PAGEDESC )).GetPageDesc() ) ((SwFindNearestNode&)rInfo).CheckNode( *this ); - return TRUE; + return sal_True; case RES_CONTENT_VISIBLE: { ((SwPtrMsgPoolItem&)rInfo).pObject = SwClientIter( *(SwCntntNode*)this ).First( TYPE(SwFrm) ); } - return FALSE; + return sal_False; } return SwModify::GetInfo( rInfo ); @@ -1521,7 +1521,7 @@ BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const // setze ein Attribut -BOOL SwCntntNode::SetAttr(const SfxPoolItem& rAttr ) +sal_Bool SwCntntNode::SetAttr(const SfxPoolItem& rAttr ) { if( !GetpSwAttrSet() ) // lasse von den entsprechenden Nodes die NewAttrSet( GetDoc()->GetAttrPool() ); // AttrSets anlegen @@ -1531,10 +1531,10 @@ BOOL SwCntntNode::SetAttr(const SfxPoolItem& rAttr ) if ( IsInCache() ) { SwFrm::GetCache().Delete( this ); - SetInCache( FALSE ); + SetInCache( sal_False ); } - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // wenn Modify gelockt ist, werden keine Modifies verschickt if( IsModifyLocked() || ( !GetDepends() && RES_PARATR_NUMRULE != rAttr.Which() )) @@ -1556,16 +1556,16 @@ BOOL SwCntntNode::SetAttr(const SfxPoolItem& rAttr ) } #include <svl/itemiter.hxx> -BOOL SwCntntNode::SetAttr( const SfxItemSet& rSet ) +sal_Bool SwCntntNode::SetAttr( const SfxItemSet& rSet ) { if ( IsInCache() ) { SwFrm::GetCache().Delete( this ); - SetInCache( FALSE ); + SetInCache( sal_False ); } const SfxPoolItem* pFnd = 0; - if( SFX_ITEM_SET == rSet.GetItemState( RES_AUTO_STYLE, FALSE, &pFnd ) ) + if( SFX_ITEM_SET == rSet.GetItemState( RES_AUTO_STYLE, sal_False, &pFnd ) ) { ASSERT( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" ); const SwFmtAutoFmt* pTmp = static_cast<const SwFmtAutoFmt*>(pFnd); @@ -1594,24 +1594,24 @@ BOOL SwCntntNode::SetAttr( const SfxItemSet& rSet ) // the string is empty. const SfxPoolItem* pNameItem = 0; if ( 0 != GetCondFmtColl() || - SFX_ITEM_SET != mpAttrSet->GetItemState( RES_FRMATR_STYLE_NAME, FALSE, &pNameItem ) || + SFX_ITEM_SET != mpAttrSet->GetItemState( RES_FRMATR_STYLE_NAME, sal_False, &pNameItem ) || 0 == static_cast<const SfxStringItem*>(pNameItem)->GetValue().Len() ) AttrSetHandleHelper::SetParent( mpAttrSet, *this, &GetAnyFmtColl(), GetFmtColl() ); else const_cast<SfxItemSet*>(mpAttrSet.get())->SetParent( &GetFmtColl()->GetAttrSet() ); } - return TRUE; + return sal_True; } if( !GetpSwAttrSet() ) // lasse von den entsprechenden Nodes die NewAttrSet( GetDoc()->GetAttrPool() ); // AttrSets anlegen - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // wenn Modify gelockt ist, werden keine Modifies verschickt if ( IsModifyLocked() || ( !GetDepends() && - SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_NUMRULE, FALSE ) ) ) + SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_NUMRULE, sal_False ) ) ) { // einige Sonderbehandlungen fuer Attribute bRet = 0 != AttrSetHandleHelper::Put( mpAttrSet, *this, rSet ); @@ -1634,24 +1634,24 @@ BOOL SwCntntNode::SetAttr( const SfxItemSet& rSet ) // Nimmt den Hint mit nWhich aus dem Delta-Array -BOOL SwCntntNode::ResetAttr( USHORT nWhich1, USHORT nWhich2 ) +sal_Bool SwCntntNode::ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 ) { if( !GetpSwAttrSet() ) - return FALSE; + return sal_False; if ( IsInCache() ) { SwFrm::GetCache().Delete( this ); - SetInCache( FALSE ); + SetInCache( sal_False ); } // wenn Modify gelockt ist, werden keine Modifies verschickt if( IsModifyLocked() ) { - USHORT nDel = 0; + sal_uInt16 nDel = 0; if ( !nWhich2 || nWhich2 < nWhich1 ) { - std::vector<USHORT> aClearWhichIds; + std::vector<sal_uInt16> aClearWhichIds; aClearWhichIds.push_back( nWhich1 ); nDel = ClearItemsFromAttrSet( aClearWhichIds ); } @@ -1669,7 +1669,7 @@ BOOL SwCntntNode::ResetAttr( USHORT nWhich1, USHORT nWhich2 ) SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ), aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ); - BOOL bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew ); + sal_Bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew ); if( bRet ) { @@ -1682,23 +1682,23 @@ BOOL SwCntntNode::ResetAttr( USHORT nWhich1, USHORT nWhich2 ) } return bRet; } -BOOL SwCntntNode::ResetAttr( const SvUShorts& rWhichArr ) +sal_Bool SwCntntNode::ResetAttr( const SvUShorts& rWhichArr ) { if( !GetpSwAttrSet() ) - return FALSE; + return sal_False; if ( IsInCache() ) { SwFrm::GetCache().Delete( this ); - SetInCache( FALSE ); + SetInCache( sal_False ); } // wenn Modify gelockt ist, werden keine Modifies verschickt - USHORT nDel = 0; + sal_uInt16 nDel = 0; if( IsModifyLocked() ) { - std::vector<USHORT> aClearWhichIds; - for( USHORT n = 0, nEnd = rWhichArr.Count(); n < nEnd; ++n ) + std::vector<sal_uInt16> aClearWhichIds; + for( sal_uInt16 n = 0, nEnd = rWhichArr.Count(); n < nEnd; ++n ) aClearWhichIds.push_back( rWhichArr[ n ] ); nDel = ClearItemsFromAttrSet( aClearWhichIds ); @@ -1708,7 +1708,7 @@ BOOL SwCntntNode::ResetAttr( const SvUShorts& rWhichArr ) SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ), aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ); - for( USHORT n = 0, nEnd = rWhichArr.Count(); n < nEnd; ++n ) + for( sal_uInt16 n = 0, nEnd = rWhichArr.Count(); n < nEnd; ++n ) if( AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, rWhichArr[ n ], &aOld, &aNew )) ++nDel; @@ -1725,7 +1725,7 @@ BOOL SwCntntNode::ResetAttr( const SvUShorts& rWhichArr ) } -USHORT SwCntntNode::ResetAllAttr() +sal_uInt16 SwCntntNode::ResetAllAttr() { if( !GetpSwAttrSet() ) return 0; @@ -1733,15 +1733,15 @@ USHORT SwCntntNode::ResetAllAttr() if ( IsInCache() ) { SwFrm::GetCache().Delete( this ); - SetInCache( FALSE ); + SetInCache( sal_False ); } // wenn Modify gelockt ist, werden keine Modifies verschickt if( IsModifyLocked() ) { - std::vector<USHORT> aClearWhichIds; + std::vector<sal_uInt16> aClearWhichIds; aClearWhichIds.push_back(0); - USHORT nDel = ClearItemsFromAttrSet( aClearWhichIds ); + sal_uInt16 nDel = ClearItemsFromAttrSet( aClearWhichIds ); if( !GetpSwAttrSet()->Count() ) // leer, dann loeschen mpAttrSet.reset(); // DELETEZ( mpAttrSet ); return nDel; @@ -1749,7 +1749,7 @@ USHORT SwCntntNode::ResetAllAttr() SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ), aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ); - BOOL bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew ); + sal_Bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew ); if( bRet ) { @@ -1764,28 +1764,28 @@ USHORT SwCntntNode::ResetAllAttr() } -BOOL SwCntntNode::GetAttr( SfxItemSet& rSet, BOOL bInParent ) const +sal_Bool SwCntntNode::GetAttr( SfxItemSet& rSet, sal_Bool bInParent ) const { if( rSet.Count() ) rSet.ClearItem(); const SwAttrSet& rAttrSet = GetSwAttrSet(); if( bInParent ) - return rSet.Set( rAttrSet, TRUE ) ? TRUE : FALSE; + return rSet.Set( rAttrSet, sal_True ) ? sal_True : sal_False; rSet.Put( rAttrSet ); - return rSet.Count() ? TRUE : FALSE; + return rSet.Count() ? sal_True : sal_False; } -USHORT SwCntntNode::ClearItemsFromAttrSet( const std::vector<USHORT>& rWhichIds ) +sal_uInt16 SwCntntNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds ) { - USHORT nRet = 0; + sal_uInt16 nRet = 0; if ( 0 == rWhichIds.size() ) return nRet; ASSERT( GetpSwAttrSet(), "no item set" ) SwAttrSet aNewAttrSet( *GetpSwAttrSet() ); - for ( std::vector<USHORT>::const_iterator aIter = rWhichIds.begin(); + for ( std::vector<sal_uInt16>::const_iterator aIter = rWhichIds.begin(); aIter != rWhichIds.end(); ++aIter ) { @@ -1797,14 +1797,14 @@ USHORT SwCntntNode::ClearItemsFromAttrSet( const std::vector<USHORT>& rWhichIds return nRet; } -const SfxPoolItem* SwCntntNode::GetNoCondAttr( USHORT nWhich, - BOOL bInParents ) const +const SfxPoolItem* SwCntntNode::GetNoCondAttr( sal_uInt16 nWhich, + sal_Bool bInParents ) const { const SfxPoolItem* pFnd = 0; if( pCondColl && pCondColl->GetRegisteredIn() ) { if( !GetpSwAttrSet() || ( SFX_ITEM_SET != GetpSwAttrSet()->GetItemState( - nWhich, FALSE, &pFnd ) && bInParents )) + nWhich, sal_False, &pFnd ) && bInParents )) ((SwFmt*)GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd ); } // --> OD 2005-10-25 #126347# - undo change of issue #i51029# @@ -1824,7 +1824,7 @@ const SfxPoolItem* SwCntntNode::GetNoCondAttr( USHORT nWhich, int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const { const SwNodes& rNds = GetNodes(); - BYTE nNdType = GetNodeType(); + sal_uInt8 nNdType = GetNodeType(); SwNodeIndex aIdx( *this, 1 ); const SwNode* pNd = this; @@ -1834,7 +1834,7 @@ int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const aIdx++; if( pNd->GetNodeType() != nNdType || rNds.Count()-1 == aIdx.GetIndex() ) - return FALSE; + return sal_False; if( IsTxtNode() ) { // Do not merge strings if the result exceeds the allowed string length const SwTxtNode* pTxtNd = static_cast<const SwTxtNode*>(this); @@ -1842,11 +1842,11 @@ int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const pTxtNd = static_cast<const SwTxtNode*>(pNd); nSum += pTxtNd->GetTxt().Len(); if( nSum > STRING_LEN ) - return FALSE; + return sal_False; } if( pIdx ) *pIdx = aIdx; - return TRUE; + return sal_True; } @@ -1854,7 +1854,7 @@ int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const // in pIdx kann die 2. Position returnt werden. int SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const { - BYTE nNdType = GetNodeType(); + sal_uInt8 nNdType = GetNodeType(); SwNodeIndex aIdx( *this, -1 ); const SwNode* pNd = this; @@ -1864,10 +1864,10 @@ int SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const aIdx--; if( pNd->GetNodeType() != nNdType || 0 == aIdx.GetIndex() ) - return FALSE; + return sal_False; if( pIdx ) *pIdx = aIdx; - return TRUE; + return sal_True; } @@ -1900,13 +1900,13 @@ void SwCntntNode::SetCondFmtColl( SwFmtColl* pColl ) if( IsInCache() ) { SwFrm::GetCache().Delete( this ); - SetInCache( FALSE ); + SetInCache( sal_False ); } } } -BOOL SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const +sal_Bool SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const { const SwNodes& rNds = GetNodes(); { @@ -1941,7 +1941,7 @@ BOOL SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const const SwTxtFtn* pTxtFtn; const SwNode* pSrchNd = pSttNd; - for( USHORT n = 0; n < rFtnArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n ) if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() && pSrchNd == &pTxtFtn->GetStartNode()->GetNode() ) { @@ -1960,7 +1960,7 @@ BOOL SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const if( nCond ) { rTmp.SetCondition( (Master_CollConditions)nCond, 0 ); - return TRUE; + return sal_True; } pSttNd = pSttNd->GetIndex() ? pSttNd->StartOfSectionNode() @@ -1969,7 +1969,7 @@ BOOL SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const } { - USHORT nPos; + sal_uInt16 nPos; const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds(); if( rOutlNds.Count() ) { @@ -1983,13 +1983,13 @@ BOOL SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const if( pOutlNd->IsOutline()) { rTmp.SetCondition( PARA_IN_OUTLINE, pOutlNd->GetAttrOutlineLevel() - 1 ); - return TRUE; + return sal_True; } } } } - return FALSE; + return sal_False; } @@ -2049,7 +2049,7 @@ short SwCntntNode::GetTextDirection( const SwPosition& rPos, // --> OD 2007-01-10 #i72024# // No format of the frame, because this can cause recursive layout actions - SwFrm* pFrm = GetFrm( &aPt, &rPos, FALSE ); + SwFrm* pFrm = GetFrm( &aPt, &rPos, sal_False ); // <-- if ( pFrm ) @@ -2114,10 +2114,10 @@ IDocumentListItems& SwNode::getIDocumentListItems() } // <-- -BOOL SwNode::IsInRedlines() const +sal_Bool SwNode::IsInRedlines() const { const SwDoc * pDoc = GetDoc(); - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; if (pDoc != NULL) bResult = pDoc->IsInRedlines(*this); diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index cce0919e1e1a..ca80bc391c7a 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -51,34 +51,34 @@ class SwNode2LayImpl { SwClientIter *pIter; // Der eigentliche Iterator SvPtrarr *pUpperFrms;// Zum Einsammeln der Upper - ULONG nIndex; // Der Index des einzufuegenden Nodes - BOOL bMaster : 1; // TRUE => nur Master , FALSE => nur Frames ohne Follow - BOOL bInit : 1; // Ist am SwClient bereits ein First()-Aufruf erfolgt? + sal_uLong nIndex; // Der Index des einzufuegenden Nodes + sal_Bool bMaster : 1; // sal_True => nur Master , sal_False => nur Frames ohne Follow + sal_Bool bInit : 1; // Ist am SwClient bereits ein First()-Aufruf erfolgt? public: - SwNode2LayImpl( const SwNode& rNode, ULONG nIdx, BOOL bSearch ); + SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, sal_Bool bSearch ); ~SwNode2LayImpl() { delete pIter; delete pUpperFrms; } SwFrm* NextFrm(); // liefert den naechsten "sinnvollen" Frame SwLayoutFrm* UpperFrm( SwFrm* &rpFrm, const SwNode &rNode ); void SaveUpperFrms(); // Speichert (und lockt ggf.) die pUpper // Fuegt unter jeden pUpper des Arrays einen Frame ein. - void RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ); + void RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd ); SwFrm* GetFrm( const Point* pDocPos = 0, const SwPosition *pPos = 0, - const BOOL bCalcFrm = TRUE ) const; + const sal_Bool bCalcFrm = sal_True ) const; }; /* -----------------25.02.99 10:38------------------- * Hauptaufgabe des Ctor: Das richtige SwModify zu ermitteln, * ueber das iteriert wird. - * Uebergibt man bSearch == TRUE, so wird der naechste Cntnt- oder TableNode + * Uebergibt man bSearch == sal_True, so wird der naechste Cntnt- oder TableNode * gesucht, der Frames besitzt ( zum Einsammeln der pUpper ), ansonsten wird * erwartet, das rNode bereits auf einem solchen Cntnt- oder TableNode sitzt, * vor oder hinter den eingefuegt werden soll. * --------------------------------------------------*/ -SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, ULONG nIdx, BOOL bSearch ) - : pUpperFrms( NULL ), nIndex( nIdx ), bInit( FALSE ) +SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, sal_Bool bSearch ) + : pUpperFrms( NULL ), nIndex( nIdx ), bInit( sal_False ) { const SwNode* pNd; if( bSearch || rNode.IsSectionNode() ) @@ -91,13 +91,13 @@ SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, ULONG nIdx, BOOL bSearch ) pNd = rNode.GetNodes().GoPreviousWithFrm( &aTmp ); if( !bSearch && pNd && rNode.GetIndex() > pNd->GetIndex() ) pNd = NULL; // Nicht ueber den Bereich hinausschiessen - bMaster = FALSE; + bMaster = sal_False; } else { SwNodeIndex aTmp( rNode, -1 ); pNd = rNode.GetNodes().GoNextWithFrm( &aTmp ); - bMaster = TRUE; + bMaster = sal_True; if( !bSearch && pNd && rNode.EndOfSectionIndex() < pNd->GetIndex() ) pNd = NULL; // Nicht ueber den Bereich hinausschiessen } @@ -138,11 +138,11 @@ SwFrm* SwNode2LayImpl::NextFrm() { SwFrm* pRet; if( !pIter ) - return FALSE; + return sal_False; if( !bInit ) { pRet = (SwFrm*)pIter->First(TYPE(SwFrm)); - bInit = TRUE; + bInit = sal_True; } else pRet = (SwFrm*)pIter->Next(); @@ -277,19 +277,19 @@ SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode ) return pUpper; } -void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) +void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd ) { ASSERT( pUpperFrms, "RestoreUpper without SaveUpper?" ) SwNode* pNd; SwDoc *pDoc = rNds.GetDoc(); - BOOL bFirst = TRUE; + sal_Bool bFirst = sal_True; for( ; nStt < nEnd; ++nStt ) { SwFrm* pNew = 0; SwFrm* pNxt; SwLayoutFrm* pUp; if( (pNd = rNds[nStt])->IsCntntNode() ) - for( USHORT n = 0; n < pUpperFrms->Count(); ) + for( sal_uInt16 n = 0; n < pUpperFrms->Count(); ) { pNxt = (SwFrm*)(*pUpperFrms)[n++]; if( bFirst && pNxt && pNxt->IsSctFrm() ) @@ -304,7 +304,7 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) (*pUpperFrms)[n-2] = pNew; } else if( pNd->IsTableNode() ) - for( USHORT x = 0; x < pUpperFrms->Count(); ) + for( sal_uInt16 x = 0; x < pUpperFrms->Count(); ) { pNxt = (SwFrm*)(*pUpperFrms)[x++]; if( bFirst && pNxt && pNxt->IsSctFrm() ) @@ -323,21 +323,21 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) else if( pNd->IsSectionNode() ) { nStt = pNd->EndOfSectionIndex(); - for( USHORT x = 0; x < pUpperFrms->Count(); ) + for( sal_uInt16 x = 0; x < pUpperFrms->Count(); ) { pNxt = (SwFrm*)(*pUpperFrms)[x++]; if( bFirst && pNxt && pNxt->IsSctFrm() ) ((SwSectionFrm*)pNxt)->UnlockJoin(); pUp = (SwLayoutFrm*)(*pUpperFrms)[x++]; ASSERT( pUp->GetUpper() || pUp->IsFlyFrm(), "Lost Upper" ); - ::_InsertCnt( pUp, pDoc, pNd->GetIndex(), FALSE, nStt+1, pNxt ); + ::_InsertCnt( pUp, pDoc, pNd->GetIndex(), sal_False, nStt+1, pNxt ); pNxt = pUp->GetLastLower(); (*pUpperFrms)[x-2] = pNxt; } } - bFirst = FALSE; + bFirst = sal_False; } - for( USHORT x = 0; x < pUpperFrms->Count(); ++x ) + for( sal_uInt16 x = 0; x < pUpperFrms->Count(); ++x ) { SwFrm* pTmp = (SwFrm*)(*pUpperFrms)[++x]; if( pTmp->IsFtnFrm() ) @@ -356,25 +356,25 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) SwFrm* SwNode2LayImpl::GetFrm( const Point* pDocPos, const SwPosition *pPos, - const BOOL bCalcFrm ) const + const sal_Bool bCalcFrm ) const { return pIter ? ::GetFrmOfModify( pIter->GetModify(), USHRT_MAX, pDocPos, pPos, bCalcFrm ) : 0; } -SwNode2Layout::SwNode2Layout( const SwNode& rNd, ULONG nIdx ) +SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx ) { - pImpl = new SwNode2LayImpl( rNd, nIdx, FALSE ); + pImpl = new SwNode2LayImpl( rNd, nIdx, sal_False ); } SwNode2Layout::SwNode2Layout( const SwNode& rNd ) { - pImpl = new SwNode2LayImpl( rNd, rNd.GetIndex(), TRUE ); + pImpl = new SwNode2LayImpl( rNd, rNd.GetIndex(), sal_True ); pImpl->SaveUpperFrms(); } -void SwNode2Layout::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ) +void SwNode2Layout::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd ) { ASSERT( pImpl, "RestoreUpperFrms without SaveUpperFrms" ); pImpl->RestoreUpperFrms( rNds, nStt, nEnd ); @@ -397,7 +397,7 @@ SwNode2Layout::~SwNode2Layout() SwFrm* SwNode2Layout::GetFrm( const Point* pDocPos, const SwPosition *pPos, - const BOOL bCalcFrm ) const + const sal_Bool bCalcFrm ) const { return pImpl->GetFrm( pDocPos, pPos, bCalcFrm ); } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 1d387df76063..5ef2df851e17 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -29,8 +29,10 @@ #include "precompiled_sw.hxx" #include <stdlib.h> + #include <node.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <txtfld.hxx> #include <fmtfld.hxx> @@ -50,8 +52,8 @@ #include <docsh.hxx> #include <svl/smplhint.hxx> -extern BOOL CheckNodesRange( const SwNodeIndex& rStt, - const SwNodeIndex& rEnd, BOOL bChkSection ); +extern sal_Bool CheckNodesRange( const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, sal_Bool bChkSection ); SV_DECL_PTRARR(SwSttNdPtrs,SwStartNode*,2,2) @@ -64,7 +66,7 @@ SV_DECL_PTRARR(SwSttNdPtrs,SwStartNode*,2,2) // Funktion zum bestimmen des hoechsten Levels innerhalb des Bereiches -USHORT HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange ); +sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange ); //----------------------------------------------------------------------- @@ -78,11 +80,11 @@ USHORT HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange ); SwNodes::SwNodes( SwDoc* pDocument ) : pRoot( 0 ), pMyDoc( pDocument ) { - bInNodesDel = bInDelUpdOutl = bInDelUpdNum = FALSE; + bInNodesDel = bInDelUpdOutl = bInDelUpdNum = sal_False; ASSERT( pMyDoc, "in welchem Doc stehe ich denn?" ); - ULONG nPos = 0; + sal_uLong nPos = 0; SwStartNode* pSttNd = new SwStartNode( *this, nPos++ ); pEndOfPostIts = new SwEndNode( *this, nPos++, *pSttNd ); @@ -129,7 +131,7 @@ SwNodes::~SwNodes() { SwNode *pNode; SwNodeIndex aNdIdx( *this ); - while( TRUE ) + while( sal_True ) { pNode = &aNdIdx.GetNode(); if( pNode == pEndOfContent ) @@ -144,8 +146,8 @@ SwNodes::~SwNodes() delete pEndOfContent; } -void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, - SwNodeIndex& rInsPos, BOOL bNewFrms ) +void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, + SwNodeIndex& rInsPos, sal_Bool bNewFrms ) { // im UndoBereich brauchen wir keine Frames SwNodes& rNds = rInsPos.GetNodes(); @@ -153,13 +155,13 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, //JP 03.02.99: alle Felder als invalide erklaeren, aktu. erfolgt im // Idle-Handler des Docs - if( GetDoc()->SetFieldsDirty( TRUE, &rDelPos.GetNode(), nSz ) && + if( GetDoc()->SetFieldsDirty( sal_True, &rDelPos.GetNode(), nSz ) && rNds.GetDoc() != GetDoc() ) rNds.GetDoc()->SetFieldsDirty( true, NULL, 0 ); //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen - ULONG nNd = rInsPos.GetIndex(); - BOOL bInsOutlineIdx = !( + sal_uLong nNd = rInsPos.GetIndex(); + sal_Bool bInsOutlineIdx = !( rNds.GetEndOfRedlines().StartOfSectionNode()->GetIndex() < nNd && nNd < rNds.GetEndOfRedlines().GetIndex() ); @@ -167,9 +169,9 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, { // wird von vorne nach hinten gemovt, so wird nach vorne immer // nachgeschoben, d.H. die Loeschposition ist immer gleich - USHORT nDiff = rDelPos.GetIndex() < rInsPos.GetIndex() ? 0 : 1; + sal_uInt16 nDiff = rDelPos.GetIndex() < rInsPos.GetIndex() ? 0 : 1; - for( ULONG n = rDelPos.GetIndex(); nSz; n += nDiff, --nSz ) + for( sal_uLong n = rDelPos.GetIndex(); nSz; n += nDiff, --nSz ) { SwNodeIndex aDelIdx( *this, n ); SwNode& rNd = aDelIdx.GetNode(); @@ -226,15 +228,18 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, } else { - int bSavePersData = GetDoc()->GetUndoNds() == &rNds; - int bRestPersData = GetDoc()->GetUndoNds() == this; + bool bSavePersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds)); + bool bRestPersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this)); SwDoc* pDestDoc = rNds.GetDoc() != GetDoc() ? rNds.GetDoc() : 0; + OSL_ENSURE(!pDestDoc, "SwNodes::ChgNode(): " + "the code to handle text fields here looks broken\n" + "if the target is in a different document."); if( !bRestPersData && !bSavePersData && pDestDoc ) - bSavePersData = bRestPersData = TRUE; + bSavePersData = bRestPersData = sal_True; String sNumRule; SwNodeIndex aInsPos( rInsPos ); - for( ULONG n = 0; n < nSz; n++ ) + for( sal_uLong n = 0; n < nSz; n++ ) { SwNode* pNd = &rDelPos.GetNode(); @@ -262,7 +267,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, sNumRule = pNumRule->GetName(); SwNumRule* pDestRule = pDestDoc->FindNumRulePtr( sNumRule ); if( pDestRule ) - pDestRule->SetInvalidRule( TRUE ); + pDestRule->SetInvalidRule( sal_True ); else pDestDoc->MakeNumRule( sNumRule, pNumRule ); } @@ -278,7 +283,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, // <-- } - RemoveNode( rDelPos.GetIndex(), 1, FALSE ); // Indizies verschieben !! + RemoveNode( rDelPos.GetIndex(), 1, sal_False ); // Indizies verschieben !! SwCntntNode * pCNd = pNd->GetCntntNode(); rNds.InsertNode( pNd, aInsPos ); @@ -305,10 +310,12 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, // Sonderbehandlung fuer die Felder! if( pHts && pHts->Count() ) { - int bToUndo = &pDestDoc->GetNodes() != &rNds; - for( USHORT i = pHts->Count(); i; ) + // this looks fishy if pDestDoc != 0 + bool const bToUndo = !pDestDoc && + GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds); + for( sal_uInt16 i = pHts->Count(); i; ) { - USHORT nDelMsg = 0; + sal_uInt16 nDelMsg = 0; SwTxtAttr * const pAttr = pHts->GetTextHint( --i ); switch ( pAttr->Which() ) { @@ -408,7 +415,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, { ASSERT( !this, "ob das so richtig ist ??" ); aFrmNdIdx = rNds.GetEndOfContent(); - pFrmNd = rNds.GoPrevSection( &aFrmNdIdx, TRUE, FALSE ); + pFrmNd = rNds.GoPrevSection( &aFrmNdIdx, sal_True, sal_False ); if( pFrmNd && !((SwCntntNode*)pFrmNd)->GetDepends() ) pFrmNd = 0; @@ -457,14 +464,14 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, |* ***********************************************************************/ -BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, - const SwNodeIndex& aIndex, BOOL bNewFrms ) +sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, + const SwNodeIndex& aIndex, sal_Bool bNewFrms ) { SwNode * pAktNode; if( aIndex == 0 || ( (pAktNode = &aIndex.GetNode())->GetStartNode() && !pAktNode->StartOfSectionIndex() )) - return FALSE; + return sal_False; SwNodeRange aRg( aRange ); @@ -487,18 +494,18 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // wird im selben Array's verschoben, dann ueberpruefe die Einfuegepos. if( aRg.aStart >= aRg.aEnd ) - return FALSE; + return sal_False; if( this == &rNodes ) { if( ( aIndex.GetIndex()-1 >= aRg.aStart.GetIndex() && aIndex.GetIndex()-1 < aRg.aEnd.GetIndex()) || ( aIndex.GetIndex()-1 == aRg.aEnd.GetIndex() ) ) - return FALSE; + return sal_False; } - USHORT nLevel = 0; // Level-Counter - ULONG nInsPos = 0; // Cnt fuer das TmpArray + sal_uInt16 nLevel = 0; // Level-Counter + sal_uLong nInsPos = 0; // Cnt fuer das TmpArray // das Array bildet einen Stack, es werden alle StartOfSelction's gesichert SwSttNdPtrs aSttNdStack( 1, 5 ); @@ -507,7 +514,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwNodeIndex aIdx( aIndex ); /* --- JP 17.11.94: sollte ueberholt sein, wird im ChgNode schon erledigt! - BOOL bCorrNum = pSect && pSect->aStart.GetIndex() == aIdx.GetIndex(); + sal_Bool bCorrNum = pSect && pSect->aStart.GetIndex() == aIdx.GetIndex(); */ SwStartNode* pStartNode = aIdx.GetNode().pStartOfSection; @@ -516,8 +523,8 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, SwNodeRange aOrigInsPos( aIdx, -1, aIdx ); // Originale Insert Pos //JP 16.01.98: SectionNodes: DelFrms/MakeFrms beim obersten SectionNode! - USHORT nSectNdCnt = 0; - BOOL bSaveNewFrms = bNewFrms; + sal_uInt16 nSectNdCnt = 0; + sal_Bool bSaveNewFrms = bNewFrms; // bis alles verschoben ist while( aRg.aStart < aRg.aEnd ) @@ -546,8 +553,8 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, aRg.aEnd -= nInsPos; //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen - ULONG nNd = aIdx.GetIndex(); - BOOL bInsOutlineIdx = !( rNodes.GetEndOfRedlines(). + sal_uLong nNd = aIdx.GetIndex(); + sal_Bool bInsOutlineIdx = !( rNodes.GetEndOfRedlines(). StartOfSectionNode()->GetIndex() < nNd && nNd < rNodes.GetEndOfRedlines().GetIndex() ); @@ -559,7 +566,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // dann bewege alle Start/End/ContentNodes. Loesche // bei den ContentNodes auch die Frames !! pTblNd->pStartOfSection = aIdx.GetNode().pStartOfSection; - for( ULONG n = 0; n < nInsPos; ++n ) + for( sal_uLong n = 0; n < nInsPos; ++n ) { SwNodeIndex aMvIdx( aRg.aEnd, 1 ); SwCntntNode* pCNd = 0; @@ -606,7 +613,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // (Array kopieren und alle gefunden wieder loeschen; // erleichtert das suchen!!) SwNodeIndex aMvIdx( aRg.aEnd, 1 ); - for( ULONG n = 0; n < nInsPos; ++n ) + for( sal_uLong n = 0; n < nInsPos; ++n ) { SwNode* pNd = &aMvIdx.GetNode(); /* if( bNewFrms ) @@ -617,7 +624,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, ((SwSectionNode*)pNd)->DelFrms(); } */ - //BOOL bOutlNd = pNd->IsTxtNode() && NO_NUMBERING !=//#outline level,zhaojianwei + //sal_Bool bOutlNd = pNd->IsTxtNode() && NO_NUMBERING !=//#outline level,zhaojianwei // ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel(); const bool bOutlNd = pNd->IsTxtNode() && 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel();//<-end,zhaojianwei @@ -626,7 +633,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, if( bOutlNd ) pOutlineNds->Remove( pNd ); - RemoveNode( aMvIdx.GetIndex(), 1, FALSE ); + RemoveNode( aMvIdx.GetIndex(), 1, sal_False ); pNd->pStartOfSection = pSttNode; rNodes.InsertNode( pNd, aIdx ); @@ -658,7 +665,8 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, } } - if( GetDoc()->GetUndoNds() == &rNodes ) + if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes( + rNodes)) { SwFrmFmt* pTblFmt = pTblNd->GetTable().GetFrmFmt(); SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, @@ -695,8 +703,8 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // noch den EndNode erzeugen new SwEndNode( aIdx, *pTmp ); } - else if( (const SwNodes*)&rNodes == - GetDoc()->GetUndoNds() ) + else if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes( + rNodes)) { // im UndoNodes-Array spendieren wir einen // Platzhalter @@ -712,7 +720,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, aRg.aEnd--; aIdx--; - } while( FALSE ); + } while( sal_False ); } else { @@ -727,14 +735,14 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, if( bNewFrms && pSctNd ) pSctNd->DelFrms(); - RemoveNode( aRg.aEnd.GetIndex(), 1, FALSE ); // EndNode loeschen - ULONG nSttPos = pSttNd->GetIndex(); + RemoveNode( aRg.aEnd.GetIndex(), 1, sal_False ); // EndNode loeschen + sal_uLong nSttPos = pSttNd->GetIndex(); // dieser StartNode wird spaeter wieder entfernt! SwStartNode* pTmpSttNd = new SwStartNode( *this, nSttPos+1 ); pTmpSttNd->pStartOfSection = pSttNd->pStartOfSection; - RemoveNode( nSttPos, 1, FALSE ); // SttNode loeschen + RemoveNode( nSttPos, 1, sal_False ); // SttNode loeschen pSttNd->pStartOfSection = aIdx.GetNode().pStartOfSection; rNodes.InsertNode( pSttNd, aIdx ); @@ -752,7 +760,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, { pSctNd->NodesArrChgd(); ++nSectNdCnt; - bNewFrms = FALSE; + bNewFrms = sal_False; } } } @@ -762,7 +770,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, case ND_SECTIONNODE: if( !nLevel && - ( (const SwNodes*)&rNodes == GetDoc()->GetUndoNds() ) ) + GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNodes)) { // dann muss an der akt. InsPos ein SectionDummyNode // eingefuegt werden @@ -811,7 +819,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, aRg.aEnd++; { SwNodeIndex aCntIdx( aRg.aEnd ); - for( ULONG n = 0; n < nInsPos; n++, aCntIdx++) + for( sal_uLong n = 0; n < nInsPos; n++, aCntIdx++) aCntIdx.GetNode().pStartOfSection = pTmpStt; } @@ -847,8 +855,8 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, nInsPos = 0; // loesche nur noch den Pointer aus dem Nodes-Array. -// RemoveNode( aRg.aEnd.GetIndex(), 1, FALSE ); - RemoveNode( aRg.aEnd.GetIndex(), 1, TRUE ); +// RemoveNode( aRg.aEnd.GetIndex(), 1, sal_False ); + RemoveNode( aRg.aEnd.GetIndex(), 1, sal_True ); aRg.aEnd--; SwSectionNode* pSectNd = aSttNdStack[ nLevel ]->GetSectionNode(); @@ -889,7 +897,7 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, break; case ND_SECTIONDUMMY: - if( (const SwNodes*)this == GetDoc()->GetUndoNds() ) + if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this)) { if( &rNodes == this ) // innerhalb vom UndoNodesArray { @@ -918,13 +926,13 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, } } else { - ASSERT( FALSE, "wie kommt diser Node ins Nodes-Array??" ); + ASSERT( sal_False, "wie kommt diser Node ins Nodes-Array??" ); } aRg.aEnd--; break; default: - ASSERT( FALSE, "was ist das fuer ein Node??" ); + ASSERT( sal_False, "was ist das fuer ein Node??" ); break; } @@ -973,7 +981,7 @@ extern Writer* GetDebugWriter(const String&); } #endif - return TRUE; + return sal_True; } @@ -1119,8 +1127,8 @@ void SwNodes::SectionUp(SwNodeRange *pRange) { // dann wurde paarig aufgehoben, also nur die im Berich neu anpassen SwStartNode* pTmpSttNd = pAktNode->pStartOfSection; - RemoveNode( pRange->aStart.GetIndex(), 1, TRUE ); - RemoveNode( pRange->aEnd.GetIndex(), 1, TRUE ); + RemoveNode( pRange->aStart.GetIndex(), 1, sal_True ); + RemoveNode( pRange->aEnd.GetIndex(), 1, sal_True ); SwNodeIndex aTmpIdx( pRange->aStart ); while( aTmpIdx < pRange->aEnd ) @@ -1236,7 +1244,7 @@ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEn |* SwIndex &rIndex bezeichnet die Position, an der |* geloescht wird |* rIndex ist nach Aufruf der Funktion unveraendert (Kopie?!) -|* USHORT nNodes bezeichnet die Anzahl der zu loeschenden +|* sal_uInt16 nNodes bezeichnet die Anzahl der zu loeschenden |* Nodes; ist auf 1 defaulted |* |* Debug-Funktionen @@ -1250,12 +1258,12 @@ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEn |* VER0100 vb 901214 |* *******************************************************************/ -void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) +void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) { - USHORT nLevel = 0; // Level-Counter + sal_uInt16 nLevel = 0; // Level-Counter SwNode * pAktNode; - ULONG nCnt = Count() - rIndex.GetIndex() - 1; + sal_uLong nCnt = Count() - rIndex.GetIndex() - 1; if( nCnt > nNodes ) nCnt = nNodes; if( nCnt == 0 ) // keine Anzahl -> return @@ -1281,9 +1289,9 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) // so ist aEnd <= aStart aRg.aStart--; - BOOL bSaveInNodesDel = bInNodesDel; - bInNodesDel = TRUE; - BOOL bUpdateOutline = FALSE; + sal_Bool bSaveInNodesDel = bInNodesDel; + bInNodesDel = sal_True; + sal_Bool bUpdateOutline = sal_False; // bis alles geloescht ist while( aRg.aStart < aRg.aEnd ) @@ -1300,7 +1308,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) pTblNd->DelFrms(); SwNode *pNd, *pChkNd = pAktNode->pStartOfSection; - USHORT nIdxPos; + sal_uInt16 nIdxPos; do { pNd = &aRg.aEnd.GetNode(); @@ -1313,7 +1321,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) { // loesche die Gliederungs-Indizies. pOutlineNds->Remove( nIdxPos ); - bUpdateOutline = TRUE; + bUpdateOutline = sal_True; } ((SwTxtNode*)pNd)->InvalidateNumRule(); } @@ -1328,7 +1336,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) } else { - RemoveNode( aRg.aEnd.GetIndex()+1, nCnt, TRUE ); // loesche + RemoveNode( aRg.aEnd.GetIndex()+1, nCnt, sal_True ); // loesche nCnt = 0; aRg.aEnd--; // vor den EndNode nLevel++; @@ -1342,13 +1350,13 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) { // loesche jetzt das Array aRg.aEnd++; - RemoveNode( aRg.aEnd.GetIndex(), nCnt, TRUE ); + RemoveNode( aRg.aEnd.GetIndex(), nCnt, sal_True ); nCnt = 0; } } else // es werden alle Nodes Innerhalb eines Start- und { // End-Nodes geloescht, loesche mit Start/EndNode - RemoveNode( aRg.aEnd.GetIndex(), nCnt + 2, TRUE ); // loesche Array + RemoveNode( aRg.aEnd.GetIndex(), nCnt + 2, sal_True ); // loesche Array nCnt = 0; nLevel--; } @@ -1375,7 +1383,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) if( pTxtNd->IsOutline()) { // loesche die Gliederungs-Indizies. pOutlineNds->Remove( pTxtNd ); - bUpdateOutline = TRUE; + bUpdateOutline = sal_True; } pTxtNd->InvalidateNumRule(); } @@ -1389,7 +1397,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) aRg.aEnd++; if( nCnt != 0 ) - RemoveNode( aRg.aEnd.GetIndex(), nCnt, TRUE ); // loesche den Rest + RemoveNode( aRg.aEnd.GetIndex(), nCnt, sal_True ); // loesche den Rest // loesche alle leeren Start-/End-Node-Paare while( aRg.aEnd.GetNode().GetEndNode() && @@ -1409,14 +1417,14 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) if( bUpdateOutline || bInDelUpdOutl ) { UpdtOutlineIdx( aRg.aEnd.GetNode() ); - bInDelUpdOutl = FALSE; + bInDelUpdOutl = sal_False; } } else { if( bUpdateOutline ) - bInDelUpdOutl = TRUE; + bInDelUpdOutl = sal_True; } } @@ -1454,15 +1462,14 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) |* VER0100 vb 901214 |* *******************************************************************/ -USHORT SwNodes::GetSectionLevel(const SwNodeIndex &rIdx) const { +sal_uInt16 SwNodes::GetSectionLevel(const SwNodeIndex &rIdx) const { // Sonderbehandlung 1. Node if(rIdx == 0) return 1; /* * Keine Rekursion! - hier wird das SwNode::GetSectionLevel * aufgerufen */ - return (*this)[rIdx]->GetSectionLevel(); - + return rIdx.GetNode().GetSectionLevel(); } void SwNodes::GoStartOfSection(SwNodeIndex *pIdx) const @@ -1600,7 +1607,7 @@ SwNode* SwNodes::GoPreviousWithFrm(SwNodeIndex *pIdx) const /************************************************************************* |* -|* BOOL SwNodes::CheckNodesRange() +|* sal_Bool SwNodes::CheckNodesRange() |* |* Beschreibung |* Teste ob der uebergene SRange nicht ueber die Grenzen der @@ -1613,37 +1620,37 @@ SwNode* SwNodes::GoPreviousWithFrm(SwNodeIndex *pIdx) const |* |* Parameter SwIndex & Start-Index vom Bereich |* SwIndex & End-Index vom Bereich -|* BOOL TRUE: Start+End in gleicher Section! -|* FALSE: Start+End in verschiedenen Sect. -|* Return-Wert BOOL TRUE: gueltiger SRange -|* FALSE: ungueltiger SRange +|* sal_Bool sal_True: Start+End in gleicher Section! +|* sal_False: Start+End in verschiedenen Sect. +|* Return-Wert sal_Bool sal_True: gueltiger SRange +|* sal_False: ungueltiger SRange |* |* Ersterstellung JP 23.04.91 |* Letzte Aenderung JP 18.06.92 |* *************************************************************************/ -inline int TstIdx( ULONG nSttIdx, ULONG nEndIdx, ULONG nStt, ULONG nEnd ) +inline int TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, sal_uLong nStt, sal_uLong nEnd ) { return nStt < nSttIdx && nEnd >= nSttIdx && nStt < nEndIdx && nEnd >= nEndIdx; } -BOOL SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const +sal_Bool SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const { - ULONG nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex(); + sal_uLong nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex(); if( TstIdx( nStt, nEnd, pEndOfContent->StartOfSectionIndex(), - pEndOfContent->GetIndex() )) return TRUE; + pEndOfContent->GetIndex() )) return sal_True; if( TstIdx( nStt, nEnd, pEndOfAutotext->StartOfSectionIndex(), - pEndOfAutotext->GetIndex() )) return TRUE; + pEndOfAutotext->GetIndex() )) return sal_True; if( TstIdx( nStt, nEnd, pEndOfPostIts->StartOfSectionIndex(), - pEndOfPostIts->GetIndex() )) return TRUE; + pEndOfPostIts->GetIndex() )) return sal_True; if( TstIdx( nStt, nEnd, pEndOfInserts->StartOfSectionIndex(), - pEndOfInserts->GetIndex() )) return TRUE; + pEndOfInserts->GetIndex() )) return sal_True; if( TstIdx( nStt, nEnd, pEndOfRedlines->StartOfSectionIndex(), - pEndOfRedlines->GetIndex() )) return TRUE; + pEndOfRedlines->GetIndex() )) return sal_True; - return FALSE; // liegt irgendwo dazwischen, FEHLER + return sal_False; // liegt irgendwo dazwischen, FEHLER } @@ -1655,16 +1662,16 @@ BOOL SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd |* Loesche aus den NodesArray ab einer Position entsprechend Node's. |* |* Parameter SwIndex & Der Startpunkt im Nodes-Array -|* USHORT die Anzahl +|* sal_uInt16 die Anzahl |* |* Ersterstellung JP 23.04.91 |* Letzte Aenderung JP 23.04.91 |* *************************************************************************/ -void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt ) +void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt ) { int bUpdateNum = 0; - ULONG nSttIdx = rStart.GetIndex(); + sal_uLong nSttIdx = rStart.GetIndex(); if( !nSttIdx && nCnt == GetEndOfContent().GetIndex()+1 ) { @@ -1681,17 +1688,17 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt ) while( *ppEndNdArr ) { nSttIdx = (*ppEndNdArr)->StartOfSectionIndex() + 1; - ULONG nEndIdx = (*ppEndNdArr)->GetIndex(); + sal_uLong nEndIdx = (*ppEndNdArr)->GetIndex(); if( nSttIdx != nEndIdx ) - RemoveNode( nSttIdx, nEndIdx - nSttIdx, TRUE ); + RemoveNode( nSttIdx, nEndIdx - nSttIdx, sal_True ); ++ppEndNdArr; } } else { - for( ULONG n = nSttIdx, nEnd = nSttIdx + nCnt; n < nEnd; ++n ) + for( sal_uLong n = nSttIdx, nEnd = nSttIdx + nCnt; n < nEnd; ++n ) { SwNode* pNd = (*this)[ n ]; @@ -1699,7 +1706,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt ) //NO_NUMBERING != ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() ) //<-end,zhaojianwei { // loesche die Gliederungs-Indizies. - USHORT nIdxPos; + sal_uInt16 nIdxPos; if( pOutlineNds->Seek_Entry( pNd, &nIdxPos )) { pOutlineNds->Remove( nIdxPos ); @@ -1712,7 +1719,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt ) ((SwCntntNode*)pNd)->DelFrms(); } } - RemoveNode( nSttIdx, nCnt, TRUE ); + RemoveNode( nSttIdx, nCnt, sal_True ); // rufe noch das Update fuer die Gliederungsnumerierung auf if( bUpdateNum ) @@ -1723,14 +1730,14 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt ) /************************************************************************* |* -|* USHORT HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange ) +|* sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange ) |* |* Beschreibung |* Berechne den hoehsten Level innerhalb des Bereiches |* |* Parameter SwNodes & das Node-Array |* SwNodeRange & der zu ueberpruefende Bereich -|* Return USHORT der hoechste Level +|* Return sal_uInt16 der hoechste Level |* |* Ersterstellung JP 24.04.91 |* Letzte Aenderung JP 24.04.91 @@ -1739,12 +1746,12 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt ) struct HighLevel { - USHORT nLevel, nTop; - HighLevel( USHORT nLv ) : nLevel( nLv ), nTop( nLv ) {} + sal_uInt16 nLevel, nTop; + HighLevel( sal_uInt16 nLv ) : nLevel( nLv ), nTop( nLv ) {} }; -BOOL _HighestLevel( const SwNodePtr& rpNode, void * pPara ) +sal_Bool _HighestLevel( const SwNodePtr& rpNode, void * pPara ) { HighLevel * pHL = (HighLevel*)pPara; if( rpNode->GetStartNode() ) @@ -1753,11 +1760,11 @@ BOOL _HighestLevel( const SwNodePtr& rpNode, void * pPara ) pHL->nLevel--; if( pHL->nTop > pHL->nLevel ) pHL->nTop = pHL->nLevel; - return TRUE; + return sal_True; } -USHORT HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange ) +sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange ) { HighLevel aPara( rNodes.GetSectionLevel( rRange.aStart )); rNodes.ForEach( rRange.aStart, rRange.aEnd, _HighestLevel, &aPara ); @@ -1790,10 +1797,10 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) SwNodeIndex aEndIdx( pEnd->nNode ); SwNodeIndex aSttIdx( pStt->nNode ); - SwTxtNode* const pSrcNd = (*this)[ aSttIdx ]->GetTxtNode(); - SwTxtNode* pDestNd = rNodes[ rPos.nNode ]->GetTxtNode(); - BOOL bSplitDestNd = TRUE; - BOOL bCopyCollFmt = pDestNd && !pDestNd->GetTxt().Len(); + SwTxtNode *const pSrcNd = aSttIdx.GetNode().GetTxtNode(); + SwTxtNode * pDestNd = rPos.nNode.GetNode().GetTxtNode(); + sal_Bool bSplitDestNd = sal_True; + sal_Bool bCopyCollFmt = pDestNd && !pDestNd->GetTxt().Len(); if( pSrcNd ) { @@ -1804,27 +1811,27 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) pDestNd = rNodes.MakeTxtNode( rPos.nNode, pSrcNd->GetTxtColl() ); rPos.nNode--; rPos.nContent.Assign( pDestNd, 0 ); - bCopyCollFmt = TRUE; + bCopyCollFmt = sal_True; } bSplitDestNd = pDestNd->Len() > rPos.nContent.GetIndex() || pEnd->nNode.GetNode().IsTxtNode(); // verschiebe jetzt noch den Inhalt in den neuen Node - BOOL bOneNd = pStt->nNode == pEnd->nNode; + sal_Bool bOneNd = pStt->nNode == pEnd->nNode; const xub_StrLen nLen = ( (bOneNd) ? pEnd->nContent.GetIndex() : pSrcNd->Len() ) - pStt->nContent.GetIndex(); if( !pEnd->nNode.GetNode().IsCntntNode() ) { - bOneNd = TRUE; - ULONG nSttNdIdx = pStt->nNode.GetIndex() + 1; - const ULONG nEndNdIdx = pEnd->nNode.GetIndex(); + bOneNd = sal_True; + sal_uLong nSttNdIdx = pStt->nNode.GetIndex() + 1; + const sal_uLong nEndNdIdx = pEnd->nNode.GetIndex(); for( ; nSttNdIdx < nEndNdIdx; ++nSttNdIdx ) { if( (*this)[ nSttNdIdx ]->IsCntntNode() ) { - bOneNd = FALSE; + bOneNd = sal_False; break; } } @@ -1836,15 +1843,13 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) { if( !rPos.nContent.GetIndex() ) { - bCopyCollFmt = TRUE; + bCopyCollFmt = sal_True; } if( rNodes.IsDocNodes() ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo()); pInsDoc->SplitNode( rPos, false ); - pInsDoc->DoUndo( bIsUndo ); } else { @@ -1855,7 +1860,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) { aEndIdx--; } - bSplitDestNd = TRUE; + bSplitDestNd = sal_True; pDestNd = rNodes[ rPos.nNode.GetIndex() - 1 ]->GetTxtNode(); if( nLen ) @@ -1872,11 +1877,9 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( bCopyCollFmt ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + ::sw::UndoGuard const undoGuard(pInsDoc->GetIDocumentUndoRedo()); pSrcNd->CopyCollFmt( *pDestNd ); - pInsDoc->DoUndo( bIsUndo ); - bCopyCollFmt = FALSE; + bCopyCollFmt = sal_False; } if( bOneNd ) // das wars schon @@ -1911,10 +1914,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( rNodes.IsDocNodes() ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo()); pInsDoc->SplitNode( rPos, false ); - pInsDoc->DoUndo( bIsUndo ); } else { @@ -1930,10 +1931,10 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) } } // am Ende steht noch ein leerer Text Node herum. - bSplitDestNd = TRUE; + bSplitDestNd = sal_True; } - SwTxtNode* const pEndSrcNd = (*this)[ aEndIdx ]->GetTxtNode(); + SwTxtNode* const pEndSrcNd = aEndIdx.GetNode().GetTxtNode(); if ( pEndSrcNd ) { { @@ -1952,7 +1953,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) } else { - pDestNd = rNodes[ rPos.nNode ]->GetTxtNode(); + pDestNd = rPos.nNode.GetNode().GetTxtNode(); } if( pDestNd && pEnd->nContent.GetIndex() ) @@ -1966,10 +1967,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( bCopyCollFmt ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo()); pEndSrcNd->CopyCollFmt( *pDestNd ); - pInsDoc->DoUndo( bIsUndo ); } } } @@ -1989,7 +1988,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( aEndIdx != aSttIdx ) { // verschiebe jetzt die Nodes in das NodesArary - const ULONG nSttDiff = aSttIdx.GetIndex() - pStt->nNode.GetIndex(); + const sal_uLong nSttDiff = aSttIdx.GetIndex() - pStt->nNode.GetIndex(); SwNodeRange aRg( aSttIdx, aEndIdx ); _MoveNodes( aRg, rNodes, rPos.nNode ); // falls ins gleiche Nodes-Array verschoben wurde, stehen die @@ -2009,7 +2008,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) ASSERT( bSuccess, "Move() - no ContentNode here" ); (void) bSuccess; } - pStt->nContent.Assign( (*this)[ pStt->nNode ]->GetCntntNode(), + pStt->nContent.Assign( pStt->nNode.GetNode().GetCntntNode(), pStt->nContent.GetIndex() ); // der PaM wird korrigiert, denn falls ueber Nodegrenzen verschoben // wurde, so stehen sie in unterschielichen Nodes. Auch die Selektion @@ -2035,13 +2034,13 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) |* *************************************************************************/ -inline BYTE MaxLvl( BYTE nMin, BYTE nMax, short nNew ) +inline sal_uInt8 MaxLvl( sal_uInt8 nMin, sal_uInt8 nMax, short nNew ) { - return (BYTE)(nNew < nMin ? nMin : nNew > nMax ? nMax : nNew); + return (sal_uInt8)(nNew < nMin ? nMin : nNew > nMax ? nMax : nNew); } void SwNodes::_CopyNodes( const SwNodeRange& rRange, - const SwNodeIndex& rIndex, BOOL bNewFrms, BOOL bTblInsDummyNode ) const + const SwNodeIndex& rIndex, sal_Bool bNewFrms, sal_Bool bTblInsDummyNode ) const { SwDoc* pDoc = rIndex.GetNode().GetDoc(); @@ -2054,7 +2053,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, SwNodeRange aRg( rRange ); // "einfache" StartNodes oder EndNodes ueberspringen - while( ND_STARTNODE == (pAktNode = (*this)[ aRg.aStart ])->GetNodeType() + while( ND_STARTNODE == (pAktNode = & aRg.aStart.GetNode())->GetNodeType() || ( pAktNode->IsEndNode() && !pAktNode->pStartOfSection->IsSectionNode() ) ) aRg.aStart++; @@ -2066,7 +2065,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, // special section nodes and then one before the first. if (aRg.aEnd.GetNode().StartOfSectionIndex() != 0) { - while( (( pAktNode = (*this)[ aRg.aEnd ])->GetStartNode() && + while( ((pAktNode = & aRg.aEnd.GetNode())->GetStartNode() && !pAktNode->IsSectionNode() ) || ( pAktNode->IsEndNode() && ND_STARTNODE == pAktNode->pStartOfSection->GetNodeType()) ) @@ -2092,9 +2091,9 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, SwNodeIndex aInsPos( rIndex ); SwNodeIndex aOrigInsPos( rIndex, -1 ); // Originale Insert Pos - USHORT nLevel = 0; // Level-Counter + sal_uInt16 nLevel = 0; // Level-Counter - for( ULONG nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex(); + for( sal_uLong nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex(); nNodeCnt > 0; --nNodeCnt ) { pAktNode = &aRg.aStart.GetNode(); @@ -2127,7 +2126,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, SwStartNode* pSttNd = aRg.aStart.GetNode().GetStartNode(); _CopyNodes( SwNodeRange( *pSttNd, + 1, *pSttNd->EndOfSectionNode() ), - aInsPos, bNewFrms, FALSE ); + aInsPos, bNewFrms, sal_False ); // fuer den Box-EndNode einen DummyNode einfuegen? if( bTblInsDummyNode ) @@ -2214,23 +2213,23 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, break; case ND_SECTIONDUMMY: - if( (const SwNodes*)this == GetDoc()->GetUndoNds() ) + if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this)) { // dann muss an der akt. InsPos auch ein SectionNode // (Start/Ende) stehen; dann diesen ueberspringen. // Andernfalls nicht weiter beachten. - SwNode* pTmpNd = pDoc->GetNodes()[ aInsPos ]; + SwNode *const pTmpNd = & aInsPos.GetNode(); if( pTmpNd->IsSectionNode() || pTmpNd->StartOfSectionNode()->IsSectionNode() ) aInsPos++; // ueberspringen } else { - ASSERT( FALSE, "wie kommt diser Node ins Nodes-Array??" ); + ASSERT( sal_False, "wie kommt diser Node ins Nodes-Array??" ); } break; default: - ASSERT( FALSE, "weder Start-/End-/Content-Node, unbekannter Typ" ); + ASSERT( sal_False, "weder Start-/End-/Content-Node, unbekannter Typ" ); } aRg.aStart++; } @@ -2258,7 +2257,7 @@ void SwNodes::_DelDummyNodes( const SwNodeRange& rRg ) while( aIdx.GetIndex() < rRg.aEnd.GetIndex() ) { if( ND_SECTIONDUMMY == aIdx.GetNode().GetNodeType() ) - RemoveNode( aIdx.GetIndex(), 1, TRUE ); + RemoveNode( aIdx.GetIndex(), 1, sal_True ); else aIdx++; } @@ -2285,27 +2284,28 @@ SwStartNode* SwNodes::MakeTextSection( const SwNodeIndex & rWhere, } // zum naechsten Content-Node, der nicht geschuetzt oder versteckt ist - // (beides auf FALSE ==> GoNext/GoPrevious!!!) + // (beides auf sal_False ==> GoNext/GoPrevious!!!) SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx, int bSkipHidden, int bSkipProtect ) const { - int bFirst = TRUE; + int bFirst = sal_True; SwNodeIndex aTmp( *pIdx ); const SwNode* pNd; while( aTmp < Count() - 1 ) { - if( ND_SECTIONNODE == ( pNd = (*this)[aTmp])->GetNodeType() ) + pNd = & aTmp.GetNode(); + if (ND_SECTIONNODE == pNd->GetNodeType()) { const SwSection& rSect = ((SwSectionNode*)pNd)->GetSection(); if( (bSkipHidden && rSect.IsHiddenFlag()) || (bSkipProtect && rSect.IsProtectFlag()) ) // dann diese Section ueberspringen aTmp = *pNd->EndOfSectionNode(); - bFirst = FALSE; + bFirst = sal_False; } else if( bFirst ) { - bFirst = FALSE; + bFirst = sal_False; if( pNd->pStartOfSection->IsSectionNode() ) { const SwSection& rSect = ((SwSectionNode*)pNd-> @@ -2333,7 +2333,7 @@ SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx, } } aTmp++; - bFirst = FALSE; + bFirst = sal_False; } return 0; } @@ -2341,12 +2341,13 @@ SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx, SwCntntNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx, int bSkipHidden, int bSkipProtect ) const { - int bFirst = TRUE; + int bFirst = sal_True; SwNodeIndex aTmp( *pIdx ); const SwNode* pNd; while( aTmp > 0 ) { - if( ND_ENDNODE == ( pNd = (*this)[aTmp])->GetNodeType() ) + pNd = & aTmp.GetNode(); + if (ND_ENDNODE == pNd->GetNodeType()) { if( pNd->pStartOfSection->IsSectionNode() ) { @@ -2357,11 +2358,11 @@ SwCntntNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx, // dann diese Section ueberspringen aTmp = *pNd->StartOfSectionNode(); } - bFirst = FALSE; + bFirst = sal_False; } else if( bFirst ) { - bFirst = FALSE; + bFirst = sal_False; if( pNd->pStartOfSection->IsSectionNode() ) { const SwSection& rSect = ((SwSectionNode*)pNd-> @@ -2435,8 +2436,8 @@ SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx, rFrmIdx = aIdx; // suche nach vorne/hinten nach einem Content Node - else if( 0 != ( pFrmNd = GoPrevSection( &aIdx, TRUE, FALSE )) && - ::CheckNodesRange( aIdx, rFrmIdx, TRUE ) && + else if( 0 != ( pFrmNd = GoPrevSection( &aIdx, sal_True, sal_False )) && + ::CheckNodesRange( aIdx, rFrmIdx, sal_True ) && // nach vorne nie aus der Tabelle hinaus! pFrmNd->FindTableNode() == pTableNd && // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus! @@ -2457,8 +2458,8 @@ SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx, // JP 19.09.93: aber nie die Section dafuer verlassen !! if( ( pEnd && ( pFrmNd = &aIdx.GetNode())->IsCntntNode() ) || - ( 0 != ( pFrmNd = GoNextSection( &aIdx, TRUE, FALSE )) && - ::CheckNodesRange( aIdx, rFrmIdx, TRUE ) && + ( 0 != ( pFrmNd = GoNextSection( &aIdx, sal_True, sal_False )) && + ::CheckNodesRange( aIdx, rFrmIdx, sal_True ) && ( pFrmNd->FindTableNode() == pTableNd && // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus! (!pFrmNd->FindTableNode() || pFrmNd->FindTableBoxStartNode() @@ -2538,9 +2539,9 @@ struct _TempBigPtrEntry : public BigPtrEntry }; -void SwNodes::RemoveNode( ULONG nDelPos, ULONG nSz, BOOL bDel ) +void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, sal_Bool bDel ) { - ULONG nEnd = nDelPos + nSz; + sal_uLong nEnd = nDelPos + nSz; SwNode* pNew = (*this)[ nEnd ]; if( pRoot ) @@ -2548,7 +2549,7 @@ void SwNodes::RemoveNode( ULONG nDelPos, ULONG nSz, BOOL bDel ) SwNodeIndex *p = pRoot; while( p ) { - ULONG nIdx = p->GetIndex(); + sal_uLong nIdx = p->GetIndex(); SwNodeIndex* pNext = p->pNext; if( nDelPos <= nIdx && nIdx < nEnd ) (*p) = *pNew; @@ -2559,7 +2560,7 @@ void SwNodes::RemoveNode( ULONG nDelPos, ULONG nSz, BOOL bDel ) p = pRoot->pPrev; while( p ) { - ULONG nIdx = p->GetIndex(); + sal_uLong nIdx = p->GetIndex(); SwNodeIndex* pPrev = p->pPrev; if( nDelPos <= nIdx && nIdx < nEnd ) (*p) = *pNew; @@ -2569,7 +2570,7 @@ void SwNodes::RemoveNode( ULONG nDelPos, ULONG nSz, BOOL bDel ) } { - for (ULONG nCnt = 0; nCnt < nSz; nCnt++) + for (sal_uLong nCnt = 0; nCnt < nSz; nCnt++) { SwTxtNode * pTxtNd = ((*this)[ nDelPos + nCnt ])->GetTxtNode(); @@ -2585,7 +2586,7 @@ void SwNodes::RemoveNode( ULONG nDelPos, ULONG nSz, BOOL bDel ) if( bDel ) { - ULONG nCnt = nSz; + sal_uLong nCnt = nSz; SwNode *pDel = (*this)[ nDelPos+nCnt-1 ], *pPrev = (*this)[ nDelPos+nCnt-2 ]; // temp. Object setzen @@ -2602,7 +2603,7 @@ void SwNodes::RemoveNode( ULONG nDelPos, ULONG nSz, BOOL bDel ) { delete pDel; pDel = pPrev; - ULONG nPrevNdIdx = pPrev->GetIndex(); + sal_uLong nPrevNdIdx = pPrev->GetIndex(); BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry ); if( nCnt ) pPrev = (*this)[ nPrevNdIdx - 1 ]; @@ -2657,7 +2658,7 @@ void SwNodes::InsertNode( const SwNodePtr pNode, } void SwNodes::InsertNode( const SwNodePtr pNode, - ULONG nPos ) + sal_uLong nPos ) { const ElementPtr pIns = pNode; BigPtrArray::Insert( pIns, nPos ); @@ -2689,7 +2690,7 @@ SwNode * SwNodes::DocumentSectionEndNode(SwNode * pNode) const //SwNode * SwNodes::operator[](int n) const //{ -// return operator[]((ULONG) n); +// return operator[]((sal_uLong) n); //} // <-#112139# diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 2d54cb88f2e6..54143770bb7c 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -28,8 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <stdlib.h> + #include <hintids.hxx> #include <svl/intitem.hxx> #include <svl/stritem.hxx> @@ -46,6 +46,7 @@ #include <fmtpdsc.hxx> #include <errhdl.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <node.hxx> #include <pam.hxx> #include <frmtool.hxx> @@ -82,7 +83,7 @@ class SwIntrnlSectRefLink : public SwBaseLink { SwSectionFmt& rSectFmt; public: - SwIntrnlSectRefLink( SwSectionFmt& rFmt, USHORT nUpdateType, USHORT nFmt ) + SwIntrnlSectRefLink( SwSectionFmt& rFmt, sal_uInt16 nUpdateType, sal_uInt16 nFmt ) : SwBaseLink( nUpdateType, nFmt ), rSectFmt( rFmt ) {} @@ -92,7 +93,7 @@ public: const uno::Any & rValue ); virtual const SwNode* GetAnchor() const; - virtual BOOL IsInRange( ULONG nSttNd, ULONG nEndNd, xub_StrLen nStt = 0, + virtual sal_Bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, xub_StrLen nStt = 0, xub_StrLen nEnd = STRING_NOTFOUND ) const; // --> OD 2007-02-14 #b6521322# @@ -274,10 +275,8 @@ SwSection::~SwSection() { // Bug: 28191 - nicht ins Undo aufnehmen, sollte schon vorher // geschehen sein!! - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); pDoc->DelSectionFmt( pFmt ); // und loeschen - pDoc->DoUndo( bUndo ); } } if (m_RefObj.Is()) @@ -361,15 +360,15 @@ void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition) } } -BOOL SwSection::CalcHiddenFlag() const +sal_Bool SwSection::CalcHiddenFlag() const { const SwSection* pSect = this; do { if( pSect->IsHidden() && pSect->IsCondHidden() ) - return TRUE; + return sal_True; } while( 0 != ( pSect = pSect->GetParent()) ); - return FALSE; + return sal_False; } bool SwSection::IsProtect() const @@ -409,7 +408,7 @@ void SwSection::SetProtect(bool const bFlag) if (pFormat) { SvxProtectItem aItem( RES_PROTECT ); - aItem.SetCntntProtect( (BOOL)bFlag ); + aItem.SetCntntProtect( (sal_Bool)bFlag ); pFormat->SetFmtAttr( aItem ); // note: this will call m_Data.SetProtectFlag via Modify! } @@ -427,7 +426,7 @@ void SwSection::SetEditInReadonly(bool const bFlag) if (pFormat) { SwFmtEditInReadonly aItem; - aItem.SetValue( (BOOL)bFlag ); + aItem.SetValue( (sal_Bool)bFlag ); pFormat->SetFmtAttr( aItem ); // note: this will call m_Data.SetEditInReadonlyFlag via Modify! } @@ -451,7 +450,7 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) const SfxPoolItem* pItem; if( SFX_ITEM_SET == pNewSet->GetItemState( - RES_PROTECT, FALSE, &pItem ) ) + RES_PROTECT, sal_False, &pItem ) ) { m_Data.SetProtectFlag( static_cast<SvxProtectItem const*>(pItem) ->IsCntntProtected() ); @@ -461,7 +460,7 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) // --> FME 2004-06-22 #114856# edit in readonly sections if( SFX_ITEM_SET == pNewSet->GetItemState( - RES_EDIT_IN_READONLY, FALSE, &pItem ) ) + RES_EDIT_IN_READONLY, sal_False, &pItem ) ) { m_Data.SetEditInReadonlyFlag( static_cast<SwFmtEditInReadonly const*>(pItem)->GetValue()); @@ -471,9 +470,9 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) // <-- if( SFX_ITEM_SET == pNewSet->GetItemState( - RES_FTN_AT_TXTEND, FALSE, &pItem ) || + RES_FTN_AT_TXTEND, sal_False, &pItem ) || SFX_ITEM_SET == pNewSet->GetItemState( - RES_END_AT_TXTEND, FALSE, &pItem )) + RES_END_AT_TXTEND, sal_False, &pItem )) { bUpdateFtn = true; } @@ -553,7 +552,7 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) if( bUpdateFtn ) { - SwSectionNode* pSectNd = GetFmt()->GetSectionNode( FALSE ); + SwSectionNode* pSectNd = GetFmt()->GetSectionNode( sal_False ); if( pSectNd ) pSectNd->GetDoc()->GetFtnIdxs().UpdateFtn(SwNodeIndex( *pSectNd )); } @@ -634,7 +633,7 @@ void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd ) { const SwNode* pNd; const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks(); - for( USHORT n = rLnks.Count(); n; ) + for( sal_uInt16 n = rLnks.Count(); n; ) { ::sfx2::SvBaseLink* pBLnk = &(*rLnks[ --n ]); if( pBLnk && !pBLnk->IsVisible() && @@ -651,7 +650,7 @@ void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd ) // steht nur noch in einer normalen Section, also // wieder anzeigen if( !pParent ) - pBLnk->SetVisible( TRUE ); + pBLnk->SetVisible( sal_True ); } } } @@ -679,7 +678,7 @@ SwSectionFmt::~SwSectionFmt() if( !GetDoc()->IsInDtor() ) { SwSectionNode* pSectNd; - const SwNodeIndex* pIdx = GetCntnt( FALSE ).GetCntntIdx(); + const SwNodeIndex* pIdx = GetCntnt( sal_False ).GetCntntIdx(); if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) { @@ -707,7 +706,7 @@ SwSectionFmt::~SwSectionFmt() if ( pLast->IsA( TYPE(SwFrm) ) ) { SwSectionFrm *pFrm = (SwSectionFrm*)pLast; - SwSectionFrm::MoveCntntAndDelete( pFrm, TRUE ); + SwSectionFrm::MoveCntntAndDelete( pFrm, sal_True ); pLast = aIter.GoStart(); } else @@ -732,17 +731,17 @@ SwSection * SwSectionFmt::GetSection() const return (SwSectionPtr)aIter.First( TYPE(SwSection) ); } - ASSERT( FALSE, "keine Section als Client." ) + ASSERT( sal_False, "keine Section als Client." ) return 0; } -extern void lcl_DeleteFtn( SwSectionNode *pNd, ULONG nStt, ULONG nEnd ); +extern void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd ); //Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt). void SwSectionFmt::DelFrms() { SwSectionNode* pSectNd; - const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx(); + const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx(); if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) { @@ -755,7 +754,7 @@ void SwSectionFmt::DelFrms() if ( pLast->IsA( TYPE(SwFrm) ) ) { SwSectionFrm *pFrm = (SwSectionFrm*)pLast; - SwSectionFrm::MoveCntntAndDelete( pFrm, FALSE ); + SwSectionFrm::MoveCntntAndDelete( pFrm, sal_False ); pLast = aIter.GoStart(); } else @@ -774,8 +773,8 @@ void SwSectionFmt::DelFrms() pLast = aIter++; } // <-- - ULONG nEnde = pSectNd->EndOfSectionIndex(); - ULONG nStart = pSectNd->GetIndex()+1; + sal_uLong nEnde = pSectNd->EndOfSectionIndex(); + sal_uLong nStart = pSectNd->GetIndex()+1; lcl_DeleteFtn( pSectNd, nStart, nEnde ); } if( pIdx ) @@ -786,7 +785,7 @@ void SwSectionFmt::DelFrms() //zu weiteren Folgefehlern, die mit Laufzeitkosten geloest werden //muesten. #56977# #55001# #56135# SwNodeIndex aNextNd( *pIdx ); - SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection( &aNextNd, TRUE, FALSE ); + SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection( &aNextNd, sal_True, sal_False ); if( pCNd ) { const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get( RES_PAGEDESC ); @@ -800,7 +799,7 @@ void SwSectionFmt::DelFrms() void SwSectionFmt::MakeFrms() { SwSectionNode* pSectNd; - const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx(); + const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx(); if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) @@ -823,8 +822,8 @@ void lcl_ClientIter( SwSectionFmt* pFmt, const SfxPoolItem* pOld, void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) { - BOOL bClients = FALSE; - USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; + sal_Bool bClients = sal_False; + sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; switch( nWhich ) { case RES_ATTRSET_CHG: @@ -834,7 +833,7 @@ void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet(); const SfxPoolItem *pItem; if( SFX_ITEM_SET == pNewSet->GetItemState( - RES_PROTECT, FALSE, &pItem )) + RES_PROTECT, sal_False, &pItem )) { lcl_ClientIter( this, pItem, pItem ); pNewSet->ClearItem( RES_PROTECT ); @@ -843,7 +842,7 @@ void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) // --> FME 2004-06-22 #114856# edit in readonly sections if( SFX_ITEM_SET == pNewSet->GetItemState( - RES_EDIT_IN_READONLY, FALSE, &pItem ) ) + RES_EDIT_IN_READONLY, sal_False, &pItem ) ) { lcl_ClientIter( this, pItem, pItem ); pNewSet->ClearItem( RES_EDIT_IN_READONLY ); @@ -852,7 +851,7 @@ void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) // <-- if( SFX_ITEM_SET == pNewSet->GetItemState( - RES_FTN_AT_TXTEND, FALSE, &pItem )) + RES_FTN_AT_TXTEND, sal_False, &pItem )) { lcl_ClientIter( this, &pOldSet->Get( RES_FTN_AT_TXTEND ), pItem ); @@ -860,7 +859,7 @@ void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) pOldSet->ClearItem( RES_FTN_AT_TXTEND ); } if( SFX_ITEM_SET == pNewSet->GetItemState( - RES_END_AT_TXTEND, FALSE, &pItem )) + RES_END_AT_TXTEND, sal_False, &pItem )) { lcl_ClientIter( this, &pOldSet->Get( RES_END_AT_TXTEND ), pItem ); @@ -874,7 +873,7 @@ void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) case RES_SECTION_RESETHIDDENFLAG: case RES_FTN_AT_TXTEND: - case RES_END_AT_TXTEND : bClients = TRUE; + case RES_END_AT_TXTEND : bClients = sal_True; // no break !! case RES_SECTION_HIDDEN: case RES_SECTION_NOT_HIDDEN: @@ -943,7 +942,7 @@ void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) } // erfrage vom Format Informationen -BOOL SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const +sal_Bool SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const { switch( rInfo.Which() ) { @@ -954,7 +953,7 @@ BOOL SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const if( pNd ) ((SwFindNearestNode&)rInfo).CheckNode( *pNd ); } - return TRUE; + return sal_True; case RES_CONTENT_VISIBLE: { @@ -973,7 +972,7 @@ BOOL SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const } ((SwPtrMsgPoolItem&)rInfo).pObject = pFrm; } - return FALSE; + return sal_False; } return SwModify::GetInfo( rInfo ); } @@ -992,11 +991,11 @@ extern "C" { const SwSectionFmt* pFSectFmt = (*(SwSectionPtr*)pFirst)->GetFmt(); const SwSectionFmt* pSSectFmt = (*(SwSectionPtr*)pSecond)->GetFmt(); ASSERT( pFSectFmt && pSSectFmt && - pFSectFmt->GetCntnt(FALSE).GetCntntIdx() && - pSSectFmt->GetCntnt(FALSE).GetCntntIdx(), + pFSectFmt->GetCntnt(sal_False).GetCntntIdx() && + pSSectFmt->GetCntnt(sal_False).GetCntntIdx(), "ungueltige Sections" ); - return (int)((long)pFSectFmt->GetCntnt(FALSE).GetCntntIdx()->GetIndex()) - - pSSectFmt->GetCntnt(FALSE).GetCntntIdx()->GetIndex(); + return (int)((long)pFSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex()) - + pSSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex(); } int @@ -1019,9 +1018,9 @@ extern "C" { } // alle Sections, die von dieser abgeleitet sind -USHORT SwSectionFmt::GetChildSections( SwSections& rArr, +sal_uInt16 SwSectionFmt::GetChildSections( SwSections& rArr, SectionSort eSort, - BOOL bAllSections ) const + sal_Bool bAllSections ) const { rArr.Remove( 0, rArr.Count() ); @@ -1032,7 +1031,7 @@ USHORT SwSectionFmt::GetChildSections( SwSections& rArr, const SwNodeIndex* pIdx; for( pLast = aIter.First(TYPE(SwSectionFmt)); pLast; pLast = aIter.Next() ) if( bAllSections || - ( 0 != ( pIdx = ((SwSectionFmt*)pLast)->GetCntnt(FALSE). + ( 0 != ( pIdx = ((SwSectionFmt*)pLast)->GetCntnt(sal_False). GetCntntIdx()) && &pIdx->GetNodes() == &GetDoc()->GetNodes() )) { const SwSection* Dummy=((SwSectionFmt*)pLast)->GetSection(); @@ -1066,9 +1065,9 @@ USHORT SwSectionFmt::GetChildSections( SwSections& rArr, // erfrage, ob sich die Section im Nodes-Array oder UndoNodes-Array // befindet. -BOOL SwSectionFmt::IsInNodesArr() const +sal_Bool SwSectionFmt::IsInNodesArr() const { - const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx(); + const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx(); return pIdx && &pIdx->GetNodes() == &GetDoc()->GetNodes(); } @@ -1130,7 +1129,7 @@ void SwSectionFmt::UpdateParent() // Parent wurde veraendert if( bIsHidden == pSection->IsHiddenFlag() ) { - SwMsgPoolItem aMsgItem( static_cast<USHORT>(bIsHidden + SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden ? RES_SECTION_HIDDEN : RES_SECTION_NOT_HIDDEN ) ); pLast->Modify( &aMsgItem, &aMsgItem ); @@ -1164,7 +1163,7 @@ void SwSectionFmt::UpdateParent() // Parent wurde veraendert SwSectionNode* SwSectionFmt::GetSectionNode(bool const bAlways) { - const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx(); + const SwNodeIndex* pIdx = GetCntnt(sal_False).GetCntntIdx(); if( pIdx && ( bAlways || &pIdx->GetNodes() == &GetDoc()->GetNodes() )) return pIdx->GetNode().GetSectionNode(); return 0; @@ -1202,7 +1201,7 @@ bool SwSectionFmt::IsInUndo() const bool SwSectionFmt::IsInContent() const { - SwNodeIndex const*const pIdx = GetCntnt(FALSE).GetCntntIdx(); + SwNodeIndex const*const pIdx = GetCntnt(sal_False).GetCntntIdx(); OSL_ENSURE(pIdx, "SwSectionFmt::IsInContent: no index?"); return (pIdx) ? !GetDoc()->IsInHeaderFooter(*pIdx) : true; } @@ -1246,7 +1245,7 @@ void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd ) } const ::sfx2::SvBaseLink* pOwnLink( &(rSectNd.GetSection().GetBaseLink() ) ); const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->GetLinkManager().GetLinks(); - for ( USHORT n = rLnks.Count(); n > 0; ) + for ( sal_uInt16 n = rLnks.Count(); n > 0; ) { SwIntrnlSectRefLink* pSectLnk = dynamic_cast<SwIntrnlSectRefLink*>(&(*rLnks[ --n ])); if ( pSectLnk && pSectLnk != pOwnLink && @@ -1280,7 +1279,7 @@ void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) aValue <<= ::rtl::OUString( sName ); // beliebiger Name const ::sfx2::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks(); - for( USHORT n = rLnks.Count(); n; ) + for( sal_uInt16 n = rLnks.Count(); n; ) { ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); if( pLnk && pLnk != &rUpdLnk && @@ -1319,13 +1318,14 @@ void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) // Der Return-Wert gibt an, was mit der Shell zu geschehen hat: // 0 - Fehler, konnte DocShell nicht finden // 1 - DocShell ist ein existieren Document -// 2 - DocShell wurde neu angelegt, muss also wieder geschlossen werden +// 2 - DocShell wurde neu angelegt, muss also wieder geschlossen werden ( will be assigned to xLockRef additionaly ) int lcl_FindDocShell( SfxObjectShellRef& xDocSh, + SfxObjectShellLock& xLockRef, const String& rFileName, const String& rPasswd, String& rFilter, - INT16 nVersion, + sal_Int16 nVersion, SwDocShell* pDestSh ) { if( !rFileName.Len() ) @@ -1340,7 +1340,7 @@ int lcl_FindDocShell( SfxObjectShellRef& xDocSh, TypeId aType( TYPE(SwDocShell) ); SfxObjectShell* pShell = pDestSh; - BOOL bFirst = 0 != pShell; + sal_Bool bFirst = 0 != pShell; if( !bFirst ) // keine DocShell uebergeben, also beginne mit der ersten aus der @@ -1355,7 +1355,7 @@ int lcl_FindDocShell( SfxObjectShellRef& xDocSh, { const SfxPoolItem* pItem; if( ( SFX_ITEM_SET == pMed->GetItemSet()->GetItemState( - SID_VERSION, FALSE, &pItem ) ) + SID_VERSION, sal_False, &pItem ) ) ? (nVersion == ((SfxInt16Item*)pItem)->GetValue()) : !nVersion ) { @@ -1367,7 +1367,7 @@ int lcl_FindDocShell( SfxObjectShellRef& xDocSh, if( bFirst ) { - bFirst = FALSE; + bFirst = sal_False; pShell = SfxObjectShell::GetFirst( &aType ); } else @@ -1376,7 +1376,7 @@ int lcl_FindDocShell( SfxObjectShellRef& xDocSh, // 2. selbst die Date oeffnen SfxMedium* pMed = new SfxMedium( aTmpObj.GetMainURL( - INetURLObject::NO_DECODE ), STREAM_READ, TRUE ); + INetURLObject::NO_DECODE ), STREAM_READ, sal_True ); if( INET_PROT_FILE == aTmpObj.GetProtocol() ) pMed->DownLoad(); // nur mal das Medium anfassen (DownLoaden) @@ -1400,14 +1400,16 @@ int lcl_FindDocShell( SfxObjectShellRef& xDocSh, pMed->GetItemSet()->Put( SfxStringItem( SID_PASSWORD, rPasswd )); if( !pSfxFlt ) - aMatcher.DetectFilter( *pMed, &pSfxFlt, FALSE, FALSE ); + aMatcher.DetectFilter( *pMed, &pSfxFlt, sal_False, sal_False ); if( pSfxFlt ) { // ohne Filter geht gar nichts pMed->SetFilter( pSfxFlt ); - xDocSh = new SwDocShell( SFX_CREATE_MODE_INTERNAL ); + // if the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure + xLockRef = new SwDocShell( SFX_CREATE_MODE_INTERNAL ); + xDocSh = (SfxObjectShell*)xLockRef; if( xDocSh->DoLoad( pMed ) ) return 2; } @@ -1423,10 +1425,10 @@ int lcl_FindDocShell( SfxObjectShellRef& xDocSh, void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, const uno::Any & rValue ) { - SwSectionNode* pSectNd = rSectFmt.GetSectionNode( FALSE ); + SwSectionNode* pSectNd = rSectFmt.GetSectionNode( sal_False ); SwDoc* pDoc = rSectFmt.GetDoc(); - ULONG nDataFormat = SotExchange::GetFormatIdFromMimeType( rMimeType ); + sal_uLong nDataFormat = SotExchange::GetFormatIdFromMimeType( rMimeType ); if( !pSectNd || !pDoc || pDoc->IsInDtor() || ChkNoDataFlag() || sfx2::LinkManager::RegisterStatusInfoId() == nDataFormat ) @@ -1444,10 +1446,10 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, // <-- // Undo immer abschalten - BOOL bWasUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); - BOOL bWasVisibleLinks = pDoc->IsVisibleLinks(); - pDoc->SetVisibleLinks( FALSE ); + bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); + sal_Bool bWasVisibleLinks = pDoc->IsVisibleLinks(); + pDoc->SetVisibleLinks( sal_False ); SwPaM* pPam; ViewShell* pVSh = 0; @@ -1467,7 +1469,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, SwPosition aPos( aIdx, SwIndex( pNewNd, 0 )); aPos.nNode--; - pDoc->CorrAbs( aIdx, aEndIdx, aPos, TRUE ); + pDoc->CorrAbs( aIdx, aEndIdx, aPos, sal_True ); pPam = new SwPaM( aPos ); @@ -1504,6 +1506,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, RedlineMode_t eOldRedlineMode = nsRedlineMode_t::REDLINE_NONE; SfxObjectShellRef xDocSh; + SfxObjectShellLock xLockRef; int nRet; if( !sFileName.Len() ) { @@ -1512,7 +1515,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, } else { - nRet = lcl_FindDocShell( xDocSh, sFileName, + nRet = lcl_FindDocShell( xDocSh, xLockRef, sFileName, rSection.GetLinkFilePassword(), sFilter, 0, pDoc->GetDocShell() ); if( nRet ) @@ -1535,7 +1538,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, { const SfxPoolItem* pItem; if( SFX_ITEM_SET == xDocSh->GetMedium()->GetItemSet()-> - GetItemState( SID_PASSWORD, FALSE, &pItem ) ) + GetItemState( SID_PASSWORD, sal_False, &pItem ) ) rSection.SetLinkFilePassword( ((SfxStringItem*)pItem)->GetValue() ); } @@ -1545,7 +1548,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, if( sRange.Len() ) { // Rekursionen abfangen - BOOL bRecursion = FALSE; + sal_Bool bRecursion = sal_False; if( pSrcDoc == pDoc ) { SwServerObjectRef refObj( (SwServerObject*) @@ -1587,13 +1590,13 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, if ( pSrcDoc != pDoc && rSection.IsProtectFlag() ) { - pSrcDoc->GetLinkManager().UpdateAllLinks( FALSE, TRUE, FALSE, 0 ); + pSrcDoc->GetLinkManager().UpdateAllLinks( sal_False, sal_True, sal_False, 0 ); } // <-- if( pCpyRg ) { SwNodeIndex& rInsPos = pPam->GetPoint()->nNode; - BOOL bCreateFrm = rInsPos.GetIndex() <= + sal_Bool bCreateFrm = rInsPos.GetIndex() <= pDoc->GetNodes().GetEndOfExtras().GetIndex() || rInsPos.GetNode().FindTableNode(); @@ -1614,7 +1617,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, pPam->Move( fnMoveBackward, fnGoNode ); pPam->SetMark(); // beide SwPositions ummelden! - pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, TRUE ); + pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, sal_True ); pDoc->GetNodes().Delete( aSave, 1 ); } delete pCpyRg; @@ -1675,15 +1678,15 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, if( pESh ) { - pESh->Pop( FALSE ); + pESh->Pop( sal_False ); pPam = 0; // pam is deleted before } } - // Alle UndoActions entfernen und Undo wieder einschalten - pDoc->DelAllUndoObj(); - pDoc->DoUndo( bWasUndo ); + // remove all undo actions and turn undo on again + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + pDoc->GetIDocumentUndoRedo().DoUndo(bWasUndo); pDoc->SetVisibleLinks( bWasVisibleLinks ); pDoc->UnlockExpFlds(); @@ -1707,7 +1710,7 @@ void SwIntrnlSectRefLink::Closed() // kennzeichnen und das Flag umsetzen const SwSectionFmts& rFmts = pDoc->GetSections(); - for( USHORT n = rFmts.Count(); n; ) + for( sal_uInt16 n = rFmts.Count(); n; ) if( rFmts[ --n ] == &rSectFmt ) { ViewShell* pSh; @@ -1732,7 +1735,7 @@ void SwIntrnlSectRefLink::Closed() pDoc->UpdateSection( n, aSectionData ); // alle in der Section liegenden Links werden sichtbar - SwSectionNode* pSectNd = rSectFmt.GetSectionNode( FALSE ); + SwSectionNode* pSectNd = rSectFmt.GetSectionNode( sal_False ); if( pSectNd ) pSectNd->GetSection().MakeChildLinksVisible( *pSectNd ); @@ -1754,7 +1757,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) if (!pFmt || (CONTENT_SECTION == m_Data.GetType())) return ; - USHORT nUpdateType = sfx2::LINKUPDATE_ALWAYS; + sal_uInt16 nUpdateType = sfx2::LINKUPDATE_ALWAYS; if (!m_RefLink.Is()) { @@ -1789,7 +1792,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) String sFltr( sCmd.GetToken( 1, sfx2::cTokenSeperator ) ); String sRange( sCmd.GetToken( 2, sfx2::cTokenSeperator ) ); pFmt->GetDoc()->GetLinkManager().InsertFileLink( *pLnk, - static_cast<USHORT>(m_Data.GetType()), + static_cast<sal_uInt16>(m_Data.GetType()), sCmd.GetToken( 0, sfx2::cTokenSeperator ), ( sFltr.Len() ? &sFltr : 0 ), ( sRange.Len() ? &sRange : 0 ) ); @@ -1845,14 +1848,14 @@ void SwSection::BreakLink() const SwNode* SwIntrnlSectRefLink::GetAnchor() const { - return rSectFmt.GetSectionNode( FALSE ); + return rSectFmt.GetSectionNode( sal_False ); } -BOOL SwIntrnlSectRefLink::IsInRange( ULONG nSttNd, ULONG nEndNd, +sal_Bool SwIntrnlSectRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, xub_StrLen , xub_StrLen ) const { - SwStartNode* pSttNd = rSectFmt.GetSectionNode( FALSE ); + SwStartNode* pSttNd = rSectFmt.GetSectionNode( sal_False ); return pSttNd && nSttNd < pSttNd->GetIndex() && pSttNd->EndOfSectionIndex() < nEndNd; diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index cb804b102c0e..4451b32c736e 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -66,7 +66,7 @@ using namespace com::sun::star; -BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ); +sal_Bool SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ); TYPEINIT1( SwBaseLink, ::sfx2::SvBaseLink ); @@ -108,11 +108,11 @@ void SwBaseLink::DataChanged( const String& rMimeType, SwDoc* pDoc = pCntntNode->GetDoc(); if( pDoc->IsInDtor() || ChkNoDataFlag() || bIgnoreDataChanged ) { - bIgnoreDataChanged = FALSE; + bIgnoreDataChanged = sal_False; return ; } - ULONG nFmt = SotExchange::GetFormatIdFromMimeType( rMimeType ); + sal_uLong nFmt = SotExchange::GetFormatIdFromMimeType( rMimeType ); if( pCntntNode->IsNoTxtNode() && nFmt == sfx2::LinkManager::RegisterStatusInfoId() ) @@ -121,7 +121,7 @@ void SwBaseLink::DataChanged( const String& rMimeType, ::rtl::OUString sState; if( rValue.hasValue() && ( rValue >>= sState )) { - USHORT nEvent = 0; + sal_uInt16 nEvent = 0; switch( sState.toInt32() ) { case sfx2::LinkManager::STATE_LOAD_OK: nEvent = SVX_EVENT_IMAGE_LOAD; break; @@ -140,10 +140,10 @@ void SwBaseLink::DataChanged( const String& rMimeType, return; // das wars! } - BOOL bUpdate = FALSE; - BOOL bGraphicArrived = FALSE; - BOOL bGraphicPieceArrived = FALSE; - BOOL bDontNotify = FALSE; + sal_Bool bUpdate = sal_False; + sal_Bool bGraphicArrived = sal_False; + sal_Bool bGraphicPieceArrived = sal_False; + sal_Bool bDontNotify = sal_False; Size aGrfSz, aFrmFmtSz; if( pCntntNode->IsGrfNode() ) @@ -183,12 +183,12 @@ void SwBaseLink::DataChanged( const String& rMimeType, // gesetzt ist, dann muss "unten" der Teil von // bGraphicArrived durchlaufen werden! // (ansonten wird die Grafik in deft. Size gepaintet) - bGraphicArrived = TRUE; - bGraphicPieceArrived = FALSE; + bGraphicArrived = sal_True; + bGraphicPieceArrived = sal_False; } rGrfObj.SetGraphic( aGrf, rGrfObj.GetLink() ); - bUpdate = TRUE; + bUpdate = sal_True; // Bug 33999: damit der Node den Transparent-Status // richtig gesetzt hat, ohne auf die Grafik @@ -207,7 +207,7 @@ void SwBaseLink::DataChanged( const String& rMimeType, ((SwGrfNode*)pCntntNode)->SetTwipSize( Size(0,0) ); } else if( pCntntNode->IsOLENode() ) - bUpdate = TRUE; + bUpdate = sal_True; ViewShell *pSh = 0; SwEditShell* pESh = pDoc->GetEditShell( &pSh ); @@ -219,19 +219,19 @@ void SwBaseLink::DataChanged( const String& rMimeType, { SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED ); pCntntNode->Modify( &aMsgHint, &aMsgHint ); - bUpdate = FALSE; + bUpdate = sal_False; } } - static BOOL bInNotifyLinks = FALSE; + static sal_Bool bInNotifyLinks = sal_False; if( bUpdate && !bDontNotify && (!bSwapIn || bGraphicArrived) && !bInNotifyLinks) { - BOOL bLockView = FALSE; + sal_Bool bLockView = sal_False; if( pSh ) { bLockView = pSh->IsViewLocked(); - pSh->LockView( TRUE ); + pSh->LockView( sal_True ); } if( pESh ) @@ -239,16 +239,16 @@ void SwBaseLink::DataChanged( const String& rMimeType, else if( pSh ) pSh->StartAction(); - SwMsgPoolItem aMsgHint( static_cast<USHORT>( + SwMsgPoolItem aMsgHint( static_cast<sal_uInt16>( bGraphicArrived ? RES_GRAPHIC_ARRIVED : RES_UPDATE_ATTR ) ); if ( bGraphicArrived ) { //Alle benachrichtigen, die am gleichen Link horchen. - bInNotifyLinks = TRUE; + bInNotifyLinks = sal_True; const ::sfx2::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks(); - for( USHORT n = rLnks.Count(); n; ) + for( sal_uInt16 n = rLnks.Count(); n; ) { ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() && @@ -261,9 +261,9 @@ void SwBaseLink::DataChanged( const String& rMimeType, ( !bSwapIn || GRAPHIC_DEFAULT == pGrfNd->GetGrfObj().GetType())) { - pBLink->bIgnoreDataChanged = FALSE; + pBLink->bIgnoreDataChanged = sal_False; pBLink->DataChanged( rMimeType, rValue ); - pBLink->bIgnoreDataChanged = TRUE; + pBLink->bIgnoreDataChanged = sal_True; pGrfNd->SetGrafikArrived( ((SwGrfNode*)pCntntNode)-> IsGrafikArrived() ); @@ -279,7 +279,7 @@ void SwBaseLink::DataChanged( const String& rMimeType, } } - bInNotifyLinks = FALSE; + bInNotifyLinks = sal_False; } else { @@ -289,8 +289,8 @@ void SwBaseLink::DataChanged( const String& rMimeType, if( pESh ) { - const BOOL bEndActionByVirDev = pESh->IsEndActionByVirDev(); - pESh->SetEndActionByVirDev( TRUE ); + const sal_Bool bEndActionByVirDev = pESh->IsEndActionByVirDev(); + pESh->SetEndActionByVirDev( sal_True ); pESh->EndAllAction(); pESh->SetEndActionByVirDev( bEndActionByVirDev ); } @@ -298,13 +298,13 @@ void SwBaseLink::DataChanged( const String& rMimeType, pSh->EndAction(); if( pSh && !bLockView ) - pSh->LockView( FALSE ); + pSh->LockView( sal_False ); } } -BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ) +sal_Bool SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; ViewShell *pSh; CurrShell *pCurr = 0; if ( pGrfNd->GetDoc()->GetEditShell( &pSh ) ) @@ -342,7 +342,7 @@ BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ) SwFmtFrmSize aAttr( rOldAttr ); aAttr.SetSize( aCalcSz ); pFmt->SetFmtAttr( aAttr ); - bRet = TRUE; + bRet = sal_True; } if( !aSz.Width() ) @@ -354,19 +354,19 @@ BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ) SwNode *pANd; SwTableNode *pTblNd; if( pAPos && - 0 != (pANd = pDoc->GetNodes()[pAPos->nNode]) && + 0 != (pANd = & pAPos->nNode.GetNode()) && 0 != (pTblNd = pANd->FindTableNode()) ) { - const BOOL bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); + const sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); SwHTMLTableLayout *pLayout = pTblNd->GetTable().GetHTMLTableLayout(); if( pLayout ) { - const USHORT nBrowseWidth = + const sal_uInt16 nBrowseWidth = pLayout->GetBrowseWidthByTable( *pDoc ); if ( nBrowseWidth ) { - pLayout->Resize( nBrowseWidth, TRUE, TRUE, + pLayout->Resize( nBrowseWidth, sal_True, sal_True, bLastGrf ? HTMLTABLE_RESIZE_NOW : 500 ); } @@ -386,11 +386,11 @@ BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ) } -BOOL SwBaseLink::SwapIn( BOOL bWaitForData, BOOL bNativFormat ) +sal_Bool SwBaseLink::SwapIn( sal_Bool bWaitForData, sal_Bool bNativFormat ) { - bSwapIn = TRUE; + bSwapIn = sal_True; - BOOL bRes; + sal_Bool bRes; if( !GetObj() && ( bNativFormat || ( !IsSynchron() && bWaitForData ) )) { @@ -439,27 +439,27 @@ BOOL SwBaseLink::SwapIn( BOOL bWaitForData, BOOL bNativFormat ) if( bWaitForData && !GetObj() ) { ASSERT( !this, "das SvxFileObject wurde in einem GetData geloescht!" ); - bRes = FALSE; + bRes = sal_False; } else if( 0 != ( bRes = aValue.hasValue() ) ) { //JP 14.04.99: Bug 64820 - das Flag muss beim SwapIn natuerlich // zurueckgesetzt werden. Die Daten sollen ja neu // uebernommen werden - bIgnoreDataChanged = FALSE; + bIgnoreDataChanged = sal_False; DataChanged( aMimeType, aValue ); } } else if( !IsSynchron() && bWaitForData ) { - SetSynchron( TRUE ); + SetSynchron( sal_True ); bRes = Update(); - SetSynchron( FALSE ); + SetSynchron( sal_False ); } else bRes = Update(); - bSwapIn = FALSE; + bSwapIn = sal_False; // --> OD 2005-04-11 #i46300# - deactivate fix for issues i9861 and i33293 // if ( pTBIS && pTBIS->isTouched() ) @@ -511,7 +511,7 @@ const SwNode* SwBaseLink::GetAnchor() const return 0; } -BOOL SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const +sal_Bool SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const { SwServerObjectRef aRef( (SwServerObject*)GetObj() ); if( aRef.Is() ) @@ -521,14 +521,14 @@ BOOL SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const // handelt es sich um eine Rekursion. return aRef->IsLinkInServer( pChkLnk ); } - return FALSE; + return sal_False; } -BOOL SwBaseLink::IsInRange( ULONG, ULONG, xub_StrLen, xub_StrLen ) const +sal_Bool SwBaseLink::IsInRange( sal_uLong, sal_uLong, xub_StrLen, xub_StrLen ) const { // Grafik oder OLE-Links nicht, // Felder oder Sections haben eigene Ableitung! - return FALSE; + return sal_False; } SwBaseLink::~SwBaseLink() |