Line data Source code
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 :
27 : class SwDoc;
28 : class SwTextFormatColl;
29 : class SwConditionTextFormatColl;
30 : class SwRewriter;
31 : class SfxItemSet;
32 :
33 : class SwUndoFormatCreate : public SwUndo
34 : {
35 : protected:
36 : SwFormat * pNew;
37 : OUString sDerivedFrom;
38 : SwDoc * pDoc;
39 : mutable OUString sNewName;
40 : SfxItemSet * pNewSet;
41 : sal_uInt16 nId; // FormatId related
42 : bool bAuto;
43 :
44 : public:
45 : SwUndoFormatCreate(SwUndoId nUndoId, SwFormat * pNew, SwFormat * pDerivedFrom,
46 : SwDoc * pDoc);
47 : virtual ~SwUndoFormatCreate();
48 :
49 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
50 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
51 :
52 : virtual SwRewriter GetRewriter() const SAL_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 sDerivedFrom;
63 : SwDoc * pDoc;
64 : OUString sOldName;
65 : SfxItemSet aOldSet;
66 : sal_uInt16 nId; // FormatId related
67 : bool bAuto;
68 :
69 : public:
70 : SwUndoFormatDelete(SwUndoId nUndoId, SwFormat * pOld, SwDoc * pDoc);
71 : virtual ~SwUndoFormatDelete();
72 :
73 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
74 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
75 :
76 : virtual SwRewriter GetRewriter() const SAL_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:
86 : OUString sOldName, sNewName;
87 : SwDoc * pDoc;
88 :
89 : public:
90 : SwUndoRenameFormat(SwUndoId nUndoId, const OUString & sOldName,
91 : const OUString & sNewName,
92 : SwDoc * pDoc);
93 : virtual ~SwUndoRenameFormat();
94 :
95 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
96 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
97 :
98 : SwRewriter GetRewriter() const SAL_OVERRIDE;
99 :
100 : virtual SwFormat * Find(const OUString & rName) const = 0;
101 : };
102 :
103 18 : class SwUndoTextFormatCollCreate : public SwUndoFormatCreate
104 : {
105 : public:
106 : SwUndoTextFormatCollCreate(SwTextFormatColl * pNew, SwTextFormatColl * pDerivedFrom,
107 : SwDoc * pDoc);
108 :
109 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
110 : virtual void Delete() SAL_OVERRIDE;
111 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
112 : };
113 :
114 0 : class SwUndoTextFormatCollDelete : public SwUndoFormatDelete
115 : {
116 : public:
117 : SwUndoTextFormatCollDelete(SwTextFormatColl * pOld, SwDoc * pDoc);
118 :
119 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
120 : virtual void Delete(SwFormat * pFormat) SAL_OVERRIDE;
121 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
122 : };
123 :
124 4 : class SwUndoCondTextFormatCollCreate : public SwUndoTextFormatCollCreate
125 : {
126 : public:
127 : SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl * pNew, SwTextFormatColl * pDerivedFrom, SwDoc * pDoc);
128 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
129 : };
130 :
131 0 : class SwUndoCondTextFormatCollDelete : public SwUndoTextFormatCollDelete
132 : {
133 : public:
134 : SwUndoCondTextFormatCollDelete(SwTextFormatColl * pOld, SwDoc * pDoc);
135 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
136 : };
137 :
138 4 : class SwUndoRenameFormatColl : public SwUndoRenameFormat
139 : {
140 : public:
141 : SwUndoRenameFormatColl(const OUString & sOldName,
142 : const OUString & sNewName,
143 : SwDoc * pDoc);
144 :
145 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
146 : };
147 :
148 446 : class SwUndoCharFormatCreate : public SwUndoFormatCreate
149 : {
150 : public:
151 : SwUndoCharFormatCreate(SwCharFormat * pNew, SwCharFormat * pDerivedFrom,
152 : SwDoc * pDoc);
153 :
154 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
155 : virtual void Delete() SAL_OVERRIDE;
156 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
157 : };
158 :
159 2 : class SwUndoCharFormatDelete : public SwUndoFormatDelete
160 : {
161 : public:
162 : SwUndoCharFormatDelete(SwCharFormat * pOld, SwDoc * pDoc);
163 :
164 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
165 : virtual void Delete(SwFormat * pFormat) SAL_OVERRIDE;
166 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
167 : };
168 :
169 4 : class SwUndoRenameCharFormat : public SwUndoRenameFormat
170 : {
171 : public:
172 : SwUndoRenameCharFormat(const OUString & sOldName,
173 : const OUString & sNewName,
174 : SwDoc * pDoc);
175 :
176 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
177 : };
178 :
179 44 : class SwUndoFrameFormatCreate : public SwUndoFormatCreate
180 : {
181 : bool bAuto;
182 :
183 : public:
184 : SwUndoFrameFormatCreate(SwFrameFormat * pNew, SwFrameFormat * pDerivedFrom,
185 : SwDoc * pDoc);
186 :
187 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
188 : virtual void Delete() SAL_OVERRIDE;
189 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
190 : };
191 :
192 5888 : class SwUndoFrameFormatDelete : public SwUndoFormatDelete
193 : {
194 : public:
195 : SwUndoFrameFormatDelete(SwFrameFormat * pOld, SwDoc * pDoc);
196 :
197 : virtual SwFormat * Create(SwFormat * pDerivedFrom) SAL_OVERRIDE;
198 : virtual void Delete(SwFormat * pFormat) SAL_OVERRIDE;
199 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
200 : };
201 :
202 0 : class SwUndoRenameFrameFormat : public SwUndoRenameFormat
203 : {
204 : public:
205 : SwUndoRenameFrameFormat(const OUString & sOldName,
206 : const OUString & sNewName,
207 : SwDoc * pDoc);
208 :
209 : virtual SwFormat * Find(const OUString & rName) const SAL_OVERRIDE;
210 : };
211 :
212 24 : class SwUndoNumruleCreate : public SwUndo
213 : {
214 : const SwNumRule * pNew;
215 : mutable SwNumRule aNew;
216 : SwDoc * pDoc;
217 : mutable bool bInitialized;
218 :
219 : public:
220 : SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc);
221 :
222 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
223 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
224 :
225 : SwRewriter GetRewriter() const SAL_OVERRIDE;
226 : };
227 :
228 0 : class SwUndoNumruleDelete : public SwUndo
229 : {
230 : SwNumRule aOld;
231 : SwDoc * pDoc;
232 :
233 : public:
234 : SwUndoNumruleDelete(const SwNumRule & aRule, SwDoc * pDoc);
235 :
236 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
237 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
238 :
239 : SwRewriter GetRewriter() const SAL_OVERRIDE;
240 : };
241 :
242 0 : class SwUndoNumruleRename : public SwUndo
243 : {
244 : OUString aOldName, aNewName;
245 : SwDoc * pDoc;
246 :
247 : public:
248 : SwUndoNumruleRename(const OUString & aOldName, const OUString & aNewName,
249 : SwDoc * pDoc);
250 :
251 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
252 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
253 :
254 : SwRewriter GetRewriter() const SAL_OVERRIDE;
255 : };
256 :
257 : #endif // INCLUDED_SW_SOURCE_CORE_INC_SWUNDOFMT_HXX
258 :
259 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|