LibreOffice Module editeng (master) 1
editundo.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <editdoc.hxx>
23#include <editeng/editund2.hxx>
24#include <editeng/editdata.hxx>
25#include <editeng/editobj.hxx>
26#include <vector>
27#include <memory>
28
29class EditTextObject;
30class EditEngine;
31enum class SetAttribsMode;
32enum class TransliterationFlags;
33
34// EditUndoDelContent
35
37{
38private:
40 sal_Int32 nNode;
41 ContentNode* pContentNode; // Points to the valid,
42 // undestroyed object!
43
44public:
45 EditUndoDelContent(EditEngine* pEE, ContentNode* pNode, sal_Int32 nPortion);
46 virtual ~EditUndoDelContent() override;
47
48 virtual void Undo() override;
49 virtual void Redo() override;
50};
51
52
53// EditUndoConnectParas
54
56{
57private:
58 sal_Int32 nNode;
59 sal_uInt16 nSepPos;
62
63 // 2 Pointers would be nicer but then it would have to be a SfxListener.
68
70
71public:
72 EditUndoConnectParas(EditEngine* pEE, sal_Int32 nNode, sal_uInt16 nSepPos,
74 const SfxStyleSheet* pLeftStyle, const SfxStyleSheet* pRightStyle, bool bBackward);
75 virtual ~EditUndoConnectParas() override;
76
77 virtual void Undo() override;
78 virtual void Redo() override;
79};
80
81
82// EditUndoSplitPara
83
85{
86private:
87 sal_Int32 nNode;
88 sal_uInt16 nSepPos;
89
90public:
91 EditUndoSplitPara(EditEngine* pEE, sal_Int32 nNode, sal_uInt16 nSepPos);
92 virtual ~EditUndoSplitPara() override;
93
94 virtual void Undo() override;
95 virtual void Redo() override;
96};
97
98
99// EditUndoInsertChars
100
102{
103private:
105 OUString aText;
106
107public:
108 EditUndoInsertChars(EditEngine* pEE, const EPaM& rEPaM, OUString aStr);
109
110 virtual void Undo() override;
111 virtual void Redo() override;
112
113 virtual bool Merge( SfxUndoAction *pNextAction ) override;
114};
115
116
117// EditUndoRemoveChars
118
120{
121private:
123 OUString aText;
124
125public:
126 EditUndoRemoveChars(EditEngine* pEE, const EPaM& rEPaM, OUString aStr);
127
128 virtual void Undo() override;
129 virtual void Redo() override;
130};
131
132
133// EditUndoInsertFeature
134
136{
137private:
139 std::unique_ptr<SfxPoolItem> pFeature;
140
141public:
142 EditUndoInsertFeature(EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature);
143 virtual ~EditUndoInsertFeature() override;
144
145 virtual void Undo() override;
146 virtual void Redo() override;
147};
148
149
150// EditUndoMoveParagraphs
151
153{
154private:
156 sal_Int32 nDest;
157
158public:
159 EditUndoMoveParagraphs(EditEngine* pEE, const Range& rParas, sal_Int32 nDest);
160 virtual ~EditUndoMoveParagraphs() override;
161
162 virtual void Undo() override;
163 virtual void Redo() override;
164};
165
166
167// EditUndoSetStyleSheet
168
170{
171private:
172 sal_Int32 nPara;
173 OUString aPrevName;
174 OUString aNewName;
178
179public:
180 EditUndoSetStyleSheet(EditEngine* pEE, sal_Int32 nPara,
184 virtual ~EditUndoSetStyleSheet() override;
185
186 virtual void Undo() override;
187 virtual void Redo() override;
188};
189
190
191// EditUndoSetParaAttribs
192
194{
195private:
196 sal_Int32 nPara;
199
200public:
202 virtual ~EditUndoSetParaAttribs() override;
203
204 virtual void Undo() override;
205 virtual void Redo() override;
206};
207
208
209// EditUndoSetAttribs
210
212{
213private:
214 typedef std::vector<std::unique_ptr<ContentAttribsInfo> > InfoArrayType;
215
219
225 sal_uInt16 nRemoveWhich;
226
227 void ImpSetSelection();
228
229
230public:
231 EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel, SfxItemSet aNewItems);
232 virtual ~EditUndoSetAttribs() override;
233
235
237 void SetUpdateSelection( bool bSetSelection ) { m_bSetSelection = bSetSelection; }
238 void SetRemoveAttribs( bool b ) { bSetIsRemove = b; }
240 void SetRemoveWhich( sal_uInt16 n ) { nRemoveWhich = n; }
241
242 virtual void Undo() override;
243 virtual void Redo() override;
244
246};
247
248
249// EditUndoTransliteration
250
252{
253private:
256
259 std::unique_ptr<EditTextObject>
261 OUString aText;
262
263public:
265 virtual ~EditUndoTransliteration() override;
266
267 void SetText( const OUString& rText ) { aText = rText; }
268 void SetText( std::unique_ptr<EditTextObject> pObj ) { pTxtObj = std::move( pObj ); }
269 void SetNewSelection( const ESelection& rSel ) { aNewESel = rSel; }
270
271 virtual void Undo() override;
272 virtual void Redo() override;
273};
274
275
276// EditUndoMarkSelection
277
279{
280private:
282
283public:
285 virtual ~EditUndoMarkSelection() override;
286
287 virtual void Undo() override;
288 virtual void Redo() override;
289};
290
291/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EditUndoConnectParas(EditEngine *pEE, sal_Int32 nNode, sal_uInt16 nSepPos, SfxItemSet aLeftParaAttribs, SfxItemSet aRightParaAttribs, const SfxStyleSheet *pLeftStyle, const SfxStyleSheet *pRightStyle, bool bBackward)
Definition: editundo.cxx:215
SfxStyleFamily eLeftStyleFamily
Definition: editundo.hxx:66
OUString aRightStyleName
Definition: editundo.hxx:65
SfxItemSet aRightParaAttribs
Definition: editundo.hxx:61
virtual void Redo() override
Definition: editundo.cxx:277
sal_uInt16 nSepPos
Definition: editundo.hxx:59
OUString aLeftStyleName
Definition: editundo.hxx:64
virtual ~EditUndoConnectParas() override
Definition: editundo.cxx:240
virtual void Undo() override
Definition: editundo.cxx:244
SfxStyleFamily eRightStyleFamily
Definition: editundo.hxx:67
SfxItemSet aLeftParaAttribs
Definition: editundo.hxx:60
EditUndoDelContent(EditEngine *pEE, ContentNode *pNode, sal_Int32 nPortion)
Definition: editundo.cxx:160
sal_Int32 nNode
Definition: editundo.hxx:40
ContentNode * pContentNode
Definition: editundo.hxx:41
virtual ~EditUndoDelContent() override
Definition: editundo.cxx:167
virtual void Redo() override
Definition: editundo.cxx:182
virtual void Undo() override
Definition: editundo.cxx:173
virtual void Redo() override
Definition: editundo.cxx:322
virtual void Undo() override
Definition: editundo.cxx:312
EditUndoInsertChars(EditEngine *pEE, const EPaM &rEPaM, OUString aStr)
Definition: editundo.cxx:306
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: editundo.cxx:332
std::unique_ptr< SfxPoolItem > pFeature
Definition: editundo.hxx:139
virtual ~EditUndoInsertFeature() override
Definition: editundo.cxx:383
EditUndoInsertFeature(EditEngine *pEE, const EPaM &rEPaM, const SfxPoolItem &rFeature)
Definition: editundo.cxx:374
virtual void Redo() override
Definition: editundo.cxx:399
virtual void Undo() override
Definition: editundo.cxx:387
EditUndoMarkSelection(EditEngine *pEE, const ESelection &rSel)
Definition: editundo.cxx:657
virtual void Redo() override
Definition: editundo.cxx:674
ESelection aSelection
Definition: editundo.hxx:281
virtual ~EditUndoMarkSelection() override
Definition: editundo.cxx:660
virtual void Undo() override
Definition: editundo.cxx:662
virtual void Undo() override
Definition: editundo.cxx:417
EditUndoMoveParagraphs(EditEngine *pEE, const Range &rParas, sal_Int32 nDest)
Definition: editundo.cxx:411
virtual void Redo() override
Definition: editundo.cxx:440
virtual ~EditUndoMoveParagraphs() override
Definition: editundo.cxx:415
EditUndoRemoveChars(EditEngine *pEE, const EPaM &rEPaM, OUString aStr)
Definition: editundo.cxx:349
virtual void Redo() override
Definition: editundo.cxx:364
virtual void Undo() override
Definition: editundo.cxx:354
void SetSpecial(SetAttribsMode n)
Definition: editundo.hxx:236
void SetRemoveAttribs(bool b)
Definition: editundo.hxx:238
sal_uInt16 nRemoveWhich
Definition: editundo.hxx:225
void SetRemoveWhich(sal_uInt16 n)
Definition: editundo.hxx:240
void SetRemoveParaAttribs(bool b)
Definition: editundo.hxx:239
void ImpSetSelection()
Definition: editundo.cxx:595
InfoArrayType aPrevAttribs
Definition: editundo.hxx:218
void AppendContentInfo(ContentAttribsInfo *pNew)
Definition: editundo.cxx:590
SfxItemSet & GetNewAttribs()
Definition: editundo.hxx:234
SetAttribsMode nSpecial
Definition: editundo.hxx:220
EditUndoSetAttribs(EditEngine *pEE, const ESelection &rESel, SfxItemSet aNewItems)
Definition: editundo.cxx:502
virtual void Undo() override
Definition: editundo.cxx:539
void SetUpdateSelection(bool bSetSelection)
Definition: editundo.hxx:237
ESelection aESel
Definition: editundo.hxx:216
SfxItemSet aNewAttribs
Definition: editundo.hxx:217
bool m_bSetSelection
Once the attributes are set / unset, set the selection to the end of the formatted range?
Definition: editundo.hxx:222
virtual ~EditUndoSetAttribs() override
Definition: editundo.cxx:532
virtual void Redo() override
Definition: editundo.cxx:573
std::vector< std::unique_ptr< ContentAttribsInfo > > InfoArrayType
Definition: editundo.hxx:214
virtual void Redo() override
Definition: editundo.cxx:495
virtual ~EditUndoSetParaAttribs() override
Definition: editundo.cxx:486
EditUndoSetParaAttribs(EditEngine *pEE, sal_Int32 nPara, SfxItemSet aPrevItems, SfxItemSet aNewItems)
Definition: editundo.cxx:479
virtual void Undo() override
Definition: editundo.cxx:488
EditUndoSetStyleSheet(EditEngine *pEE, sal_Int32 nPara, OUString aPrevName, SfxStyleFamily ePrevFamily, OUString aNewName, SfxStyleFamily eNewFamily, SfxItemSet aPrevParaAttribs)
Definition: editundo.cxx:447
virtual void Undo() override
Definition: editundo.cxx:464
SfxStyleFamily ePrevFamily
Definition: editundo.hxx:175
SfxItemSet aPrevParaAttribs
Definition: editundo.hxx:177
virtual void Redo() override
Definition: editundo.cxx:472
virtual ~EditUndoSetStyleSheet() override
Definition: editundo.cxx:460
SfxStyleFamily eNewFamily
Definition: editundo.hxx:176
virtual void Redo() override
Definition: editundo.cxx:299
virtual ~EditUndoSplitPara() override
Definition: editundo.cxx:290
sal_Int32 nNode
Definition: editundo.hxx:87
virtual void Undo() override
Definition: editundo.cxx:292
EditUndoSplitPara(EditEngine *pEE, sal_Int32 nNode, sal_uInt16 nSepPos)
Definition: editundo.cxx:285
sal_uInt16 nSepPos
Definition: editundo.hxx:88
virtual void Undo() override
Definition: editundo.cxx:610
void SetText(std::unique_ptr< EditTextObject > pObj)
Definition: editundo.hxx:268
void SetText(const OUString &rText)
Definition: editundo.hxx:267
virtual void Redo() override
Definition: editundo.cxx:647
EditUndoTransliteration(EditEngine *pEE, const ESelection &rESel, TransliterationFlags nMode)
Definition: editundo.cxx:602
virtual ~EditUndoTransliteration() override
Definition: editundo.cxx:606
TransliterationFlags nMode
Definition: editundo.hxx:258
void SetNewSelection(const ESelection &rSel)
Definition: editundo.hxx:269
std::unique_ptr< EditTextObject > pTxtObj
Definition: editundo.hxx:260
sal_Int64 n
Definition: editdoc.hxx:56
SfxStyleFamily
TransliterationFlags