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 SwRewriter;
30 : class SfxItemSet;
31 :
32 : class SwUndoFmtCreate : public SwUndo
33 : {
34 : protected:
35 : SwFmt * pNew;
36 : OUString sDerivedFrom;
37 : SwDoc * pDoc;
38 : mutable OUString sNewName;
39 : SfxItemSet * pNewSet;
40 : sal_uInt16 nId; // FmtId related
41 : sal_Bool bAuto;
42 :
43 : public:
44 : SwUndoFmtCreate(SwUndoId nUndoId, SwFmt * pNew, SwFmt * pDerivedFrom,
45 : SwDoc * pDoc);
46 : virtual ~SwUndoFmtCreate();
47 :
48 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
49 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
50 :
51 : virtual SwRewriter GetRewriter() const SAL_OVERRIDE;
52 :
53 : virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0;
54 : virtual void Delete() = 0;
55 : virtual SwFmt * Find(const OUString & rName) const = 0;
56 : };
57 :
58 : class SwUndoFmtDelete : public SwUndo
59 : {
60 : protected:
61 : OUString sDerivedFrom;
62 : SwDoc * pDoc;
63 : OUString sOldName;
64 : SfxItemSet aOldSet;
65 : sal_uInt16 nId; // FmtId related
66 : sal_Bool bAuto;
67 :
68 : public:
69 : SwUndoFmtDelete(SwUndoId nUndoId, SwFmt * pOld, SwDoc * pDoc);
70 : virtual ~SwUndoFmtDelete();
71 :
72 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
73 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
74 :
75 : virtual SwRewriter GetRewriter() const SAL_OVERRIDE;
76 :
77 : virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0;
78 : virtual void Delete(SwFmt * pFmt) = 0;
79 : virtual SwFmt * Find(const OUString & rName) const = 0;
80 : };
81 :
82 : class SwUndoRenameFmt : public SwUndo
83 : {
84 : protected:
85 : OUString sOldName, sNewName;
86 : SwDoc * pDoc;
87 :
88 : public:
89 : SwUndoRenameFmt(SwUndoId nUndoId, const OUString & sOldName,
90 : const OUString & sNewName,
91 : SwDoc * pDoc);
92 : virtual ~SwUndoRenameFmt();
93 :
94 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
95 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
96 :
97 : SwRewriter GetRewriter() const SAL_OVERRIDE;
98 :
99 : virtual SwFmt * Find(const OUString & rName) const = 0;
100 : };
101 :
102 0 : class SwUndoTxtFmtCollCreate : public SwUndoFmtCreate
103 : {
104 : public:
105 : SwUndoTxtFmtCollCreate(SwTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom,
106 : SwDoc * pDoc);
107 :
108 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
109 : virtual void Delete() SAL_OVERRIDE;
110 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
111 : };
112 :
113 0 : class SwUndoTxtFmtCollDelete : public SwUndoFmtDelete
114 : {
115 : public:
116 : SwUndoTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc);
117 :
118 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
119 : virtual void Delete(SwFmt * pFmt) SAL_OVERRIDE;
120 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
121 : };
122 :
123 0 : class SwUndoRenameFmtColl : public SwUndoRenameFmt
124 : {
125 : public:
126 : SwUndoRenameFmtColl(const OUString & sOldName,
127 : const OUString & sNewName,
128 : SwDoc * pDoc);
129 :
130 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
131 : };
132 :
133 0 : class SwUndoCharFmtCreate : public SwUndoFmtCreate
134 : {
135 : public:
136 : SwUndoCharFmtCreate(SwCharFmt * pNew, SwCharFmt * pDerivedFrom,
137 : SwDoc * pDoc);
138 :
139 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
140 : virtual void Delete() SAL_OVERRIDE;
141 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
142 : };
143 :
144 0 : class SwUndoCharFmtDelete : public SwUndoFmtDelete
145 : {
146 : public:
147 : SwUndoCharFmtDelete(SwCharFmt * pOld, SwDoc * pDoc);
148 :
149 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
150 : virtual void Delete(SwFmt * pFmt) SAL_OVERRIDE;
151 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
152 : };
153 :
154 0 : class SwUndoRenameCharFmt : public SwUndoRenameFmt
155 : {
156 : public:
157 : SwUndoRenameCharFmt(const OUString & sOldName,
158 : const OUString & sNewName,
159 : SwDoc * pDoc);
160 :
161 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
162 : };
163 :
164 0 : class SwUndoFrmFmtCreate : public SwUndoFmtCreate
165 : {
166 : sal_Bool bAuto;
167 :
168 : public:
169 : SwUndoFrmFmtCreate(SwFrmFmt * pNew, SwFrmFmt * pDerivedFrom,
170 : SwDoc * pDoc);
171 :
172 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
173 : virtual void Delete() SAL_OVERRIDE;
174 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
175 : };
176 :
177 0 : class SwUndoFrmFmtDelete : public SwUndoFmtDelete
178 : {
179 : public:
180 : SwUndoFrmFmtDelete(SwFrmFmt * pOld, SwDoc * pDoc);
181 :
182 : virtual SwFmt * Create(SwFmt * pDerivedFrom) SAL_OVERRIDE;
183 : virtual void Delete(SwFmt * pFmt) SAL_OVERRIDE;
184 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
185 : };
186 :
187 0 : class SwUndoRenameFrmFmt : public SwUndoRenameFmt
188 : {
189 : public:
190 : SwUndoRenameFrmFmt(const OUString & sOldName,
191 : const OUString & sNewName,
192 : SwDoc * pDoc);
193 :
194 : virtual SwFmt * Find(const OUString & rName) const SAL_OVERRIDE;
195 : };
196 :
197 0 : class SwUndoNumruleCreate : public SwUndo
198 : {
199 : const SwNumRule * pNew;
200 : mutable SwNumRule aNew;
201 : SwDoc * pDoc;
202 : mutable bool bInitialized;
203 :
204 : public:
205 : SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc);
206 :
207 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
208 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
209 :
210 : SwRewriter GetRewriter() const SAL_OVERRIDE;
211 : };
212 :
213 0 : class SwUndoNumruleDelete : public SwUndo
214 : {
215 : SwNumRule aOld;
216 : SwDoc * pDoc;
217 :
218 : public:
219 : SwUndoNumruleDelete(const SwNumRule & aRule, SwDoc * pDoc);
220 :
221 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
222 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
223 :
224 : SwRewriter GetRewriter() const SAL_OVERRIDE;
225 : };
226 :
227 0 : class SwUndoNumruleRename : public SwUndo
228 : {
229 : OUString aOldName, aNewName;
230 : SwDoc * pDoc;
231 :
232 : public:
233 : SwUndoNumruleRename(const OUString & aOldName, const OUString & aNewName,
234 : 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 : #endif // INCLUDED_SW_SOURCE_CORE_INC_SWUNDOFMT_HXX
243 :
244 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|