LibreOffice Module sw (master) 1
IDocumentUndoRedo.hxx
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#ifndef INCLUDED_SW_INC_IDOCUMENTUNDOREDO_HXX
21#define INCLUDED_SW_INC_IDOCUMENTUNDOREDO_HXX
22
23#include <sal/types.h>
24
25#include "swundo.hxx"
26#include <memory>
27
28class SwRewriter;
29class SwNodes;
30class SwUndo;
31class SwView;
32
33namespace sw {
34 class RepeatContext;
35}
36
38{
39public:
40
43 virtual void DoUndo(bool const bDoUndo) = 0;
44
47 virtual bool DoesUndo() const = 0;
48
53 virtual void DoGroupUndo(bool const bDoUndo) = 0;
54
57 virtual bool DoesGroupUndo() const = 0;
58
61 virtual void DoDrawUndo(bool const bDoUndo) = 0;
62
66 virtual bool DoesDrawUndo() const = 0;
67
69 virtual void DoRepair(bool bRepair) = 0;
71 virtual bool DoesRepair() const = 0;
72
76 virtual void SetUndoNoModifiedPosition() = 0;
77
81 virtual void LockUndoNoModifiedPosition() = 0;
82
86 virtual void UnLockUndoNoModifiedPosition() = 0;
87
90 virtual void SetUndoNoResetModified() = 0;
91
94 virtual bool IsUndoNoResetModified() const = 0;
95
100 virtual bool Undo() = 0;
101
114 virtual SwUndoId StartUndo(SwUndoId const eUndoId,
115 SwRewriter const*const pRewriter) = 0;
116
133 virtual SwUndoId EndUndo(SwUndoId const eUndoId,
134 SwRewriter const*const pRewriter) = 0;
135
140 virtual void DelAllUndoObj() = 0;
141
148 virtual bool GetLastUndoInfo(OUString *const o_pStr,
149 SwUndoId *const o_pId,
150 const SwView* pView = nullptr) const = 0;
151
156
161 virtual bool Redo() = 0;
162
169 virtual bool GetFirstRedoInfo(OUString *const o_pStr,
170 SwUndoId *const o_pId,
171 const SwView* pView = nullptr) const = 0;
172
177
181 virtual bool Repeat(::sw::RepeatContext & rContext,
182 sal_uInt16 const nRepeatCnt) = 0;
183
190 virtual SwUndoId GetRepeatInfo(OUString *const o_pStr) const = 0;
191
197 virtual void AppendUndo(std::unique_ptr<SwUndo> pUndo) = 0;
198
201 virtual void ClearRedo() = 0;
202
203 /* Is the given nodes array the Undo nodes array?
204 */
205 virtual bool IsUndoNodes(SwNodes const& rNodes) const = 0;
206
209 virtual size_t GetUndoActionCount(const bool bCurrentLevel = true) const = 0;
210
213 virtual void SetView(SwView* pView) = 0;
214
216 virtual bool UndoWithOffset(size_t nUndoOffset) = 0;
217
218protected:
219 virtual ~IDocumentUndoRedo() {};
220};
221
222namespace sw {
223
225{
226public:
227
229 : m_rUndoRedo(rUndoRedo)
230 , m_bUndoWasEnabled(rUndoRedo.DoesUndo())
231 {
232 m_rUndoRedo.DoUndo(false);
233 }
235 {
237 }
238
239 bool UndoWasEnabled() const
240 {
241 return m_bUndoWasEnabled;
242 }
243
244private:
247};
248
251{
252public:
253
255 : m_rUndoRedo(rUndoRedo)
256 , m_bGroupUndoWasEnabled(rUndoRedo.DoesGroupUndo())
257 {
259 }
261 {
263 }
264
265private:
268};
269
271{
272public:
273
275 : m_rUndoRedo(rUndoRedo)
276 , m_bDrawUndoWasEnabled(rUndoRedo.DoesDrawUndo())
277 {
278 m_rUndoRedo.DoDrawUndo(false);
279 }
281 {
283 }
284
285private:
288};
289
290} // namespace sw
291
292#endif
293
294/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DoGroupUndo(bool const bDoUndo)=0
Enable/Disable Group Undo.
virtual bool IsUndoNodes(SwNodes const &rNodes) const =0
virtual bool UndoWithOffset(size_t nUndoOffset)=0
Zero offset means undoing the top undo action.
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual bool DoesUndo() const =0
Is Undo enabled?
virtual void LockUndoNoModifiedPosition()=0
Prevent updates to the "unmodified" state position via SetUndoNoResetModified().
virtual SwUndoComments_t GetUndoComments() const =0
Get comments of Undo actions.
virtual bool Redo()=0
Execute Redo.
virtual bool GetFirstRedoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const =0
Get Id and comment of first Redo action.
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
virtual SwUndoComments_t GetRedoComments() const =0
Get comments of Redo actions.
virtual bool Undo()=0
Execute Undo.
virtual void SetUndoNoModifiedPosition()=0
Set the position at which the document is in the "unmodified" state to the current position in the Un...
virtual void DoDrawUndo(bool const bDoUndo)=0
Enable/Disable Undo for Drawing objects.
virtual void SetView(SwView *pView)=0
Return undo/redo info for this view.
virtual bool DoesDrawUndo() const =0
Is Undo for Drawing objects enabled? for Draw-Undo: writer wants to handle actions on Flys on its own...
virtual void DoRepair(bool bRepair)=0
Enable repair mode.
virtual bool Repeat(::sw::RepeatContext &rContext, sal_uInt16 const nRepeatCnt)=0
Repeat the last Undo action.
virtual void DelAllUndoObj()=0
Delete all Undo actions.
virtual void ClearRedo()=0
Delete all Redo actions.
virtual bool DoesGroupUndo() const =0
Is Group Undo enabled?
virtual size_t GetUndoActionCount(const bool bCurrentLevel=true) const =0
Get the number of Undo actions.
virtual bool IsUndoNoResetModified() const =0
Is setting the document modified flag on Undo/Redo disabled?
virtual void SetUndoNoResetModified()=0
Disable (re)setting the document modified flag on Undo/Redo.
virtual SwUndoId GetRepeatInfo(OUString *const o_pStr) const =0
Get Id and comment of last Undo action, if it is Repeat capable.
virtual bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const =0
Get Id and comment of last Undo action.
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
virtual bool DoesRepair() const =0
Is repair mode active?
virtual void UnLockUndoNoModifiedPosition()=0
Allow updates to the "unmodified" state position via SetUndoNoResetModified().
Definition: view.hxx:146
IDocumentUndoRedo & m_rUndoRedo
DrawUndoGuard(IDocumentUndoRedo &rUndoRedo)
bool const m_bDrawUndoWasEnabled
Blocks grouping undo actions together into an SfxListUndoAction.
GroupUndoGuard(IDocumentUndoRedo &rUndoRedo)
bool const m_bGroupUndoWasEnabled
IDocumentUndoRedo & m_rUndoRedo
IDocumentUndoRedo & m_rUndoRedo
UndoGuard(IDocumentUndoRedo &rUndoRedo)
bool UndoWasEnabled() const
bool const m_bUndoWasEnabled
Dialog to specify the properties of date form field.
SwUndoId
Definition: swundo.hxx:30
std::vector< OUString > SwUndoComments_t
Definition: swundo.hxx:26