LibreOffice Module sw (master)  1
SwUndoFmt.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_SOURCE_CORE_INC_SWUNDOFMT_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_SWUNDOFMT_HXX
22 
23 #include <undobj.hxx>
24 #include <swundo.hxx>
25 #include <numrule.hxx>
26 #include <memory>
27 
28 class SwDoc;
29 class SwTextFormatColl;
31 class SwRewriter;
32 
33 class SwUndoFormatCreate : public SwUndo
34 {
35 protected:
37  OUString m_sDerivedFrom;
39  mutable OUString m_sNewName;
40  std::unique_ptr<SfxItemSet> m_pNewSet;
41  sal_uInt16 m_nId; // FormatId related
42  bool m_bAuto;
43 
44 public:
45  SwUndoFormatCreate(SwUndoId nUndoId, SwFormat * pNew, SwFormat const * pDerivedFrom,
46  SwDoc& rDoc);
47  virtual ~SwUndoFormatCreate() override;
48 
49  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
50  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
51 
52  virtual SwRewriter GetRewriter() const override;
53 
54  virtual SwFormat * Create(SwFormat * pDerivedFrom) = 0;
55  virtual void Delete() = 0;
56  virtual SwFormat * Find(const OUString & rName) const = 0;
57 };
58 
59 class SwUndoFormatDelete : public SwUndo
60 {
61 protected:
62  OUString m_sDerivedFrom;
64  OUString m_sOldName;
66  sal_uInt16 m_nId; // FormatId related
67  bool m_bAuto;
68 
69 public:
70  SwUndoFormatDelete(SwUndoId nUndoId, SwFormat const * pOld, SwDoc& rDoc);
71  virtual ~SwUndoFormatDelete() override;
72 
73  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
74  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
75 
76  virtual SwRewriter GetRewriter() const override;
77 
78  virtual SwFormat * Create(SwFormat * pDerivedFrom) = 0;
79  virtual void Delete(SwFormat * pFormat) = 0;
80  virtual SwFormat * Find(const OUString & rName) const = 0;
81 };
82 
83 class SwUndoRenameFormat : public SwUndo
84 {
85 protected:
88 
89 public:
90  SwUndoRenameFormat(SwUndoId nUndoId, const OUString & sOldName,
91  const OUString & sNewName,
92  SwDoc& rDoc);
93  virtual ~SwUndoRenameFormat() override;
94 
95  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
96  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
97 
98  SwRewriter GetRewriter() const override;
99 
100  virtual SwFormat * Find(const OUString & rName) const = 0;
101 };
102 
104 {
105 public:
106  SwUndoTextFormatCollCreate(SwTextFormatColl * pNew, SwTextFormatColl const * pDerivedFrom,
107  SwDoc& rDoc);
108 
109  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
110  virtual void Delete() override;
111  virtual SwFormat * Find(const OUString & rName) const override;
112 };
113 
115 {
116 public:
118 
119  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
120  virtual void Delete(SwFormat * pFormat) override;
121  virtual SwFormat * Find(const OUString & rName) const override;
122 };
123 
125 {
126 public:
128  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
129 };
130 
132 {
133 public:
135  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
136 };
137 
139 {
140 public:
141  SwUndoRenameFormatColl(const OUString & sOldName,
142  const OUString & sNewName,
143  SwDoc& rDoc);
144 
145  virtual SwFormat * Find(const OUString & rName) const override;
146 };
147 
149 {
150 public:
151  SwUndoCharFormatCreate(SwCharFormat * pNew, SwCharFormat const * pDerivedFrom,
152  SwDoc& rDoc);
153 
154  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
155  virtual void Delete() override;
156  virtual SwFormat * Find(const OUString & rName) const override;
157 };
158 
160 {
161 public:
162  SwUndoCharFormatDelete(SwCharFormat const * pOld, SwDoc& rDoc);
163 
164  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
165  virtual void Delete(SwFormat * pFormat) override;
166  virtual SwFormat * Find(const OUString & rName) const override;
167 };
168 
170 {
171 public:
172  SwUndoRenameCharFormat(const OUString & sOldName,
173  const OUString & sNewName,
174  SwDoc& rDoc);
175 
176  virtual SwFormat * Find(const OUString & rName) const override;
177 };
178 
180 {
181 public:
182  SwUndoFrameFormatCreate(SwFrameFormat * pNew, SwFrameFormat const * pDerivedFrom,
183  SwDoc& rDoc);
184 
185  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
186  virtual void Delete() override;
187  virtual SwFormat * Find(const OUString & rName) const override;
188 };
189 
191 {
192 public:
193  SwUndoFrameFormatDelete(SwFrameFormat const * pOld, SwDoc& rDoc);
194 
195  virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
196  virtual void Delete(SwFormat * pFormat) override;
197  virtual SwFormat * Find(const OUString & rName) const override;
198 };
199 
201 {
202 public:
203  SwUndoRenameFrameFormat(const OUString & sOldName,
204  const OUString & sNewName,
205  SwDoc& rDoc);
206 
207  virtual SwFormat * Find(const OUString & rName) const override;
208 };
209 
210 class SwUndoNumruleCreate final : public SwUndo
211 {
212  const SwNumRule * m_pNew;
213  mutable SwNumRule m_aNew;
215  mutable bool m_bInitialized;
216 
217 public:
218  SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc& rDoc);
219 
220  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
221  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
222 
223  SwRewriter GetRewriter() const override;
224 };
225 
226 class SwUndoNumruleDelete final : public SwUndo
227 {
230 
231 public:
232  SwUndoNumruleDelete(const SwNumRule& rRule, SwDoc& rDoc);
233 
234  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
235  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
236 
237  SwRewriter GetRewriter() const override;
238 };
239 
240 class SwUndoNumruleRename final : public SwUndo
241 {
244 
245  public:
246  SwUndoNumruleRename(const OUString & aOldName, const OUString & aNewName,
247  SwDoc& rDoc);
248 
249  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
250  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
251 
252  SwRewriter GetRewriter() const override;
253 };
254 
255 #endif // INCLUDED_SW_SOURCE_CORE_INC_SWUNDOFMT_HXX
256 
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwFormat * m_pNew
Definition: SwUndoFmt.hxx:36
SwUndoRenameFrameFormat(const OUString &sOldName, const OUString &sNewName, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:362
virtual ~SwUndoFormatCreate() override
Definition: SwUndoFmt.cxx:40
virtual void Delete(SwFormat *pFormat) override
Definition: SwUndoFmt.cxx:352
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:159
SwUndoId
Definition: swundo.hxx:29
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:369
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:127
SwUndoFrameFormatCreate(SwFrameFormat *pNew, SwFrameFormat const *pDerivedFrom, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:320
SwUndoCondTextFormatCollDelete(SwTextFormatColl const *pOld, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:243
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:169
sal_uInt16 m_nId
Definition: SwUndoFmt.hxx:41
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:238
SfxItemSet m_aOldSet
Definition: SwUndoFmt.hxx:65
OUString m_sDerivedFrom
Definition: SwUndoFmt.hxx:37
Definition: doc.hxx:188
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:217
virtual void Delete(SwFormat *pFormat) override
Definition: SwUndoFmt.cxx:222
SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl *pNew, SwTextFormatColl const *pDerivedFrom, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:232
virtual void Delete()=0
virtual void Delete(SwFormat *pFormat)=0
virtual ~SwUndoRenameFormat() override
Definition: SwUndoFmt.cxx:155
virtual SwFormat * Create(SwFormat *pDerivedFrom)=0
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:337
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:249
sal_uInt16 m_nId
Definition: SwUndoFmt.hxx:66
Base class for various Writer styles.
Definition: format.hxx:46
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:392
SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: SwUndoFmt.cxx:455
OUString m_sOldName
Definition: SwUndoFmt.hxx:86
Style of a layout element.
Definition: frmfmt.hxx:59
SwUndoNumruleCreate(const SwNumRule *pNew, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:374
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:418
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:273
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:450
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:111
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:315
OUString m_sNewName
Definition: SwUndoFmt.hxx:39
SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: SwUndoFmt.cxx:179
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:423
virtual SwFormat * Find(const OUString &rName) const =0
virtual void Delete() override
Definition: SwUndoFmt.cxx:278
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:65
Represents the style of a text portion.
Definition: charfmt.hxx:26
SwUndoTextFormatCollDelete(SwTextFormatColl const *pOld, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:211
OUString m_sDerivedFrom
Definition: SwUndoFmt.hxx:62
virtual void Delete() override
Definition: SwUndoFmt.cxx:201
SwUndoCharFormatCreate(SwCharFormat *pNew, SwCharFormat const *pDerivedFrom, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:266
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:347
virtual SwFormat * Find(const OUString &rName) const =0
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:445
const SwNumRule * m_pNew
Definition: SwUndoFmt.hxx:212
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:283
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:381
virtual ~SwUndoFormatDelete() override
Definition: SwUndoFmt.cxx:107
OUString m_sOldName
Definition: SwUndoFmt.hxx:64
SwUndoFormatDelete(SwUndoId nUndoId, SwFormat const *pOld, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:97
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:327
SwUndoCharFormatDelete(SwCharFormat const *pOld, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:288
SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: SwUndoFmt.cxx:428
SwUndoFrameFormatDelete(SwFrameFormat const *pOld, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:342
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:293
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: SwUndoFmt.cxx:44
SwUndoRenameCharFormat(const OUString &sOldName, const OUString &sNewName, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:308
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:357
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:206
virtual void Delete() override
Definition: SwUndoFmt.cxx:332
SwUndoRenameFormatColl(const OUString &sOldName, const OUString &sNewName, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:254
SwUndoTextFormatCollCreate(SwTextFormatColl *pNew, SwTextFormatColl const *pDerivedFrom, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:191
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: SwUndoFmt.cxx:84
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:303
virtual void Delete(SwFormat *pFormat) override
Definition: SwUndoFmt.cxx:298
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:227
SwUndoFormatCreate(SwUndoId nUndoId, SwFormat *pNew, SwFormat const *pDerivedFrom, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:32
OUString m_sNewName
Definition: SwUndoFmt.hxx:86
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: SwUndoFmt.cxx:137
virtual SwFormat * Find(const OUString &rName) const =0
SwUndoNumruleRename(const OUString &aOldName, const OUString &aNewName, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:437
SwUndoRenameFormat(SwUndoId nUndoId, const OUString &sOldName, const OUString &sNewName, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:146
SwUndoNumruleDelete(const SwNumRule &rRule, SwDoc &rDoc)
Definition: SwUndoFmt.cxx:412
std::unique_ptr< SfxItemSet > m_pNewSet
Definition: SwUndoFmt.hxx:40
virtual SwFormat * Create(SwFormat *pDerivedFrom)=0
SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: SwUndoFmt.cxx:397
virtual SwFormat * Create(SwFormat *pDerivedFrom) override
Definition: SwUndoFmt.cxx:196
virtual SwFormat * Find(const OUString &rName) const override
Definition: SwUndoFmt.cxx:261