Revert "reduce symbol visibility in sw"
[LibreOffice.git] / sw / source / core / inc / SwUndoFmt.hxx
blobc3f0a256f16cc030297f9d2bcc96ea06df5b6517
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <undobj.hxx>
24 #include <swundo.hxx>
25 #include <numrule.hxx>
26 #include <memory>
28 class SwDoc;
29 class SwTextFormatColl;
30 class SwConditionTextFormatColl;
31 class SwRewriter;
33 class SwUndoFormatCreate : public SwUndo
35 protected:
36 SwFormat * m_pNew;
37 OUString m_sDerivedFrom;
38 SwDoc& m_rDoc;
39 mutable OUString m_sNewName;
40 std::unique_ptr<SfxItemSet> m_pNewSet;
41 sal_uInt16 m_nId; // FormatId related
42 bool m_bAuto;
44 public:
45 SwUndoFormatCreate(SwUndoId nUndoId, SwFormat * pNew, SwFormat const * pDerivedFrom,
46 SwDoc& rDoc);
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
61 protected:
62 OUString m_sDerivedFrom;
63 SwDoc& m_rDoc;
64 OUString m_sOldName;
65 SfxItemSet m_aOldSet;
66 sal_uInt16 m_nId; // FormatId related
67 bool m_bAuto;
69 public:
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
85 protected:
86 OUString m_sOldName, m_sNewName;
87 SwDoc& m_rDoc;
89 public:
90 SwUndoRenameFormat(SwUndoId nUndoId, OUString sOldName,
91 OUString sNewName,
92 SwDoc& rDoc);
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
105 public:
106 SwUndoTextFormatCollCreate(SwTextFormatColl * pNew, SwTextFormatColl const * pDerivedFrom,
107 SwDoc& rDoc);
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
116 public:
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
126 public:
127 SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl * pNew, SwTextFormatColl const * pDerivedFrom, SwDoc& rDoc);
128 virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
131 class SwUndoCondTextFormatCollDelete final : public SwUndoTextFormatCollDelete
133 public:
134 SwUndoCondTextFormatCollDelete(SwTextFormatColl const * pOld, SwDoc& rDoc);
135 virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
138 class SwUndoRenameFormatColl final : public SwUndoRenameFormat
140 public:
141 SwUndoRenameFormatColl(const OUString & sOldName,
142 const OUString & sNewName,
143 SwDoc& rDoc);
145 virtual SwFormat * Find(const OUString & rName) const override;
148 class SwUndoCharFormatCreate final : public SwUndoFormatCreate
150 public:
151 SwUndoCharFormatCreate(SwCharFormat * pNew, SwCharFormat const * pDerivedFrom,
152 SwDoc& rDoc);
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
161 public:
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
171 public:
172 SwUndoRenameCharFormat(const OUString & sOldName,
173 const OUString & sNewName,
174 SwDoc& rDoc);
176 virtual SwFormat * Find(const OUString & rName) const override;
179 class SwUndoFrameFormatCreate final : public SwUndoFormatCreate
181 public:
182 SwUndoFrameFormatCreate(SwFrameFormat * pNew, SwFrameFormat const * pDerivedFrom,
183 SwDoc& rDoc);
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
192 public:
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
202 public:
203 SwUndoRenameFrameFormat(const OUString & sOldName,
204 const OUString & sNewName,
205 SwDoc& rDoc);
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;
214 SwDoc& m_rDoc;
215 mutable bool m_bInitialized;
217 public:
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
228 SwNumRule m_aOld;
229 SwDoc& m_rDoc;
231 public:
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;
243 SwDoc& m_rDoc;
245 public:
246 SwUndoNumruleRename(OUString aOldName, OUString aNewName,
247 SwDoc& rDoc);
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: */