1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef SC_UNDOTAB_HXX
#define SC_UNDOTAB_HXX
#include "undobase.hxx"
#include "markdata.hxx"
#include "formula/grammar.hxx"
#include <tools/color.hxx>
#include "tabbgcolor.hxx"
#ifndef _SVSTDARR_STRINGS
#define _SVSTDARR_STRINGS
#include <svl/svstdarr.hxx>
#endif
#include <com/sun/star/uno/Sequence.hxx>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <vector>
class ScDocShell;
class ScDocument;
class SdrUndoAction;
class ScPrintRangeSaver;
class SdrObject;
class ScDocProtection;
class ScTableProtection;
//----------------------------------------------------------------------------
class ScUndoInsertTab : public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoInsertTab(
ScDocShell* pNewDocShell,
SCTAB nTabNum,
sal_Bool bApp,
const String& rNewName);
virtual ~ScUndoInsertTab();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
String sNewName;
SdrUndoAction* pDrawUndo;
sal_uLong nEndChangeAction;
SCTAB nTab;
sal_Bool bAppend;
void SetChangeTrack();
};
class ScUndoInsertTables : public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoInsertTables(
ScDocShell* pNewDocShell,
SCTAB nTabNum,
sal_Bool bApp,
SvStrings *pNewNameList);
virtual ~ScUndoInsertTables();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SdrUndoAction* pDrawUndo;
SvStrings* pNameList;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
SCTAB nTab;
sal_Bool bAppend;
void SetChangeTrack();
};
class ScUndoDeleteTab: public ScMoveUndo // Draw vom Move fuer geloeschte Tabelle
{
public:
TYPEINFO();
ScUndoDeleteTab(
ScDocShell* pNewDocShell,
const std::vector<SCTAB> &theTabs, //SCTAB nNewTab,
ScDocument* pUndoDocument,
ScRefUndoData* pRefData );
virtual ~ScUndoDeleteTab();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
std::vector<SCTAB> theTabs;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
void SetChangeTrack();
};
class ScUndoRenameTab: public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoRenameTab(
ScDocShell* pNewDocShell,
SCTAB nT,
const String& rOldName,
const String& rNewName);
virtual ~ScUndoRenameTab();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB nTab;
String sOldName;
String sNewName;
void DoChange( SCTAB nTab, const String& rName ) const;
};
class ScUndoMoveTab: public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoMoveTab(
ScDocShell* pNewDocShell,
::std::vector<SCTAB>* pOldTabs,
::std::vector<SCTAB>* pNewTabs,
::std::vector< ::rtl::OUString>* pOldNames = NULL,
::std::vector< ::rtl::OUString>* pNewNames = NULL );
virtual ~ScUndoMoveTab();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
::boost::shared_ptr< ::std::vector<SCTAB> > mpOldTabs;
::boost::shared_ptr< ::std::vector<SCTAB> > mpNewTabs;
::boost::shared_ptr< ::std::vector< ::rtl::OUString> > mpOldNames;
::boost::shared_ptr< ::std::vector< ::rtl::OUString> > mpNewNames;
void DoChange( sal_Bool bUndo ) const;
};
class ScUndoCopyTab: public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoCopyTab(
ScDocShell* pNewDocShell,
::std::vector<SCTAB>* pOldTabs,
::std::vector<SCTAB>* pNewTabs,
::std::vector< ::rtl::OUString>* pNewNames = NULL );
virtual ~ScUndoCopyTab();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
::boost::shared_ptr< ::std::vector<SCTAB> > mpOldTabs;
::boost::shared_ptr< ::std::vector<SCTAB> > mpNewTabs;
::boost::shared_ptr< ::std::vector< ::rtl::OUString> > mpNewNames;
SdrUndoAction* pDrawUndo;
void DoChange() const;
};
class ScUndoTabColor: public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoTabColor(
ScDocShell* pNewDocShell,
SCTAB nT,
const Color& aOTabBgColor,
const Color& aNTabBgColor);
ScUndoTabColor(
ScDocShell* pNewDocShell,
const ScUndoTabColorInfo::List& rUndoTabColorList);
virtual ~ScUndoTabColor();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
ScUndoTabColorInfo::List aTabColorList;
bool bIsMultipleUndo;
void DoChange(bool bUndoType) const;
};
class ScUndoMakeScenario: public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoMakeScenario(
ScDocShell* pNewDocShell,
SCTAB nSrc, SCTAB nDest,
const String& rN, const String& rC,
const Color& rCol, sal_uInt16 nF,
const ScMarkData& rMark );
virtual ~ScUndoMakeScenario();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB nSrcTab;
SCTAB nDestTab;
String aName;
String aComment;
Color aColor;
sal_uInt16 nFlags;
ScMarkData aMarkData;
SdrUndoAction* pDrawUndo;
};
class ScUndoImportTab : public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoImportTab(
ScDocShell* pShell,
SCTAB nNewTab, SCTAB nNewCount,
sal_Bool bNewLink );
virtual ~ScUndoImportTab();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB nTab;
SCTAB nCount;
sal_Bool bLink;
ScDocument* pRedoDoc;
SdrUndoAction* pDrawUndo;
void DoChange() const;
};
class ScUndoRemoveLink : public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoRemoveLink( // vor dem Loeschen aufrufen!
ScDocShell* pShell,
const String& rDoc );
virtual ~ScUndoRemoveLink();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
String aDocName;
String aFltName;
String aOptions;
sal_uLong nRefreshDelay;
sal_uInt16 nCount;
SCTAB* pTabs;
sal_uInt8* pModes;
String* pTabNames;
void DoChange( sal_Bool bLink ) const;
};
class ScUndoShowHideTab : public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoShowHideTab(
ScDocShell* pShell,
SCTAB nNewTab, sal_Bool bNewShow );
virtual ~ScUndoShowHideTab();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB nTab;
sal_Bool bShow;
void DoChange( sal_Bool bShow ) const;
};
// ============================================================================
/** This class implements undo & redo of document protect & unprotect
operations. */
class ScUndoDocProtect : public ScSimpleUndo
{
public:
ScUndoDocProtect(ScDocShell* pShell, ::std::auto_ptr<ScDocProtection> pProtectSettings);
virtual ~ScUndoDocProtect();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
::std::auto_ptr<ScDocProtection> mpProtectSettings;
void DoProtect(bool bProtect);
};
// ============================================================================
/** This class implements undo & redo of both protect and unprotect of
sheet. */
class ScUndoTabProtect : public ScSimpleUndo
{
public:
ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab,
::std::auto_ptr<ScTableProtection> pProtectSettings);
virtual ~ScUndoTabProtect();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB mnTab;
::std::auto_ptr<ScTableProtection> mpProtectSettings;
void DoProtect(bool bProtect);
};
class ScUndoPrintRange : public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
ScPrintRangeSaver* pOld, ScPrintRangeSaver* pNew );
virtual ~ScUndoPrintRange();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB nTab;
ScPrintRangeSaver* pOldRanges;
ScPrintRangeSaver* pNewRanges;
void DoChange( sal_Bool bUndo );
};
class ScUndoScenarioFlags: public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoScenarioFlags(
ScDocShell* pNewDocShell, SCTAB nT,
const String& rON, const String& rNN,
const String& rOC, const String& rNC,
const Color& rOCol, const Color& rNCol,
sal_uInt16 nOF, sal_uInt16 nNF );
virtual ~ScUndoScenarioFlags();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB nTab;
String aOldName;
String aNewName;
String aOldComment;
String aNewComment;
Color aOldColor;
Color aNewColor;
sal_uInt16 nOldFlags;
sal_uInt16 nNewFlags;
};
class ScUndoRenameObject: public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoRenameObject(
ScDocShell* pNewDocShell, const String& rPN,
const String& rON, const String& rNN );
virtual ~ScUndoRenameObject();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
String aPersistName; // to find object (works only for OLE objects)
String aOldName;
String aNewName;
SdrObject* GetObject();
};
class ScUndoLayoutRTL : public ScSimpleUndo
{
public:
TYPEINFO();
ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, sal_Bool bNewRTL );
virtual ~ScUndoLayoutRTL();
virtual void Undo();
virtual void Redo();
virtual void Repeat(SfxRepeatTarget& rTarget);
virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
virtual String GetComment() const;
private:
SCTAB nTab;
sal_Bool bRTL;
void DoChange( sal_Bool bNew );
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|