Resolves: tdf#134308 if max undo is 0, treat as if no undo
Change-Id: I7eaa71d80718a4350ba6a3d7ff19ce09e1ac3aa3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151354
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
index a64a1f5..a7d1e475 100644
--- a/include/svl/undo.hxx
+++ b/include/svl/undo.hxx
@@ -198,6 +198,7 @@ public:
virtual ~SfxUndoManager();
void SetMaxUndoActionCount( size_t nMaxUndoActionCount );
size_t GetMaxUndoActionCount() const;
virtual void AddUndoAction( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerg=false );
virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const;
OUString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index a0db578..c7e59c5 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -64,6 +64,8 @@ void FuText::StopEditMode()
ScDocShell* pDocShell = rViewData.GetDocShell();
SfxUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : nullptr;
if (pUndoMgr && !pUndoMgr->GetMaxUndoActionCount()) // tdf#134308 if max undo is 0, treat as if no undo
pUndoMgr = nullptr;
bool bNewNote = false;
if( pNote && pUndoMgr )
{
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 3126943..9b90495 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -376,7 +376,6 @@ bool SfxUndoManager::ImplIsUndoEnabled_Lock() const
return m_xData->mbUndoEnabled;
}
void SfxUndoManager::SetMaxUndoActionCount( size_t nMaxUndoActionCount )
{
UndoManagerGuard aGuard( *m_xData );
@@ -411,6 +410,10 @@ void SfxUndoManager::SetMaxUndoActionCount( size_t nMaxUndoActionCount )
ImplCheckEmptyActions();
}
size_t SfxUndoManager::GetMaxUndoActionCount() const
{
return m_xData->pActUndoArray->nMaxUndoActions;
}
void SfxUndoManager::ImplClearCurrentLevel_NoNotify( UndoManagerGuard& i_guard )
{