Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_EDITENG_SOURCE_EDITENG_EDITUNDO_HXX
21 : #define INCLUDED_EDITENG_SOURCE_EDITENG_EDITUNDO_HXX
22 :
23 : #include <editdoc.hxx>
24 : #include <editeng/editund2.hxx>
25 : #include <editeng/editdata.hxx>
26 :
27 : class EditEngine;
28 : class EditView;
29 :
30 :
31 : // EditUndoDelContent
32 :
33 : class EditUndoDelContent : public EditUndo
34 : {
35 : private:
36 : bool bDelObject;
37 : sal_Int32 nNode;
38 : ContentNode* pContentNode; // Points to the valid,
39 : // undestroyed object!
40 :
41 : public:
42 : EditUndoDelContent(EditEngine* pEE, ContentNode* pNode, sal_Int32 nPortion);
43 : virtual ~EditUndoDelContent();
44 :
45 : virtual void Undo() SAL_OVERRIDE;
46 : virtual void Redo() SAL_OVERRIDE;
47 : };
48 :
49 :
50 : // EditUndoConnectParas
51 :
52 : class EditUndoConnectParas : public EditUndo
53 : {
54 : private:
55 : sal_Int32 nNode;
56 : sal_uInt16 nSepPos;
57 : SfxItemSet aLeftParaAttribs;
58 : SfxItemSet aRightParaAttribs;
59 :
60 : // 2 Pointers would be nicer but then it would have to be a SfxListener.
61 : OUString aLeftStyleName;
62 : OUString aRightStyleName;
63 : SfxStyleFamily eLeftStyleFamily;
64 : SfxStyleFamily eRightStyleFamily;
65 :
66 : bool bBackward;
67 :
68 : public:
69 : EditUndoConnectParas(EditEngine* pEE, sal_Int32 nNode, sal_uInt16 nSepPos,
70 : const SfxItemSet& rLeftParaAttribs, const SfxItemSet& rRightParaAttribs,
71 : const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool bBackward);
72 : virtual ~EditUndoConnectParas();
73 :
74 : virtual void Undo() SAL_OVERRIDE;
75 : virtual void Redo() SAL_OVERRIDE;
76 : };
77 :
78 :
79 : // EditUndoSplitPara
80 :
81 : class EditUndoSplitPara : public EditUndo
82 : {
83 : private:
84 : sal_Int32 nNode;
85 : sal_uInt16 nSepPos;
86 :
87 : public:
88 : EditUndoSplitPara(EditEngine* pEE, sal_Int32 nNode, sal_uInt16 nSepPos);
89 : virtual ~EditUndoSplitPara();
90 :
91 : virtual void Undo() SAL_OVERRIDE;
92 : virtual void Redo() SAL_OVERRIDE;
93 : };
94 :
95 :
96 : // EditUndoInsertChars
97 :
98 48090 : class EditUndoInsertChars : public EditUndo
99 : {
100 : private:
101 : EPaM aEPaM;
102 : OUString aText;
103 :
104 : public:
105 : EditUndoInsertChars(EditEngine* pEE, const EPaM& rEPaM, const OUString& rStr);
106 :
107 : const EPaM& GetEPaM() { return aEPaM; }
108 : OUString GetStr() const { return aText; }
109 :
110 : virtual void Undo() SAL_OVERRIDE;
111 : virtual void Redo() SAL_OVERRIDE;
112 :
113 : virtual bool Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
114 : };
115 :
116 :
117 : // EditUndoRemoveChars
118 :
119 1496 : class EditUndoRemoveChars : public EditUndo
120 : {
121 : private:
122 : EPaM aEPaM;
123 : OUString aText;
124 :
125 : public:
126 : EditUndoRemoveChars(EditEngine* pEE, const EPaM& rEPaM, const OUString& rStr);
127 :
128 0 : const EPaM& GetEPaM() { return aEPaM; }
129 0 : OUString GetStr() const { return aText; }
130 :
131 : virtual void Undo() SAL_OVERRIDE;
132 : virtual void Redo() SAL_OVERRIDE;
133 : };
134 :
135 :
136 : // EditUndoInsertFeature
137 :
138 : class EditUndoInsertFeature : public EditUndo
139 : {
140 : private:
141 : EPaM aEPaM;
142 : SfxPoolItem* pFeature;
143 :
144 : public:
145 : EditUndoInsertFeature(EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature);
146 : virtual ~EditUndoInsertFeature();
147 :
148 : virtual void Undo() SAL_OVERRIDE;
149 : virtual void Redo() SAL_OVERRIDE;
150 : };
151 :
152 :
153 : // EditUndoMoveParagraphs
154 :
155 : class EditUndoMoveParagraphs: public EditUndo
156 : {
157 : private:
158 : Range nParagraphs;
159 : sal_Int32 nDest;
160 :
161 : public:
162 : EditUndoMoveParagraphs(EditEngine* pEE, const Range& rParas, sal_Int32 nDest);
163 : virtual ~EditUndoMoveParagraphs();
164 :
165 : virtual void Undo() SAL_OVERRIDE;
166 : virtual void Redo() SAL_OVERRIDE;
167 : };
168 :
169 :
170 : // EditUndoSetStyleSheet
171 :
172 : class EditUndoSetStyleSheet: public EditUndo
173 : {
174 : private:
175 : sal_Int32 nPara;
176 : OUString aPrevName;
177 : OUString aNewName;
178 : SfxStyleFamily ePrevFamily;
179 : SfxStyleFamily eNewFamily;
180 : SfxItemSet aPrevParaAttribs;
181 :
182 : public:
183 : EditUndoSetStyleSheet(EditEngine* pEE, sal_Int32 nPara,
184 : const OUString& rPrevName, SfxStyleFamily ePrevFamily,
185 : const OUString& rNewName, SfxStyleFamily eNewFamily,
186 : const SfxItemSet& rPrevParaAttribs);
187 : virtual ~EditUndoSetStyleSheet();
188 :
189 : virtual void Undo() SAL_OVERRIDE;
190 : virtual void Redo() SAL_OVERRIDE;
191 : };
192 :
193 :
194 : // EditUndoSetParaAttribs
195 :
196 : class EditUndoSetParaAttribs: public EditUndo
197 : {
198 : private:
199 : sal_Int32 nPara;
200 : SfxItemSet aPrevItems;
201 : SfxItemSet aNewItems;
202 :
203 : public:
204 : EditUndoSetParaAttribs(EditEngine* pEE, sal_Int32 nPara, const SfxItemSet& rPrevItems, const SfxItemSet& rNewItems);
205 : virtual ~EditUndoSetParaAttribs();
206 :
207 : virtual void Undo() SAL_OVERRIDE;
208 : virtual void Redo() SAL_OVERRIDE;
209 : };
210 :
211 :
212 : // EditUndoSetAttribs
213 :
214 : class EditUndoSetAttribs: public EditUndo
215 : {
216 : private:
217 : typedef boost::ptr_vector<ContentAttribsInfo> InfoArrayType;
218 :
219 : ESelection aESel;
220 : SfxItemSet aNewAttribs;
221 : InfoArrayType aPrevAttribs;
222 :
223 : sal_uInt8 nSpecial;
224 : bool bSetIsRemove;
225 : bool bRemoveParaAttribs;
226 : sal_uInt16 nRemoveWhich;
227 :
228 : void ImpSetSelection( EditView* pView );
229 :
230 :
231 : public:
232 : EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel, const SfxItemSet& rNewItems);
233 : virtual ~EditUndoSetAttribs();
234 :
235 5929 : SfxItemSet& GetNewAttribs() { return aNewAttribs; }
236 :
237 4728 : void SetSpecial( sal_uInt8 n ) { nSpecial = n; }
238 969 : void SetRemoveAttribs( bool b ) { bSetIsRemove = b; }
239 969 : void SetRemoveParaAttribs( bool b ) { bRemoveParaAttribs = b; }
240 969 : void SetRemoveWhich( sal_uInt16 n ) { nRemoveWhich = n; }
241 :
242 : virtual void Undo() SAL_OVERRIDE;
243 : virtual void Redo() SAL_OVERRIDE;
244 :
245 : void AppendContentInfo(ContentAttribsInfo* pNew);
246 : };
247 :
248 :
249 : // EditUndoTransliteration
250 :
251 : class EditUndoTransliteration: public EditUndo
252 : {
253 : private:
254 : ESelection aOldESel;
255 : ESelection aNewESel;
256 :
257 : sal_Int32 nMode;
258 : EditTextObject* pTxtObj;
259 : OUString aText;
260 :
261 : public:
262 : EditUndoTransliteration(EditEngine* pEE, const ESelection& rESel, sal_Int32 nMode);
263 : virtual ~EditUndoTransliteration();
264 :
265 0 : void SetText( const OUString& rText ) { aText = rText; }
266 0 : void SetText( EditTextObject* pObj ) { pTxtObj = pObj; }
267 0 : void SetNewSelection( const ESelection& rSel ) { aNewESel = rSel; }
268 :
269 : virtual void Undo() SAL_OVERRIDE;
270 : virtual void Redo() SAL_OVERRIDE;
271 : };
272 :
273 :
274 : // EditUndoMarkSelection
275 :
276 : class EditUndoMarkSelection: public EditUndo
277 : {
278 : private:
279 : ESelection aSelection;
280 :
281 : public:
282 : EditUndoMarkSelection(EditEngine* pEE, const ESelection& rSel);
283 : virtual ~EditUndoMarkSelection();
284 :
285 : virtual void Undo() SAL_OVERRIDE;
286 : virtual void Redo() SAL_OVERRIDE;
287 : };
288 :
289 :
290 : #endif // INCLUDED_EDITENG_SOURCE_EDITENG_EDITUNDO_HXX
291 :
292 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|