1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDOBOOKMARK_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOBOOKMARK_HXX
27 class SwHistoryBookmark
;
28 class SwHistoryNoTextFieldmark
;
29 class SwHistoryTextFieldmark
;
39 class SwUndoBookmark
: public SwUndo
41 const std::unique_ptr
<SwHistoryBookmark
> m_pHistoryBookmark
;
44 SwUndoBookmark(SwUndoId nUndoId
, const ::sw::mark::IMark
&);
46 void SetInDoc(SwDoc
*);
47 void ResetInDoc(SwDoc
&);
50 virtual ~SwUndoBookmark() override
;
53 Returns the rewriter for this undo object.
55 The rewriter contains the following rule:
57 $1 -> <name of bookmark>
59 <name of bookmark> is the name of the bookmark whose
60 insertion/deletion is recorded by this undo object.
62 @return the rewriter for this undo object
64 virtual SwRewriter
GetRewriter() const override
;
67 class SwUndoInsBookmark final
: public SwUndoBookmark
70 SwUndoInsBookmark(const ::sw::mark::IMark
&);
72 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
73 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
76 class SwUndoDeleteBookmark final
: public SwUndoBookmark
79 SwUndoDeleteBookmark(const ::sw::mark::IMark
&);
81 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
82 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
85 class SwUndoRenameBookmark final
: public SwUndo
87 const OUString m_sOldName
;
88 const OUString m_sNewName
;
91 SwUndoRenameBookmark(OUString aOldName
, OUString aNewName
, const SwDoc
& rDoc
);
92 virtual ~SwUndoRenameBookmark() override
;
95 virtual SwRewriter
GetRewriter() const override
;
96 static void Rename(::sw::UndoRedoContext
const&, const OUString
& sFrom
, const OUString
& sTo
);
97 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
98 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
101 /// Handling undo / redo of checkbox and drop-down form field insertion
102 class SwUndoInsNoTextFieldmark final
: public SwUndo
105 const std::unique_ptr
<SwHistoryNoTextFieldmark
> m_pHistoryNoTextFieldmark
;
108 SwUndoInsNoTextFieldmark(const ::sw::mark::IFieldmark
& rFieldmark
);
110 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
111 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
114 /// Handling undo / redo of checkbox and drop-down form field deletion
115 class SwUndoDelNoTextFieldmark final
: public SwUndo
118 const std::unique_ptr
<SwHistoryNoTextFieldmark
> m_pHistoryNoTextFieldmark
;
121 SwUndoDelNoTextFieldmark(const ::sw::mark::IFieldmark
& rFieldmark
);
122 ~SwUndoDelNoTextFieldmark();
124 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
125 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
128 /// Handling undo / redo of text form field insertion
129 class SwUndoInsTextFieldmark final
: public SwUndo
132 const std::unique_ptr
<SwHistoryTextFieldmark
> m_pHistoryTextFieldmark
;
135 SwUndoInsTextFieldmark(const ::sw::mark::IFieldmark
& rFieldmark
);
137 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
138 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
141 /// Handling undo / redo of text form field deletion
142 class SwUndoDelTextFieldmark final
: public SwUndo
145 const std::unique_ptr
<SwHistoryTextFieldmark
> m_pHistoryTextFieldmark
;
148 SwUndoDelTextFieldmark(const ::sw::mark::IFieldmark
& rFieldmark
);
149 ~SwUndoDelTextFieldmark();
151 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
152 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
155 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOBOOKMARK_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */