26 #include <osl/diagnose.h>
28 #include <document.hxx>
33 #include <globstr.hrc>
40 #include <stlpool.hxx>
55 for (
const auto & rOldValue : rOldValues)
60 Notify(*pModelObj, aChangeRanges,
"cell-change");
94 return ScResId( STR_UNDO_CURSORATTR );
149 if (
auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
150 pViewTarget->GetViewShell()->ApplySelectionPattern( *
pApplyPattern );
162 const OUString& rNewStr, std::unique_ptr<EditTextObject> pObj ) :
176 return ScResId( STR_UNDO_ENTERDATA );
182 bool bHeightChanged =
false;
186 bHeightChanged =
true;
196 pViewShell,
false ,
true ,
true ,
197 false ,
false ,
false ,
maPos.
Tab());
215 aPos.
SetTab(rOldValue.mnTab);
217 if (rOldValue.mbHasFormat)
218 nFormat = rOldValue.mnFormat;
219 pChangeTrack->
AppendContent(aPos, rOldValue.maCell, nFormat);
241 if (rVal.mbHasFormat)
254 size_t nCount = maOldValues.size();
255 if ( pChangeTrack &&
mnEndChangeAction >= sal::static_int_cast<sal_uLong>(nCount) )
271 SCTAB nTab = rOldValue.mnTab;
295 if (
auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
298 pViewTarget->GetViewShell()->EnterDataAtCursor( aTemp );
312 maOldCell(rUndoCell),
324 return ScResId( STR_UNDO_ENTERDATA );
384 ScSimpleUndo(pDocSh), maPos(rPos), maOldValue(rOldVal), maNewValue(rNewVal), mnEndChangeAction(0)
428 return ScResId(STR_UNDO_ENTERDATA);
493 bool bNewColumn,
bool bNewInsert ) :
498 bColumn( bNewColumn ),
499 bInsert( bNewInsert )
512 ScResId( STR_UNDO_INSCOLBREAK ) :
513 ScResId( STR_UNDO_DELCOLBREAK )
516 ScResId( STR_UNDO_INSROWBREAK ) :
517 ScResId( STR_UNDO_DELROWBREAK )
555 if (
auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
572 SCTAB nT, sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP ) :
588 return ScResId( STR_UNDO_PRINTSCALE );
600 OSL_ENSURE( pStyleSheet,
"PageStyle not found" );
628 if (
auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
658 return ScResId( STR_UNDO_THESAURUS );
713 if (
auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
714 pViewTarget->GetViewShell()->DoThesaurus();
724 const ScNoteData& rNoteData,
bool bInsert, std::unique_ptr<SdrUndoAction> pDrawUndo ) :
727 mpDrawUndo(
std::move(pDrawUndo) )
729 OSL_ENSURE( rNoteData.
mxCaption,
"ScUndoReplaceNote::ScUndoReplaceNote - missing note caption" );
743 const ScNoteData& rOldData,
const ScNoteData& rNewData, std::unique_ptr<SdrUndoAction> pDrawUndo ) :
746 maOldData( rOldData ),
747 maNewData( rNewData ),
748 mpDrawUndo(
std::move(pDrawUndo) )
799 (
maOldData.
mxCaption ? STR_UNDO_EDITNOTE : STR_UNDO_INSERTNOTE) : STR_UNDO_DELETENOTE );
807 OSL_ENSURE( !rDoc.
GetNote(
maPos),
"ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
809 rDoc.
SetNote(
maPos, std::unique_ptr<ScPostIt>(pNote) );
820 OSL_ENSURE( rDoc.
GetNote(
maPos),
"ScUndoReplaceNote::DoRemoveNote - missing cell note" );
826 pNote->ForgetCaption();
869 return ScResId(
mbShown ? STR_UNDO_SHOWNOTE : STR_UNDO_HIDENOTE );
873 std::unique_ptr<SdrUndoAction> pDraw,
const ScDetOpData* pOperation,
874 std::unique_ptr<ScDetOpList> pUndoList ) :
876 pOldList (
std::move(pUndoList) ),
878 pDrawUndo (
std::move(pDraw) )
898 switch ( static_cast<ScDetOpType>(
nAction) )
927 if (pList && pList->
Count())
930 ScDetOpDataVector::iterator it = rVec.begin() + rVec.size() - 1;
935 OSL_FAIL(
"Detective entry could not be found in list");
978 std::unique_ptr<ScRangeName> pOld, std::unique_ptr<ScRangeName> pNew,
SCTAB nTab ) :
980 pOldRanges (
std::move(pOld) ),
981 pNewRanges (
std::move(pNew) ),
994 return ScResId( STR_UNDO_RANGENAMES );
1004 auto p = std::make_unique<ScRangeName>(*pOldRanges);
1012 auto p = std::make_unique<ScRangeName>(*pNewRanges);
sal_uLong mnEndChangeAction
If set, cloned formula cells will start to listen to the document.
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
void ClearDetectiveOperations()
std::unique_ptr< SdrUndoAction > mpDrawUndo
void DoInsertNote(const ScNoteData &rNoteData)
std::vector< ScDetOpData > ScDetOpDataVector
ScCaptionInitDataRef mxInitData
Author of the note.
OUString getString() const
ScDocShell * GetDocShell() const
ScUndoDetective(ScDocShell *pNewDocShell, std::unique_ptr< SdrUndoAction > pDraw, const ScDetOpData *pOperation, std::unique_ptr< ScDetOpList > pUndoList=nullptr)
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Store parameters used in the ScDocument::SetString() method.
std::unique_ptr< SdrUndoAction > pDrawUndo
void DoRemoveNote(const ScNoteData &rNoteData)
OUString ScResId(TranslateId aId)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is...
ScUndoShowHideNote(ScDocShell &rDocShell, const ScAddress &rPos, bool bShow)
virtual void Redo() override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual OUString GetComment() const override
sal_uLong nEndChangeAction
virtual OUString GetComment() const override
virtual void Redo() override
virtual void Undo() override
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
virtual void Undo() override
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(175)
ScDetOpList * GetDetOpList() const
SC_DLLPUBLIC void CompileHybridFormula()
Call this immediately after updating named ranges.
std::unique_ptr< EditTextObject > pNewEditData
ScUndoEnterValue(ScDocShell *pNewDocShell, const ScAddress &rNewPos, const ScCellValue &rUndoCell, double nVal)
virtual void Undo() override
std::unique_ptr< EditTextObject > mpNewEditData
virtual ~ScUndoThesaurus() override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual void Repeat(SfxRepeatTarget &rTarget) override
ScUndoEnterData(ScDocShell *pNewDocShell, const ScAddress &rPos, ValuesType &rOldValues, const OUString &rNewStr, std::unique_ptr< EditTextObject > pObj)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual ~ScUndoPrintZoom() override
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
virtual SfxItemSet & GetItemSet()
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
void Remove(const SfxPoolItem &)
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
virtual void Repeat(SfxRepeatTarget &rTarget) override
sal_uLong GetActionMax() const
ScUndoSetCell(ScDocShell *pDocSh, const ScAddress &rPos, const ScCellValue &rOldVal, const ScCellValue &rNewVal)
std::unique_ptr< ScRangeName > pNewRanges
virtual void Undo() override
virtual OUString GetComment() const override
virtual void Undo() override
static void notifyAllViewsSheetGeomInvalidation(const SfxViewShell *pForViewShell, bool bColumns, bool bRows, bool bSizes, bool bHidden, bool bFiltered, bool bGroups, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY for all views whose current tab is equal to nCurrentTa...
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual OUString GetComment() const override
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
SfxApplication * SfxGetpApp()
TextFormatPolicy meSetTextNumFormat
Determine when to set the 'Text' number format to the cell where the input string is being set...
SC_DLLPUBLIC ScDocumentPool * GetPool()
virtual void Redo() override
Store arbitrary cell value of any kind.
ScPatternAttr * pNewPattern
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
virtual ~ScUndoSetCell() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
ScFormulaCell * mpFormula
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
Additional class containing cell annotation data.
static void LOKCommentNotify(LOKCommentNotificationType nType, const ScDocument *pDocument, const ScAddress &rPos, const ScPostIt *pNote)
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual void Repeat(SfxRepeatTarget &rTarget) override
void DoChange(bool bUndo, const ScCellValue &rText)
const ScAddress & GetPos() const
void push_back(const ScRange &rRange)
ScUndoRangeNames(ScDocShell *pNewDocShell, std::unique_ptr< ScRangeName > pOld, std::unique_ptr< ScRangeName > pNew, SCTAB nTab)
void RedoSdrUndoAction(SdrUndoAction *pUndoAction)
void release(ScDocument &rDoc, const ScAddress &rPos)
Set cell value at specified position in specified document.
void setNotOwner()
Flag that this instance is in Undo, so drawing layer owns it.
ScUndoThesaurus(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, const ScCellValue &rOldText, const ScCellValue &rNewText)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual ~ScUndoRangeNames() override
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
ScViewData & GetViewData()
ScChangeTrack * GetChangeTrack() const
SC_DLLPUBLIC void DeletePageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
SC_DLLPUBLIC void Undo(sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge=false)
virtual ~ScUndoEnterValue() override
virtual ~ScUndoPageBreak() override
SC_DLLPUBLIC bool SetEditText(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
This method manages the lifecycle of the passed edit text object.
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
virtual void Redo() override
virtual OUString GetComment() const override
void DoChange(const ScPatternAttr *pWhichPattern, const std::unique_ptr< EditTextObject > &pEditData) const
SC_DLLPUBLIC void SetPattern(const ScAddress &, const ScPatternAttr &rAttr)
void InvalidatePageBreaks(SCTAB nTab)
virtual void Undo() override
virtual OUString GetComment() const override
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
ScPatternAttr * pApplyPattern
void SetValue(const ScCellValue &rVal)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
void DoChange(bool bUndo)
virtual OUString GetComment() const override
svl::SharedString * mpString
virtual ~ScUndoCursorAttr() override
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
virtual void Repeat(SfxRepeatTarget &rTarget) override
ScUndoReplaceNote(ScDocShell &rDocShell, const ScAddress &rPos, const ScNoteData &rNoteData, bool bInsert, std::unique_ptr< SdrUndoAction > pDrawUndo)
Constructs an undo action for inserting or removing a cell note.
void SetPrintZoom(SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages)
SfxItemSet & GetItemSet()
ScDetOpDataVector & GetDataVector()
void DoSdrUndoAction(SdrUndoAction *pUndoAction, ScDocument *pDoc)
void SetNote(const ScAddress &rPos, std::unique_ptr< ScPostIt > pNote)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
Keep an existing number format, do not set Text number format and do not set another number format...
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
virtual void Undo() override
std::unique_ptr< ScDetOpList > pOldList
virtual ~ScUndoShowHideNote() override
std::unique_ptr< ScRangeName > pOldRanges
virtual void Undo() override
static void notifyAllViewsHeaderInvalidation(const SfxViewShell *pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex...
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
std::vector< Value > ValuesType
SfxViewShell * GetViewShell() const
virtual void Repeat(SfxRepeatTarget &rTarget) override
sal_uLong nEndChangeAction
ScUndoPrintZoom(ScDocShell *pNewDocShell, SCTAB nT, sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP)
sal_uLong mnEndChangeAction
virtual void Undo() override
virtual OUString GetComment() const override
virtual void Repeat(SfxRepeatTarget &rTarget) override
ScModelObj * getMustPropagateChangesModel(const ScDocShell &rDocShell)
void SetDetOpList(std::unique_ptr< ScDetOpList > pNew)
ScPatternAttr * pOldPattern
void DoChange(bool bInsert) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual void Redo() override
virtual void Redo() override
ScCaptionPtr mxCaption
Initial data for invisible notes without SdrObject.
SC_DLLPUBLIC ScFormulaCell * SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell)
Set formula cell, and transfer its ownership to the document.
ScDetOpType GetOperation() const
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual OUString GetComment() const override
static ScTabViewShell * GetActiveViewShell()
void SetEditData(std::unique_ptr< EditTextObject > pOld, std::unique_ptr< EditTextObject > pNew)
once the objects are passed to this class, their life-cycle is managed by this class; the calling fun...
virtual OUString GetComment() const override
Internal data for a cell annotation.
void DoChange(bool bUndo)
virtual void Undo() override
ScUndoCursorAttr(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, const ScPatternAttr *pOldPat, const ScPatternAttr *pNewPat, const ScPatternAttr *pApplyPat)
void assign(const ScDocument &rDoc, const ScAddress &rPos)
Take cell value from specified position in specified document.
virtual std::unique_ptr< EditTextObject > Clone() const =0
virtual void Redo() override
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
ScUndoPageBreak(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, bool bNewColumn, bool bNewInsert)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
const ScDocument & GetDocument() const
EditTextObject * mpEditText
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(176)
void SetEmptyCell(const ScAddress &rPos)
void SetRangeName(SCTAB nTab, std::unique_ptr< ScRangeName > pNew)
virtual void Redo() override
virtual ~ScUndoDetective() override
virtual void Redo() override
virtual void Undo() override
std::unique_ptr< EditTextObject > pOldEditData
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual OUString GetComment() const override
void SetChangeTrack(const ScCellValue &rOldCell)
virtual ~ScUndoReplaceNote() override
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
SC_DLLPUBLIC std::unique_ptr< ScPostIt > ReleaseNote(const ScAddress &rPos)
void commit(ScDocument &rDoc, const ScAddress &rPos) const
Set cell value at specified position in specified document.
virtual void Repeat(SfxRepeatTarget &rTarget) override
SC_DLLPUBLIC void PreprocessRangeNameUpdate()
void AppendContent(const ScAddress &rPos, const ScDocument *pRefDoc)
virtual void Redo() override
virtual void Redo() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
bool m_bDetectedRangeSegmentation false