diff options
Diffstat (limited to 'sw/source/core/doc/docfmt.cxx')
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 404 |
1 files changed, 209 insertions, 195 deletions
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 26e20128f375..d0f60e5bb058 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -54,12 +54,14 @@ #include <fmtcntnt.hxx> #include <frmatr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <hints.hxx> // fuer SwHyphenBug (in SetDefault) #include <ndtxt.hxx> #include <pam.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoAttribute.hxx> #include <ndgrf.hxx> #include <pagedesc.hxx> // Fuer Sonderbehandlung in InsFrmFmt #include <rolbck.hxx> // Undo-Attr @@ -95,14 +97,14 @@ SV_IMPL_PTRARR(SwSpzFrmFmts,SwFrmFmtPtr) * interne Funktionen */ -BOOL SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs ) +sal_Bool SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs ) { SwTxtFmtColl *pDel = (SwTxtFmtColl*) pArgs; if ( &rpTxtColl->GetNextTxtFmtColl() == pDel ) { rpTxtColl->SetNextTxtFmtColl( *rpTxtColl ); } - return TRUE; + return sal_True; } /* @@ -116,7 +118,7 @@ struct ParaRstFmt SwHistory* pHistory; const SwPosition *pSttNd, *pEndNd; const SfxItemSet* pDelSet; - USHORT nWhich; + sal_uInt16 nWhich; bool bReset; // --> OD 2007-11-06 #i62575# bool bResetListAttrs; @@ -127,7 +129,7 @@ struct ParaRstFmt bool bKeepOutlineLevelAttr; //#outline level,add by zhaojianwei ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd, - SwHistory* pHst, USHORT nWhch = 0, const SfxItemSet* pSet = 0 ) + SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0 ) : pFmtColl(0), pHistory(pHst), pSttNd(pStt), @@ -164,14 +166,14 @@ struct ParaRstFmt * (wird bei Selectionen am Start/Ende und bei keiner SSelection benoetigt) */ -BOOL lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) +sal_Bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) { ParaRstFmt* pPara = (ParaRstFmt*)pArgs; SwTxtNode * pTxtNode = (SwTxtNode*)rpNd->GetTxtNode(); if( pTxtNode && pTxtNode->GetpSwpHints() ) { SwIndex aSt( pTxtNode, 0 ); - USHORT nEnd = pTxtNode->Len(); + sal_uInt16 nEnd = pTxtNode->Len(); if( &pPara->pSttNd->nNode.GetNode() == pTxtNode && pPara->pSttNd->nContent.GetIndex() ) @@ -194,16 +196,16 @@ BOOL lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich, pPara->pDelSet, pPara->bInclRefToxMark ); } - return TRUE; + return sal_True; } -BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) +sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) { ParaRstFmt* pPara = (ParaRstFmt*)pArgs; SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode(); if( pNode && pNode->HasSwAttrSet() ) { - const BOOL bLocked = pNode->IsModifyLocked(); + const sal_Bool bLocked = pNode->IsModifyLocked(); pNode->LockModify(); SwDoc* pDoc = pNode->GetDoc(); @@ -220,7 +222,7 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) const SfxItemSet* pSet = pNode->GetpSwAttrSet(); // --> OD 2008-04-15 #refactorlists# -// std::vector<USHORT> aClearWhichIds; +// std::vector<sal_uInt16> aClearWhichIds; SvUShorts aClearWhichIds; // <-- // --> OD 2008-04-15 #refactorlists# @@ -245,15 +247,15 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) // <-- const SfxPoolItem* pItem; - // USHORT __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, //#outline level,removed by zhaojianwei + // sal_uInt16 __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, //#outline level,removed by zhaojianwei // RES_PARATR_NUMRULE }; - //for( USHORT n = 0; n < 3; ++n ) - USHORT __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei + //for( sal_uInt16 n = 0; n < 3; ++n ) + sal_uInt16 __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei RES_PARATR_NUMRULE, RES_PARATR_OUTLINELEVEL }; - for( USHORT n = 0; n < 4; ++n ) //<-end,zhaojianwei + for( sal_uInt16 n = 0; n < 4; ++n ) //<-end,zhaojianwei { - if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], FALSE, &pItem )) + if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], sal_False, &pItem )) { bool bSave = false; switch( aSavIds[ n ] ) @@ -312,14 +314,14 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) // <-- SfxItemIter aIter( *pPara->pDelSet ); pItem = aIter.FirstItem(); - while( TRUE ) + while( sal_True ) { // --> OD 2008-04-14 #refactorlists# // if ( ( pItem->Which() != RES_PAGEDESC && pItem->Which() != RES_BREAK && pItem->Which() != RES_PARATR_NUMRULE ) || - ( aSet.GetItemState( pItem->Which(), FALSE ) != SFX_ITEM_SET ) ) + ( aSet.GetItemState( pItem->Which(), sal_False ) != SFX_ITEM_SET ) ) { pNode->ResetAttr( pItem->Which() ); } @@ -350,30 +352,29 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) pNode->UnlockModify(); } } - return TRUE; + return sal_True; } -void SwDoc::RstTxtAttrs(const SwPaM &rRg, BOOL bInclRefToxMark ) +void SwDoc::RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark ) { SwHistory* pHst = 0; SwDataChanged aTmp( rRg, 0 ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, RES_CHRFMT ); pHst = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End(); ParaRstFmt aPara( pStt, pEnd, pHst ); - aPara.bInclRefToxMark = ( bInclRefToxMark == TRUE ); + aPara.bInclRefToxMark = ( bInclRefToxMark == sal_True ); GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1, lcl_RstTxtAttr, &aPara ); SetModified(); } void SwDoc::ResetAttrs( const SwPaM &rRg, - BOOL bTxtAttr, + sal_Bool bTxtAttr, const SvUShortsSort* pAttrs, // --> OD 2008-11-28 #b96644# const bool bSendDataChangedEvents ) @@ -382,7 +383,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SwPaM* pPam = (SwPaM*)&rRg; if( !bTxtAttr && pAttrs && pAttrs->Count() && RES_TXTATR_END > (*pAttrs)[ 0 ] ) - bTxtAttr = TRUE; + bTxtAttr = sal_True; if( !rRg.HasMark() ) { @@ -393,7 +394,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, pPam = new SwPaM( *rRg.GetPoint() ); SwIndex& rSt = pPam->GetPoint()->nContent; - USHORT nMkPos, nPtPos = rSt.GetIndex(); + sal_uInt16 nMkPos, nPtPos = rSt.GetIndex(); // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut // dann wird dessen Bereich genommen @@ -412,7 +413,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, pTxtNd->GetTxt(), nPtPos, pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ), WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/, - TRUE ); + sal_True ); if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos ) { @@ -423,7 +424,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, { nPtPos = nMkPos = rSt.GetIndex(); if( bTxtAttr ) - pTxtNd->DontExpandFmt( rSt, TRUE ); + pTxtNd->DontExpandFmt( rSt, sal_True ); } } @@ -441,24 +442,23 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, } // <-- SwHistory* pHst = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, - static_cast<USHORT>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL )); + static_cast<sal_uInt16>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL )); if( pAttrs && pAttrs->Count() ) { pUndo->SetAttrs( *pAttrs ); } pHst = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End(); ParaRstFmt aPara( pStt, pEnd, pHst ); // mst: not including META here; it seems attrs with CH_TXTATR are omitted - USHORT __FAR_DATA aResetableSetRange[] = { + sal_uInt16 __FAR_DATA aResetableSetRange[] = { RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, @@ -476,7 +476,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SfxItemSet aDelSet( GetAttrPool(), aResetableSetRange ); if( pAttrs && pAttrs->Count() ) { - for( USHORT n = pAttrs->Count(); n; ) + for( sal_uInt16 n = pAttrs->Count(); n; ) if( POOLATTR_END > (*pAttrs)[ --n ] ) aDelSet.Put( *GetDfltAttr( (*pAttrs)[ n ] )); @@ -484,7 +484,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, aPara.pDelSet = &aDelSet; } - BOOL bAdd = TRUE; + sal_Bool bAdd = sal_True; SwNodeIndex aTmpStt( pStt->nNode ); SwNodeIndex aTmpEnd( pEnd->nNode ); if( pStt->nContent.GetIndex() ) // nur ein Teil @@ -497,7 +497,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, const SfxPoolItem* pItem = aIter.GetCurItem(); SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END ); - while( TRUE ) + while( sal_True ) { if( IsInRange( aCharFmtSetRange, pItem->Which() )) { @@ -539,7 +539,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, } if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() ) // dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr - aTmpEnd++, bAdd = FALSE; + aTmpEnd++, bAdd = sal_False; else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() ) { SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode(); @@ -547,7 +547,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, { SfxItemIter aIter( *pTNd->GetpSwAttrSet() ); const SfxPoolItem* pItem = aIter.GetCurItem(); - while( TRUE ) + while( sal_True ) { if( IsInRange( aCharFmtSetRange, pItem->Which() )) { @@ -615,7 +615,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, { SfxItemIter aIter( rChgSet ); const SfxPoolItem* pItem = aIter.FirstItem(); - const USHORT nWhich = pItem->Which(); + const sal_uInt16 nWhich = pItem->Which(); if ( isCHRATR(nWhich) || (RES_TXTATR_CHARFMT == nWhich) || @@ -695,7 +695,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, } // <-- - SwNumFmt aNumFmt = pNumRule->Get(static_cast<USHORT>(pTxtNd->GetActualListLevel())); + SwNumFmt aNumFmt = pNumRule->Get(static_cast<sal_uInt16>(pTxtNd->GetActualListLevel())); SwCharFmt * pCharFmt = pDoc->FindCharFmtByName(aNumFmt.GetCharFmtName()); @@ -734,7 +734,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pStt->nNode, pStt->nContent.GetIndex() ); if( pUndo ) - pUndo->SaveRedlineData( aPam, TRUE ); + pUndo->SaveRedlineData( aPam, sal_True ); if( pDoc->IsRedlineOn() ) pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true); @@ -759,8 +759,8 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, aTxtSet.Put( rChgSet ); if( aTxtSet.Count() ) { - USHORT nInsCnt = rSt.GetIndex(); - USHORT nEnd = pStt->nNode == pEnd->nNode + sal_uInt16 nInsCnt = rSt.GetIndex(); + sal_uInt16 nEnd = pStt->nNode == pEnd->nNode ? pEnd->nContent.GetIndex() : pNode->Len(); SwRegHistory history( pNode, *pNode, pHistory ); @@ -771,7 +771,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, && pDoc->GetRedlineTbl().Count()))) { // wurde Text-Inhalt eingefuegt? (RefMark/TOXMarks ohne Ende) - BOOL bTxtIns = nInsCnt != rSt.GetIndex(); + sal_Bool bTxtIns = nInsCnt != rSt.GetIndex(); // wurde Inhalt eingefuegt oder ueber die Selektion gesetzt? SwPaM aPam( pStt->nNode, bTxtIns ? nInsCnt + 1 : nEnd, pStt->nNode, nInsCnt ); @@ -795,7 +795,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, SwTableNode* pTblNd; const SwFmtPageDesc* pDesc; if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PAGEDESC, - FALSE, (const SfxPoolItem**)&pDesc )) + sal_False, (const SfxPoolItem**)&pDesc )) { if( pNode ) { @@ -844,7 +844,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if( pNode && 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) && 0 != (pTblNd = pNode->FindTableNode() ) && SFX_ITEM_SET == pOtherSet->GetItemState( RES_BREAK, - FALSE, (const SfxPoolItem**)&pBreak ) ) + sal_False, (const SfxPoolItem**)&pBreak ) ) { SwTableNode* pCurTblNd = pTblNd; while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) ) @@ -873,9 +873,9 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, { // wenns eine PoolNumRule ist, diese ggfs. anlegen const SwNumRuleItem* pRule; - USHORT nPoolId; + sal_uInt16 nPoolId; if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PARATR_NUMRULE, - FALSE, (const SfxPoolItem**)&pRule ) && + sal_False, (const SfxPoolItem**)&pRule ) && !pDoc->FindNumRulePtr( pRule->GetValue() ) && USHRT_MAX != (nPoolId = SwStyleNameMapper::GetPoolIdFromUIName ( pRule->GetValue(), nsSwGetPoolIdFromName::GET_POOLID_NUMRULE )) ) @@ -896,7 +896,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, { SwTxtNode* pTxtNd = static_cast<SwTxtNode*>(pNode); const SwIndex& rSt = pStt->nContent; - USHORT nMkPos, nPtPos = rSt.GetIndex(); + sal_uInt16 nMkPos, nPtPos = rSt.GetIndex(); const String& rStr = pTxtNd->GetTxt(); // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut @@ -916,7 +916,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pTxtNd->GetTxt(), nPtPos, pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ), WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/, - TRUE ); + sal_True ); if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos ) { @@ -958,7 +958,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, SwPaM aPam( *pNode, nMkPos, *pNode, nPtPos ); if( pUndo ) - pUndo->SaveRedlineData( aPam, FALSE ); + pUndo->SaveRedlineData( aPam, sal_False ); pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, aPam ), true); } } @@ -975,12 +975,12 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if( pDoc->IsRedlineOn() && pCharSet && pCharSet->Count() ) { if( pUndo ) - pUndo->SaveRedlineData( rRg, FALSE ); + pUndo->SaveRedlineData( rRg, sal_False ); pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rRg ), true); } /* jetzt wenn Bereich */ - ULONG nNodes = 0; + sal_uLong nNodes = 0; SwNodeIndex aSt( pDoc->GetNodes() ); SwNodeIndex aEnd( pDoc->GetNodes() ); @@ -988,7 +988,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if( pNode ) { - USHORT nLen = pNode->Len(); + sal_uInt16 nLen = pNode->Len(); if( pStt->nNode != pEnd->nNode ) aCntEnd.Assign( pNode, nLen ); @@ -1035,7 +1035,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pNode = pEnd->nNode.GetNode().GetCntntNode(); if(pNode) { - USHORT nLen = pNode->Len(); + sal_uInt16 nLen = pNode->Len(); if( aCntEnd.GetIndex() != nLen ) { // the SwRegHistory inserts the attribute into the TxtNode! @@ -1075,9 +1075,9 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pDoc->GetNodes().ForEach( aSt, aEnd, lcl_RstTxtAttr, &aPara ); } - BOOL bCreateSwpHints = pCharSet && ( - SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, FALSE ) || - SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, FALSE ) ); + sal_Bool bCreateSwpHints = pCharSet && ( + SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, sal_False ) || + SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, sal_False ) ); for(; aSt < aEnd; aSt++ ) { @@ -1125,9 +1125,9 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, { SwDataChanged aTmp( rRg, 0 ); SwUndoAttr* pUndoAttr = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoAttr = new SwUndoAttr( rRg, rHt, nFlags ); } @@ -1135,8 +1135,10 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, aSet.Put( rHt ); bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr ); - if( DoesUndo() ) - AppendUndo( pUndoAttr ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( pUndoAttr ); + } if( bRet ) SetModified(); @@ -1148,16 +1150,18 @@ bool SwDoc::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet, { SwDataChanged aTmp( rRg, 0 ); SwUndoAttr* pUndoAttr = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoAttr = new SwUndoAttr( rRg, rSet, nFlags ); } bool bRet = lcl_InsAttr( this, rRg, rSet, nFlags, pUndoAttr ); - if( DoesUndo() ) - AppendUndo( pUndoAttr ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( pUndoAttr ); + } if( bRet ) SetModified(); @@ -1179,14 +1183,17 @@ void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt ) // das alte in die Undo-History aufgenommen void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoFmtAttrHelper aTmp( rFmt ); rFmt.SetFmtAttr( rSet ); if ( aTmp.GetUndo() ) { - AppendUndo( aTmp.ReleaseUndo() ); + GetIDocumentUndoRedo().AppendUndo( aTmp.ReleaseUndo() ); + } + else + { + GetIDocumentUndoRedo().ClearRedo(); } } else @@ -1197,19 +1204,21 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) } // --> OD 2008-02-12 #newlistlevelattrs# -void SwDoc::ResetAttrAtFormat( const USHORT nWhichId, +void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId, SwFmt& rChangedFormat ) { - SwUndo* pUndo = 0; - if ( DoesUndo() ) - pUndo = new SwUndoFmtResetAttr( rChangedFormat, nWhichId ); + SwUndo *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoFmtResetAttr( rChangedFormat, nWhichId ) + : 0; - const BOOL bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId ); + const sal_Bool bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId ); if ( bAttrReset ) { if ( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } SetModified(); } @@ -1227,14 +1236,14 @@ int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth, // auf dem gleichen TabStop (gepoolt!) vorgenommen // wird. Als Modify wird ein FmtChg verschickt. - USHORT nOldCnt = rChgTabStop.Count(); + sal_uInt16 nOldCnt = rChgTabStop.Count(); if( !nOldCnt || nOldWidth == nNewWidth ) - return FALSE; + return sal_False; // suche den Anfang der Defaults SvxTabStop* pTabs = ((SvxTabStop*)rChgTabStop.GetStart()) + (nOldCnt-1); - USHORT n; + sal_uInt16 n; for( n = nOldCnt; n ; --n, --pTabs ) if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() ) @@ -1242,7 +1251,7 @@ int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth, ++n; if( n < nOldCnt ) // die DefTabStops loeschen rChgTabStop.Remove( n, nOldCnt - n ); - return TRUE; + return sal_True; } // Setze das Attribut als neues default Attribut in diesem Dokument. @@ -1263,12 +1272,12 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ), aNew( GetAttrPool(), rSet.GetRanges() ); SfxItemIter aIter( rSet ); - USHORT nWhich; + sal_uInt16 nWhich; const SfxPoolItem* pItem = aIter.GetCurItem(); SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool(); - while( TRUE ) + while( sal_True ) { - BOOL bCheckSdrDflt = FALSE; + sal_Bool bCheckSdrDflt = sal_False; nWhich = pItem->Which(); aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) ); GetAttrPool().SetPoolDefaultItem( *pItem ); @@ -1306,7 +1315,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) // copy also the defaults if( bCheckSdrDflt ) { - USHORT nEdtWhich, nSlotId; + sal_uInt16 nEdtWhich, nSlotId; if( 0 != (nSlotId = GetAttrPool().GetSlotId( nWhich ) ) && nSlotId != nWhich && 0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) && @@ -1326,15 +1335,14 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) if( aNew.Count() && aCallMod.GetDepends() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoDefaultAttr( aOld ) ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDefaultAttr( aOld ) ); } const SfxPoolItem* pTmpItem; if( ( SFX_ITEM_SET == - aNew.GetItemState( RES_PARATR_TABSTOP, FALSE, &pTmpItem ) ) && + aNew.GetItemState( RES_PARATR_TABSTOP, sal_False, &pTmpItem ) ) && ((SvxTabStopItem*)pTmpItem)->Count() ) { // TabStop-Aenderungen behandeln wir erstmal anders: @@ -1346,7 +1354,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) SwTwips nNewWidth = (*(SvxTabStopItem*)pTmpItem)[ 0 ].GetTabPos(), nOldWidth = ((SvxTabStopItem&)aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos(); - int bChg = FALSE; + int bChg = sal_False; sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_PARATR_TABSTOP ); for( sal_uInt32 n = 0; n < nMaxItems; ++n ) if( 0 != (pTmpItem = GetAttrPool().GetItem2( RES_PARATR_TABSTOP, n ) )) @@ -1380,7 +1388,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) } // Erfrage das Default Attribut in diesem Dokument. -const SfxPoolItem& SwDoc::GetDefault( USHORT nFmtHint ) const +const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFmtHint ) const { return GetAttrPool().GetDefaultItem( nFmtHint ); } @@ -1388,7 +1396,7 @@ const SfxPoolItem& SwDoc::GetDefault( USHORT nFmtHint ) const /* * Loeschen der Formate */ -void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) +void SwDoc::DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast) { SwCharFmt * pDel = (*pCharFmtTbl)[nFmt]; @@ -1396,12 +1404,12 @@ void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_CHAR, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoCharFmtDelete(pDel, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pCharFmtTbl->DeleteAndDestroy(nFmt); @@ -1409,15 +1417,15 @@ void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) SetModified(); } -void SwDoc::DelCharFmt( SwCharFmt *pFmt, BOOL bBroadcast ) +void SwDoc::DelCharFmt( SwCharFmt *pFmt, sal_Bool bBroadcast ) { - USHORT nFmt = pCharFmtTbl->GetPos( pFmt ); + sal_uInt16 nFmt = pCharFmtTbl->GetPos( pFmt ); ASSERT( USHRT_MAX != nFmt, "Fmt not found," ); DelCharFmt( nFmt, bBroadcast ); } -void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) +void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast ) { if( pFmt->ISA( SwTableBoxFmt ) || pFmt->ISA( SwTableLineFmt )) { @@ -1430,7 +1438,7 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) //Das Format muss in einem der beiden Arrays stehen, in welchem //werden wir schon merken. - USHORT nPos; + sal_uInt16 nPos; if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) ) { if (bBroadcast) @@ -1438,11 +1446,11 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) SFX_STYLE_FAMILY_FRAME, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoFrmFmtDelete(pFmt, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pFrmFmtTbl->DeleteAndDestroy( nPos ); @@ -1459,7 +1467,7 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt ) { - USHORT nPos = pTblFrmFmtTbl->GetPos( pFmt ); + sal_uInt16 nPos = pTblFrmFmtTbl->GetPos( pFmt ); ASSERT( USHRT_MAX != nPos, "Fmt not found," ); pTblFrmFmtTbl->DeleteAndDestroy( nPos ); } @@ -1486,13 +1494,13 @@ SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const String &rFmtName, } -USHORT SwDoc::GetTblFrmFmtCount(BOOL bUsed) const +sal_uInt16 SwDoc::GetTblFrmFmtCount(sal_Bool bUsed) const { - USHORT nCount = pTblFrmFmtTbl->Count(); + sal_uInt16 nCount = pTblFrmFmtTbl->Count(); if(bUsed) { - SwAutoFmtGetDocNode aGetHt( &aNodes ); - for ( USHORT i = nCount; i; ) + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); + for ( sal_uInt16 i = nCount; i; ) { if((*pTblFrmFmtTbl)[--i]->GetInfo( aGetHt )) @@ -1504,14 +1512,13 @@ USHORT SwDoc::GetTblFrmFmtCount(BOOL bUsed) const } -SwFrmFmt& SwDoc::GetTblFrmFmt(USHORT nFmt, BOOL bUsed ) const +SwFrmFmt& SwDoc::GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed ) const { - USHORT nRemoved = 0; + sal_uInt16 nRemoved = 0; if(bUsed) { - SwAutoFmtGetDocNode aGetHt( &aNodes ); - - for ( USHORT i = 0; i <= nFmt; i++ ) + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); + for ( sal_uInt16 i = 0; i <= nFmt; i++ ) { while ( (*pTblFrmFmtTbl)[ i + nRemoved]->GetInfo( aGetHt )) { @@ -1534,7 +1541,7 @@ SwTableFmt* SwDoc::MakeTblFrmFmt( const String &rFmtName, SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom ); @@ -1548,11 +1555,11 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName, BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } @@ -1561,7 +1568,7 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName, SwFmt *SwDoc::_MakeFrmFmt(const String &rFmtName, SwFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwFrmFmt *pFrmFmt = dynamic_cast<SwFrmFmt*>(pDerivedFrom); pFrmFmt = MakeFrmFmt( rFmtName, pFrmFmt, bBroadcast, bAuto ); @@ -1572,20 +1579,20 @@ SwFmt *SwDoc::_MakeFrmFmt(const String &rFmtName, // --> OD 2005-01-13 #i40550# - add parameter <bAuto> - not relevant SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName, SwCharFmt *pDerivedFrom, - BOOL bBroadcast, - BOOL ) + sal_Bool bBroadcast, + sal_Bool ) // <-- { SwCharFmt *pFmt = new SwCharFmt( GetAttrPool(), rFmtName, pDerivedFrom ); pCharFmtTbl->Insert( pFmt, pCharFmtTbl->Count() ); - pFmt->SetAuto( FALSE ); + pFmt->SetAuto( sal_False ); SetModified(); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoCharFmtCreate(pFmt, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1599,7 +1606,7 @@ SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName, SwFmt *SwDoc::_MakeCharFmt(const String &rFmtName, SwFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwCharFmt *pCharFmt = dynamic_cast<SwCharFmt*>(pDerivedFrom); pCharFmt = MakeCharFmt( rFmtName, pCharFmt, bBroadcast, bAuto ); @@ -1614,21 +1621,21 @@ SwFmt *SwDoc::_MakeCharFmt(const String &rFmtName, // --> OD 2005-01-13 #i40550# - add parameter <bAuto> - not relevant SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName, SwTxtFmtColl *pDerivedFrom, - BOOL bBroadcast, - BOOL ) + sal_Bool bBroadcast, + sal_Bool ) // <-- { SwTxtFmtColl *pFmtColl = new SwTxtFmtColl( GetAttrPool(), rFmtName, pDerivedFrom ); pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count()); - pFmtColl->SetAuto( FALSE ); + pFmtColl->SetAuto( sal_False ); SetModified(); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoTxtFmtCollCreate(pFmtColl, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1640,7 +1647,7 @@ SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName, SwFmt *SwDoc::_MakeTxtFmtColl(const String &rFmtName, SwFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwTxtFmtColl *pTxtFmtColl = dynamic_cast<SwTxtFmtColl*>(pDerivedFrom); pTxtFmtColl = MakeTxtFmtColl( rFmtName, pTxtFmtColl, bBroadcast, bAuto ); @@ -1651,12 +1658,12 @@ SwFmt *SwDoc::_MakeTxtFmtColl(const String &rFmtName, //FEATURE::CONDCOLL SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const String &rFmtName, SwTxtFmtColl *pDerivedFrom, - BOOL bBroadcast) + sal_Bool bBroadcast) { SwConditionTxtFmtColl*pFmtColl = new SwConditionTxtFmtColl( GetAttrPool(), rFmtName, pDerivedFrom ); pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count()); - pFmtColl->SetAuto( FALSE ); + pFmtColl->SetAuto( sal_False ); SetModified(); if (bBroadcast) @@ -1675,12 +1682,12 @@ SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const String &rFmtName, SwGrfFmtColl *pFmtColl = new SwGrfFmtColl( GetAttrPool(), rFmtName, pDerivedFrom ); pGrfFmtCollTbl->Insert( pFmtColl, pGrfFmtCollTbl->Count() ); - pFmtColl->SetAuto( FALSE ); + pFmtColl->SetAuto( sal_False ); SetModified(); return pFmtColl; } -void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) +void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, sal_Bool bBroadcast) { ASSERT( nFmtColl, "Remove fuer Coll 0." ); @@ -1693,12 +1700,12 @@ void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoTxtFmtCollDelete * pUndo = new SwUndoTxtFmtCollDelete(pDel, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // Die FmtColl austragen @@ -1710,14 +1717,14 @@ void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) SetModified(); } -void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, BOOL bBroadcast ) +void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, sal_Bool bBroadcast ) { - USHORT nFmt = pTxtFmtCollTbl->GetPos( pColl ); + sal_uInt16 nFmt = pTxtFmtCollTbl->GetPos( pColl ); ASSERT( USHRT_MAX != nFmt, "Collection not found," ); DelTxtFmtColl( nFmt, bBroadcast ); } -BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) +sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) { // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs; SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode(); @@ -1794,10 +1801,10 @@ BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) pPara->nWhich++; } - return TRUE; + return sal_True; } -BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg, +sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt, bool bReset, bool bResetListAttrs ) @@ -1805,18 +1812,17 @@ BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg, SwDataChanged aTmp( rRg, 0 ); const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End(); SwHistory* pHst = 0; - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); // --> OD 2008-04-15 #refactorlists# SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt, bReset, bResetListAttrs ); // <-- pHst = pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } ParaRstFmt aPara( pStt, pEnd, pHst ); @@ -1829,7 +1835,7 @@ BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg, GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1, lcl_SetTxtFmtColl, &aPara ); if( !aPara.nWhich ) - bRet = FALSE; // keinen gueltigen Node gefunden + bRet = sal_False; // keinen gueltigen Node gefunden if( bRet ) SetModified(); @@ -1846,7 +1852,7 @@ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt, // kein-Autoformat || default Format || Collection-Format // dann suche danach. if( !rFmt.IsAuto() || !rFmt.GetRegisteredIn() ) - for( USHORT n = 0; n < rFmtArr.Count(); n++ ) + for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ ) { // ist die Vorlage schon im Doc vorhanden ?? if( ((SwFmt*)rFmtArr[n])->GetName().Equals( rFmt.GetName() )) @@ -1861,10 +1867,10 @@ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt, // erzeuge das Format und kopiere die Attribute // --> OD 2005-01-13 #i40550# - SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent, FALSE, TRUE ); + SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent, sal_False, sal_True ); // <-- pNewFmt->SetAuto( rFmt.IsAuto() ); - pNewFmt->CopyAttrs( rFmt, TRUE ); // kopiere Attribute + pNewFmt->CopyAttrs( rFmt, sal_True ); // kopiere Attribute pNewFmt->SetPoolFmtId( rFmt.GetPoolFmtId() ); pNewFmt->SetPoolHelpId( rFmt.GetPoolHelpId() ); @@ -1913,7 +1919,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), rColl.GetName(), pParent); pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() ); - pNewColl->SetAuto( FALSE ); + pNewColl->SetAuto( sal_False ); SetModified(); // Kopiere noch die Bedingungen @@ -1925,7 +1931,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pNewColl = MakeTxtFmtColl( rColl.GetName(), pParent ); // kopiere jetzt noch die Auto-Formate oder kopiere die Attribute - pNewColl->CopyAttrs( rColl, TRUE ); + pNewColl->CopyAttrs( rColl, sal_True ); // setze noch den Outline-Level //if( NO_NUMBERING != rColl.GetOutlineLevel() ) //#outline level,zhaojianwei @@ -1947,7 +1953,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) { const SfxPoolItem* pItem; if( SFX_ITEM_SET == pNewColl->GetItemState( RES_PARATR_NUMRULE, - FALSE, &pItem )) + sal_False, &pItem )) { const SwNumRule* pRule; const String& rName = ((SwNumRuleItem*)pItem)->GetValue(); @@ -1957,7 +1963,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) { SwNumRule* pDestRule = FindNumRulePtr( rName ); if( pDestRule ) - pDestRule->SetInvalidRule( TRUE ); + pDestRule->SetInvalidRule( sal_True ); else MakeNumRule( rName, pRule ); } @@ -1996,7 +2002,7 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl ) SwPageDesc* lcl_FindPageDesc( const SwPageDescs& rArr, const String& rName ) { - for( USHORT n = rArr.Count(); n; ) + for( sal_uInt16 n = rArr.Count(); n; ) { SwPageDesc* pDesc = rArr[ --n ]; if( pDesc->GetName() == rName ) @@ -2010,7 +2016,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt ) { - USHORT nSrc; + sal_uInt16 nSrc; SwFmt* pSrc, *pDest; // 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!) @@ -2026,7 +2032,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, MakeCondTxtFmtColl( pSrc->GetName(), (SwTxtFmtColl*)&rDfltFmt ); else // --> OD 2005-01-13 #i40550# - (this->*fnCopyFmt)( pSrc->GetName(), &rDfltFmt, FALSE, TRUE ); + (this->*fnCopyFmt)( pSrc->GetName(), &rDfltFmt, sal_False, sal_True ); // <-- } } @@ -2039,14 +2045,21 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, continue; pDest = FindFmtByName( rDestArr, pSrc->GetName() ); +<<<<<<< local pDest->SetAuto( FALSE ); +======= + pDest->SetAuto( sal_False ); +// pDest->ResetAllAttr(); +// pDest->CopyAttrs( *pSrc, sal_True ); // kopiere Attribute +//JP 19.02.96: ist so wohl optimaler - loest ggfs. kein Modify aus! +>>>>>>> other pDest->DelDiffs( *pSrc ); // #i94285#: existing <SwFmtPageDesc> instance, before copying attributes const SfxPoolItem* pItem; if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() && SFX_ITEM_SET == pSrc->GetAttrSet().GetItemState( - RES_PAGEDESC, FALSE, &pItem ) && + RES_PAGEDESC, sal_False, &pItem ) && ((SwFmtPageDesc*)pItem)->GetPageDesc() ) { SwFmtPageDesc aPageDesc( *(SwFmtPageDesc*)pItem ); @@ -2107,9 +2120,9 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, { // jetzt noch Header-/Footer-Attribute richtig behandeln // Contenten Nodes Dokumentuebergreifend kopieren! - USHORT nAttr = static_cast<USHORT>( bCpyHeader ? RES_HEADER : RES_FOOTER ); + sal_uInt16 nAttr = static_cast<sal_uInt16>( bCpyHeader ? RES_HEADER : RES_FOOTER ); const SfxPoolItem* pItem; - if( SFX_ITEM_SET != rSrcFmt.GetAttrSet().GetItemState( nAttr, FALSE, &pItem )) + if( SFX_ITEM_SET != rSrcFmt.GetAttrSet().GetItemState( nAttr, sal_False, &pItem )) return ; // Im Header steht noch der Verweis auf das Format aus dem @@ -2126,10 +2139,10 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, { SwFrmFmt* pNewFmt = new SwFrmFmt( GetAttrPool(), "CpyDesc", GetDfltFrmFmt() ); - pNewFmt->CopyAttrs( *pOldFmt, TRUE ); + pNewFmt->CopyAttrs( *pOldFmt, sal_True ); if( SFX_ITEM_SET == pNewFmt->GetAttrSet().GetItemState( - RES_CNTNT, FALSE, &pItem )) + RES_CNTNT, sal_False, &pItem )) { SwFmtCntnt* pCntnt = (SwFmtCntnt*)pItem; if( pCntnt->GetCntntIdx() ) @@ -2161,17 +2174,21 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, } void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, - BOOL bCopyPoolIds ) + sal_Bool bCopyPoolIds ) { +<<<<<<< local BOOL bNotifyLayout = FALSE; SwRootFrm* pTmpRoot = GetCurrentLayout();//swmod 080219 +======= + sal_Bool bNotifyLayout = sal_False; +>>>>>>> other rDstDesc.SetLandscape( rSrcDesc.GetLandscape() ); rDstDesc.SetNumType( rSrcDesc.GetNumType() ); if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() ) { rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() ); - bNotifyLayout = TRUE; + bNotifyLayout = sal_True; } if( bCopyPoolIds ) @@ -2189,12 +2206,12 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, if( !pFollow ) { // dann mal kopieren - USHORT nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() ); + sal_uInt16 nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() ); pFollow = aPageDescs[ nPos ]; CopyPageDesc( *rSrcDesc.GetFollow(), *pFollow ); } rDstDesc.SetFollow( pFollow ); - bNotifyLayout = TRUE; + bNotifyLayout = sal_True; } // die Header/Footer-Attribute werden gesondert kopiert, die Content- @@ -2251,8 +2268,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, void SwDoc::ReplaceStyles( SwDoc& rSource ) { - BOOL bIsUndo = DoesUndo(); - DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); CopyFmtArr( *rSource.pCharFmtTbl, *pCharFmtTbl, &SwDoc::_MakeCharFmt, *pDfltCharFmt ); @@ -2262,7 +2278,7 @@ void SwDoc::ReplaceStyles( SwDoc& rSource ) &SwDoc::_MakeTxtFmtColl, *pDfltTxtFmtColl ); // und jetzt noch die Seiten-Vorlagen - USHORT nCnt = rSource.aPageDescs.Count(); + sal_uInt16 nCnt = rSource.aPageDescs.Count(); if( nCnt ) { // ein anderes Doc -> Numberformatter muessen gemergt werden @@ -2289,7 +2305,7 @@ void SwDoc::ReplaceStyles( SwDoc& rSource ) if( nCnt ) { const SwNumRuleTbl& rArr = rSource.GetNumRuleTbl(); - for( USHORT n = 0; n < nCnt; ++n ) + for( sal_uInt16 n = 0; n < nCnt; ++n ) { const SwNumRule& rR = *rArr[ n ]; if( !rR.IsAutoRule() ) @@ -2303,22 +2319,20 @@ void SwDoc::ReplaceStyles( SwDoc& rSource ) } } - if( bIsUndo ) + if (undoGuard.UndoWasEnabled()) { - // es wurde am Nodes-Array gedreht! - ClearRedo(); - DelAllUndoObj(); + // nodes array was modified! + GetIDocumentUndoRedo().DelAllUndoObj(); } SetModified(); - DoUndo( bIsUndo ); } SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr, const String& rName ) const { SwFmt* pFnd = 0; - for( USHORT n = 0; n < rFmtArr.Count(); n++ ) + for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ ) { // ist die Vorlage schon im Doc vorhanden ?? if( ((SwFmt*)rFmtArr[n])->GetName() == rName ) @@ -2330,21 +2344,20 @@ SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr, return pFnd; } -void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus ) +void SwDoc::MoveLeftMargin( const SwPaM& rPam, sal_Bool bRight, sal_Bool bModulus ) { SwHistory* pHistory = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoMoveLeftMargin* pUndo = new SwUndoMoveLeftMargin( rPam, bRight, bModulus ); pHistory = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDefault( RES_PARATR_TABSTOP ); - USHORT nDefDist = rTabItem.Count() ? - static_cast<USHORT>(rTabItem[0].GetTabPos()) : 1134; + sal_uInt16 nDefDist = rTabItem.Count() ? + static_cast<sal_uInt16>(rTabItem[0].GetTabPos()) : 1134; const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); SwNodeIndex aIdx( rStt.nNode ); while( aIdx <= rEnd.nNode ) @@ -2363,7 +2376,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus ) const int nListLevel = pTNd->GetActualListLevel(); if ( nListLevel >= 0 ) { - const SwNumFmt& rFmt = pRule->Get(static_cast<USHORT>(nListLevel)); + const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nListLevel)); if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { aLS.SetTxtLeft( rFmt.GetIndentAt() ); @@ -2392,17 +2405,16 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus ) SetModified(); } -BOOL SwDoc::DontExpandFmt( const SwPosition& rPos, BOOL bFlag ) +sal_Bool SwDoc::DontExpandFmt( const SwPosition& rPos, sal_Bool bFlag ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); if( pTxtNd ) { bRet = pTxtNd->DontExpandFmt( rPos.nContent, bFlag ); - if( bRet && DoesUndo() ) + if( bRet && GetIDocumentUndoRedo().DoesUndo() ) { - ClearRedo(); - AppendUndo( new SwUndoDontExpandFmt( rPos )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDontExpandFmt(rPos) ); } } return bRet; @@ -2438,7 +2450,7 @@ void SwDoc::_CreateNumberFormatter() Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); pNumberFormatter = new SvNumberFormatter( xMSF, eLang ); pNumberFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL ); - pNumberFormatter->SetYear2000(static_cast<USHORT>(::utl::MiscCfg().GetYear2000())); + pNumberFormatter->SetYear2000(static_cast<sal_uInt16>(::utl::MiscCfg().GetYear2000())); } @@ -2447,8 +2459,8 @@ SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest ) { // ein anderes Doc -> Numberformatter muessen gemergt werden SvNumberFormatter* pN; - if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( FALSE ) )) - ( pNFmt = rDest.GetNumberFormatter( TRUE ))->MergeFormatter( *pN ); + if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( sal_False ) )) + ( pNFmt = rDest.GetNumberFormatter( sal_True ))->MergeFormatter( *pN ); if( &rSrc != &rDest ) ((SwGetRefFieldType*)rSrc.GetSysFldType( RES_GETREFFLD ))-> @@ -2462,7 +2474,7 @@ SwTblNumFmtMerge::~SwTblNumFmtMerge() } -void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, USHORT nPoolId, +void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId, const SfxItemSet* pSet ) { SwPaM aPam( rPos ); @@ -2486,7 +2498,7 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, USHORT nPoolId, // das Adjust Item behalten wir extra const SfxPoolItem* pItem; if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState( - RES_PARATR_ADJUST, FALSE, &pItem )) + RES_PARATR_ADJUST, sal_False, &pItem )) aTmp.Put( *pItem ); aExtraData.SetItemSet( aTmp ); } @@ -2531,7 +2543,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet ) // das Adjust Item behalten wir extra const SfxPoolItem* pItem; if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState( - RES_PARATR_ADJUST, FALSE, &pItem )) + RES_PARATR_ADJUST, sal_False, &pItem )) aTmp.Put( *pItem ); aExtraData.SetItemSet( aTmp ); } @@ -2550,7 +2562,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet ) void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { // copying <rSet> to <aSet> SfxItemSet aSet(rSet); @@ -2578,18 +2590,18 @@ void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet) SwUndo * pUndo = new SwUndoFmtAttr(aOldSet, rFmt); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } rFmt.SetFmtAttr(rSet); } void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName, - BOOL bBroadcast) + sal_Bool bBroadcast) { SfxStyleFamily eFamily = SFX_STYLE_FAMILY_ALL; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = NULL; @@ -2613,7 +2625,9 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName, } if (pUndo) - AppendUndo(pUndo); + { + GetIDocumentUndoRedo().AppendUndo(pUndo); + } } rFmt.SetName(sNewName); @@ -2637,8 +2651,8 @@ namespace docfunc const SwTxtFmtColls* pTxtFmtColls( rDoc.GetTxtFmtColls() ); if ( pTxtFmtColls ) { - const USHORT nCount = pTxtFmtColls->Count(); - for ( USHORT i = 0; i < nCount; ++i ) + const sal_uInt16 nCount = pTxtFmtColls->Count(); + for ( sal_uInt16 i = 0; i < nCount; ++i ) { SwTxtFmtColl* pTxtFmtColl = (*pTxtFmtColls)[i]; |