xref: /aoo4110/main/sc/source/ui/inc/undodat.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_UNDODAT_HXX
25 #define SC_UNDODAT_HXX
26 
27 #include "undobase.hxx"
28 #include "rangeutl.hxx"		// ScArea
29 #include "rangelst.hxx"		// ScRangeListRef
30 #include "markdata.hxx"
31 #include "sortparam.hxx"
32 #include "queryparam.hxx"
33 #include "pivot.hxx"
34 
35 class ScDocShell;
36 class ScDocument;
37 class ScOutlineTable;
38 class ScRangeName;
39 class ScDBData;
40 class ScDBCollection;
41 class ScDPObject;
42 class SdrUndoAction;
43 
44 //----------------------------------------------------------------------------
45 
46 class ScUndoDoOutline: public ScSimpleUndo
47 {
48 public:
49 					TYPEINFO();
50 					ScUndoDoOutline( ScDocShell* pNewDocShell,
51 							SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
52 							ScDocument* pNewUndoDoc, sal_Bool bNewColumns,
53 							sal_uInt16 nNewLevel, sal_uInt16 nNewEntry, sal_Bool bNewShow );
54 	virtual 		~ScUndoDoOutline();
55 
56 	virtual void	Undo();
57 	virtual void	Redo();
58 	virtual void	Repeat(SfxRepeatTarget& rTarget);
59 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
60 
61 	virtual String	GetComment() const;
62 
63 private:
64 	SCCOLROW		nStart;
65 	SCCOLROW		nEnd;
66 	SCTAB			nTab;
67 	ScDocument*		pUndoDoc;
68 	sal_Bool			bColumns;
69 	sal_uInt16			nLevel;
70 	sal_uInt16			nEntry;
71 	sal_Bool			bShow;
72 };
73 
74 
75 class ScUndoMakeOutline: public ScSimpleUndo
76 {
77 public:
78 					TYPEINFO();
79 					ScUndoMakeOutline( ScDocShell* pNewDocShell,
80 							SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
81 							SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
82 							ScOutlineTable* pNewUndoTab,
83 							sal_Bool bNewColumns, sal_Bool bNewMake );
84 	virtual 		~ScUndoMakeOutline();
85 
86 	virtual void	Undo();
87 	virtual void	Redo();
88 	virtual void	Repeat(SfxRepeatTarget& rTarget);
89 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
90 
91 	virtual String	GetComment() const;
92 
93 private:
94 	ScAddress		aBlockStart;
95 	ScAddress		aBlockEnd;
96 	ScOutlineTable*	pUndoTable;
97 	sal_Bool			bColumns;
98 	sal_Bool			bMake;
99 };
100 
101 
102 class ScUndoOutlineLevel: public ScSimpleUndo
103 {
104 public:
105 					TYPEINFO();
106 					ScUndoOutlineLevel( ScDocShell* pNewDocShell,
107                             SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
108 							ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
109 							sal_Bool bNewColumns, sal_uInt16 nNewLevel );
110 	virtual 		~ScUndoOutlineLevel();
111 
112 	virtual void	Undo();
113 	virtual void	Redo();
114 	virtual void	Repeat(SfxRepeatTarget& rTarget);
115 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
116 
117 	virtual String	GetComment() const;
118 
119 private:
120 	SCCOLROW		nStart;
121 	SCCOLROW		nEnd;
122 	SCTAB			nTab;
123 	ScDocument*		pUndoDoc;
124 	ScOutlineTable*	pUndoTable;
125 	sal_Bool			bColumns;
126 	sal_uInt16			nLevel;
127 };
128 
129 
130 class ScUndoOutlineBlock: public ScSimpleUndo
131 {
132 public:
133 					TYPEINFO();
134 					ScUndoOutlineBlock( ScDocShell* pNewDocShell,
135 							SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
136 							SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
137 							ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
138 							sal_Bool bNewShow );
139 	virtual 		~ScUndoOutlineBlock();
140 
141 	virtual void	Undo();
142 	virtual void	Redo();
143 	virtual void	Repeat(SfxRepeatTarget& rTarget);
144 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
145 
146 	virtual String	GetComment() const;
147 
148 private:
149 	ScAddress		aBlockStart;
150 	ScAddress		aBlockEnd;
151 	ScDocument*		pUndoDoc;
152 	ScOutlineTable*	pUndoTable;
153 	sal_Bool			bShow;
154 };
155 
156 
157 class ScUndoRemoveAllOutlines: public ScSimpleUndo
158 {
159 public:
160 					TYPEINFO();
161 					ScUndoRemoveAllOutlines( ScDocShell* pNewDocShell,
162 							SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
163 							SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
164 							ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab );
165 	virtual 		~ScUndoRemoveAllOutlines();
166 
167 	virtual void	Undo();
168 	virtual void	Redo();
169 	virtual void	Repeat(SfxRepeatTarget& rTarget);
170 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
171 
172 	virtual String	GetComment() const;
173 
174 private:
175 	ScAddress		aBlockStart;
176 	ScAddress		aBlockEnd;
177 	ScDocument*		pUndoDoc;
178 	ScOutlineTable*	pUndoTable;
179 };
180 
181 
182 class ScUndoAutoOutline: public ScSimpleUndo
183 {
184 public:
185 					TYPEINFO();
186 					ScUndoAutoOutline( ScDocShell* pNewDocShell,
187 							SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
188 							SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
189 							ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab );
190 	virtual 		~ScUndoAutoOutline();
191 
192 	virtual void	Undo();
193 	virtual void	Redo();
194 	virtual void	Repeat(SfxRepeatTarget& rTarget);
195 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
196 
197 	virtual String	GetComment() const;
198 
199 private:
200 	ScAddress		aBlockStart;
201 	ScAddress		aBlockEnd;
202 	ScDocument*		pUndoDoc;
203 	ScOutlineTable*	pUndoTable;
204 };
205 
206 
207 class ScUndoSubTotals: public ScDBFuncUndo
208 {
209 public:
210 					TYPEINFO();
211 					ScUndoSubTotals( ScDocShell* pNewDocShell, SCTAB nNewTab,
212 							const ScSubTotalParam& rNewParam, SCROW nNewEndY,
213 							ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
214 //							ScDBData* pNewData,
215 							ScRangeName* pNewUndoRange, ScDBCollection* pNewUndoDB );
216 	virtual 		~ScUndoSubTotals();
217 
218 	virtual void	Undo();
219 	virtual void	Redo();
220 	virtual void	Repeat(SfxRepeatTarget& rTarget);
221 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
222 
223 	virtual String	GetComment() const;
224 
225 private:
226 	SCTAB			nTab;
227 	ScSubTotalParam	aParam;							// Original uebergebener Parameter
228 	SCROW			nNewEndRow;						// Ergebnis-Groesse
229 	ScDocument*		pUndoDoc;
230 	ScOutlineTable*	pUndoTable;
231 //	ScDBData*		pUndoDBData;
232 	ScRangeName*	pUndoRange;
233 	ScDBCollection*	pUndoDB;
234 };
235 
236 
237 class ScUndoSort: public ScDBFuncUndo
238 {
239 public:
240 					TYPEINFO();
241 					ScUndoSort( ScDocShell* pNewDocShell, SCTAB nNewTab,
242 							const ScSortParam& rParam,
243 							sal_Bool bQuery, ScDocument* pNewUndoDoc,
244 							ScDBCollection* pNewUndoDB, const ScRange* pDest = NULL );
245 	virtual 		~ScUndoSort();
246 
247 	virtual void	Undo();
248 	virtual void	Redo();
249 	virtual void	Repeat(SfxRepeatTarget& rTarget);
250 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
251 
252 	virtual String	GetComment() const;
253 
254 private:
255 	SCTAB			nTab;
256 	ScSortParam		aSortParam;
257 	sal_Bool			bRepeatQuery;
258 	ScDocument*		pUndoDoc;
259 	ScDBCollection*	pUndoDB;				// wegen Quell- und Zielbereich
260 	sal_Bool			bDestArea;
261 	ScRange			aDestRange;
262 };
263 
264 
265 class ScUndoQuery: public ScDBFuncUndo
266 {
267 public:
268 					TYPEINFO();
269 					ScUndoQuery( ScDocShell* pNewDocShell, SCTAB nNewTab,
270 							const ScQueryParam& rParam, ScDocument* pNewUndoDoc,
271 							ScDBCollection* pNewUndoDB, const ScRange* pOld,
272 							sal_Bool bSize, const ScRange* pAdvSrc );
273 	virtual 		~ScUndoQuery();
274 
275 	virtual void	Undo();
276 	virtual void	Redo();
277 	virtual void	Repeat(SfxRepeatTarget& rTarget);
278 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
279 
280 	virtual String	GetComment() const;
281 
282 private:
283     SdrUndoAction*  pDrawUndo;
284 	SCTAB			nTab;
285 	ScQueryParam	aQueryParam;
286 	ScDocument*		pUndoDoc;
287 	ScDBCollection*	pUndoDB;				// wegen Quell- und Zielbereich
288 	ScRange			aOldDest;
289 	ScRange			aAdvSource;
290 	sal_Bool			bIsAdvanced;
291 	sal_Bool			bDestArea;
292 	sal_Bool			bDoSize;
293 };
294 
295 
296 class ScUndoAutoFilter: public ScDBFuncUndo
297 {
298 private:
299     String          aDBName;
300     sal_Bool            bFilterSet;
301 
302     void            DoChange( sal_Bool bUndo );
303 
304 public:
305                     TYPEINFO();
306                     ScUndoAutoFilter( ScDocShell* pNewDocShell, const ScRange& rRange,
307                             const String& rName, sal_Bool bSet );
308     virtual         ~ScUndoAutoFilter();
309 
310     virtual void    Undo();
311     virtual void    Redo();
312     virtual void    Repeat(SfxRepeatTarget& rTarget);
313     virtual sal_Bool    CanRepeat(SfxRepeatTarget& rTarget) const;
314 
315     virtual String  GetComment() const;
316 };
317 
318 
319 class ScUndoDBData: public ScSimpleUndo
320 {
321 public:
322 					TYPEINFO();
323 					ScUndoDBData( ScDocShell* pNewDocShell,
324 							ScDBCollection* pNewUndoColl, ScDBCollection* pNewRedoColl );
325 	virtual 		~ScUndoDBData();
326 
327 	virtual void	Undo();
328 	virtual void	Redo();
329 	virtual void	Repeat(SfxRepeatTarget& rTarget);
330 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
331 
332 	virtual String	GetComment() const;
333 
334 private:
335 	ScDBCollection* pUndoColl;
336 	ScDBCollection* pRedoColl;
337 };
338 
339 
340 class ScUndoImportData: public ScSimpleUndo
341 {
342 public:
343 					TYPEINFO();
344 					ScUndoImportData( ScDocShell* pNewDocShell, SCTAB nNewTab,
345 							const ScImportParam& rParam, SCCOL nNewEndX, SCROW nNewEndY,
346 							SCCOL nNewFormula,
347 							ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
348 							ScDBData* pNewUndoData, ScDBData* pNewRedoData );
349 	virtual 		~ScUndoImportData();
350 
351 	virtual void	Undo();
352 	virtual void	Redo();
353 	virtual void	Repeat(SfxRepeatTarget& rTarget);
354 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
355 
356 	virtual String	GetComment() const;
357 
358 private:
359 	SCTAB			nTab;
360 	ScImportParam	aImportParam;
361 	SCCOL			nEndCol;
362 	SCROW			nEndRow;
363 	ScDocument*		pUndoDoc;
364 	ScDocument*		pRedoDoc;
365 	ScDBData*		pUndoDBData;
366 	ScDBData*		pRedoDBData;
367 	SCCOL			nFormulaCols;
368 	sal_Bool			bRedoFilled;
369 };
370 
371 
372 class ScUndoRepeatDB: public ScSimpleUndo
373 {
374 public:
375 					TYPEINFO();
376 					ScUndoRepeatDB( ScDocShell* pNewDocShell, SCTAB nNewTab,
377 							SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY,
378 							SCROW nResultEndRow, SCCOL nCurX, SCROW nCurY,
379 							ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
380 							ScRangeName* pNewUndoRange, ScDBCollection* pNewUndoDB,
381 							const ScRange* pOldQ, const ScRange* pNewQ );
382 	virtual 		~ScUndoRepeatDB();
383 
384 	virtual void	Undo();
385 	virtual void	Redo();
386 	virtual void	Repeat(SfxRepeatTarget& rTarget);
387 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
388 
389 	virtual String	GetComment() const;
390 
391 private:
392 	ScAddress		aBlockStart;
393 	ScAddress		aBlockEnd;
394 	SCROW			nNewEndRow;
395 	ScAddress		aCursorPos;
396 	ScDocument*		pUndoDoc;
397 	ScOutlineTable*	pUndoTable;
398 	ScRangeName*	pUndoRange;
399 	ScDBCollection*	pUndoDB;
400 	ScRange			aOldQuery;
401 	ScRange			aNewQuery;
402 	sal_Bool			bQuerySize;
403 };
404 
405 //UNUSED2008-05  class ScUndoPivot: public ScSimpleUndo
406 //UNUSED2008-05  {
407 //UNUSED2008-05  public:
408 //UNUSED2008-05                      TYPEINFO();
409 //UNUSED2008-05                      ScUndoPivot( ScDocShell* pNewDocShell,
410 //UNUSED2008-05                              const ScArea& rOld, const ScArea& rNew,
411 //UNUSED2008-05                              ScDocument* pOldDoc, ScDocument* pNewDoc,
412 //UNUSED2008-05                              const ScPivot* pOldPivot, const ScPivot* pNewPivot );
413 //UNUSED2008-05      virtual         ~ScUndoPivot();
414 //UNUSED2008-05
415 //UNUSED2008-05      virtual void    Undo();
416 //UNUSED2008-05      virtual void    Redo();
417 //UNUSED2008-05      virtual void    Repeat(SfxRepeatTarget& rTarget);
418 //UNUSED2008-05      virtual sal_Bool    CanRepeat(SfxRepeatTarget& rTarget) const;
419 //UNUSED2008-05
420 //UNUSED2008-05      virtual String  GetComment() const;
421 //UNUSED2008-05
422 //UNUSED2008-05  private:
423 //UNUSED2008-05      ScArea          aOldArea;
424 //UNUSED2008-05      ScArea          aNewArea;
425 //UNUSED2008-05      ScDocument*     pOldUndoDoc;
426 //UNUSED2008-05      ScDocument*     pNewUndoDoc;
427 //UNUSED2008-05      ScPivotParam    aOldParam;              // fuer Redo
428 //UNUSED2008-05      ScQueryParam    aOldQuery;
429 //UNUSED2008-05      ScArea          aOldSrc;
430 //UNUSED2008-05      ScPivotParam    aNewParam;              // fuer Undo in Collection
431 //UNUSED2008-05      ScQueryParam    aNewQuery;
432 //UNUSED2008-05      ScArea          aNewSrc;
433 //UNUSED2008-05      String          aOldName;
434 //UNUSED2008-05      String          aOldTag;
435 //UNUSED2008-05      String          aNewName;
436 //UNUSED2008-05      String          aNewTag;
437 //UNUSED2008-05  };
438 
439 class ScUndoDataPilot: public ScSimpleUndo
440 {
441 public:
442 					TYPEINFO();
443 					ScUndoDataPilot( ScDocShell* pNewDocShell,
444 							ScDocument* pOldDoc, ScDocument* pNewDoc,
445 							const ScDPObject* pOldObj, const ScDPObject* pNewObj,
446 							sal_Bool bMove );
447 	virtual 		~ScUndoDataPilot();
448 
449 	virtual void	Undo();
450 	virtual void	Redo();
451 	virtual void	Repeat(SfxRepeatTarget& rTarget);
452 	virtual sal_Bool	CanRepeat(SfxRepeatTarget& rTarget) const;
453 
454 	virtual String	GetComment() const;
455 
456 private:
457 	ScDocument*		pOldUndoDoc;
458 	ScDocument*		pNewUndoDoc;
459 	ScDPObject*		pOldDPObject;
460 	ScDPObject*		pNewDPObject;
461 	sal_Bool			bAllowMove;
462 };
463 
464 
465 class ScUndoConsolidate: public ScSimpleUndo
466 {
467 public:
468 						TYPEINFO();
469 						ScUndoConsolidate( ScDocShell* pNewDocShell,
470 								const ScArea& rArea, const ScConsolidateParam& rPar,
471 								ScDocument* pNewUndoDoc, sal_Bool bReference,
472 								SCROW nInsCount, ScOutlineTable* pTab,
473 								ScDBData* pData );
474 	virtual 			~ScUndoConsolidate();
475 
476 	virtual void		Undo();
477 	virtual void		Redo();
478 	virtual void		Repeat(SfxRepeatTarget& rTarget);
479 	virtual sal_Bool		CanRepeat(SfxRepeatTarget& rTarget) const;
480 
481 	virtual String		GetComment() const;
482 
483 private:
484 	ScArea				aDestArea;
485 	ScDocument*			pUndoDoc;
486 	ScConsolidateParam	aParam;
487 	sal_Bool				bInsRef;
488 	SCSIZE				nInsertCount;
489 	ScOutlineTable*		pUndoTab;
490 	ScDBData*			pUndoData;
491 };
492 
493 
494 class ScUndoChartData: public ScSimpleUndo
495 {
496 public:
497 						TYPEINFO();
498 						ScUndoChartData( ScDocShell* pNewDocShell,
499 								const String& rName, const ScRange& rNew,
500 								sal_Bool bColHdr, sal_Bool bRowHdr, sal_Bool bAdd );
501 						ScUndoChartData( ScDocShell* pNewDocShell,
502 								const String& rName, const ScRangeListRef& rNew,
503 								sal_Bool bColHdr, sal_Bool bRowHdr, sal_Bool bAdd );
504 	virtual 			~ScUndoChartData();
505 
506 	virtual void		Undo();
507 	virtual void		Redo();
508 	virtual void		Repeat(SfxRepeatTarget& rTarget);
509 	virtual sal_Bool		CanRepeat(SfxRepeatTarget& rTarget) const;
510 
511 	virtual String		GetComment() const;
512 
513 private:
514 	String				aChartName;
515 	ScRangeListRef		aOldRangeListRef;
516 	sal_Bool				bOldColHeaders;
517 	sal_Bool				bOldRowHeaders;
518 //	ScRange				aNewRange;
519 	ScRangeListRef		aNewRangeListRef;
520 	sal_Bool				bNewColHeaders;
521 	sal_Bool				bNewRowHeaders;
522 	sal_Bool				bAddRange;
523 
524 	void				Init();
525 };
526 
527 
528 
529 
530 #endif
531 
532