Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _EDITUNDO_HXX
30 : : #define _EDITUNDO_HXX
31 : :
32 : : #include <editdoc.hxx>
33 : : #include <editeng/editund2.hxx>
34 : : #include <editeng/editdata.hxx>
35 : :
36 : : class EditEngine;
37 : : class EditView;
38 : :
39 : : // -----------------------------------------------------------------------
40 : : // EditUndoDelContent
41 : : // ------------------------------------------------------------------------
42 : : class EditUndoDelContent : public EditUndo
43 : : {
44 : : private:
45 : : bool bDelObject;
46 : : size_t nNode;
47 : : ContentNode* pContentNode; // Points to the valid,
48 : : // undestroyed object!
49 : :
50 : : public:
51 : : EditUndoDelContent(EditEngine* pEE, ContentNode* pNode, size_t nPortion);
52 : : virtual ~EditUndoDelContent();
53 : :
54 : : virtual void Undo();
55 : : virtual void Redo();
56 : : };
57 : :
58 : : // -----------------------------------------------------------------------
59 : : // EditUndoConnectParas
60 : : // ------------------------------------------------------------------------
61 : : class EditUndoConnectParas : public EditUndo
62 : : {
63 : : private:
64 : : sal_uInt16 nNode;
65 : : sal_uInt16 nSepPos;
66 : : SfxItemSet aLeftParaAttribs;
67 : : SfxItemSet aRightParaAttribs;
68 : :
69 : : // 2 Pointers would be nicer but then it would have to be a SfxListener.
70 : : String aLeftStyleName;
71 : : String aRightStyleName;
72 : : SfxStyleFamily eLeftStyleFamily;
73 : : SfxStyleFamily eRightStyleFamily;
74 : :
75 : : bool bBackward;
76 : :
77 : : public:
78 : : EditUndoConnectParas(EditEngine* pEE, sal_uInt16 nNode, sal_uInt16 nSepPos,
79 : : const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
80 : : const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool bBackward);
81 : : virtual ~EditUndoConnectParas();
82 : :
83 : : virtual void Undo();
84 : : virtual void Redo();
85 : : };
86 : :
87 : : // -----------------------------------------------------------------------
88 : : // EditUndoSplitPara
89 : : // ------------------------------------------------------------------------
90 : : class EditUndoSplitPara : public EditUndo
91 : : {
92 : : private:
93 : : sal_uInt16 nNode;
94 : : sal_uInt16 nSepPos;
95 : :
96 : : public:
97 : : EditUndoSplitPara(EditEngine* pEE, sal_uInt16 nNode, sal_uInt16 nSepPos);
98 : : ~EditUndoSplitPara();
99 : :
100 : : virtual void Undo();
101 : : virtual void Redo();
102 : : };
103 : :
104 : : // -----------------------------------------------------------------------
105 : : // EditUndoInsertChars
106 : : // ------------------------------------------------------------------------
107 [ + - ][ - + ]: 46116 : class EditUndoInsertChars : public EditUndo
108 : : {
109 : : private:
110 : : EPaM aEPaM;
111 : : String aText;
112 : :
113 : : public:
114 : : EditUndoInsertChars(EditEngine* pEE, const EPaM& rEPaM, const String& rStr);
115 : :
116 : : const EPaM& GetEPaM() { return aEPaM; }
117 : : String& GetStr() { return aText; }
118 : :
119 : : virtual void Undo();
120 : : virtual void Redo();
121 : :
122 : : virtual sal_Bool Merge( SfxUndoAction *pNextAction );
123 : : };
124 : :
125 : : // -----------------------------------------------------------------------
126 : : // EditUndoRemoveChars
127 : : // ------------------------------------------------------------------------
128 [ + - ][ - + ]: 304 : class EditUndoRemoveChars : public EditUndo
129 : : {
130 : : private:
131 : : EPaM aEPaM;
132 : : String aText;
133 : :
134 : : public:
135 : : EditUndoRemoveChars(EditEngine* pEE, const EPaM& rEPaM, const String& rStr);
136 : :
137 : 0 : const EPaM& GetEPaM() { return aEPaM; }
138 : 0 : String& GetStr() { return aText; }
139 : :
140 : : virtual void Undo();
141 : : virtual void Redo();
142 : : };
143 : :
144 : : // -----------------------------------------------------------------------
145 : : // EditUndoInsertFeature
146 : : // ------------------------------------------------------------------------
147 : : class EditUndoInsertFeature : public EditUndo
148 : : {
149 : : private:
150 : : EPaM aEPaM;
151 : : SfxPoolItem* pFeature;
152 : :
153 : : public:
154 : : EditUndoInsertFeature(EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature);
155 : : virtual ~EditUndoInsertFeature();
156 : :
157 : : virtual void Undo();
158 : : virtual void Redo();
159 : : };
160 : :
161 : : // -----------------------------------------------------------------------
162 : : // EditUndoMoveParagraphs
163 : : // ------------------------------------------------------------------------
164 : : class EditUndoMoveParagraphs: public EditUndo
165 : : {
166 : : private:
167 : : Range nParagraphs;
168 : : sal_uInt16 nDest;
169 : :
170 : : public:
171 : : EditUndoMoveParagraphs(EditEngine* pEE, const Range& rParas, sal_uInt16 nDest);
172 : : virtual ~EditUndoMoveParagraphs();
173 : :
174 : : virtual void Undo();
175 : : virtual void Redo();
176 : : };
177 : :
178 : : // -----------------------------------------------------------------------
179 : : // EditUndoSetStyleSheet
180 : : // ------------------------------------------------------------------------
181 : : class EditUndoSetStyleSheet: public EditUndo
182 : : {
183 : : private:
184 : : sal_uInt16 nPara;
185 : : String aPrevName;
186 : : String aNewName;
187 : : SfxStyleFamily ePrevFamily;
188 : : SfxStyleFamily eNewFamily;
189 : : SfxItemSet aPrevParaAttribs;
190 : :
191 : : public:
192 : : EditUndoSetStyleSheet(EditEngine* pEE, sal_uInt16 nPara,
193 : : const String& rPrevName, SfxStyleFamily ePrevFamily,
194 : : const String& rNewName, SfxStyleFamily eNewFamily,
195 : : const SfxItemSet& rPrevParaAttribs);
196 : : virtual ~EditUndoSetStyleSheet();
197 : :
198 : : virtual void Undo();
199 : : virtual void Redo();
200 : : };
201 : :
202 : : // -----------------------------------------------------------------------
203 : : // EditUndoSetParaAttribs
204 : : // ------------------------------------------------------------------------
205 : : class EditUndoSetParaAttribs: public EditUndo
206 : : {
207 : : private:
208 : : sal_uInt16 nPara;
209 : : SfxItemSet aPrevItems;
210 : : SfxItemSet aNewItems;
211 : :
212 : : public:
213 : : EditUndoSetParaAttribs(EditEngine* pEE, sal_uInt16 nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems);
214 : : virtual ~EditUndoSetParaAttribs();
215 : :
216 : : virtual void Undo();
217 : : virtual void Redo();
218 : : };
219 : :
220 : : // -----------------------------------------------------------------------
221 : : // EditUndoSetAttribs
222 : : // ------------------------------------------------------------------------
223 : : class EditUndoSetAttribs: public EditUndo
224 : : {
225 : : private:
226 : : typedef boost::ptr_vector<ContentAttribsInfo> InfoArrayType;
227 : :
228 : : ESelection aESel;
229 : : SfxItemSet aNewAttribs;
230 : : InfoArrayType aPrevAttribs;
231 : :
232 : : sal_uInt8 nSpecial;
233 : : sal_Bool bSetIsRemove;
234 : : sal_Bool bRemoveParaAttribs;
235 : : sal_uInt16 nRemoveWhich;
236 : :
237 : : void ImpSetSelection( EditView* pView );
238 : :
239 : :
240 : : public:
241 : : EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel, const SfxItemSet& rNewItems);
242 : : virtual ~EditUndoSetAttribs();
243 : :
244 : 1700 : SfxItemSet& GetNewAttribs() { return aNewAttribs; }
245 : :
246 : 1624 : void SetSpecial( sal_uInt8 n ) { nSpecial = n; }
247 : 76 : void SetRemoveAttribs( sal_Bool b ) { bSetIsRemove = b; }
248 : 76 : void SetRemoveParaAttribs( sal_Bool b ) { bRemoveParaAttribs = b; }
249 : 76 : void SetRemoveWhich( sal_uInt16 n ) { nRemoveWhich = n; }
250 : :
251 : : virtual void Undo();
252 : : virtual void Redo();
253 : :
254 : : void AppendContentInfo(ContentAttribsInfo* pNew);
255 : : };
256 : :
257 : : // -----------------------------------------------------------------------
258 : : // EditUndoTransliteration
259 : : // ------------------------------------------------------------------------
260 : : class EditUndoTransliteration: public EditUndo
261 : : {
262 : : private:
263 : : ESelection aOldESel;
264 : : ESelection aNewESel;
265 : :
266 : : sal_Int32 nMode;
267 : : EditTextObject* pTxtObj;
268 : : String aText;
269 : :
270 : : public:
271 : : EditUndoTransliteration(EditEngine* pEE, const ESelection& rESel, sal_Int32 nMode);
272 : : virtual ~EditUndoTransliteration();
273 : :
274 : 0 : void SetText( const String& rText ) { aText = rText; }
275 : 0 : void SetText( EditTextObject* pObj ) { pTxtObj = pObj; }
276 : 0 : void SetNewSelection( const ESelection& rSel ) { aNewESel = rSel; }
277 : :
278 : : virtual void Undo();
279 : : virtual void Redo();
280 : : };
281 : :
282 : : // -----------------------------------------------------------------------
283 : : // EditUndoMarkSelection
284 : : // ------------------------------------------------------------------------
285 : : class EditUndoMarkSelection: public EditUndo
286 : : {
287 : : private:
288 : : ESelection aSelection;
289 : :
290 : : public:
291 : : EditUndoMarkSelection(EditEngine* pEE, const ESelection& rSel);
292 : : virtual ~EditUndoMarkSelection();
293 : :
294 : : virtual void Undo();
295 : : virtual void Redo();
296 : : };
297 : :
298 : :
299 : : #endif // _EDITUNDO_HXX
300 : :
301 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|