28 #include <document.hxx>
32 #include <globstr.hrc>
34 #include <drawview.hxx>
44 if( !pObject )
return;
53 OSL_ENSURE( pDrawLayer && (pDrawLayer ==
pDrDoc),
"FuText::StopEditMode - missing or different drawing layers" );
59 aNotePos = pCaptData->maStart;
60 pNote = rDoc.
GetNote( aNotePos );
61 OSL_ENSURE( pNote && (pNote->
GetCaption() == pObject),
"FuText::StopEditMode - missing or invalid cell note" );
66 bool bNewNote =
false;
67 if( pNote && pUndoMgr )
71 std::unique_ptr<SdrUndoGroup> pCalcUndo = pDrawLayer->
GetCalcUndo();
75 const OUString aUndoStr =
ScResId( STR_UNDO_EDITNOTE );
81 bNewNote = (pCalcUndo->GetActionCount() > 0) && dynamic_cast< SdrUndoNewObj* >(pCalcUndo->GetAction( 0 ));
85 pUndoMgr->
AddUndoAction( std::make_unique<ScUndoReplaceNote>( *pDocShell, aNotePos, pNote->
GetNoteData(),
true, std::move(pCalcUndo) ) );
125 bool bDeleteNote = !pTextObject || !pTextObject->
HasText();
137 pUndoMgr->
AddUndoAction( std::make_unique<ScUndoReplaceNote>( *pDocShell, aNotePos, aNoteData,
false, pDrawLayer->
GetCalcUndo() ) );
158 if( bNewNote && bDeleteNote )
167 else if( bNewNote || bDeleteNote )
170 OSL_ENSURE( pAction,
"FuText::StopEditMode - list undo action expected" );
172 pAction->
SetComment(
ScResId( bNewNote ? STR_UNDO_INSERTNOTE : STR_UNDO_DELETENOTE ) );
void BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
SfxUndoAction * GetUndoAction(size_t nNo=0) const
ScDocShell * GetDocShell() const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
SdrTextObj * GetTextEditObject() const
void LockInternalLayer(bool bLock=true)
Locks/unlocks the internal layer that contains caption objects of cell notes.
void AutoStamp()
Sets date and author from system settings.
ScDocument & GetDocument() const
EmbeddedObjectRef * pObject
void SetDrawTextUndo(SfxUndoManager *pUndoMgr)
virtual bool HasText() const override
virtual SfxUndoManager * GetUndoManager() override
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Notes.
Additional class containing cell annotation data.
ScTabViewShell & rViewShell
ScViewData & GetViewData()
void ShowCaptionTemp(const ScAddress &rPos, bool bShow=true)
Shows or hides the caption temporarily (does not change internal visibility state).
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
static ScDrawObjData * GetNoteCaptionData(SdrObject *pObj, SCTAB nTab)
Returns the object data, if the passed object is a cell note caption.
ScSheetLimits & GetSheetLimits() const
OUString ScResId(const char *pId)
vcl::Cursor * GetCursor() const
void RemoveLastUndoAction()
void LockStreamValid(bool bLock)
virtual SdrLayerID GetLayer() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
SdrCaptionObj * GetCaption() const
Returns an existing note caption object.
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
void SetComment(const OUString &rComment)
std::unique_ptr< SdrUndoGroup > GetCalcUndo()
const ScNoteData & GetNoteData() const
Returns the data struct containing all note settings.
Internal data for a cell annotation.
constexpr SdrLayerID SC_LAYER_INTERN(2)
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
static void OnLOKNoteStateChanged(const ScPostIt *pNote)
void UpdateSelectionArea(const ScMarkData &rSel, ScPatternAttr *pAttr=nullptr)
bool IsUndoEnabled() const
SC_DLLPUBLIC std::unique_ptr< ScPostIt > ReleaseNote(const ScAddress &rPos)
VclPtr< vcl::Window > pWindow
ViewShellId GetViewShellId() const override