Update to m13
[ooovba.git] / sc / source / ui / undo / undoblk3.cxx
blob753a1a1a17c788f65f4a57b595a0f441ccfea88d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: undoblk3.cxx,v $
10 * $Revision: 1.22.128.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 // INCLUDE -------------------------------------------------------------------
36 #include "scitems.hxx"
37 #include <svx/algitem.hxx>
38 #include <svx/boxitem.hxx>
39 #include <svx/srchitem.hxx>
40 #include <svx/linkmgr.hxx>
41 #include <sfx2/bindings.hxx>
42 #include <vcl/virdev.hxx>
43 #include <sfx2/app.hxx>
45 #include "undoblk.hxx"
46 #include "sc.hrc"
47 #include "globstr.hrc"
48 #include "global.hxx"
49 #include "rangenam.hxx"
50 #include "arealink.hxx"
51 #include "patattr.hxx"
52 #include "target.hxx"
53 #include "document.hxx"
54 #include "docpool.hxx"
55 #include "table.hxx"
56 #include "docsh.hxx"
57 #include "tabvwsh.hxx"
58 #include "undoolk.hxx"
59 #include "undoutil.hxx"
60 #include "chgtrack.hxx"
61 #include "dociter.hxx"
62 #include "cell.hxx"
63 #include "paramisc.hxx"
64 #include "postit.hxx"
65 #include "docuno.hxx"
67 // STATIC DATA ---------------------------------------------------------------
69 TYPEINIT1(ScUndoDeleteContents, SfxUndoAction);
70 TYPEINIT1(ScUndoFillTable, SfxUndoAction);
71 TYPEINIT1(ScUndoSelectionAttr, SfxUndoAction);
72 TYPEINIT1(ScUndoAutoFill, SfxUndoAction);
73 TYPEINIT1(ScUndoMerge, SfxUndoAction);
74 TYPEINIT1(ScUndoAutoFormat, SfxUndoAction);
75 TYPEINIT1(ScUndoReplace, SfxUndoAction);
76 TYPEINIT1(ScUndoTabOp, SfxUndoAction);
77 TYPEINIT1(ScUndoConversion, SfxUndoAction);
78 TYPEINIT1(ScUndoRefreshLink, SfxUndoAction);
79 TYPEINIT1(ScUndoInsertAreaLink, SfxUndoAction);
80 TYPEINIT1(ScUndoRemoveAreaLink, SfxUndoAction);
81 TYPEINIT1(ScUndoUpdateAreaLink, SfxUndoAction);
84 // To Do:
85 /*A*/ // SetOptimalHeight auf Dokument, wenn keine View
88 //============================================================================
89 // class ScUndoDeleteContents
91 // Inhalte loeschen
93 //----------------------------------------------------------------------------
95 ScUndoDeleteContents::ScUndoDeleteContents(
96 ScDocShell* pNewDocShell,
97 const ScMarkData& rMark, const ScRange& rRange,
98 ScDocument* pNewUndoDoc, BOOL bNewMulti,
99 USHORT nNewFlags, BOOL bObjects )
101 : ScSimpleUndo( pNewDocShell ),
103 aRange ( rRange ),
104 aMarkData ( rMark ),
105 pUndoDoc ( pNewUndoDoc ),
106 pDrawUndo ( NULL ),
107 nFlags ( nNewFlags ),
108 bMulti ( bNewMulti ) // ueberliquid
110 if (bObjects)
111 pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
113 if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) ) // keine Zelle markiert:
114 aMarkData.SetMarkArea( aRange ); // Zelle unter Cursor markieren
116 SetChangeTrack();
120 //----------------------------------------------------------------------------
122 __EXPORT ScUndoDeleteContents::~ScUndoDeleteContents()
124 delete pUndoDoc;
125 DeleteSdrUndoAction( pDrawUndo );
129 //----------------------------------------------------------------------------
131 String __EXPORT ScUndoDeleteContents::GetComment() const
133 return ScGlobal::GetRscString( STR_UNDO_DELETECONTENTS ); // "Loeschen"
137 void ScUndoDeleteContents::SetChangeTrack()
139 ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
140 if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
141 pChangeTrack->AppendContentRange( aRange, pUndoDoc,
142 nStartChangeAction, nEndChangeAction );
143 else
144 nStartChangeAction = nEndChangeAction = 0;
148 //----------------------------------------------------------------------------
150 void ScUndoDeleteContents::DoChange( const BOOL bUndo )
152 ScDocument* pDoc = pDocShell->GetDocument();
153 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
155 if (pViewShell)
156 pViewShell->SetMarkData( aMarkData );
158 USHORT nExtFlags = 0;
160 if (bUndo) // nur Undo
162 USHORT nUndoFlags = IDF_NONE; // entweder alle oder keine Inhalte kopieren
163 if (nFlags & IDF_CONTENTS) // (es sind nur die richtigen ins UndoDoc kopiert worden)
164 nUndoFlags |= IDF_CONTENTS;
165 if (nFlags & IDF_ATTRIB)
166 nUndoFlags |= IDF_ATTRIB;
167 if (nFlags & IDF_EDITATTR) // Edit-Engine-Attribute
168 nUndoFlags |= IDF_STRING; // -> Zellen werden geaendert
169 // do not create clones of note captions, they will be restored via drawing undo
170 nUndoFlags |= IDF_NOCAPTIONS;
172 ScRange aCopyRange = aRange;
173 SCTAB nTabCount = pDoc->GetTableCount();
174 aCopyRange.aStart.SetTab(0);
175 aCopyRange.aEnd.SetTab(nTabCount-1);
177 pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, bMulti, pDoc, &aMarkData );
179 DoSdrUndoAction( pDrawUndo, pDoc );
181 ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
182 if ( pChangeTrack )
183 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
185 pDocShell->UpdatePaintExt( nExtFlags, aRange ); // content after the change
187 else // nur Redo
189 pDocShell->UpdatePaintExt( nExtFlags, aRange ); // content before the change
191 aMarkData.MarkToMulti();
192 RedoSdrUndoAction( pDrawUndo );
193 // do not delete objects and note captions, they have been removed via drawing undo
194 USHORT nRedoFlags = (nFlags & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
195 pDoc->DeleteSelection( nRedoFlags, aMarkData );
196 aMarkData.MarkToSimple();
198 SetChangeTrack();
201 if ( !( (pViewShell) && pViewShell->AdjustRowHeight(
202 aRange.aStart.Row(), aRange.aEnd.Row() ) ) )
203 /*A*/ pDocShell->PostPaint( aRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
205 pDocShell->PostDataChanged();
206 if (pViewShell)
207 pViewShell->CellContentChanged();
209 ShowTable( aRange );
213 //----------------------------------------------------------------------------
215 void __EXPORT ScUndoDeleteContents::Undo()
217 BeginUndo();
218 DoChange( TRUE );
219 EndUndo();
221 // #i97876# Spreadsheet data changes are not notified
222 ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
223 if ( pModelObj && pModelObj->HasChangesListeners() )
225 ScRangeList aChangeRanges;
226 aChangeRanges.Append( aRange );
227 pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
232 //----------------------------------------------------------------------------
234 void __EXPORT ScUndoDeleteContents::Redo()
236 BeginRedo();
237 DoChange( FALSE );
238 EndRedo();
240 // #i97876# Spreadsheet data changes are not notified
241 ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
242 if ( pModelObj && pModelObj->HasChangesListeners() )
244 ScRangeList aChangeRanges;
245 aChangeRanges.Append( aRange );
246 pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
251 //----------------------------------------------------------------------------
253 void __EXPORT ScUndoDeleteContents::Repeat(SfxRepeatTarget& rTarget)
255 if (rTarget.ISA(ScTabViewTarget))
256 ((ScTabViewTarget&)rTarget).GetViewShell()->DeleteContents( nFlags, TRUE );
260 //----------------------------------------------------------------------------
262 BOOL __EXPORT ScUndoDeleteContents::CanRepeat(SfxRepeatTarget& rTarget) const
264 return (rTarget.ISA(ScTabViewTarget));
268 //============================================================================
269 // class ScUndoFillTable
271 // Tabellen ausfuellen
272 // (Bearbeiten|Ausfuellen|...)
274 //----------------------------------------------------------------------------
276 ScUndoFillTable::ScUndoFillTable( ScDocShell* pNewDocShell,
277 const ScMarkData& rMark,
278 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
279 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
280 ScDocument* pNewUndoDoc, BOOL bNewMulti, SCTAB nSrc,
281 USHORT nFlg, USHORT nFunc, BOOL bSkip, BOOL bLink )
283 : ScSimpleUndo( pNewDocShell ),
285 aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
286 aMarkData ( rMark ),
287 pUndoDoc ( pNewUndoDoc ),
288 nFlags ( nFlg ),
289 nFunction ( nFunc ),
290 nSrcTab ( nSrc ),
291 bMulti ( bNewMulti ),
292 bSkipEmpty ( bSkip ),
293 bAsLink ( bLink )
295 SetChangeTrack();
299 //----------------------------------------------------------------------------
301 __EXPORT ScUndoFillTable::~ScUndoFillTable()
303 delete pUndoDoc;
307 //----------------------------------------------------------------------------
309 String __EXPORT ScUndoFillTable::GetComment() const
311 return ScGlobal::GetRscString( STR_FILL_TAB );
315 void ScUndoFillTable::SetChangeTrack()
317 ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
318 if ( pChangeTrack )
320 SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
321 ScRange aWorkRange(aRange);
322 nStartChangeAction = 0;
323 ULONG nTmpAction;
324 for ( SCTAB i = 0; i < nTabCount; i++ )
326 if (i != nSrcTab && aMarkData.GetTableSelect(i))
328 aWorkRange.aStart.SetTab(i);
329 aWorkRange.aEnd.SetTab(i);
330 pChangeTrack->AppendContentRange( aWorkRange, pUndoDoc,
331 nTmpAction, nEndChangeAction );
332 if ( !nStartChangeAction )
333 nStartChangeAction = nTmpAction;
337 else
338 nStartChangeAction = nEndChangeAction = 0;
342 //----------------------------------------------------------------------------
344 void ScUndoFillTable::DoChange( const BOOL bUndo )
346 ScDocument* pDoc = pDocShell->GetDocument();
347 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
349 if (pViewShell)
350 pViewShell->SetMarkData( aMarkData );
352 if (bUndo) // nur Undo
354 SCTAB nTabCount = pDoc->GetTableCount();
355 ScRange aWorkRange(aRange);
356 for ( SCTAB i = 0; i < nTabCount; i++ )
357 if (i != nSrcTab && aMarkData.GetTableSelect(i))
359 aWorkRange.aStart.SetTab(i);
360 aWorkRange.aEnd.SetTab(i);
361 if (bMulti)
362 pDoc->DeleteSelectionTab( i, IDF_ALL, aMarkData );
363 else
364 pDoc->DeleteAreaTab( aWorkRange, IDF_ALL );
365 pUndoDoc->CopyToDocument( aWorkRange, IDF_ALL, bMulti, pDoc, &aMarkData );
368 ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
369 if ( pChangeTrack )
370 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
372 else // nur Redo
374 aMarkData.MarkToMulti();
375 pDoc->FillTabMarked( nSrcTab, aMarkData, nFlags, nFunction, bSkipEmpty, bAsLink );
376 aMarkData.MarkToSimple();
377 SetChangeTrack();
380 pDocShell->PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_EXTRAS);
381 pDocShell->PostDataChanged();
383 // CellContentChanged kommt mit der Markierung
385 if (pViewShell)
387 SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
388 if ( !aMarkData.GetTableSelect(nTab) )
389 pViewShell->SetTabNo( nSrcTab );
391 pViewShell->DoneBlockMode(); // gibt sonst Probleme, weil Markierung auf falscher Tabelle
396 //----------------------------------------------------------------------------
398 void __EXPORT ScUndoFillTable::Undo()
400 BeginUndo();
401 DoChange( TRUE );
402 EndUndo();
406 //----------------------------------------------------------------------------
408 void __EXPORT ScUndoFillTable::Redo()
410 BeginRedo();
411 DoChange( FALSE );
412 EndRedo();
416 //----------------------------------------------------------------------------
418 void __EXPORT ScUndoFillTable::Repeat(SfxRepeatTarget& rTarget)
420 if (rTarget.ISA(ScTabViewTarget))
421 ((ScTabViewTarget&)rTarget).GetViewShell()->FillTab( nFlags, nFunction, bSkipEmpty, bAsLink );
425 //----------------------------------------------------------------------------
427 BOOL __EXPORT ScUndoFillTable::CanRepeat(SfxRepeatTarget& rTarget) const
429 return (rTarget.ISA(ScTabViewTarget));
433 //============================================================================
434 // class ScUndoSelectionAttr
436 // Zellformat aendern
438 //----------------------------------------------------------------------------
440 ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell* pNewDocShell,
441 const ScMarkData& rMark,
442 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
443 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
444 ScDocument* pNewUndoDoc, BOOL bNewMulti,
445 const ScPatternAttr* pNewApply,
446 const SvxBoxItem* pNewOuter, const SvxBoxInfoItem* pNewInner )
448 : ScSimpleUndo( pNewDocShell ),
450 aMarkData ( rMark ),
451 aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
452 pUndoDoc ( pNewUndoDoc ),
453 bMulti ( bNewMulti )
455 ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
456 pApplyPattern = (ScPatternAttr*) &pPool->Put( *pNewApply );
457 pLineOuter = pNewOuter ? (SvxBoxItem*) &pPool->Put( *pNewOuter ) : NULL;
458 pLineInner = pNewInner ? (SvxBoxInfoItem*) &pPool->Put( *pNewInner ) : NULL;
462 //----------------------------------------------------------------------------
464 __EXPORT ScUndoSelectionAttr::~ScUndoSelectionAttr()
466 ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
467 pPool->Remove(*pApplyPattern);
468 if (pLineOuter)
469 pPool->Remove(*pLineOuter);
470 if (pLineInner)
471 pPool->Remove(*pLineInner);
473 delete pUndoDoc;
477 //----------------------------------------------------------------------------
479 String __EXPORT ScUndoSelectionAttr::GetComment() const
481 //"Attribute" "/Linien"
482 return ScGlobal::GetRscString( pLineOuter ? STR_UNDO_SELATTRLINES : STR_UNDO_SELATTR );
485 //----------------------------------------------------------------------------
487 ScEditDataArray* ScUndoSelectionAttr::GetDataArray()
489 return &aDataArray;
492 //----------------------------------------------------------------------------
494 void ScUndoSelectionAttr::DoChange( const BOOL bUndo )
496 ScDocument* pDoc = pDocShell->GetDocument();
497 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
499 if (pViewShell)
500 pViewShell->SetMarkData( aMarkData );
502 ScRange aEffRange( aRange );
503 if ( pDoc->HasAttrib( aEffRange, HASATTR_MERGED ) ) // zusammengefasste Zellen?
504 pDoc->ExtendMerge( aEffRange );
506 USHORT nExtFlags = 0;
507 pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
509 ChangeEditData(bUndo);
511 if (bUndo) // nur bei Undo
513 ScRange aCopyRange = aRange;
514 SCTAB nTabCount = pDoc->GetTableCount();
515 aCopyRange.aStart.SetTab(0);
516 aCopyRange.aEnd.SetTab(nTabCount-1);
517 pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pDoc, &aMarkData );
519 else // nur bei Redo
521 aMarkData.MarkToMulti();
522 pDoc->ApplySelectionPattern( *pApplyPattern, aMarkData );
523 aMarkData.MarkToSimple();
525 if (pLineOuter)
526 pDoc->ApplySelectionFrame( aMarkData, pLineOuter, pLineInner );
529 if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
530 /*A*/ pDocShell->PostPaint( aEffRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
532 ShowTable( aRange );
535 void ScUndoSelectionAttr::ChangeEditData( const bool bUndo )
537 ScDocument* pDoc = pDocShell->GetDocument();
538 for (const ScEditDataArray::Item* pItem = aDataArray.First(); pItem; pItem = aDataArray.Next())
540 ScBaseCell* pCell;
541 pDoc->GetCell(pItem->GetCol(), pItem->GetRow(), pItem->GetTab(), pCell);
542 if (!pCell || pCell->GetCellType() != CELLTYPE_EDIT)
543 continue;
545 ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
546 if (bUndo)
547 pEditCell->SetData(pItem->GetOldData(), NULL);
548 else
549 pEditCell->SetData(pItem->GetNewData(), NULL);
554 //----------------------------------------------------------------------------
556 void __EXPORT ScUndoSelectionAttr::Undo()
558 BeginUndo();
559 DoChange( TRUE );
560 EndUndo();
564 //----------------------------------------------------------------------------
566 void __EXPORT ScUndoSelectionAttr::Redo()
568 BeginRedo();
569 DoChange( FALSE );
570 EndRedo();
574 //----------------------------------------------------------------------------
576 void __EXPORT ScUndoSelectionAttr::Repeat(SfxRepeatTarget& rTarget)
578 if (rTarget.ISA(ScTabViewTarget))
580 ScTabViewShell& rViewShell = *((ScTabViewTarget&)rTarget).GetViewShell();
581 if (pLineOuter)
582 rViewShell.ApplyPatternLines( *pApplyPattern, pLineOuter, pLineInner, TRUE );
583 else
584 rViewShell.ApplySelectionPattern( *pApplyPattern, TRUE );
589 //----------------------------------------------------------------------------
591 BOOL __EXPORT ScUndoSelectionAttr::CanRepeat(SfxRepeatTarget& rTarget) const
593 return (rTarget.ISA(ScTabViewTarget));
597 //============================================================================
598 // class ScUndoAutoFill
600 // Auto-Fill (nur einfache Bloecke)
602 //----------------------------------------------------------------------------
604 ScUndoAutoFill::ScUndoAutoFill( ScDocShell* pNewDocShell,
605 const ScRange& rRange, const ScRange& rSourceArea,
606 ScDocument* pNewUndoDoc, const ScMarkData& rMark,
607 FillDir eNewFillDir, FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd,
608 double fNewStartValue, double fNewStepValue, double fNewMaxValue,
609 USHORT nMaxShIndex )
611 : ScBlockUndo( pNewDocShell, rRange, SC_UNDO_AUTOHEIGHT ),
613 aSource ( rSourceArea ),
614 aMarkData ( rMark ),
615 pUndoDoc ( pNewUndoDoc ),
616 eFillDir ( eNewFillDir ),
617 eFillCmd ( eNewFillCmd ),
618 eFillDateCmd ( eNewFillDateCmd ),
619 fStartValue ( fNewStartValue ),
620 fStepValue ( fNewStepValue ),
621 fMaxValue ( fNewMaxValue ),
622 nMaxSharedIndex ( nMaxShIndex)
624 SetChangeTrack();
628 //----------------------------------------------------------------------------
630 __EXPORT ScUndoAutoFill::~ScUndoAutoFill()
632 pDocShell->GetDocument()->EraseNonUsedSharedNames(nMaxSharedIndex);
633 delete pUndoDoc;
637 //----------------------------------------------------------------------------
639 String __EXPORT ScUndoAutoFill::GetComment() const
641 return ScGlobal::GetRscString( STR_UNDO_AUTOFILL ); //"Ausfuellen"
645 void ScUndoAutoFill::SetChangeTrack()
647 ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
648 if ( pChangeTrack )
649 pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
650 nStartChangeAction, nEndChangeAction );
651 else
652 nStartChangeAction = nEndChangeAction = 0;
656 //----------------------------------------------------------------------------
658 void __EXPORT ScUndoAutoFill::Undo()
660 BeginUndo();
662 ScDocument* pDoc = pDocShell->GetDocument();
664 SCTAB nTabCount = pDoc->GetTableCount();
665 for (SCTAB nTab=0; nTab<nTabCount; nTab++)
667 if (aMarkData.GetTableSelect(nTab))
669 ScRange aWorkRange = aBlockRange;
670 aWorkRange.aStart.SetTab(nTab);
671 aWorkRange.aEnd.SetTab(nTab);
673 USHORT nExtFlags = 0;
674 pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
675 pDoc->DeleteAreaTab( aWorkRange, IDF_AUTOFILL );
676 pUndoDoc->CopyToDocument( aWorkRange, IDF_AUTOFILL, FALSE, pDoc );
678 pDoc->ExtendMerge( aWorkRange, TRUE );
679 pDocShell->PostPaint( aWorkRange, PAINT_GRID, nExtFlags );
682 pDocShell->PostDataChanged();
683 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
684 if (pViewShell)
685 pViewShell->CellContentChanged();
687 // Shared-Names loeschen
688 // Falls Undo ins Dokument gespeichert
689 // => automatisches Loeschen am Ende
690 // umarbeiten!!
692 String aName = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("___SC_"));
693 aName += String::CreateFromInt32(nMaxSharedIndex);
694 aName += '_';
695 ScRangeName* pRangeName = pDoc->GetRangeName();
696 BOOL bHasFound = FALSE;
697 for (USHORT i = 0; i < pRangeName->GetCount(); i++)
699 ScRangeData* pRangeData = (*pRangeName)[i];
700 if (pRangeData)
702 String aRName;
703 pRangeData->GetName(aRName);
704 if (aRName.Search(aName) != STRING_NOTFOUND)
706 pRangeName->AtFree(i);
707 bHasFound = TRUE;
711 if (bHasFound)
712 pRangeName->SetSharedMaxIndex(pRangeName->GetSharedMaxIndex()-1);
714 ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
715 if ( pChangeTrack )
716 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
718 EndUndo();
722 //----------------------------------------------------------------------------
724 void __EXPORT ScUndoAutoFill::Redo()
726 BeginRedo();
728 //! Tabellen selektieren
730 SCCOLROW nCount = 0;
731 switch (eFillDir)
733 case FILL_TO_BOTTOM:
734 nCount = aBlockRange.aEnd.Row() - aSource.aEnd.Row();
735 break;
736 case FILL_TO_RIGHT:
737 nCount = aBlockRange.aEnd.Col() - aSource.aEnd.Col();
738 break;
739 case FILL_TO_TOP:
740 nCount = aSource.aStart.Row() - aBlockRange.aStart.Row();
741 break;
742 case FILL_TO_LEFT:
743 nCount = aSource.aStart.Col() - aBlockRange.aStart.Col();
744 break;
747 ScDocument* pDoc = pDocShell->GetDocument();
748 if ( fStartValue != MAXDOUBLE )
750 SCCOL nValX = (eFillDir == FILL_TO_LEFT) ? aSource.aEnd.Col() : aSource.aStart.Col();
751 SCROW nValY = (eFillDir == FILL_TO_TOP ) ? aSource.aEnd.Row() : aSource.aStart.Row();
752 SCTAB nTab = aSource.aStart.Tab();
753 pDoc->SetValue( nValX, nValY, nTab, fStartValue );
755 pDoc->Fill( aSource.aStart.Col(), aSource.aStart.Row(),
756 aSource.aEnd.Col(), aSource.aEnd.Row(),
757 aMarkData, nCount,
758 eFillDir, eFillCmd, eFillDateCmd,
759 fStepValue, fMaxValue );
761 SetChangeTrack();
763 pDocShell->PostPaint( aBlockRange, PAINT_GRID );
764 pDocShell->PostDataChanged();
765 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
766 if (pViewShell)
767 pViewShell->CellContentChanged();
769 EndRedo();
773 //----------------------------------------------------------------------------
775 void __EXPORT ScUndoAutoFill::Repeat(SfxRepeatTarget& rTarget)
777 if (rTarget.ISA(ScTabViewTarget))
779 ScTabViewShell& rViewShell = *((ScTabViewTarget&)rTarget).GetViewShell();
780 if (eFillCmd==FILL_SIMPLE)
781 rViewShell.FillSimple( eFillDir, TRUE );
782 else
783 rViewShell.FillSeries( eFillDir, eFillCmd, eFillDateCmd,
784 fStartValue, fStepValue, fMaxValue, TRUE );
789 //----------------------------------------------------------------------------
791 BOOL __EXPORT ScUndoAutoFill::CanRepeat(SfxRepeatTarget& rTarget) const
793 return (rTarget.ISA(ScTabViewTarget));
797 //============================================================================
798 // class ScUndoMerge
800 // Zellen zusammenfassen / Zusammenfassung aufheben
802 //----------------------------------------------------------------------------
804 ScUndoMerge::ScUndoMerge( ScDocShell* pNewDocShell, const ScCellMergeOption& rOption,
805 bool bMergeContents, ScDocument* pUndoDoc, SdrUndoAction* pDrawUndo )
807 : ScSimpleUndo( pNewDocShell ),
809 maOption(rOption),
810 mbMergeContents( bMergeContents ),
811 mpUndoDoc( pUndoDoc ),
812 mpDrawUndo( pDrawUndo )
817 //----------------------------------------------------------------------------
819 ScUndoMerge::~ScUndoMerge()
821 delete mpUndoDoc;
822 DeleteSdrUndoAction( mpDrawUndo );
826 //----------------------------------------------------------------------------
828 String ScUndoMerge::GetComment() const
830 return ScGlobal::GetRscString( STR_UNDO_MERGE );
834 //----------------------------------------------------------------------------
836 void ScUndoMerge::DoChange( bool bUndo ) const
838 using ::std::set;
840 if (maOption.maTabs.empty())
841 // Nothing to do.
842 return;
844 ScDocument* pDoc = pDocShell->GetDocument();
845 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
847 ScRange aCurRange = maOption.getSingleRange(pDocShell->GetCurTab());
848 ScUndoUtil::MarkSimpleBlock(pDocShell, aCurRange);
850 for (set<SCTAB>::const_iterator itr = maOption.maTabs.begin(), itrEnd = maOption.maTabs.end();
851 itr != itrEnd; ++itr)
853 SCTAB nTab = *itr;
854 ScRange aRange = maOption.getSingleRange(nTab);
856 if (bUndo)
857 // remove merge (contents are copied back below from undo document)
858 pDoc->RemoveMerge( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab() );
859 else
861 // repeat merge, but do not remove note captions (will be done by drawing redo below)
862 pDoc->DoMerge( aRange.aStart.Tab(),
863 aRange.aStart.Col(), aRange.aStart.Row(),
864 aRange.aEnd.Col(), aRange.aEnd.Row(), false );
866 if (maOption.mbCenter)
868 pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
869 aRange.aStart.Tab(),
870 SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
871 pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
872 aRange.aStart.Tab(),
873 SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
877 // undo -> copy back deleted contents
878 if (bUndo && mpUndoDoc)
880 pDoc->DeleteAreaTab( aRange, IDF_CONTENTS|IDF_NOCAPTIONS );
881 mpUndoDoc->CopyToDocument( aRange, IDF_ALL|IDF_NOCAPTIONS, FALSE, pDoc );
884 // redo -> merge contents again
885 else if (!bUndo && mbMergeContents)
887 pDoc->DoMergeContents( aRange.aStart.Tab(),
888 aRange.aStart.Col(), aRange.aStart.Row(),
889 aRange.aEnd.Col(), aRange.aEnd.Row() );
892 if (bUndo)
893 DoSdrUndoAction( mpDrawUndo, pDoc );
894 else
895 RedoSdrUndoAction( mpDrawUndo );
897 bool bDidPaint = false;
898 if ( pViewShell )
900 pViewShell->SetTabNo(nTab);
901 bDidPaint = pViewShell->AdjustRowHeight(maOption.mnStartRow, maOption.mnEndRow);
904 if (!bDidPaint)
905 ScUndoUtil::PaintMore(pDocShell, aRange);
908 ShowTable(aCurRange);
912 //----------------------------------------------------------------------------
914 void ScUndoMerge::Undo()
916 BeginUndo();
917 DoChange( true );
918 EndUndo();
922 //----------------------------------------------------------------------------
924 void ScUndoMerge::Redo()
926 BeginRedo();
927 DoChange( false );
928 EndRedo();
932 //----------------------------------------------------------------------------
934 void ScUndoMerge::Repeat(SfxRepeatTarget& rTarget)
936 if (rTarget.ISA(ScTabViewTarget))
938 ScTabViewShell& rViewShell = *((ScTabViewTarget&)rTarget).GetViewShell();
939 BOOL bCont = FALSE;
940 rViewShell.MergeCells( FALSE, bCont, TRUE );
945 //----------------------------------------------------------------------------
947 BOOL ScUndoMerge::CanRepeat(SfxRepeatTarget& rTarget) const
949 return (rTarget.ISA(ScTabViewTarget));
953 //============================================================================
954 // class ScUndoAutoFormat
956 // Auto-Format (nur einfache Bloecke)
958 //----------------------------------------------------------------------------
960 ScUndoAutoFormat::ScUndoAutoFormat( ScDocShell* pNewDocShell,
961 const ScRange& rRange, ScDocument* pNewUndoDoc,
962 const ScMarkData& rMark, BOOL bNewSize, USHORT nNewFormatNo )
964 : ScBlockUndo( pNewDocShell, rRange, bNewSize ? SC_UNDO_MANUALHEIGHT : SC_UNDO_AUTOHEIGHT ),
966 pUndoDoc ( pNewUndoDoc ),
967 aMarkData ( rMark ),
968 bSize ( bNewSize ),
969 nFormatNo ( nNewFormatNo )
974 //----------------------------------------------------------------------------
976 __EXPORT ScUndoAutoFormat::~ScUndoAutoFormat()
978 delete pUndoDoc;
982 //----------------------------------------------------------------------------
984 String __EXPORT ScUndoAutoFormat::GetComment() const
986 return ScGlobal::GetRscString( STR_UNDO_AUTOFORMAT ); //"Auto-Format"
990 //----------------------------------------------------------------------------
992 void __EXPORT ScUndoAutoFormat::Undo()
994 BeginUndo();
996 ScDocument* pDoc = pDocShell->GetDocument();
998 // Attribute
999 // pDoc->DeleteAreaTab( aBlockRange, IDF_ATTRIB );
1000 // pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, FALSE, pDoc );
1002 SCTAB nTabCount = pDoc->GetTableCount();
1003 pDoc->DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
1004 aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(),
1005 aMarkData, IDF_ATTRIB );
1006 ScRange aCopyRange = aBlockRange;
1007 aCopyRange.aStart.SetTab(0);
1008 aCopyRange.aEnd.SetTab(nTabCount-1);
1009 pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, FALSE, pDoc, &aMarkData );
1011 // Zellhoehen und -breiten (IDF_NONE)
1012 if (bSize)
1014 SCCOL nStartX = aBlockRange.aStart.Col();
1015 SCROW nStartY = aBlockRange.aStart.Row();
1016 SCTAB nStartZ = aBlockRange.aStart.Tab();
1017 SCCOL nEndX = aBlockRange.aEnd.Col();
1018 SCROW nEndY = aBlockRange.aEnd.Row();
1019 SCTAB nEndZ = aBlockRange.aEnd.Tab();
1021 pUndoDoc->CopyToDocument( nStartX, 0, 0, nEndX, MAXROW, nTabCount-1,
1022 IDF_NONE, FALSE, pDoc, &aMarkData );
1023 pUndoDoc->CopyToDocument( 0, nStartY, 0, MAXCOL, nEndY, nTabCount-1,
1024 IDF_NONE, FALSE, pDoc, &aMarkData );
1025 pDocShell->PostPaint( 0, 0, nStartZ, MAXCOL, MAXROW, nEndZ,
1026 PAINT_GRID | PAINT_LEFT | PAINT_TOP, SC_PF_LINES );
1028 else
1029 pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES );
1031 EndUndo();
1035 //----------------------------------------------------------------------------
1037 void __EXPORT ScUndoAutoFormat::Redo()
1039 BeginRedo();
1041 ScDocument* pDoc = pDocShell->GetDocument();
1043 SCCOL nStartX = aBlockRange.aStart.Col();
1044 SCROW nStartY = aBlockRange.aStart.Row();
1045 SCTAB nStartZ = aBlockRange.aStart.Tab();
1046 SCCOL nEndX = aBlockRange.aEnd.Col();
1047 SCROW nEndY = aBlockRange.aEnd.Row();
1048 SCTAB nEndZ = aBlockRange.aEnd.Tab();
1050 pDoc->AutoFormat( nStartX, nStartY, nEndX, nEndY, nFormatNo, aMarkData );
1052 if (bSize)
1054 VirtualDevice aVirtDev;
1055 Fraction aZoomX(1,1);
1056 Fraction aZoomY = aZoomX;
1057 double nPPTX,nPPTY;
1058 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1059 if (pViewShell)
1061 ScViewData* pData = pViewShell->GetViewData();
1062 nPPTX = pData->GetPPTX();
1063 nPPTY = pData->GetPPTY();
1064 aZoomX = pData->GetZoomX();
1065 aZoomY = pData->GetZoomY();
1067 else
1069 // Zoom auf 100 lassen
1070 nPPTX = ScGlobal::nScreenPPTX;
1071 nPPTY = ScGlobal::nScreenPPTY;
1074 BOOL bFormula = FALSE; //! merken
1076 for (SCTAB nTab=nStartZ; nTab<=nEndZ; nTab++)
1078 ScMarkData aDestMark;
1079 aDestMark.SelectOneTable( nTab );
1080 aDestMark.SetMarkArea( ScRange( nStartX, nStartY, nTab, nEndX, nEndY, nTab ) );
1081 aDestMark.MarkToMulti();
1083 // wie SC_SIZE_VISOPT
1084 SCROW nLastRow = -1;
1085 for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
1087 BYTE nOld = pDoc->GetRowFlags(nRow,nTab);
1088 bool bHidden = pDoc->RowHidden(nRow, nTab, nLastRow);
1089 if ( !bHidden && ( nOld & CR_MANUALSIZE ) )
1090 pDoc->SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
1092 pDoc->SetOptimalHeight( nStartY, nEndY, nTab, 0, &aVirtDev,
1093 nPPTX, nPPTY, aZoomX, aZoomY, FALSE );
1095 SCCOL nLastCol = -1;
1096 for (SCCOL nCol=nStartX; nCol<=nEndX; nCol++)
1097 if (!pDoc->ColHidden(nCol, nTab, nLastCol))
1099 USHORT nThisSize = STD_EXTRA_WIDTH + pDoc->GetOptimalColWidth( nCol, nTab,
1100 &aVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, bFormula,
1101 &aDestMark );
1102 pDoc->SetColWidth( nCol, nTab, nThisSize );
1103 pDoc->ShowCol( nCol, nTab, TRUE );
1107 pDocShell->PostPaint( 0, 0, nStartZ,
1108 MAXCOL, MAXROW, nEndZ,
1109 PAINT_GRID | PAINT_LEFT | PAINT_TOP, SC_PF_LINES);
1111 else
1112 pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES );
1114 EndRedo();
1118 //----------------------------------------------------------------------------
1120 void __EXPORT ScUndoAutoFormat::Repeat(SfxRepeatTarget& rTarget)
1122 if (rTarget.ISA(ScTabViewTarget))
1123 ((ScTabViewTarget&)rTarget).GetViewShell()->AutoFormat( nFormatNo, TRUE );
1127 //----------------------------------------------------------------------------
1129 BOOL __EXPORT ScUndoAutoFormat::CanRepeat(SfxRepeatTarget& rTarget) const
1131 return (rTarget.ISA(ScTabViewTarget));
1135 //============================================================================
1136 // class ScUndoReplace
1138 // Ersetzen
1140 //----------------------------------------------------------------------------
1142 ScUndoReplace::ScUndoReplace( ScDocShell* pNewDocShell, const ScMarkData& rMark,
1143 SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
1144 const String& rNewUndoStr, ScDocument* pNewUndoDoc,
1145 const SvxSearchItem* pItem )
1147 : ScSimpleUndo( pNewDocShell ),
1149 aCursorPos ( nCurX, nCurY, nCurZ ),
1150 aMarkData ( rMark ),
1151 aUndoStr ( rNewUndoStr ),
1152 pUndoDoc ( pNewUndoDoc )
1154 pSearchItem = new SvxSearchItem( *pItem );
1155 SetChangeTrack();
1159 //----------------------------------------------------------------------------
1161 __EXPORT ScUndoReplace::~ScUndoReplace()
1163 delete pUndoDoc;
1164 delete pSearchItem;
1168 //----------------------------------------------------------------------------
1170 void ScUndoReplace::SetChangeTrack()
1172 ScDocument* pDoc = pDocShell->GetDocument();
1173 ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
1174 if ( pChangeTrack )
1176 if ( pUndoDoc )
1177 { //! im UndoDoc stehen nur die geaenderten Zellen,
1178 // deswegen per Iterator moeglich
1179 pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
1180 nStartChangeAction, nEndChangeAction );
1182 else
1184 nStartChangeAction = pChangeTrack->GetActionMax() + 1;
1185 ScChangeActionContent* pContent = new ScChangeActionContent(
1186 ScRange( aCursorPos) );
1187 pContent->SetOldValue( aUndoStr, pDoc );
1188 pContent->SetNewValue( pDoc->GetCell( aCursorPos ), pDoc );
1189 pChangeTrack->Append( pContent );
1190 nEndChangeAction = pChangeTrack->GetActionMax();
1193 else
1194 nStartChangeAction = nEndChangeAction = 0;
1197 //----------------------------------------------------------------------------
1199 String __EXPORT ScUndoReplace::GetComment() const
1201 return ScGlobal::GetRscString( STR_UNDO_REPLACE ); // "Ersetzen"
1205 //----------------------------------------------------------------------------
1207 void __EXPORT ScUndoReplace::Undo()
1209 BeginUndo();
1211 ScDocument* pDoc = pDocShell->GetDocument();
1212 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1214 ShowTable( aCursorPos.Tab() );
1216 if (pUndoDoc) // nur bei ReplaceAll !!
1218 DBG_ASSERT(pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL,
1219 "ScUndoReplace:: Falscher Modus");
1221 if (pViewShell)
1222 pViewShell->SetMarkData( aMarkData );
1224 //! markierte Tabellen
1225 //! Bereich merken ?
1227 // Undo-Dokument hat keine Zeilen-/Spalten-Infos, also mit bColRowFlags = FALSE
1228 // kopieren, um Outline-Gruppen nicht kaputtzumachen.
1230 USHORT nUndoFlags = (pSearchItem->GetPattern()) ? IDF_ATTRIB : IDF_CONTENTS;
1231 pUndoDoc->CopyToDocument( 0, 0, 0,
1232 MAXCOL, MAXROW, MAXTAB,
1233 nUndoFlags, FALSE, pDoc, NULL, FALSE ); // ohne Row-Flags
1234 pDocShell->PostPaintGridAll();
1236 else if (pSearchItem->GetPattern() &&
1237 pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
1239 String aTempStr = pSearchItem->GetSearchString(); // vertauschen
1240 pSearchItem->SetSearchString(pSearchItem->GetReplaceString());
1241 pSearchItem->SetReplaceString(aTempStr);
1242 pDoc->ReplaceStyle( *pSearchItem,
1243 aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(),
1244 aMarkData, TRUE);
1245 pSearchItem->SetReplaceString(pSearchItem->GetSearchString());
1246 pSearchItem->SetSearchString(aTempStr);
1247 if (pViewShell)
1248 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1249 SC_FOLLOW_JUMP, FALSE, FALSE );
1250 pDocShell->PostPaintGridAll();
1252 else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
1254 if (ScPostIt* pNote = pDoc->GetNote(aCursorPos))
1256 pNote->SetText( aUndoStr );
1258 else
1260 DBG_ERROR("ScUndoReplace: Hier ist keine Notizzelle");
1262 if (pViewShell)
1263 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1264 SC_FOLLOW_JUMP, FALSE, FALSE );
1266 else
1268 // #78889# aUndoStr may contain line breaks
1269 if ( aUndoStr.Search('\n') != STRING_NOTFOUND )
1270 pDoc->PutCell( aCursorPos, new ScEditCell( aUndoStr, pDoc ) );
1271 else
1272 pDoc->SetString( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aUndoStr );
1273 if (pViewShell)
1274 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1275 SC_FOLLOW_JUMP, FALSE, FALSE );
1276 pDocShell->PostPaintGridAll();
1279 ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
1280 if ( pChangeTrack )
1281 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1283 EndUndo();
1287 //----------------------------------------------------------------------------
1289 void __EXPORT ScUndoReplace::Redo()
1291 BeginRedo();
1293 ScDocument* pDoc = pDocShell->GetDocument();
1294 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1296 if (pViewShell)
1297 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1298 SC_FOLLOW_JUMP, FALSE, FALSE );
1299 if (pUndoDoc)
1301 if (pViewShell)
1303 pViewShell->SetMarkData( aMarkData );
1305 pViewShell->SearchAndReplace( pSearchItem, FALSE, TRUE );
1308 else if (pSearchItem->GetPattern() &&
1309 pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
1311 pDoc->ReplaceStyle( *pSearchItem,
1312 aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(),
1313 aMarkData, TRUE);
1314 pDocShell->PostPaintGridAll();
1316 else
1317 if (pViewShell)
1318 pViewShell->SearchAndReplace( pSearchItem, FALSE, TRUE );
1320 SetChangeTrack();
1322 EndRedo();
1326 //----------------------------------------------------------------------------
1328 void __EXPORT ScUndoReplace::Repeat(SfxRepeatTarget& rTarget)
1330 if (rTarget.ISA(ScTabViewTarget))
1331 ((ScTabViewTarget&)rTarget).GetViewShell()->SearchAndReplace( pSearchItem, TRUE, FALSE );
1335 //----------------------------------------------------------------------------
1337 BOOL __EXPORT ScUndoReplace::CanRepeat(SfxRepeatTarget& rTarget) const
1339 return (rTarget.ISA(ScTabViewTarget));
1343 //============================================================================
1344 // class ScUndoTabOp
1346 // Mehrfachoperation (nur einfache Bloecke)
1348 //----------------------------------------------------------------------------
1350 ScUndoTabOp::ScUndoTabOp( ScDocShell* pNewDocShell,
1351 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
1352 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, ScDocument* pNewUndoDoc,
1353 const ScRefAddress& rFormulaCell,
1354 const ScRefAddress& rFormulaEnd,
1355 const ScRefAddress& rRowCell,
1356 const ScRefAddress& rColCell,
1357 BYTE nMd )
1359 : ScSimpleUndo( pNewDocShell ),
1361 aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
1362 pUndoDoc ( pNewUndoDoc ),
1363 theFormulaCell ( rFormulaCell ),
1364 theFormulaEnd ( rFormulaEnd ),
1365 theRowCell ( rRowCell ),
1366 theColCell ( rColCell ),
1367 nMode ( nMd )
1372 //----------------------------------------------------------------------------
1374 __EXPORT ScUndoTabOp::~ScUndoTabOp()
1376 delete pUndoDoc;
1380 //----------------------------------------------------------------------------
1382 String __EXPORT ScUndoTabOp::GetComment() const
1384 return ScGlobal::GetRscString( STR_UNDO_TABOP ); // "Mehrfachoperation"
1388 //----------------------------------------------------------------------------
1390 void __EXPORT ScUndoTabOp::Undo()
1392 BeginUndo();
1394 ScUndoUtil::MarkSimpleBlock( pDocShell, aRange );
1396 USHORT nExtFlags = 0;
1397 pDocShell->UpdatePaintExt( nExtFlags, aRange );
1399 ScDocument* pDoc = pDocShell->GetDocument();
1400 pDoc->DeleteAreaTab( aRange,IDF_ALL );
1401 pUndoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc );
1402 pDocShell->PostPaint( aRange, PAINT_GRID, nExtFlags );
1403 pDocShell->PostDataChanged();
1404 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1405 if (pViewShell)
1406 pViewShell->CellContentChanged();
1408 EndUndo();
1412 //----------------------------------------------------------------------------
1414 void __EXPORT ScUndoTabOp::Redo()
1416 BeginRedo();
1418 ScUndoUtil::MarkSimpleBlock( pDocShell, aRange );
1420 ScTabOpParam aParam( theFormulaCell, theFormulaEnd,
1421 theRowCell, theColCell,
1422 nMode );
1424 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1425 if (pViewShell)
1426 pViewShell->TabOp( aParam, FALSE);
1428 EndRedo();
1432 //----------------------------------------------------------------------------
1434 void __EXPORT ScUndoTabOp::Repeat(SfxRepeatTarget& /* rTarget */)
1439 //----------------------------------------------------------------------------
1441 BOOL __EXPORT ScUndoTabOp::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1443 return FALSE;
1447 //============================================================================
1448 // class ScUndoConversion
1450 // Spelling
1452 //----------------------------------------------------------------------------
1454 ScUndoConversion::ScUndoConversion(
1455 ScDocShell* pNewDocShell, const ScMarkData& rMark,
1456 SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScDocument* pNewUndoDoc,
1457 SCCOL nNewX, SCROW nNewY, SCTAB nNewZ, ScDocument* pNewRedoDoc,
1458 const ScConversionParam& rConvParam ) :
1459 ScSimpleUndo( pNewDocShell ),
1460 aMarkData( rMark ),
1461 aCursorPos( nCurX, nCurY, nCurZ ),
1462 pUndoDoc( pNewUndoDoc ),
1463 aNewCursorPos( nNewX, nNewY, nNewZ ),
1464 pRedoDoc( pNewRedoDoc ),
1465 maConvParam( rConvParam )
1467 SetChangeTrack();
1471 //----------------------------------------------------------------------------
1473 __EXPORT ScUndoConversion::~ScUndoConversion()
1475 delete pUndoDoc;
1476 delete pRedoDoc;
1480 //----------------------------------------------------------------------------
1482 void ScUndoConversion::SetChangeTrack()
1484 ScDocument* pDoc = pDocShell->GetDocument();
1485 ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
1486 if ( pChangeTrack )
1488 if ( pUndoDoc )
1489 pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
1490 nStartChangeAction, nEndChangeAction );
1491 else
1493 DBG_ERROR( "ScUndoConversion::SetChangeTrack: kein UndoDoc" );
1494 nStartChangeAction = nEndChangeAction = 0;
1497 else
1498 nStartChangeAction = nEndChangeAction = 0;
1501 //----------------------------------------------------------------------------
1503 String ScUndoConversion::GetComment() const
1505 String aText;
1506 switch( maConvParam.GetType() )
1508 case SC_CONVERSION_SPELLCHECK: aText = ScGlobal::GetRscString( STR_UNDO_SPELLING ); break;
1509 case SC_CONVERSION_HANGULHANJA: aText = ScGlobal::GetRscString( STR_UNDO_HANGULHANJA ); break;
1510 case SC_CONVERSION_CHINESE_TRANSL: aText = ScGlobal::GetRscString( STR_UNDO_CHINESE_TRANSLATION ); break;
1511 default: DBG_ERRORFILE( "ScUndoConversion::GetComment - unknown conversion type" );
1513 return aText;
1517 //----------------------------------------------------------------------------
1519 void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPos )
1521 if (pRefDoc)
1523 ScDocument* pDoc = pDocShell->GetDocument();
1524 ShowTable( rCursorPos.Tab() );
1526 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1527 if (pViewShell)
1528 pViewShell->SetMarkData( aMarkData );
1530 SCTAB nTabCount = pDoc->GetTableCount();
1531 // Undo/Redo-doc has only selected tables
1533 BOOL bMulti = aMarkData.IsMultiMarked();
1534 pRefDoc->CopyToDocument( 0, 0, 0,
1535 MAXCOL, MAXROW, nTabCount-1,
1536 IDF_CONTENTS, bMulti, pDoc, &aMarkData );
1537 pDocShell->PostPaintGridAll();
1539 else
1541 DBG_ERROR("Kein Un-/RedoDoc bei Un-/RedoSpelling");
1546 //----------------------------------------------------------------------------
1548 void ScUndoConversion::Undo()
1550 BeginUndo();
1551 DoChange( pUndoDoc, aCursorPos );
1552 ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
1553 if ( pChangeTrack )
1554 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1555 EndUndo();
1559 //----------------------------------------------------------------------------
1561 void ScUndoConversion::Redo()
1563 BeginRedo();
1564 DoChange( pRedoDoc, aNewCursorPos );
1565 SetChangeTrack();
1566 EndRedo();
1570 //----------------------------------------------------------------------------
1572 void ScUndoConversion::Repeat( SfxRepeatTarget& rTarget )
1574 if( rTarget.ISA( ScTabViewTarget ) )
1575 ((ScTabViewTarget&)rTarget).GetViewShell()->DoSheetConversion( maConvParam, TRUE );
1579 //----------------------------------------------------------------------------
1581 BOOL ScUndoConversion::CanRepeat(SfxRepeatTarget& rTarget) const
1583 return rTarget.ISA( ScTabViewTarget );
1587 //============================================================================
1588 // class ScUndoRefreshLink
1590 // Link aktualisieren / aendern
1592 //----------------------------------------------------------------------------
1594 ScUndoRefreshLink::ScUndoRefreshLink( ScDocShell* pNewDocShell,
1595 ScDocument* pNewUndoDoc )
1597 : ScSimpleUndo( pNewDocShell ),
1599 pUndoDoc( pNewUndoDoc ),
1600 pRedoDoc( NULL )
1605 //----------------------------------------------------------------------------
1607 __EXPORT ScUndoRefreshLink::~ScUndoRefreshLink()
1609 delete pUndoDoc;
1610 delete pRedoDoc;
1614 //----------------------------------------------------------------------------
1616 String __EXPORT ScUndoRefreshLink::GetComment() const
1618 return ScGlobal::GetRscString( STR_UNDO_UPDATELINK );
1622 //----------------------------------------------------------------------------
1624 void __EXPORT ScUndoRefreshLink::Undo()
1626 BeginUndo();
1628 BOOL bMakeRedo = !pRedoDoc;
1629 if (bMakeRedo)
1630 pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
1632 BOOL bFirst = TRUE;
1633 ScDocument* pDoc = pDocShell->GetDocument();
1634 SCTAB nCount = pDoc->GetTableCount();
1635 for (SCTAB nTab=0; nTab<nCount; nTab++)
1636 if (pUndoDoc->HasTable(nTab))
1638 ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
1639 if (bMakeRedo)
1641 if (bFirst)
1642 pRedoDoc->InitUndo( pDoc, nTab, nTab, TRUE, TRUE );
1643 else
1644 pRedoDoc->AddUndoTab( nTab, nTab, TRUE, TRUE );
1645 bFirst = FALSE;
1646 pDoc->CopyToDocument(aRange, IDF_ALL, FALSE, pRedoDoc);
1647 // pRedoDoc->TransferDrawPage( pDoc, nTab, nTab );
1648 pRedoDoc->SetLink( nTab,
1649 pDoc->GetLinkMode(nTab),
1650 pDoc->GetLinkDoc(nTab),
1651 pDoc->GetLinkFlt(nTab),
1652 pDoc->GetLinkOpt(nTab),
1653 pDoc->GetLinkTab(nTab),
1654 pDoc->GetLinkRefreshDelay(nTab) );
1657 pDoc->DeleteAreaTab( aRange,IDF_ALL );
1658 pUndoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc );
1659 // pDoc->TransferDrawPage( pUndoDoc, nTab, nTab );
1660 pDoc->SetLink( nTab, pUndoDoc->GetLinkMode(nTab), pUndoDoc->GetLinkDoc(nTab),
1661 pUndoDoc->GetLinkFlt(nTab), pUndoDoc->GetLinkOpt(nTab),
1662 pUndoDoc->GetLinkTab(nTab),
1663 pUndoDoc->GetLinkRefreshDelay(nTab) );
1666 pDocShell->PostPaintGridAll();
1668 EndUndo();
1672 //----------------------------------------------------------------------------
1674 void __EXPORT ScUndoRefreshLink::Redo()
1676 DBG_ASSERT(pRedoDoc, "Kein RedoDoc bei ScUndoRefreshLink::Redo");
1678 BeginUndo();
1680 ScDocument* pDoc = pDocShell->GetDocument();
1681 SCTAB nCount = pDoc->GetTableCount();
1682 for (SCTAB nTab=0; nTab<nCount; nTab++)
1683 if (pRedoDoc->HasTable(nTab))
1685 ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
1687 pDoc->DeleteAreaTab( aRange, IDF_ALL );
1688 pRedoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc );
1689 // pDoc->TransferDrawPage( pRedoDoc, nTab, nTab );
1690 pDoc->SetLink( nTab,
1691 pRedoDoc->GetLinkMode(nTab),
1692 pRedoDoc->GetLinkDoc(nTab),
1693 pRedoDoc->GetLinkFlt(nTab),
1694 pRedoDoc->GetLinkOpt(nTab),
1695 pRedoDoc->GetLinkTab(nTab),
1696 pRedoDoc->GetLinkRefreshDelay(nTab) );
1699 pDocShell->PostPaintGridAll();
1701 EndUndo();
1705 //----------------------------------------------------------------------------
1707 void __EXPORT ScUndoRefreshLink::Repeat(SfxRepeatTarget& /* rTarget */)
1709 // gippsnich
1713 //----------------------------------------------------------------------------
1715 BOOL __EXPORT ScUndoRefreshLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1717 return FALSE;
1721 //----------------------------------------------------------------------------
1723 ScAreaLink* lcl_FindAreaLink( SvxLinkManager* pLinkManager, const String& rDoc,
1724 const String& rFlt, const String& rOpt,
1725 const String& rSrc, const ScRange& rDest )
1727 const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
1728 USHORT nCount = pLinkManager->GetLinks().Count();
1729 for (USHORT i=0; i<nCount; i++)
1731 ::sfx2::SvBaseLink* pBase = *rLinks[i];
1732 if (pBase->ISA(ScAreaLink))
1733 if ( ((ScAreaLink*)pBase)->IsEqual( rDoc, rFlt, rOpt, rSrc, rDest ) )
1734 return (ScAreaLink*)pBase;
1737 DBG_ERROR("ScAreaLink nicht gefunden");
1738 return NULL;
1742 //============================================================================
1743 // class ScUndoInsertAreaLink
1745 // Bereichs-Verknuepfung einfuegen
1747 //----------------------------------------------------------------------------
1749 ScUndoInsertAreaLink::ScUndoInsertAreaLink( ScDocShell* pShell,
1750 const String& rDoc,
1751 const String& rFlt, const String& rOpt,
1752 const String& rArea, const ScRange& rDestRange,
1753 ULONG nRefresh )
1755 : ScSimpleUndo ( pShell ),
1757 aDocName ( rDoc ),
1758 aFltName ( rFlt ),
1759 aOptions ( rOpt ),
1760 aAreaName ( rArea ),
1761 aRange ( rDestRange ),
1762 nRefreshDelay ( nRefresh )
1767 //----------------------------------------------------------------------------
1769 __EXPORT ScUndoInsertAreaLink::~ScUndoInsertAreaLink()
1774 //----------------------------------------------------------------------------
1776 String __EXPORT ScUndoInsertAreaLink::GetComment() const
1778 return ScGlobal::GetRscString( STR_UNDO_INSERTAREALINK );
1782 //----------------------------------------------------------------------------
1784 void __EXPORT ScUndoInsertAreaLink::Undo()
1786 ScDocument* pDoc = pDocShell->GetDocument();
1787 SvxLinkManager* pLinkManager = pDoc->GetLinkManager();
1789 ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aDocName, aFltName, aOptions,
1790 aAreaName, aRange );
1791 if (pLink)
1792 pLinkManager->Remove( pLink );
1794 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator
1798 //----------------------------------------------------------------------------
1800 void __EXPORT ScUndoInsertAreaLink::Redo()
1802 ScDocument* pDoc = pDocShell->GetDocument();
1803 SvxLinkManager* pLinkManager = pDoc->GetLinkManager();
1805 ScAreaLink* pLink = new ScAreaLink( pDocShell, aDocName, aFltName, aOptions,
1806 aAreaName, aRange.aStart, nRefreshDelay );
1807 pLink->SetInCreate( TRUE );
1808 pLink->SetDestArea( aRange );
1809 pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aDocName, &aFltName, &aAreaName );
1810 pLink->Update();
1811 pLink->SetInCreate( FALSE );
1813 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator
1817 //----------------------------------------------------------------------------
1819 void __EXPORT ScUndoInsertAreaLink::Repeat(SfxRepeatTarget& /* rTarget */)
1821 //! ....
1825 //----------------------------------------------------------------------------
1827 BOOL __EXPORT ScUndoInsertAreaLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1829 return FALSE;
1833 //============================================================================
1834 // class ScUndoRemoveAreaLink
1836 // Bereichs-Verknuepfung loeschen
1838 //----------------------------------------------------------------------------
1840 ScUndoRemoveAreaLink::ScUndoRemoveAreaLink( ScDocShell* pShell,
1841 const String& rDoc, const String& rFlt, const String& rOpt,
1842 const String& rArea, const ScRange& rDestRange,
1843 ULONG nRefresh )
1845 : ScSimpleUndo ( pShell ),
1847 aDocName ( rDoc ),
1848 aFltName ( rFlt ),
1849 aOptions ( rOpt ),
1850 aAreaName ( rArea ),
1851 aRange ( rDestRange ),
1852 nRefreshDelay ( nRefresh )
1857 //----------------------------------------------------------------------------
1859 __EXPORT ScUndoRemoveAreaLink::~ScUndoRemoveAreaLink()
1864 //----------------------------------------------------------------------------
1866 String __EXPORT ScUndoRemoveAreaLink::GetComment() const
1868 return ScGlobal::GetRscString( STR_UNDO_REMOVELINK ); //! eigener Text ??
1872 //----------------------------------------------------------------------------
1874 void __EXPORT ScUndoRemoveAreaLink::Undo()
1876 ScDocument* pDoc = pDocShell->GetDocument();
1877 SvxLinkManager* pLinkManager = pDoc->GetLinkManager();
1879 ScAreaLink* pLink = new ScAreaLink( pDocShell, aDocName, aFltName, aOptions,
1880 aAreaName, aRange.aStart, nRefreshDelay );
1881 pLink->SetInCreate( TRUE );
1882 pLink->SetDestArea( aRange );
1883 pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aDocName, &aFltName, &aAreaName );
1884 pLink->Update();
1885 pLink->SetInCreate( FALSE );
1887 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator
1891 //----------------------------------------------------------------------------
1893 void __EXPORT ScUndoRemoveAreaLink::Redo()
1895 ScDocument* pDoc = pDocShell->GetDocument();
1896 SvxLinkManager* pLinkManager = pDoc->GetLinkManager();
1898 ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aDocName, aFltName, aOptions,
1899 aAreaName, aRange );
1900 if (pLink)
1901 pLinkManager->Remove( pLink );
1903 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator
1907 //----------------------------------------------------------------------------
1909 void __EXPORT ScUndoRemoveAreaLink::Repeat(SfxRepeatTarget& /* rTarget */)
1911 // gippsnich
1915 //----------------------------------------------------------------------------
1917 BOOL __EXPORT ScUndoRemoveAreaLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1919 return FALSE;
1923 //============================================================================
1924 // class ScUndoUpdateAreaLink
1926 // Bereichs-Verknuepfung aktualisieren
1928 //----------------------------------------------------------------------------
1930 ScUndoUpdateAreaLink::ScUndoUpdateAreaLink( ScDocShell* pShell,
1931 const String& rOldD, const String& rOldF, const String& rOldO,
1932 const String& rOldA, const ScRange& rOldR, ULONG nOldRD,
1933 const String& rNewD, const String& rNewF, const String& rNewO,
1934 const String& rNewA, const ScRange& rNewR, ULONG nNewRD,
1935 ScDocument* pUndo, ScDocument* pRedo, BOOL bDoInsert )
1937 : ScSimpleUndo( pShell ),
1939 aOldDoc ( rOldD ),
1940 aOldFlt ( rOldF ),
1941 aOldOpt ( rOldO ),
1942 aOldArea ( rOldA ),
1943 aOldRange ( rOldR ),
1944 aNewDoc ( rNewD ),
1945 aNewFlt ( rNewF ),
1946 aNewOpt ( rNewO ),
1947 aNewArea ( rNewA ),
1948 aNewRange ( rNewR ),
1949 pUndoDoc ( pUndo ),
1950 pRedoDoc ( pRedo ),
1951 nOldRefresh ( nOldRD ),
1952 nNewRefresh ( nNewRD ),
1953 bWithInsert ( bDoInsert )
1955 DBG_ASSERT( aOldRange.aStart == aNewRange.aStart, "AreaLink verschoben ?" );
1959 //----------------------------------------------------------------------------
1961 __EXPORT ScUndoUpdateAreaLink::~ScUndoUpdateAreaLink()
1963 delete pUndoDoc;
1964 delete pRedoDoc;
1968 //----------------------------------------------------------------------------
1970 String __EXPORT ScUndoUpdateAreaLink::GetComment() const
1972 return ScGlobal::GetRscString( STR_UNDO_UPDATELINK ); //! eigener Text ??
1976 //----------------------------------------------------------------------------
1978 void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo ) const
1980 ScDocument* pDoc = pDocShell->GetDocument();
1982 SCCOL nEndX = Max( aOldRange.aEnd.Col(), aNewRange.aEnd.Col() );
1983 SCROW nEndY = Max( aOldRange.aEnd.Row(), aNewRange.aEnd.Row() );
1984 SCTAB nEndZ = Max( aOldRange.aEnd.Tab(), aNewRange.aEnd.Tab() ); //?
1986 if ( bUndo )
1988 if ( bWithInsert )
1990 pDoc->FitBlock( aNewRange, aOldRange );
1991 pDoc->DeleteAreaTab( aOldRange, IDF_ALL );
1992 pUndoDoc->UndoToDocument( aOldRange, IDF_ALL, FALSE, pDoc );
1994 else
1996 ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
1997 pDoc->DeleteAreaTab( aCopyRange, IDF_ALL );
1998 pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc );
2001 else
2003 if ( bWithInsert )
2005 pDoc->FitBlock( aOldRange, aNewRange );
2006 pDoc->DeleteAreaTab( aNewRange, IDF_ALL );
2007 pRedoDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pDoc );
2009 else
2011 ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
2012 pDoc->DeleteAreaTab( aCopyRange, IDF_ALL );
2013 pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc );
2017 ScRange aWorkRange( aNewRange.aStart, ScAddress( nEndX, nEndY, nEndZ ) );
2018 pDoc->ExtendMerge( aWorkRange, TRUE );
2020 // Paint
2022 if ( aNewRange.aEnd.Col() != aOldRange.aEnd.Col() )
2023 aWorkRange.aEnd.SetCol(MAXCOL);
2024 if ( aNewRange.aEnd.Row() != aOldRange.aEnd.Row() )
2025 aWorkRange.aEnd.SetRow(MAXROW);
2027 if ( !pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), aWorkRange.aStart.Tab() ) )
2028 pDocShell->PostPaint( aWorkRange, PAINT_GRID );
2030 pDocShell->PostDataChanged();
2031 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
2032 if (pViewShell)
2033 pViewShell->CellContentChanged();
2037 //----------------------------------------------------------------------------
2039 void __EXPORT ScUndoUpdateAreaLink::Undo()
2041 ScDocument* pDoc = pDocShell->GetDocument();
2042 SvxLinkManager* pLinkManager = pDoc->GetLinkManager();
2043 ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aNewDoc, aNewFlt, aNewOpt,
2044 aNewArea, aNewRange );
2045 if (pLink)
2047 pLink->SetSource( aOldDoc, aOldFlt, aOldOpt, aOldArea ); // alte Werte im Link
2048 pLink->SetDestArea( aOldRange );
2049 pLink->SetRefreshDelay( nOldRefresh );
2052 DoChange(TRUE);
2056 //----------------------------------------------------------------------------
2058 void __EXPORT ScUndoUpdateAreaLink::Redo()
2060 ScDocument* pDoc = pDocShell->GetDocument();
2061 SvxLinkManager* pLinkManager = pDoc->GetLinkManager();
2062 ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aOldDoc, aOldFlt, aOldOpt,
2063 aOldArea, aOldRange );
2064 if (pLink)
2066 pLink->SetSource( aNewDoc, aNewFlt, aNewOpt, aNewArea ); // neue Werte im Link
2067 pLink->SetDestArea( aNewRange );
2068 pLink->SetRefreshDelay( nNewRefresh );
2071 DoChange(FALSE);
2075 //----------------------------------------------------------------------------
2077 void __EXPORT ScUndoUpdateAreaLink::Repeat(SfxRepeatTarget& /* rTarget */)
2079 // gippsnich
2083 //----------------------------------------------------------------------------
2085 BOOL __EXPORT ScUndoUpdateAreaLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
2087 return FALSE;