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 )
431 return ScResId(STR_CHANGED_MOVE_REJECTION_WARNING) +
" ";
436 return ScResId(STR_CHANGED_DELETE_REJECTION_WARNING) +
" ";
450 return ScResId(STR_CHANGED_MOVE_REJECTION_WARNING) +
" ";
455 return ScResId(STR_CHANGED_DELETE_REJECTION_WARNING) +
" ";
463 ScChangeActionMap::iterator itChangeAction = std::find_if(aMap.begin(), aMap.end(),
464 [&pReject](
const ScChangeActionMap::value_type& rEntry) {
466 if (itChangeAction == aMap.end())
469 if( itChangeAction->second->GetType() ==
SC_CAT_MOVE)
470 return ScResId(STR_CHANGED_MOVE_REJECTION_WARNING) +
" ";
472 return ScResId(STR_CHANGED_DELETE_REJECTION_WARNING) +
" ";
492 rDoc.
GetName( aTmpRange.aStart.Tab(), aTmp );
505 rDoc.
GetName( aTmpRange.aStart.Tab(), aTmp );
509 aBuf.append(static_cast<sal_Int64>(aTmpRange.aStart.Row()+1));
511 aBuf.append(static_cast<sal_Int64>(aTmpRange.aEnd.Row()+1));
527 return aBuf.makeStringAndClear();
568 std::vector<ScChangeActionContent*> aContentsList;
574 aContentsList.push_back(static_cast<ScChangeActionContent*>(p) );
579 OSL_ENSURE( !
pLinkDeleted,
"ScChangeAction::RejectRestoreContents: pLinkDeleted != NULL" );
585 if ( !pContent->IsDeletedIn() &&
586 pContent->GetBigRange().aStart.IsValid( rDoc ) )
587 pContent->PutNewValueToDoc( &rDoc, nDx, nDy );
598 OSL_ENSURE( pAct,
"ScChangeAction::SetDeletedInThis: missing Action" );
610 OSL_ENSURE( pAct,
"ScChangeAction::AddDependent: missing Action" );
622 mbEndOfList(bEndOfList)
645 OSL_FAIL(
"ScChangeActionIns: Block not supported!" );
652 const OUString& aUserP,
const DateTime& aDateTimeP,
655 ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
656 mbEndOfList(bEndOfList)
672 pWhatId = STR_COLUMN;
681 OUString aRsc =
ScResId(STR_CHANGED_INSERT);
682 sal_Int32
nPos = aRsc.indexOf(
"#1");
687 OUString aRangeStr =
ScResId(pWhatId) +
691 aRsc = aRsc.replaceAt(nPos, 2, aRangeStr);
708 aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ) )
740 pLinkMove( nullptr ),
765 OSL_FAIL(
"ScChangeActionDel: Block not supported!" );
772 const OUString& aUserP,
const DateTime& aDateTimeP,
const OUString &sComment,
774 ScChangeAction(eTypeP, aBigRangeP, nActionNumber, nRejectingNumber, eStateP, aDateTimeP, aUserP, sComment),
778 pLinkMove( nullptr ),
852 sal_Int32 nDxP, sal_Int32 nDyP, sal_Int32 nDz )
905 pWhatId = STR_COLUMN;
926 OUString aRsc =
ScResId(STR_CHANGED_DELETE);
927 sal_Int32
nPos = aRsc.indexOf(
"#1");
932 OUString aRangeStr =
ScResId(pWhatId) +
" " +
934 aRsc = aRsc.replaceAt(nPos, 2, aRangeStr);
948 if ( !aTmpRange.
IsValid( rDoc ) )
969 if ( aRange.aStart.Col() != 0 || aRange.aEnd.Col() != rDoc.
MaxCol() )
1022 else if ( nFrom < 0 )
1032 else if ( nFrom < 0 )
1042 else if ( nFrom < 0 )
1095 const OUString& aUserP,
const DateTime& aDateTimeP,
1096 const OUString &sComment,
const ScBigRange& aFromBigRange,
1099 aFromRange(aFromBigRange),
1123 sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz )
1133 nDx = rToPos.
Col() - rFromPos.
Col();
1134 nDy = rToPos.
Row() - rFromPos.
Row();
1135 nDz = rToPos.
Tab() - rFromPos.
Tab();
1139 ScDocument& rDoc,
bool bSplitRange,
bool bWarning )
const
1145 OUString aRsc =
ScResId(STR_CHANGED_MOVE);
1148 sal_Int32
nPos = aRsc.indexOf(
"#1");
1151 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1152 nPos += aTmpStr.getLength();
1156 nPos = nPos >= 0 ? aRsc.indexOf(
"#2", nPos) : -1;
1159 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1184 aToRange.aStart.Col(), aToRange.aStart.Row(),
1185 aToRange.aEnd.Col(), aToRange.aEnd.Row() );
1188 aFrmRange.aStart.Col(), aFrmRange.aStart.Row(),
1189 aFrmRange.aEnd.Col(), aFrmRange.aEnd.Row() );
1201 aCxt.
mnColDelta = aFrmRange.aStart.Col() - aToRange.aStart.Col();
1202 aCxt.
mnRowDelta = aFrmRange.aStart.Row() - aToRange.aStart.Row();
1203 aCxt.
mnTabDelta = aFrmRange.aStart.Tab() - aToRange.aStart.Tab();
1239 pNextContent(nullptr),
1240 pPrevContent(nullptr),
1241 pNextInSlot(nullptr),
1242 ppPrevInSlot(nullptr)
1247 const ScBigRange& aBigRangeP,
const OUString& aUserP,
1248 const DateTime& aDateTimeP,
const OUString& sComment,
1251 maOldCell(rOldCell),
1252 maOldValue(sOldValue),
1253 pNextContent(nullptr),
1254 pPrevContent(nullptr),
1255 pNextInSlot(nullptr),
1256 ppPrevInSlot(nullptr)
1261 if (!sOldValue.isEmpty())
1267 const ScDocument* pDoc,
const OUString& sNewValue ) :
1269 maNewCell(rNewCell),
1270 maNewValue(sNewValue),
1271 pNextContent(nullptr),
1272 pPrevContent(nullptr),
1273 pNextInSlot(nullptr),
1274 ppPrevInSlot(nullptr)
1279 if (!sNewValue.isEmpty())
1357 if (!rFormatted.isEmpty())
1365 if ( rStr.getLength() > 1 && rStr[0] ==
'=' )
1394 ScDocument& rDoc,
bool bSplitRange,
bool bWarning )
const
1398 OUString aRsc =
ScResId(STR_CHANGED_CELL);
1402 sal_Int32
nPos = aRsc.indexOf(
"#1", 0);
1405 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1406 nPos += aTmpStr.getLength();
1410 if (aTmpStr.isEmpty())
1411 aTmpStr =
ScResId( STR_CHANGED_BLANK );
1413 nPos = nPos >= 0 ? aRsc.indexOf(
"#2", nPos) : -1;
1416 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1417 nPos += aTmpStr.getLength();
1421 if (aTmpStr.isEmpty())
1422 aTmpStr =
ScResId( STR_CHANGED_BLANK );
1424 nPos = nPos >= 0 ? aRsc.indexOf(
"#3", nPos) : -1;
1427 aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
1458 str =
"(" + str +
")";
1480 bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions )
1487 while ( ( pContent = pContent->
pPrevContent ) != nullptr )
1494 while ( ( pContent = pContent->
pNextContent ) !=
nullptr )
1510 if ( bOldest || pEnd !=
this )
1516 aCell.
assign(rDoc, rPos);
1526 if ( pRejectActions )
1527 pRejectActions->push( pNew );
1530 aCell.
assign(rDoc, rPos);
1643 SetValue(rStr, rCell, nFormat, rOrgCell, pFromDoc, pToDoc);
1654 rCell.
assign(rOrgCell, *pToDoc);
1660 rOrgCell.
mfValue, nFormat, rStr);
1701 if (!rValue.isEmpty())
1732 OSL_FAIL(
"ScChangeActionContent::GetFormulaString: aPos != pCell->aPos" );
1760 if (!rValue.isEmpty())
1774 pDoc->
SetString( aPos.Col(), aPos.Row(), aPos.Tab(), rValue );
1785 OSL_ENSURE( nC>0 && nR>0,
"ScChangeActionContent::PutValueToDoc: MatColsRows?" );
1793 aDestMark.SetMarkArea( aRange );
1803 rCell.
commit(*pDoc, aPos);
1842 sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz )
1847 if ( nNewSlot != nOldSlot )
1858 if ( !(bOldFormula || bNewFormula) )
1882 if ( nDx < 0 || nDy < 0 || nDz < 0 )
1925 aRefCxt.maRange = aRange;
1926 aRefCxt.mnColDelta = nDx;
1927 aRefCxt.mnRowDelta = nDy;
1928 aRefCxt.mnTabDelta = nDz;
1981 const ScBigRange& aBigRangeP,
const OUString& aUserP,
1982 const DateTime& aDateTimeP,
const OUString& sComment) :
2003 if ( nRowsPerSlot * nMaxSlots < sal::static_int_cast<SCSIZE>(
rDoc.
GetMaxRowCount()) )
2005 return nRowsPerSlot;
2013 SC_MOD()->GetUserOptions().AddListener(
this);
2020 maUserCollection(
std::move(aTempUserCollection)),
2025 SC_MOD()->GetUserOptions().AddListener(
this);
2032 SC_MOD()->GetUserOptions().RemoveListener(
this);
2073 for ( p =
GetFirst(); p; p = pNext )
2085 delete rEntry.second;
2117 ScChangeActionMap::const_iterator it =
aMap.find( nAction );
2118 if( it !=
aMap.end() )
2126 ScChangeActionMap::const_iterator it =
aGeneratedMap.find( nGenerated );
2152 if( it !=
aMap.end() )
2280 pAppend->
AddLink(
nullptr, pLink );
2287 pAppend->
AddLink(
nullptr, pLink );
2294 pAppend->
AddLink(
nullptr, pLink );
2301 pAppend->
AddLink(
nullptr, pLink );
2334 aMap.insert( ::std::make_pair( nAction, pAppend ) );
2400 rRange.
GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
2401 for (
SCTAB nTab = nTab1; nTab <= nTab2; nTab++ )
2403 if ( !pRefDoc || nTab < pRefDoc->GetTableCount() )
2411 for (
SCCOL nCol = nCol1; nCol <= nCol2; nCol++ )
2414 aRange.aEnd.SetCol( nCol );
2415 if ( nCol == nCol2 )
2418 nTab-nTab1 + nDz, nRejectingInsert );
2422 nTab-nTab1 + nDz, nRejectingInsert );
2427 for (
SCROW nRow = nRow1; nRow <= nRow2; nRow++ )
2430 aRange.aEnd.SetRow( nRow );
2431 if ( nRow == nRow2 )
2434 0, nRejectingInsert );
2438 else if ( nRow1 == 0 && nRow2 ==
rDoc.
MaxRow() )
2441 for (
SCCOL nCol = nCol1; nCol <= nCol2; nCol++ )
2444 aRange.aEnd.SetCol( nCol );
2445 if ( nCol == nCol2 )
2448 0, nRejectingInsert );
2453 OSL_FAIL(
"ScChangeTrack::AppendDeleteRange: Block not supported!" );
2465 ScRange aTrackRange( rOrgRange );
2487 if ( nRejectingInsert )
2504 for (
bool bHas = aIter.
first(); bHas; bHas = aIter.
next())
2547 return nC1 != nC2 || nR1 != nR2;
2576 aOldCell.
assign(*pRefDoc, rPos);
2637 rRange.
GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
2641 bDoContents =
false;
2647 if ( (nTmpCol = static_cast<SCCOL>(r.
aEnd.
Col() - r.
aStart.
Col())) != (nCol2 - nCol1) )
2650 nCol1 += nTmpCol + 1;
2654 if ( (nTmpRow = static_cast<SCROW>(r.
aEnd.
Row() - r.
aStart.
Row())) != (nRow2 - nRow1) )
2657 nRow1 += nTmpRow + 1;
2661 if ( (nTmpTab = static_cast<SCTAB>(r.
aEnd.
Tab() - r.
aStart.
Tab())) != (nTab2 - nTab1) )
2664 nTab1 += nTmpTab + 1;
2689 for (
SCTAB nTab = nTab1; nTab <= nTab2; nTab++ )
2695 for (
SCCOL nCol = nCol1; nCol <= lastCol; nCol++ )
2700 for (
SCROW nRow = nRow1; nRow <= lastRow; nRow++ )
2733 while (aIter.
next());
2739 nStartAction = nEndAction = 0;
2764 pContent->RemoveDeletedIn( pDeletor );
2765 if (
IsGenerated( pContent->GetActionNumber() ) &&
2766 !pContent->IsDeletedIn() )
2780 rPos, rCell, pFromDoc, &
rDoc );
2799 if ( pContent->
pNext )
2801 if ( pContent->
pPrev )
2814 p =
p->GetNextInSlot() )
2816 if (
p != pButNotThis && !
p->IsDeletedIn() &&
2817 p->GetBigRange().aStart == rPos )
2831 pDependent->
AddLink( pParent, pLink );
2851 if ( !(static_cast<ScChangeActionContent*>(pAct)->GetNextContent() ||
2858 pContent->
SetNextContent( static_cast<ScChangeActionContent*>(pAct) );
2874 OSL_FAIL(
"ScChangeTrack::Dependencies: MatOrg not found" );
2897 (bActNoInsert && !bActRowDel && !bActTabDel)) )
2911 (bActNoInsert && !bActColDel && !bActTabDel)) )
2925 (bActNoInsert && !bActColDel && !bActRowDel)) )
2991 if ( pRemove ==
pLast )
3000 if ( pRemove->
pNext )
3002 if ( pRemove->
pPrev )
3042 if ( nStartAction == 0 )
3046 if ( nEndAction && nStartAction <= nEndAction )
3052 for (
sal_uLong j = nEndAction; j >= nStartAction; --j )
3062 if (j == nEndAction || (pAct !=
pLast && static_cast<ScChangeActionDel*>(pAct)->IsTopDelete()))
3065 SetInDeleteRange( static_cast<ScChangeActionDel*>(pAct)->GetOverAllRange().MakeRange(
rDoc ) );
3082 if ( nStart && nStart <= nEnd )
3087 for (
sal_uLong nCut = nStart; nCut <= nEnd; nCut++ )
3089 ScChangeActionMap::iterator itCut =
aPasteCutMap.find( nCut );
3093 OSL_ENSURE(
aMap.find( nCut ) ==
aMap.end(),
"ScChangeTrack::Undo: nCut dup" );
3094 Append( itCut->second, nCut );
3099 OSL_FAIL(
"ScChangeTrack::Undo: nCut not found" );
3152 if ( static_cast<ScChangeActionDel*>(pAct)->IsTopDelete() )
3156 GetOverAllRange().MakeRange(
rDoc ) );
3163 pAct = ( pAct == pFirstMerge ?
nullptr : pAct->
GetPrev() );
3178 if ( static_cast<ScChangeActionDel*>(pAct)->IsTopDelete() )
3182 GetOverAllRange().MakeRange(
rDoc ) );
3238 bool bGeneratedDelContents =
3243 sal_Int32 nDx, nDy, nDz;
3244 nDx = nDy = nDz = 0;
3284 OSL_FAIL(
"ScChangeTrack::UpdateReference: unknown Type" );
3319 bool bUpdate =
true;
3323 if (
p->IsInsertType() )
3328 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3332 p->IsDeletedInDelType( eInsType ) )
3335 if ( aDelRange.
Contains(
p->GetBigRange().aStart ) )
3340 while ( pLink && bUpdate )
3343 if ( pDel && pDel->
GetType() == eInsType &&
3353 if ( aDelRange.
Contains(
p->GetBigRange() ) )
3359 if ( !
p->IsDeletedInDelType( eActType ) )
3361 p->SetDeletedIn( pActDel );
3363 if ( bGeneratedDelContents )
3364 pActDel->
AddContent( static_cast<ScChangeActionContent*>(
p) );
3380 switch (
p->GetType() )
3385 if ( aDelRange.
Contains(
p->GetBigRange().aStart ) )
3388 static_cast<ScChangeActionIns*>(
p), 1 );
3389 p->GetBigRange().aStart.IncCol();
3391 else if ( aDelRange.
Contains(
p->GetBigRange().aEnd ) )
3394 static_cast<ScChangeActionIns*>(
p), -1 );
3395 p->GetBigRange().aEnd.IncCol( -1 );
3402 if ( aDelRange.
Contains(
p->GetBigRange().aStart ) )
3405 static_cast<ScChangeActionIns*>(
p), 1 );
3406 p->GetBigRange().aStart.IncRow();
3408 else if ( aDelRange.
Contains(
p->GetBigRange().aEnd ) )
3411 static_cast<ScChangeActionIns*>(
p), -1 );
3412 p->GetBigRange().aEnd.IncRow( -1 );
3419 if ( aDelRange.
Contains(
p->GetBigRange().aStart ) )
3422 static_cast<ScChangeActionIns*>(
p), 1 );
3423 p->GetBigRange().aStart.IncTab();
3425 else if ( aDelRange.
Contains(
p->GetBigRange().aEnd ) )
3428 static_cast<ScChangeActionIns*>(
p), -1 );
3429 p->GetBigRange().aEnd.IncTab( -1 );
3506 pMove->
AddLink( pActDel, pLink );
3518 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3519 if (
p->GetType() == eActType && !
p->IsRejected() &&
3521 p->GetBigRange().Contains( aDelRange ) )
3532 bool bUpdate =
true;
3533 if ( aDelRange.
Contains(
p->GetBigRange() ) )
3541 p->SetDeletedIn( pAct );
3544 if (
p->IsDeletedInDelType( eActType ) )
3546 if (
p->IsDeletedIn( pActDel ) )
3551 p->RemoveDeletedIn( pActDel );
3563 if (
p->GetType() == eActType && pActDel->
IsDeletedIn(
p ) )
3570 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3572 if ( !bGeneratedDelContents )
3582 bool bLastCutMove = ( pActMove ==
pLastCutMove.get() );
3596 if ( !
p->IsDeletedIn( pActMove ) )
3598 p->SetDeletedIn( pActMove );
3600 if ( bGeneratedDelContents )
3601 pActMove->
AddContent( static_cast<ScChangeActionContent*>(
p) );
3604 else if ( bLastCutMove &&
3630 p->UpdateReference(
this, eMode, rFrom, nDx, nDy, nDz );
3644 if (
p->IsDeletedIn( pActMove ) )
3646 if ( static_cast<ScChangeActionContent*>(
p)->IsTopContent() )
3648 p->RemoveDeletedIn( pActMove );
3655 p->UpdateReference(
this, eMode, rTo, nDx, nDy, nDz );
3656 if ( bActRejected &&
3657 static_cast<ScChangeActionContent*>(
p)->IsTopContent() &&
3662 p->AddLink( pActMove, pLink );
3679 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3705 p->SetDeletedIn( pAct );
3713 if ( !
p->IsDeletedIn( pAct )
3717 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3728 if ( !
p->IsDeletedIn( pAct )
3732 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3755 p->RemoveDeletedIn( pAct );
3771 p->SetDeletedIn( pAct );
3781 if ( !
p->IsDeletedIn( pAct ) &&
p->GetActionNumber() <= pAct->
GetActionNumber() )
3783 p->UpdateReference(
this, eMode, aRange, nDx, nDy, nDz );
3798 bool bIsMasterDelete = ( bListMasterDelete && pAct->
IsMasterDelete() );
3801 ::std::stack<ScChangeAction*> cStack;
3804 while ( !cStack.empty() )
3806 pCur = cStack.top();
3820 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
3828 if ( static_cast<ScChangeActionContent*>(p)->IsTopContent() )
3843 if ( !bAllFlat && bIsMasterDelete && pCur == pAct )
3852 if (!p || p->
GetType() != eType ||
3872 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
3881 if ( static_cast<ScChangeActionDel*>(p)->IsTopDelete() )
3900 if ( p != pAct && rMap.insert( ::std::make_pair( p->
GetActionNumber(), p ) ).second )
3920 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
3928 if ( static_cast<ScChangeActionContent*>(p)->IsTopContent() )
3945 rMap.insert( ::std::make_pair( pContent->
GetActionNumber(), pContent ) );
3952 rMap.insert( ::std::make_pair( pContent->
GetActionNumber(), pContent ) );
3964 if ( !
IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
3979 static_cast<const ScChangeActionReject*>(pCur)->GetRejectAction() );
3999 if ( !pPrevContent || !pPrevContent->
IsVirgin() )
4001 pContent = pPrevContent;
4015 aBigRange.aEnd.IncCol( nC-1 );
4016 aBigRange.aEnd.IncRow( nR-1 );
4019 if ( !aBigRange.IsValid(
rDoc ) )
4024 aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ) )
4030 ::std::stack<ScChangeActionContent*> aRejectActions;
4035 if ( p != pContent )
4041 bOldest, &aRejectActions );
4045 OSL_FAIL(
"ScChangeTrack::SelectContent: content dependent no content" );
4051 bOk &= pContent->
Select(
rDoc,
this, bOldest,
nullptr );
4054 while ( !aRejectActions.empty() )
4057 aRejectActions.pop();
4067 return pContent->
Select(
rDoc,
this, bOldest,
nullptr );
4089 for(
auto& rEntry : aActionMap )
4091 rEntry.second->Accept();
4103 if (
p->IsInternalRejectable() )
4119 std::unique_ptr<ScChangeActionMap> pMap;
4125 bool bRejected =
Reject( pAct, pMap.get(),
false );
4136 bool bRejected =
false;
4141 OSL_ENSURE( pMap,
"ScChangeTrack::Reject: Insert without map" );
4142 ScChangeActionMap::reverse_iterator itChangeAction;
4143 for (itChangeAction = pMap->rbegin();
4144 itChangeAction != pMap->rend() && bOk; ++itChangeAction)
4148 itChangeAction->second->SetRejected();
4149 else if ( itChangeAction->second->IsDeleteType() )
4150 itChangeAction->second->Accept();
4152 bOk =
Reject( itChangeAction->second,
nullptr,
true );
4168 OSL_ENSURE( !pMap,
"ScChangeTrack::Reject: Delete with map" );
4171 bool bTabDel, bTabDelOk;
4185 bTabDel = bTabDelOk =
false;
4192 bool bOneOk =
false;
4246 }
while ( bOk && bLoop && p && p->
GetType() == eActType &&
4250 if ( bOneOk || (bTabDel && bTabDelOk) )
4264 OSL_ENSURE( pMap,
"ScChangeTrack::Reject: Move without Map" );
4265 ScChangeActionMap::reverse_iterator itChangeAction;
4267 for( itChangeAction = pMap->rbegin(); itChangeAction != pMap->rend() && bOk; ++itChangeAction )
4269 bOk =
Reject( itChangeAction->second,
nullptr,
true );
4301 if ( bRejected && !bRecursion )
4315 OSL_FAIL(
"ScChangeTrack::Reject: say what?" );
4358 std::unique_ptr<ScChangeTrack> pClonedTrack(
new ScChangeTrack( *pDocument ));
4362 ::std::stack< const ScChangeAction* > aGeneratedStack;
4364 while ( pGenerated )
4366 aGeneratedStack.push( pGenerated );
4367 pGenerated = pGenerated->
GetNext();
4369 while ( !aGeneratedStack.empty() )
4371 pGenerated = aGeneratedStack.top();
4372 aGeneratedStack.pop();
4378 aClonedNewCell.
assign(rNewCell, *pDocument);
4379 OUString aNewValue = rContent.
GetNewString( pDocument );
4381 pClonedTrack->AddLoadedGenerated(aClonedNewCell, pGenerated->
GetBigRange(), aNewValue);
4397 bool bEndOfList =
static_cast<const ScChangeActionIns*
>(pAction)->IsEndOfList();
4437 pClonedTrack.get() );
4443 assert(pMove &&
"ScChangeTrack::Clone: pMove is null!");
4453 pMove->GetFromRange(),
4454 pClonedTrack.get() );
4462 aClonedOldCell.
assign(rOldCell, *pDocument);
4463 OUString aOldValue = rContent.
GetOldString( pDocument );
4478 if (!rNewCell.isEmpty())
4481 aClonedNewCell.
assign(rNewCell, *pDocument);
4482 pClonedContent->
SetNewValue(aClonedNewCell, pDocument);
4485 pClonedAction = pClonedContent;
4506 if ( pClonedAction )
4508 pClonedTrack->AppendCloned( pClonedAction );
4514 if ( pClonedTrack->GetLast() )
4516 pClonedTrack->SetActionMax( pClonedTrack->GetLast()->GetActionNumber() );
4525 ::std::stack< sal_uLong > aStack;
4537 if ( pClonedAction )
4539 while ( !aStack.empty() )
4541 ScChangeAction* pClonedDeleted = pClonedTrack->GetActionOrGenerated( aStack.top() );
4543 if ( pClonedDeleted )
4559 ::std::stack< sal_uLong > aStack;
4571 if ( pClonedAction )
4573 while ( !aStack.empty() )
4575 ScChangeAction* pClonedDependent = pClonedTrack->GetActionOrGenerated( aStack.top() );
4577 if ( pClonedDependent )
4580 pClonedDependent->
AddLink( pClonedAction, pLink );
4590 while ( pClonedAction )
4592 pClonedTrack->MasterLinks( pClonedAction );
4593 pClonedAction = pClonedAction->
GetNext();
4601 if ( pClonedTrack->GetLast() )
4603 pClonedTrack->SetLastSavedActionNumber( pClonedTrack->GetLast()->GetActionNumber() );
4606 auto tmp = pClonedTrack.get();
4638 rRedlines.
put(
"index", static_cast<sal_Int64>(nIndex));
4642 rRedlines.
put(
"type",
"Modify");
4647 rRedlines.
put(
"description", aDescription);
4650 rRedlines.
put(
"dateTime", sDateTime);
4655 auto redlinesNode = aRedlines.
startArray(
"redlines");
4663 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
void IncTab(sal_Int64 n=1)
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)
OUString getString() const
void SetLastMerge(sal_uLong nVal)
virtual OUString GetRefString(ScDocument &rDoc, bool bFlag3D=false) const override
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)
OUString ScResId(TranslateId aId)
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)
SC_DLLPUBLIC SCROW GetMaxRowCount() const
OUString toISO8601(const css::util::DateTime &rDateTime)
Single reference (one address) into the sheet.
void MasterLinks(ScChangeAction *)
void IncRow(sal_Int64 n=1)
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)
static constexpr sal_Int64 nRangeMax
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)
ScChangeActionMove(const ScRange &rFromRange, const ScRange &rToRange, ScChangeTrack *pTrackP)
ScChangeActionContent * pFirstGeneratedDelContent
OUString GetFormulaString(const ScFormulaCell *pCell) const
bool IsInDeleteTop() const
bool InsertCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
bool IsDialogParent() const
bool IsMultiDelete() const
#define SC_CHGTRACK_GENERATED_START
ScChangeActionIns * pCutOff
This is very similar to ScCellValue, except that it references the original value instead of copying ...
ScChangeActionContent * pNextContent
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const