Branch data Line data Source code
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 SW_UNDO_MANAGER_HXX
21 : : #define SW_UNDO_MANAGER_HXX
22 : :
23 : : #include <IDocumentUndoRedo.hxx>
24 : : #include <memory>
25 : : #include <svl/undo.hxx>
26 : :
27 : : class IDocumentDrawModelAccess;
28 : : class IDocumentRedlineAccess;
29 : : class IDocumentState;
30 : :
31 : : namespace sw {
32 : :
33 [ + - ][ + - ]: 2916 : class UndoManager
[ - + ]
34 : : : public IDocumentUndoRedo
35 : : , public SfxUndoManager
36 : : {
37 : : public:
38 : : UndoManager(::std::auto_ptr<SwNodes> pUndoNodes,
39 : : IDocumentDrawModelAccess & rDrawModelAccess,
40 : : IDocumentRedlineAccess & rRedlineAccess,
41 : : IDocumentState & rState);
42 : :
43 : : /** IDocumentUndoRedo */
44 : : virtual void DoUndo(bool const bDoUndo);
45 : : virtual bool DoesUndo() const;
46 : : virtual void DoGroupUndo(bool const bDoUndo);
47 : : virtual bool DoesGroupUndo() const;
48 : : virtual void DoDrawUndo(bool const bDoUndo);
49 : : virtual bool DoesDrawUndo() const;
50 : : virtual void SetUndoNoModifiedPosition();
51 : : virtual void LockUndoNoModifiedPosition();
52 : : virtual void UnLockUndoNoModifiedPosition();
53 : : virtual void SetUndoNoResetModified();
54 : : virtual bool IsUndoNoResetModified() const;
55 : :
56 : : virtual SwUndoId StartUndo(SwUndoId const eUndoId,
57 : : SwRewriter const*const pRewriter);
58 : : virtual SwUndoId EndUndo(SwUndoId const eUndoId,
59 : : SwRewriter const*const pRewriter);
60 : : virtual void DelAllUndoObj();
61 : : virtual bool GetLastUndoInfo(::rtl::OUString *const o_pStr,
62 : : SwUndoId *const o_pId) const;
63 : : virtual SwUndoComments_t GetUndoComments() const;
64 : :
65 : : virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const;
66 : : virtual SwUndoComments_t GetRedoComments() const;
67 : : virtual bool Repeat(::sw::RepeatContext & rContext,
68 : : sal_uInt16 const nRepeatCnt);
69 : : virtual SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const;
70 : : virtual void AppendUndo(SwUndo *const pUndo);
71 : : virtual void ClearRedo();
72 : : virtual bool IsUndoNodes(SwNodes const& rNodes) const;
73 : :
74 : : // ::svl::IUndoManager
75 : : virtual void AddUndoAction(SfxUndoAction *pAction,
76 : : sal_Bool bTryMerg = sal_False);
77 : : virtual sal_Bool Undo();
78 : : virtual sal_Bool Redo();
79 : : virtual void EnableUndo(bool bEnable);
80 : :
81 : : SwUndo * RemoveLastUndo();
82 : : SwUndo * GetLastUndo();
83 : :
84 : : SwNodes const& GetUndoNodes() const;
85 : : SwNodes & GetUndoNodes();
86 : :
87 : : private:
88 : : IDocumentDrawModelAccess & m_rDrawModelAccess;
89 : : IDocumentRedlineAccess & m_rRedlineAccess;
90 : : IDocumentState & m_rState;
91 : :
92 : : /// Undo nodes array: content not currently in document
93 : : ::std::auto_ptr<SwNodes> m_pUndoNodes;
94 : :
95 : : bool m_bGroupUndo : 1; // TRUE: Undo grouping enabled
96 : : bool m_bDrawUndo : 1; // TRUE: Draw Undo enabled
97 : : bool m_bLockUndoNoModifiedPosition : 1;
98 : : /// position in Undo-Array at which Doc was saved (and is not modified)
99 : : UndoStackMark m_UndoSaveMark;
100 : :
101 : : typedef enum { UNDO = true, REDO = false } UndoOrRedo_t;
102 : : bool impl_DoUndoRedo(UndoOrRedo_t const undoOrRedo);
103 : :
104 : : // UGLY: should not be called
105 : : using SfxUndoManager::Repeat;
106 : : };
107 : :
108 : : } // namespace sw
109 : :
110 : : #endif // SW_UNDO_MANAGER_HXX
111 : :
112 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|