merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / SwUndoFmt.hxx
blob01967d9650663b53122d4a598f847967d22db953
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SwUndoFmt.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SW_UNDO_TXT_FMT_COLL_HXX
31 #define _SW_UNDO_TXT_FMT_COLL_HXX
33 #include <undobj.hxx>
34 #include <swundo.hxx>
36 class SwDoc;
37 class SwTxtFmtColl;
38 class String;
39 class SwRewriter;
40 class SfxItemSet;
42 class SwUndoFmtCreate : public SwUndo
44 protected:
45 SwFmt * pNew;
46 String sDerivedFrom;
47 SwDoc * pDoc;
48 mutable String sNewName;
49 SfxItemSet * pNewSet;
50 USHORT nId; // FmtId related
51 BOOL bAuto;
53 public:
55 SwUndoFmtCreate(SwUndoId nUndoId, SwFmt * pNew, SwFmt * pDerivedFrom,
56 SwDoc * pDoc);
57 virtual ~SwUndoFmtCreate();
59 virtual void Undo(SwUndoIter & rIter);
60 virtual void Redo(SwUndoIter & rIter);
62 virtual SwRewriter GetRewriter() const;
64 virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0;
65 virtual void Delete() = 0;
66 virtual SwFmt * Find(const String & rName) const = 0;
69 class SwUndoFmtDelete : public SwUndo
71 protected:
72 String sDerivedFrom;
73 SwDoc * pDoc;
74 String sOldName;
75 SfxItemSet aOldSet;
76 USHORT nId; // FmtId related
77 BOOL bAuto;
79 public:
80 SwUndoFmtDelete(SwUndoId nUndoId, SwFmt * pOld, SwDoc * pDoc);
81 ~SwUndoFmtDelete();
83 virtual void Undo(SwUndoIter & rIter);
84 virtual void Redo(SwUndoIter & rIter);
86 virtual SwRewriter GetRewriter() const;
88 virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0;
89 virtual void Delete(SwFmt * pFmt) = 0;
90 virtual SwFmt * Find(const String & rName) const = 0;
93 class SwUndoRenameFmt : public SwUndo
95 protected:
96 String sOldName, sNewName;
97 SwDoc * pDoc;
98 // SwUndoId nId;
100 public:
101 SwUndoRenameFmt(SwUndoId nUndoId, const String & sOldName,
102 const String & sNewName,
103 SwDoc * pDoc);
104 ~SwUndoRenameFmt();
106 void Undo(SwUndoIter & rIter);
107 void Redo(SwUndoIter & rIter);
109 SwRewriter GetRewriter() const;
111 virtual SwFmt * Find(const String & rName) const = 0;
114 class SwUndoTxtFmtCollCreate : public SwUndoFmtCreate
116 public:
117 SwUndoTxtFmtCollCreate(SwTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom,
118 SwDoc * pDoc);
120 virtual SwFmt * Create(SwFmt * pDerivedFrom);
121 virtual void Delete();
122 virtual SwFmt * Find(const String & rName) const;
125 class SwUndoTxtFmtCollDelete : public SwUndoFmtDelete
127 public:
128 SwUndoTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc);
130 virtual SwFmt * Create(SwFmt * pDerivedFrom);
131 virtual void Delete(SwFmt * pFmt);
132 virtual SwFmt * Find(const String & rName) const;
135 class SwUndoRenameFmtColl : public SwUndoRenameFmt
137 public:
138 SwUndoRenameFmtColl(const String & sOldName,
139 const String & sNewName,
140 SwDoc * pDoc);
142 virtual SwFmt * Find(const String & rName) const;
145 class SwUndoCharFmtCreate : public SwUndoFmtCreate
147 public:
148 SwUndoCharFmtCreate(SwCharFmt * pNew, SwCharFmt * pDerivedFrom,
149 SwDoc * pDoc);
151 virtual SwFmt * Create(SwFmt * pDerivedFrom);
152 virtual void Delete();
153 virtual SwFmt * Find(const String & rName) const;
156 class SwUndoCharFmtDelete : public SwUndoFmtDelete
158 public:
159 SwUndoCharFmtDelete(SwCharFmt * pOld, SwDoc * pDoc);
161 virtual SwFmt * Create(SwFmt * pDerivedFrom);
162 virtual void Delete(SwFmt * pFmt);
163 virtual SwFmt * Find(const String & rName) const;
166 class SwUndoRenameCharFmt : public SwUndoRenameFmt
168 public:
169 SwUndoRenameCharFmt(const String & sOldName,
170 const String & sNewName,
171 SwDoc * pDoc);
173 virtual SwFmt * Find(const String & rName) const;
176 class SwUndoFrmFmtCreate : public SwUndoFmtCreate
178 BOOL bAuto;
180 public:
181 SwUndoFrmFmtCreate(SwFrmFmt * pNew, SwFrmFmt * pDerivedFrom,
182 SwDoc * pDoc);
184 virtual SwFmt * Create(SwFmt * pDerivedFrom);
185 virtual void Delete();
186 virtual SwFmt * Find(const String & rName) const;
189 class SwUndoFrmFmtDelete : public SwUndoFmtDelete
191 public:
192 SwUndoFrmFmtDelete(SwFrmFmt * pOld, SwDoc * pDoc);
194 virtual SwFmt * Create(SwFmt * pDerivedFrom);
195 virtual void Delete(SwFmt * pFmt);
196 virtual SwFmt * Find(const String & rName) const;
199 class SwUndoRenameFrmFmt : public SwUndoRenameFmt
201 public:
202 SwUndoRenameFrmFmt(const String & sOldName,
203 const String & sNewName,
204 SwDoc * pDoc);
206 virtual SwFmt * Find(const String & rName) const;
209 class SwUndoNumruleCreate : public SwUndo
211 const SwNumRule * pNew;
212 mutable SwNumRule aNew;
213 SwDoc * pDoc;
214 mutable bool bInitialized;
216 public:
217 SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc);
219 virtual void Undo(SwUndoIter & rIter);
220 virtual void Redo(SwUndoIter & rIter);
222 SwRewriter GetRewriter() const;
225 class SwUndoNumruleDelete : public SwUndo
227 SwNumRule aOld;
228 SwDoc * pDoc;
230 public:
231 SwUndoNumruleDelete(const SwNumRule & aRule, SwDoc * pDoc);
233 virtual void Undo(SwUndoIter & rIter);
234 virtual void Redo(SwUndoIter & rIter);
236 SwRewriter GetRewriter() const;
239 class SwUndoNumruleRename : public SwUndo
241 String aOldName, aNewName;
242 SwDoc * pDoc;
244 public:
245 SwUndoNumruleRename(const String & aOldName, const String & aNewName,
246 SwDoc * pDoc);
248 virtual void Undo(SwUndoIter & rIter);
249 virtual void Redo(SwUndoIter & rIter);
251 SwRewriter GetRewriter() const;
253 #endif // _SW_UNDO_TXT_FMT_COLL_HXX