22 #include <document.hxx>
24 #include <tools/datetime.hxx>
25 #include <osl/diagnose.h>
29 #define SC_CHANGE_ID_PREFIX "ct"
32 const ScCellValue& rCell,
const OUString& rFormulaAddress,
const OUString& rFormula,
34 const double& rValue,
const sal_uInt16 nTempType,
const ScMatrixMode nTempMatrixFlag,
const sal_Int32 nTempMatrixCols,
35 const sal_Int32 nTempMatrixRows ) :
37 sFormulaAddress(rFormulaAddress),
39 sInputString(rInputString),
41 nMatrixCols(nTempMatrixCols),
42 nMatrixRows(nTempMatrixRows),
43 eGrammar( eTempGrammar),
45 nMatrixFlag(nTempMatrixFlag)
68 sal_uInt32 nFormat(0);
71 else if (
nType == css::util::NumberFormat::TIME)
85 nActionType(nTempActionType),
147 nMultiSpannedSlaveCount(0)
198 sal_uInt32 nResult(0);
205 OSL_ENSURE(nValue > 0,
"wrong change action ID");
210 OSL_FAIL(
"wrong change action ID");
236 OSL_ENSURE(nCount > 0,
"wrong count");
243 nPosition + nCount - 1,
nInt32Max, nTable);
250 nInt32Max, nPosition + nCount - 1, nTable);
274 pCurrentAction->aDeletedList.emplace_back( nID, std::move(pCellInfo) );
279 if (nTempMultiSpanned)
297 OSL_FAIL(
"wrong action type");
310 OSL_FAIL(
"wrong action type");
322 OSL_FAIL(
"wrong action type");
344 OSL_FAIL(
"wrong action type");
350 ScMyGenerated aGenerated { aBigRange, 0, std::move(pCellInfo) };
362 OSL_FAIL(
"try to insert a generated action to a wrong action");
370 OSL_FAIL(
"no current action");
382 OSL_FAIL(
"no current action");
397 std::set<OUString>::const_iterator it = rUsers.find(aInfo.
sUser);
398 if (it != rUsers.end())
433 OSL_ENSURE(pAction->
pMoveRanges,
"no move ranges");
457 pAction->
aBigRange, aUser, aDateTime, sComment);
463 OUString sInputString;
466 aCell = pAction->
pCellInfo->CreateCell(rDoc);
467 sInputString = pAction->
pCellInfo->sInputString;
477 pAction->
aBigRange, aUser, aDateTime, sComment, aCell, &rDoc, sInputString);
484 if (rGenerated.nID == 0)
487 if (rGenerated.pCellInfo)
488 aCell = rGenerated.pCellInfo->CreateCell(rDoc);
493 OSL_ENSURE(rGenerated.nID,
"could not insert generated action");
510 OSL_ENSURE(rGenerated.
nID,
"a not inserted generated action");
530 OSL_FAIL(
"no cut off insert action");
552 OSL_FAIL(
"no cut off move action");
569 OSL_ENSURE(rGenerated.
nID,
"a not inserted generated action");
639 SetContentDependencies(static_cast<ScMyContentAction*>(pAction), static_cast<ScChangeActionContent*>(pAct), rDoc);
643 OSL_FAIL(
"could not find the action");
653 assert(dynamic_cast<ScChangeActionContent*>(pChangeAction));
658 sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2;
660 if ((nCol >= 0) && (nCol <= rDoc.
MaxCol()) &&
661 (nRow >= 0) && (nRow <= rDoc.
MaxRow()) &&
662 (nTab >= 0) && (nTab <=
MAXTAB))
664 ScAddress aAddress (static_cast<SCCOL>(nCol),
665 static_cast<SCROW>(nRow),
666 static_cast<SCTAB>(nTab));
668 aCell.
assign(rDoc, aAddress);
694 sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
698 sFormula2 = sFormula.copy( 1 );
718 OSL_FAIL(
"wrong cell position");
731 for (
const auto & rAction :
aActions)
733 std::unique_ptr<ScChangeAction> pAction;
735 switch (rAction->nActionType)
780 OSL_FAIL(
"no action");
786 auto aItr = aActions.begin();
787 while (aItr != aActions.end())
794 aItr = aActions.erase(aItr);
797 for (
const auto& rxAction : aActions)
799 OSL_ENSURE(rxAction->nActionType ==
SC_CAT_CONTENT,
"wrong action type");
800 SetNewCell(static_cast<ScMyContentAction*>(rxAction.get()), *pDoc);
const ScCellValue & GetOldCell() const
bool equalsWithoutFormat(const ScCellValue &r) const
virtual ~ScMyBaseAction()
std::vector< ScMyMoveCutOff > aMoveCutOffs
void AddGenerated(std::unique_ptr< ScMyCellInfo > pCellInfo, const ScBigRange &aBigRange)
ScChangeActionType GetType() const
static bool GetAddressFromString(ScAddress &rAddress, const OUString &rAddressStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
String to Range core.
ScChangeAction * GetLast() const
sal_uInt32 nRejectingNumber
void SetProtection(const css::uno::Sequence< sal_Int8 > &rPass)
void StartChangeAction(const ScChangeActionType nActionType)
SC_DLLPUBLIC ScChangeAction * GetAction(sal_uLong nAction) const
ScChangeActionDelMoveEntry * AddCutOffMove(ScChangeActionMove *pMove, short nFrom, short nTo)
virtual ~ScMyContentAction() override
std::vector< ScMyDeleted > aDeletedList
std::unique_ptr< ScChangeAction > CreateInsertAction(const ScMyInsAction *pAction)
std::unique_ptr< ScChangeAction > CreateDeleteAction(const ScMyDelAction *pAction)
virtual ~ScMyDelAction() override
void SetActionInfo(const ScMyActionInfo &aInfo)
std::vector< std::unique_ptr< ScMyBaseAction > > aActions
void SetMovementDependencies(ScMyMoveAction *pAction, ScChangeActionMove *pMoveAct)
void AddDeleted(const sal_uInt32 nID)
void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo *pCellInfo)
std::unique_ptr< ScChangeAction > CreateContentAction(const ScMyContentAction *pAction, ScDocument &rDoc)
~ScXMLChangeTrackingImportHelper()
Store arbitrary cell value of any kind.
ScChangeActionState nActionState
void SetNewCell(const ScMyContentAction *pAction, ScDocument &rDoc)
void AppendLoaded(std::unique_ptr< ScChangeAction > pAppend)
void SetDependencies(ScMyBaseAction *pAction, ScDocument &rDoc)
sal_uInt32 nPreviousAction
void CreateChangeTrack(ScDocument *pDoc)
ScFormulaCell * mpFormula
SC_DLLPUBLIC SCROW MaxRow() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void SetDeletedInThis(sal_uLong nActionNumber, const ScChangeTrack *pTrack)
static sal_uInt32 GetIDFromString(std::string_view sID)
bool IsTopContent() const
void CreateGeneratedActions(std::vector< ScMyGenerated > &rList, ScDocument &rDoc)
virtual ~ScMyMoveAction() override
void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition)
ScChangeTrack * GetChangeTrack() const
ScXMLChangeTrackingImportHelper()
const css::uno::Sequence< sal_Int8 > & GetProtection() const
void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable)
void SetDeletionDependencies(ScMyDelAction *pAction, ScChangeActionDel *pDelAct)
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
sal_uLong AddLoadedGenerated(const ScCellValue &rNewCell, const ScBigRange &aBigRange, const OUString &sNewValue)
void SetTimeNanoSeconds(bool bVal)
std::unique_ptr< ScChangeAction > CreateRejectionAction(const ScMyRejAction *pAction)
void ConvertInfo(const ScMyActionInfo &aInfo, OUString &rUser, DateTime &aDateTime)
void SetContentDependencies(const ScMyContentAction *pAction, ScChangeActionContent *pActContent, ScDocument &rDoc)
std::vector< ScMyGenerated > aGeneratedList
virtual ~ScMyRejAction() override
sal_Int16 nMultiSpannedSlaveCount
std::unique_ptr< ScMyInsertionCutOff > pInsCutOff
ScChangeActionType nActionType
static SC_DLLPUBLIC LanguageType eLnge
void SetMultiSpanned(const sal_Int16 nMultiSpanned)
std::unique_ptr< ScMyCellInfo > pCellInfo
ScMyInsAction(const ScChangeActionType nActionType)
void SetNextContent(ScChangeActionContent *p)
#define SC_CHANGE_ID_PREFIX
void SetLastSavedActionNumber(sal_uLong nNew)
void GetMultiSpannedRange()
sal_uLong GetActionNumber() const
std::vector< ScMyGenerated > aGeneratedList
css::uno::Sequence< sal_Int8 > aProtect
void SetNewValue(const ScCellValue &rCell, ScDocument *pDoc)
std::unique_ptr< ScMyCellInfo > pCellInfo
ScChangeActionLinkEntry * AddDependent(ScChangeAction *p)
ScMyBaseAction(const ScChangeActionType nActionType)
SC_DLLPUBLIC void SetChangeTrack(std::unique_ptr< ScChangeTrack > pTrack)
only for import filter, deletes any existing ChangeTrack via EndChangeTracking() and takes ownership ...
void assign(const ScDocument &rDoc, const ScAddress &rPos)
Take cell value from specified position in specified document.
std::unique_ptr< ScMyMoveRanges > pMoveRanges
ScMyCellInfo(const ScCellValue &rCell, const OUString &sFormulaAddress, const OUString &sFormula, const formula::FormulaGrammar::Grammar eGrammar, const OUString &sInputString, const double &fValue, const sal_uInt16 nType, const ScMatrixMode nMatrixFlag, const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows)
const ScCellValue & CreateCell(ScDocument &rDoc)
bool IsInsertType() const
formula::FormulaGrammar::Grammar eGrammar
void SetCutOffInsert(ScChangeActionIns *p, short n)
const std::set< OUString > & GetUserCollection() const
std::set< OUString > aUsers
void GetVars(sal_Int32 &nCol1, sal_Int32 &nRow1, sal_Int32 &nTab1, sal_Int32 &nCol2, sal_Int32 &nRow2, sal_Int32 &nTab2) const
void SetActionMax(sal_uLong nTempActionMax)
virtual ~ScMyInsAction() override
const sal_Int32 nInt32Max
const ScCellValue & GetNewCell() const
ScMyDelAction(const ScChangeActionType nActionType)
void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition)
std::vector< sal_uInt32 > aDependencies
void SetMoveRanges(const ScBigRange &aSourceRange, const ScBigRange &aTargetRange)
std::unique_ptr< ScChangeAction > CreateMoveAction(const ScMyMoveAction *pAction)
css::util::DateTime aDateTime
static bool convertNumber(sal_Int32 &rValue, std::u16string_view aString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
void SetNewCell(const ScCellValue &rCell, const ScDocument *pDoc, const OUString &rFormatted)
const sal_Int32 nInt32Min
void SetPrevContent(ScChangeActionContent *p)
std::unique_ptr< ScMyBaseAction > pCurrentAction