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>
28 class SwTextFormatColl
;
29 class SwConditionTextFormatColl
;
32 class SwUndoFormatCreate
: public SwUndo
36 OUString m_sDerivedFrom
;
38 mutable OUString m_sNewName
;
39 SfxItemSet
* m_pNewSet
;
40 sal_uInt16 m_nId
; // FormatId related
44 SwUndoFormatCreate(SwUndoId nUndoId
, SwFormat
* pNew
, SwFormat
const * pDerivedFrom
,
46 virtual ~SwUndoFormatCreate() override
;
48 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
49 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
51 virtual SwRewriter
GetRewriter() const override
;
53 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) = 0;
54 virtual void Delete() = 0;
55 virtual SwFormat
* Find(const OUString
& rName
) const = 0;
58 class SwUndoFormatDelete
: public SwUndo
61 OUString m_sDerivedFrom
;
65 sal_uInt16 m_nId
; // FormatId related
69 SwUndoFormatDelete(SwUndoId nUndoId
, SwFormat
const * pOld
, SwDoc
& rDoc
);
70 virtual ~SwUndoFormatDelete() override
;
72 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
73 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
75 virtual SwRewriter
GetRewriter() const override
;
77 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) = 0;
78 virtual void Delete(SwFormat
* pFormat
) = 0;
79 virtual SwFormat
* Find(const OUString
& rName
) const = 0;
82 class SwUndoRenameFormat
: public SwUndo
85 OUString m_sOldName
, m_sNewName
;
89 SwUndoRenameFormat(SwUndoId nUndoId
, const OUString
& sOldName
,
90 const OUString
& sNewName
,
92 virtual ~SwUndoRenameFormat() override
;
94 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
95 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
97 SwRewriter
GetRewriter() const override
;
99 virtual SwFormat
* Find(const OUString
& rName
) const = 0;
102 class SwUndoTextFormatCollCreate
: public SwUndoFormatCreate
105 SwUndoTextFormatCollCreate(SwTextFormatColl
* pNew
, SwTextFormatColl
const * pDerivedFrom
,
108 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
109 virtual void Delete() override
;
110 virtual SwFormat
* Find(const OUString
& rName
) const override
;
113 class SwUndoTextFormatCollDelete
: public SwUndoFormatDelete
116 SwUndoTextFormatCollDelete(SwTextFormatColl
const * pOld
, SwDoc
& rDoc
);
118 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
119 virtual void Delete(SwFormat
* pFormat
) override
;
120 virtual SwFormat
* Find(const OUString
& rName
) const override
;
123 class SwUndoCondTextFormatCollCreate
: public SwUndoTextFormatCollCreate
126 SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl
* pNew
, SwTextFormatColl
const * pDerivedFrom
, SwDoc
& rDoc
);
127 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
130 class SwUndoCondTextFormatCollDelete
: public SwUndoTextFormatCollDelete
133 SwUndoCondTextFormatCollDelete(SwTextFormatColl
const * pOld
, SwDoc
& rDoc
);
134 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
137 class SwUndoRenameFormatColl
: public SwUndoRenameFormat
140 SwUndoRenameFormatColl(const OUString
& sOldName
,
141 const OUString
& sNewName
,
144 virtual SwFormat
* Find(const OUString
& rName
) const override
;
147 class SwUndoCharFormatCreate
: public SwUndoFormatCreate
150 SwUndoCharFormatCreate(SwCharFormat
* pNew
, SwCharFormat
const * pDerivedFrom
,
153 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
154 virtual void Delete() override
;
155 virtual SwFormat
* Find(const OUString
& rName
) const override
;
158 class SwUndoCharFormatDelete
: public SwUndoFormatDelete
161 SwUndoCharFormatDelete(SwCharFormat
const * pOld
, SwDoc
& rDoc
);
163 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
164 virtual void Delete(SwFormat
* pFormat
) override
;
165 virtual SwFormat
* Find(const OUString
& rName
) const override
;
168 class SwUndoRenameCharFormat
: public SwUndoRenameFormat
171 SwUndoRenameCharFormat(const OUString
& sOldName
,
172 const OUString
& sNewName
,
175 virtual SwFormat
* Find(const OUString
& rName
) const override
;
178 class SwUndoFrameFormatCreate
: public SwUndoFormatCreate
181 SwUndoFrameFormatCreate(SwFrameFormat
* pNew
, SwFrameFormat
const * pDerivedFrom
,
184 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
185 virtual void Delete() override
;
186 virtual SwFormat
* Find(const OUString
& rName
) const override
;
189 class SwUndoFrameFormatDelete
: public SwUndoFormatDelete
192 SwUndoFrameFormatDelete(SwFrameFormat
const * pOld
, SwDoc
& rDoc
);
194 virtual SwFormat
* Create(SwFormat
* pDerivedFrom
) override
;
195 virtual void Delete(SwFormat
* pFormat
) override
;
196 virtual SwFormat
* Find(const OUString
& rName
) const override
;
199 class SwUndoRenameFrameFormat
: public SwUndoRenameFormat
202 SwUndoRenameFrameFormat(const OUString
& sOldName
,
203 const OUString
& sNewName
,
206 virtual SwFormat
* Find(const OUString
& rName
) const override
;
209 class SwUndoNumruleCreate
: public SwUndo
211 const SwNumRule
* m_pNew
;
212 mutable SwNumRule m_aNew
;
214 mutable bool m_bInitialized
;
217 SwUndoNumruleCreate(const SwNumRule
* pNew
, SwDoc
& rDoc
);
219 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
220 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
222 SwRewriter
GetRewriter() const override
;
225 class SwUndoNumruleDelete
: public SwUndo
231 SwUndoNumruleDelete(const SwNumRule
& rRule
, SwDoc
& rDoc
);
233 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
234 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
236 SwRewriter
GetRewriter() const override
;
239 class SwUndoNumruleRename
: public SwUndo
241 OUString m_aOldName
, m_aNewName
;
245 SwUndoNumruleRename(const OUString
& aOldName
, const OUString
& aNewName
,
248 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
249 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
251 SwRewriter
GetRewriter() const override
;
254 #endif // INCLUDED_SW_SOURCE_CORE_INC_SWUNDOFMT_HXX
256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */