xref: /aoo41x/main/sc/source/ui/undo/undotab.cxx (revision 37e3d887)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 #include <sfx2/app.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/dispatch.hxx>
30 #include <svl/smplhint.hxx>
31 
32 #include "undotab.hxx"
33 #include "document.hxx"
34 #include "docsh.hxx"
35 #include "tabvwsh.hxx"
36 #include "globstr.hrc"
37 #include "global.hxx"
38 #include "sc.hrc"
39 #include "undoolk.hxx"
40 #include "target.hxx"
41 #include "uiitems.hxx"
42 #include "prnsave.hxx"
43 #include "printfun.hxx"
44 #include "chgtrack.hxx"
45 #include "tabprotection.hxx"
46 #include "viewdata.hxx"
47 
48 // for ScUndoRenameObject - might me moved to another file later
49 #include <svx/svditer.hxx>
50 #include <svx/svdoole2.hxx>
51 #include <svx/svdpage.hxx>
52 #include "drwlayer.hxx"
53 #include "scresid.hxx"
54 
55 extern sal_Bool bDrawIsInUndo;			//! irgendwo als Member !!!
56 
57 using namespace com::sun::star;
58 using ::com::sun::star::uno::Sequence;
59 using ::std::auto_ptr;
60 
61 // STATIC DATA -----------------------------------------------------------
62 
63 TYPEINIT1(ScUndoInsertTab,		SfxUndoAction);
64 TYPEINIT1(ScUndoInsertTables,	SfxUndoAction);
65 TYPEINIT1(ScUndoDeleteTab,		SfxUndoAction);
66 TYPEINIT1(ScUndoRenameTab,		SfxUndoAction);
67 TYPEINIT1(ScUndoMoveTab,		SfxUndoAction);
68 TYPEINIT1(ScUndoCopyTab,		SfxUndoAction);
69 TYPEINIT1(ScUndoMakeScenario,	SfxUndoAction);
70 TYPEINIT1(ScUndoImportTab,		SfxUndoAction);
71 TYPEINIT1(ScUndoRemoveLink,		SfxUndoAction);
72 TYPEINIT1(ScUndoShowHideTab,	SfxUndoAction);
73 TYPEINIT1(ScUndoPrintRange,		SfxUndoAction);
74 TYPEINIT1(ScUndoScenarioFlags,	SfxUndoAction);
75 TYPEINIT1(ScUndoRenameObject,	SfxUndoAction);
76 TYPEINIT1(ScUndoLayoutRTL,		SfxUndoAction);
77 //UNUSED2009-05 TYPEINIT1(ScUndoSetGrammar,		SfxUndoAction);
78 TYPEINIT1(ScUndoTabColor,  SfxUndoAction);
79 
80 
81 // -----------------------------------------------------------------------
82 //
83 //		Tabelle einfuegen
84 //
85 
ScUndoInsertTab(ScDocShell * pNewDocShell,SCTAB nTabNum,sal_Bool bApp,const String & rNewName)86 ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
87 								  SCTAB nTabNum,
88 								  sal_Bool bApp,
89 								  const String& rNewName) :
90 	ScSimpleUndo( pNewDocShell ),
91 	sNewName( rNewName ),
92 	pDrawUndo( NULL ),
93 	nTab( nTabNum ),
94 	bAppend( bApp )
95 {
96 	pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
97 	SetChangeTrack();
98 }
99 
~ScUndoInsertTab()100 ScUndoInsertTab::~ScUndoInsertTab()
101 {
102 	DeleteSdrUndoAction( pDrawUndo );
103 }
104 
GetComment() const105 String ScUndoInsertTab::GetComment() const
106 {
107 	if (bAppend)
108 		return ScGlobal::GetRscString( STR_UNDO_APPEND_TAB );
109 	else
110 		return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
111 }
112 
SetChangeTrack()113 void ScUndoInsertTab::SetChangeTrack()
114 {
115 	ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
116 	if ( pChangeTrack )
117 	{
118 		ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab );
119 		pChangeTrack->AppendInsert( aRange );
120 		nEndChangeAction = pChangeTrack->GetActionMax();
121 	}
122 	else
123 		nEndChangeAction = 0;
124 }
125 
Undo()126 void ScUndoInsertTab::Undo()
127 {
128 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
129 	pViewShell->SetTabNo(nTab);
130 
131 	pDocShell->SetInUndo( sal_True );				//! BeginUndo
132 	bDrawIsInUndo = sal_True;
133 	pViewShell->DeleteTable( nTab, sal_False );
134 	bDrawIsInUndo = sal_False;
135 	pDocShell->SetInUndo( sal_False );				//! EndUndo
136 
137     DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
138 
139 	ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
140 	if ( pChangeTrack )
141 		pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
142 
143 	//	SetTabNo(...,sal_True) for all views to sync with drawing layer pages
144 	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
145 }
146 
Redo()147 void ScUndoInsertTab::Redo()
148 {
149 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
150 
151     RedoSdrUndoAction( pDrawUndo );             // Draw Redo first
152 
153 	pDocShell->SetInUndo( sal_True );				//! BeginRedo
154 	bDrawIsInUndo = sal_True;
155 	if (bAppend)
156 		pViewShell->AppendTable( sNewName, sal_False );
157 	else
158 	{
159 		pViewShell->SetTabNo(nTab);
160 		pViewShell->InsertTable( sNewName, nTab, sal_False );
161 	}
162 	bDrawIsInUndo = sal_False;
163 	pDocShell->SetInUndo( sal_False );				//! EndRedo
164 
165 	SetChangeTrack();
166 }
167 
Repeat(SfxRepeatTarget & rTarget)168 void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
169 {
170 	if (rTarget.ISA(ScTabViewTarget))
171 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
172 			Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
173 }
174 
CanRepeat(SfxRepeatTarget & rTarget) const175 sal_Bool ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const
176 {
177 	return (rTarget.ISA(ScTabViewTarget));
178 }
179 
180 // -----------------------------------------------------------------------
181 //
182 //		Tabellen einfuegen
183 //
184 
ScUndoInsertTables(ScDocShell * pNewDocShell,SCTAB nTabNum,sal_Bool bApp,SvStrings * pNewNameList)185 ScUndoInsertTables::ScUndoInsertTables( ScDocShell* pNewDocShell,
186 										SCTAB nTabNum,
187 										sal_Bool bApp,SvStrings *pNewNameList) :
188 	ScSimpleUndo( pNewDocShell ),
189 	pDrawUndo( NULL ),
190 	nTab( nTabNum ),
191 	bAppend( bApp )
192 {
193 	pNameList =	pNewNameList;
194 	pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
195 
196 	SetChangeTrack();
197 }
198 
~ScUndoInsertTables()199 ScUndoInsertTables::~ScUndoInsertTables()
200 {
201 	String *pStr=NULL;
202 	if(pNameList!=NULL)
203 	{
204 		for(int i=0;i<pNameList->Count();i++)
205 		{
206             pStr=pNameList->GetObject(sal::static_int_cast<sal_uInt16>(i));
207 			delete pStr;
208 		}
209 		pNameList->Remove(0,pNameList->Count());
210 		delete pNameList;
211 	}
212 	DeleteSdrUndoAction( pDrawUndo );
213 }
214 
GetComment() const215 String ScUndoInsertTables::GetComment() const
216 {
217 	return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
218 }
219 
SetChangeTrack()220 void ScUndoInsertTables::SetChangeTrack()
221 {
222 	ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
223 	if ( pChangeTrack )
224 	{
225 		nStartChangeAction = pChangeTrack->GetActionMax() + 1;
226 		nEndChangeAction = 0;
227 		ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab );
228 		for( int i = 0; i < pNameList->Count(); i++ )
229 		{
230             aRange.aStart.SetTab( sal::static_int_cast<SCTAB>( nTab + i ) );
231             aRange.aEnd.SetTab( sal::static_int_cast<SCTAB>( nTab + i ) );
232 			pChangeTrack->AppendInsert( aRange );
233 			nEndChangeAction = pChangeTrack->GetActionMax();
234 		}
235 	}
236 	else
237 		nStartChangeAction = nEndChangeAction = 0;
238 }
239 
Undo()240 void ScUndoInsertTables::Undo()
241 {
242 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
243 	pViewShell->SetTabNo(nTab);
244 
245 	pDocShell->SetInUndo( sal_True );				//! BeginUndo
246 	bDrawIsInUndo = sal_True;
247 
248 	SvShorts TheTabs;
249 	for(int i=0;i<pNameList->Count();i++)
250 	{
251         TheTabs.push_back( sal::static_int_cast<short>(nTab+i) );
252 	}
253 
254 	pViewShell->DeleteTables( TheTabs, sal_False );
255 	TheTabs.clear();
256 
257 	bDrawIsInUndo = sal_False;
258 	pDocShell->SetInUndo( sal_False );				//! EndUndo
259 
260     DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
261 
262 	ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
263 	if ( pChangeTrack )
264 		pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
265 
266 	//	SetTabNo(...,sal_True) for all views to sync with drawing layer pages
267 	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
268 }
269 
Redo()270 void ScUndoInsertTables::Redo()
271 {
272 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
273 
274     RedoSdrUndoAction( pDrawUndo );             // Draw Redo first
275 
276 	pDocShell->SetInUndo( sal_True );				//! BeginRedo
277 	bDrawIsInUndo = sal_True;
278 	pViewShell->SetTabNo(nTab);
279 	pViewShell->InsertTables( pNameList, nTab, static_cast<SCTAB>(pNameList->Count()),sal_False );
280 
281 	bDrawIsInUndo = sal_False;
282 	pDocShell->SetInUndo( sal_False );				//! EndRedo
283 
284 	SetChangeTrack();
285 }
286 
Repeat(SfxRepeatTarget & rTarget)287 void ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
288 {
289 	if (rTarget.ISA(ScTabViewTarget))
290 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
291 			Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
292 }
293 
CanRepeat(SfxRepeatTarget & rTarget) const294 sal_Bool ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
295 {
296 	return (rTarget.ISA(ScTabViewTarget));
297 }
298 
299 
300 //----------------------------------------------------------------------------------
301 //
302 //		Tabelle loeschen
303 //
304 
ScUndoDeleteTab(ScDocShell * pNewDocShell,const SvShorts & aTab,ScDocument * pUndoDocument,ScRefUndoData * pRefData)305 ScUndoDeleteTab::ScUndoDeleteTab( ScDocShell* pNewDocShell,const SvShorts &aTab, //SCTAB nNewTab,
306 									ScDocument* pUndoDocument, ScRefUndoData* pRefData ) :
307 	ScMoveUndo( pNewDocShell, pUndoDocument, pRefData, SC_UNDO_REFLAST )
308 {
309         theTabs=aTab;
310 
311 		SetChangeTrack();
312 }
313 
~ScUndoDeleteTab()314 ScUndoDeleteTab::~ScUndoDeleteTab()
315 {
316 	theTabs.clear();
317 }
318 
GetComment() const319 String ScUndoDeleteTab::GetComment() const
320 {
321 	return ScGlobal::GetRscString( STR_UNDO_DELETE_TAB );
322 }
323 
SetChangeTrack()324 void ScUndoDeleteTab::SetChangeTrack()
325 {
326 	ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
327 	if ( pChangeTrack )
328 	{
329 		sal_uLong nTmpChangeAction;
330 		nStartChangeAction = pChangeTrack->GetActionMax() + 1;
331 		nEndChangeAction = 0;
332 		ScRange aRange( 0, 0, 0, MAXCOL, MAXROW, 0 );
333 		for ( size_t i = 0; i < theTabs.size(); i++ )
334 		{
335             aRange.aStart.SetTab( theTabs[sal::static_int_cast<sal_uInt16>(i)] );
336             aRange.aEnd.SetTab( theTabs[sal::static_int_cast<sal_uInt16>(i)] );
337 			pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc,
338 				nTmpChangeAction, nEndChangeAction, (short) i );
339 		}
340 	}
341 	else
342 		nStartChangeAction = nEndChangeAction = 0;
343 }
344 
lcl_GetVisibleTabBefore(ScDocument & rDoc,SCTAB nTab)345 SCTAB lcl_GetVisibleTabBefore( ScDocument& rDoc, SCTAB nTab )
346 {
347 	while ( nTab > 0 && !rDoc.IsVisible( nTab ) )
348 		--nTab;
349 
350 	return nTab;
351 }
352 
Undo()353 void ScUndoDeleteTab::Undo()
354 {
355 	BeginUndo();
356 	size_t i=0;
357 	ScDocument* pDoc = pDocShell->GetDocument();
358 
359 	sal_Bool bLink = sal_False;
360 	String aName;
361 
362 	for(i=0;i<theTabs.size();i++)
363 	{
364         SCTAB nTab = theTabs[sal::static_int_cast<sal_uInt16>(i)];
365         pRefUndoDoc->GetName( nTab, aName );
366 
367 		bDrawIsInUndo = sal_True;
368         sal_Bool bOk = pDoc->InsertTab( nTab, aName );
369 		bDrawIsInUndo = sal_False;
370 		if (bOk)
371 		{
372 			//	Ref-Undo passiert in EndUndo
373 	//		pUndoDoc->UndoToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,sal_False, pDoc );
374             pRefUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,sal_False, pDoc );
375 
376 			String aOldName;
377             pRefUndoDoc->GetName( nTab, aOldName );
378             pDoc->RenameTab( nTab, aOldName, sal_False );
379             if (pRefUndoDoc->IsLinked(nTab))
380 			{
381                 pDoc->SetLink( nTab, pRefUndoDoc->GetLinkMode(nTab), pRefUndoDoc->GetLinkDoc(nTab),
382                                      pRefUndoDoc->GetLinkFlt(nTab), pRefUndoDoc->GetLinkOpt(nTab),
383                                      pRefUndoDoc->GetLinkTab(nTab), pRefUndoDoc->GetLinkRefreshDelay(nTab) );
384 				bLink = sal_True;
385 			}
386 
387             if ( pRefUndoDoc->IsScenario(nTab) )
388 			{
389                 pDoc->SetScenario( nTab, sal_True );
390 				String aComment;
391 				Color  aColor;
392 				sal_uInt16 nScenFlags;
393                 pRefUndoDoc->GetScenarioData( nTab, aComment, aColor, nScenFlags );
394                 pDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
395                 sal_Bool bActive = pRefUndoDoc->IsActiveScenario( nTab );
396                 pDoc->SetActiveScenario( nTab, bActive );
397 			}
398             pDoc->SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
399             pDoc->SetTabBgColor( nTab, pRefUndoDoc->GetTabBgColor(nTab) );
400             pDoc->SetSheetEvents( nTab, pRefUndoDoc->GetSheetEvents( nTab ) );
401 
402             if ( pRefUndoDoc->IsTabProtected( nTab ) )
403                 pDoc->SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
404 
405 			//	Drawing-Layer passiert beim MoveUndo::EndUndo
406 	//		pDoc->TransferDrawPage(pRefUndoDoc, nTab,nTab);
407 		}
408 	}
409 	if (bLink)
410 	{
411 		pDocShell->UpdateLinks();				// Link-Manager updaten
412 	}
413 
414 	EndUndo();		// Draw-Undo muss vor dem Broadcast kommen!
415 
416 	ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
417 	if ( pChangeTrack )
418 		pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
419 
420 	for(i=0;i<theTabs.size();i++)
421 	{
422         pDocShell->Broadcast( ScTablesHint( SC_TAB_INSERTED, theTabs[sal::static_int_cast<sal_uInt16>(i)]) );
423 	}
424     SfxApplication* pSfxApp = SFX_APP();                                // Navigator
425     pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
426     pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
427     pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
428 
429 	pDocShell->PostPaint(0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_ALL );	// incl. Extras
430 
431 	//	nicht ShowTable wegen SetTabNo(..., sal_True):
432 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
433 	if (pViewShell)
434 		pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDoc, theTabs.front() ), sal_True );
435 
436 //	EndUndo();
437 }
438 
Redo()439 void ScUndoDeleteTab::Redo()
440 {
441 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
442 	pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDocShell->GetDocument(), theTabs.front() ) );
443 
444     RedoSdrUndoAction( pDrawUndo );             // Draw Redo first
445 
446 	pDocShell->SetInUndo( sal_True );				//! BeginRedo
447 	bDrawIsInUndo = sal_True;
448 	pViewShell->DeleteTables( theTabs, sal_False );
449 	bDrawIsInUndo = sal_False;
450 	pDocShell->SetInUndo( sal_True );				//! EndRedo
451 
452 	SetChangeTrack();
453 
454 	//	SetTabNo(...,sal_True) for all views to sync with drawing layer pages
455 	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
456 }
457 
Repeat(SfxRepeatTarget & rTarget)458 void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
459 {
460 	if (rTarget.ISA(ScTabViewTarget))
461 	{
462 		ScTabViewShell* pViewShell = ((ScTabViewTarget&)rTarget).GetViewShell();
463 		pViewShell->DeleteTable( pViewShell->GetViewData()->GetTabNo(), sal_True );
464 	}
465 }
466 
CanRepeat(SfxRepeatTarget & rTarget) const467 sal_Bool ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const
468 {
469 	return (rTarget.ISA(ScTabViewTarget));
470 }
471 
472 
473 //---------------------------------------------------------------------------------
474 //
475 //		Tabelle umbenennen
476 //
477 
ScUndoRenameTab(ScDocShell * pNewDocShell,SCTAB nT,const String & rOldName,const String & rNewName)478 ScUndoRenameTab::ScUndoRenameTab( ScDocShell* pNewDocShell,
479 								  SCTAB nT,
480 								  const String& rOldName,
481 								  const String& rNewName) :
482 	ScSimpleUndo( pNewDocShell ),
483 	nTab 	 ( nT )
484 {
485 	sOldName = rOldName;
486 	sNewName = rNewName;
487 }
488 
~ScUndoRenameTab()489 ScUndoRenameTab::~ScUndoRenameTab()
490 {
491 }
492 
GetComment() const493 String ScUndoRenameTab::GetComment() const
494 {
495 	return ScGlobal::GetRscString( STR_UNDO_RENAME_TAB );
496 }
497 
DoChange(SCTAB nTabP,const String & rName) const498 void ScUndoRenameTab::DoChange( SCTAB nTabP, const String& rName ) const
499 {
500 	ScDocument* pDoc = pDocShell->GetDocument();
501     pDoc->RenameTab( nTabP, rName );
502 
503 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );	// Navigator
504 
505 	pDocShell->PostPaintGridAll();
506 	pDocShell->PostPaintExtras();
507 	pDocShell->PostDataChanged();
508 
509 	//	Der Tabellenname koennte in einer Formel vorkommen...
510 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
511 	if (pViewShell)
512 		pViewShell->UpdateInputHandler();
513 }
514 
Undo()515 void ScUndoRenameTab::Undo()
516 {
517 	DoChange(nTab, sOldName);
518 }
519 
Redo()520 void ScUndoRenameTab::Redo()
521 {
522 	DoChange(nTab, sNewName);
523 }
524 
Repeat(SfxRepeatTarget &)525 void ScUndoRenameTab::Repeat(SfxRepeatTarget& /* rTarget */)
526 {
527 	//	Repeat macht keinen Sinn
528 }
529 
CanRepeat(SfxRepeatTarget &) const530 sal_Bool ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
531 {
532 	return sal_False;
533 }
534 
535 
536 //----------------------------------------------------------------------------------
537 //
538 //		Tabelle verschieben
539 //
540 
ScUndoMoveTab(ScDocShell * pNewDocShell,const SvShorts & aOldTab,const SvShorts & aNewTab)541 ScUndoMoveTab::ScUndoMoveTab( ScDocShell* pNewDocShell,
542 								  const SvShorts &aOldTab,
543 								  const SvShorts &aNewTab) :
544 	ScSimpleUndo( pNewDocShell )
545 {
546     theOldTabs=aOldTab;
547     theNewTabs=aNewTab;
548 }
549 
~ScUndoMoveTab()550 ScUndoMoveTab::~ScUndoMoveTab()
551 {
552 	theNewTabs.clear();
553 	theOldTabs.clear();
554 }
555 
GetComment() const556 String ScUndoMoveTab::GetComment() const
557 {
558 	return ScGlobal::GetRscString( STR_UNDO_MOVE_TAB );
559 }
560 
DoChange(sal_Bool bUndo) const561 void ScUndoMoveTab::DoChange( sal_Bool bUndo ) const
562 {
563 	ScDocument* pDoc = pDocShell->GetDocument();
564 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
565 
566 	if (bUndo)										// UnDo
567 	{
568         for (size_t i = theNewTabs.size(); i > 0; i--)
569         {
570             SCTAB nDestTab = theNewTabs[i - 1];
571             SCTAB nOldTab = theOldTabs[i - 1];
572 			if (nDestTab > MAXTAB)							// append ?
573 				nDestTab = pDoc->GetTableCount() - 1;
574 
575 			pDoc->MoveTab( nDestTab, nOldTab );
576 			pViewShell->GetViewData()->MoveTab( nDestTab, nOldTab );
577 			pViewShell->SetTabNo( nOldTab, sal_True );
578 		}
579 	}
580 	else
581 	{
582 		for(size_t i=0;i<theNewTabs.size();i++)
583 		{
584             SCTAB nDestTab = theNewTabs[i];
585             SCTAB nNewTab = theNewTabs[i];
586             SCTAB nOldTab = theOldTabs[i];
587 			if (nDestTab > MAXTAB)							// append ?
588 				nDestTab = pDoc->GetTableCount() - 1;
589 
590 			pDoc->MoveTab( nOldTab, nNewTab );
591 			pViewShell->GetViewData()->MoveTab( nOldTab, nNewTab );
592 			pViewShell->SetTabNo( nDestTab, sal_True );
593 		}
594 	}
595 
596 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );	// Navigator
597 
598 	pDocShell->PostPaintGridAll();
599 	pDocShell->PostPaintExtras();
600 	pDocShell->PostDataChanged();
601 }
602 
Undo()603 void ScUndoMoveTab::Undo()
604 {
605 	DoChange( sal_True );
606 }
607 
Redo()608 void ScUndoMoveTab::Redo()
609 {
610 	DoChange( sal_False );
611 }
612 
Repeat(SfxRepeatTarget &)613 void ScUndoMoveTab::Repeat(SfxRepeatTarget& /* rTarget */)
614 {
615 		// No Repeat ! ? !
616 }
617 
CanRepeat(SfxRepeatTarget &) const618 sal_Bool ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
619 {
620 	return sal_False;
621 }
622 
623 
624 //----------------------------------------------------------------------------------
625 //
626 //		Copy table
627 //
628 
ScUndoCopyTab(ScDocShell * pNewDocShell,const SvShorts & aOldTab,const SvShorts & aNewTab)629 ScUndoCopyTab::ScUndoCopyTab( ScDocShell* pNewDocShell,
630 								  const SvShorts &aOldTab,
631 								  const SvShorts &aNewTab) :
632 	ScSimpleUndo( pNewDocShell ),
633 	pDrawUndo( NULL )
634 {
635 	pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
636 
637     theOldTabs=aOldTab;
638     theNewTabs=aNewTab;
639 }
640 
~ScUndoCopyTab()641 ScUndoCopyTab::~ScUndoCopyTab()
642 {
643 	DeleteSdrUndoAction( pDrawUndo );
644 }
645 
GetComment() const646 String ScUndoCopyTab::GetComment() const
647 {
648 	return ScGlobal::GetRscString( STR_UNDO_COPY_TAB );
649 }
650 
DoChange() const651 void ScUndoCopyTab::DoChange() const
652 {
653 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
654 
655 	if (pViewShell)
656 		pViewShell->SetTabNo(theOldTabs.front(),sal_True);
657 
658 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );	// Navigator
659 
660 	pDocShell->PostPaintGridAll();
661 	pDocShell->PostPaintExtras();
662 	pDocShell->PostDataChanged();
663 }
664 
Undo()665 void ScUndoCopyTab::Undo()
666 {
667 	ScDocument* pDoc = pDocShell->GetDocument();
668 
669     DoSdrUndoAction( pDrawUndo, pDoc );                 // before the sheets are deleted
670 
671     for (size_t i = theNewTabs.size(); i > 0; i--)
672     {
673         SCTAB nDestTab = theNewTabs[i - 1];
674 		if (nDestTab > MAXTAB)							// append?
675 			nDestTab = pDoc->GetTableCount() - 1;
676 
677 		bDrawIsInUndo = sal_True;
678 		pDoc->DeleteTab(nDestTab);
679 		bDrawIsInUndo = sal_False;
680 	}
681 
682 	//	ScTablesHint broadcasts after all sheets have been deleted,
683 	//	so sheets and draw pages are in sync!
684 
685     for (size_t i = theNewTabs.size(); i > 0; i--)
686     {
687         SCTAB nDestTab = theNewTabs[i - 1];
688 		if (nDestTab > MAXTAB)							// append?
689 			nDestTab = pDoc->GetTableCount() - 1;
690 
691 		pDocShell->Broadcast( ScTablesHint( SC_TAB_DELETED, nDestTab ) );
692 	}
693 
694 	DoChange();
695 }
696 
Redo()697 void ScUndoCopyTab::Redo()
698 {
699 	ScDocument* pDoc = pDocShell->GetDocument();
700 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
701 
702 	SCTAB nDestTab = 0;
703 	for(size_t i=0;i<theNewTabs.size();i++)
704 	{
705         nDestTab = theNewTabs[i];
706         SCTAB nNewTab = theNewTabs[i];
707         SCTAB nOldTab = theOldTabs[i];
708 		if (nDestTab > MAXTAB)							// append ?
709 			nDestTab = pDoc->GetTableCount() - 1;
710 
711 		bDrawIsInUndo = sal_True;
712 		pDoc->CopyTab( nOldTab, nNewTab );
713 		bDrawIsInUndo = sal_False;
714 
715 		pViewShell->GetViewData()->MoveTab( nOldTab, nNewTab );
716 
717 		SCTAB nAdjSource = nOldTab;
718 		if ( nNewTab <= nOldTab )
719 			++nAdjSource;				// new position of source table after CopyTab
720 
721 		if ( pDoc->IsScenario(nAdjSource) )
722 		{
723 			pDoc->SetScenario(nNewTab, sal_True );
724 			String aComment;
725 			Color  aColor;
726 			sal_uInt16 nScenFlags;
727 			pDoc->GetScenarioData(nAdjSource, aComment, aColor, nScenFlags );
728 			pDoc->SetScenarioData(nNewTab, aComment, aColor, nScenFlags );
729 			sal_Bool bActive = pDoc->IsActiveScenario(nAdjSource);
730 			pDoc->SetActiveScenario(nNewTab, bActive );
731 			sal_Bool bVisible=pDoc->IsVisible(nAdjSource);
732 			pDoc->SetVisible(nNewTab,bVisible );
733 		}
734 
735 		if ( pDoc->IsTabProtected( nAdjSource ) )
736             pDoc->CopyTabProtection(nAdjSource, nNewTab);
737 	}
738 
739     RedoSdrUndoAction( pDrawUndo );             // after the sheets are inserted
740 
741 	pViewShell->SetTabNo( nDestTab, sal_True );		// after draw-undo
742 
743 	DoChange();
744 
745 }
746 
Repeat(SfxRepeatTarget &)747 void ScUndoCopyTab::Repeat(SfxRepeatTarget& /* rTarget */)
748 {
749 		// kein Repeat ! ? !
750 }
751 
CanRepeat(SfxRepeatTarget &) const752 sal_Bool ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
753 {
754 	return sal_False;
755 }
756 
757 //---------------------------------------------------------------------------------
758 //
759 //      Tab Bg Color
760 //
761 
ScUndoTabColor(ScDocShell * pNewDocShell,SCTAB nT,const Color & aOTabBgColor,const Color & aNTabBgColor)762 ScUndoTabColor::ScUndoTabColor(
763     ScDocShell* pNewDocShell, SCTAB nT, const Color& aOTabBgColor, const Color& aNTabBgColor) :
764     ScSimpleUndo( pNewDocShell )
765 {
766     ScUndoTabColorInfo aInfo(nT);
767     aInfo.maOldTabBgColor = aOTabBgColor;
768     aInfo.maNewTabBgColor = aNTabBgColor;
769     aTabColorList.push_back(aInfo);
770 }
771 
ScUndoTabColor(ScDocShell * pNewDocShell,const ScUndoTabColorInfo::List & rUndoTabColorList)772 ScUndoTabColor::ScUndoTabColor(
773     ScDocShell* pNewDocShell,
774     const ScUndoTabColorInfo::List& rUndoTabColorList) :
775     ScSimpleUndo(pNewDocShell),
776     aTabColorList(rUndoTabColorList)
777 {
778 }
779 
~ScUndoTabColor()780 ScUndoTabColor::~ScUndoTabColor()
781 {
782 }
783 
GetComment() const784 String ScUndoTabColor::GetComment() const
785 {
786     if (aTabColorList.size() > 1)
787         return ScGlobal::GetRscString(STR_UNDO_SET_MULTI_TAB_BG_COLOR);
788     return ScGlobal::GetRscString(STR_UNDO_SET_TAB_BG_COLOR);
789 }
790 
DoChange(bool bUndoType) const791 void ScUndoTabColor::DoChange(bool bUndoType) const
792 {
793     ScDocument* pDoc = pDocShell->GetDocument();
794     if (!pDoc)
795         return;
796 
797     size_t nTabColorCount = aTabColorList.size();
798     for (size_t i = 0; i < nTabColorCount; ++i)
799     {
800         const ScUndoTabColorInfo& rTabColor = aTabColorList[i];
801         pDoc->SetTabBgColor(rTabColor.mnTabId,
802             bUndoType ? rTabColor.maOldTabBgColor : rTabColor.maNewTabBgColor);
803     }
804 
805     pDocShell->PostPaintExtras();
806     ScDocShellModificator aModificator( *pDocShell );
807     aModificator.SetDocumentModified();
808 }
809 
Undo()810 void ScUndoTabColor::Undo()
811 {
812     DoChange(true);
813 }
814 
Redo()815 void ScUndoTabColor::Redo()
816 {
817     DoChange(false);
818 }
819 
Repeat(SfxRepeatTarget &)820 void ScUndoTabColor::Repeat(SfxRepeatTarget& /* rTarget */)
821 {
822     //  No Repeat
823 }
824 
CanRepeat(SfxRepeatTarget &) const825 sal_Bool ScUndoTabColor::CanRepeat(SfxRepeatTarget& /* rTarget */) const
826 {
827     return sal_False;
828 }
829 
830 // -----------------------------------------------------------------------
831 //
832 //		Szenario anlegen
833 //
834 
ScUndoMakeScenario(ScDocShell * pNewDocShell,SCTAB nSrc,SCTAB nDest,const String & rN,const String & rC,const Color & rCol,sal_uInt16 nF,const ScMarkData & rMark)835 ScUndoMakeScenario::ScUndoMakeScenario( ScDocShell* pNewDocShell,
836                         SCTAB nSrc, SCTAB nDest,
837 						const String& rN, const String& rC,
838 						const Color& rCol, sal_uInt16 nF,
839 						const ScMarkData& rMark ) :
840 	ScSimpleUndo( pNewDocShell ),
841 	nSrcTab( nSrc ),
842 	nDestTab( nDest ),
843 	aName( rN ),
844 	aComment( rC ),
845 	aColor( rCol ),
846 	nFlags( nF ),
847     aMarkData( rMark ),
848     pDrawUndo( NULL )
849 {
850     pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
851 }
852 
~ScUndoMakeScenario()853 ScUndoMakeScenario::~ScUndoMakeScenario()
854 {
855     DeleteSdrUndoAction( pDrawUndo );
856 }
857 
GetComment() const858 String ScUndoMakeScenario::GetComment() const
859 {
860 	return ScGlobal::GetRscString( STR_UNDO_MAKESCENARIO );
861 }
862 
Undo()863 void ScUndoMakeScenario::Undo()
864 {
865 	ScDocument* pDoc = pDocShell->GetDocument();
866 
867     pDocShell->SetInUndo( sal_True );
868     bDrawIsInUndo = sal_True;
869 	pDoc->DeleteTab( nDestTab );
870     bDrawIsInUndo = sal_False;
871     pDocShell->SetInUndo( sal_False );
872 
873     DoSdrUndoAction( pDrawUndo, pDoc );
874 
875 	pDocShell->PostPaint(0,0,nDestTab,MAXCOL,MAXROW,MAXTAB, PAINT_ALL);
876 	pDocShell->PostDataChanged();
877 
878 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
879 	if (pViewShell)
880 		pViewShell->SetTabNo( nSrcTab, sal_True );
881 
882 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
883 
884     //  SetTabNo(...,sal_True) for all views to sync with drawing layer pages
885     pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
886 }
887 
Redo()888 void ScUndoMakeScenario::Redo()
889 {
890     SetViewMarkData( aMarkData );
891 
892     RedoSdrUndoAction( pDrawUndo );             // Draw Redo first
893 
894     pDocShell->SetInUndo( sal_True );
895     bDrawIsInUndo = sal_True;
896 
897 	pDocShell->MakeScenario( nSrcTab, aName, aComment, aColor, nFlags, aMarkData, sal_False );
898 
899     bDrawIsInUndo = sal_False;
900     pDocShell->SetInUndo( sal_False );
901 
902 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
903 	if (pViewShell)
904 		pViewShell->SetTabNo( nDestTab, sal_True );
905 
906 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
907 }
908 
Repeat(SfxRepeatTarget & rTarget)909 void ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
910 {
911 	if (rTarget.ISA(ScTabViewTarget))
912 	{
913 		((ScTabViewTarget&)rTarget).GetViewShell()->MakeScenario( aName, aComment, aColor, nFlags );
914 	}
915 }
916 
CanRepeat(SfxRepeatTarget & rTarget) const917 sal_Bool ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const
918 {
919 	return (rTarget.ISA(ScTabViewTarget));
920 }
921 
922 
923 // -----------------------------------------------------------------------
924 //
925 //		Tabelle einfuegen
926 //
927 
ScUndoImportTab(ScDocShell * pShell,SCTAB nNewTab,SCTAB nNewCount,sal_Bool bNewLink)928 ScUndoImportTab::ScUndoImportTab( ScDocShell* pShell,
929 						SCTAB nNewTab, SCTAB nNewCount, sal_Bool bNewLink ) :
930 	ScSimpleUndo( pShell ),
931 	nTab( nNewTab ),
932 	nCount( nNewCount ),
933 	bLink( bNewLink ),
934 	pRedoDoc( NULL ),
935 	pDrawUndo( NULL )
936 {
937 	pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
938 }
939 
~ScUndoImportTab()940 ScUndoImportTab::~ScUndoImportTab()
941 {
942 	delete pRedoDoc;
943 	DeleteSdrUndoAction( pDrawUndo );
944 }
945 
GetComment() const946 String ScUndoImportTab::GetComment() const
947 {
948 	return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
949 }
950 
DoChange() const951 void ScUndoImportTab::DoChange() const
952 {
953 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
954 	ScDocument* pDoc = pDocShell->GetDocument();
955     SCTAB nTabCount = pDoc->GetTableCount();
956 	if (pViewShell)
957 	{
958         if(nTab<nTabCount)
959 		{
960 			pViewShell->SetTabNo(nTab,sal_True);
961 		}
962 		else
963 		{
964 			pViewShell->SetTabNo(nTab-1,sal_True);
965 		}
966 	}
967 
968 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );	// Navigator
969 	pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB,
970 								PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
971 }
972 
Undo()973 void ScUndoImportTab::Undo()
974 {
975 	//!	eingefuegte Bereichsnamen etc.
976 
977 	SCTAB i;
978 	ScDocument* pDoc = pDocShell->GetDocument();
979 	sal_Bool bMakeRedo = !pRedoDoc;
980 	if (bMakeRedo)
981 	{
982 		pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
983 		pRedoDoc->InitUndo( pDoc, nTab,nTab+nCount-1, sal_True,sal_True );
984 
985 		String aOldName;
986 		for (i=0; i<nCount; i++)
987 		{
988 			SCTAB nTabPos=nTab+i;
989 
990 			pDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,sal_False, pRedoDoc );
991 			pDoc->GetName( nTabPos, aOldName );
992 			pRedoDoc->RenameTab( nTabPos, aOldName, sal_False );
993             pRedoDoc->SetTabBgColor( nTabPos, pDoc->GetTabBgColor(nTabPos) );
994 
995 			if ( pDoc->IsScenario(nTabPos) )
996 			{
997 				pRedoDoc->SetScenario(nTabPos, sal_True );
998 				String aComment;
999 				Color  aColor;
1000 				sal_uInt16 nScenFlags;
1001 				pDoc->GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
1002 				pRedoDoc->SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
1003 				sal_Bool bActive = pDoc->IsActiveScenario(nTabPos);
1004 				pRedoDoc->SetActiveScenario(nTabPos, bActive );
1005 				sal_Bool bVisible=pDoc->IsVisible(nTabPos);
1006 				pRedoDoc->SetVisible(nTabPos,bVisible );
1007 			}
1008 
1009 			if ( pDoc->IsTabProtected( nTabPos ) )
1010                 pRedoDoc->SetTabProtection(nTabPos, pDoc->GetTabProtection(nTabPos));
1011 		}
1012 
1013 	}
1014 
1015     DoSdrUndoAction( pDrawUndo, pDoc );             // before the sheets are deleted
1016 
1017 	bDrawIsInUndo = sal_True;
1018 	for (i=0; i<nCount; i++)
1019 		pDoc->DeleteTab( nTab );
1020 	bDrawIsInUndo = sal_False;
1021 
1022 	DoChange();
1023 }
1024 
Redo()1025 void ScUndoImportTab::Redo()
1026 {
1027 	if (!pRedoDoc)
1028 	{
1029 		DBG_ERROR("wo ist mein Redo-Document?");
1030 		return;
1031 	}
1032 
1033 	ScDocument* pDoc = pDocShell->GetDocument();
1034 	String aName;
1035 	SCTAB i;
1036 	for (i=0; i<nCount; i++)				// first insert all sheets (#63304#)
1037 	{
1038 		SCTAB nTabPos=nTab+i;
1039 		pRedoDoc->GetName(nTabPos,aName);
1040 		bDrawIsInUndo = sal_True;
1041 		pDoc->InsertTab(nTabPos,aName);
1042 		bDrawIsInUndo = sal_False;
1043 	}
1044 	for (i=0; i<nCount; i++)				// then copy into inserted sheets
1045 	{
1046 		SCTAB nTabPos=nTab+i;
1047 		pRedoDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,sal_False, pDoc );
1048         pDoc->SetTabBgColor( nTabPos, pRedoDoc->GetTabBgColor(nTabPos) );
1049 
1050 		if ( pRedoDoc->IsScenario(nTabPos) )
1051 		{
1052 			pDoc->SetScenario(nTabPos, sal_True );
1053 			String aComment;
1054 			Color  aColor;
1055 			sal_uInt16 nScenFlags;
1056 			pRedoDoc->GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
1057 			pDoc->SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
1058 			sal_Bool bActive = pRedoDoc->IsActiveScenario(nTabPos);
1059 			pDoc->SetActiveScenario(nTabPos, bActive );
1060 			sal_Bool bVisible=pRedoDoc->IsVisible(nTabPos);
1061 			pDoc->SetVisible(nTabPos,bVisible );
1062 		}
1063 
1064 		if ( pRedoDoc->IsTabProtected( nTabPos ) )
1065             pDoc->SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
1066 	}
1067 
1068     RedoSdrUndoAction( pDrawUndo );     // after the sheets are inserted
1069 
1070 	DoChange();
1071 }
1072 
Repeat(SfxRepeatTarget & rTarget)1073 void ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
1074 {
1075 	if (rTarget.ISA(ScTabViewTarget))
1076 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
1077 			Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
1078 }
1079 
CanRepeat(SfxRepeatTarget & rTarget) const1080 sal_Bool ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
1081 {
1082 	return (rTarget.ISA(ScTabViewTarget));
1083 }
1084 
1085 
1086 // -----------------------------------------------------------------------
1087 //
1088 //		Tabellen-Verknuepfung aufheben
1089 //
1090 
ScUndoRemoveLink(ScDocShell * pShell,const String & rDoc)1091 ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const String& rDoc ) :
1092 	ScSimpleUndo( pShell ),
1093 	aDocName( rDoc ),
1094 	nCount( 0 )
1095 {
1096 	ScDocument* pDoc = pDocShell->GetDocument();
1097 	SCTAB nTabCount = pDoc->GetTableCount();
1098 	pTabs	  = new SCTAB[nTabCount];
1099 	pModes	  = new sal_uInt8[nTabCount];
1100 	pTabNames = new String[nTabCount];
1101 
1102 	for (SCTAB i=0; i<nTabCount; i++)
1103 	{
1104 		sal_uInt8 nMode = pDoc->GetLinkMode(i);
1105 		if (nMode)
1106 			if (pDoc->GetLinkDoc(i) == aDocName)
1107 			{
1108 				if (!nCount)
1109 				{
1110 					aFltName = pDoc->GetLinkFlt(i);
1111 					aOptions = pDoc->GetLinkOpt(i);
1112 					nRefreshDelay = pDoc->GetLinkRefreshDelay(i);
1113 				}
1114 				else
1115 				{
1116 					DBG_ASSERT(aFltName == pDoc->GetLinkFlt(i) &&
1117 							   aOptions == pDoc->GetLinkOpt(i),
1118 									"verschiedene Filter fuer ein Dokument?");
1119 				}
1120 				pTabs[nCount] = i;
1121 				pModes[nCount] = nMode;
1122 				pTabNames[nCount] = pDoc->GetLinkTab(i);
1123 				++nCount;
1124 			}
1125 	}
1126 }
1127 
~ScUndoRemoveLink()1128 ScUndoRemoveLink::~ScUndoRemoveLink()
1129 {
1130 	delete pTabs;
1131 	delete pModes;
1132 	delete[] pTabNames;
1133 }
1134 
GetComment() const1135 String ScUndoRemoveLink::GetComment() const
1136 {
1137 	return ScGlobal::GetRscString( STR_UNDO_REMOVELINK );
1138 }
1139 
DoChange(sal_Bool bLink) const1140 void ScUndoRemoveLink::DoChange( sal_Bool bLink ) const
1141 {
1142 	ScDocument* pDoc = pDocShell->GetDocument();
1143 	String aEmpty;
1144 	for (sal_uInt16 i=0; i<nCount; i++)
1145 		if (bLink)		// establish link
1146 			pDoc->SetLink( pTabs[i], pModes[i], aDocName, aFltName, aOptions, pTabNames[i], nRefreshDelay );
1147 		else			// remove link
1148 			pDoc->SetLink( pTabs[i], SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
1149 	pDocShell->UpdateLinks();
1150 }
1151 
Undo()1152 void ScUndoRemoveLink::Undo()
1153 {
1154 	DoChange( sal_True );
1155 }
1156 
Redo()1157 void ScUndoRemoveLink::Redo()
1158 {
1159 	DoChange( sal_False );
1160 }
1161 
Repeat(SfxRepeatTarget &)1162 void ScUndoRemoveLink::Repeat(SfxRepeatTarget& /* rTarget */)
1163 {
1164 	//	gippsnich
1165 }
1166 
CanRepeat(SfxRepeatTarget &) const1167 sal_Bool ScUndoRemoveLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1168 {
1169 	return sal_False;
1170 }
1171 
1172 
1173 // -----------------------------------------------------------------------
1174 //
1175 //		Tabellen ein-/ausblenden
1176 //
1177 
ScUndoShowHideTab(ScDocShell * pShell,SCTAB nNewTab,sal_Bool bNewShow)1178 ScUndoShowHideTab::ScUndoShowHideTab( ScDocShell* pShell, SCTAB nNewTab, sal_Bool bNewShow ) :
1179 	ScSimpleUndo( pShell ),
1180 	nTab( nNewTab ),
1181 	bShow( bNewShow )
1182 {
1183 }
1184 
~ScUndoShowHideTab()1185 ScUndoShowHideTab::~ScUndoShowHideTab()
1186 {
1187 }
1188 
DoChange(sal_Bool bShowP) const1189 void ScUndoShowHideTab::DoChange( sal_Bool bShowP ) const
1190 {
1191 	ScDocument* pDoc = pDocShell->GetDocument();
1192     pDoc->SetVisible( nTab, bShowP );
1193 
1194 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1195 	if (pViewShell)
1196 		pViewShell->SetTabNo(nTab,sal_True);
1197 
1198 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
1199 	pDocShell->SetDocumentModified();
1200 }
1201 
Undo()1202 void ScUndoShowHideTab::Undo()
1203 {
1204 	DoChange(!bShow);
1205 }
1206 
Redo()1207 void ScUndoShowHideTab::Redo()
1208 {
1209 	DoChange(bShow);
1210 }
1211 
Repeat(SfxRepeatTarget & rTarget)1212 void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
1213 {
1214 	if (rTarget.ISA(ScTabViewTarget))
1215 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
1216 			Execute( bShow ? FID_TABLE_SHOW : FID_TABLE_HIDE,
1217 								SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
1218 }
1219 
CanRepeat(SfxRepeatTarget & rTarget) const1220 sal_Bool ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const
1221 {
1222 	return (rTarget.ISA(ScTabViewTarget));
1223 }
1224 
GetComment() const1225 String ScUndoShowHideTab::GetComment() const
1226 {
1227 	sal_uInt16 nId = bShow ? STR_UNDO_SHOWTAB : STR_UNDO_HIDETAB;
1228 	return ScGlobal::GetRscString( nId );
1229 }
1230 
1231 // ============================================================================
1232 
ScUndoDocProtect(ScDocShell * pShell,auto_ptr<ScDocProtection> pProtectSettings)1233 ScUndoDocProtect::ScUndoDocProtect(ScDocShell* pShell, auto_ptr<ScDocProtection> pProtectSettings) :
1234     ScSimpleUndo(pShell),
1235     mpProtectSettings(pProtectSettings)
1236 {
1237 }
1238 
~ScUndoDocProtect()1239 ScUndoDocProtect::~ScUndoDocProtect()
1240 {
1241 }
1242 
DoProtect(bool bProtect)1243 void ScUndoDocProtect::DoProtect(bool bProtect)
1244 {
1245     ScDocument* pDoc = pDocShell->GetDocument();
1246 
1247     if (bProtect)
1248     {
1249         // set protection.
1250         auto_ptr<ScDocProtection> pCopy(new ScDocProtection(*mpProtectSettings));
1251         pCopy->setProtected(true);
1252         pDoc->SetDocProtection(pCopy.get());
1253     }
1254     else
1255     {
1256         // remove protection.
1257         pDoc->SetDocProtection(NULL);
1258     }
1259 
1260     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1261     if (pViewShell)
1262     {
1263         pViewShell->UpdateLayerLocks();
1264         pViewShell->UpdateInputHandler(sal_True);   // damit sofort wieder eingegeben werden kann
1265     }
1266 
1267     pDocShell->PostPaintGridAll();
1268 }
1269 
Undo()1270 void ScUndoDocProtect::Undo()
1271 {
1272     BeginUndo();
1273     DoProtect(!mpProtectSettings->isProtected());
1274     EndUndo();
1275 }
1276 
Redo()1277 void ScUndoDocProtect::Redo()
1278 {
1279     BeginRedo();
1280     DoProtect(mpProtectSettings->isProtected());
1281     EndRedo();
1282 }
1283 
Repeat(SfxRepeatTarget &)1284 void ScUndoDocProtect::Repeat(SfxRepeatTarget& /* rTarget */)
1285 {
1286     //  gippsnich
1287 }
1288 
CanRepeat(SfxRepeatTarget &) const1289 sal_Bool ScUndoDocProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1290 {
1291     return sal_False;       // gippsnich
1292 }
1293 
GetComment() const1294 String ScUndoDocProtect::GetComment() const
1295 {
1296     sal_uInt16 nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
1297     return ScGlobal::GetRscString( nId );
1298 }
1299 
1300 // ============================================================================
1301 
ScUndoTabProtect(ScDocShell * pShell,SCTAB nTab,auto_ptr<ScTableProtection> pProtectSettings)1302 ScUndoTabProtect::ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab, auto_ptr<ScTableProtection> pProtectSettings) :
1303     ScSimpleUndo(pShell),
1304     mnTab(nTab),
1305     mpProtectSettings(pProtectSettings)
1306 {
1307 }
1308 
~ScUndoTabProtect()1309 ScUndoTabProtect::~ScUndoTabProtect()
1310 {
1311 }
1312 
DoProtect(bool bProtect)1313 void ScUndoTabProtect::DoProtect(bool bProtect)
1314 {
1315     ScDocument* pDoc = pDocShell->GetDocument();
1316 
1317     if (bProtect)
1318     {
1319         // set protection.
1320         auto_ptr<ScTableProtection> pCopy(new ScTableProtection(*mpProtectSettings));
1321         pCopy->setProtected(true);
1322         pDoc->SetTabProtection(mnTab, pCopy.get());
1323     }
1324     else
1325     {
1326         // remove protection.
1327         pDoc->SetTabProtection(mnTab, NULL);
1328     }
1329 
1330     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1331     if (pViewShell)
1332     {
1333         pViewShell->UpdateLayerLocks();
1334         pViewShell->UpdateInputHandler(sal_True);   // damit sofort wieder eingegeben werden kann
1335     }
1336 
1337     pDocShell->PostPaintGridAll();
1338 }
1339 
Undo()1340 void ScUndoTabProtect::Undo()
1341 {
1342     BeginUndo();
1343     DoProtect(!mpProtectSettings->isProtected());
1344     EndUndo();
1345 }
1346 
Redo()1347 void ScUndoTabProtect::Redo()
1348 {
1349     BeginRedo();
1350     DoProtect(mpProtectSettings->isProtected());
1351     EndRedo();
1352 }
1353 
Repeat(SfxRepeatTarget &)1354 void ScUndoTabProtect::Repeat(SfxRepeatTarget& /* rTarget */)
1355 {
1356     //  gippsnich
1357 }
1358 
CanRepeat(SfxRepeatTarget &) const1359 sal_Bool ScUndoTabProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1360 {
1361     return sal_False;       // gippsnich
1362 }
1363 
GetComment() const1364 String ScUndoTabProtect::GetComment() const
1365 {
1366     sal_uInt16 nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB;
1367     return ScGlobal::GetRscString( nId );
1368 }
1369 
1370 // -----------------------------------------------------------------------
1371 //
1372 //		Druck-/Wiederholungsbereiche aendern
1373 //
1374 
ScUndoPrintRange(ScDocShell * pShell,SCTAB nNewTab,ScPrintRangeSaver * pOld,ScPrintRangeSaver * pNew)1375 ScUndoPrintRange::ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
1376 									ScPrintRangeSaver* pOld, ScPrintRangeSaver* pNew ) :
1377 	ScSimpleUndo( pShell ),
1378 	nTab( nNewTab ),
1379 	pOldRanges( pOld ),
1380 	pNewRanges( pNew )
1381 {
1382 }
1383 
~ScUndoPrintRange()1384 ScUndoPrintRange::~ScUndoPrintRange()
1385 {
1386 	delete pOldRanges;
1387 	delete pNewRanges;
1388 }
1389 
DoChange(sal_Bool bUndo)1390 void ScUndoPrintRange::DoChange(sal_Bool bUndo)
1391 {
1392 	ScDocument* pDoc = pDocShell->GetDocument();
1393 	if (bUndo)
1394 		pDoc->RestorePrintRanges( *pOldRanges );
1395 	else
1396 		pDoc->RestorePrintRanges( *pNewRanges );
1397 
1398 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1399 	if (pViewShell)
1400 		pViewShell->SetTabNo( nTab );
1401 
1402 	ScPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab ).UpdatePages();
1403 
1404 	pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PAINT_GRID );
1405 }
1406 
Undo()1407 void ScUndoPrintRange::Undo()
1408 {
1409 	BeginUndo();
1410 	DoChange( sal_True );
1411 	EndUndo();
1412 }
1413 
Redo()1414 void ScUndoPrintRange::Redo()
1415 {
1416 	BeginRedo();
1417 	DoChange( sal_False );
1418 	EndRedo();
1419 }
1420 
Repeat(SfxRepeatTarget &)1421 void ScUndoPrintRange::Repeat(SfxRepeatTarget& /* rTarget */)
1422 {
1423 	//	gippsnich
1424 }
1425 
CanRepeat(SfxRepeatTarget &) const1426 sal_Bool ScUndoPrintRange::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1427 {
1428 	return sal_False;		// gippsnich
1429 }
1430 
GetComment() const1431 String ScUndoPrintRange::GetComment() const
1432 {
1433 	return ScGlobal::GetRscString( STR_UNDO_PRINTRANGES );
1434 }
1435 
1436 
1437 //------------------------------------------------------------------------
1438 
1439 //---------------------------------------------------------------------------------
1440 //
1441 //		Szenario-Flags
1442 //
1443 
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)1444 ScUndoScenarioFlags::ScUndoScenarioFlags( ScDocShell* pNewDocShell, SCTAB nT,
1445 					const String& rON, const String& rNN, const String& rOC, const String& rNC,
1446 					const Color& rOCol, const Color& rNCol, sal_uInt16 nOF, sal_uInt16 nNF ) :
1447 	ScSimpleUndo( pNewDocShell ),
1448 	nTab		( nT ),
1449 	aOldName	( rON ),
1450 	aNewName	( rNN ),
1451 	aOldComment	( rOC ),
1452 	aNewComment	( rNC ),
1453 	aOldColor	( rOCol ),
1454 	aNewColor	( rNCol ),
1455 	nOldFlags	( nOF ),
1456 	nNewFlags	( nNF )
1457 {
1458 }
1459 
~ScUndoScenarioFlags()1460 ScUndoScenarioFlags::~ScUndoScenarioFlags()
1461 {
1462 }
1463 
GetComment() const1464 String ScUndoScenarioFlags::GetComment() const
1465 {
1466 	return ScGlobal::GetRscString( STR_UNDO_EDITSCENARIO );
1467 }
1468 
Undo()1469 void ScUndoScenarioFlags::Undo()
1470 {
1471 	ScDocument* pDoc = pDocShell->GetDocument();
1472 
1473 	pDoc->RenameTab( nTab, aOldName );
1474 	pDoc->SetScenarioData( nTab, aOldComment, aOldColor, nOldFlags );
1475 
1476 	pDocShell->PostPaintGridAll();
1477 	//	Der Tabellenname koennte in einer Formel vorkommen...
1478 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1479 	if (pViewShell)
1480 		pViewShell->UpdateInputHandler();
1481 
1482 	if ( aOldName != aNewName )
1483 		SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
1484 }
1485 
Redo()1486 void ScUndoScenarioFlags::Redo()
1487 {
1488 	ScDocument* pDoc = pDocShell->GetDocument();
1489 
1490 	pDoc->RenameTab( nTab, aNewName );
1491 	pDoc->SetScenarioData( nTab, aNewComment, aNewColor, nNewFlags );
1492 
1493 	pDocShell->PostPaintGridAll();
1494 	//	Der Tabellenname koennte in einer Formel vorkommen...
1495 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1496 	if (pViewShell)
1497 		pViewShell->UpdateInputHandler();
1498 
1499 	if ( aOldName != aNewName )
1500 		SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
1501 }
1502 
Repeat(SfxRepeatTarget &)1503 void ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */)
1504 {
1505 	//	Repeat macht keinen Sinn
1506 }
1507 
CanRepeat(SfxRepeatTarget &) const1508 sal_Bool ScUndoScenarioFlags::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1509 {
1510 	return sal_False;
1511 }
1512 
1513 
1514 //---------------------------------------------------------------------------------
1515 //
1516 //		rename object
1517 //		(move to different file?)
1518 //
1519 
ScUndoRenameObject(ScDocShell * pNewDocShell,const String & rPN,const String & rON,const String & rNN)1520 ScUndoRenameObject::ScUndoRenameObject( ScDocShell* pNewDocShell, const String& rPN,
1521 										const String& rON, const String& rNN ) :
1522 	ScSimpleUndo( pNewDocShell ),
1523 	aPersistName( rPN ),
1524 	aOldName	( rON ),
1525 	aNewName	( rNN )
1526 {
1527 }
1528 
~ScUndoRenameObject()1529 ScUndoRenameObject::~ScUndoRenameObject()
1530 {
1531 }
1532 
GetComment() const1533 String ScUndoRenameObject::GetComment() const
1534 {
1535 	//	string resource shared with title for dialog
1536 	return String( ScResId(SCSTR_RENAMEOBJECT) );
1537 }
1538 
GetObject()1539 SdrObject* ScUndoRenameObject::GetObject()
1540 {
1541 	ScDocument* pDoc = pDocShell->GetDocument();
1542 	ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
1543 	if ( pDrawLayer )
1544 	{
1545 		sal_uInt16 nCount = pDrawLayer->GetPageCount();
1546 		for (sal_uInt16 nTab=0; nTab<nCount; nTab++)
1547 		{
1548 			SdrPage* pPage = pDrawLayer->GetPage(nTab);
1549 			DBG_ASSERT(pPage,"Page ?");
1550 
1551 			SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
1552 			SdrObject* pObject = aIter.Next();
1553 			while (pObject)
1554 			{
1555 				if ( pObject->GetObjIdentifier() == OBJ_OLE2 &&
1556 						((SdrOle2Obj*)pObject)->GetPersistName() == aPersistName )
1557 				{
1558 					return pObject;
1559 				}
1560 
1561 				pObject = aIter.Next();
1562 			}
1563 		}
1564 	}
1565 	DBG_ERROR("Object not found");
1566 	return NULL;
1567 }
1568 
Undo()1569 void ScUndoRenameObject::Undo()
1570 {
1571 	BeginUndo();
1572 	SdrObject* pObj = GetObject();
1573 	if ( pObj )
1574 		pObj->SetName( aOldName );
1575 	EndUndo();
1576 }
1577 
Redo()1578 void ScUndoRenameObject::Redo()
1579 {
1580 	BeginRedo();
1581 	SdrObject* pObj = GetObject();
1582 	if ( pObj )
1583 		pObj->SetName( aNewName );
1584 	EndRedo();
1585 }
1586 
Repeat(SfxRepeatTarget &)1587 void ScUndoRenameObject::Repeat(SfxRepeatTarget& /* rTarget */)
1588 {
1589 }
1590 
CanRepeat(SfxRepeatTarget &) const1591 sal_Bool ScUndoRenameObject::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1592 {
1593 	return sal_False;
1594 }
1595 
1596 // -----------------------------------------------------------------------
1597 //
1598 //		Switch sheet between left-to-right and right-to-left
1599 //
1600 
ScUndoLayoutRTL(ScDocShell * pShell,SCTAB nNewTab,sal_Bool bNewRTL)1601 ScUndoLayoutRTL::ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, sal_Bool bNewRTL ) :
1602 	ScSimpleUndo( pShell ),
1603 	nTab( nNewTab ),
1604 	bRTL( bNewRTL )
1605 {
1606 }
1607 
~ScUndoLayoutRTL()1608 ScUndoLayoutRTL::~ScUndoLayoutRTL()
1609 {
1610 }
1611 
DoChange(sal_Bool bNew)1612 void ScUndoLayoutRTL::DoChange( sal_Bool bNew )
1613 {
1614 	pDocShell->SetInUndo( sal_True );
1615 
1616 	ScDocument* pDoc = pDocShell->GetDocument();
1617 	pDoc->SetLayoutRTL( nTab, bNew );
1618 
1619 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1620 	if (pViewShell)
1621 		pViewShell->SetTabNo(nTab,sal_True);
1622 
1623 	pDocShell->SetDocumentModified();
1624 
1625 	pDocShell->SetInUndo( sal_False );
1626 }
1627 
Undo()1628 void ScUndoLayoutRTL::Undo()
1629 {
1630 	DoChange(!bRTL);
1631 }
1632 
Redo()1633 void ScUndoLayoutRTL::Redo()
1634 {
1635 	DoChange(bRTL);
1636 }
1637 
Repeat(SfxRepeatTarget & rTarget)1638 void ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
1639 {
1640 	if (rTarget.ISA(ScTabViewTarget))
1641 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
1642 			Execute( FID_TAB_RTL, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
1643 }
1644 
CanRepeat(SfxRepeatTarget & rTarget) const1645 sal_Bool ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const
1646 {
1647 	return (rTarget.ISA(ScTabViewTarget));
1648 }
1649 
GetComment() const1650 String ScUndoLayoutRTL::GetComment() const
1651 {
1652 	return ScGlobal::GetRscString( STR_UNDO_TAB_RTL );
1653 }
1654 
1655 
1656 
1657 // -----------------------------------------------------------------------
1658 //
1659 //		Set the grammar used for the sheet
1660 //
1661 
1662 //UNUSED2009-05 ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell,
1663 //UNUSED2009-05                                     formula::FormulaGrammar::Grammar eGrammar ) :
1664 //UNUSED2009-05     ScSimpleUndo( pShell ),
1665 //UNUSED2009-05     meNewGrammar( eGrammar )
1666 //UNUSED2009-05 {
1667 //UNUSED2009-05     meOldGrammar = pDocShell->GetDocument()->GetGrammar();
1668 //UNUSED2009-05 }
1669 //UNUSED2009-05
1670 //UNUSED2009-05 __EXPORT ScUndoSetGrammar::~ScUndoSetGrammar()
1671 //UNUSED2009-05 {
1672 //UNUSED2009-05 }
1673 //UNUSED2009-05
1674 //UNUSED2009-05 void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar )
1675 //UNUSED2009-05 {
1676 //UNUSED2009-05     pDocShell->SetInUndo( sal_True );
1677 //UNUSED2009-05     ScDocument* pDoc = pDocShell->GetDocument();
1678 //UNUSED2009-05     pDoc->SetGrammar( eGrammar );
1679 //UNUSED2009-05     pDocShell->SetDocumentModified();
1680 //UNUSED2009-05     pDocShell->SetInUndo( sal_False );
1681 //UNUSED2009-05 }
1682 //UNUSED2009-05
1683 //UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Undo()
1684 //UNUSED2009-05 {
1685 //UNUSED2009-05     DoChange( meOldGrammar );
1686 //UNUSED2009-05 }
1687 //UNUSED2009-05
1688 //UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Redo()
1689 //UNUSED2009-05 {
1690 //UNUSED2009-05     DoChange( meNewGrammar );
1691 //UNUSED2009-05 }
1692 //UNUSED2009-05
1693 //UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
1694 //UNUSED2009-05 {
1695 //UNUSED2009-05 #if 0
1696 //UNUSED2009-05 // erAck: 2006-09-07T23:00+0200  commented out in CWS scr1c1
1697 //UNUSED2009-05     if (rTarget.ISA(ScTabViewTarget))
1698 //UNUSED2009-05         ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
1699 //UNUSED2009-05             Execute( FID_TAB_USE_R1C1, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
1700 //UNUSED2009-05 #endif
1701 //UNUSED2009-05 }
1702 //UNUSED2009-05
1703 //UNUSED2009-05 sal_Bool __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
1704 //UNUSED2009-05 {
1705 //UNUSED2009-05     return (rTarget.ISA(ScTabViewTarget));
1706 //UNUSED2009-05 }
1707 //UNUSED2009-05
1708 //UNUSED2009-05 String __EXPORT ScUndoSetGrammar::GetComment() const
1709 //UNUSED2009-05 {
1710 //UNUSED2009-05     return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
1711 //UNUSED2009-05 }
1712 
1713