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_SWUNDOFMT_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_SWUNDOFMT_HXX
25 #include <numrule.hxx>
29 class SwTextFormatColl
;
30 class SwConditionTextFormatColl
;
33 class SwUndoFormatCreate
: public SwUndo
37 OUString m_sDerivedFrom
;
39 mutable OUString m_sNewName
;
40 std::unique_ptr
<SfxItemSet
> m_pNewSet
;
41 sal_uInt16 m_nId
; // FormatId related
45 SwUndoFormatCreate(SwUndoId nUndoId
, SwFormat
* pNew
, SwFormat
const * pDerivedFrom
,
47 virtual ~SwUndoFormatCreate() override
;
49 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
50 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
52 virtual SwRewriter
GetRewriter() const override
;
54 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) = 0;
55 virtual void Delete() = 0;
56 virtual SwFormat
* Find(const OUString
& rName
) const = 0;
59 class SwUndoFormatDelete
: public SwUndo
62 OUString m_sDerivedFrom
;
66 sal_uInt16 m_nId
; // FormatId related
70 SwUndoFormatDelete(SwUndoId nUndoId
, SwFormat
const * pOld
, SwDoc
& rDoc
);
71 virtual ~SwUndoFormatDelete() override
;
73 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
74 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
76 virtual SwRewriter
GetRewriter() const override
;
78 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) = 0;
79 virtual void Delete(SwFormat
* pFormat
) = 0;
80 virtual SwFormat
* Find(const OUString
& rName
) const = 0;
83 class SwUndoRenameFormat
: public SwUndo
86 OUString m_sOldName
, m_sNewName
;
90 SwUndoRenameFormat(SwUndoId nUndoId
, OUString sOldName
,
93 virtual ~SwUndoRenameFormat() override
;
95 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
96 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
98 SwRewriter
GetRewriter() const override
;
100 virtual SwFormat
* Find(const OUString
& rName
) const = 0;
103 class SwUndoTextFormatCollCreate
: public SwUndoFormatCreate
106 SwUndoTextFormatCollCreate(SwTextFormatColl
* pNew
, SwTextFormatColl
const * pDerivedFrom
,
109 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
110 virtual void Delete() override
;
111 virtual SwFormat
* Find(const OUString
& rName
) const override
;
114 class SwUndoTextFormatCollDelete
: public SwUndoFormatDelete
117 SwUndoTextFormatCollDelete(SwTextFormatColl
const * pOld
, SwDoc
& rDoc
);
119 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
120 virtual void Delete(SwFormat
* pFormat
) override
;
121 virtual SwFormat
* Find(const OUString
& rName
) const override
;
124 class SwUndoCondTextFormatCollCreate final
: public SwUndoTextFormatCollCreate
127 SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl
* pNew
, SwTextFormatColl
const * pDerivedFrom
, SwDoc
& rDoc
);
128 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
131 class SwUndoCondTextFormatCollDelete final
: public SwUndoTextFormatCollDelete
134 SwUndoCondTextFormatCollDelete(SwTextFormatColl
const * pOld
, SwDoc
& rDoc
);
135 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
138 class SwUndoRenameFormatColl final
: public SwUndoRenameFormat
141 SwUndoRenameFormatColl(const OUString
& sOldName
,
142 const OUString
& sNewName
,
145 virtual SwFormat
* Find(const OUString
& rName
) const override
;
148 class SwUndoCharFormatCreate final
: public SwUndoFormatCreate
151 SwUndoCharFormatCreate(SwCharFormat
* pNew
, SwCharFormat
const * pDerivedFrom
,
154 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
155 virtual void Delete() override
;
156 virtual SwFormat
* Find(const OUString
& rName
) const override
;
159 class SwUndoCharFormatDelete final
: public SwUndoFormatDelete
162 SwUndoCharFormatDelete(SwCharFormat
const * pOld
, SwDoc
& rDoc
);
164 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
165 virtual void Delete(SwFormat
* pFormat
) override
;
166 virtual SwFormat
* Find(const OUString
& rName
) const override
;
169 class SwUndoRenameCharFormat final
: public SwUndoRenameFormat
172 SwUndoRenameCharFormat(const OUString
& sOldName
,
173 const OUString
& sNewName
,
176 virtual SwFormat
* Find(const OUString
& rName
) const override
;
179 class SwUndoFrameFormatCreate final
: public SwUndoFormatCreate
182 SwUndoFrameFormatCreate(SwFrameFormat
* pNew
, SwFrameFormat
const * pDerivedFrom
,
185 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
186 virtual void Delete() override
;
187 virtual SwFormat
* Find(const OUString
& rName
) const override
;
190 class SwUndoFrameFormatDelete final
: public SwUndoFormatDelete
193 SwUndoFrameFormatDelete(SwFrameFormat
const * pOld
, SwDoc
& rDoc
);
195 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
196 virtual void Delete(SwFormat
* pFormat
) override
;
197 virtual SwFormat
* Find(const OUString
& rName
) const override
;
200 class SwUndoRenameFrameFormat final
: public SwUndoRenameFormat
203 SwUndoRenameFrameFormat(const OUString
& sOldName
,
204 const OUString
& sNewName
,
207 virtual SwFormat
* Find(const OUString
& rName
) const override
;
210 class SwUndoNumruleCreate final
: public SwUndo
212 const SwNumRule
* m_pNew
;
213 mutable SwNumRule m_aNew
;
215 mutable bool m_bInitialized
;
218 SwUndoNumruleCreate(const SwNumRule
* pNew
, SwDoc
& rDoc
);
220 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
221 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
223 SwRewriter
GetRewriter() const override
;
226 class SwUndoNumruleDelete final
: public SwUndo
232 SwUndoNumruleDelete(const SwNumRule
& rRule
, SwDoc
& rDoc
);
234 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
235 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
237 SwRewriter
GetRewriter() const override
;
240 class SwUndoNumruleRename final
: public SwUndo
242 OUString m_aOldName
, m_aNewName
;
246 SwUndoNumruleRename(OUString aOldName
, OUString aNewName
,
249 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
250 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
252 SwRewriter
GetRewriter() const override
;
255 #endif // INCLUDED_SW_SOURCE_CORE_INC_SWUNDOFMT_HXX
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */