xref: /aoo41x/main/sw/source/core/inc/SwUndoFmt.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef SW_UNDO_TXT_FMT_COLL_HXX
24cdf0e10cSrcweir #define SW_UNDO_TXT_FMT_COLL_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <undobj.hxx>
27cdf0e10cSrcweir #include <swundo.hxx>
28cdf0e10cSrcweir #include <numrule.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class SwDoc;
32cdf0e10cSrcweir class SwTxtFmtColl;
33cdf0e10cSrcweir class String;
34cdf0e10cSrcweir class SwRewriter;
35cdf0e10cSrcweir class SfxItemSet;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class SwUndoFmtCreate : public SwUndo
38cdf0e10cSrcweir {
39cdf0e10cSrcweir protected:
40cdf0e10cSrcweir     SwFmt * pNew;
41cdf0e10cSrcweir     String sDerivedFrom;
42cdf0e10cSrcweir     SwDoc * pDoc;
43cdf0e10cSrcweir     mutable String sNewName;
44cdf0e10cSrcweir     SfxItemSet * pNewSet;
45cdf0e10cSrcweir     sal_uInt16 nId;     // FmtId related
46cdf0e10cSrcweir     sal_Bool bAuto;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir public:
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     SwUndoFmtCreate(SwUndoId nUndoId, SwFmt * pNew, SwFmt * pDerivedFrom,
51cdf0e10cSrcweir                     SwDoc * pDoc);
52cdf0e10cSrcweir     virtual ~SwUndoFmtCreate();
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
55cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     virtual SwRewriter GetRewriter() const;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0;
60cdf0e10cSrcweir     virtual void Delete() = 0;
61cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const = 0;
62cdf0e10cSrcweir };
63cdf0e10cSrcweir 
64cdf0e10cSrcweir class SwUndoFmtDelete : public SwUndo
65cdf0e10cSrcweir {
66cdf0e10cSrcweir protected:
67cdf0e10cSrcweir     String sDerivedFrom;
68cdf0e10cSrcweir     SwDoc * pDoc;
69cdf0e10cSrcweir     String sOldName;
70cdf0e10cSrcweir     SfxItemSet aOldSet;
71cdf0e10cSrcweir     sal_uInt16 nId;     // FmtId related
72cdf0e10cSrcweir     sal_Bool bAuto;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir public:
75cdf0e10cSrcweir     SwUndoFmtDelete(SwUndoId nUndoId, SwFmt * pOld, SwDoc * pDoc);
76cdf0e10cSrcweir     ~SwUndoFmtDelete();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
79cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     virtual SwRewriter GetRewriter() const;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0;
84cdf0e10cSrcweir     virtual void Delete(SwFmt * pFmt) = 0;
85cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const = 0;
86cdf0e10cSrcweir };
87cdf0e10cSrcweir 
88cdf0e10cSrcweir class SwUndoRenameFmt : public SwUndo
89cdf0e10cSrcweir {
90cdf0e10cSrcweir protected:
91cdf0e10cSrcweir     String sOldName, sNewName;
92cdf0e10cSrcweir     SwDoc * pDoc;
93cdf0e10cSrcweir //    SwUndoId nId;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir public:
96cdf0e10cSrcweir     SwUndoRenameFmt(SwUndoId nUndoId, const String & sOldName,
97cdf0e10cSrcweir                     const String & sNewName,
98cdf0e10cSrcweir                     SwDoc * pDoc);
99cdf0e10cSrcweir     ~SwUndoRenameFmt();
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
102cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     SwRewriter GetRewriter() const;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const = 0;
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class SwUndoTxtFmtCollCreate : public SwUndoFmtCreate
110cdf0e10cSrcweir {
111cdf0e10cSrcweir public:
112cdf0e10cSrcweir     SwUndoTxtFmtCollCreate(SwTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom,
113cdf0e10cSrcweir                            SwDoc * pDoc);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom);
116cdf0e10cSrcweir     virtual void Delete();
117cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir class SwUndoTxtFmtCollDelete : public SwUndoFmtDelete
121cdf0e10cSrcweir {
122cdf0e10cSrcweir public:
123cdf0e10cSrcweir     SwUndoTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom);
126cdf0e10cSrcweir     virtual void Delete(SwFmt * pFmt);
127cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
128cdf0e10cSrcweir };
129cdf0e10cSrcweir 
130cdf0e10cSrcweir class SwUndoRenameFmtColl : public SwUndoRenameFmt
131cdf0e10cSrcweir {
132cdf0e10cSrcweir public:
133cdf0e10cSrcweir     SwUndoRenameFmtColl(const String & sOldName,
134cdf0e10cSrcweir                         const String & sNewName,
135cdf0e10cSrcweir                         SwDoc * pDoc);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
138cdf0e10cSrcweir };
139cdf0e10cSrcweir 
140cdf0e10cSrcweir class SwUndoCharFmtCreate : public SwUndoFmtCreate
141cdf0e10cSrcweir {
142cdf0e10cSrcweir public:
143cdf0e10cSrcweir     SwUndoCharFmtCreate(SwCharFmt * pNew, SwCharFmt * pDerivedFrom,
144cdf0e10cSrcweir                            SwDoc * pDoc);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom);
147cdf0e10cSrcweir     virtual void Delete();
148cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
149cdf0e10cSrcweir };
150cdf0e10cSrcweir 
151cdf0e10cSrcweir class SwUndoCharFmtDelete : public SwUndoFmtDelete
152cdf0e10cSrcweir {
153cdf0e10cSrcweir public:
154cdf0e10cSrcweir     SwUndoCharFmtDelete(SwCharFmt * pOld, SwDoc * pDoc);
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom);
157cdf0e10cSrcweir     virtual void Delete(SwFmt * pFmt);
158cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
159cdf0e10cSrcweir };
160cdf0e10cSrcweir 
161cdf0e10cSrcweir class SwUndoRenameCharFmt : public SwUndoRenameFmt
162cdf0e10cSrcweir {
163cdf0e10cSrcweir public:
164cdf0e10cSrcweir     SwUndoRenameCharFmt(const String & sOldName,
165cdf0e10cSrcweir                         const String & sNewName,
166cdf0e10cSrcweir                         SwDoc * pDoc);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
169cdf0e10cSrcweir };
170cdf0e10cSrcweir 
171cdf0e10cSrcweir class SwUndoFrmFmtCreate : public SwUndoFmtCreate
172cdf0e10cSrcweir {
173cdf0e10cSrcweir     sal_Bool bAuto;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir public:
176cdf0e10cSrcweir     SwUndoFrmFmtCreate(SwFrmFmt * pNew, SwFrmFmt * pDerivedFrom,
177cdf0e10cSrcweir                        SwDoc * pDoc);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom);
180cdf0e10cSrcweir     virtual void Delete();
181cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
182cdf0e10cSrcweir };
183cdf0e10cSrcweir 
184cdf0e10cSrcweir class SwUndoFrmFmtDelete : public SwUndoFmtDelete
185cdf0e10cSrcweir {
186cdf0e10cSrcweir public:
187cdf0e10cSrcweir     SwUndoFrmFmtDelete(SwFrmFmt * pOld, SwDoc * pDoc);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     virtual SwFmt * Create(SwFmt * pDerivedFrom);
190cdf0e10cSrcweir     virtual void Delete(SwFmt * pFmt);
191cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
192cdf0e10cSrcweir };
193cdf0e10cSrcweir 
194cdf0e10cSrcweir class SwUndoRenameFrmFmt : public SwUndoRenameFmt
195cdf0e10cSrcweir {
196cdf0e10cSrcweir public:
197cdf0e10cSrcweir     SwUndoRenameFrmFmt(const String & sOldName,
198cdf0e10cSrcweir                        const String & sNewName,
199cdf0e10cSrcweir                        SwDoc * pDoc);
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     virtual SwFmt * Find(const String & rName) const;
202cdf0e10cSrcweir };
203cdf0e10cSrcweir 
204cdf0e10cSrcweir class SwUndoNumruleCreate : public SwUndo
205cdf0e10cSrcweir {
206cdf0e10cSrcweir     const SwNumRule * pNew;
207cdf0e10cSrcweir     mutable SwNumRule aNew;
208cdf0e10cSrcweir     SwDoc * pDoc;
209cdf0e10cSrcweir     mutable bool bInitialized;
210cdf0e10cSrcweir 
211cdf0e10cSrcweir public:
212cdf0e10cSrcweir     SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
215cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     SwRewriter GetRewriter() const;
218cdf0e10cSrcweir };
219cdf0e10cSrcweir 
220cdf0e10cSrcweir class SwUndoNumruleDelete : public SwUndo
221cdf0e10cSrcweir {
222cdf0e10cSrcweir     SwNumRule aOld;
223cdf0e10cSrcweir     SwDoc * pDoc;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir public:
226cdf0e10cSrcweir     SwUndoNumruleDelete(const SwNumRule  & aRule, SwDoc * pDoc);
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
229cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     SwRewriter GetRewriter() const;
232cdf0e10cSrcweir };
233cdf0e10cSrcweir 
234cdf0e10cSrcweir class SwUndoNumruleRename : public SwUndo
235cdf0e10cSrcweir {
236cdf0e10cSrcweir     String aOldName, aNewName;
237cdf0e10cSrcweir     SwDoc * pDoc;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir  public:
240cdf0e10cSrcweir     SwUndoNumruleRename(const String & aOldName, const String & aNewName,
241cdf0e10cSrcweir                         SwDoc * pDoc);
242cdf0e10cSrcweir 
243cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
244cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     SwRewriter GetRewriter() const;
247cdf0e10cSrcweir };
248cdf0e10cSrcweir 
249cdf0e10cSrcweir #endif // SW_UNDO_TXT_FMT_COLL_HXX
250