diff options
Diffstat (limited to 'sw/source/core/doc/docnum.cxx')
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 521 |
1 files changed, 273 insertions, 248 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index e0ebde6d8782..93cef43b956c 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/date.hxx> #include <tools/time.hxx> @@ -35,11 +36,14 @@ #include <ftninfo.hxx> #include <ftnidx.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <doctxm.hxx> // pTOXBaseRing #include <poolfmt.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoRedline.hxx> +#include <UndoNumbering.hxx> #include <swundo.hxx> #include <SwUndoFmt.hxx> #include <rolbck.hxx> @@ -61,7 +65,7 @@ #include <map> -inline BYTE GetUpperLvlChg( BYTE nCurLvl, BYTE nLevel, USHORT nMask ) +inline sal_uInt8 GetUpperLvlChg( sal_uInt8 nCurLvl, sal_uInt8 nLevel, sal_uInt16 nMask ) { if( 1 < nLevel ) { @@ -70,7 +74,7 @@ inline BYTE GetUpperLvlChg( BYTE nCurLvl, BYTE nLevel, USHORT nMask ) else nCurLvl = 0; } - return static_cast<BYTE>((nMask - 1) & ~(( 1 << nCurLvl ) - 1)); + return static_cast<sal_uInt8>((nMask - 1) & ~(( 1 << nCurLvl ) - 1)); } void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) @@ -92,7 +96,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) // <-- // --> OD 2006-09-21 #i69522# // assure that the outline numbering rule is an automatic rule - pOutlineRule->SetAutoRule( TRUE ); + pOutlineRule->SetAutoRule( sal_True ); // <-- // teste ob die evt. gesetzen CharFormate in diesem Document @@ -121,7 +125,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) // <-- PropagateOutlineRule(); - pOutlineRule->SetInvalidRule(TRUE); + pOutlineRule->SetInvalidRule(sal_True); UpdateNumRule(); // gibt es Fussnoten && gilt Kapitelweises Nummerieren, dann updaten @@ -135,7 +139,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) void SwDoc::PropagateOutlineRule() { - for (USHORT n = 0; n < pTxtFmtCollTbl->Count(); n++) + for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); n++) { SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n]; @@ -144,7 +148,7 @@ void SwDoc::PropagateOutlineRule() { // --> OD 2006-11-20 #i71764# // Check only the list style, which is set at the paragraph style - const SwNumRuleItem & rCollRuleItem = pColl->GetNumRule( FALSE ); + const SwNumRuleItem & rCollRuleItem = pColl->GetNumRule( sal_False ); // <-- // --> OD 2006-11-20 #i71764# @@ -166,21 +170,21 @@ void SwDoc::PropagateOutlineRule() } // Hoch-/Runterstufen -BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) +sal_Bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) { if( !GetNodes().GetOutLineNds().Count() || !nOffset ) - return FALSE; + return sal_False; // den Bereich feststellen const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds(); const SwNodePtr pSttNd = (SwNodePtr)&rPam.Start()->nNode.GetNode(); const SwNodePtr pEndNd = (SwNodePtr)&rPam.End()->nNode.GetNode(); - USHORT nSttPos, nEndPos; + sal_uInt16 nSttPos, nEndPos; if( !rOutlNds.Seek_Entry( pSttNd, &nSttPos ) && !nSttPos-- ) // wir stehen in keiner "Outline-Section" - return FALSE; + return sal_False; if( rOutlNds.Seek_Entry( pEndNd, &nEndPos ) ) ++nEndPos; @@ -188,7 +192,7 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) // jetzt haben wir unseren Bereich im OutlineNodes-Array // dann prufe ersmal, ob nicht unterebenen aufgehoben werden // (Stufung ueber die Grenzen) - USHORT n; + sal_uInt16 n; // so, dann koennen wir: // 1. Vorlagen-Array anlegen @@ -197,7 +201,7 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) for( n = 0; n < pTxtFmtCollTbl->Count(); ++n ) { - //BYTE nLevel = (*pTxtFmtCollTbl)[ n ]->GetOutlineLevel();//#outline level,zhaojianwei + //sal_uInt8 nLevel = (*pTxtFmtCollTbl)[ n ]->GetOutlineLevel();//#outline level,zhaojianwei //if( nLevel < MAXLEVEL ) // aCollArr[ nLevel ] = (*pTxtFmtCollTbl)[ n ]; if((*pTxtFmtCollTbl)[ n ]->IsAssignedToListLevelOfOutlineStyle()) @@ -310,12 +314,12 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) */ if (aCollArr[n] != NULL) { - USHORT m = n; + sal_uInt16 m = n; int nCount = nNum; while (nCount > 0 && m + nStep >= 0 && m + nStep < MAXLEVEL) { - m = static_cast<USHORT>(m + nStep); + m = static_cast<sal_uInt16>(m + nStep); if (aCollArr[m] != NULL) nCount--; @@ -363,14 +367,14 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) } if (! bMoveApplicable ) - return FALSE; + return sal_False; /* <-- #i13747 # */ - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo(UNDO_OUTLINE_LR, NULL); - AppendUndo( new SwUndoOutlineLeftRight( rPam, nOffset ) ); + GetIDocumentUndoRedo().StartUndo(UNDO_OUTLINE_LR, NULL); + SwUndo *const pUndoOLR( new SwUndoOutlineLeftRight( rPam, nOffset ) ); + GetIDocumentUndoRedo().AppendUndo(pUndoOLR); } // 2. allen Nodes die neue Vorlage zuweisen @@ -412,52 +416,56 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) n++; // Undo ??? } - if (DoesUndo()) - EndUndo(UNDO_OUTLINE_LR, NULL); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo(UNDO_OUTLINE_LR, NULL); + } ChkCondColls(); SetModified(); - return TRUE; + return sal_True; } // Hoch-/Runter - Verschieben ! -BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) +sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) { // kein Verschiebung in den Sonderbereichen const SwPosition& rStt = *rPam.Start(), & rEnd = &rStt == rPam.GetPoint() ? *rPam.GetMark() : *rPam.GetPoint(); if( !GetNodes().GetOutLineNds().Count() || !nOffset || - rStt.nNode.GetIndex() < aNodes.GetEndOfExtras().GetIndex() || - rEnd.nNode.GetIndex() < aNodes.GetEndOfExtras().GetIndex() ) - return FALSE; + (rStt.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()) || + (rEnd.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex())) + { + return sal_False; + } - USHORT nAktPos = 0; + sal_uInt16 nAktPos = 0; SwNodeIndex aSttRg( rStt.nNode ), aEndRg( rEnd.nNode ); - //BYTE nOutLineLevel = NO_NUMBERING; //#outline level,zhaojianwei + //sal_uInt8 nOutLineLevel = NO_NUMBERING; //#outline level,zhaojianwei int nOutLineLevel = MAXLEVEL; //<-end,zhaojianwei SwNode* pSrch = &aSttRg.GetNode(); //if( pSrch->IsTxtNode() ) //#outline level,zhaojianwei - // nOutLineLevel = static_cast<BYTE>(((SwTxtNode*)pSrch)->GetOutlineLevel()); + // nOutLineLevel = static_cast<sal_uInt8>(((SwTxtNode*)pSrch)->GetOutlineLevel()); if( pSrch->IsTxtNode()) - nOutLineLevel = static_cast<BYTE>(((SwTxtNode*)pSrch)->GetAttrOutlineLevel()-1);//<-end,zhaojianwei + nOutLineLevel = static_cast<sal_uInt8>(((SwTxtNode*)pSrch)->GetAttrOutlineLevel()-1);//<-end,zhaojianwei SwNode* pEndSrch = &aEndRg.GetNode(); if( !GetNodes().GetOutLineNds().Seek_Entry( pSrch, &nAktPos ) ) { if( !nAktPos ) - return FALSE; // Promoting or demoting before the first outline => no. + return sal_False; // Promoting or demoting before the first outline => no. if( --nAktPos ) aSttRg = *GetNodes().GetOutLineNds()[ nAktPos ]; else if( 0 > nOffset ) - return FALSE; // Promoting at the top of document?! + return sal_False; // Promoting at the top of document?! else aSttRg = *GetNodes().GetEndOfContent().StartOfSectionNode(); } - USHORT nTmpPos = 0; + sal_uInt16 nTmpPos = 0; // If the given range ends at an outlined text node we have to decide if it has to be a part of // the moving range or not. Normally it will be a sub outline of our chapter // and has to be moved, too. But if the chapter ends with a table(or a section end), @@ -511,14 +519,14 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) aEndRg++; // calculation of the new position - if( nOffset < 0 && nAktPos < USHORT(-nOffset) ) + if( nOffset < 0 && nAktPos < sal_uInt16(-nOffset) ) pNd = GetNodes().GetEndOfContent().StartOfSectionNode(); else if( nAktPos + nOffset >= GetNodes().GetOutLineNds().Count() ) pNd = &GetNodes().GetEndOfContent(); else pNd = GetNodes().GetOutLineNds()[ nAktPos + nOffset ]; - ULONG nNewPos = pNd->GetIndex(); + sal_uLong nNewPos = pNd->GetIndex(); // And now a correction of the insert position if necessary... SwNodeIndex aInsertPos( *pNd, -1 ); @@ -558,7 +566,7 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) if( pNd->IsTableNode() ) pNd = pNd->StartOfSectionNode(); if( pNd->FindTableNode() ) - return FALSE; + return sal_False; ASSERT( aSttRg.GetIndex() > nNewPos || nNewPos >= aEndRg.GetIndex(), "Position liegt im MoveBereich" ); @@ -567,20 +575,20 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) // setze die Position auf den Dokumentanfang. // Sollten da Bereiche oder Tabellen stehen, so werden sie nach // hinten verschoben. - nNewPos = Max( nNewPos, aNodes.GetEndOfExtras().GetIndex() + 2 ); + nNewPos = Max( nNewPos, GetNodes().GetEndOfExtras().GetIndex() + 2 ); long nOffs = nNewPos - ( 0 < nOffset ? aEndRg.GetIndex() : aSttRg.GetIndex()); SwPaM aPam( aSttRg, aEndRg, 0, -1 ); - return MoveParagraph( aPam, nOffs, TRUE ); + return MoveParagraph( aPam, nOffs, sal_True ); } -USHORT lcl_FindOutlineName( const SwNodes& rNds, const String& rName, - BOOL bExact ) +sal_uInt16 lcl_FindOutlineName( const SwNodes& rNds, const String& rName, + sal_Bool bExact ) { - USHORT nSavePos = USHRT_MAX; + sal_uInt16 nSavePos = USHRT_MAX; const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds(); - for( USHORT n = 0; n < rOutlNds.Count(); ++n ) + for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n ) { SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); String sTxt( pTxtNd->GetExpandTxt() ); @@ -603,7 +611,7 @@ USHORT lcl_FindOutlineName( const SwNodes& rNds, const String& rName, -USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) +sal_uInt16 lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) { // Gueltig Nummern sind (immer nur Offsets!!!): // ([Nummer]+\.)+ (als regulaerer Ausdruck!) @@ -614,16 +622,16 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) if( STRING_NOTFOUND == nPos ) return USHRT_MAX; // ungueltige Nummer!!! - USHORT nLevelVal[ MAXLEVEL ]; // Nummern aller Levels + sal_uInt16 nLevelVal[ MAXLEVEL ]; // Nummern aller Levels memset( nLevelVal, 0, MAXLEVEL * sizeof( nLevelVal[0] )); - BYTE nLevel = 0; + sal_uInt8 nLevel = 0; String sName( rName ); while( STRING_NOTFOUND != nPos ) { - USHORT nVal = 0; + sal_uInt16 nVal = 0; sal_Unicode c; - for( USHORT n = 0; n < sNum.Len(); ++n ) + for( sal_uInt16 n = 0; n < sNum.Len(); ++n ) if( '0' <= ( c = sNum.GetChar( n )) && c <= '9' ) { nVal *= 10; nVal += c - '0'; @@ -658,7 +666,7 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) for( ; nPos < rOutlNds.Count(); ++nPos ) { pNd = rOutlNds[ nPos ]->GetTxtNode(); - //BYTE nLvl = pNd->GetTxtColl()->GetOutlineLevel(); //#outline level,zhaojianwei + //sal_uInt8 nLvl = pNd->GetTxtColl()->GetOutlineLevel(); //#outline level,zhaojianwei const int nLvl = pNd->GetAttrOutlineLevel()-1; //<-end,zhaojianwei if( nLvl == nLevel - 1) { @@ -676,7 +684,7 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) SwNumberTree::tNumberVector aLevelVal = rNdNum.GetNumberVector(); //now compare with the one searched for bool bEqual = true; - for( BYTE n = 0; (n < nLevel) && bEqual; ++n ) + for( sal_uInt8 n = 0; (n < nLevel) && bEqual; ++n ) { bEqual = aLevelVal[n] == nLevelVal[n]; } @@ -714,7 +722,7 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) // der ueber die Nummer gefunden wurde. // Ist keine Nummer angegeben, dann nur den Text suchen. -BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const +sal_Bool SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const { if( rName.Len() ) { @@ -722,7 +730,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const // 1. Schritt: ueber die Nummer: String sName( rName ); - USHORT nFndPos = ::lcl_FindOutlineNum( GetNodes(), sName ); + sal_uInt16 nFndPos = ::lcl_FindOutlineNum( GetNodes(), sName ); if( USHRT_MAX != nFndPos ) { SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode(); @@ -730,7 +738,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const //#i4533# leading numbers followed by a dot have been remove while //searching for the outline position //to compensate this they must be removed from the paragraphs text content, too - USHORT nPos = 0; + sal_uInt16 nPos = 0; String sTempNum; while(sExpandedText.Len() && (sTempNum = sExpandedText.GetToken(0, '.', nPos)).Len() && STRING_NOTFOUND != nPos && @@ -742,7 +750,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const if( !sExpandedText.Equals( sName ) ) { - USHORT nTmp = ::lcl_FindOutlineName( GetNodes(), sName, TRUE ); + sal_uInt16 nTmp = ::lcl_FindOutlineName( GetNodes(), sName, sal_True ); if( USHRT_MAX != nTmp ) // ueber den Namen gefunden { nFndPos = nTmp; @@ -751,34 +759,34 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const } rPos.nNode = *pNd; rPos.nContent.Assign( pNd, 0 ); - return TRUE; + return sal_True; } - nFndPos = ::lcl_FindOutlineName( GetNodes(), rName, FALSE ); + nFndPos = ::lcl_FindOutlineName( GetNodes(), rName, sal_False ); if( USHRT_MAX != nFndPos ) { SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode(); rPos.nNode = *pNd; rPos.nContent.Assign( pNd, 0 ); - return TRUE; + return sal_True; } // --> OD 2006-09-22 #i68289# // additional search on hyperlink URL without its outline numbering part if ( !sName.Equals( rName ) ) { - nFndPos = ::lcl_FindOutlineName( GetNodes(), sName, FALSE ); + nFndPos = ::lcl_FindOutlineName( GetNodes(), sName, sal_False ); if( USHRT_MAX != nFndPos ) { SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode(); rPos.nNode = *pNd; rPos.nContent.Assign( pNd, 0 ); - return TRUE; + return sal_True; } } // <-- } - return FALSE; + return sal_False; } /* */ @@ -786,7 +794,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const // --- Nummerierung ----------------------------------------- // --> OD 2008-02-19 #refactorlists# -//void SwNumRuleInfo::MakeList( SwDoc& rDoc, BOOL ) +//void SwNumRuleInfo::MakeList( SwDoc& rDoc, sal_Bool ) //{ // SwNumRule* pRule = rDoc.FindNumRulePtr(rName); @@ -812,7 +820,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const // { // const SwOutlineNodes & rOutlineNodes = rDoc.GetNodes().GetOutLineNds(); -// for (USHORT i = 0; i < rOutlineNodes.Count(); ++i) +// for (sal_uInt16 i = 0; i < rOutlineNodes.Count(); ++i) // { // SwTxtNode & aNode = *((SwTxtNode *) rOutlineNodes[i]); @@ -823,7 +831,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const // { // SwModify* pMod; // const SfxPoolItem* pItem; -// USHORT i, nMaxItems = rDoc.GetAttrPool().GetItemCount +// sal_uInt16 i, nMaxItems = rDoc.GetAttrPool().GetItemCount // ( RES_PARATR_NUMRULE); // for( i = 0; i < nMaxItems; ++i ) // { @@ -867,8 +875,8 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() ); ASSERT( pOld, "ohne die alte NumRule geht gar nichts" ); - USHORT nChgFmtLevel = 0, nMask = 1; - BYTE n; + sal_uInt16 nChgFmtLevel = 0, nMask = 1; + sal_uInt8 n; for( n = 0; n < MAXLEVEL; ++n, nMask <<= 1 ) { @@ -898,7 +906,7 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) // --> OD 2006-04-27 #i64311# if ( bInvalidateNumRule ) { - pOld->SetInvalidRule(TRUE); + pOld->SetInvalidRule(sal_True); } // <-- return ; @@ -908,12 +916,12 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) // SwNumRuleInfo* pUpd = new SwNumRuleInfo( rRule.GetName() ); // pUpd->MakeList( rDoc ); -// BYTE nLvl; -// for( ULONG nFirst = 0, nLast = pUpd->GetList().Count(); +// sal_uInt8 nLvl; +// for( sal_uLong nFirst = 0, nLast = pUpd->GetList().Count(); // nFirst < nLast; ++nFirst ) // { // SwTxtNode* pTxtNd = pUpd->GetList().GetObject( nFirst ); -// nLvl = static_cast<BYTE>(pTxtNd->GetLevel()); +// nLvl = static_cast<sal_uInt8>(pTxtNd->GetLevel()); // if( nLvl < MAXLEVEL ) // { @@ -925,12 +933,12 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) // } SwNumRule::tTxtNodeList aTxtNodeList; pOld->GetTxtNodeList( aTxtNodeList ); - BYTE nLvl( 0 ); + sal_uInt8 nLvl( 0 ); for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin(); aIter != aTxtNodeList.end(); ++aIter ) { SwTxtNode* pTxtNd = *aIter; - nLvl = static_cast<BYTE>(pTxtNd->GetActualListLevel()); + nLvl = static_cast<sal_uInt8>(pTxtNd->GetActualListLevel()); if( nLvl < MAXLEVEL ) { @@ -947,7 +955,7 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) pOld->Set( n, rRule.GetNumFmt( n )); pOld->CheckCharFmts( &rDoc ); - pOld->SetInvalidRule(TRUE); + pOld->SetInvalidRule(sal_True); pOld->SetContinusNum( rRule.IsContinusNum() ); // --> OD 2008-06-17 #i87166# // Do NOT change list style type @@ -971,11 +979,12 @@ void SwDoc::SetNumRule( const SwPaM& rPam, const bool bResetIndentAttrs ) { SwUndoInsNum * pUndo = NULL; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo( UNDO_INSNUM, NULL ); // Klammerung fuer die Attribute! - AppendUndo( pUndo = new SwUndoInsNum( rPam, rRule ) ); + // Start/End for attributes! + GetIDocumentUndoRedo().StartUndo( UNDO_INSNUM, NULL ); + pUndo = new SwUndoInsNum( rPam, rRule ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwNumRule * pNew = FindNumRulePtr( rRule.GetName() ); @@ -1097,18 +1106,20 @@ void SwDoc::SetNumRule( const SwPaM& rPam, rPam.End()->nNode ); aPam.Start()->nContent = 0; aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTxtNode()->Len(); - ResetAttrs( aPam, FALSE, &aResetAttrsArray ); + ResetAttrs( aPam, sal_False, &aResetAttrsArray ); } else { - ResetAttrs( rPam, FALSE, &aResetAttrsArray ); + ResetAttrs( rPam, sal_False, &aResetAttrsArray ); } // <-- } // <-- - if (DoesUndo()) - EndUndo( UNDO_INSNUM, NULL ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo( UNDO_INSNUM, NULL ); + } SetModified(); } @@ -1129,22 +1140,22 @@ void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted) rPam.End()->nNode ); aPam.Start()->nContent = 0; aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTxtNode()->Len(); - ResetAttrs( aPam, FALSE, &aResetAttrsArray ); + ResetAttrs( aPam, sal_False, &aResetAttrsArray ); } else { - ResetAttrs( rPam, FALSE, &aResetAttrsArray ); + ResetAttrs( rPam, sal_False, &aResetAttrsArray ); } // <-- } else { InsertPoolItem( rPam, - SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, FALSE ), 0 ); + SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, sal_False ), 0 ); } } -void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) +void SwDoc::SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag ) { SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); @@ -1153,10 +1164,10 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) const SwNumRule* pRule = pTxtNd->GetNumRule(); if( pRule && !bFlag != !pTxtNd->IsListRestart()) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumRuleStart( rPos, bFlag )); + SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, bFlag) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pTxtNd->SetListRestart(bFlag ? true : false); @@ -1166,7 +1177,7 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) } } -void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt ) +void SwDoc::SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt ) { SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); @@ -1188,10 +1199,10 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt ) if ( !pTxtNd->HasAttrListRestartValue() || pTxtNd->GetAttrListRestartValue() != nStt ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumRuleStart( rPos, nStt )); + SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, nStt) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pTxtNd->SetAttrListRestartValue( nStt ); @@ -1202,27 +1213,26 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt ) } // loeschen geht nur, wenn die Rule niemand benutzt! -BOOL SwDoc::DelNumRule( const String& rName, BOOL bBroadcast ) +sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast ) { - USHORT nPos = FindNumRule( rName ); + sal_uInt16 nPos = FindNumRule( rName ); // --> OD 2007-12-17 #151213# if ( (*pNumRuleTbl)[ nPos ] == GetOutlineNumRule() ) { ASSERT( false, "<SwDoc::DelNumRule(..)> - No deletion of outline list style. This is serious defect - please inform OD" ); - return FALSE; + return sal_False; } // <-- if( USHRT_MAX != nPos && !IsUsed( *(*pNumRuleTbl)[ nPos ] )) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleDelete(*(*pNumRuleTbl)[nPos], this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1261,9 +1271,9 @@ BOOL SwDoc::DelNumRule( const String& rName, BOOL bBroadcast ) maNumRuleMap.erase(aTmpName); SetModified(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // #106897# @@ -1274,12 +1284,11 @@ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName ) if( pRule ) { SwUndoInsNum* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); pUndo = new SwUndoInsNum( *pRule, rRule ); pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } ::lcl_ChgNumRule( *this, rRule ); @@ -1291,18 +1300,17 @@ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName ) } sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName, - BOOL bBroadcast) + sal_Bool bBroadcast) { sal_Bool bResult = sal_False; SwNumRule * pNumRule = FindNumRulePtr(rOldName); if (pNumRule) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleRename(rOldName, rNewName, this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // --> OD 2008-02-19 #refactorlists# @@ -1318,7 +1326,7 @@ sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName, SwNumRuleItem aItem(rNewName); // --> OD 2008-02-19 #refactorlists# -// for (ULONG nI = 0; nI < aInfo.GetList().Count(); ++nI) +// for (sal_uLong nI = 0; nI < aInfo.GetList().Count(); ++nI) // { // SwTxtNode * pTxtNd = aInfo.GetList().GetObject(nI); // pTxtNd->SwCntntNode::SetAttr(aItem); @@ -1343,8 +1351,25 @@ sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName, void SwDoc::StopNumRuleAnimations( OutputDevice* pOut ) { - for( USHORT n = GetNumRuleTbl().Count(); n; ) + for( sal_uInt16 n = GetNumRuleTbl().Count(); n; ) { +<<<<<<< local +======= + // --> OD 2008-02-19 #refactorlists# +// SwNumRuleInfo aUpd( GetNumRuleTbl()[ --n ]->GetName() ); +// aUpd.MakeList( *this ); + +// for( sal_uLong nFirst = 0, nLast = aUpd.GetList().Count(); +// nFirst < nLast; ++nFirst ) +// { +// SwTxtNode* pTNd = aUpd.GetList().GetObject( nFirst ); +// SwClientIter aIter( *pTNd ); +// for( SwFrm* pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) ); +// pFrm; pFrm = (SwFrm*)aIter.Next() ) +// if( ((SwTxtFrm*)pFrm)->HasAnimation() ) +// ((SwTxtFrm*)pFrm)->StopAnimation( pOut ); +// } +>>>>>>> other SwNumRule::tTxtNodeList aTxtNodeList; GetNumRuleTbl()[ --n ]->GetTxtNodeList( aTxtNodeList ); for ( SwNumRule::tTxtNodeList::iterator aTxtNodeIter = aTxtNodeList.begin(); @@ -1359,21 +1384,22 @@ void SwDoc::StopNumRuleAnimations( OutputDevice* pOut ) } } -BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, +sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos, const String& rOldRule, const String& rNewRule ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SwNumRule *pOldRule = FindNumRulePtr( rOldRule ), *pNewRule = FindNumRulePtr( rNewRule ); if( pOldRule && pNewRule && pOldRule != pNewRule ) { // --> OD 2008-02-19 #refactorlists# SwUndoInsNum* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo( UNDO_START, NULL ); // Klammerung fuer die Attribute! - AppendUndo( pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule ) ); + // Start/End for attributes! + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); + pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // --> OD 2008-02-19 #refactorlists# @@ -1391,7 +1417,7 @@ BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, // // Position suchen und bestimme ob ein Node davor oder dahinter // // einen Start erzwingt // SwTxtNode* pTxtNd; -// ULONG nFndPos, nFirst, nLast; +// sal_uLong nFndPos, nFirst, nLast; // if( TABLE_ENTRY_NOTFOUND != aUpd.GetList().SearchKey( // rPos.nNode.GetIndex(), &nFndPos )) @@ -1420,8 +1446,8 @@ BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, // } SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 ); - USHORT nChgFmtLevel = 0; - for( BYTE n = 0; n < MAXLEVEL; ++n ) + sal_uInt16 nChgFmtLevel = 0; + for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) { const SwNumFmt& rOldFmt = pOldRule->Get( n ), & rNewFmt = pNewRule->Get( n ); @@ -1456,10 +1482,10 @@ BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, pTxtNd->NumRuleChgd(); } } - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); - bRet = TRUE; // #106897# + bRet = sal_True; // #106897# } } @@ -1493,12 +1519,12 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) ::std::map<SwNumRule *, ListStyleData> aMyNumRuleMap; // <-- - ULONG nStt = rPaM.Start()->nNode.GetIndex(); - ULONG nEnd = rPaM.End()->nNode.GetIndex(); + sal_uLong nStt = rPaM.Start()->nNode.GetIndex(); + sal_uLong nEnd = rPaM.End()->nNode.GetIndex(); bool bFirst = true; - for (ULONG n = nStt; n <= nEnd; n++) + for (sal_uLong n = nStt; n <= nEnd; n++) { SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode(); @@ -1561,10 +1587,10 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) } } -BOOL SwDoc::NoNum( const SwPaM& rPam ) +sal_Bool SwDoc::NoNum( const SwPaM& rPam ) { - BOOL bRet = SplitNode( *rPam.GetPoint(), false ); + sal_Bool bRet = SplitNode( *rPam.GetPoint(), false ); // ist ueberhaupt Nummerierung im Spiel ? if( bRet ) { @@ -1579,25 +1605,25 @@ BOOL SwDoc::NoNum( const SwPaM& rPam ) SetModified(); } else - bRet = FALSE; // keine Nummerierung , ?? oder immer TRUE ?? + bRet = sal_False; // keine Nummerierung , ?? oder immer sal_True ?? } return bRet; } void SwDoc::DelNumRules( const SwPaM& rPam ) { - ULONG nStt = rPam.GetPoint()->nNode.GetIndex(), + sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(), nEnd = rPam.GetMark()->nNode.GetIndex(); if( nStt > nEnd ) { - ULONG nTmp = nStt; nStt = nEnd; nEnd = nTmp; + sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp; } SwUndoDelNum* pUndo; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoDelNum( rPam ) ); + pUndo = new SwUndoDelNum( rPam ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else pUndo = 0; @@ -1611,7 +1637,7 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) SwTxtNode* pTNd = GetNodes()[ nStt ]->GetTxtNode(); // --> OD 2008-03-13 #refactorlists# // if( pTNd && 0 != ( pItem = pTNd->GetNoCondAttr( -// RES_PARATR_NUMRULE, TRUE ) ) && +// RES_PARATR_NUMRULE, sal_True ) ) && // ( pName = &((SwNumRuleItem*)pItem)->GetValue())->Len() ) SwNumRule* pNumRuleOfTxtNode = pTNd ? pTNd->GetNumRule() : 0; if ( pTNd && pNumRuleOfTxtNode ) @@ -1621,13 +1647,13 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) aRegH.RegisterInModify( pTNd, *pTNd ); if( pUndo ) - pUndo->AddNode( *pTNd, FALSE ); + pUndo->AddNode( *pTNd, sal_False ); // directly set list style attribute is reset, otherwise empty // list style is applied const SfxItemSet* pAttrSet = pTNd->GetpSwAttrSet(); if ( pAttrSet && - pAttrSet->GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_SET ) + pAttrSet->GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET ) pTNd->ResetAttr( RES_PARATR_NUMRULE ); else pTNd->SetAttr( aEmptyRule ); @@ -1659,24 +1685,24 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) void SwDoc::InvalidateNumRules() { - for (USHORT n = 0; n < pNumRuleTbl->Count(); ++n) - (*pNumRuleTbl)[n]->SetInvalidRule(TRUE); + for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n) + (*pNumRuleTbl)[n]->SetInvalidRule(sal_True); } // zum naechsten/vorhergehenden Punkt auf gleicher Ebene -BOOL lcl_IsNumOk( BYTE nSrchNum, BYTE& rLower, BYTE& rUpper, - BOOL bOverUpper, BYTE nNumber ) +sal_Bool lcl_IsNumOk( sal_uInt8 nSrchNum, sal_uInt8& rLower, sal_uInt8& rUpper, + sal_Bool bOverUpper, sal_uInt8 nNumber ) { // --> OD 2008-04-02 #refactorlists# ASSERT( nNumber < MAXLEVEL, "<lcl_IsNumOk(..)> - misusage of method" ); // <-- - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; { if( bOverUpper ? nSrchNum == nNumber : nSrchNum >= nNumber ) - bRet = TRUE; + bRet = sal_True; else if( nNumber > rLower ) rLower = nNumber; else if( nNumber < rUpper ) @@ -1685,9 +1711,9 @@ BOOL lcl_IsNumOk( BYTE nSrchNum, BYTE& rLower, BYTE& rUpper, return bRet; } -BOOL lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) +sal_Bool lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const SwNode& rNd = rIdx.GetNode(); switch( rNd.GetNodeType() ) { @@ -1701,28 +1727,28 @@ BOOL lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) break; case ND_SECTIONNODE: // der ist erlaubt, also weiter - bRet = TRUE; + bRet = sal_True; break; } return bRet; } -BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, - BOOL bOverUpper, BYTE* pUpper, BYTE* pLower ) +sal_Bool lcl_GotoNextPrevNum( SwPosition& rPos, sal_Bool bNext, + sal_Bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower ) { const SwTxtNode* pNd = rPos.nNode.GetNode().GetTxtNode(); const SwNumRule* pRule; if( !pNd || 0 == ( pRule = pNd->GetNumRule())) - return FALSE; + return sal_False; - BYTE nSrchNum = static_cast<BYTE>(pNd->GetActualListLevel()); + sal_uInt8 nSrchNum = static_cast<sal_uInt8>(pNd->GetActualListLevel()); SwNodeIndex aIdx( rPos.nNode ); if( ! pNd->IsCountedInList() ) { // falls gerade mal NO_NUMLEVEL an ist, so such den vorherigen Node // mit Nummerierung - BOOL bError = FALSE; + sal_Bool bError = sal_False; do { aIdx--; if( aIdx.GetNode().IsTxtNode() ) @@ -1730,28 +1756,28 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, pNd = aIdx.GetNode().GetTxtNode(); pRule = pNd->GetNumRule(); - BYTE nTmpNum; + sal_uInt8 nTmpNum; if( pRule ) { - nTmpNum = static_cast<BYTE>(pNd->GetActualListLevel()); + nTmpNum = static_cast<sal_uInt8>(pNd->GetActualListLevel()); if( !( ! pNd->IsCountedInList() && (nTmpNum >= nSrchNum )) ) break; // gefunden } else - bError = TRUE; + bError = sal_True; } else bError = !lcl_IsValidPrevNextNumNode( aIdx ); } while( !bError ); if( bError ) - return FALSE; + return sal_False; } - BYTE nLower = nSrchNum, nUpper = nSrchNum; - BOOL bRet = FALSE; + sal_uInt8 nLower = nSrchNum, nUpper = nSrchNum; + sal_Bool bRet = sal_False; const SwTxtNode* pLast; if( bNext ) @@ -1769,11 +1795,11 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, if( pRule ) { if( ::lcl_IsNumOk( nSrchNum, nLower, nUpper, bOverUpper, - static_cast<BYTE>(pNd->GetActualListLevel()) )) + static_cast<sal_uInt8>(pNd->GetActualListLevel()) )) { rPos.nNode = aIdx; rPos.nContent.Assign( (SwTxtNode*)pNd, 0 ); - bRet = TRUE; + bRet = sal_True; break; } else @@ -1804,7 +1830,7 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, rPos.nNode.Assign( *pLast ); rPos.nContent.Assign( (SwTxtNode*)pLast, 0 ); } - bRet = TRUE; + bRet = sal_True; } if( bRet ) @@ -1817,10 +1843,10 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, return bRet; } -BOOL SwDoc::GotoNextNum( SwPosition& rPos, BOOL bOverUpper, - BYTE* pUpper, BYTE* pLower ) +sal_Bool SwDoc::GotoNextNum( SwPosition& rPos, sal_Bool bOverUpper, + sal_uInt8* pUpper, sal_uInt8* pLower ) { - return ::lcl_GotoNextPrevNum( rPos, TRUE, bOverUpper, pUpper, pLower ); + return ::lcl_GotoNextPrevNum( rPos, sal_True, bOverUpper, pUpper, pLower ); } // -> #i23731# @@ -1862,7 +1888,7 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, const SwNumRule * pNumRule = pTxtNd->GetNumRule(); if (pNumRule) { - if ( ( pNumRule->IsOutlineRule() == ( bOutline ? TRUE : FALSE ) ) && // #115901# + if ( ( pNumRule->IsOutlineRule() == ( bOutline ? sal_True : sal_False ) ) && // #115901# ( ( bNum && pNumRule->Get(0).IsEnumeration()) || ( !bNum && pNumRule->Get(0).IsItemize() ) ) ) // #i22362#, #i29560# { @@ -1898,8 +1924,8 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, pNode = &aIdx.GetNode(); } - while (! (pNode == aNodes.DocumentSectionStartNode(pStartFromNode) || - pNode == aNodes.DocumentSectionEndNode(pStartFromNode))); + while (!(pNode == GetNodes().DocumentSectionStartNode(pStartFromNode) || + pNode == GetNodes().DocumentSectionEndNode(pStartFromNode))); // <-- } @@ -1907,25 +1933,25 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, } // <- #i23731# -BOOL SwDoc::GotoPrevNum( SwPosition& rPos, BOOL bOverUpper, - BYTE* pUpper, BYTE* pLower ) +sal_Bool SwDoc::GotoPrevNum( SwPosition& rPos, sal_Bool bOverUpper, + sal_uInt8* pUpper, sal_uInt8* pLower ) { - return ::lcl_GotoNextPrevNum( rPos, FALSE, bOverUpper, pUpper, pLower ); + return ::lcl_GotoNextPrevNum( rPos, sal_False, bOverUpper, pUpper, pLower ); } -BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) +sal_Bool SwDoc::NumUpDown( const SwPaM& rPam, sal_Bool bDown ) { - ULONG nStt = rPam.GetPoint()->nNode.GetIndex(), + sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(), nEnd = rPam.GetMark()->nNode.GetIndex(); if( nStt > nEnd ) { - ULONG nTmp = nStt; nStt = nEnd; nEnd = nTmp; + sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp; } // -> #115901# outline nodes are promoted or demoted differently bool bOnlyOutline = true; bool bOnlyNonOutline = true; - for (ULONG n = nStt; n <= nEnd; n++) + for (sal_uLong n = nStt; n <= nEnd; n++) { SwTxtNode * pTxtNd = GetNodes()[n]->GetTxtNode(); @@ -1944,7 +1970,7 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) } // <- #115901# - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; char nDiff = bDown ? 1 : -1; // ->#115901# @@ -1958,7 +1984,7 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) promotable resp. demotable. */ - for (ULONG nTmp = nStt; nTmp <= nEnd; ++nTmp) + for (sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp) { SwTxtNode* pTNd = GetNodes()[ nTmp ]->GetTxtNode(); @@ -1970,10 +1996,10 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) if (pRule) { - BYTE nLevel = static_cast<BYTE>(pTNd->GetActualListLevel()); + sal_uInt8 nLevel = static_cast<sal_uInt8>(pTNd->GetActualListLevel()); if( (-1 == nDiff && 0 >= nLevel) || (1 == nDiff && MAXLEVEL - 1 <= nLevel)) - bRet = FALSE; + bRet = sal_False; } } // <-- @@ -1982,15 +2008,15 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) if( bRet ) { /* <-- #i24560# */ - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumUpDown( rPam, nDiff ) ); + SwUndo *const pUndo( new SwUndoNumUpDown(rPam, nDiff) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } String sNumRule; - for(ULONG nTmp = nStt; nTmp <= nEnd; ++nTmp ) + for(sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp ) { SwTxtNode* pTNd = GetNodes()[ nTmp ]->GetTxtNode(); @@ -2000,7 +2026,7 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) if (pRule) { - BYTE nLevel = static_cast<BYTE>(pTNd->GetActualListLevel()); + sal_uInt8 nLevel = static_cast<sal_uInt8>(pTNd->GetActualListLevel()); nLevel = nLevel + nDiff; pTNd->SetAttrListLevel(nLevel); @@ -2016,12 +2042,12 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) return bRet; } -BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) +sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv ) { const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); - ULONG nStIdx = pStt->nNode.GetIndex(); - ULONG nEndIdx = pEnd->nNode.GetIndex(); + sal_uLong nStIdx = pStt->nNode.GetIndex(); + sal_uLong nEndIdx = pEnd->nNode.GetIndex(); // Here are some sophisticated checks whether the wished PaM will be moved or not. // For moving outlines (bIsOutlMv) I've already done some checks, so here are two different @@ -2041,24 +2067,24 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) { // First is a start node pTmp2 = pTmp1->EndOfSectionNode(); if( pTmp2->GetIndex() > nEndIdx ) - return FALSE; // Its end node is behind the moved range + return sal_False; // Its end node is behind the moved range } pTmp1 = pTmp1->StartOfSectionNode()->EndOfSectionNode(); if( pTmp1->GetIndex() <= nEndIdx ) - return FALSE; // End node inside but start node before moved range => no. + return sal_False; // End node inside but start node before moved range => no. pTmp1 = GetNodes()[ nEndIdx ]; if( pTmp1->IsEndNode() ) { // The last one is an end node pTmp1 = pTmp1->StartOfSectionNode(); if( pTmp1->GetIndex() < nStIdx ) - return FALSE; // Its start node is before the moved range. + return sal_False; // Its start node is before the moved range. } pTmp1 = pTmp1->StartOfSectionNode(); if( pTmp1->GetIndex() >= nStIdx ) - return FALSE; // A start node which ends behind the moved area => no. + return sal_False; // A start node which ends behind the moved area => no. } - ULONG nInStIdx, nInEndIdx; + sal_uLong nInStIdx, nInEndIdx; long nOffs = nOffset; if( nOffset > 0 ) { @@ -2069,8 +2095,8 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) else { //Impossible to move to negative index - if( ULONG(abs( nOffset )) > nStIdx) - return FALSE; + if( sal_uLong(abs( nOffset )) > nStIdx) + return sal_False; nInEndIdx = nStIdx - 1; nStIdx += nOffset; @@ -2080,7 +2106,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) // [ nStIdx, nInEndIdx ] mit [ nInStIdx, nEndIdx ] if( nEndIdx >= GetNodes().GetEndOfContent().GetIndex() ) - return FALSE; + return sal_False; if( !bIsOutlMv ) { // And here the restrictions for moving paragraphs other than chapters (outlines) @@ -2091,7 +2117,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) pTmp1 = GetNodes()[ nStIdx ]->StartOfSectionNode(); pTmp2 = GetNodes()[ nInStIdx ]->StartOfSectionNode(); if( pTmp1 != pTmp2 ) - return FALSE; // "start" nodes in different sections + return sal_False; // "start" nodes in different sections pTmp1 = GetNodes()[ nEndIdx ]; bool bIsEndNode = pTmp1->IsEndNode(); if( !pTmp1->IsStartNode() ) @@ -2111,21 +2137,21 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) } pTmp2 = pTmp2->EndOfSectionNode(); if( pTmp1 != pTmp2 ) - return FALSE; // The "end" notes are in different sections + return sal_False; // The "end" notes are in different sections } // auf Redlining testen - darf die Selektion ueberhaupt verschoben // werden? if( !IsIgnoreRedline() ) { - USHORT nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE ); + sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE ); if( USHRT_MAX != nRedlPos ) { SwPosition aStPos( *pStt ), aEndPos( *pEnd ); aStPos.nContent = 0; SwCntntNode* pCNd = pEnd->nNode.GetNode().GetCntntNode(); aEndPos.nContent = pCNd ? pCNd->Len() : 1; - BOOL bCheckDel = TRUE; + sal_Bool bCheckDel = sal_True; // es existiert fuer den Bereich irgendein Redline-Delete-Object for( ; nRedlPos < GetRedlineTbl().Count(); ++nRedlPos ) @@ -2147,14 +2173,14 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2 // ist erlaubt, aber checke dann alle nachfolgenden // auf Ueberlappungen - bCheckDel = FALSE; + bCheckDel = sal_False; break; case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1 case POS_EQUAL: // Pos1 ist genauso gross wie Pos2 case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende - return FALSE; + return sal_False; } } } @@ -2176,7 +2202,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) { // wenn der Bereich komplett im eigenen Redline liegt, kann es // verschoben werden! - USHORT nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT ); + sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT ); if( USHRT_MAX != nRedlPos ) { SwRedline* pTmp = GetRedlineTbl()[ nRedlPos ]; @@ -2212,7 +2238,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) if( !pOwnRedl ) { - StartUndo( UNDO_START, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); // zuerst das Insert, dann das Loeschen SwPosition aInsPos( aIdx ); @@ -2224,7 +2250,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) rOrigPam.DeleteMark(); rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1; - BOOL bDelLastPara = !aInsPos.nNode.GetNode().IsCntntNode(); + sal_Bool bDelLastPara = !aInsPos.nNode.GetNode().IsCntntNode(); /* #101076# When copying to a non-content node Copy will insert a paragraph before that node and insert before @@ -2237,7 +2263,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) /* aInsPos points to the non-content node. Move it to the previous content node. */ SwPaM aInsPam(aInsPos); - BOOL bMoved = aInsPam.Move(fnMoveBackward); + sal_Bool bMoved = aInsPam.Move(fnMoveBackward); ASSERT(bMoved, "No content node found!"); if (bMoved) @@ -2263,21 +2289,21 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) // alle die im zu loeschenden Node stehen, mussen auf den // naechsten umgestezt werden SwPosition* pPos; - for( USHORT n = 0; n < GetRedlineTbl().Count(); ++n ) + for( sal_uInt16 n = 0; n < GetRedlineTbl().Count(); ++n ) { SwRedline* pTmp = GetRedlineTbl()[ n ]; - if( ( pPos = &pTmp->GetBound(TRUE))->nNode == aIdx ) + if( ( pPos = &pTmp->GetBound(sal_True))->nNode == aIdx ) { pPos->nNode++; pPos->nContent.Assign( pPos->nNode.GetNode().GetCntntNode(),0); } - if( ( pPos = &pTmp->GetBound(FALSE))->nNode == aIdx ) + if( ( pPos = &pTmp->GetBound(sal_False))->nNode == aIdx ) { pPos->nNode++; pPos->nContent.Assign( pPos->nNode.GetNode().GetCntntNode(),0); } } - CorrRel( aIdx, aInsPos, 0, FALSE ); + CorrRel( aIdx, aInsPos, 0, sal_False ); pCNd->JoinNext(); } @@ -2287,12 +2313,13 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) RedlineMode_t eOld = GetRedlineMode(); checkRedlining(eOld); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); - AppendUndo( new SwUndoRedlineDelete( aPam, UNDO_DELETE )); + SwUndo *const pUndo(new SwUndoRedlineDelete(aPam, UNDO_DELETE)); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwRedline* pNewRedline = new SwRedline( nsRedlineType_t::REDLINE_DELETE, aPam ); @@ -2300,17 +2327,17 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) // #101654# prevent assertion from aPam's target being deleted // (Alternatively, one could just let aPam go out of scope, but // that requires touching a lot of code.) - aPam.GetBound(TRUE).nContent.Assign( NULL, 0 ); - aPam.GetBound(FALSE).nContent.Assign( NULL, 0 ); + aPam.GetBound(sal_True).nContent.Assign( NULL, 0 ); + aPam.GetBound(sal_False).nContent.Assign( NULL, 0 ); AppendRedline( pNewRedline, true ); //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( eOld ); - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); - return TRUE; + return sal_True; } } @@ -2320,7 +2347,7 @@ SetRedlineMode( eOld ); SplitRedline(aTemp); } - ULONG nRedlSttNd(0), nRedlEndNd(0); + sal_uLong nRedlSttNd(0), nRedlEndNd(0); if( pOwnRedl ) { const SwPosition *pRStt = pOwnRedl->Start(), *pREnd = pOwnRedl->End(); @@ -2329,8 +2356,8 @@ SetRedlineMode( eOld ); } SwUndoMoveNum* pUndo = 0; - ULONG nMoved = 0; - if( DoesUndo() ) + sal_uLong nMoved = 0; + if (GetIDocumentUndoRedo().DoesUndo()) { pUndo = new SwUndoMoveNum( rPam, nOffset, bIsOutlMv ); nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1; @@ -2341,13 +2368,12 @@ SetRedlineMode( eOld ); if( pUndo ) { - ClearRedo(); // i57907: Under circumstances (sections at the end of a chapter) // the rPam.Start() is not moved to the new position. // But aIdx should be at the new end position and as long as the number of moved paragraphs // is nMoved, I know, where the new position is. pUndo->SetStartNode( aIdx.GetIndex() - nMoved ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if( pOwnRedl ) @@ -2368,12 +2394,12 @@ SetRedlineMode( eOld ); } SetModified(); - return TRUE; + return sal_True; } -BOOL SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, BOOL bDel ) +sal_Bool SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel ) { - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; SwTxtNode * pTxtNd = rIdx.GetNode().GetTxtNode(); if (pTxtNd && pTxtNd->GetNumRule() != NULL && @@ -2381,23 +2407,23 @@ BOOL SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, BOOL bDel ) { if ( !pTxtNd->IsCountedInList() == !bDel) { - BOOL bOldNum = bDel; // == pTxtNd->IsCounted(); - BOOL bNewNum = bDel ? FALSE : TRUE; + sal_Bool bOldNum = bDel; // == pTxtNd->IsCounted(); + sal_Bool bNewNum = bDel ? sal_False : sal_True; pTxtNd->SetCountedInList(bNewNum ? true : false); SetModified(); - bResult = TRUE; + bResult = sal_True; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoNumOrNoNum * pUndo = new SwUndoNumOrNoNum(rIdx, bOldNum, bNewNum); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } - else if (bDel && pTxtNd->GetNumRule(FALSE) && + else if (bDel && pTxtNd->GetNumRule(sal_False) && pTxtNd->GetActualListLevel() >= 0 && pTxtNd->GetActualListLevel() < MAXLEVEL) { @@ -2405,7 +2431,7 @@ BOOL SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, BOOL bDel ) DelNumRules(aPam); - bResult = TRUE; + bResult = sal_True; } } @@ -2428,9 +2454,9 @@ SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const return pRet; } -USHORT SwDoc::FindNumRule( const String& rName ) const +sal_uInt16 SwDoc::FindNumRule( const String& rName ) const { - for( USHORT n = pNumRuleTbl->Count(); n; ) + for( sal_uInt16 n = pNumRuleTbl->Count(); n; ) if( (*pNumRuleTbl)[ --n ]->GetName() == rName ) return n; @@ -2445,7 +2471,7 @@ SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const if ( !pResult ) { - for (USHORT n = 0; n < pNumRuleTbl->Count(); ++n) + for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n) { if ((*pNumRuleTbl)[n]->GetName() == rName) { @@ -2472,9 +2498,9 @@ void SwDoc::AddNumRule(SwNumRule * pRule) } // --> OD 2008-02-11 #newlistlevelattrs# -USHORT SwDoc::MakeNumRule( const String &rName, +sal_uInt16 SwDoc::MakeNumRule( const String &rName, const SwNumRule* pCpy, - BOOL bBroadcast, + sal_Bool bBroadcast, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode ) { SwNumRule* pNew; @@ -2504,15 +2530,14 @@ USHORT SwDoc::MakeNumRule( const String &rName, // <-- } - USHORT nRet = pNumRuleTbl->Count(); + sal_uInt16 nRet = pNumRuleTbl->Count(); AddNumRule(pNew); // #i36749# - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleCreate(pNew, this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -2522,7 +2547,7 @@ USHORT SwDoc::MakeNumRule( const String &rName, return nRet; } -String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const +String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) const { String aName; if( bAutoNum ) @@ -2541,8 +2566,8 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const aName = SW_RESSTR( STR_NUMRULE_DEFNAME ); } - USHORT nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2; - BYTE* pSetFlags = new BYTE[ nFlagSize ]; + sal_uInt16 nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2; + sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ]; memset( pSetFlags, 0, nFlagSize ); xub_StrLen nNmLen = aName.Len(); @@ -2560,7 +2585,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const } const SwNumRule* pNumRule; - USHORT n; + sal_uInt16 n; for( n = 0; n < pNumRuleTbl->Count(); ++n ) if( 0 != ( pNumRule = (*pNumRuleTbl)[ n ] ) ) @@ -2569,7 +2594,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const if( rNm.Match( aName ) == nNmLen ) { // Nummer bestimmen und das Flag setzen - nNum = (USHORT)rNm.Copy( nNmLen ).ToInt32(); + nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32(); if( nNum-- && nNum < pNumRuleTbl->Count() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } @@ -2601,7 +2626,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const void SwDoc::UpdateNumRule() { const SwNumRuleTbl& rNmTbl = GetNumRuleTbl(); - for( USHORT n = 0; n < rNmTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n ) if( rNmTbl[ n ]->IsInvalidRule() ) rNmTbl[ n ]->Validate(); } @@ -2609,7 +2634,7 @@ void SwDoc::UpdateNumRule() // --> OD 2008-04-02 #refactorlists# void SwDoc::MarkListLevel( const String& sListId, const int nListLevel, - const BOOL bValue ) + const sal_Bool bValue ) { SwList* pList = getListByName( sListId ); @@ -2621,7 +2646,7 @@ void SwDoc::MarkListLevel( const String& sListId, void SwDoc::MarkListLevel( SwList& rList, const int nListLevel, - const BOOL bValue ) + const sal_Bool bValue ) { // Set new marked list level and notify all affected nodes of the changed mark. rList.MarkListLevel( nListLevel, bValue ); @@ -2630,9 +2655,9 @@ void SwDoc::MarkListLevel( SwList& rList, // <-- // #i23726# -BOOL SwDoc::IsFirstOfNumRule(SwPosition & rPos) +sal_Bool SwDoc::IsFirstOfNumRule(SwPosition & rPos) { - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; SwTxtNode * pTxtNode = rPos.nNode.GetNode().GetTxtNode(); if (pTxtNode) @@ -2737,7 +2762,7 @@ sal_Int32 SwDoc::getOutlineNodesCount() const int SwDoc::getOutlineLevel( const sal_Int32 nIdx ) const { - return GetNodes().GetOutLineNds()[ static_cast<USHORT>(nIdx) ]-> + return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]-> // GetTxtNode()->GetOutlineLevel(); //#outline level,zhaojianwei GetTxtNode()->GetAttrOutlineLevel()-1; //<-end,zhaojianwei } @@ -2746,14 +2771,14 @@ String SwDoc::getOutlineText( const sal_Int32 nIdx, const bool bWithNumber, const bool bWithSpacesForLevel ) const { - return GetNodes().GetOutLineNds()[ static_cast<USHORT>(nIdx) ]-> + return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]-> GetTxtNode()->GetExpandTxt( 0, STRING_LEN, bWithNumber, bWithNumber, bWithSpacesForLevel ); } SwTxtNode* SwDoc::getOutlineNode( const sal_Int32 nIdx ) const { - return GetNodes().GetOutLineNds()[ static_cast<USHORT>(nIdx) ]->GetTxtNode(); + return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->GetTxtNode(); } void SwDoc::getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const @@ -2761,8 +2786,8 @@ void SwDoc::getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOu orOutlineNodeList.clear(); orOutlineNodeList.reserve( getOutlineNodesCount() ); - const USHORT nOutlCount( static_cast<USHORT>(getOutlineNodesCount()) ); - for ( USHORT i = 0; i < nOutlCount; ++i ) + const sal_uInt16 nOutlCount( static_cast<sal_uInt16>(getOutlineNodesCount()) ); + for ( sal_uInt16 i = 0; i < nOutlCount; ++i ) { orOutlineNodeList.push_back( GetNodes().GetOutLineNds()[i]->GetTxtNode() ); |