LibreOffice Module sw (master)  1
docundo.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <UndoManager.hxx>
21 
22 #include <vcl/wrkwin.hxx>
23 #include <svx/svdmodel.hxx>
24 #include <swmodule.hxx>
25 #include <doc.hxx>
26 #include <docsh.hxx>
27 #include <view.hxx>
28 #include <drawdoc.hxx>
29 #include <ndarr.hxx>
30 #include <pam.hxx>
31 #include <ndtxt.hxx>
32 #include <swundo.hxx>
33 #include <UndoCore.hxx>
34 #include <rolbck.hxx>
35 #include <editsh.hxx>
36 #include <unobaseclass.hxx>
37 #include <limits>
40 #include <IDocumentState.hxx>
41 #include <comphelper/lok.hxx>
42 #include <assert.h>
43 
44 using namespace ::com::sun::star;
45 
46 // the undo array should never grow beyond this limit:
47 #define UNDO_ACTION_LIMIT (USHRT_MAX - 1000)
48 
49 namespace sw {
50 
51 UndoManager::UndoManager(std::shared_ptr<SwNodes> const & xUndoNodes,
52  IDocumentDrawModelAccess & rDrawModelAccess,
53  IDocumentRedlineAccess & rRedlineAccess,
54  IDocumentState & rState)
55  : m_rDrawModelAccess(rDrawModelAccess)
56  , m_rRedlineAccess(rRedlineAccess)
57  , m_rState(rState)
58  , m_xUndoNodes(xUndoNodes)
59  , m_bGroupUndo(true)
60  , m_bDrawUndo(true)
61  , m_bRepair(false)
62  , m_bLockUndoNoModifiedPosition(false)
63  , m_isAddWithIgnoreRepeat(false)
64  , m_UndoSaveMark(MARK_INVALID)
65  , m_pDocShell(nullptr)
66  , m_pView(nullptr)
67 {
68  assert(m_xUndoNodes.get());
69  // writer expects it to be disabled initially
70  // Undo is enabled by SwEditShell constructor
71  SdrUndoManager::EnableUndo(false);
72 }
73 
75 {
76  return *m_xUndoNodes;
77 }
78 
80 {
81  return *m_xUndoNodes;
82 }
83 
84 bool UndoManager::IsUndoNodes(SwNodes const& rNodes) const
85 {
86  return & rNodes == m_xUndoNodes.get();
87 }
88 
90 {
91  m_pDocShell = pDocShell;
92 }
93 
95 {
96  m_pView = pView;
97 }
98 
99 size_t UndoManager::GetUndoActionCount(const bool bCurrentLevel) const
100 {
101  size_t nRet = SdrUndoManager::GetUndoActionCount(bCurrentLevel);
103  return nRet;
104 
105  if (!nRet || !SdrUndoManager::GetUndoActionCount())
106  return nRet;
107 
108  const SfxUndoAction* pAction = SdrUndoManager::GetUndoAction();
109  if (!pAction)
110  return nRet;
111 
112  if (!m_bRepair)
113  {
114  // If another view created the last undo action, prevent undoing it from this view.
115  ViewShellId nViewShellId = m_pView->GetViewShellId();
116  if (pAction->GetViewShellId() != nViewShellId)
117  nRet = 0;
118  }
119 
120  return nRet;
121 }
122 
123 size_t UndoManager::GetRedoActionCount(const bool bCurrentLevel) const
124 {
125  size_t nRet = SdrUndoManager::GetRedoActionCount(bCurrentLevel);
127  return nRet;
128 
129  if (!nRet || !SdrUndoManager::GetRedoActionCount())
130  return nRet;
131 
132  const SfxUndoAction* pAction = SdrUndoManager::GetRedoAction();
133  if (!pAction)
134  return nRet;
135 
136  if (!m_bRepair)
137  {
138  // If another view created the first redo action, prevent redoing it from this view.
139  ViewShellId nViewShellId = m_pView->GetViewShellId();
140  if (pAction->GetViewShellId() != nViewShellId)
141  nRet = 0;
142  }
143 
144  return nRet;
145 }
146 
147 void UndoManager::DoUndo(bool const bDoUndo)
148 {
149  if(!isTextEditActive())
150  {
151  EnableUndo(bDoUndo);
152 
153  SwDrawModel*const pSdrModel = m_rDrawModelAccess.GetDrawModel();
154  if( pSdrModel )
155  {
156  pSdrModel->EnableUndo(bDoUndo);
157  }
158  }
159 }
160 
162 {
163  if(isTextEditActive())
164  {
165  return false;
166  }
167  else
168  {
169  return IsUndoEnabled();
170  }
171 }
172 
173 void UndoManager::DoGroupUndo(bool const bDoUndo)
174 {
175  m_bGroupUndo = bDoUndo;
176 }
177 
179 {
180  return m_bGroupUndo;
181 }
182 
183 void UndoManager::DoDrawUndo(bool const bDoUndo)
184 {
185  m_bDrawUndo = bDoUndo;
186 }
187 
189 {
190  return m_bDrawUndo;
191 }
192 
193 void UndoManager::DoRepair(bool bRepair)
194 {
195  m_bRepair = bRepair;
196 }
197 
199 {
200  return m_bRepair;
201 }
202 
204 {
205  return MARK_INVALID == m_UndoSaveMark;
206 }
207 
209 {
211  {
212  RemoveMark(m_UndoSaveMark);
214  }
215 }
216 
218 {
220  {
221  m_UndoSaveMark = MarkTopUndoAction();
222  }
223 }
224 
226 {
228 }
229 
231 {
233 }
234 
236 {
237  if (!SdrUndoManager::GetUndoActionCount())
238  {
239  return nullptr;
240  }
241  SfxUndoAction *const pAction( SdrUndoManager::GetUndoAction() );
242  return dynamic_cast<SwUndo*>(pAction);
243 }
244 
245 void UndoManager::AppendUndo(std::unique_ptr<SwUndo> pUndo)
246 {
247  AddUndoAction(std::move(pUndo));
248 }
249 
251 {
252  return SdrUndoManager::ImplClearRedo_NoLock(TopLevel);
253 }
254 
256 {
257  ::sw::UndoGuard const undoGuard(*this);
258 
259  SdrUndoManager::ClearAllLevels();
260 
262 }
263 
264 SwUndoId
266  SwRewriter const*const pRewriter)
267 {
268  if (!IsUndoEnabled())
269  {
270  return SwUndoId::EMPTY;
271  }
272 
273  SwUndoId const eUndoId( (i_eUndoId == SwUndoId::EMPTY) ? SwUndoId::START : i_eUndoId );
274 
275  assert(SwUndoId::END != eUndoId);
276  OUString comment( (SwUndoId::START == eUndoId)
277  ? OUString("??")
278  : GetUndoComment(eUndoId) );
279  if (pRewriter)
280  {
281  assert(SwUndoId::START != eUndoId);
282  comment = pRewriter->Apply(comment);
283  }
284 
285  ViewShellId nViewShellId(-1);
286  if (m_pDocShell)
287  {
288  if (const SwView* pView = m_pDocShell->GetView())
289  nViewShellId = pView->GetViewShellId();
290  }
291  SdrUndoManager::EnterListAction(comment, comment, static_cast<sal_uInt16>(eUndoId), nViewShellId);
292 
293  return eUndoId;
294 }
295 
296 SwUndoId
297 UndoManager::EndUndo(SwUndoId eUndoId, SwRewriter const*const pRewriter)
298 {
299  if (!IsUndoEnabled())
300  {
301  return SwUndoId::EMPTY;
302  }
303 
304  if ((eUndoId == SwUndoId::EMPTY) || (SwUndoId::START == eUndoId))
305  eUndoId = SwUndoId::END;
306  OSL_ENSURE(!((SwUndoId::END == eUndoId) && pRewriter),
307  "EndUndo(): no Undo ID, but rewriter given?");
308 
309  SfxUndoAction *const pLastUndo(
310  (0 == SdrUndoManager::GetUndoActionCount())
311  ? nullptr : SdrUndoManager::GetUndoAction() );
312 
313  int const nCount = LeaveListAction();
314 
315  if (nCount) // otherwise: empty list action not inserted!
316  {
317  assert(pLastUndo);
318  assert(SwUndoId::START != eUndoId);
319  auto pListAction = dynamic_cast<SfxListUndoAction*>(SdrUndoManager::GetUndoAction());
320  assert(pListAction);
321  if (SwUndoId::END != eUndoId)
322  {
323  OSL_ENSURE(static_cast<SwUndoId>(pListAction->GetId()) == eUndoId,
324  "EndUndo(): given ID different from StartUndo()");
325  // comment set by caller of EndUndo
326  OUString comment = GetUndoComment(eUndoId);
327  if (pRewriter)
328  {
329  comment = pRewriter->Apply(comment);
330  }
331  pListAction->SetComment(comment);
332  }
333  else if (SwUndoId::START != static_cast<SwUndoId>(pListAction->GetId()))
334  {
335  // comment set by caller of StartUndo: nothing to do here
336  }
337  else if (pLastUndo)
338  {
339  // comment was not set at StartUndo or EndUndo:
340  // take comment of last contained action
341  // (note that this works recursively, i.e. the last contained
342  // action may be a list action created by StartUndo/EndUndo)
343  OUString const comment(pLastUndo->GetComment());
344  pListAction->SetComment(comment);
345  }
346  else
347  {
348  OSL_ENSURE(false, "EndUndo(): no comment?");
349  }
350  }
351 
352  return eUndoId;
353 }
354 
355 bool
357  OUString *const o_pStr, SwUndoId *const o_pId, const SwView* pView) const
358 {
359  // this is actually expected to work on the current level,
360  // but that was really not obvious from the previous implementation...
361  if (!SdrUndoManager::GetUndoActionCount())
362  {
363  return false;
364  }
365 
366  SfxUndoAction *const pAction( SdrUndoManager::GetUndoAction() );
367 
369  {
370  // If another view created the undo action, prevent undoing it from this view.
371  ViewShellId nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId();
372  if (pAction->GetViewShellId() != nViewShellId)
373  {
374  if (o_pId)
375  {
376  *o_pId = SwUndoId::CONFLICT;
377  }
378  return false;
379  }
380  }
381 
382  if (o_pStr)
383  {
384  *o_pStr = pAction->GetComment();
385  }
386  if (o_pId)
387  {
388  if (auto pListAction = dynamic_cast<const SfxListUndoAction*>(pAction))
389  *o_pId = static_cast<SwUndoId>(pListAction->GetId());
390  else if (auto pSwAction = dynamic_cast<const SwUndo*>(pAction))
391  *o_pId = pSwAction->GetId();
392  else
393  *o_pId = SwUndoId::EMPTY;
394  }
395 
396  return true;
397 }
398 
400 {
401  OSL_ENSURE(!SdrUndoManager::IsInListAction(),
402  "GetUndoComments() called while in list action?");
403 
404  SwUndoComments_t ret;
405  const size_t nUndoCount(SdrUndoManager::GetUndoActionCount(TopLevel));
406  for (size_t n = 0; n < nUndoCount; ++n)
407  {
408  OUString const comment(
409  SdrUndoManager::GetUndoActionComment(n, TopLevel));
410  ret.push_back(comment);
411  }
412 
413  return ret;
414 }
415 
416 bool UndoManager::GetFirstRedoInfo(OUString *const o_pStr,
417  SwUndoId *const o_pId,
418  const SwView* pView) const
419 {
420  if (!SdrUndoManager::GetRedoActionCount())
421  {
422  return false;
423  }
424 
425  SfxUndoAction *const pAction( SdrUndoManager::GetRedoAction() );
426  if ( pAction == nullptr )
427  {
428  return false;
429  }
430 
432  {
433  // If another view created the undo action, prevent redoing it from this view.
434  ViewShellId nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId();
435  if (pAction->GetViewShellId() != nViewShellId)
436  {
437  if (o_pId)
438  {
439  *o_pId = SwUndoId::CONFLICT;
440  }
441  return false;
442  }
443  }
444 
445  if (o_pStr)
446  {
447  *o_pStr = pAction->GetComment();
448  }
449  if (o_pId)
450  {
451  if (auto pListAction = dynamic_cast<const SfxListUndoAction*>(pAction))
452  *o_pId = static_cast<SwUndoId>(pListAction->GetId());
453  else if (auto pSwAction = dynamic_cast<const SwUndo*>(pAction))
454  *o_pId = pSwAction->GetId();
455  else
456  *o_pId = SwUndoId::EMPTY;
457  }
458 
459  return true;
460 }
461 
463 {
464  OSL_ENSURE(!SdrUndoManager::IsInListAction(),
465  "GetRedoComments() called while in list action?");
466 
467  SwUndoComments_t ret;
468  const size_t nRedoCount(SdrUndoManager::GetRedoActionCount(TopLevel));
469  for (size_t n = 0; n < nRedoCount; ++n)
470  {
471  OUString const comment(
472  SdrUndoManager::GetRedoActionComment(n, TopLevel));
473  ret.push_back(comment);
474  }
475 
476  return ret;
477 }
478 
479 SwUndoId UndoManager::GetRepeatInfo(OUString *const o_pStr) const
480 {
481  SwUndoId nRepeatId(SwUndoId::EMPTY);
482  GetLastUndoInfo(o_pStr, & nRepeatId);
483  if( SwUndoId::REPEAT_START <= nRepeatId && SwUndoId::REPEAT_END > nRepeatId )
484  {
485  return nRepeatId;
486  }
487  if (o_pStr) // not repeatable -> clear comment
488  {
489  o_pStr->clear();
490  }
491  return SwUndoId::EMPTY;
492 }
493 
495 {
496  if (SdrUndoManager::GetRedoActionCount() ||
497  SdrUndoManager::GetRedoActionCount(TopLevel))
498  {
499  OSL_ENSURE(false, "RemoveLastUndoAction(): there are Redo actions?");
500  return nullptr;
501  }
502  if (!SdrUndoManager::GetUndoActionCount())
503  {
504  OSL_ENSURE(false, "RemoveLastUndoAction(): no Undo actions");
505  return nullptr;
506  }
507  SfxUndoAction *const pLastUndo(GetUndoAction());
508  SdrUndoManager::RemoveLastUndoAction();
509  return dynamic_cast<SwUndo *>(pLastUndo);
510 }
511 
512 // SfxUndoManager
513 
514 void UndoManager::AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTryMerge)
515 {
516  SwUndo *const pUndo( dynamic_cast<SwUndo *>(pAction.get()) );
517  if (pUndo)
518  {
519  if (RedlineFlags::NONE == pUndo->GetRedlineFlags())
520  {
522  }
524  {
525  pUndo->IgnoreRepeat();
526  }
527  }
528  SdrUndoManager::AddUndoAction(std::move(pAction), bTryMerge);
529  // if the undo nodes array is too large, delete some actions
530  while (UNDO_ACTION_LIMIT < GetUndoNodes().Count())
531  {
532  RemoveOldestUndoAction();
533  }
534 }
535 
537 {
538 public:
539  CursorGuard(SwEditShell & rShell, bool const bSave)
540  : m_rShell(rShell)
541  , m_bSaveCursor(bSave)
542  {
543  if (m_bSaveCursor)
544  {
545  m_rShell.Push(); // prevent modification of current cursor
546  }
547  }
548  ~CursorGuard() COVERITY_NOEXCEPT_FALSE
549  {
550  if (m_bSaveCursor)
551  {
553  }
554  }
555 private:
557  bool const m_bSaveCursor;
558 };
559 
561 {
562  SwDoc & rDoc(*GetUndoNodes().GetDoc());
563 
564  UnoActionContext c(& rDoc); // exception-safe StartAllAction/EndAllAction
565 
566  SwEditShell *const pEditShell( rDoc.GetEditShell() );
567 
568  OSL_ENSURE(pEditShell, "sw::UndoManager needs a SwEditShell!");
569  if (!pEditShell)
570  {
571  throw uno::RuntimeException();
572  }
573 
574  // in case the model has controllers locked, the Undo should not
575  // change the view cursors!
576  bool const bSaveCursors(pEditShell->CursorsLocked());
577  CursorGuard aCursorGuard(*pEditShell, bSaveCursors);
578  if (!bSaveCursors)
579  {
580  // (in case Undo was called via API) clear the cursors:
581  pEditShell->KillPams();
582  pEditShell->SetMark();
583  pEditShell->ClearMark();
584  }
585 
586  bool bRet(false);
587 
588  ::sw::UndoRedoContext context(rDoc, *pEditShell);
589 
590  // N.B. these may throw!
591  if (UndoOrRedoType::Undo == undoOrRedo)
592  {
593  bRet = SdrUndoManager::UndoWithContext(context);
594  }
595  else
596  {
597  bRet = SdrUndoManager::RedoWithContext(context);
598  }
599 
600  if (bRet)
601  {
602  // if we are at the "last save" position, the document is not modified
603  if (SdrUndoManager::HasTopUndoActionMark(m_UndoSaveMark))
604  {
606  }
607  else
608  {
610  }
611  }
612 
613  pEditShell->HandleUndoRedoContext(context);
614 
615  return bRet;
616 }
617 
619 {
620  if(isTextEditActive())
621  {
622  return SdrUndoManager::Undo();
623  }
624  else
625  {
627  }
628 }
629 
631 {
632  if(isTextEditActive())
633  {
634  return SdrUndoManager::Redo();
635  }
636  else
637  {
639  }
640 }
641 
643 {
644  if (m_pDocShell)
645  {
646  m_pDocShell->Broadcast(SfxHint(SfxHintId::DocumentRepair));
647  }
648 }
649 
656  sal_uInt16 const nRepeatCount)
657 {
658  if (SdrUndoManager::IsInListAction())
659  {
660  OSL_ENSURE(false, "repeat in open list action???");
661  return false;
662  }
663  if (!SdrUndoManager::GetUndoActionCount(TopLevel))
664  {
665  return false;
666  }
667  SfxUndoAction *const pRepeatAction(GetUndoAction());
668  assert(pRepeatAction);
669  if (!pRepeatAction->CanRepeat(rContext))
670  {
671  return false;
672  }
673 
674  OUString const comment(pRepeatAction->GetComment());
675  OUString const rcomment(pRepeatAction->GetRepeatComment(rContext));
676  SwUndoId nId;
677  if (auto const* const pSwAction = dynamic_cast<SwUndo*>(pRepeatAction))
678  nId = pSwAction->GetId();
679  else if (auto const* const pListAction = dynamic_cast<SfxListUndoAction*>(pRepeatAction))
680  nId = static_cast<SwUndoId>(pListAction->GetId());
681  else
682  return false;
683  if (DoesUndo())
684  {
685  ViewShellId nViewShellId(-1);
686  if (m_pDocShell)
687  {
688  if (const SwView* pView = m_pDocShell->GetView())
689  nViewShellId = pView->GetViewShellId();
690  }
691  EnterListAction(comment, rcomment, static_cast<sal_uInt16>(nId), nViewShellId);
692  }
693 
694  SwPaM* pTmp = rContext.m_pCurrentPaM;
695  for(SwPaM& rPaM : rContext.GetRepeatPaM().GetRingContainer())
696  { // iterate over ring
697  rContext.m_pCurrentPaM = &rPaM;
698  if (DoesUndo() && & rPaM != pTmp)
699  {
701  }
702  for (sal_uInt16 nRptCnt = nRepeatCount; nRptCnt > 0; --nRptCnt)
703  {
704  pRepeatAction->Repeat(rContext);
705  }
706  if (DoesUndo() && & rPaM != pTmp)
707  {
708  m_isAddWithIgnoreRepeat = false;
709  }
710  rContext.m_bDeleteRepeated = false; // reset for next PaM
711  }
712  rContext.m_pCurrentPaM = pTmp;
713 
714  if (DoesUndo())
715  {
716  LeaveListAction();
717  }
718  return true;
719 }
720 
721 } // namespace sw
722 
723 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool DoesGroupUndo() const override
Is Group Undo enabled?
Definition: docundo.cxx:178
SwNodes const & GetUndoNodes() const
Definition: docundo.cxx:74
std::shared_ptr< SwNodes > m_xUndoNodes
Undo nodes array: content not currently in document.
SwUndoId
Definition: swundo.hxx:29
bool m_isAddWithIgnoreRepeat
set the IgnoreRepeat flag on every added action
virtual void SetModified()=0
Must be called manually at changes of format.
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:128
virtual bool Undo() override
Definition: doc.hxx:185
sal_Int16 nId
virtual bool DoesDrawUndo() const override
Is Undo for Drawing objects enabled? for Draw-Undo: writer wants to handle actions on Flys on its own...
Definition: docundo.cxx:188
void SetDocShell(SwDocShell *pDocShell)
Definition: docundo.cxx:89
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:118
virtual void SetUndoNoResetModified() override
Disable (re)setting the document modified flag on Undo/Redo.
Definition: docundo.cxx:208
bool impl_DoUndoRedo(UndoOrRedoType undoOrRedo)
Definition: docundo.cxx:560
size_t GetRedoActionCount(const bool bCurrentLevel=true) const override
Definition: docundo.cxx:123
Dialog to specify the properties of drop-down form field.
Definition: accframe.hxx:34
virtual bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const override
Get Id and comment of last Undo action.
Definition: docundo.cxx:356
virtual bool Redo() override
void SetView(SwView *pView) override
Return undo/redo info for this view.
Definition: docundo.cxx:94
IDocumentState & m_rState
virtual void DelAllUndoObj() override
Delete all Undo actions.
Definition: docundo.cxx:255
void EnableUndo(bool bEnable)
virtual bool IsUndoNoResetModified() const override
Is setting the document modified flag on Undo/Redo disabled?
Definition: docundo.cxx:203
virtual SwUndoComments_t GetRedoComments() const override
Get comments of Redo actions.
Definition: docundo.cxx:462
virtual bool Undo() override
Definition: docundo.cxx:618
std::vector< OUString > SwUndoComments_t
Definition: swundo.hxx:26
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:117
bool isTextEditActive() const
void DoRepair(bool bRepair) override
Enable repair mode.
Definition: docundo.cxx:193
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
SwDocShell * m_pDocShell
IDocumentRedlineAccess & m_rRedlineAccess
OUString Apply(const OUString &rStr) const
Definition: SwRewriter.cxx:43
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:323
bool m_bRepair
If true, then repair mode is enabled.
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2143
Count
virtual void LockUndoNoModifiedPosition() override
Prevent updates to the "unmodified" state position via SetUndoNoResetModified().
Definition: docundo.cxx:225
#define MARK_INVALID
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual size_t GetUndoActionCount(const bool bCurrentLevel=true) const override
Get the number of Undo actions.
Definition: docundo.cxx:99
UndoManager(std::shared_ptr< SwNodes > const &pUndoNodes, IDocumentDrawModelAccess &rDrawModelAccess, IDocumentRedlineAccess &rRedlineAccess, IDocumentState &rState)
Definition: docundo.cxx:51
virtual void SetUndoNoModifiedPosition() override
Set the position at which the document is in the "unmodified" state to the current position in the Un...
Definition: docundo.cxx:217
virtual SwUndoId GetRepeatInfo(OUString *const o_pStr) const override
Get Id and comment of last Undo action, if it is Repeat capable.
Definition: docundo.cxx:479
ring_container GetRingContainer()
Definition: ring.hxx:240
UndoStackMark m_UndoSaveMark
position in Undo-Array at which Doc was saved (and is not modified)
virtual bool IsUndoNodes(SwNodes const &rNodes) const override
Definition: docundo.cxx:84
virtual void DoDrawUndo(bool const bDoUndo) override
Enable/Disable Undo for Drawing objects.
Definition: docundo.cxx:183
virtual OUString GetRepeatComment(SfxRepeatTarget &) const
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter) override
Closes undo block.
Definition: docundo.cxx:297
virtual void UnLockUndoNoModifiedPosition() override
Allow updates to the "unmodified" state position via SetUndoNoResetModified().
Definition: docundo.cxx:230
CursorGuard(SwEditShell &rShell, bool const bSave)
Definition: docundo.cxx:539
SwUndo * GetLastUndo()
Definition: docundo.cxx:235
virtual ViewShellId GetViewShellId() const
bool DoesRepair() const override
Is repair mode active?
Definition: docundo.cxx:198
virtual OUString GetComment() const
#define UNDO_ACTION_LIMIT
Definition: docundo.cxx:47
bool m_bLockUndoNoModifiedPosition
SwEditShell & m_rShell
Definition: docundo.cxx:556
virtual void Repeat(SfxRepeatTarget &)
Get information about the current document state.
void IgnoreRepeat()
Definition: undobj.hxx:128
IDocumentDrawModelAccess & m_rDrawModelAccess
virtual SwUndoComments_t GetUndoComments() const override
Get comments of Undo actions.
Definition: docundo.cxx:399
virtual bool Redo() override
Definition: docundo.cxx:630
virtual void DoUndo(bool const bDoUndo) override
IDocumentUndoRedo.
Definition: docundo.cxx:147
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false) override
Definition: docundo.cxx:514
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter) override
Opens undo block.
Definition: docundo.cxx:265
virtual void EmptyActionsChanged() override
Definition: docundo.cxx:642
bool const m_bSaveCursor
Definition: docundo.cxx:557
OUString GetUndoComment(SwUndoId eId)
Definition: undobj.cxx:265
virtual bool CanRepeat(SfxRepeatTarget &) const
virtual void DoGroupUndo(bool const bDoUndo) override
Enable/Disable Group Undo.
Definition: docundo.cxx:173
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
SwPaM * m_pCurrentPaM
Definition: UndoCore.hxx:138
const SwView * GetView() const
Definition: docsh.hxx:219
SwUndo * RemoveLastUndo()
Definition: docundo.cxx:494
virtual void ClearRedo() override
Delete all Redo actions.
Definition: docundo.cxx:250
virtual bool Repeat(::sw::RepeatContext &rContext, sal_uInt16 const nRepeatCnt) override
N.B.
Definition: docundo.cxx:655
bool Pop(PopMode)
delete cursor
Definition: crsrsh.cxx:2165
virtual bool DoesUndo() const override
Is Undo enabled?
Definition: docundo.cxx:161
virtual bool GetFirstRedoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const override
Get Id and comment of first Redo action.
Definition: docundo.cxx:416
~CursorGuard() COVERITY_NOEXCEPT_FALSE
Definition: docundo.cxx:548
no RedlineFlags
Definition: view.hxx:146
ViewShellId GetViewShellId() const override
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo) override
Add new Undo action.
Definition: docundo.cxx:245
virtual void ResetModified()=0