21 #include <compiler.hxx>
23 #include <document.hxx>
31 #include <globstr.hrc>
34 #include <tokenarray.hxx>
38 #include <osl/diagnose.h>
54 pLinkDeletedIn( nullptr ),
55 pLinkDeleted( nullptr ),
56 pLinkDependent( nullptr ),
69 const OUString& aTempUser,
const OUString& aTempComment) :
71 aDateTime( aTempDateTime ),
73 aComment( aTempComment ),
77 pLinkDeletedIn( nullptr ),
78 pLinkDeleted( nullptr ),
79 pLinkDependent( nullptr ),
80 nAction( nTempAction ),
81 nRejectAction( nTempRejectAction ),
95 pLinkDeletedIn( nullptr ),
96 pLinkDeleted( nullptr ),
97 pLinkDependent( nullptr ),
98 nAction( nTempAction ),
175 static_cast<const ScChangeActionContent*>(
this)->GetNewCell() );
202 if ( static_cast<const ScChangeActionContent*>(
this)->IsOldMatrixReference() )
206 if ( pNextContent ==
nullptr )
224 if ( pNextContent ==
nullptr )
243 if ( static_cast<const ScChangeActionContent*>(
this)->IsMatrixOrigin() &&
HasDependent() )
247 return pPrevContent && pPrevContent->
IsVirgin();
301 bool bRemoved =
false;
367 if ( p !=
nullptr && (p->
GetType() == eDelType || p->
GetType() == eInsType) )
390 pLink2 = p->
AddDeleted( static_cast<ScChangeActionContent*>(
this)->GetTopContent() );
414 sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz )
420 OUString& rStr,
ScDocument& ,
bool ,
bool bWarning )
const
429 OUStringBuffer
aBuf(rStr);
433 ScResId(STR_CHANGED_MOVE_REJECTION_WARNING)).append(
" ");
434 rStr = aBuf.makeStringAndClear();
441 ScResId(STR_CHANGED_DELETE_REJECTION_WARNING)).append(
" ");
442 rStr = aBuf.makeStringAndClear();
458 ScResId(STR_CHANGED_MOVE_REJECTION_WARNING));
460 rStr = aBuf.makeStringAndClear();
467 ScResId(STR_CHANGED_DELETE_REJECTION_WARNING));
469 rStr = aBuf.makeStringAndClear();
478 ScChangeActionMap::iterator itChangeAction = std::find_if(aMap.begin(), aMap.end(),
479 [&pReject](
const ScChangeActionMap::value_type& rEntry) {
481 if (itChangeAction == aMap.end())
484 if( itChangeAction->second->GetType() ==
SC_CAT_MOVE)
486 ScResId(STR_CHANGED_MOVE_REJECTION_WARNING));
489 ScResId(STR_CHANGED_DELETE_REJECTION_WARNING));
492 rStr = aBuf.makeStringAndClear();
513 rDoc.
GetName( aTmpRange.aStart.Tab(), aTmp );
526 rDoc.
GetName( aTmpRange.aStart.Tab(), aTmp );
530 aBuf.append(static_cast<sal_Int32>(aTmpRange.aStart.Row()+1));
532 aBuf.append(static_cast<sal_Int32>(aTmpRange.aEnd.Row()+1));
548 return aBuf.makeStringAndClear();
562 OUString& rStr,
ScDocument& rDoc,
bool bFlag3D )
const
590 std::vector<ScChangeActionContent*> aContentsList;
596 aContentsList.push_back(static_cast<ScChangeActionContent*>(p) );
601 OSL_ENSURE( !
pLinkDeleted,
"ScChangeAction::RejectRestoreContents: pLinkDeleted != NULL" );
608 pContent->GetBigRange().aStart.IsValid( rDoc ) )
609 pContent->PutNewValueToDoc( &rDoc, nDx, nDy );
620 OSL_ENSURE( pAct,
"ScChangeAction::SetDeletedInThis: missing Action" );
632 OSL_ENSURE( pAct,
"ScChangeAction::AddDependent: missing Action" );
644 mbEndOfList(bEndOfList)
667 OSL_FAIL(
"ScChangeActionIns: Block not supported!" );
674 const OUString& aUserP,
const DateTime& aDateTimeP,
677 ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
678 mbEndOfList(bEndOfList)
687 OUString& rStr,
ScDocument& rDoc,
bool bSplitRange,
bool bWarning )
const
695 pWhatId = STR_COLUMN;
704 OUString aRsc =
ScResId(STR_CHANGED_INSERT);
705 sal_Int32
nPos = aRsc.indexOf(
"#1");
713 OUString aRangeStr = aBuf.makeStringAndClear();
715 aRsc = aRsc.replaceAt(nPos, 2, aRangeStr);
717 aBuf.append(rStr).append(aRsc);
718 rStr = aBuf.makeStringAndClear();
733 aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ) )
765 pLinkMove( nullptr ),
790 OSL_FAIL(
"ScChangeActionDel: Block not supported!" );
797 const OUString& aUserP,
const DateTime& aDateTimeP,
const OUString &sComment,
799 ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
803 pLinkMove( nullptr ),
877 sal_Int32 nDxP, sal_Int32 nDyP, sal_Int32 nDz )
923 OUString& rStr,
ScDocument& rDoc,
bool bSplitRange,
bool bWarning )
const
931 pWhatId = STR_COLUMN;
952 OUString aRsc =
ScResId(STR_CHANGED_DELETE);
953 sal_Int32
nPos = aRsc.indexOf(
"#1");
962 OUString aRangeStr = aBuf.makeStringAndClear();
963 aRsc = aRsc.replaceAt(nPos, 2, aRangeStr);
965 aBuf.append(rStr).append(aRsc);
966 rStr = aBuf.makeStringAndClear();
978 if ( !aTmpRange.
IsValid( rDoc ) )
999 if ( aRange.aStart.Col() != 0 || aRange.aEnd.Col() != rDoc.
MaxCol() )
1052 else if ( nFrom < 0 )
1062 else if ( nFrom < 0 )
1072 else if ( nFrom < 0 )
1125 const OUString& aUserP,
const DateTime& aDateTimeP,
1126 const OUString &sComment,
const ScBigRange& aFromBigRange,
1129 aFromRange(aFromBigRange),
1153 sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz )
1163 nDx = rToPos.
Col() - rFromPos.
Col();
1164 nDy = rToPos.
Row() - rFromPos.
Row();
1165 nDz = rToPos.
Tab() - rFromPos.
Tab();
1169 OUString& rStr,
ScDocument& rDoc,
bool bSplitRange,
bool bWarning )
const
1175 OUString aRsc =
ScResId(STR_CHANGED_MOVE);
1178 sal_Int32
nPos = aRsc.indexOf(
"#1");
1181 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1182 nPos += aTmpStr.getLength();
1186 nPos = nPos >= 0 ? aRsc.indexOf(
"#2", nPos) : -1;
1189 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1196 OUString& rStr,
ScDocument& rDoc,
bool bFlag3D )
const
1216 aToRange.aStart.Col(), aToRange.aStart.Row(),
1217 aToRange.aEnd.Col(), aToRange.aEnd.Row() );
1220 aFrmRange.aStart.Col(), aFrmRange.aStart.Row(),
1221 aFrmRange.aEnd.Col(), aFrmRange.aEnd.Row() );
1233 aCxt.
mnColDelta = aFrmRange.aStart.Col() - aToRange.aStart.Col();
1234 aCxt.
mnRowDelta = aFrmRange.aStart.Row() - aToRange.aStart.Row();
1235 aCxt.
mnTabDelta = aFrmRange.aStart.Tab() - aToRange.aStart.Tab();
1271 pNextContent(nullptr),
1272 pPrevContent(nullptr),
1273 pNextInSlot(nullptr),
1274 ppPrevInSlot(nullptr)
1279 const ScBigRange& aBigRangeP,
const OUString& aUserP,
1280 const DateTime& aDateTimeP,
const OUString& sComment,
1283 maOldCell(rOldCell),
1284 maOldValue(sOldValue),
1285 pNextContent(nullptr),
1286 pPrevContent(nullptr),
1287 pNextInSlot(nullptr),
1288 ppPrevInSlot(nullptr)
1293 if (!sOldValue.isEmpty())
1299 const ScDocument* pDoc,
const OUString& sNewValue ) :
1301 maNewCell(rNewCell),
1302 maNewValue(sNewValue),
1303 pNextContent(nullptr),
1304 pPrevContent(nullptr),
1305 pNextInSlot(nullptr),
1306 ppPrevInSlot(nullptr)
1311 if (!sNewValue.isEmpty())
1389 if (!rFormatted.isEmpty())
1397 if ( rStr.getLength() > 1 && rStr[0] ==
'=' )
1426 OUString& rStr,
ScDocument& rDoc,
bool bSplitRange,
bool bWarning )
const
1430 OUString aRsc =
ScResId(STR_CHANGED_CELL);
1435 sal_Int32
nPos = aRsc.indexOf(
"#1", 0);
1438 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1439 nPos += aTmpStr.getLength();
1443 if (aTmpStr.isEmpty())
1444 aTmpStr =
ScResId( STR_CHANGED_BLANK );
1446 nPos = nPos >= 0 ? aRsc.indexOf(
"#2", nPos) : -1;
1449 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1450 nPos += aTmpStr.getLength();
1454 if (aTmpStr.isEmpty())
1455 aTmpStr =
ScResId( STR_CHANGED_BLANK );
1457 nPos = nPos >= 0 ? aRsc.indexOf(
"#3", nPos) : -1;
1460 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1467 OUString& rStr,
ScDocument& rDoc,
bool bFlag3D )
const
1493 rStr =
"(" + rStr +
")";
1514 bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions )
1521 while ( ( pContent = pContent->
pPrevContent ) != nullptr )
1528 while ( ( pContent = pContent->
pNextContent ) !=
nullptr )
1544 if ( bOldest || pEnd !=
this )
1550 aCell.
assign(rDoc, rPos);
1560 if ( pRejectActions )
1561 pRejectActions->push( pNew );
1564 aCell.
assign(rDoc, rPos);
1678 SetValue(rStr, rCell, nFormat, rOrgCell, pFromDoc, pToDoc);
1689 rCell.
assign(rOrgCell, *pToDoc);
1695 rOrgCell.
mfValue, nFormat, rStr);
1736 if (!rValue.isEmpty())
1771 OSL_FAIL(
"ScChangeActionContent::GetFormulaString: aPos != pCell->aPos" );
1773 pNew->GetFormula( rStr );
1799 if (!rValue.isEmpty())
1813 pDoc->
SetString( aPos.Col(), aPos.Row(), aPos.Tab(), rValue );
1824 OSL_ENSURE( nC>0 && nR>0,
"ScChangeActionContent::PutValueToDoc: MatColsRows?" );
1832 aDestMark.SetMarkArea( aRange );
1842 rCell.
commit(*pDoc, aPos);
1881 sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz )
1886 if ( nNewSlot != nOldSlot )
1897 if ( !(bOldFormula || bNewFormula) )
1921 if ( nDx < 0 || nDy < 0 || nDz < 0 )
1964 aRefCxt.maRange = aRange;
1965 aRefCxt.mnColDelta = nDx;
1966 aRefCxt.mnRowDelta = nDy;
1967 aRefCxt.mnTabDelta = nDz;
2020 const ScBigRange& aBigRangeP,
const OUString& aUserP,
2021 const DateTime& aDateTimeP,
const OUString& sComment) :
2044 return nRowsPerSlot;
2052 SC_MOD()->GetUserOptions().AddListener(
this);
2059 maUserCollection(aTempUserCollection),
2064 SC_MOD()->GetUserOptions().AddListener(
this);
2071 SC_MOD()->GetUserOptions().RemoveListener(
this);
2104 OUStringBuffer
aBuf;
2108 maUser = aBuf.makeStringAndClear();
2116 for ( p =
GetFirst(); p; p = pNext )
2128 delete rEntry.second;
2160 ScChangeActionMap::const_iterator it =
aMap.find( nAction );
2161 if( it !=
aMap.end() )
2169 ScChangeActionMap::const_iterator it =
aGeneratedMap.find( nGenerated );
2195 if( it !=
aMap.end() )
2209 OUStringBuffer
aBuf;
2213 SetUser(aBuf.makeStringAndClear());
2327 pAppend->
AddLink(
nullptr, pLink );
2334 pAppend->
AddLink(
nullptr, pLink );
2341 pAppend->
AddLink(
nullptr, pLink );
2348 pAppend->
AddLink(
nullptr, pLink );
2381 aMap.insert( ::std::make_pair( nAction, pAppend ) );
2447 rRange.
GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
2448 for (
SCTAB nTab = nTab1; nTab <= nTab2; nTab++ )
2450 if ( !pRefDoc || nTab < pRefDoc->GetTableCount() )
2458 for (
SCCOL nCol = nCol1; nCol <= nCol2; nCol++ )
2461 aRange.aEnd.SetCol( nCol );
2462 if ( nCol == nCol2 )
2465 nTab-nTab1 + nDz, nRejectingInsert );
2469 nTab-nTab1 + nDz, nRejectingInsert );
2474 for (
SCROW nRow = nRow1; nRow <= nRow2; nRow++ )
2477 aRange.aEnd.SetRow( nRow );
2478 if ( nRow == nRow2 )
2481 0, nRejectingInsert );
2485 else if ( nRow1 == 0 && nRow2 ==
rDoc.
MaxRow() )
2488 for (
SCCOL nCol = nCol1; nCol <= nCol2; nCol++ )
2491 aRange.aEnd.SetCol( nCol );
2492 if ( nCol == nCol2 )
2495 0, nRejectingInsert );
2500 OSL_FAIL(
"ScChangeTrack::AppendDeleteRange: Block not supported!" );
2512 ScRange aTrackRange( rOrgRange );
2534 if ( nRejectingInsert )
2551 for (
bool bHas = aIter.
first(); bHas; bHas = aIter.
next())
2594 return nC1 != nC2 || nR1 != nR2;
2626 aOldCell.
assign(*pRefDoc, rPos);
2688 rRange.
GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
2692 bDoContents =
false;
2698 if ( (nTmpCol = static_cast<SCCOL>(r.
aEnd.
Col() - r.
aStart.
Col())) != (nCol2 - nCol1) )
2701 nCol1 += nTmpCol + 1;
2705 if ( (nTmpRow = static_cast<SCROW>(r.
aEnd.
Row() - r.
aStart.
Row())) != (nRow2 - nRow1) )
2708 nRow1 += nTmpRow + 1;
2712 if ( (nTmpTab = static_cast<SCTAB>(r.
aEnd.
Tab() - r.
aStart.
Tab())) != (nTab2 - nTab1) )
2715 nTab1 += nTmpTab + 1;
2740 for (
SCTAB nTab = nTab1; nTab <= nTab2; nTab++ )
2743 for (
SCCOL nCol = nCol1; nCol <= nCol2; nCol++ )
2746 for (
SCROW nRow = nRow1; nRow <= nRow2; nRow++ )
2779 while (aIter.
next());
2785 nStartAction = nEndAction = 0;
2810 pContent->RemoveDeletedIn( pDeletor );
2826 rPos, rCell, pFromDoc, &
rDoc );
2845 if ( pContent->
pNext )
2847 if ( pContent->
pPrev )
2860 p =
p->GetNextInSlot() )
2862 if (
p != pButNotThis && !
p->IsDeletedIn() &&
2863 p->GetBigRange().aStart == rPos )
2877 pDependent->
AddLink( pParent, pLink );
2897 if ( !(static_cast<ScChangeActionContent*>(pAct)->GetNextContent() ||
2904 pContent->
SetNextContent( static_cast<ScChangeActionContent*>(pAct) );
2920 OSL_FAIL(
"ScChangeTrack::Dependencies: MatOrg not found" );
2943 (bActNoInsert && !bActRowDel && !bActTabDel)) )
2957 (bActNoInsert && !bActColDel && !bActTabDel)) )
2971 (bActNoInsert && !bActColDel && !bActRowDel)) )
3037 if ( pRemove ==
pLast )
3046 if ( pRemove->
pNext )
3048 if ( pRemove->
pPrev )
3088 if ( nStartAction == 0 )
3092 if ( nEndAction && nStartAction <= nEndAction )
3098 for (
sal_uLong j = nEndAction; j >= nStartAction; --j )
3108 if (j == nEndAction || (pAct !=
pLast && static_cast<ScChangeActionDel*>(pAct)->IsTopDelete()))
3111 SetInDeleteRange( static_cast<ScChangeActionDel*>(pAct)->GetOverAllRange().MakeRange() );
3128 if ( nStart && nStart <= nEnd )
3133 for (
sal_uLong nCut = nStart; nCut <= nEnd; nCut++ )
3135 ScChangeActionMap::iterator itCut =
aPasteCutMap.find( nCut );
3139 OSL_ENSURE(
aMap.find( nCut ) ==
aMap.end(),
"ScChangeTrack::Undo: nCut dup" );
3140 Append( itCut->second, nCut );
3145 OSL_FAIL(
"ScChangeTrack::Undo: nCut not found" );
3198 if ( static_cast<ScChangeActionDel*>(pAct)->IsTopDelete() )
3202 GetOverAllRange().MakeRange() );
3209 pAct = ( pAct == pFirstMerge ?
nullptr : pAct->
GetPrev() );
3224 if ( static_cast<ScChangeActionDel*>(pAct)->IsTopDelete() )
3228 GetOverAllRange().MakeRange() );
3284 bool bGeneratedDelContents =
3289 sal_Int32 nDx, nDy, nDz;
3290 nDx = nDy = nDz = 0;
3330 OSL_FAIL(
"ScChangeTrack::UpdateReference: unknown Type" );
3365 bool bUpdate =
true;
3369 if (
p->IsInsertType() )
3374 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3378 p->IsDeletedInDelType( eInsType ) )
3381 if ( aDelRange.
In(
p->GetBigRange().aStart ) )
3386 while ( pLink && bUpdate )
3389 if ( pDel && pDel->
GetType() == eInsType &&
3399 if ( aDelRange.
In(
p->GetBigRange() ) )
3405 if ( !
p->IsDeletedInDelType( eActType ) )
3407 p->SetDeletedIn( pActDel );
3409 if ( bGeneratedDelContents )
3410 pActDel->
AddContent( static_cast<ScChangeActionContent*>(
p) );
3426 switch (
p->GetType() )
3431 if ( aDelRange.
In(
p->GetBigRange().aStart ) )
3434 static_cast<ScChangeActionIns*>(
p), 1 );
3435 p->GetBigRange().aStart.IncCol();
3437 else if ( aDelRange.
In(
p->GetBigRange().aEnd ) )
3440 static_cast<ScChangeActionIns*>(
p), -1 );
3441 p->GetBigRange().aEnd.IncCol( -1 );
3448 if ( aDelRange.
In(
p->GetBigRange().aStart ) )
3451 static_cast<ScChangeActionIns*>(
p), 1 );
3452 p->GetBigRange().aStart.IncRow();
3454 else if ( aDelRange.
In(
p->GetBigRange().aEnd ) )
3457 static_cast<ScChangeActionIns*>(
p), -1 );
3458 p->GetBigRange().aEnd.IncRow( -1 );
3465 if ( aDelRange.
In(
p->GetBigRange().aStart ) )
3468 static_cast<ScChangeActionIns*>(
p), 1 );
3469 p->GetBigRange().aStart.IncTab();
3471 else if ( aDelRange.
In(
p->GetBigRange().aEnd ) )
3474 static_cast<ScChangeActionIns*>(
p), -1 );
3475 p->GetBigRange().aEnd.IncTab( -1 );
3552 pMove->
AddLink( pActDel, pLink );
3564 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3565 if (
p->GetType() == eActType && !
p->IsRejected() &&
3567 p->GetBigRange().In( aDelRange ) )
3578 bool bUpdate =
true;
3579 if ( aDelRange.
In(
p->GetBigRange() ) )
3587 p->SetDeletedIn( pAct );
3590 if (
p->IsDeletedInDelType( eActType ) )
3592 if (
p->IsDeletedIn( pActDel ) )
3597 p->RemoveDeletedIn( pActDel );
3609 if (
p->GetType() == eActType && pActDel->
IsDeletedIn(
p ) )
3616 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3618 if ( !bGeneratedDelContents )
3628 bool bLastCutMove = ( pActMove ==
pLastCutMove.get() );
3640 if ( rTo.
In(
p->GetBigRange() ) )
3642 if ( !
p->IsDeletedIn( pActMove ) )
3644 p->SetDeletedIn( pActMove );
3646 if ( bGeneratedDelContents )
3647 pActMove->
AddContent( static_cast<ScChangeActionContent*>(
p) );
3650 else if ( bLastCutMove &&
3652 rFrom.
In(
p->GetBigRange() ) )
3676 p->UpdateReference(
this, eMode, rFrom, nDx, nDy, nDz );
3690 if (
p->IsDeletedIn( pActMove ) )
3692 if ( static_cast<ScChangeActionContent*>(
p)->IsTopContent() )
3694 p->RemoveDeletedIn( pActMove );
3701 p->UpdateReference(
this, eMode, rTo, nDx, nDy, nDz );
3702 if ( bActRejected &&
3703 static_cast<ScChangeActionContent*>(
p)->IsTopContent() &&
3704 rFrom.
In(
p->GetBigRange() ) )
3708 p->AddLink( pActMove, pLink );
3725 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3751 p->SetDeletedIn( pAct );
3759 if ( !
p->IsDeletedIn( pAct )
3763 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3774 if ( !
p->IsDeletedIn( pAct )
3778 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3801 p->RemoveDeletedIn( pAct );
3817 p->SetDeletedIn( pAct );
3827 if ( !
p->IsDeletedIn( pAct ) &&
p->GetActionNumber() <= pAct->
GetActionNumber() )
3829 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3844 bool bIsMasterDelete = ( bListMasterDelete && pAct->
IsMasterDelete() );
3847 ::std::stack<ScChangeAction*> cStack;
3850 while ( !cStack.empty() )
3852 pCur = cStack.top();
3866 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
3874 if ( static_cast<ScChangeActionContent*>(p)->IsTopContent() )
3889 if ( !bAllFlat && bIsMasterDelete && pCur == pAct )
3898 if (!p || p->
GetType() != eType ||
3918 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
3927 if ( static_cast<ScChangeActionDel*>(p)->IsTopDelete() )
3946 if ( p != pAct && rMap.insert( ::std::make_pair( p->
GetActionNumber(), p ) ).second )
3966 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
3974 if ( static_cast<ScChangeActionContent*>(p)->IsTopContent() )
3991 rMap.insert( ::std::make_pair( pContent->
GetActionNumber(), pContent ) );
3998 rMap.insert( ::std::make_pair( pContent->
GetActionNumber(), pContent ) );
4010 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
4025 static_cast<const ScChangeActionReject*>(pCur)->GetRejectAction() );
4045 if ( !pPrevContent || !pPrevContent->
IsVirgin() )
4047 pContent = pPrevContent;
4061 aBigRange.aEnd.IncCol( nC-1 );
4062 aBigRange.aEnd.IncRow( nR-1 );
4065 if ( !aBigRange.IsValid(
rDoc ) )
4068 ScRange aRange( aBigRange.MakeRange() );
4070 aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ) )
4076 ::std::stack<ScChangeActionContent*> aRejectActions;
4081 if ( p != pContent )
4087 bOldest, &aRejectActions );
4091 OSL_FAIL(
"ScChangeTrack::SelectContent: content dependent no content" );
4097 bOk &= pContent->
Select(
rDoc,
this, bOldest,
nullptr );
4100 while ( !aRejectActions.empty() )
4103 aRejectActions.pop();
4113 return pContent->
Select(
rDoc,
this, bOldest,
nullptr );
4135 for(
auto& rEntry : aActionMap )
4137 rEntry.second->Accept();
4149 if (
p->IsInternalRejectable() )
4165 std::unique_ptr<ScChangeActionMap> pMap;
4171 bool bRejected =
Reject( pAct, pMap.get(), false );
4182 bool bRejected =
false;
4187 OSL_ENSURE( pMap,
"ScChangeTrack::Reject: Insert without map" );
4188 ScChangeActionMap::reverse_iterator itChangeAction;
4189 for (itChangeAction = pMap->rbegin();
4190 itChangeAction != pMap->rend() && bOk; ++itChangeAction)
4194 itChangeAction->second->SetRejected();
4195 else if ( itChangeAction->second->IsDeleteType() )
4196 itChangeAction->second->Accept();
4198 bOk =
Reject( itChangeAction->second,
nullptr,
true );
4214 OSL_ENSURE( !pMap,
"ScChangeTrack::Reject: Delete with map" );
4217 bool bTabDel, bTabDelOk;
4231 bTabDel = bTabDelOk =
false;
4238 bool bOneOk =
false;
4292 }
while ( bOk && bLoop && p && p->
GetType() == eActType &&
4296 if ( bOneOk || (bTabDel && bTabDelOk) )
4310 OSL_ENSURE( pMap,
"ScChangeTrack::Reject: Move without Map" );
4311 ScChangeActionMap::reverse_iterator itChangeAction;
4313 for( itChangeAction = pMap->rbegin(); itChangeAction != pMap->rend() && bOk; ++itChangeAction )
4315 bOk =
Reject( itChangeAction->second,
nullptr,
true );
4347 if ( bRejected && !bRecursion )
4361 OSL_FAIL(
"ScChangeTrack::Reject: say what?" );
4404 std::unique_ptr<ScChangeTrack> pClonedTrack(
new ScChangeTrack( *pDocument ));
4408 ::std::stack< const ScChangeAction* > aGeneratedStack;
4410 while ( pGenerated )
4412 aGeneratedStack.push( pGenerated );
4413 pGenerated = pGenerated->
GetNext();
4415 while ( !aGeneratedStack.empty() )
4417 pGenerated = aGeneratedStack.top();
4418 aGeneratedStack.pop();
4424 aClonedNewCell.
assign(rNewCell, *pDocument);
4428 pClonedTrack->AddLoadedGenerated(aClonedNewCell, pGenerated->
GetBigRange(), aNewValue);
4444 bool bEndOfList =
static_cast<const ScChangeActionIns*
>(pAction)->IsEndOfList();
4484 pClonedTrack.get() );
4490 assert(pMove &&
"ScChangeTrack::Clone: pMove is null!");
4500 pMove->GetFromRange(),
4501 pClonedTrack.get() );
4509 aClonedOldCell.
assign(rOldCell, *pDocument);
4526 if (!rNewCell.isEmpty())
4529 aClonedNewCell.
assign(rNewCell, *pDocument);
4530 pClonedContent->
SetNewValue(aClonedNewCell, pDocument);
4533 pClonedAction = pClonedContent;
4554 if ( pClonedAction )
4556 pClonedTrack->AppendCloned( pClonedAction );
4562 if ( pClonedTrack->GetLast() )
4564 pClonedTrack->SetActionMax( pClonedTrack->GetLast()->GetActionNumber() );
4573 ::std::stack< sal_uLong > aStack;
4585 if ( pClonedAction )
4587 while ( !aStack.empty() )
4589 ScChangeAction* pClonedDeleted = pClonedTrack->GetActionOrGenerated( aStack.top() );
4591 if ( pClonedDeleted )
4607 ::std::stack< sal_uLong > aStack;
4619 if ( pClonedAction )
4621 while ( !aStack.empty() )
4623 ScChangeAction* pClonedDependent = pClonedTrack->GetActionOrGenerated( aStack.top() );
4625 if ( pClonedDependent )
4628 pClonedDependent->
AddLink( pClonedAction, pLink );
4638 while ( pClonedAction )
4640 pClonedTrack->MasterLinks( pClonedAction );
4641 pClonedAction = pClonedAction->
GetNext();
4649 if ( pClonedTrack->GetLast() )
4651 pClonedTrack->SetLastSavedActionNumber( pClonedTrack->GetLast()->GetActionNumber() );
4654 auto tmp = pClonedTrack.get();
4685 auto redlinesNode = rRedlines.
startNode(
"");
4686 rRedlines.
put(
"index", static_cast<sal_Int64>(nIndex));
4690 rRedlines.
put(
"type",
"Modify");
4694 OUString aDescription;
4696 rRedlines.
put(
"description", aDescription);
4699 rRedlines.
put(
"dateTime", sDateTime);
4704 auto redlinesNode = aRedlines.
startNode(
"redlines");
4712 while (pAction != pLastAction)
ScChangeTrackMsgQueue aMsgQueue
ScDocument & GetDocument() const
bool IsBlockEditable(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool *pOnlyNotBecauseOfMatrix=nullptr, bool bNoMatrixAtAll=false) const
OUString GetRefString(const ScBigRange &rRange, const ScDocument &rDoc, bool bFlag3D=false) const
void DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
SCROW mnRowDelta
Amount and direction of movement in the row direction.
bool IsGenerated(sal_uLong nAction) const
void DeleteRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
const ScCellValue & GetOldCell() const
static ScRefUpdateRes Update(const ScDocument *pDoc, UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz, SCCOL &theCol1, SCROW &theRow1, SCTAB &theTab1, SCCOL &theCol2, SCROW &theRow2, SCTAB &theTab2)
virtual void GetRefString(OUString &rStr, ScDocument &rDoc, bool bFlag3D=false) const override
OUString getString() const
void SetLastMerge(sal_uLong nVal)
void GetValueString(OUString &rStr, const OUString &rValue, const ScCellValue &rCell, const ScDocument *pDoc) const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
ScChangeActionType GetType() const
bool IsDialogRoot() const
void SetRejectAction(sal_uLong n)
ScChangeActionContent * GetNextContent() const
bool IsValid(const ScDocument &rDoc) const
std::vector< ScChangeTrackMsgInfo > ScChangeTrackMsgQueue
void RemoveAllDeletedIn()
const ScChangeActionLinkEntry * GetFirstDependentEntry() const
void IncTab(SCTAB nDelta=1)
ScChangeAction * GetNext() const
void SetDateTimeUTC(const DateTime &rDT)
OUString toISO8601(const css::util::DateTime &rDateTime)
Single reference (one address) into the sheet.
void MasterLinks(ScChangeAction *)
virtual void DeleteCellEntries() override
bool IsMasterDelete() const
ScChangeAction * GetLast() const
ScChangeActionContent * GenerateDelContent(const ScAddress &rPos, const ScCellValue &rCell, const ScDocument *pFromDoc)
sal_uLong GetLastMerge() const
void SetMergeState(ScChangeTrackMergeState eState)
virtual void AddContent(ScChangeActionContent *) override
ScChangeAction * GetActionOrGenerated(sal_uLong nAction) const
virtual ~ScChangeActionDel() override
virtual void UpdateReference(const ScChangeTrack *, UpdateRefMode, const ScBigRange &, sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz)
void SetInDeleteRange(const ScRange &rRange)
SC_DLLPUBLIC ScChangeAction * GetAction(sal_uLong nAction) const
bool IsExpandRefs() const
virtual ~ScChangeActionIns() override
ScChangeActionState GetState() const
Context for reference update during shifting, moving or copying of cell ranges.
ScChangeActionDelMoveEntry * AddCutOffMove(ScChangeActionMove *pMove, short nFrom, short nTo)
SC_DLLPUBLIC bool ValidNewTabName(const OUString &rName) const
virtual bool Reject(ScDocument &rDoc) override
std::unique_ptr< ScChangeActionMove > pLastCutMove
ScChangeActionLinkEntry * pLinkInsertRow
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
void SetComment(const OUString &rStr)
ScChangeActionReject(const sal_uLong nActionNumber, const ScChangeActionState eState, const sal_uLong nRejectingNumber, const ScBigRange &aBigRange, const OUString &aUser, const DateTime &aDateTime, const OUString &sComment)
SC_DLLPUBLIC void GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 &rFormat) const
ScChangeActionMove(const ScRange &rFromRange, const ScRange &rToRange, ScChangeTrack *pTrackP)