27#include <osl/diagnose.h>
29#include <document.hxx>
58 for (
const auto & rOldValue : rOldValues)
64 Notify(*pModelObj, aChangeRanges, rType);
68 ? OUString(
"data-area-invalidate") : OUString(
"data-area-extend"));
103 return ScResId( STR_UNDO_CURSORATTR );
159 pViewTarget->GetViewShell()->ApplySelectionPattern( *
pApplyPattern );
171 OUString aNewStr, std::unique_ptr<EditTextObject> pObj ) :
185 return ScResId( STR_UNDO_ENTERDATA );
191 bool bHeightChanged =
false;
195 bHeightChanged =
true;
205 pViewShell,
false ,
true ,
true ,
206 false ,
false ,
false ,
maPos.
Tab());
224 aPos.
SetTab(rOldValue.mnTab);
226 if (rOldValue.mbHasFormat)
227 nFormat = rOldValue.mnFormat;
228 pChangeTrack->
AppendContent(aPos, rOldValue.maCell, nFormat);
250 if (rVal.mbHasFormat)
280 SCTAB nTab = rOldValue.mnTab;
307 pViewTarget->GetViewShell()->EnterDataAtCursor( aTemp );
321 maOldCell(
std::move(aUndoCell)),
333 return ScResId( STR_UNDO_ENTERDATA );
393 ScSimpleUndo(pDocSh), maPos(rPos), maOldValue(
std::move(aOldVal)), maNewValue(
std::move(aNewVal)), mnEndChangeAction(0)
437 return ScResId(STR_UNDO_ENTERDATA);
502 bool bNewColumn,
bool bNewInsert ) :
507 bColumn( bNewColumn ),
508 bInsert( bNewInsert )
521 ScResId( STR_UNDO_INSCOLBREAK ) :
522 ScResId( STR_UNDO_DELCOLBREAK )
525 ScResId( STR_UNDO_INSROWBREAK ) :
526 ScResId( STR_UNDO_DELROWBREAK )
581 SCTAB nT, sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP ) :
597 return ScResId( STR_UNDO_PRINTSCALE );
609 OSL_ENSURE( pStyleSheet,
"PageStyle not found" );
657 maOldText(
std::move(aOldText)),
658 maNewText(
std::move(aNewText))
667 return ScResId( STR_UNDO_THESAURUS );
723 pViewTarget->GetViewShell()->DoThesaurus();
733 const ScNoteData& rNoteData,
bool bInsert, std::unique_ptr<SdrUndoAction> pDrawUndo ) :
736 mpDrawUndo(
std::move(pDrawUndo) )
738 OSL_ENSURE( rNoteData.
mxCaption,
"ScUndoReplaceNote::ScUndoReplaceNote - missing note caption" );
753 maOldData(
std::move( aOldData )),
754 maNewData(
std::move( aNewData )),
755 mpDrawUndo(
std::move(pDrawUndo) )
804 (
maOldData.
mxCaption ? STR_UNDO_EDITNOTE : STR_UNDO_INSERTNOTE) : STR_UNDO_DELETENOTE );
812 OSL_ENSURE( !rDoc.
GetNote(
maPos),
"ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
814 rDoc.
SetNote(
maPos, std::unique_ptr<ScPostIt>(pNote) );
825 OSL_ENSURE( rDoc.
GetNote(
maPos),
"ScUndoReplaceNote::DoRemoveNote - missing cell note" );
831 pNote->ForgetCaption();
874 return ScResId(
mbShown ? STR_UNDO_SHOWNOTE : STR_UNDO_HIDENOTE );
878 std::unique_ptr<SdrUndoAction> pDraw,
const ScDetOpData* pOperation,
879 std::unique_ptr<ScDetOpList> pUndoList ) :
881 pOldList (
std::move(pUndoList) ),
883 pDrawUndo (
std::move(pDraw) )
932 if (pList && pList->
Count())
935 ScDetOpDataVector::iterator it = rVec.begin() + rVec.size() - 1;
940 OSL_FAIL(
"Detective entry could not be found in list");
983 std::unique_ptr<ScRangeName> pOld, std::unique_ptr<ScRangeName> pNew,
SCTAB nTab ) :
985 pOldRanges (
std::move(pOld) ),
986 pNewRanges (
std::move(pNew) ),
999 return ScResId( STR_UNDO_RANGENAMES );
1009 auto p = std::make_unique<ScRangeName>(*
pOldRanges);
1017 auto p = std::make_unique<ScRangeName>(*
pNewRanges);
SfxApplication * SfxGetpApp()
virtual std::unique_ptr< EditTextObject > Clone() const=0
sal_uLong GetActionMax() const
SC_DLLPUBLIC void Undo(sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge=false)
void AppendContent(const ScAddress &rPos, const ScDocument *pRefDoc)
ScDetOpType GetOperation() const
const ScAddress & GetPos() const
ScDetOpDataVector & GetDataVector()
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
const ScDocument & GetDocument() const
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
void SetPrintZoom(SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages)
ScModelObj * GetModel() const
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
static void LOKCommentNotify(LOKCommentNotificationType nType, const ScDocument *pDocument, const ScAddress &rPos, const ScPostIt *pNote)
void SetEmptyCell(const ScAddress &rPos)
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 ScFormulaCell * SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell)
Set formula cell, and transfer its ownership to the document.
void SetRangeName(SCTAB nTab, std::unique_ptr< ScRangeName > pNew)
void SetNote(const ScAddress &rPos, std::unique_ptr< ScPostIt > pNote)
SC_DLLPUBLIC void CompileHybridFormula()
Call this immediately after updating named ranges.
void InvalidatePageBreaks(SCTAB nTab)
SC_DLLPUBLIC ScDocumentPool * GetPool()
ScDetOpList * GetDetOpList() const
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
void AddDetectiveOperation(const ScDetOpData &rData)
SC_DLLPUBLIC void PreprocessRangeNameUpdate()
SC_DLLPUBLIC std::unique_ptr< ScPostIt > ReleaseNote(const ScAddress &rPos)
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
void SetDetOpList(std::unique_ptr< ScDetOpList > pNew)
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
SC_DLLPUBLIC void SetPattern(const ScAddress &, const ScPatternAttr &rAttr)
void ClearDetectiveOperations()
ScChangeTrack * GetChangeTrack() const
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SfxItemSet & GetItemSet()
Additional class containing cell annotation data.
void push_back(const ScRange &rRange)
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...
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.
static ScTabViewShell * GetActiveViewShell()
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
ScViewData & GetViewData()
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
std::unique_ptr< EditTextObject > pOldEditData
virtual void Undo() override
std::unique_ptr< EditTextObject > pNewEditData
void DoChange(const ScPatternAttr *pWhichPattern, const std::unique_ptr< EditTextObject > &pEditData) const
virtual void Redo() override
ScPatternAttr * pNewPattern
ScPatternAttr * pApplyPattern
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual OUString GetComment() const override
virtual ~ScUndoCursorAttr() override
ScUndoCursorAttr(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, const ScPatternAttr *pOldPat, const ScPatternAttr *pNewPat, const ScPatternAttr *pApplyPat)
virtual void Repeat(SfxRepeatTarget &rTarget) override
ScPatternAttr * pOldPattern
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 void Redo() override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual void Undo() override
std::unique_ptr< ScDetOpList > pOldList
virtual ~ScUndoDetective() override
virtual OUString GetComment() const override
ScUndoDetective(ScDocShell *pNewDocShell, std::unique_ptr< SdrUndoAction > pDraw, const ScDetOpData *pOperation, std::unique_ptr< ScDetOpList > pUndoList=nullptr)
virtual void Repeat(SfxRepeatTarget &rTarget) override
std::unique_ptr< SdrUndoAction > pDrawUndo
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual OUString GetComment() const override
sal_uLong mnEndChangeAction
virtual void Undo() override
ScUndoEnterData(ScDocShell *pNewDocShell, const ScAddress &rPos, ValuesType &rOldValues, OUString aNewStr, std::unique_ptr< EditTextObject > pObj)
std::unique_ptr< EditTextObject > mpNewEditData
std::vector< Value > ValuesType
virtual void Redo() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual OUString GetComment() const override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual void Redo() override
sal_uLong nEndChangeAction
ScUndoEnterValue(ScDocShell *pNewDocShell, const ScAddress &rNewPos, ScCellValue aUndoCell, double nVal)
virtual ~ScUndoEnterValue() override
virtual void Undo() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual OUString GetComment() const override
virtual ~ScUndoPageBreak() override
ScUndoPageBreak(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, bool bNewColumn, bool bNewInsert)
virtual void Undo() override
virtual void Redo() override
void DoChange(bool bInsert) const
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual ~ScUndoPrintZoom() override
void DoChange(bool bUndo)
virtual void Undo() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
ScUndoPrintZoom(ScDocShell *pNewDocShell, SCTAB nT, sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP)
virtual OUString GetComment() const override
virtual void Redo() override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
std::unique_ptr< ScRangeName > pOldRanges
std::unique_ptr< ScRangeName > pNewRanges
virtual void Undo() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
void DoChange(bool bUndo)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual void Redo() override
virtual ~ScUndoRangeNames() override
virtual OUString GetComment() const override
ScUndoRangeNames(ScDocShell *pNewDocShell, std::unique_ptr< ScRangeName > pOld, std::unique_ptr< ScRangeName > pNew, SCTAB nTab)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual OUString GetComment() const override
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual void Undo() override
virtual void Redo() override
virtual ~ScUndoReplaceNote() 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 DoInsertNote(const ScNoteData &rNoteData)
void DoRemoveNote(const ScNoteData &rNoteData)
std::unique_ptr< SdrUndoAction > mpDrawUndo
virtual OUString GetComment() const override
sal_uLong mnEndChangeAction
virtual void Redo() override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual void Undo() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual ~ScUndoSetCell() override
void SetValue(const ScCellValue &rVal)
ScUndoSetCell(ScDocShell *pDocSh, const ScAddress &rPos, ScCellValue aOldVal, ScCellValue aNewVal)
virtual OUString GetComment() const override
virtual ~ScUndoShowHideNote() override
virtual void Redo() override
virtual void Repeat(SfxRepeatTarget &rTarget) override
ScUndoShowHideNote(ScDocShell &rDocShell, const ScAddress &rPos, bool bShow)
virtual void Undo() override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual OUString GetComment() const override
virtual void Redo() override
sal_uLong nEndChangeAction
void SetChangeTrack(const ScCellValue &rOldCell)
ScUndoThesaurus(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, ScCellValue aOldText, ScCellValue aNewText)
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual void Undo() override
void DoChange(bool bUndo, const ScCellValue &rText)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
virtual ~ScUndoThesaurus() override
ScDocShell * GetDocShell() const
SC_DLLPUBLIC void DeletePageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
void Remove(const SfxPoolItem &)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxViewShell * GetViewShell() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual SfxItemSet & GetItemSet()
const OUString & getString() const
std::vector< ScDetOpData > ScDetOpDataVector
@ StartListening
If set, cloned formula cells will start to listen to the document.
bool isDataAreaInvalidateType(std::u16string_view rType)
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
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 >())
bool getMustPropagateChangesModel(ScModelObj *pModelObj)
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(175)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(176)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
Store arbitrary cell value of any kind.
void assign(const ScDocument &rDoc, const ScAddress &rPos)
Take cell value from specified position in specified document.
const svl::SharedString * getSharedString() const
ScFormulaCell * getFormula() const
EditTextObject * getEditText() const
void release(ScDocument &rDoc, const ScAddress &rPos)
Set cell value at specified position in specified document.
void commit(ScDocument &rDoc, const ScAddress &rPos) const
Set cell value at specified position in specified document.
Internal data for a cell annotation.
rtl::Reference< SdrCaptionObj > mxCaption
Initial data for invisible notes without SdrObject.
ScCaptionInitDataRef mxInitData
Author of the note.
Store parameters used in the ScDocument::SetString() method.
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is.
@ Keep
Keep an existing number format, do not set Text number format and do not set another number format.
TextFormatPolicy meSetTextNumFormat
Determine when to set the 'Text' number format to the cell where the input string is being set.
void DoSdrUndoAction(SdrUndoAction *pUndoAction, ScDocument *pDoc)
void RedoSdrUndoAction(SdrUndoAction *pUndoAction)