merge the formfield patch from ooo-build
[ooovba.git] / svx / source / editeng / editundo.hxx
blob1def47b7e9b971519a2614d63a6343d00a673fb9
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: editundo.hxx,v $
10 * $Revision: 1.9 $
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 ************************************************************************/
31 #ifndef _EDITUNDO_HXX
32 #define _EDITUNDO_HXX
34 #include <editdoc.hxx>
35 #include <editund2.hxx>
36 #include <svx/editdata.hxx>
38 #define UNDO_NOACTION 0
39 #define UNDO_NEWUNDO 1
40 #define UNDO_UNDOSDELETED 2
41 #define UNDO_EMPTYGROUPDELETED 3
42 #define UNDO_INVALIDEND 4
44 class ImpEditEngine;
45 class EditView;
47 // -----------------------------------------------------------------------
48 // EditUndoDelContent
49 // ------------------------------------------------------------------------
50 class EditUndoDelContent : public EditUndo
52 private:
53 BOOL bDelObject;
54 USHORT nNode;
55 ContentNode* pContentNode; // Zeigt auf das gueltige,
56 // nicht zerstoerte Objekt!
58 public:
59 TYPEINFO();
60 EditUndoDelContent( ImpEditEngine* pImpEE, ContentNode* pNode, USHORT nPortio );
61 ~EditUndoDelContent();
63 virtual void Undo();
64 virtual void Redo();
67 // -----------------------------------------------------------------------
68 // EditUndoConnectParas
69 // ------------------------------------------------------------------------
70 class EditUndoConnectParas : public EditUndo
72 private:
73 USHORT nNode;
74 USHORT nSepPos;
75 SfxItemSet aLeftParaAttribs;
76 SfxItemSet aRightParaAttribs;
78 // 2 Pointer waeren schoener, aber dann muesste es ein SfxListener sein.
79 String aLeftStyleName;
80 String aRightStyleName;
81 SfxStyleFamily eLeftStyleFamily;
82 SfxStyleFamily eRightStyleFamily;
84 BOOL bBackward;
86 public:
87 TYPEINFO();
88 EditUndoConnectParas( ImpEditEngine* pImpEE, USHORT nNode, USHORT nSepPos,
89 const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
90 const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, BOOL bBackward );
91 ~EditUndoConnectParas();
93 virtual void Undo();
94 virtual void Redo();
97 // -----------------------------------------------------------------------
98 // EditUndoSplitPara
99 // ------------------------------------------------------------------------
100 class EditUndoSplitPara : public EditUndo
102 private:
103 USHORT nNode;
104 USHORT nSepPos;
106 public:
107 TYPEINFO();
108 EditUndoSplitPara( ImpEditEngine* pImpEE, USHORT nNode, USHORT nSepPos );
109 ~EditUndoSplitPara();
111 virtual void Undo();
112 virtual void Redo();
115 // -----------------------------------------------------------------------
116 // EditUndoInsertChars
117 // ------------------------------------------------------------------------
118 class EditUndoInsertChars : public EditUndo
120 private:
121 EPaM aEPaM;
122 String aText;
124 public:
125 TYPEINFO();
126 EditUndoInsertChars( ImpEditEngine* pImpEE, const EPaM& rEPaM, const String& rStr );
128 const EPaM& GetEPaM() { return aEPaM; }
129 String& GetStr() { return aText; }
131 virtual void Undo();
132 virtual void Redo();
134 virtual BOOL Merge( SfxUndoAction *pNextAction );
137 // -----------------------------------------------------------------------
138 // EditUndoRemoveChars
139 // ------------------------------------------------------------------------
140 class EditUndoRemoveChars : public EditUndo
142 private:
143 EPaM aEPaM;
144 String aText;
146 public:
147 TYPEINFO();
148 EditUndoRemoveChars( ImpEditEngine* pImpEE, const EPaM& rEPaM, const String& rStr );
150 const EPaM& GetEPaM() { return aEPaM; }
151 String& GetStr() { return aText; }
153 virtual void Undo();
154 virtual void Redo();
157 // -----------------------------------------------------------------------
158 // EditUndoInsertFeature
159 // ------------------------------------------------------------------------
160 class EditUndoInsertFeature : public EditUndo
162 private:
163 EPaM aEPaM;
164 SfxPoolItem* pFeature;
166 public:
167 TYPEINFO();
168 EditUndoInsertFeature( ImpEditEngine* pImpEE, const EPaM& rEPaM,
169 const SfxPoolItem& rFeature);
170 ~EditUndoInsertFeature();
172 virtual void Undo();
173 virtual void Redo();
176 // -----------------------------------------------------------------------
177 // EditUndoMoveParagraphs
178 // ------------------------------------------------------------------------
179 class EditUndoMoveParagraphs: public EditUndo
181 private:
182 Range nParagraphs;
183 USHORT nDest;
185 public:
186 TYPEINFO();
187 EditUndoMoveParagraphs( ImpEditEngine* pImpEE, const Range& rParas, USHORT nDest );
188 ~EditUndoMoveParagraphs();
190 virtual void Undo();
191 virtual void Redo();
194 // -----------------------------------------------------------------------
195 // EditUndoSetStyleSheet
196 // ------------------------------------------------------------------------
197 class EditUndoSetStyleSheet: public EditUndo
199 private:
200 USHORT nPara;
201 XubString aPrevName;
202 XubString aNewName;
203 SfxStyleFamily ePrevFamily;
204 SfxStyleFamily eNewFamily;
205 SfxItemSet aPrevParaAttribs;
207 public:
208 TYPEINFO();
210 EditUndoSetStyleSheet( ImpEditEngine* pImpEE, USHORT nPara,
211 const XubString& rPrevName, SfxStyleFamily ePrevFamily,
212 const XubString& rNewName, SfxStyleFamily eNewFamily,
213 const SfxItemSet& rPrevParaAttribs );
214 ~EditUndoSetStyleSheet();
216 virtual void Undo();
217 virtual void Redo();
220 // -----------------------------------------------------------------------
221 // EditUndoSetParaAttribs
222 // ------------------------------------------------------------------------
223 class EditUndoSetParaAttribs: public EditUndo
225 private:
226 USHORT nPara;
227 SfxItemSet aPrevItems;
228 SfxItemSet aNewItems;
230 public:
231 TYPEINFO();
232 EditUndoSetParaAttribs( ImpEditEngine* pImpEE, USHORT nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems );
233 ~EditUndoSetParaAttribs();
235 virtual void Undo();
236 virtual void Redo();
239 // -----------------------------------------------------------------------
240 // EditUndoSetAttribs
241 // ------------------------------------------------------------------------
242 class EditUndoSetAttribs: public EditUndo
244 private:
245 ESelection aESel;
246 SfxItemSet aNewAttribs;
247 ContentInfoArray aPrevAttribs;
249 BYTE nSpecial;
250 BOOL bSetIsRemove;
251 BOOL bRemoveParaAttribs;
252 USHORT nRemoveWhich;
254 void ImpSetSelection( EditView* pView );
257 public:
258 TYPEINFO();
259 EditUndoSetAttribs( ImpEditEngine* pImpEE, const ESelection& rESel, const SfxItemSet& rNewItems );
260 ~EditUndoSetAttribs();
262 ContentInfoArray& GetContentInfos() { return aPrevAttribs; }
263 SfxItemSet& GetNewAttribs() { return aNewAttribs; }
265 void SetSpecial( BYTE n ) { nSpecial = n; }
266 void SetRemoveAttribs( BOOL b ) { bSetIsRemove = b; }
267 void SetRemoveParaAttribs( BOOL b ) { bRemoveParaAttribs = b; }
268 void SetRemoveWhich( USHORT n ) { nRemoveWhich = n; }
270 virtual void Undo();
271 virtual void Redo();
274 // -----------------------------------------------------------------------
275 // EditUndoTransliteration
276 // ------------------------------------------------------------------------
277 class EditUndoTransliteration: public EditUndo
279 private:
280 ESelection aOldESel;
281 ESelection aNewESel;
283 sal_Int32 nMode;
284 EditTextObject* pTxtObj;
285 String aText;
287 public:
288 TYPEINFO();
289 EditUndoTransliteration( ImpEditEngine* pImpEE, const ESelection& rESel, sal_Int32 nMode );
290 ~EditUndoTransliteration();
292 void SetText( const String& rText ) { aText = rText; }
293 void SetText( EditTextObject* pObj ) { pTxtObj = pObj; }
294 void SetNewSelection( const ESelection& rSel ) { aNewESel = rSel; }
296 virtual void Undo();
297 virtual void Redo();
300 // -----------------------------------------------------------------------
301 // EditUndoMarkSelection
302 // ------------------------------------------------------------------------
303 class EditUndoMarkSelection: public EditUndo
305 private:
306 ESelection aSelection;
308 public:
309 TYPEINFO();
310 EditUndoMarkSelection( ImpEditEngine* pImpEE, const ESelection& rSel );
311 ~EditUndoMarkSelection();
313 virtual void Undo();
314 virtual void Redo();
318 #endif // _EDITUNDO_HXX