1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SwUndoFmt.hxx,v $
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
42 class SwUndoFmtCreate
: public SwUndo
48 mutable String sNewName
;
50 USHORT nId
; // FmtId related
55 SwUndoFmtCreate(SwUndoId nUndoId
, SwFmt
* pNew
, SwFmt
* pDerivedFrom
,
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
76 USHORT nId
; // FmtId related
80 SwUndoFmtDelete(SwUndoId nUndoId
, SwFmt
* pOld
, SwDoc
* pDoc
);
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
96 String sOldName
, sNewName
;
101 SwUndoRenameFmt(SwUndoId nUndoId
, const String
& sOldName
,
102 const String
& sNewName
,
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
117 SwUndoTxtFmtCollCreate(SwTxtFmtColl
* pNew
, SwTxtFmtColl
* pDerivedFrom
,
120 virtual SwFmt
* Create(SwFmt
* pDerivedFrom
);
121 virtual void Delete();
122 virtual SwFmt
* Find(const String
& rName
) const;
125 class SwUndoTxtFmtCollDelete
: public SwUndoFmtDelete
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
138 SwUndoRenameFmtColl(const String
& sOldName
,
139 const String
& sNewName
,
142 virtual SwFmt
* Find(const String
& rName
) const;
145 class SwUndoCharFmtCreate
: public SwUndoFmtCreate
148 SwUndoCharFmtCreate(SwCharFmt
* pNew
, SwCharFmt
* pDerivedFrom
,
151 virtual SwFmt
* Create(SwFmt
* pDerivedFrom
);
152 virtual void Delete();
153 virtual SwFmt
* Find(const String
& rName
) const;
156 class SwUndoCharFmtDelete
: public SwUndoFmtDelete
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
169 SwUndoRenameCharFmt(const String
& sOldName
,
170 const String
& sNewName
,
173 virtual SwFmt
* Find(const String
& rName
) const;
176 class SwUndoFrmFmtCreate
: public SwUndoFmtCreate
181 SwUndoFrmFmtCreate(SwFrmFmt
* pNew
, SwFrmFmt
* pDerivedFrom
,
184 virtual SwFmt
* Create(SwFmt
* pDerivedFrom
);
185 virtual void Delete();
186 virtual SwFmt
* Find(const String
& rName
) const;
189 class SwUndoFrmFmtDelete
: public SwUndoFmtDelete
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
202 SwUndoRenameFrmFmt(const String
& sOldName
,
203 const String
& sNewName
,
206 virtual SwFmt
* Find(const String
& rName
) const;
209 class SwUndoNumruleCreate
: public SwUndo
211 const SwNumRule
* pNew
;
212 mutable SwNumRule aNew
;
214 mutable bool bInitialized
;
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
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
;
245 SwUndoNumruleRename(const String
& aOldName
, const String
& aNewName
,
248 virtual void Undo(SwUndoIter
& rIter
);
249 virtual void Redo(SwUndoIter
& rIter
);
251 SwRewriter
GetRewriter() const;
253 #endif // _SW_UNDO_TXT_FMT_COLL_HXX