diff options
Diffstat (limited to 'sw/source/core/crsr/findattr.cxx')
-rw-r--r-- | sw/source/core/crsr/findattr.cxx | 249 |
1 files changed, 127 insertions, 122 deletions
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index be581b17735d..b505134e4395 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -45,13 +45,14 @@ #include <fchrfmt.hxx> #include <charfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swcrsr.hxx> #include <editsh.hxx> #include <ndtxt.hxx> #include <pamtyp.hxx> #include <swundo.hxx> #include <crsskip.hxx> -#include <undobj.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -82,7 +83,7 @@ int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 ) } -const SwTxtAttr* GetFrwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos, +const SwTxtAttr* GetFrwrdTxtHint( const SwpHints& rHtsArr, sal_uInt16& rPos, xub_StrLen nCntntPos ) { while( rPos < rHtsArr.Count() ) @@ -96,7 +97,7 @@ const SwTxtAttr* GetFrwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos, } -const SwTxtAttr* GetBkwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos, +const SwTxtAttr* GetBkwrdTxtHint( const SwpHints& rHtsArr, sal_uInt16& rPos, xub_StrLen nCntntPos ) { while( rPos > 0 ) @@ -112,14 +113,14 @@ const SwTxtAttr* GetBkwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos, void lcl_SetAttrPam( SwPaM & rPam, xub_StrLen nStart, const xub_StrLen* pEnde, - const BOOL bSaveMark ) + const sal_Bool bSaveMark ) { xub_StrLen nCntntPos; if( bSaveMark ) nCntntPos = rPam.GetMark()->nContent.GetIndex(); else nCntntPos = rPam.GetPoint()->nContent.GetIndex(); - BOOL bTstEnde = rPam.GetPoint()->nNode == rPam.GetMark()->nNode; + sal_Bool bTstEnde = rPam.GetPoint()->nNode == rPam.GetMark()->nNode; SwCntntNode* pCNd = rPam.GetCntntNode(); rPam.GetPoint()->nContent.Assign( pCNd, nStart ); @@ -142,15 +143,15 @@ void lcl_SetAttrPam( SwPaM & rPam, xub_StrLen nStart, const xub_StrLen* pEnde, // umspannt, unter Beachtung des Suchbereiches -BOOL lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam, +sal_Bool lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam, const SfxPoolItem& rCmpItem, - SwMoveFn fnMove, BOOL bValue ) + SwMoveFn fnMove, sal_Bool bValue ) { if ( !rTxtNd.HasHints() ) - return FALSE; + return sal_False; const SwTxtAttr *pTxtHt = 0; - BOOL bForward = fnMove == fnMoveForward; - USHORT nPos = bForward ? 0 : rTxtNd.GetSwpHints().Count(); + sal_Bool bForward = fnMove == fnMoveForward; + sal_uInt16 nPos = bForward ? 0 : rTxtNd.GetSwpHints().Count(); xub_StrLen nCntntPos = rPam.GetPoint()->nContent.GetIndex(); while( 0 != ( pTxtHt=(*fnMove->fnGetHint)(rTxtNd.GetSwpHints(),nPos,nCntntPos))) @@ -158,9 +159,9 @@ BOOL lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam, ( !bValue || CmpAttr( pTxtHt->GetAttr(), rCmpItem ))) { lcl_SetAttrPam( rPam, *pTxtHt->GetStart(), pTxtHt->GetEnd(), bForward ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } @@ -168,7 +169,7 @@ BOOL lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam, struct _SwSrchChrAttr { - USHORT nWhich; + sal_uInt16 nWhich; xub_StrLen nStt, nEnd; _SwSrchChrAttr( const SfxPoolItem& rItem, @@ -181,11 +182,11 @@ class SwAttrCheckArr { _SwSrchChrAttr *pFndArr, *pStackArr; xub_StrLen nNdStt, nNdEnd; - USHORT nArrStart, nArrLen; - USHORT nFound, nStackCnt; + sal_uInt16 nArrStart, nArrLen; + sal_uInt16 nFound, nStackCnt; SfxItemSet aCmpSet; - BOOL bNoColls; - BOOL bForward; + sal_Bool bNoColls; + sal_Bool bForward; public: SwAttrCheckArr( const SfxItemSet& rSet, int bForward, int bNoCollections ); @@ -194,7 +195,7 @@ public: void SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ); // wieviele Attribute ueberhaupt ?? - USHORT Count() const { return aCmpSet.Count(); } + sal_uInt16 Count() const { return aCmpSet.Count(); } int Found() const { return nFound == aCmpSet.Count(); } int CheckStack(); @@ -214,7 +215,7 @@ SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, int bFwd, int bNoCollections ) : aCmpSet( *rSet.GetPool(), RES_CHRATR_BEGIN, RES_TXTATR_END-1 ) { - aCmpSet.Put( rSet, FALSE ); + aCmpSet.Put( rSet, sal_False ); bNoColls = 0 != bNoCollections; bForward = 0 != bFwd; @@ -269,9 +270,9 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) SfxItemIter aIter( aCmpSet ); const SfxPoolItem* pItem = aIter.GetCurItem(); const SfxPoolItem* pFndItem; - USHORT nWhich; + sal_uInt16 nWhich; - while( TRUE ) + while( sal_True ) { // nur testen, ob vorhanden ist ? if( IsInvalidItem( pItem ) ) @@ -322,7 +323,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) // -------------------------------------------------------------- // Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht // -------------------------------------------------------------- - USHORT nWhch = rAttr.Which(); + sal_uInt16 nWhch = rAttr.Which(); SfxWhichIter* pIter = NULL; const SfxPoolItem* pTmpItem = NULL; const SfxItemSet* pSet = NULL; @@ -337,7 +338,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) pIter = new SfxWhichIter( *pSet ); nWhch = pIter->FirstWhich(); while( nWhch && - SFX_ITEM_SET != pSet->GetItemState( nWhch, TRUE, &pTmpItem ) ) + SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) ) nWhch = pIter->NextWhich(); if( !nWhch ) pTmpItem = NULL; @@ -347,10 +348,10 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) pTmpItem = &rAttr.GetAttr(); while( pTmpItem ) { - SfxItemState eState = aCmpSet.GetItemState( nWhch, FALSE, &pItem ); + SfxItemState eState = aCmpSet.GetItemState( nWhch, sal_False, &pItem ); if( SFX_ITEM_DONTCARE == eState || SFX_ITEM_SET == eState ) { - USHORT n; + sal_uInt16 n; _SwSrchChrAttr* pCmp; // loesche erstmal alle, die bis zu der Start Position schon wieder @@ -400,7 +401,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) } } - BOOL bContinue = FALSE; + sal_Bool bContinue = sal_False; if( SFX_ITEM_DONTCARE == eState ) { @@ -417,7 +418,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) else if( pCmp->nEnd < aTmp.nEnd ) // erweitern ? pCmp->nEnd = aTmp.nEnd; - bContinue = TRUE; + bContinue = sal_True; } } // wird Attribut gueltig ? @@ -425,7 +426,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) { pFndArr[ nWhch - nArrStart ] = aTmp; ++nFound; - bContinue = TRUE; + bContinue = sal_True; } // tja, dann muss es auf den Stack @@ -457,7 +458,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) { nWhch = pIter->NextWhich(); while( nWhch && - SFX_ITEM_SET != pSet->GetItemState( nWhch, TRUE, &pTmpItem ) ) + SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) ) nWhch = pIter->NextWhich(); if( !nWhch ) break; @@ -480,7 +481,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) // -------------------------------------------------------------- // Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht // -------------------------------------------------------------- - USHORT nWhch = rAttr.Which(); + sal_uInt16 nWhch = rAttr.Which(); SfxWhichIter* pIter = NULL; const SfxPoolItem* pTmpItem = NULL; const SfxItemSet* pSet = NULL; @@ -495,7 +496,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) pIter = new SfxWhichIter( *pSet ); nWhch = pIter->FirstWhich(); while( nWhch && - SFX_ITEM_SET != pSet->GetItemState( nWhch, TRUE, &pTmpItem ) ) + SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) ) nWhch = pIter->NextWhich(); if( !nWhch ) pTmpItem = NULL; @@ -505,10 +506,10 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) pTmpItem = &rAttr.GetAttr(); while( pTmpItem ) { - SfxItemState eState = aCmpSet.GetItemState( nWhch, FALSE, &pItem ); + SfxItemState eState = aCmpSet.GetItemState( nWhch, sal_False, &pItem ); if( SFX_ITEM_DONTCARE == eState || SFX_ITEM_SET == eState ) { - USHORT n; + sal_uInt16 n; _SwSrchChrAttr* pCmp; // loesche erstmal alle, die bis zu der Start Position schon wieder @@ -557,7 +558,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) } } - BOOL bContinue = FALSE; + sal_Bool bContinue = sal_False; if( SFX_ITEM_DONTCARE == eState ) { // wird Attribut gueltig ? @@ -573,7 +574,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) else if( pCmp->nStt > aTmp.nStt ) // erweitern ? pCmp->nStt = aTmp.nStt; - bContinue = TRUE; + bContinue = sal_True; } } // wird Attribut gueltig ? @@ -581,7 +582,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) { pFndArr[ nWhch - nArrStart ] = aTmp; ++nFound; - bContinue = TRUE; + bContinue = sal_True; } // tja, dann muss es auf den Stack @@ -613,7 +614,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) { nWhch = pIter->NextWhich(); while( nWhch && - SFX_ITEM_SET != pSet->GetItemState( nWhch, TRUE, &pTmpItem ) ) + SFX_ITEM_SET != pSet->GetItemState( nWhch, sal_True, &pTmpItem ) ) nWhch = pIter->NextWhich(); if( !nWhch ) break; @@ -629,7 +630,7 @@ xub_StrLen SwAttrCheckArr::Start() const { xub_StrLen nStart = nNdStt; _SwSrchChrAttr* pArrPtr = pFndArr; - for( USHORT n = 0; n < nArrLen; ++n, ++pArrPtr ) + for( sal_uInt16 n = 0; n < nArrLen; ++n, ++pArrPtr ) if( pArrPtr->nWhich && pArrPtr->nStt > nStart ) nStart = pArrPtr->nStt; @@ -641,7 +642,7 @@ xub_StrLen SwAttrCheckArr::End() const { _SwSrchChrAttr* pArrPtr = pFndArr; xub_StrLen nEnd = nNdEnd; - for( USHORT n = 0; n < nArrLen; ++n, ++pArrPtr ) + for( sal_uInt16 n = 0; n < nArrLen; ++n, ++pArrPtr ) if( pArrPtr->nWhich && pArrPtr->nEnd < nEnd ) nEnd = pArrPtr->nEnd; @@ -652,9 +653,9 @@ xub_StrLen SwAttrCheckArr::End() const int SwAttrCheckArr::CheckStack() { if( !nStackCnt ) - return FALSE; + return sal_False; - USHORT n; + sal_uInt16 n; xub_StrLen nSttPos = Start(), nEndPos = End(); _SwSrchChrAttr* pArrPtr; for( pArrPtr = pStackArr, n = 0; n < nArrLen; ++n, ++pArrPtr ) @@ -693,16 +694,16 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, if( !rTxtNd.HasHints() ) { if( !rCmpArr.Found() ) - return FALSE; + return sal_False; nEndPos = rCmpArr.GetNdEnd(); - lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, TRUE ); - return TRUE; + lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_True ); + return sal_True; } // dann gehe mal durch das nach "Start" sortierte Array const SwpHints& rHtArr = rTxtNd.GetSwpHints(); const SwTxtAttr* pAttr; - USHORT nPos = 0; + sal_uInt16 nPos = 0; // sollte jetzt schon alles vorhanden sein, dann teste, mit welchem // das wieder beendet wird. @@ -715,8 +716,8 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, { // dann haben wir unser Ende: lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), - pAttr->GetStart(), TRUE ); - return TRUE; + pAttr->GetStart(), sal_True ); + return sal_True; } // ansonsten muessen wir weiter suchen break; @@ -726,8 +727,8 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, { // dann haben wir unseren Bereich nEndPos = rCmpArr.GetNdEnd(); - lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, TRUE ); - return TRUE; + lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_True ); + return sal_True; } } @@ -746,16 +747,16 @@ int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, // dann haben wir den Bereich zusammen if( (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) ) - return FALSE; - lcl_SetAttrPam( rPam, nSttPos, &nEndPos, TRUE ); - return TRUE; + return sal_False; + lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_True ); + return sal_True; } if( !rCmpArr.CheckStack() || (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) ) - return FALSE; - lcl_SetAttrPam( rPam, nSttPos, &nEndPos, TRUE ); - return TRUE; + return sal_False; + lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_True ); + return sal_True; } @@ -767,16 +768,16 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, if( !rTxtNd.HasHints() ) { if( !rCmpArr.Found() ) - return FALSE; + return sal_False; nEndPos = rCmpArr.GetNdEnd(); - lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, FALSE ); - return TRUE; + lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_False ); + return sal_True; } // dann gehe mal durch das nach "Start" sortierte Array const SwpHints& rHtArr = rTxtNd.GetSwpHints(); const SwTxtAttr* pAttr; - USHORT nPos = rHtArr.Count(); + sal_uInt16 nPos = rHtArr.Count(); // sollte jetzt schon alles vorhanden sein, dann teste, mit welchem // das wieder beendet wird. @@ -790,8 +791,8 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, { // dann haben wir unser Ende: nEndPos = rCmpArr.GetNdEnd(); - lcl_SetAttrPam( rPam, nSttPos, &nEndPos, FALSE ); - return TRUE; + lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False ); + return sal_True; } // ansonsten muessen wir weiter suchen @@ -802,8 +803,8 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, { // dann haben wir unseren Bereich nEndPos = rCmpArr.GetNdEnd(); - lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, FALSE ); - return TRUE; + lcl_SetAttrPam( rPam, rCmpArr.GetNdStt(), &nEndPos, sal_False ); + return sal_True; } } @@ -826,32 +827,32 @@ int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, // dann haben wir den Bereich zusammen if( (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) ) - return FALSE; - lcl_SetAttrPam( rPam, nSttPos, &nEndPos, FALSE ); - return TRUE; + return sal_False; + lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False ); + return sal_True; } if( !rCmpArr.CheckStack() || (nSttPos = rCmpArr.Start()) > (nEndPos = rCmpArr.End()) ) - return FALSE; - lcl_SetAttrPam( rPam, nSttPos, &nEndPos, FALSE ); - return TRUE; + return sal_False; + lcl_SetAttrPam( rPam, nSttPos, &nEndPos, sal_False ); + return sal_True; } -int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, BOOL bNoColls ) +int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, sal_Bool bNoColls ) { // nur die harte Attributierung suchen ? if( bNoColls && !rCNd.HasSwAttrSet() ) - return FALSE; + return sal_False; const SfxItemSet& rNdSet = rCNd.GetSwAttrSet(); SfxItemIter aIter( rCmpSet ); const SfxPoolItem* pItem = aIter.GetCurItem(); const SfxPoolItem* pNdItem; - USHORT nWhich; + sal_uInt16 nWhich; - while( TRUE ) + while( sal_True ) { // nur testen, ob vorhanden ist ? if( IsInvalidItem( pItem )) @@ -859,7 +860,7 @@ int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, BOOL bNoColl nWhich = rCmpSet.GetWhichByPos( aIter.GetCurPos() ); if( SFX_ITEM_SET != rNdSet.GetItemState( nWhich, !bNoColls, &pNdItem ) || CmpAttr( *pNdItem, rNdSet.GetPool()->GetDefaultItem( nWhich ) )) - return FALSE; + return sal_False; } else { @@ -869,29 +870,29 @@ int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, BOOL bNoColl // if( SFX_ITEM_SET != rNdSet.GetItemState( nWhich, !bNoColls, &pNdItem ) // || *pNdItem != *pItem ) if( !CmpAttr( rNdSet.Get( nWhich, !bNoColls ), *pItem )) - return FALSE; + return sal_False; } if( aIter.IsAtEnd() ) break; pItem = aIter.NextItem(); } - return TRUE; // wurde gefunden + return sal_True; // wurde gefunden } -BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove, - const SwPaM *pRegion, BOOL bInReadOnly ) +sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove, + const SwPaM *pRegion, sal_Bool bInReadOnly ) { // stelle fest welches Attribut gesucht wird: - USHORT nWhich = rAttr.Which(); + sal_uInt16 nWhich = rAttr.Which(); int bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich); SwPaM* pPam = MakeRegion( fnMove, pRegion ); - BOOL bFound = FALSE; - BOOL bFirst = TRUE; - BOOL bSrchForward = fnMove == fnMoveForward; + sal_Bool bFound = sal_False; + sal_Bool bFirst = sal_True; + sal_Bool bSrchForward = fnMove == fnMoveForward; SwCntntNode * pNode; const SfxPoolItem* pItem; SwpFmts aFmtArr; @@ -901,10 +902,10 @@ BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove, ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len() : !pPam->GetPoint()->nContent.GetIndex() ) { - if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, FALSE )) + if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False )) { delete pPam; - return FALSE; + return sal_False; } SwCntntNode *pNd = pPam->GetCntntNode(); xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len(); @@ -925,7 +926,7 @@ BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove, SetMark(); *GetPoint() = *pPam->GetPoint(); *GetMark() = *pPam->GetMark(); - bFound = TRUE; + bFound = sal_True; break; } else if (isTXTATR(nWhich)) @@ -943,7 +944,7 @@ BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove, } if( SFX_ITEM_SET == pNode->GetSwAttrSet().GetItemState( nWhich, - TRUE, &pItem ) && ( !bValue || *pItem == rAttr ) ) + sal_True, &pItem ) && ( !bValue || *pItem == rAttr ) ) { // FORWARD: Point an das Ende, GetMark zum Anfanf vom Node // BACKWARD: Point zum Anfang, GetMark an das Ende vom Node @@ -951,7 +952,7 @@ BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove, *GetPoint() = *pPam->GetPoint(); SetMark(); pNode->MakeEndIndex( &GetPoint()->nContent ); - bFound = TRUE; + bFound = sal_True; break; } } @@ -967,14 +968,14 @@ BOOL SwPaM::Find( const SfxPoolItem& rAttr, BOOL bValue, SwMoveFn fnMove, typedef int (*FnSearchAttr)( const SwTxtNode&, SwAttrCheckArr&, SwPaM& ); -BOOL SwPaM::Find( const SfxItemSet& rSet, BOOL bNoColls, SwMoveFn fnMove, - const SwPaM *pRegion, BOOL bInReadOnly, BOOL bMoveFirst ) +sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove, + const SwPaM *pRegion, sal_Bool bInReadOnly, sal_Bool bMoveFirst ) { SwPaM* pPam = MakeRegion( fnMove, pRegion ); - BOOL bFound = FALSE; - BOOL bFirst = TRUE; - BOOL bSrchForward = fnMove == fnMoveForward; + sal_Bool bFound = sal_False; + sal_Bool bFirst = sal_True; + sal_Bool bSrchForward = fnMove == fnMoveForward; SwCntntNode * pNode; SwpFmts aFmtArr; @@ -982,7 +983,7 @@ BOOL SwPaM::Find( const SfxItemSet& rSet, BOOL bNoColls, SwMoveFn fnMove, SwAttrCheckArr aCmpArr( rSet, bSrchForward, bNoColls ); SfxItemSet aOtherSet( GetDoc()->GetAttrPool(), RES_PARATR_BEGIN, RES_GRFATR_END-1 ); - aOtherSet.Put( rSet, FALSE ); // alle Invalid-Items erhalten! + aOtherSet.Put( rSet, sal_False ); // alle Invalid-Items erhalten! FnSearchAttr fnSearch = bSrchForward ? (&::lcl_SearchForward) @@ -995,10 +996,10 @@ BOOL SwPaM::Find( const SfxItemSet& rSet, BOOL bNoColls, SwMoveFn fnMove, ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetCntntNode()->Len() : !pPam->GetPoint()->nContent.GetIndex() ) ) { - if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, FALSE )) + if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False )) { delete pPam; - return FALSE; + return sal_False; } SwCntntNode *pNd = pPam->GetCntntNode(); xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len(); @@ -1021,7 +1022,7 @@ BOOL SwPaM::Find( const SfxItemSet& rSet, BOOL bNoColls, SwMoveFn fnMove, SetMark(); *GetPoint() = *pPam->GetPoint(); *GetMark() = *pPam->GetMark(); - bFound = TRUE; + bFound = sal_True; break; } continue; // TextAttribute @@ -1048,7 +1049,7 @@ BOOL SwPaM::Find( const SfxItemSet& rSet, BOOL bNoColls, SwMoveFn fnMove, *GetPoint() = *pPam->GetPoint(); SetMark(); pNode->MakeEndIndex( &GetPoint()->nContent ); - bFound = TRUE; + bFound = sal_True; break; } } @@ -1066,13 +1067,13 @@ BOOL SwPaM::Find( const SfxItemSet& rSet, BOOL bNoColls, SwMoveFn fnMove, // Parameter fuer das Suchen vom Attributen struct SwFindParaAttr : public SwFindParas { - BOOL bValue; + sal_Bool bValue; const SfxItemSet *pSet, *pReplSet; const SearchOptions *pSearchOpt; SwCursor& rCursor; utl::TextSearch* pSTxt; - SwFindParaAttr( const SfxItemSet& rSet, BOOL bNoCollection, + SwFindParaAttr( const SfxItemSet& rSet, sal_Bool bNoCollection, const SearchOptions* pOpt, const SfxItemSet* pRSet, SwCursor& rCrsr ) : bValue( bNoCollection ), pSet( &rSet ), pReplSet( pRSet ), @@ -1080,22 +1081,22 @@ struct SwFindParaAttr : public SwFindParas virtual ~SwFindParaAttr() { delete pSTxt; } - virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, BOOL bInReadOnly ); + virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, sal_Bool bInReadOnly ); virtual int IsReplaceMode() const; }; int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, - BOOL bInReadOnly ) + sal_Bool bInReadOnly ) { // String ersetzen ?? (nur wenn Text angegeben oder nicht attributiert // gesucht wird) - BOOL bReplaceTxt = pSearchOpt && ( pSearchOpt->replaceString.getLength() || + sal_Bool bReplaceTxt = pSearchOpt && ( pSearchOpt->replaceString.getLength() || !pSet->Count() ); - BOOL bReplaceAttr = pReplSet && pReplSet->Count(); - BOOL bMoveFirst = !bReplaceAttr; + sal_Bool bReplaceAttr = pReplSet && pReplSet->Count(); + sal_Bool bMoveFirst = !bReplaceAttr; if( bInReadOnly && (bReplaceAttr || bReplaceTxt )) - bInReadOnly = FALSE; + bInReadOnly = sal_False; // wir suchen nach Attributen, soll zusaetzlich Text gesucht werden ? { @@ -1103,7 +1104,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, SwPaM* pTextRegion = &aRegion; SwPaM aSrchPam( *pCrsr->GetPoint() ); - while( TRUE ) + while( sal_True ) { if( pSet->Count() ) // gibts ueberhaupt Attributierung? { @@ -1112,7 +1113,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, //JP 17.11.95: was ist mit Attributen in leeren Absaetzen !! // || *pCrsr->GetMark() == *pCrsr->GetPoint() ) // kein Bereich ?? return FIND_NOT_FOUND; - bMoveFirst = TRUE; + bMoveFirst = sal_True; if( !pSearchOpt ) break; // ok, nur Attribute, also gefunden @@ -1137,7 +1138,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, } // todo/mba: searching for attributes in Outliner text?! - BOOL bSearchInNotes = FALSE; + sal_Bool bSearchInNotes = sal_False; // Bug 24665: suche im richtigen Bereich weiter (pTextRegion!) if( aSrchPam.Find( *pSearchOpt, bSearchInNotes, *pSTxt, fnMove, pTextRegion, bInReadOnly ) && @@ -1155,12 +1156,12 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, //JP 04.11.97: Bug 44897 - aber den Mark wieder aufheben, damit // weiterbewegt werden kann! { - BOOL bCheckRegion = TRUE; + sal_Bool bCheckRegion = sal_True; SwPosition* pPos = aSrchPam.GetPoint(); if( !(*fnMove->fnNd)( &pPos->nNode.GetNode(), &pPos->nContent, CRSR_SKIP_CHARS )) { - if( (*fnMove->fnNds)( &pPos->nNode, FALSE )) + if( (*fnMove->fnNds)( &pPos->nNode, sal_False )) { SwCntntNode *pNd = pPos->nNode.GetNode().GetCntntNode(); xub_StrLen nCPos; @@ -1171,7 +1172,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, pPos->nContent.Assign( pNd, nCPos ); } else - bCheckRegion = FALSE; + bCheckRegion = sal_False; } if( !bCheckRegion || *aRegion.GetPoint() <= *pPos ) return FIND_NOT_FOUND; // nicht gefunden @@ -1242,11 +1243,11 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion, SfxItemIter aIter( *pSet ); const SfxPoolItem* pItem = aIter.GetCurItem(); - while( TRUE ) + while( sal_True ) { // alle die nicht gesetzt sind mit Pool-Defaults aufuellen if( !IsInvalidItem( pItem ) && SFX_ITEM_SET != - pReplSet->GetItemState( pItem->Which(), FALSE )) + pReplSet->GetItemState( pItem->Which(), sal_False )) aSet.Put( pPool->GetDefaultItem( pItem->Which() )); if( aIter.IsAtEnd() ) @@ -1274,8 +1275,8 @@ int SwFindParaAttr::IsReplaceMode() const // Suchen nach Attributen -ULONG SwCursor::Find( const SfxItemSet& rSet, BOOL bNoCollections, - SwDocPositions nStart, SwDocPositions nEnde, BOOL& bCancel, +sal_uLong SwCursor::Find( const SfxItemSet& rSet, sal_Bool bNoCollections, + SwDocPositions nStart, SwDocPositions nEnde, sal_Bool& bCancel, FindRanges eFndRngs, const SearchOptions* pSearchOpt, const SfxItemSet* pReplSet ) { @@ -1284,23 +1285,27 @@ ULONG SwCursor::Find( const SfxItemSet& rSet, BOOL bNoCollections, Link aLnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); - BOOL bReplace = ( pSearchOpt && ( pSearchOpt->replaceString.getLength() || + sal_Bool bReplace = ( pSearchOpt && ( pSearchOpt->replaceString.getLength() || !rSet.Count() ) ) || (pReplSet && pReplSet->Count()); - BOOL bSttUndo = pDoc->DoesUndo() && bReplace; - if( bSttUndo ) - pDoc->StartUndo( UNDO_REPLACE, NULL ); + bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace; + if (bStartUndo) + { + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_REPLACE, NULL ); + } SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt, pReplSet, *this ); - ULONG nRet = FindAll(aSwFindParaAttr, nStart, nEnde, eFndRngs, bCancel ); + sal_uLong nRet = FindAll(aSwFindParaAttr, nStart, nEnde, eFndRngs, bCancel ); pDoc->SetOle2Link( aLnk ); if( nRet && bReplace ) pDoc->SetModified(); - if( bSttUndo ) - pDoc->EndUndo( UNDO_REPLACE, NULL ); + if (bStartUndo) + { + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_REPLACE, NULL ); + } return nRet; } |