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 SwTxtFmtColl;
29 : class SwConditionTxtFmtColl;
30 : class SwRewriter;
31 : class SfxItemSet;
32 :
33 : class SwUndoFmtCreate : public SwUndo
34 : {
35 : protected:
36 : SwFmt * pNew;
37 : OUString sDerivedFrom;
38 : SwDoc * pDoc;
39 : mutable OUString sNewName;
40 : SfxItemSet * pNewSet;
41 : sal_uInt16 nId; // FmtId related
42 : bool bAuto;
43 :
44 : public:
45 : SwUndoFmtCreate(SwUndoId nUndoId, SwFmt * pNew, SwFmt * pDerivedFrom,
46 : SwDoc * pDoc);
47 : virtual ~SwUndoFmtCreate();
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 SwFmt * Create(SwFmt * pDerivedFrom) = 0;
55 : virtual void Delete() = 0;
56 : virtual SwFmt * Find(const OUString & rName) const = 0;
57 : };
58 :
59 : class SwUndoFmtDelete : public SwUndo
60 : {
61 : protected:
62 : OUString sDerivedFrom;
63 : SwDoc * pDoc;
64 : OUString sOldName;
65 : SfxItemSet aOldSet;
66 : sal_uInt16 nId; // FmtId related
67 : bool bAuto;
68 :
69 : public:
70 : SwUndoFmtDelete(SwUndoId nUndoId, SwFmt * pOld, SwDoc * pDoc);
71 : virtual ~SwUndoFmtDelete();
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 SwFmt * Create(SwFmt * pDerivedFrom) = 0;
79 : virtual void Delete(SwFmt * pFmt) = 0;
80 : virtual SwFmt * Find(const OUString & rName) const = 0;
81 : };
82 :
83 : class SwUndoRenameFmt : public SwUndo
84 : {
85 : protected:
86 : OUString sOldName, sNewName;
87 : SwDoc * pDoc;
88 :
89 : public:
90 : SwUndoRenameFmt(SwUndoId nUndoId, const OUString & sOldName,
91 : const OUString & sNewName,
92 : SwDoc * pDoc);
93 : virtual ~SwUndoRenameFmt();
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 SwFmt * Find(const OUString & rName) const = 0;
101 : };
102 :
103 36 : class SwUndoTxtFmtCollCreate : public SwUndoFmtCreate
104 : {
105 : public:
106 : SwUndoTxtFmtCollCreate(SwTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom,
107 : SwDoc * pDoc);
108 :
109 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
110 : virtual void Delete() SAL_OVERRIDE;
111 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
112 : };
113 :
114 0 : class SwUndoTxtFmtCollDelete : public SwUndoFmtDelete
115 : {
116 : public:
117 : SwUndoTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc);
118 :
119 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
120 : virtual void Delete(SwFmt * pFmt) SAL_OVERRIDE;
121 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
122 : };
123 :
124 8 : class SwUndoCondTxtFmtCollCreate : public SwUndoTxtFmtCollCreate
125 : {
126 : public:
127 : SwUndoCondTxtFmtCollCreate(SwConditionTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom, SwDoc * pDoc);
128 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
129 : };
130 :
131 0 : class SwUndoCondTxtFmtCollDelete : public SwUndoTxtFmtCollDelete
132 : {
133 : public:
134 : SwUndoCondTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc);
135 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
136 : };
137 :
138 8 : class SwUndoRenameFmtColl : public SwUndoRenameFmt
139 : {
140 : public:
141 : SwUndoRenameFmtColl(const OUString & sOldName,
142 : const OUString & sNewName,
143 : SwDoc * pDoc);
144 :
145 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
146 : };
147 :
148 860 : class SwUndoCharFmtCreate : public SwUndoFmtCreate
149 : {
150 : public:
151 : SwUndoCharFmtCreate(SwCharFmt * pNew, SwCharFmt * pDerivedFrom,
152 : SwDoc * pDoc);
153 :
154 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
155 : virtual void Delete() SAL_OVERRIDE;
156 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
157 : };
158 :
159 4 : class SwUndoCharFmtDelete : public SwUndoFmtDelete
160 : {
161 : public:
162 : SwUndoCharFmtDelete(SwCharFmt * pOld, SwDoc * pDoc);
163 :
164 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
165 : virtual void Delete(SwFmt * pFmt) SAL_OVERRIDE;
166 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
167 : };
168 :
169 8 : class SwUndoRenameCharFmt : public SwUndoRenameFmt
170 : {
171 : public:
172 : SwUndoRenameCharFmt(const OUString & sOldName,
173 : const OUString & sNewName,
174 : SwDoc * pDoc);
175 :
176 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
177 : };
178 :
179 88 : class SwUndoFrmFmtCreate : public SwUndoFmtCreate
180 : {
181 : bool bAuto;
182 :
183 : public:
184 : SwUndoFrmFmtCreate(SwFrmFmt * pNew, SwFrmFmt * pDerivedFrom,
185 : SwDoc * pDoc);
186 :
187 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
188 : virtual void Delete() SAL_OVERRIDE;
189 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
190 : };
191 :
192 10138 : class SwUndoFrmFmtDelete : public SwUndoFmtDelete
193 : {
194 : public:
195 : SwUndoFrmFmtDelete(SwFrmFmt * pOld, SwDoc * pDoc);
196 :
197 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
198 : virtual void Delete(SwFmt * pFmt) SAL_OVERRIDE;
199 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
200 : };
201 :
202 0 : class SwUndoRenameFrmFmt : public SwUndoRenameFmt
203 : {
204 : public:
205 : SwUndoRenameFrmFmt(const OUString & sOldName,
206 : const OUString & sNewName,
207 : SwDoc * pDoc);
208 :
209 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
210 : };
211 :
212 44 : 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: */
|