diff options
-rw-r--r-- | sw/inc/pam.hxx | 40 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentRedlineManager.cxx | 184 | ||||
-rw-r--r-- | sw/source/core/doc/doccomp.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 46 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndhints.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/undo/undobj.cxx | 28 |
10 files changed, 199 insertions, 199 deletions
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 380cc878ed72..d6f636626190 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -75,16 +75,16 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition SW_DLLPUBLIC std::ostream &operator <<(std::ostream& s, const SwPosition& position); // Result of comparing positions. -enum SwComparePosition { - POS_BEFORE, ///< Pos1 before Pos2. - POS_BEHIND, ///< Pos1 behind Pos2. - POS_INSIDE, ///< Pos1 completely contained in Pos2. - POS_OUTSIDE, ///< Pos2 completely contained in Pos1. - POS_EQUAL, ///< Pos1 is as large as Pos2. - POS_OVERLAP_BEFORE, ///< Pos1 overlaps Pos2 at the beginning. - POS_OVERLAP_BEHIND, ///< Pos1 overlaps Pos2 at the end. - POS_COLLIDE_START, ///< Pos1 start touches at Pos2 end. - POS_COLLIDE_END ///< Pos1 end touches at Pos2 start. +enum class SwComparePosition { + Before, ///< Pos1 before Pos2. + Behind, ///< Pos1 behind Pos2. + Inside, ///< Pos1 completely contained in Pos2. + Outside, ///< Pos2 completely contained in Pos1. + Equal, ///< Pos1 is as large as Pos2. + OverlapBefore, ///< Pos1 overlaps Pos2 at the beginning. + OverlapBehind, ///< Pos1 overlaps Pos2 at the end. + CollideStart, ///< Pos1 start touches at Pos2 end. + CollideEnd ///< Pos1 end touches at Pos2 start. }; template<typename T> @@ -98,37 +98,37 @@ SwComparePosition ComparePosition( if( rEnd1 > rStt2 ) { if( rEnd1 >= rEnd2 ) - nRet = POS_OUTSIDE; + nRet = SwComparePosition::Outside; else - nRet = POS_OVERLAP_BEFORE; + nRet = SwComparePosition::OverlapBefore; } else if( rEnd1 == rStt2 ) - nRet = POS_COLLIDE_END; + nRet = SwComparePosition::CollideEnd; else - nRet = POS_BEFORE; + nRet = SwComparePosition::Before; } else if( rEnd2 > rStt1 ) { if( rEnd2 >= rEnd1 ) { if( rEnd2 == rEnd1 && rStt2 == rStt1 ) - nRet = POS_EQUAL; + nRet = SwComparePosition::Equal; else - nRet = POS_INSIDE; + nRet = SwComparePosition::Inside; } else { if (rStt1 == rStt2) - nRet = POS_OUTSIDE; + nRet = SwComparePosition::Outside; else - nRet = POS_OVERLAP_BEHIND; + nRet = SwComparePosition::OverlapBehind; } } else if( rEnd2 == rStt1 ) - nRet = POS_COLLIDE_START; + nRet = SwComparePosition::CollideStart; else - nRet = POS_BEHIND; + nRet = SwComparePosition::Behind; return nRet; } diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 56850d04753c..0dd9819023a5 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -2136,7 +2136,7 @@ const SwRangeRedline* SwCursorShell::GotoRedline( SwRedlineTable::size_type nArr switch( ::ComparePosition( *pCStt, *pCEnd, *pNStt, *pNEnd )) { - case POS_INSIDE: // Pos1 is completely in Pos2 + case SwComparePosition::Inside: // Pos1 is completely in Pos2 if( !pCur->HasMark() ) { pCur->SetMark(); @@ -2147,16 +2147,16 @@ const SwRangeRedline* SwCursorShell::GotoRedline( SwRedlineTable::size_type nArr *pCEnd = *pNEnd; break; - case POS_OUTSIDE: // Pos2 is completely in Pos1 - case POS_EQUAL: // Pos1 has same size as Pos2 + case SwComparePosition::Outside: // Pos2 is completely in Pos1 + case SwComparePosition::Equal: // Pos1 has same size as Pos2 break; - case POS_OVERLAP_BEFORE: // Pos1 overlaps Pos2 at beginning + case SwComparePosition::OverlapBefore: // Pos1 overlaps Pos2 at beginning if( !pCur->HasMark() ) pCur->SetMark(); *pCEnd = *pNEnd; break; - case POS_OVERLAP_BEHIND: // Pos1 overlaps Pos2 at end + case SwComparePosition::OverlapBehind: // Pos1 overlaps Pos2 at end if( !pCur->HasMark() ) { pCur->SetMark(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index a434ad938b0a..3ae5eb01b6dc 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -347,13 +347,13 @@ namespace SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ); switch( eCmpPos ) { - case POS_COLLIDE_END: - case POS_BEFORE: + case SwComparePosition::CollideEnd: + case SwComparePosition::Before: // Pos1 is before Pos2 break; - case POS_COLLIDE_START: - case POS_BEHIND: + case SwComparePosition::CollideStart: + case SwComparePosition::Behind: // Pos1 is after Pos2 n = rTable.size(); break; @@ -684,17 +684,17 @@ namespace // we must save this redline if it overlaps aPam // (we may have to split it, too) - if( eCompare == POS_OVERLAP_BEHIND || - eCompare == POS_OVERLAP_BEFORE || - eCompare == POS_OUTSIDE || - eCompare == POS_INSIDE || - eCompare == POS_EQUAL ) + if( eCompare == SwComparePosition::OverlapBehind || + eCompare == SwComparePosition::OverlapBefore || + eCompare == SwComparePosition::Outside || + eCompare == SwComparePosition::Inside || + eCompare == SwComparePosition::Equal ) { rRedlineTable.Remove( nCurrentRedline-- ); // split beginning, if necessary - if( eCompare == POS_OVERLAP_BEFORE || - eCompare == POS_OUTSIDE ) + if( eCompare == SwComparePosition::OverlapBefore || + eCompare == SwComparePosition::Outside ) { SwRangeRedline* pNewRedline = new SwRangeRedline( *pCurrent ); *pNewRedline->End() = *pStart; @@ -703,8 +703,8 @@ namespace } // split end, if necessary - if( eCompare == POS_OVERLAP_BEHIND || - eCompare == POS_OUTSIDE ) + if( eCompare == SwComparePosition::OverlapBehind || + eCompare == SwComparePosition::Outside ) { SwRangeRedline* pNewRedline = new SwRangeRedline( *pCurrent ); *pNewRedline->Start() = *pEnd; diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 0b65b9d7b8ac..b9e6b39e5025 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -129,7 +129,7 @@ namespace bool bRet = true; SwRangeRedline* pRedl = rArr[ rPos ]; SwPosition *pRStt = nullptr, *pREnd = nullptr; - SwComparePosition eCmp = POS_OUTSIDE; + SwComparePosition eCmp = SwComparePosition::Outside; if( pSttRng && pEndRng ) { pRStt = pRedl->Start(); @@ -147,7 +147,7 @@ namespace bool bCheck = false, bReplace = false; switch( eCmp ) { - case POS_INSIDE: + case SwComparePosition::Inside: if( *pSttRng == *pRStt ) pRedl->SetStart( *pEndRng, pRStt ); else @@ -164,18 +164,18 @@ namespace } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: pRedl->SetStart( *pEndRng, pRStt ); bReplace = true; break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: pRedl->SetEnd( *pSttRng, pREnd ); bCheck = true; break; - case POS_OUTSIDE: - case POS_EQUAL: + case SwComparePosition::Outside: + case SwComparePosition::Equal: rArr.DeleteAndDestroy( rPos-- ); break; @@ -198,7 +198,7 @@ namespace bool bDelRedl = false; switch( eCmp ) { - case POS_INSIDE: + case SwComparePosition::Inside: if( bCallDelete ) { pDelStt = pSttRng; @@ -206,14 +206,14 @@ namespace } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: if( bCallDelete ) { pDelStt = pRStt; pDelEnd = pEndRng; } break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: if( bCallDelete ) { pDelStt = pREnd; @@ -221,8 +221,8 @@ namespace } break; - case POS_OUTSIDE: - case POS_EQUAL: + case SwComparePosition::Outside: + case SwComparePosition::Equal: { rArr.Remove( rPos-- ); bDelRedl = true; @@ -292,7 +292,7 @@ namespace bool bRet = true; SwRangeRedline* pRedl = rArr[ rPos ]; SwPosition *pRStt = nullptr, *pREnd = nullptr; - SwComparePosition eCmp = POS_OUTSIDE; + SwComparePosition eCmp = SwComparePosition::Outside; if( pSttRng && pEndRng ) { pRStt = pRedl->Start(); @@ -311,7 +311,7 @@ namespace bool bDelRedl = false; switch( eCmp ) { - case POS_INSIDE: + case SwComparePosition::Inside: if( bCallDelete ) { pDelStt = pSttRng; @@ -319,22 +319,22 @@ namespace } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: if( bCallDelete ) { pDelStt = pRStt; pDelEnd = pEndRng; } break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: if( bCallDelete ) { pDelStt = pREnd; pDelEnd = pSttRng; } break; - case POS_OUTSIDE: - case POS_EQUAL: + case SwComparePosition::Outside: + case SwComparePosition::Equal: { // delete the range again rArr.Remove( rPos-- ); @@ -390,7 +390,7 @@ namespace switch( eCmp ) { - case POS_INSIDE: + case SwComparePosition::Inside: { if( 1 < pRedl->GetStackCount() ) { @@ -424,7 +424,7 @@ namespace } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: if( 1 < pRedl->GetStackCount() ) { pNew = new SwRangeRedline( *pRedl ); @@ -436,7 +436,7 @@ namespace pNew->SetEnd( *pEndRng ); break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: if( 1 < pRedl->GetStackCount() ) { pNew = new SwRangeRedline( *pRedl ); @@ -448,8 +448,8 @@ namespace pNew->SetStart( *pSttRng ); break; - case POS_OUTSIDE: - case POS_EQUAL: + case SwComparePosition::Outside: + case SwComparePosition::Equal: if( !pRedl->PopData() ) // deleting the RedlineObject is enough rArr.DeleteAndDestroy( rPos-- ); @@ -830,10 +830,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bool bDelete = false; // Merge if applicable? - if( (( POS_BEHIND == eCmpPos && + if( (( SwComparePosition::Behind == eCmpPos && IsPrevPos( *pREnd, *pStt ) ) || - ( POS_COLLIDE_START == eCmpPos ) || - ( POS_OVERLAP_BEHIND == eCmpPos ) ) && + ( SwComparePosition::CollideStart == eCmpPos ) || + ( SwComparePosition::OverlapBehind == eCmpPos ) ) && pRedl->CanCombine( *pNewRedl ) && ( n+1 >= mpRedlineTable->size() || ( *(*mpRedlineTable)[ n+1 ]->Start() >= *pEnd && @@ -850,10 +850,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bMerged = true; bDelete = true; } - else if( (( POS_BEFORE == eCmpPos && + else if( (( SwComparePosition::Before == eCmpPos && IsPrevPos( *pEnd, *pRStt ) ) || - ( POS_COLLIDE_END == eCmpPos ) || - ( POS_OVERLAP_BEFORE == eCmpPos ) ) && + ( SwComparePosition::CollideEnd == eCmpPos ) || + ( SwComparePosition::OverlapBefore == eCmpPos ) ) && pRedl->CanCombine( *pNewRedl ) && ( !n || *(*mpRedlineTable)[ n-1 ]->End() != *pRStt )) @@ -866,28 +866,28 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bMerged = true; bDelete = true; } - else if ( POS_OUTSIDE == eCmpPos ) + else if ( SwComparePosition::Outside == eCmpPos ) { // own insert-over-insert redlines: // just scrap the inside ones mpRedlineTable->DeleteAndDestroy( n ); bDec = true; } - else if( POS_OVERLAP_BEHIND == eCmpPos ) + else if( SwComparePosition::OverlapBehind == eCmpPos ) { *pStt = *pREnd; if( ( *pStt == *pEnd ) && ( pNewRedl->GetContentIdx() == nullptr ) ) bDelete = true; } - else if( POS_OVERLAP_BEFORE == eCmpPos ) + else if( SwComparePosition::OverlapBefore == eCmpPos ) { *pEnd = *pRStt; if( ( *pStt == *pEnd ) && ( pNewRedl->GetContentIdx() == nullptr ) ) bDelete = true; } - else if( POS_INSIDE == eCmpPos || POS_EQUAL == eCmpPos) + else if( SwComparePosition::Inside == eCmpPos || SwComparePosition::Equal == eCmpPos) bDelete = true; if( bDelete ) @@ -897,7 +897,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bCompress = true; } } - else if( POS_INSIDE == eCmpPos ) + else if( SwComparePosition::Inside == eCmpPos ) { // split up if( *pEnd != *pREnd ) @@ -920,7 +920,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall mpRedlineTable->Insert( pRedl ); } } - else if ( POS_OUTSIDE == eCmpPos ) + else if ( SwComparePosition::Outside == eCmpPos ) { // handle overlapping redlines in broken documents @@ -938,12 +938,12 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bCompress = true; } } - else if ( POS_OVERLAP_BEHIND == eCmpPos ) + else if ( SwComparePosition::OverlapBehind == eCmpPos ) { // handle overlapping redlines in broken documents pNewRedl->SetStart( *pREnd ); } - else if ( POS_OVERLAP_BEFORE == eCmpPos ) + else if ( SwComparePosition::OverlapBefore == eCmpPos ) { // handle overlapping redlines in broken documents *pEnd = *pRStt; @@ -957,7 +957,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; case nsRedlineType_t::REDLINE_DELETE: - if( POS_INSIDE == eCmpPos ) + if( SwComparePosition::Inside == eCmpPos ) { // split up if( *pEnd != *pREnd ) @@ -980,7 +980,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall mpRedlineTable->Insert( pRedl, n ); } } - else if ( POS_OUTSIDE == eCmpPos ) + else if ( SwComparePosition::Outside == eCmpPos ) { // handle overlapping redlines in broken documents @@ -998,14 +998,14 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bCompress = true; } } - else if ( POS_EQUAL == eCmpPos ) + else if ( SwComparePosition::Equal == eCmpPos ) { // handle identical redlines in broken documents // delete old (delete) redline mpRedlineTable->DeleteAndDestroy( n ); bDec = true; } - else if ( POS_OVERLAP_BEHIND == eCmpPos ) + else if ( SwComparePosition::OverlapBehind == eCmpPos ) { // Another workaround for broken redlines pNewRedl->SetStart( *pREnd ); } @@ -1013,7 +1013,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall case nsRedlineType_t::REDLINE_FORMAT: switch( eCmpPos ) { - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: pRedl->SetStart( *pEnd, pRStt ); // re-insert mpRedlineTable->Remove( n ); @@ -1021,7 +1021,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bDec = true; break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: pRedl->SetEnd( *pStt, pREnd ); if( *pStt == *pRStt && pRedl->GetContentIdx() == nullptr ) { @@ -1030,15 +1030,15 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_EQUAL: - case POS_OUTSIDE: + case SwComparePosition::Equal: + case SwComparePosition::Outside: // Overlaps the current one completely or has the // same dimension, delete the old one mpRedlineTable->DeleteAndDestroy( n ); bDec = true; break; - case POS_INSIDE: + case SwComparePosition::Inside: // Overlaps the current one completely, // split or shorten the new one if( *pEnd != *pREnd ) @@ -1073,7 +1073,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall case nsRedlineType_t::REDLINE_DELETE: switch( eCmpPos ) { - case POS_OUTSIDE: + case SwComparePosition::Outside: { // Overlaps the current one completely, // split the new one @@ -1091,35 +1091,35 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_INSIDE: - case POS_EQUAL: + case SwComparePosition::Inside: + case SwComparePosition::Equal: delete pNewRedl; pNewRedl = nullptr; bCompress = true; break; - case POS_OVERLAP_BEFORE: - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBefore: + case SwComparePosition::OverlapBehind: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl )) { // If that's the case we can merge it, meaning // the new one covers this well - if( POS_OVERLAP_BEHIND == eCmpPos ) + if( SwComparePosition::OverlapBehind == eCmpPos ) pNewRedl->SetStart( *pRStt, pStt ); else pNewRedl->SetEnd( *pREnd, pEnd ); mpRedlineTable->DeleteAndDestroy( n ); bDec = true; } - else if( POS_OVERLAP_BEHIND == eCmpPos ) + else if( SwComparePosition::OverlapBehind == eCmpPos ) pNewRedl->SetStart( *pREnd, pStt ); else pNewRedl->SetEnd( *pRStt, pEnd ); break; - case POS_COLLIDE_START: - case POS_COLLIDE_END: + case SwComparePosition::CollideStart: + case SwComparePosition::CollideEnd: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl ) ) { @@ -1137,7 +1137,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall // If that's the case we can merge it, meaning // the new one covers this well - if( POS_COLLIDE_START == eCmpPos ) + if( SwComparePosition::CollideStart == eCmpPos ) pNewRedl->SetStart( *pRStt, pStt ); else pNewRedl->SetEnd( *pREnd, pEnd ); @@ -1182,13 +1182,13 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall meRedlineFlags = eOld & ~RedlineFlags(RedlineFlags::On | RedlineFlags::Ignore); switch( eCmpPos ) { - case POS_EQUAL: + case SwComparePosition::Equal: bCompress = true; mpRedlineTable->DeleteAndDestroy( n ); bDec = true; SAL_FALLTHROUGH; - case POS_INSIDE: + case SwComparePosition::Inside: if( bCallDelete ) { meRedlineFlags |= RedlineFlags::IgnoreDeleteRedlines; @@ -1214,11 +1214,11 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } delete pNewRedl; pNewRedl = nullptr; - if (eCmpPos == POS_INSIDE) + if (eCmpPos == SwComparePosition::Inside) pRedl->MaybeNotifyModification(); break; - case POS_OUTSIDE: + case SwComparePosition::Outside: { mpRedlineTable->Remove( n ); bDec = true; @@ -1235,7 +1235,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: { SwPaM aPam( *pRStt, *pEnd ); @@ -1263,7 +1263,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: { SwPaM aPam( *pStt, *pREnd ); @@ -1304,7 +1304,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall switch( eCmpPos ) { - case POS_EQUAL: + case SwComparePosition::Equal: { pRedl->PushData( *pNewRedl ); delete pNewRedl; @@ -1317,7 +1317,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_INSIDE: + case SwComparePosition::Inside: { if( *pRStt == *pStt ) { @@ -1352,7 +1352,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_OUTSIDE: + case SwComparePosition::Outside: { pRedl->PushData( *pNewRedl ); if( *pEnd == *pREnd ) @@ -1367,7 +1367,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: { if( *pEnd == *pREnd ) { @@ -1395,7 +1395,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: { if( *pStt == *pRStt ) { @@ -1449,7 +1449,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall case nsRedlineType_t::REDLINE_FORMAT: switch( eCmpPos ) { - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: pRedl->SetStart( *pEnd, pRStt ); // re-insert mpRedlineTable->Remove( n ); @@ -1457,19 +1457,19 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bDec = true; break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: pRedl->SetEnd( *pStt, pREnd ); break; - case POS_EQUAL: - case POS_OUTSIDE: + case SwComparePosition::Equal: + case SwComparePosition::Outside: // Overlaps the current one completely or has the // same dimension, delete the old one mpRedlineTable->DeleteAndDestroy( n ); bDec = true; break; - case POS_INSIDE: + case SwComparePosition::Inside: // Overlaps the current one completely, // split or shorten the new one if( *pEnd != *pREnd ) @@ -1506,21 +1506,21 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall case nsRedlineType_t::REDLINE_DELETE: switch( eCmpPos ) { - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: pNewRedl->SetEnd( *pRStt, pEnd ); break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: pNewRedl->SetStart( *pREnd, pStt ); break; - case POS_EQUAL: - case POS_INSIDE: + case SwComparePosition::Equal: + case SwComparePosition::Inside: delete pNewRedl; pNewRedl = nullptr; break; - case POS_OUTSIDE: + case SwComparePosition::Outside: // Overlaps the current one completely, // split or shorten the new one if( *pEnd != *pREnd ) @@ -1545,8 +1545,8 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall case nsRedlineType_t::REDLINE_FORMAT: switch( eCmpPos ) { - case POS_OUTSIDE: - case POS_EQUAL: + case SwComparePosition::Outside: + case SwComparePosition::Equal: { // Overlaps the current one completely or has the // same dimension, delete the old one @@ -1555,7 +1555,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_INSIDE: + case SwComparePosition::Inside: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl )) { @@ -1588,27 +1588,27 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall } break; - case POS_OVERLAP_BEFORE: - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBefore: + case SwComparePosition::OverlapBehind: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl )) { // If that's the case we can merge it, meaning // the new one covers this well - if( POS_OVERLAP_BEHIND == eCmpPos ) + if( SwComparePosition::OverlapBehind == eCmpPos ) pNewRedl->SetStart( *pRStt, pStt ); else pNewRedl->SetEnd( *pREnd, pEnd ); mpRedlineTable->DeleteAndDestroy( n ); bDec = false; } - else if( POS_OVERLAP_BEHIND == eCmpPos ) + else if( SwComparePosition::OverlapBehind == eCmpPos ) pNewRedl->SetStart( *pREnd, pStt ); else pNewRedl->SetEnd( *pRStt, pEnd ); break; - case POS_COLLIDE_END: + case SwComparePosition::CollideEnd: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl ) && n && *(*mpRedlineTable)[ n-1 ]->End() < *pStt ) @@ -1620,7 +1620,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall bDec = true; } break; - case POS_COLLIDE_START: + case SwComparePosition::CollideStart: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl ) && n+1 < mpRedlineTable->size() && @@ -1917,14 +1917,14 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd : pRedl->GetPoint(); switch( ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ) ) { - case POS_EQUAL: - case POS_OUTSIDE: + case SwComparePosition::Equal: + case SwComparePosition::Outside: pRedl->InvalidateRange(); mpRedlineTable->DeleteAndDestroy( n-- ); bChg = true; break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: pRedl->InvalidateRange(); pRedl->SetStart( *pEnd, pRStt ); // re-insert @@ -1933,7 +1933,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd --n; break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: pRedl->InvalidateRange(); pRedl->SetEnd( *pStt, pREnd ); if( !pRedl->HasValidRange() ) @@ -1945,7 +1945,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd } break; - case POS_INSIDE: + case SwComparePosition::Inside: { // this one needs to be splitted pRedl->InvalidateRange(); @@ -1981,8 +1981,8 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd } break; - case POS_COLLIDE_END: - case POS_BEFORE: + case SwComparePosition::CollideEnd: + case SwComparePosition::Before: n = mpRedlineTable->size(); break; default: diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 78d3fafd74a6..4b3daa8bcee2 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1991,22 +1991,22 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) SwComparePosition eCmpPos = ComparePosition( *pDStt, *pDEnd, *pRStt, *pREnd ); switch( eCmpPos ) { - case POS_COLLIDE_START: - case POS_BEHIND: + case SwComparePosition::CollideStart: + case SwComparePosition::Behind: break; - case POS_INSIDE: - case POS_EQUAL: + case SwComparePosition::Inside: + case SwComparePosition::Equal: delete pDestRedl; pDestRedl = nullptr; SAL_FALLTHROUGH; - case POS_COLLIDE_END: - case POS_BEFORE: + case SwComparePosition::CollideEnd: + case SwComparePosition::Before: n = rRedlineTable.size(); break; - case POS_OUTSIDE: + case SwComparePosition::Outside: assert(pDestRedl && "is this actually impossible"); if (pDestRedl) { @@ -2034,11 +2034,11 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: *pDEnd = *pRStt; break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: *pDStt = *pREnd; break; } diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 6002bd928e14..9c11f2ae2f0b 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1814,23 +1814,23 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End(); switch( ComparePosition( *pRStt, *pREnd, aStPos, aEndPos )) { - case POS_COLLIDE_START: - case POS_BEHIND: // Pos1 comes after Pos2 + case SwComparePosition::CollideStart: + case SwComparePosition::Behind: // Pos1 comes after Pos2 nRedlPos = getIDocumentRedlineAccess().GetRedlineTable().size(); break; - case POS_COLLIDE_END: - case POS_BEFORE: // Pos1 comes before Pos2 + case SwComparePosition::CollideEnd: + case SwComparePosition::Before: // Pos1 comes before Pos2 break; - case POS_INSIDE: // Pos1 is completely inside Pos2 + case SwComparePosition::Inside: // Pos1 is completely inside Pos2 // that's valid, but check all following for overlapping bCheckDel = false; break; - case POS_OUTSIDE: // Pos2 is completely inside Pos1 - case POS_EQUAL: // Pos1 is equal to Pos2 - case POS_OVERLAP_BEFORE: // Pos1 overlaps Pos2 in the beginning - case POS_OVERLAP_BEHIND: // Pos1 overlaps Pos2 at the end + case SwComparePosition::Outside: // Pos2 is completely inside Pos1 + case SwComparePosition::Equal: // Pos1 is equal to Pos2 + case SwComparePosition::OverlapBefore: // Pos1 overlaps Pos2 in the beginning + case SwComparePosition::OverlapBehind: // Pos1 overlaps Pos2 at the end return false; } } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 967ea384d0e3..c0265f338602 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -2830,13 +2830,13 @@ static bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, } // The position comparison's result -// POS_BEFORE, // Box comes before -// POS_BEHIND, // Box comes after -// POS_INSIDE, // Box is completely within start/end -// POS_OUTSIDE, // Box overlaps start/end completely -// POS_EQUAL, // Box and start/end are the same -// POS_OVERLAP_BEFORE, // Box overlapps the start -// POS_OVERLAP_BEHIND // Box overlapps the end +// SwComparePosition::Before, // Box comes before +// SwComparePosition::Behind, // Box comes after +// SwComparePosition::Inside, // Box is completely within start/end +// SwComparePosition::Outside, // Box overlaps start/end completely +// SwComparePosition::Equal, // Box and start/end are the same +// SwComparePosition::OverlapBefore, // Box overlapps the start +// SwComparePosition::OverlapBehind // Box overlapps the end SwComparePosition CheckBoxInRange( sal_uInt16 nStt, sal_uInt16 nEnd, sal_uInt16 nBoxStt, sal_uInt16 nBoxEnd ) { @@ -2847,12 +2847,12 @@ SwComparePosition CheckBoxInRange( sal_uInt16 nStt, sal_uInt16 nEnd, if( nBoxEnd > nStt + COLFUZZY ) { if( nBoxEnd >= nEnd + COLFUZZY ) - nRet = POS_OUTSIDE; + nRet = SwComparePosition::Outside; else - nRet = POS_OVERLAP_BEFORE; + nRet = SwComparePosition::OverlapBefore; } else - nRet = POS_BEFORE; + nRet = SwComparePosition::Before; } else if( nEnd > nBoxStt + COLFUZZY ) { @@ -2860,15 +2860,15 @@ SwComparePosition CheckBoxInRange( sal_uInt16 nStt, sal_uInt16 nEnd, { if( COLFUZZY > std::abs( long(nEnd) - long(nBoxEnd) ) && COLFUZZY > std::abs( long(nStt) - long(nBoxStt) ) ) - nRet = POS_EQUAL; + nRet = SwComparePosition::Equal; else - nRet = POS_INSIDE; + nRet = SwComparePosition::Inside; } else - nRet = POS_OVERLAP_BEHIND; + nRet = SwComparePosition::OverlapBehind; } else - nRet = POS_BEHIND; + nRet = SwComparePosition::Behind; return nRet; } @@ -3051,7 +3051,7 @@ static bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, switch( ePosType ) { - case POS_BEFORE: + case SwComparePosition::Before: if( bCheck ) { if( rParam.bLeft ) @@ -3065,7 +3065,7 @@ static bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, } break; - case POS_BEHIND: + case SwComparePosition::Behind: if( bCheck ) { if( !rParam.bLeft ) @@ -3079,13 +3079,13 @@ static bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, } break; - case POS_OUTSIDE: // Box fully overlaps start/end - case POS_INSIDE: // Box is completely within start/end - case POS_EQUAL: // Box and start/end are the same + case SwComparePosition::Outside: // Box fully overlaps start/end + case SwComparePosition::Inside: // Box is completely within start/end + case SwComparePosition::Equal: // Box and start/end are the same bDelBox = true; break; - case POS_OVERLAP_BEFORE: // Box overlaps the start + case SwComparePosition::OverlapBefore: // Box overlaps the start if( nBoxChkStt <= ( nDist + (rParam.bLeft ? - nWidth / 2 : nWidth / 2 ))) { @@ -3107,7 +3107,7 @@ static bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, } break; - case POS_OVERLAP_BEHIND: // Box overlaps the end + case SwComparePosition::OverlapBehind: // Box overlaps the end // JP 10.02.99: // Delete generally or (like in OVERLAP_BEFORE) only delete the one who reaches up to the half into the delete Box? if( !pBox->GetSttNd() ) @@ -3215,7 +3215,7 @@ static bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, { switch( ePosType ) { - case POS_OVERLAP_BEFORE: // Box overlaps the start + case SwComparePosition::OverlapBefore: // Box overlaps the start if( TBLFIX_CHGPROP == rParam.nMode ) bCorrRel = rParam.bLeft; else if( rParam.bLeft ) // TBLFIX_CHGABS @@ -3226,7 +3226,7 @@ static bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, } break; - case POS_OVERLAP_BEHIND: // Box overlaps the end + case SwComparePosition::OverlapBehind: // Box overlaps the end if( TBLFIX_CHGPROP == rParam.nMode ) bCorrRel = !rParam.bLeft; else if( !rParam.bLeft ) // TBLFIX_CHGABS diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index cb58522e6871..3fa6bedc4611 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -335,8 +335,8 @@ bool SwpHints::Check(bool bPortionsMerged) const SwComparePosition cmp = ComparePosition( pHtThis->GetStart(), *pHtThis->End(), pOther->GetStart(), *pOther->End()); - CHECK_ERR( (POS_OVERLAP_BEFORE != cmp) && - (POS_OVERLAP_BEHIND != cmp), + CHECK_ERR( (SwComparePosition::OverlapBefore != cmp) && + (SwComparePosition::OverlapBehind != cmp), "HintsCheck: overlapping nesting hints!!!" ); } } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 0157d90ea1a1..904cef00612d 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -455,19 +455,19 @@ SwpHints::TryInsertNesting( SwTextNode & rNode, SwTextAttrNesting & rNewHint ) switch (ComparePosition(nSplitNewStart, nSplitNewEnd, nOtherStart, nOtherEnd)) { - case POS_INSIDE: + case SwComparePosition::Inside: { assert(!bRemoveOverlap && "this one should be in OverwrittenExisting?"); } break; - case POS_OUTSIDE: - case POS_EQUAL: + case SwComparePosition::Outside: + case SwComparePosition::Equal: { assert(!"existing hint inside new hint: why?"); } break; - case POS_OVERLAP_BEFORE: + case SwComparePosition::OverlapBefore: { Delete( *itOther ); // this also does NoteInHistory! (*itOther)->GetStart() = nSplitNewEnd; @@ -486,7 +486,7 @@ SwpHints::TryInsertNesting( SwTextNode & rNode, SwTextAttrNesting & rNewHint ) } } break; - case POS_OVERLAP_BEHIND: + case SwComparePosition::OverlapBehind: { Delete( *itOther ); // this also does NoteInHistory! *(*itOther)->GetEnd() = nSplitNewStart; @@ -3090,15 +3090,15 @@ bool SwpHints::TryInsertHint( bool bDelOld = true, bChgStart = false, bChgEnd = false; switch( eCmp ) { - case POS_BEFORE: - case POS_BEHIND: bDelOld = false; break; + case SwComparePosition::Before: + case SwComparePosition::Behind: bDelOld = false; break; - case POS_OUTSIDE: bChgStart = bChgEnd = true; break; + case SwComparePosition::Outside: bChgStart = bChgEnd = true; break; - case POS_COLLIDE_END: - case POS_OVERLAP_BEFORE: bChgStart = true; break; - case POS_COLLIDE_START: - case POS_OVERLAP_BEHIND: bChgEnd = true; break; + case SwComparePosition::CollideEnd: + case SwComparePosition::OverlapBefore: bChgStart = true; break; + case SwComparePosition::CollideStart: + case SwComparePosition::OverlapBehind: bChgEnd = true; break; default: break; } diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 81a6dbfcdc44..96c8969dee6d 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -910,29 +910,29 @@ SwRedlineSaveData::SwRedlineSaveData( : SwUndRng( rRedl ) , SwRedlineData( rRedl.GetRedlineData(), bCopyNext ) { - assert( POS_OUTSIDE == eCmpPos || + assert( SwComparePosition::Outside == eCmpPos || !rRedl.GetContentIdx() ); // "Redline with Content" switch (eCmpPos) { - case POS_OVERLAP_BEFORE: // Pos1 overlaps Pos2 at the beginning + case SwComparePosition::OverlapBefore: // Pos1 overlaps Pos2 at the beginning nEndNode = rEndPos.nNode.GetIndex(); nEndContent = rEndPos.nContent.GetIndex(); break; - case POS_OVERLAP_BEHIND: // Pos1 overlaps Pos2 at the end + case SwComparePosition::OverlapBehind: // Pos1 overlaps Pos2 at the end nSttNode = rSttPos.nNode.GetIndex(); nSttContent = rSttPos.nContent.GetIndex(); break; - case POS_INSIDE: // Pos1 lays completely in Pos2 + case SwComparePosition::Inside: // Pos1 lays completely in Pos2 nSttNode = rSttPos.nNode.GetIndex(); nSttContent = rSttPos.nContent.GetIndex(); nEndNode = rEndPos.nNode.GetIndex(); nEndContent = rEndPos.nContent.GetIndex(); break; - case POS_OUTSIDE: // Pos2 lays completely in Pos1 + case SwComparePosition::Outside: // Pos2 lays completely in Pos1 if ( rRedl.GetContentIdx() ) { // than move section into UndoArray and memorize it @@ -941,7 +941,7 @@ SwRedlineSaveData::SwRedlineSaveData( } break; - case POS_EQUAL: // Pos1 is exactly as big as Pos2 + case SwComparePosition::Equal: // Pos1 is exactly as big as Pos2 break; default: @@ -1007,10 +1007,10 @@ bool SwUndo::FillSaveData( const SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRedl->Start(), *pRedl->End() ); - if ( eCmpPos != POS_BEFORE - && eCmpPos != POS_BEHIND - && eCmpPos != POS_COLLIDE_END - && eCmpPos != POS_COLLIDE_START ) + if ( eCmpPos != SwComparePosition::Before + && eCmpPos != SwComparePosition::Behind + && eCmpPos != SwComparePosition::CollideEnd + && eCmpPos != SwComparePosition::CollideStart ) { rSData.push_back(o3tl::make_unique<SwRedlineSaveData>(eCmpPos, *pStt, *pEnd, *pRedl, bCopyNext)); @@ -1039,10 +1039,10 @@ bool SwUndo::FillSaveDataForFormat( if ( nsRedlineType_t::REDLINE_FORMAT == pRedl->GetType() ) { const SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRedl->Start(), *pRedl->End() ); - if ( eCmpPos != POS_BEFORE - && eCmpPos != POS_BEHIND - && eCmpPos != POS_COLLIDE_END - && eCmpPos != POS_COLLIDE_START ) + if ( eCmpPos != SwComparePosition::Before + && eCmpPos != SwComparePosition::Behind + && eCmpPos != SwComparePosition::CollideEnd + && eCmpPos != SwComparePosition::CollideStart ) { rSData.push_back(o3tl::make_unique<SwRedlineSaveData>(eCmpPos, *pStt, *pEnd, *pRedl, true)); } |