41#include <osl/diagnose.h>
48 #define ERROR_PREFIX "redline table corrupted: "
55 void lcl_CheckPosition(
const SwPosition* pPos )
57 assert(
dynamic_cast<SwContentIndexReg*
>(&pPos->
GetNode())
61 if( pTextNode ==
nullptr )
71 void lcl_CheckPam(
const SwPaM* pPam )
74 lcl_CheckPosition( pPam->
GetPoint() );
75 lcl_CheckPosition( pPam->
GetMark() );
93 OSL_ENSURE( ( *(j->GetPoint()) != *(j->GetMark()) ) ||
94 ( j->GetContentIdx() !=
nullptr ),
99 for(
size_t n = 1;
n < rTable.
size(); ++
n )
117 #define CHECK_REDLINE( pDoc ) lcl_CheckRedline( pDoc );
121 #define CHECK_REDLINE( pDoc )
133 pAuthType->DelSequenceArray();
159 if ( !pTableOrSectionNode )
161 SAL_WARN(
"sw.core",
"UpdateFramesForAddDeleteRedline:: known pathology (or ChangesInRedline mode)");
164 for (
SwNodeOffset j = pTableOrSectionNode->
GetIndex(); j <= pTableOrSectionNode->EndOfSectionIndex(); ++j)
170 if (pLayout->HasMergedParas())
174 static_cast<SwTableNode*
>(pTableOrSectionNode)->DelFrames(pLayout);
178 static_cast<SwSectionNode*
>(pTableOrSectionNode)->DelFrames(pLayout);
185 if (currentStart < *rPam.
End())
196 std::vector<SwTextFrame*> frames;
200 if (pFrame->getRootFrame()->HasMergedParas())
202 frames.push_back(pFrame);
205 pFrame->SetDrawObjsAsDeleted(
true);
210 assert(std::none_of(layouts.begin(), layouts.end(),
211 [](
SwRootFrame const*
const pLayout) { return pLayout->IsHideRedlines(); }));
219 SwTextNode & rFirstNode(pFrame->GetMergedPara()
220 ? *pFrame->GetMergedPara()->pFirstNode
222 assert(pNode == pStartNode
224 : &rFirstNode == pNode);
226 pFrame->SetMergedPara(
nullptr);
228 *pFrame, rFirstNode,
eMode));
234 if (pFrame->GetMergedPara())
236 pLast =
const_cast<SwTextNode*
>(pFrame->GetMergedPara()->pLastNode);
260 bool isAppendObjsCalled(
false);
271 assert(pTableOrSectionNode);
272 for (
SwNodeOffset j = pTableOrSectionNode->
GetIndex(); j <= pTableOrSectionNode->EndOfSectionIndex(); ++j)
281 isAppendObjsCalled =
true;
286 if (currentStart < *rPam.
End())
297 std::vector<SwTextFrame*> frames;
301 if (pFrame->getRootFrame()->HasMergedParas())
303 frames.push_back(pFrame);
306 pFrame->SetDrawObjsAsDeleted(
false);
314 assert(std::none_of(layouts.begin(), layouts.end(),
315 [](
SwRootFrame const*
const pLayout) { return pLayout->IsHideRedlines(); }));
318 isAppendObjsCalled =
true;
334 if (
auto const pMergedPara = pFrame->GetMergedPara())
336 pLast =
const_cast<SwTextNode*
>(pMergedPara->pLastNode);
337 assert(pNode == pStartNode
339 : pMergedPara->pFirstNode == pNode);
341 SwTextNode & rFirstNode(*pMergedPara->pFirstNode);
342 pFrame->SetMergedPara(
nullptr);
344 *pFrame, rFirstNode,
eMode));
359 isAppendObjsCalled =
true;
372 if (!isAppendObjsCalled)
376 if (pLayout->HasMergedParas())
411 if (pToNode !=
nullptr && pFromNode !=
nullptr && pToNode != pFromNode)
413 const SwPaM aPam(*pToNode);
414 SwDoc& rDoc = aPam.GetDoc();
418 if (bCopy && pFromColl != pToColl)
433 bool bSameSet = aTmp == aTmp2;
437 for( sal_uInt16 nItem = 0; nItem < aTmp.TotalCount(); ++nItem)
439 sal_uInt16 nWhich = aTmp.GetWhichByPos(nItem);
440 if( SfxItemState::SET == aTmp.GetItemState( nWhich,
false ) &&
441 SfxItemState::SET != aTmp2.GetItemState( nWhich,
false ) )
442 aTmp2.Put( aTmp.GetPool()->GetDefaultItem(nWhich), nWhich );
446 if (bCopy && !bSameSet)
448 else if (!bCopy && (!bSameSet || pFromColl != pToColl))
455 void lcl_DeleteTrackedTableRow (
const SwPosition* pPos )
466 if ( pHasBoxTextChangesOnlyProp && !pHasBoxTextChangesOnlyProp->GetValue() )
491 if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
509 void lcl_RemoveTrackingOfTableRow(
const SwPosition* pPos,
bool bRejectDeletion )
520 if ( pHasBoxTextChangesOnlyProp && !pHasBoxTextChangesOnlyProp->GetValue() )
533 if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
535 bool bNoMoreInsertion =
false;
536 if ( !bRejectDeletion )
542 bNoMoreInsertion =
true;
544 if ( bRejectDeletion || bNoMoreInsertion )
560 SwPosition *pRStt =
nullptr, *pREnd =
nullptr;
562 if( pSttRng && pEndRng )
564 pRStt = pRedl->
Start();
565 pREnd = pRedl->
End();
573 case RedlineType::Insert:
574 case RedlineType::Format:
576 bool bCheck =
false, bReplace =
false;
580 if( *pSttRng == *pRStt )
584 if( *pEndRng != *pREnd )
589 rArr.
Insert( pNew ); ++rPos;
591 pRedl->
SetEnd( *pSttRng, pREnd );
602 pRedl->
SetEnd( *pSttRng, pREnd );
609 bool bInsert = RedlineType::Insert == pRedl->
GetType();
615 lcl_RemoveTrackingOfTableRow( &aPos,
false );
631 case RedlineType::Delete:
634 const SwPosition *pDelStt =
nullptr, *pDelEnd =
nullptr;
635 bool bDelRedl =
false;
668 pDelStt = pRedl->
Start();
669 pDelEnd = pRedl->
End();
677 if( pDelStt && pDelEnd )
679 SwPaM aPam( *pDelStt, *pDelEnd );
682 pRStt = pRedl->
Start();
683 pREnd = pRedl->
End();
686 if( pCSttNd && pCEndNd && pRStt && pREnd && pRStt->
GetContentIndex() == 0 )
687 lcl_CopyStyle(*pREnd, *pRStt);
695 if( pCSttNd && pCEndNd )
698 lcl_DeleteTrackedTableRow( aPam.End() );
700 else if (pCSttNd && !pCEndNd)
702 aPam.GetBound().nContent.Assign(
nullptr, 0 );
703 aPam.GetBound(
false ).nContent.Assign(
nullptr, 0 );
717 case RedlineType::FmtColl:
721 case RedlineType::ParagraphFormat:
739 SwPosition *pRStt =
nullptr, *pREnd =
nullptr;
741 if( pSttRng && pEndRng )
743 pRStt = pRedl->
Start();
744 pREnd = pRedl->
End();
752 case RedlineType::Insert:
754 const SwPosition *pDelStt =
nullptr, *pDelEnd =
nullptr;
755 bool bDelRedl =
false;
788 pDelStt = pRedl->
Start();
789 pDelEnd = pRedl->
End();
797 if( pDelStt && pDelEnd )
799 SwPaM aPam( *pDelStt, *pDelEnd );
810 if( pCSttNd && pCEndNd )
813 lcl_DeleteTrackedTableRow( aPam.End() );
815 else if (pCSttNd && !pCEndNd)
817 aPam.GetBound().nContent.Assign(
nullptr, 0 );
818 aPam.GetBound(
false ).nContent.Assign(
nullptr, 0 );
819 if (aPam.End()->GetNode().IsStartNode())
823 assert(!aPam.End()->GetNode().IsStartNode());
836 case RedlineType::Delete:
839 bool bCheck =
false, bReplace =
false;
840 SwPaM const updatePaM(pSttRng ? *pSttRng : *pRedl->
Start(),
841 pEndRng ? *pEndRng : *pRedl->
End());
847 lcl_RemoveTrackingOfTableRow( updatePaM.End(),
true );
858 if( *pSttRng == *pRStt )
867 if( *pEndRng != *pREnd )
872 rArr.
Insert( pCpy ); ++rPos;
877 pRedl->
SetEnd( *pSttRng, pREnd );
903 pRedl->
SetEnd( *pSttRng, pREnd );
922 rArr.
Insert( pNew ); ++rPos;
936 case RedlineType::Format:
937 case RedlineType::FmtColl:
938 case RedlineType::ParagraphFormat:
945 if ( pRedl->
GetType() == RedlineType::Format )
950 else if ( pRedl->
GetType() == RedlineType::ParagraphFormat )
963 constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
968 for (
const auto& [nBegin, nEnd] : aResetableSetRange)
970 for (sal_uInt16 i = nBegin;
i <= nEnd; ++
i)
971 aResetAttrsArray.
insert( i );
974 rDoc.
ResetAttrs(aPam,
false, aResetAttrsArray);
1001 int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
1009 * pEnd = rPam.
End();
1012 ( *pFnd->
Start() != *pStt || *pFnd->
End() > *pEnd ))
1015 if( (*fn_AcceptReject)( rArr, n, bCallDelete, pStt, pEnd ))
1022 bool bHasParagraphFormatChange =
false;
1023 for(
int m = 0 ;
m < 2 && !bHasParagraphFormatChange; ++
m )
1030 if( *pTmp->
End() <= *pEnd )
1032 if( (m > 0 || RedlineType::ParagraphFormat == pTmp->
GetType()) &&
1033 (*fn_AcceptReject)( rArr, o, bCallDelete,
nullptr,
nullptr ))
1035 bHasParagraphFormatChange =
true;
1041 if( *pTmp->
Start() < *pEnd )
1044 if( (m > 0 || RedlineType::ParagraphFormat == pTmp->
GetType()) &&
1045 (*fn_AcceptReject)( rArr, o, bCallDelete, pStt, pEnd ))
1047 bHasParagraphFormatChange =
true;
1059 void lcl_AdjustRedlineRange(
SwPaM& rPam )
1064 auto [pStt, pEnd] = rPam.
StartEnd();
1078 if( pEnd->GetNode().IsContentNode() &&
1079 !rDoc.
GetNodes()[ pEnd->GetNodeIndex() + 1 ]->IsContentNode() &&
1080 pEnd->GetContentIndex() == pEnd->GetNode().GetContentNode()->Len() )
1087 pEnd->GetNodeIndex() + 1 )
1095 class TemporaryRedlineUpdater
1099 std::shared_ptr<SwUnoCursor> m_pCursor;
1102 : m_rRedline(rRedline)
1103 , m_pCursor(rDoc.CreateUnoCursor(*rRedline.GetPoint(), false))
1108 *m_pCursor->GetMark() = *m_rRedline.
GetMark();
1113 ~TemporaryRedlineUpdater()
1115 static_cast<SwPaM&
>(m_rRedline) = *m_pCursor;
1126 , mbIsRedlineMove(false)
1127 , mnAutoFormatRedlnCommentNo(0)
1177 if (pLayout->IsHideRedlines())
1179 pLayout->SetHideRedlines(
false);
1180 hiddenLayouts.
insert(pLayout);
1185 for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
1189 (pRedline->*pFnc)(nLoop,
i,
false);
1206 pLayout->SetHideRedlines(
true);
1306 if( bCallDelete && RedlineType::Delete == pNewRedl->
GetType() )
1322 bool bMerged =
false;
1336 auto [pStt, pEnd] = pNewRedl->
StartEnd();
1339 if( pTextNode ==
nullptr )
1343 OSL_ENSURE(
false,
"Redline start: non-text-node with content" );
1351 OSL_ENSURE(
false,
"Redline start: index after text" );
1356 if( pTextNode ==
nullptr )
1358 if( pEnd->GetContentIndex() > 0 )
1360 OSL_ENSURE(
false,
"Redline end: non-text-node with content" );
1361 pEnd->SetContent(0);
1366 if( pEnd->GetContentIndex() > pTextNode->
Len() )
1368 OSL_ENSURE(
false,
"Redline end: index after text" );
1369 pEnd->SetContent( pTextNode->
Len() );
1373 if( ( *pStt == *pEnd ) &&
1379 bool bCompress =
false;
1392 auto [pRStt, pREnd] = pRedl->
StartEnd();
1395 if( ( *pRStt == *pREnd ) &&
1409 case RedlineType::Insert:
1412 case RedlineType::Insert:
1417 bool bDelete =
false;
1421 IsPrevPos( *pREnd, *pStt ) ) ||
1429 pRedl->
SetEnd( *pEnd, pREnd );
1441 IsPrevPos( *pEnd, *pRStt ) ) ||
1466 if( ( *pStt == *pEnd ) &&
1473 if( ( *pStt == *pEnd ) &&
1499 if( *pEnd != *pREnd )
1505 pRedl->
SetEnd( *pStt, pREnd );
1506 if( ( *pStt == *pRStt ) &&
1527 pSplit->
SetEnd( *pRStt );
1530 if( *pStt == *pEnd && pNewRedl->
GetContentIdx() ==
nullptr )
1546 if( ( *pStt == *pEnd ) &&
1555 case RedlineType::Delete:
1559 if( *pEnd != *pREnd )
1565 pRedl->
SetEnd( *pStt, pREnd );
1566 if( ( *pStt == *pRStt ) &&
1587 pSplit->
SetEnd( *pRStt );
1590 if( *pStt == *pEnd && pNewRedl->
GetContentIdx() ==
nullptr )
1609 case RedlineType::Format:
1621 pRedl->
SetEnd( *pStt, pREnd );
1640 if( *pEnd != *pREnd )
1642 if( *pEnd != *pRStt )
1646 pRedl->
SetEnd( *pStt, pREnd );
1655 pRedl->
SetEnd( *pStt, pREnd );
1666 case RedlineType::Delete:
1669 case RedlineType::Delete:
1676 if (*pEnd == *pREnd)
1678 pNewRedl->
SetEnd(*pRStt, pEnd);
1680 else if (*pStt == *pRStt)
1688 pNewRedl->
SetEnd( *pRStt, pEnd );
1711 pNewRedl->
SetStart( *pRStt, pStt );
1713 pNewRedl->
SetEnd( *pREnd, pEnd );
1718 pNewRedl->
SetStart( *pREnd, pStt );
1720 pNewRedl->
SetEnd( *pRStt, pEnd );
1725 && pRStt->
GetNode() != pREnd->GetNode())
1742 pRStt = pRedl->
Start();
1743 pREnd = pRedl->
End();
1749 pNewRedl->
SetStart( *pRStt, pStt );
1751 pNewRedl->
SetEnd( *pREnd, pEnd );
1758 if( *(pNewRedl->
Start()) <= *pREnd )
1779 case RedlineType::Insert:
1812 pEnd->GetNode().IsEndNode() )
1832 TemporaryRedlineUpdater
const u(
m_rDoc, *pNewRedl);
1842 SwPaM aPam( *pRStt, *pEnd );
1844 if( *pEnd == *pREnd )
1856 TemporaryRedlineUpdater
const u(
m_rDoc, *pNewRedl);
1866 SwPaM aPam( *pStt, *pREnd );
1868 if( *pStt == *pRStt )
1874 pRedl->
SetEnd( *pStt, pREnd );
1878 TemporaryRedlineUpdater
const u(
m_rDoc, *pNewRedl);
1916 if( *pRStt == *pStt )
1922 pNewRedl->
PushData( *pRedl,
false );
1932 pNewRedl->
PushData( *pRedl,
false );
1933 if( *pREnd != *pEnd )
1938 pRedl->
SetEnd( *pStt, pREnd );
1952 if( *pEnd == *pREnd )
1954 pNewRedl->
SetEnd( *pRStt, pEnd );
1956 else if (*pStt == *pRStt)
1964 pNewRedl->
SetStart( *pREnd, pStt );
1972 if( *pEnd == *pREnd )
1975 pNewRedl->
SetEnd( *pRStt, pEnd );
1988 pNewRedl->
SetEnd( *pRStt, pEnd );
2000 if( *pStt == *pRStt )
2003 pNewRedl->
SetStart( *pREnd, pStt );
2016 pNewRedl->
SetStart( *pREnd, pStt );
2049 case RedlineType::Format:
2061 pRedl->
SetEnd( *pStt, pREnd );
2075 if( *pEnd != *pREnd )
2077 if( *pEnd != *pRStt )
2081 pRedl->
SetEnd( *pStt, pREnd );
2082 if( ( *pStt == *pRStt ) &&
2091 pRedl->
SetEnd( *pStt, pREnd );
2102 case RedlineType::Format:
2105 case RedlineType::Insert:
2106 case RedlineType::Delete:
2110 pNewRedl->
SetEnd( *pRStt, pEnd );
2114 pNewRedl->
SetStart( *pREnd, pStt );
2126 if (*pEnd == *pREnd)
2128 pNewRedl->
SetEnd(*pRStt, pEnd);
2130 else if (*pStt == *pRStt)
2138 pNewRedl->
SetEnd( *pRStt, pEnd );
2148 case RedlineType::Format:
2169 else if( *pREnd == *pEnd )
2171 pRedl->
SetEnd( *pStt, pREnd );
2172 else if( *pRStt == *pStt )
2187 pRedl->
SetEnd( *pStt, pREnd );
2202 pNewRedl->
SetStart( *pRStt, pStt );
2204 pNewRedl->
SetEnd( *pREnd, pEnd );
2209 pNewRedl->
SetStart( *pREnd, pStt );
2211 pNewRedl->
SetEnd( *pRStt, pEnd );
2221 pNewRedl->
SetEnd( *pREnd, pEnd );
2235 pNewRedl->
SetStart( *pRStt, pStt );
2249 case RedlineType::FmtColl:
2260 if( ( *pStt == *pEnd ) &&
2268 if ( bCallDelete && RedlineType::Delete == pNewRedl->
GetType() )
2298 pNewRedl->
SetEnd( aPos );
2304 std::unique_ptr<SwRedlineExtraData_FormatColl> xRedlineExtraData;
2307 xRedlineExtraData.reset(pExtraData);
2313 if ( pExtraData || *pPar->
Start() != *pPar->
End() )
2320 lcl_CopyStyle(*pStt, aPos);
2370 while ( aSttIdx < aEndIdx )
2383 assert(ret || !pNewRedl);
2384 if (ret && !pNewRedl)
2396 return (
nullptr != pNewRedl)
2440 return nullptr != pNewRedl;
2482 return nullptr != pNewRedl;
2489 void (
SwRangeRedline::*pFnc)(sal_uInt16, size_t, bool) =
nullptr;
2497 if (nStartIndex == 0)
2503 auto [pPrevStt,pPrevEnd] = pPrev->
StartEnd();
2504 auto [pCurStt, pCurEnd] = pCur->StartEnd();
2506 if( *pPrevEnd == *pCurStt && pPrev->
CanCombine( *pCur ) &&
2507 pPrevStt->GetNode().StartOfSectionNode() ==
2508 pCurEnd->GetNode().StartOfSectionNode() &&
2509 !pCurEnd->GetNode().StartOfSectionNode()->IsTableNode() )
2513 pPrev->
Show(0, nPrevIndex);
2516 pPrev->
SetEnd( *pCur->End() );
2520 (pPrev->*pFnc)(0, nPrevIndex,
false);
2531 auto [pStt, pEnd] = rRange.
StartEnd();
2537 auto [pRedlineStart, pRedlineEnd] = pRedline->
StartEnd();
2538 if (*pRedlineStart <= *pStt && *pEnd <= *pRedlineEnd)
2542 if (*pStt == *pRedlineStart)
2544 if (*pEnd == *pRedlineEnd)
2552 pRedline->
SetEnd( *pStt, pRedlineEnd );
2557 *pRedlineStart = *pEnd;
2561 *pRedlineEnd = *pStt;
2579 else if (*pEnd < *pRedlineStart)
2598 if( pUndo->GetRedlSaveCount() )
2604 auto [pStt, pEnd] = rRange.
StartEnd();
2610 if( RedlineType::Any != nDelType && nDelType != pRedl->
GetType() )
2613 auto [pRStt, pREnd] = pRedl->
StartEnd();
2635 pRedl->
SetEnd( *pStt, pREnd );
2650 if( *pRStt == *pStt )
2662 if( *pREnd != *pEnd )
2670 pRedl->
SetEnd( *pStt, pREnd );
2730 return lhs->End()->GetNodeIndex() < nNdIdx;
2735 auto [pStart, pEnd] = pTmp->
StartEnd();
2737 nEnd = pEnd->GetNodeIndex();
2740 nStart <= nNdIdx && nNdIdx <= nEnd )
2743 if( nStart > nNdIdx )
2755 std::swap( nMk, nPt );
2758 nMk <= nNdIdx && nNdIdx <= nPt )
2788 if ( currentStart < *pTmp->
End() && *pTmp->
Start() <= currentEnd &&
2790 ( !bStartOrEndInRange ||
2791 ( currentStart < *pTmp->
Start() || *pTmp->
End() < currentEnd ) ) )
2808 nM = nU + ( nO - nU ) / 2;
2810 auto [pStt, pEnd] = pRedl->StartEnd();
2813 : ( *pStt <= rPos && rPos < *pEnd ) )
2825 if( RedlineType::Format == pRedl->GetType() )
2834 else if( ( nM + 1 ) <= nO && rPos >= *
maRedlineTable[ nM + 1 ]->Start() &&
2847 else if( *pEnd <= rPos )
2889 sal_uInt16 nSeqNo = pTmp->
GetSeqNo();
2896 std::make_unique<SwUndoAcceptRedline>(*pTmp) );
2921 }
while( nLoopCnt );
2953 *pPam->GetMark() = *rPam.
GetMark();
2955 lcl_AdjustRedlineRange(*pPam);
2963 int nRet = lcl_AcceptRejectRedl( lcl_AcceptRedline,
maRedlineTable,
2964 bCallDelete, *pPam );
2992 auto [pStt, pEnd] = rPam.
StartEnd();
3003 std::swap( nMk, nPt );
3005 if( RedlineType::ParagraphFormat == pTmp->
GetType() &&
3006 ( (nSttIdx <= nMk && nMk <= nEndIdx) || (nSttIdx <= nPt && nPt <= nEndIdx) ) )
3037 sal_uInt16 nSeqNo = pTmp->
GetSeqNo();
3044 std::make_unique<SwUndoRejectRedline>( *pTmp ) );
3069 }
while( nLoopCnt );
3098 lcl_AdjustRedlineRange( aPam );
3106 int nRet = lcl_AcceptRejectRedl( lcl_RejectRedline,
maRedlineTable,
3107 bCallDelete, aPam );
3136 bool bSuccess =
true;
3161 if (!sUndoStr.isEmpty())
3187 if( !pCNd || ( aTmp == rSttPos.
GetNode() &&
3192 rSttPos = *pFnd->
End();
3204 rSttPos = *pFnd->
End();
3225 pRStt = pTmp->
Start();
3226 if( *pPrevEnd == *pRStt || IsPrevPos( *pPrevEnd, *pRStt ) )
3228 pPrevEnd = pTmp->
End();
3229 rSttPos = *pPrevEnd;
3249 pPos->
Assign( *pCNd, 0 );
3286 }
while( bRestart );
3313 if( !pCNd || ( aTmp == rSttPos.
GetNode() &&
3318 rSttPos = *pFnd->
Start();
3324 while( !pFnd && 0 <
n )
3330 rSttPos = *pFnd->
Start();
3349 ( *pNextStt == *( pREnd = pTmp->
End() ) ||
3350 IsPrevPos( *pREnd, *pNextStt )) )
3352 pNextStt = pTmp->
Start();
3353 rSttPos = *pNextStt;
3391 pPos->
Assign( *pCNd, 0 );
3413 }
while( bRestart );
3424 auto [pStt, pEnd] = rPaM.
StartEnd();
3432 if( pStt != pEnd && *pTmp->
Start() > *pEnd )
3436 if( *pTmp->
End() >= *pEnd )
3451 return SW_MOD()->GetRedlineAuthor();
3457 return SW_MOD()->InsertRedlineAuthor(rNew);
3478 const uno::Sequence <sal_Int8>& rNewPassword)
3509 if ( pRedline->
GetType() == RedlineType::Delete )
3511 if ( bDeletion && pRedline->
IsVisible() )
3513 pRedline->
Hide(0, rTable.
GetPos(pRedline),
false);
3514 pRedline->
Hide(1, rTable.
GetPos(pRedline),
false);
3516 else if ( !bDeletion && !pRedline->
IsVisible() )
3518 pRedline->
Show(0, rTable.
GetPos(pRedline),
true);
3519 pRedline->
Show(1, rTable.
GetPos(pRedline),
true);
3522 else if ( pRedline->
GetType() == RedlineType::Insert )
3524 if ( !bDeletion && pRedline->
IsVisible() )
3529 else if ( bDeletion && !pRedline->
IsVisible() )
3531 pRedline->
Show(0, rTable.
GetPos(pRedline),
true);
3532 pRedline->
Show(1, rTable.
GetPos(pRedline),
true);
3546 pRedline->
Show(0, rTable.
GetPos(pRedline),
true);
3547 pRedline->
Show(1, rTable.
GetPos(pRedline),
true);
#define CHECK_REDLINE(pDoc)
@ ShowDelete
show all deletes
@ ShowInsert
show all inserts
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual void DeleteRange(SwPaM &)=0
Delete a range SwFlyFrameFormat.
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
Document fields related interfaces.
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual void UpdateRefFields()=0
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields)=0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual bool IsRedlineOn() const =0
Query if redlining is on.
static bool IsShowOriginal(const RedlineFlags eM)
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
static bool IsHideChanges(const RedlineFlags eM)
virtual void SetModified()=0
Must be called manually at changes of format.
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
virtual sal_Int32 Len() const
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
IDocumentState const & getIDocumentState() const
void DeleteCol(const SwCursor &rCursor)
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
bool IsAutoFormatRedline() const
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void SetRowNotTracked(const SwCursor &rCursor, const SvxPrintItem &rNotTracked, bool bAll=false, bool bIns=false)
rNotTracked = false means that the row was deleted or inserted with its tracked cell content bAll: de...
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
bool IsInXMLImport() const
void DelNumRules(const SwPaM &, SwRootFrame const *pLayout=nullptr)
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwFootnoteIdxs & GetFootnoteIdxs()
void SetInXMLImport(bool bNew)
void SetAutoFormatRedline(bool bFlag)
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const o3tl::sorted_vector< sal_uInt16 > &rAttrs=o3tl::sorted_vector< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
const SwAttrPool & GetAttrPool() const
void DeleteRow(const SwCursor &rCursor)
Deleting Columns/Rows.
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter <bResetListAttrs>.
void SetBoxAttr(const SwCursor &rCursor, const SfxPoolItem &rNew)
SwDocShell * GetDocShell()
virtual void UpdateFields()
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwSectionNode * GetSectionNode()
SwNodeOffset GetIndex() const
const SwStartNode * FindTableBoxStartNode() const
SwNodes & GetNodes()
Node is in which nodes-array/doc?
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
bool IsContentNode() const
const SwStartNode * FindFlyStartNode() const
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwStartNode * StartOfSectionNode() const
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
SwTableNode * GetTableNode()
const SwEndNode * EndOfSectionNode() const
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwNode & GetEndOfRedlines() const
Section for all Redlines.
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!...
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool ContainsPosition(const SwPosition &rPos) const
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
void Show(sal_uInt16 nLoop, size_t nMyPos, bool bForced=false)
void InvalidateRange(Invalidation)
Initiate the layout.
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
void SetSeqNo(sal_uInt16 nNo)
sal_uInt16 GetStackCount() const
std::size_t GetAuthor(sal_uInt16 nPos=0) const
const SwNodeIndex * GetContentIdx() const
void Hide(sal_uInt16 nLoop, size_t nMyPos, bool bForced=false)
bool IsOwnRedline(const SwRangeRedline &rRedl) const
const SwRedlineExtraData * GetExtraData() const
OUString GetDescr(bool bSimplified=false)
Returns textual description of a redline data element of this redline.
void SetStart(const SwPosition &rPos, SwPosition *pSttPtr=nullptr)
void SetEnd(const SwPosition &rPos, SwPosition *pEndPtr=nullptr)
void ShowOriginal(sal_uInt16 nLoop, size_t nMyPos, bool bForced=false)
bool HasValidRange() const
Do we have a valid selection?
void PushData(const SwRangeRedline &rRedl, bool bOwnAsNext=true)
void SetComment(const OUString &rS)
RedlineType GetType(sal_uInt16 nPos=0) const
bool CanCombine(const SwRangeRedline &rRedl) const
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
sal_uInt16 GetSeqNo() const
bool IsAnonymized() const
size_type FindNextSeqNo(sal_uInt16 nSeqNo, size_type nSttPos) const
Search next or previous Redline with the same Seq.
size_type FindPrevSeqNo(sal_uInt16 nSeqNo, size_type nSttPos) const
vector_type::const_iterator end() const
bool isMoved(size_type tableIndex) const
bool Insert(SwRangeRedline *&p)
void DeleteAndDestroy(size_type nPos)
static constexpr size_type npos
vector_type::const_iterator begin() const
void Remove(size_type nPos)
vector_type::size_type size_type
bool HasOverlappingElements() const
size_type GetPos(const SwRangeRedline *p) const
const SwRangeRedline * FindAtPosition(const SwPosition &startPosition, size_type &tableIndex, bool next=true) const
Find the redline at the given position.
void AddRule(SwUndoArg eWhat, const OUString &rWith)
OUString Apply(const OUString &rStr) const
The root element of a Writer document layout.
bool HasMergedParas() const
A section node represents the start of a section on the UI, i.e.
Starts a section of nodes in the document model.
SwTableBox is one table cell in the document model.
bool IsEmpty(bool bWithRemainingNestedTable=true) const
SwFrameFormat * GetFrameFormat()
Redline that holds information about a table-cell that had some change.
SwTableLine is one table row in the document model.
SwFrameFormat * GetFrameFormat()
SwRedlineTable::size_type UpdateTextChangesOnly(SwRedlineTable::size_type &rRedlinePos, bool bUpdateProperty=true) const
Redline that holds information about a table-row that had some change.
Represents the style of a paragraph.
Represents the visualization of a paragraph.
SwTextNode is a paragraph in the document model.
virtual sal_Int32 Len() const override
bool GetParaAttr(SfxItemSet &rSet, sal_Int32 nStt, sal_Int32 nEnd, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true, const bool bMergeIndentValuesOfNumRule=false, SwRootFrame const *pLayout=nullptr) const
Query the attributes of textnode over the range.
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
const OUString & GetText() const
void RemoveFromListRLHidden()
SwTextFormatColl * GetTextColl() const
std::pair< const_iterator, bool > insert(Value &&x)
css::uno::Sequence< sal_Int8 > maRedlinePasswd
virtual bool SplitRedline(const SwPaM &rPam) override
void HideAll(bool bDeletion)
virtual RedlineFlags GetRedlineFlags() const override
Replaced by SwRootFrame::IsHideRedlines() (this is model-level redline hiding).
virtual AppendResult AppendRedline(SwRangeRedline *pPtr, bool bCallDelete) override
Append a new redline.
virtual bool IsRedlineMove() const override
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const override
virtual void SetRedlineFlags_intern(RedlineFlags eMode) override
Set a new redline mode.
virtual const SwRangeRedline * SelPrevRedline(SwPaM &rPam) const override
virtual void SetRedlineMove(bool bFlag) override
virtual bool IsRedlineOn() const override
Query if redlining is on.
RedlineFlags meRedlineFlags
virtual const SwRangeRedline * SelNextRedline(SwPaM &rPam) const override
void SetAutoFormatRedlineComment(const OUString *pText, sal_uInt16 nSeqNo=0)
Set comment-text for Redline.
virtual bool HasRedline(const SwPaM &rPam, RedlineType nType, bool bStartOrEndInRange) const override
virtual const SwRedlineTable & GetRedlineTable() const override
virtual bool AcceptRedline(SwRedlineTable::size_type nPos, bool bCallDelete) override
virtual void UpdateRedlineAttr() override
virtual void SetRedlineFlags(RedlineFlags eMode) override
Set a new redline mode.
std::optional< OUString > moAutoFormatRedlnComment
virtual void CompressRedlines(size_t nStartIdx=0) override
virtual std::size_t InsertRedlineAuthor(const OUString &rAuthor) override
Insert new author into the Table for the Readers etc.
sal_uInt16 mnAutoFormatRedlnCommentNo
SeqNo for conjoining of AutoFormat-Redlines.
virtual bool SetRedlineComment(const SwPaM &rPam, const OUString &rComment) override
virtual std::size_t GetRedlineAuthor() override
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword) override
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const override
virtual bool RejectRedline(SwRedlineTable::size_type nPos, bool bCallDelete) override
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const override
SwExtraRedlineTable maExtraRedlineTable
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const override
virtual bool IsInRedlines(const SwNode &rNode) const override
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType) override
virtual bool AppendTableCellRedline(SwTableCellRedline *pPtr) override
virtual void AcceptRedlineParagraphFormatting(const SwPaM &rPam) override
virtual bool AppendTableRowRedline(SwTableRowRedline *pPtr) override
virtual void AcceptAllRedline(bool bAcceptReject) override
SwRedlineTable maRedlineTable
DocumentRedlineManager(SwDoc &i_rSwdoc)
virtual bool IsIgnoreRedline() const override
virtual ~DocumentRedlineManager() override
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr sal_uInt16 RES_PARATR_END(82)
constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END)
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(101)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(104)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
Dialog to specify the properties of date form field.
void UpdateFramesForRemoveDeleteRedline(SwDoc &rDoc, SwPaM const &rPam)
void MoveMergedFlysAndFootnotes(std::vector< SwTextFrame * > const &rFrames, SwTextNode const &rFirstNode, SwTextNode &rSecondNode, bool)
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
static void UpdateFieldsForRedline(IDocumentFieldsAccess &rIDFA)
void UpdateFramesForAddDeleteRedline(SwDoc &rDoc, SwPaM const &rPam)
void AddRemoveFlysAnchoredToFrameStartingAtNode(SwTextFrame &rFrame, SwTextNode &rTextNode, std::set< SwNodeOffset > *pSkipped)
rTextNode is the first one of the "new" merge - if rTextNode isn't the same as MergedPara::pFirstNode...
std::unique_ptr< sw::MergedPara > CheckParaRedlineMerge(SwTextFrame &rFrame, SwTextNode &rTextNode, FrameMode eMode)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwComparePosition ComparePosition(const T &rStt1, const T &rEnd1, const T &rStt2, const T &rEnd2)
@ OverlapBehind
Pos1 overlaps Pos2 at the end.
@ CollideEnd
Pos1 end touches at Pos2 start.
@ Behind
Pos1 behind Pos2.
@ OverlapBefore
Pos1 overlaps Pos2 at the beginning.
@ Outside
Pos2 completely contained in Pos1.
@ Before
Pos1 before Pos2.
@ Inside
Pos1 completely contained in Pos2.
@ CollideStart
Pos1 start touches at Pos2 end.
@ Equal
Pos1 is as large as Pos2.
Marks a position in the document model.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
const SwContentNode * GetContentNode() const
SwNodeOffset GetNodeIndex() const
sal_Int32 GetContentIndex() const
SwDoc & GetDoc() const
Returns the document this position is in.
OUString SwResId(TranslateId aId)