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"
47 #include "globstr.hrc"
49 #include "rangenam.hxx"
50 #include "arealink.hxx"
51 #include "patattr.hxx"
53 #include "document.hxx"
54 #include "docpool.hxx"
57 #include "tabvwsh.hxx"
58 #include "undoolk.hxx"
59 #include "undoutil.hxx"
60 #include "chgtrack.hxx"
61 #include "dociter.hxx"
63 #include "paramisc.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(ScUndoRefConversion
, SfxUndoAction
);
79 TYPEINIT1(ScUndoRefreshLink
, SfxUndoAction
);
80 TYPEINIT1(ScUndoInsertAreaLink
, SfxUndoAction
);
81 TYPEINIT1(ScUndoRemoveAreaLink
, SfxUndoAction
);
82 TYPEINIT1(ScUndoUpdateAreaLink
, SfxUndoAction
);
86 /*A*/ // SetOptimalHeight auf Dokument, wenn keine View
89 //============================================================================
90 // class ScUndoDeleteContents
94 //----------------------------------------------------------------------------
96 ScUndoDeleteContents::ScUndoDeleteContents(
97 ScDocShell
* pNewDocShell
,
98 const ScMarkData
& rMark
, const ScRange
& rRange
,
99 ScDocument
* pNewUndoDoc
, BOOL bNewMulti
,
100 USHORT nNewFlags
, BOOL bObjects
)
102 : ScSimpleUndo( pNewDocShell
),
106 pUndoDoc ( pNewUndoDoc
),
108 nFlags ( nNewFlags
),
109 bMulti ( bNewMulti
) // ueberliquid
112 pDrawUndo
= GetSdrUndoAction( pDocShell
->GetDocument() );
114 if ( !(aMarkData
.IsMarked() || aMarkData
.IsMultiMarked()) ) // keine Zelle markiert:
115 aMarkData
.SetMarkArea( aRange
); // Zelle unter Cursor markieren
121 //----------------------------------------------------------------------------
123 __EXPORT
ScUndoDeleteContents::~ScUndoDeleteContents()
126 DeleteSdrUndoAction( pDrawUndo
);
130 //----------------------------------------------------------------------------
132 String __EXPORT
ScUndoDeleteContents::GetComment() const
134 return ScGlobal::GetRscString( STR_UNDO_DELETECONTENTS
); // "Loeschen"
138 void ScUndoDeleteContents::SetChangeTrack()
140 ScChangeTrack
* pChangeTrack
= pDocShell
->GetDocument()->GetChangeTrack();
141 if ( pChangeTrack
&& (nFlags
& IDF_CONTENTS
) )
142 pChangeTrack
->AppendContentRange( aRange
, pUndoDoc
,
143 nStartChangeAction
, nEndChangeAction
);
145 nStartChangeAction
= nEndChangeAction
= 0;
149 //----------------------------------------------------------------------------
151 void ScUndoDeleteContents::DoChange( const BOOL bUndo
)
153 ScDocument
* pDoc
= pDocShell
->GetDocument();
154 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
157 pViewShell
->SetMarkData( aMarkData
);
159 USHORT nExtFlags
= 0;
161 if (bUndo
) // nur Undo
163 USHORT nUndoFlags
= IDF_NONE
; // entweder alle oder keine Inhalte kopieren
164 if (nFlags
& IDF_CONTENTS
) // (es sind nur die richtigen ins UndoDoc kopiert worden)
165 nUndoFlags
|= IDF_CONTENTS
;
166 if (nFlags
& IDF_ATTRIB
)
167 nUndoFlags
|= IDF_ATTRIB
;
168 if (nFlags
& IDF_EDITATTR
) // Edit-Engine-Attribute
169 nUndoFlags
|= IDF_STRING
; // -> Zellen werden geaendert
170 // do not create clones of note captions, they will be restored via drawing undo
171 nUndoFlags
|= IDF_NOCAPTIONS
;
173 ScRange aCopyRange
= aRange
;
174 SCTAB nTabCount
= pDoc
->GetTableCount();
175 aCopyRange
.aStart
.SetTab(0);
176 aCopyRange
.aEnd
.SetTab(nTabCount
-1);
178 pUndoDoc
->CopyToDocument( aCopyRange
, nUndoFlags
, bMulti
, pDoc
, &aMarkData
);
180 DoSdrUndoAction( pDrawUndo
, pDoc
);
182 ScChangeTrack
* pChangeTrack
= pDoc
->GetChangeTrack();
184 pChangeTrack
->Undo( nStartChangeAction
, nEndChangeAction
);
186 pDocShell
->UpdatePaintExt( nExtFlags
, aRange
); // content after the change
190 pDocShell
->UpdatePaintExt( nExtFlags
, aRange
); // content before the change
192 aMarkData
.MarkToMulti();
193 RedoSdrUndoAction( pDrawUndo
);
194 // do not delete objects and note captions, they have been removed via drawing undo
195 USHORT nRedoFlags
= (nFlags
& ~IDF_OBJECTS
) | IDF_NOCAPTIONS
;
196 pDoc
->DeleteSelection( nRedoFlags
, aMarkData
);
197 aMarkData
.MarkToSimple();
202 if ( !( (pViewShell
) && pViewShell
->AdjustRowHeight(
203 aRange
.aStart
.Row(), aRange
.aEnd
.Row() ) ) )
204 /*A*/ pDocShell
->PostPaint( aRange
, PAINT_GRID
| PAINT_EXTRAS
, nExtFlags
);
206 pDocShell
->PostDataChanged();
208 pViewShell
->CellContentChanged();
214 //----------------------------------------------------------------------------
216 void __EXPORT
ScUndoDeleteContents::Undo()
222 // #i97876# Spreadsheet data changes are not notified
223 ScModelObj
* pModelObj
= ScModelObj::getImplementation( pDocShell
->GetModel() );
224 if ( pModelObj
&& pModelObj
->HasChangesListeners() )
226 ScRangeList aChangeRanges
;
227 aChangeRanges
.Append( aRange
);
228 pModelObj
->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges
);
233 //----------------------------------------------------------------------------
235 void __EXPORT
ScUndoDeleteContents::Redo()
241 // #i97876# Spreadsheet data changes are not notified
242 ScModelObj
* pModelObj
= ScModelObj::getImplementation( pDocShell
->GetModel() );
243 if ( pModelObj
&& pModelObj
->HasChangesListeners() )
245 ScRangeList aChangeRanges
;
246 aChangeRanges
.Append( aRange
);
247 pModelObj
->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges
);
252 //----------------------------------------------------------------------------
254 void __EXPORT
ScUndoDeleteContents::Repeat(SfxRepeatTarget
& rTarget
)
256 if (rTarget
.ISA(ScTabViewTarget
))
257 ((ScTabViewTarget
&)rTarget
).GetViewShell()->DeleteContents( nFlags
, TRUE
);
261 //----------------------------------------------------------------------------
263 BOOL __EXPORT
ScUndoDeleteContents::CanRepeat(SfxRepeatTarget
& rTarget
) const
265 return (rTarget
.ISA(ScTabViewTarget
));
269 //============================================================================
270 // class ScUndoFillTable
272 // Tabellen ausfuellen
273 // (Bearbeiten|Ausfuellen|...)
275 //----------------------------------------------------------------------------
277 ScUndoFillTable::ScUndoFillTable( ScDocShell
* pNewDocShell
,
278 const ScMarkData
& rMark
,
279 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
280 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
281 ScDocument
* pNewUndoDoc
, BOOL bNewMulti
, SCTAB nSrc
,
282 USHORT nFlg
, USHORT nFunc
, BOOL bSkip
, BOOL bLink
)
284 : ScSimpleUndo( pNewDocShell
),
286 aRange ( nStartX
, nStartY
, nStartZ
, nEndX
, nEndY
, nEndZ
),
288 pUndoDoc ( pNewUndoDoc
),
292 bMulti ( bNewMulti
),
293 bSkipEmpty ( bSkip
),
300 //----------------------------------------------------------------------------
302 __EXPORT
ScUndoFillTable::~ScUndoFillTable()
308 //----------------------------------------------------------------------------
310 String __EXPORT
ScUndoFillTable::GetComment() const
312 return ScGlobal::GetRscString( STR_FILL_TAB
);
316 void ScUndoFillTable::SetChangeTrack()
318 ScChangeTrack
* pChangeTrack
= pDocShell
->GetDocument()->GetChangeTrack();
321 SCTAB nTabCount
= pDocShell
->GetDocument()->GetTableCount();
322 ScRange
aWorkRange(aRange
);
323 nStartChangeAction
= 0;
325 for ( SCTAB i
= 0; i
< nTabCount
; i
++ )
327 if (i
!= nSrcTab
&& aMarkData
.GetTableSelect(i
))
329 aWorkRange
.aStart
.SetTab(i
);
330 aWorkRange
.aEnd
.SetTab(i
);
331 pChangeTrack
->AppendContentRange( aWorkRange
, pUndoDoc
,
332 nTmpAction
, nEndChangeAction
);
333 if ( !nStartChangeAction
)
334 nStartChangeAction
= nTmpAction
;
339 nStartChangeAction
= nEndChangeAction
= 0;
343 //----------------------------------------------------------------------------
345 void ScUndoFillTable::DoChange( const BOOL bUndo
)
347 ScDocument
* pDoc
= pDocShell
->GetDocument();
348 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
351 pViewShell
->SetMarkData( aMarkData
);
353 if (bUndo
) // nur Undo
355 SCTAB nTabCount
= pDoc
->GetTableCount();
356 ScRange
aWorkRange(aRange
);
357 for ( SCTAB i
= 0; i
< nTabCount
; i
++ )
358 if (i
!= nSrcTab
&& aMarkData
.GetTableSelect(i
))
360 aWorkRange
.aStart
.SetTab(i
);
361 aWorkRange
.aEnd
.SetTab(i
);
363 pDoc
->DeleteSelectionTab( i
, IDF_ALL
, aMarkData
);
365 pDoc
->DeleteAreaTab( aWorkRange
, IDF_ALL
);
366 pUndoDoc
->CopyToDocument( aWorkRange
, IDF_ALL
, bMulti
, pDoc
, &aMarkData
);
369 ScChangeTrack
* pChangeTrack
= pDoc
->GetChangeTrack();
371 pChangeTrack
->Undo( nStartChangeAction
, nEndChangeAction
);
375 aMarkData
.MarkToMulti();
376 pDoc
->FillTabMarked( nSrcTab
, aMarkData
, nFlags
, nFunction
, bSkipEmpty
, bAsLink
);
377 aMarkData
.MarkToSimple();
381 pDocShell
->PostPaint(0,0,0,MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_EXTRAS
);
382 pDocShell
->PostDataChanged();
384 // CellContentChanged kommt mit der Markierung
388 SCTAB nTab
= pViewShell
->GetViewData()->GetTabNo();
389 if ( !aMarkData
.GetTableSelect(nTab
) )
390 pViewShell
->SetTabNo( nSrcTab
);
392 pViewShell
->DoneBlockMode(); // gibt sonst Probleme, weil Markierung auf falscher Tabelle
397 //----------------------------------------------------------------------------
399 void __EXPORT
ScUndoFillTable::Undo()
407 //----------------------------------------------------------------------------
409 void __EXPORT
ScUndoFillTable::Redo()
417 //----------------------------------------------------------------------------
419 void __EXPORT
ScUndoFillTable::Repeat(SfxRepeatTarget
& rTarget
)
421 if (rTarget
.ISA(ScTabViewTarget
))
422 ((ScTabViewTarget
&)rTarget
).GetViewShell()->FillTab( nFlags
, nFunction
, bSkipEmpty
, bAsLink
);
426 //----------------------------------------------------------------------------
428 BOOL __EXPORT
ScUndoFillTable::CanRepeat(SfxRepeatTarget
& rTarget
) const
430 return (rTarget
.ISA(ScTabViewTarget
));
434 //============================================================================
435 // class ScUndoSelectionAttr
437 // Zellformat aendern
439 //----------------------------------------------------------------------------
441 ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell
* pNewDocShell
,
442 const ScMarkData
& rMark
,
443 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
444 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
445 ScDocument
* pNewUndoDoc
, BOOL bNewMulti
,
446 const ScPatternAttr
* pNewApply
,
447 const SvxBoxItem
* pNewOuter
, const SvxBoxInfoItem
* pNewInner
)
449 : ScSimpleUndo( pNewDocShell
),
452 aRange ( nStartX
, nStartY
, nStartZ
, nEndX
, nEndY
, nEndZ
),
453 pUndoDoc ( pNewUndoDoc
),
456 ScDocumentPool
* pPool
= pDocShell
->GetDocument()->GetPool();
457 pApplyPattern
= (ScPatternAttr
*) &pPool
->Put( *pNewApply
);
458 pLineOuter
= pNewOuter
? (SvxBoxItem
*) &pPool
->Put( *pNewOuter
) : NULL
;
459 pLineInner
= pNewInner
? (SvxBoxInfoItem
*) &pPool
->Put( *pNewInner
) : NULL
;
463 //----------------------------------------------------------------------------
465 __EXPORT
ScUndoSelectionAttr::~ScUndoSelectionAttr()
467 ScDocumentPool
* pPool
= pDocShell
->GetDocument()->GetPool();
468 pPool
->Remove(*pApplyPattern
);
470 pPool
->Remove(*pLineOuter
);
472 pPool
->Remove(*pLineInner
);
478 //----------------------------------------------------------------------------
480 String __EXPORT
ScUndoSelectionAttr::GetComment() const
482 //"Attribute" "/Linien"
483 return ScGlobal::GetRscString( pLineOuter
? STR_UNDO_SELATTRLINES
: STR_UNDO_SELATTR
);
486 //----------------------------------------------------------------------------
488 ScEditDataArray
* ScUndoSelectionAttr::GetDataArray()
493 //----------------------------------------------------------------------------
495 void ScUndoSelectionAttr::DoChange( const BOOL bUndo
)
497 ScDocument
* pDoc
= pDocShell
->GetDocument();
498 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
501 pViewShell
->SetMarkData( aMarkData
);
503 ScRange
aEffRange( aRange
);
504 if ( pDoc
->HasAttrib( aEffRange
, HASATTR_MERGED
) ) // zusammengefasste Zellen?
505 pDoc
->ExtendMerge( aEffRange
);
507 USHORT nExtFlags
= 0;
508 pDocShell
->UpdatePaintExt( nExtFlags
, aEffRange
);
510 ChangeEditData(bUndo
);
512 if (bUndo
) // nur bei Undo
514 ScRange aCopyRange
= aRange
;
515 SCTAB nTabCount
= pDoc
->GetTableCount();
516 aCopyRange
.aStart
.SetTab(0);
517 aCopyRange
.aEnd
.SetTab(nTabCount
-1);
518 pUndoDoc
->CopyToDocument( aCopyRange
, IDF_ATTRIB
, bMulti
, pDoc
, &aMarkData
);
522 aMarkData
.MarkToMulti();
523 pDoc
->ApplySelectionPattern( *pApplyPattern
, aMarkData
);
524 aMarkData
.MarkToSimple();
527 pDoc
->ApplySelectionFrame( aMarkData
, pLineOuter
, pLineInner
);
530 if ( !( (pViewShell
) && pViewShell
->AdjustBlockHeight() ) )
531 /*A*/ pDocShell
->PostPaint( aEffRange
, PAINT_GRID
| PAINT_EXTRAS
, nExtFlags
);
536 void ScUndoSelectionAttr::ChangeEditData( const bool bUndo
)
538 ScDocument
* pDoc
= pDocShell
->GetDocument();
539 for (const ScEditDataArray::Item
* pItem
= aDataArray
.First(); pItem
; pItem
= aDataArray
.Next())
542 pDoc
->GetCell(pItem
->GetCol(), pItem
->GetRow(), pItem
->GetTab(), pCell
);
543 if (!pCell
|| pCell
->GetCellType() != CELLTYPE_EDIT
)
546 ScEditCell
* pEditCell
= static_cast<ScEditCell
*>(pCell
);
548 pEditCell
->SetData(pItem
->GetOldData(), NULL
);
550 pEditCell
->SetData(pItem
->GetNewData(), NULL
);
555 //----------------------------------------------------------------------------
557 void __EXPORT
ScUndoSelectionAttr::Undo()
565 //----------------------------------------------------------------------------
567 void __EXPORT
ScUndoSelectionAttr::Redo()
575 //----------------------------------------------------------------------------
577 void __EXPORT
ScUndoSelectionAttr::Repeat(SfxRepeatTarget
& rTarget
)
579 if (rTarget
.ISA(ScTabViewTarget
))
581 ScTabViewShell
& rViewShell
= *((ScTabViewTarget
&)rTarget
).GetViewShell();
583 rViewShell
.ApplyPatternLines( *pApplyPattern
, pLineOuter
, pLineInner
, TRUE
);
585 rViewShell
.ApplySelectionPattern( *pApplyPattern
, TRUE
);
590 //----------------------------------------------------------------------------
592 BOOL __EXPORT
ScUndoSelectionAttr::CanRepeat(SfxRepeatTarget
& rTarget
) const
594 return (rTarget
.ISA(ScTabViewTarget
));
598 //============================================================================
599 // class ScUndoAutoFill
601 // Auto-Fill (nur einfache Bloecke)
603 //----------------------------------------------------------------------------
605 ScUndoAutoFill::ScUndoAutoFill( ScDocShell
* pNewDocShell
,
606 const ScRange
& rRange
, const ScRange
& rSourceArea
,
607 ScDocument
* pNewUndoDoc
, const ScMarkData
& rMark
,
608 FillDir eNewFillDir
, FillCmd eNewFillCmd
, FillDateCmd eNewFillDateCmd
,
609 double fNewStartValue
, double fNewStepValue
, double fNewMaxValue
,
612 : ScBlockUndo( pNewDocShell
, rRange
, SC_UNDO_AUTOHEIGHT
),
614 aSource ( rSourceArea
),
616 pUndoDoc ( pNewUndoDoc
),
617 eFillDir ( eNewFillDir
),
618 eFillCmd ( eNewFillCmd
),
619 eFillDateCmd ( eNewFillDateCmd
),
620 fStartValue ( fNewStartValue
),
621 fStepValue ( fNewStepValue
),
622 fMaxValue ( fNewMaxValue
),
623 nMaxSharedIndex ( nMaxShIndex
)
629 //----------------------------------------------------------------------------
631 __EXPORT
ScUndoAutoFill::~ScUndoAutoFill()
633 pDocShell
->GetDocument()->EraseNonUsedSharedNames(nMaxSharedIndex
);
638 //----------------------------------------------------------------------------
640 String __EXPORT
ScUndoAutoFill::GetComment() const
642 return ScGlobal::GetRscString( STR_UNDO_AUTOFILL
); //"Ausfuellen"
646 void ScUndoAutoFill::SetChangeTrack()
648 ScChangeTrack
* pChangeTrack
= pDocShell
->GetDocument()->GetChangeTrack();
650 pChangeTrack
->AppendContentRange( aBlockRange
, pUndoDoc
,
651 nStartChangeAction
, nEndChangeAction
);
653 nStartChangeAction
= nEndChangeAction
= 0;
657 //----------------------------------------------------------------------------
659 void __EXPORT
ScUndoAutoFill::Undo()
663 ScDocument
* pDoc
= pDocShell
->GetDocument();
665 SCTAB nTabCount
= pDoc
->GetTableCount();
666 for (SCTAB nTab
=0; nTab
<nTabCount
; nTab
++)
668 if (aMarkData
.GetTableSelect(nTab
))
670 ScRange aWorkRange
= aBlockRange
;
671 aWorkRange
.aStart
.SetTab(nTab
);
672 aWorkRange
.aEnd
.SetTab(nTab
);
674 USHORT nExtFlags
= 0;
675 pDocShell
->UpdatePaintExt( nExtFlags
, aWorkRange
);
676 pDoc
->DeleteAreaTab( aWorkRange
, IDF_AUTOFILL
);
677 pUndoDoc
->CopyToDocument( aWorkRange
, IDF_AUTOFILL
, FALSE
, pDoc
);
679 pDoc
->ExtendMerge( aWorkRange
, TRUE
);
680 pDocShell
->PostPaint( aWorkRange
, PAINT_GRID
, nExtFlags
);
683 pDocShell
->PostDataChanged();
684 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
686 pViewShell
->CellContentChanged();
688 // Shared-Names loeschen
689 // Falls Undo ins Dokument gespeichert
690 // => automatisches Loeschen am Ende
693 String aName
= String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("___SC_"));
694 aName
+= String::CreateFromInt32(nMaxSharedIndex
);
696 ScRangeName
* pRangeName
= pDoc
->GetRangeName();
697 BOOL bHasFound
= FALSE
;
698 for (USHORT i
= 0; i
< pRangeName
->GetCount(); i
++)
700 ScRangeData
* pRangeData
= (*pRangeName
)[i
];
704 pRangeData
->GetName(aRName
);
705 if (aRName
.Search(aName
) != STRING_NOTFOUND
)
707 pRangeName
->AtFree(i
);
713 pRangeName
->SetSharedMaxIndex(pRangeName
->GetSharedMaxIndex()-1);
715 ScChangeTrack
* pChangeTrack
= pDoc
->GetChangeTrack();
717 pChangeTrack
->Undo( nStartChangeAction
, nEndChangeAction
);
723 //----------------------------------------------------------------------------
725 void __EXPORT
ScUndoAutoFill::Redo()
729 //! Tabellen selektieren
735 nCount
= aBlockRange
.aEnd
.Row() - aSource
.aEnd
.Row();
738 nCount
= aBlockRange
.aEnd
.Col() - aSource
.aEnd
.Col();
741 nCount
= aSource
.aStart
.Row() - aBlockRange
.aStart
.Row();
744 nCount
= aSource
.aStart
.Col() - aBlockRange
.aStart
.Col();
748 ScDocument
* pDoc
= pDocShell
->GetDocument();
749 if ( fStartValue
!= MAXDOUBLE
)
751 SCCOL nValX
= (eFillDir
== FILL_TO_LEFT
) ? aSource
.aEnd
.Col() : aSource
.aStart
.Col();
752 SCROW nValY
= (eFillDir
== FILL_TO_TOP
) ? aSource
.aEnd
.Row() : aSource
.aStart
.Row();
753 SCTAB nTab
= aSource
.aStart
.Tab();
754 pDoc
->SetValue( nValX
, nValY
, nTab
, fStartValue
);
756 pDoc
->Fill( aSource
.aStart
.Col(), aSource
.aStart
.Row(),
757 aSource
.aEnd
.Col(), aSource
.aEnd
.Row(),
759 eFillDir
, eFillCmd
, eFillDateCmd
,
760 fStepValue
, fMaxValue
);
764 pDocShell
->PostPaint( aBlockRange
, PAINT_GRID
);
765 pDocShell
->PostDataChanged();
766 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
768 pViewShell
->CellContentChanged();
774 //----------------------------------------------------------------------------
776 void __EXPORT
ScUndoAutoFill::Repeat(SfxRepeatTarget
& rTarget
)
778 if (rTarget
.ISA(ScTabViewTarget
))
780 ScTabViewShell
& rViewShell
= *((ScTabViewTarget
&)rTarget
).GetViewShell();
781 if (eFillCmd
==FILL_SIMPLE
)
782 rViewShell
.FillSimple( eFillDir
, TRUE
);
784 rViewShell
.FillSeries( eFillDir
, eFillCmd
, eFillDateCmd
,
785 fStartValue
, fStepValue
, fMaxValue
, TRUE
);
790 //----------------------------------------------------------------------------
792 BOOL __EXPORT
ScUndoAutoFill::CanRepeat(SfxRepeatTarget
& rTarget
) const
794 return (rTarget
.ISA(ScTabViewTarget
));
798 //============================================================================
801 // Zellen zusammenfassen / Zusammenfassung aufheben
803 //----------------------------------------------------------------------------
805 ScUndoMerge::ScUndoMerge( ScDocShell
* pNewDocShell
, const ScCellMergeOption
& rOption
,
806 bool bMergeContents
, ScDocument
* pUndoDoc
, SdrUndoAction
* pDrawUndo
)
808 : ScSimpleUndo( pNewDocShell
),
811 mbMergeContents( bMergeContents
),
812 mpUndoDoc( pUndoDoc
),
813 mpDrawUndo( pDrawUndo
)
818 //----------------------------------------------------------------------------
820 ScUndoMerge::~ScUndoMerge()
823 DeleteSdrUndoAction( mpDrawUndo
);
827 //----------------------------------------------------------------------------
829 String
ScUndoMerge::GetComment() const
831 return ScGlobal::GetRscString( STR_UNDO_MERGE
);
835 //----------------------------------------------------------------------------
837 void ScUndoMerge::DoChange( bool bUndo
) const
841 if (maOption
.maTabs
.empty())
845 ScDocument
* pDoc
= pDocShell
->GetDocument();
846 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
848 ScRange aCurRange
= maOption
.getSingleRange(pDocShell
->GetCurTab());
849 ScUndoUtil::MarkSimpleBlock(pDocShell
, aCurRange
);
851 for (set
<SCTAB
>::const_iterator itr
= maOption
.maTabs
.begin(), itrEnd
= maOption
.maTabs
.end();
852 itr
!= itrEnd
; ++itr
)
855 ScRange aRange
= maOption
.getSingleRange(nTab
);
858 // remove merge (contents are copied back below from undo document)
859 pDoc
->RemoveMerge( aRange
.aStart
.Col(), aRange
.aStart
.Row(), aRange
.aStart
.Tab() );
862 // repeat merge, but do not remove note captions (will be done by drawing redo below)
863 pDoc
->DoMerge( aRange
.aStart
.Tab(),
864 aRange
.aStart
.Col(), aRange
.aStart
.Row(),
865 aRange
.aEnd
.Col(), aRange
.aEnd
.Row(), false );
867 if (maOption
.mbCenter
)
869 pDoc
->ApplyAttr( aRange
.aStart
.Col(), aRange
.aStart
.Row(),
871 SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER
, ATTR_HOR_JUSTIFY
) );
872 pDoc
->ApplyAttr( aRange
.aStart
.Col(), aRange
.aStart
.Row(),
874 SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER
, ATTR_VER_JUSTIFY
) );
878 // undo -> copy back deleted contents
879 if (bUndo
&& mpUndoDoc
)
881 pDoc
->DeleteAreaTab( aRange
, IDF_CONTENTS
|IDF_NOCAPTIONS
);
882 mpUndoDoc
->CopyToDocument( aRange
, IDF_ALL
|IDF_NOCAPTIONS
, FALSE
, pDoc
);
885 // redo -> merge contents again
886 else if (!bUndo
&& mbMergeContents
)
888 pDoc
->DoMergeContents( aRange
.aStart
.Tab(),
889 aRange
.aStart
.Col(), aRange
.aStart
.Row(),
890 aRange
.aEnd
.Col(), aRange
.aEnd
.Row() );
894 DoSdrUndoAction( mpDrawUndo
, pDoc
);
896 RedoSdrUndoAction( mpDrawUndo
);
898 bool bDidPaint
= false;
901 pViewShell
->SetTabNo(nTab
);
902 bDidPaint
= pViewShell
->AdjustRowHeight(maOption
.mnStartRow
, maOption
.mnEndRow
);
906 ScUndoUtil::PaintMore(pDocShell
, aRange
);
909 ShowTable(aCurRange
);
913 //----------------------------------------------------------------------------
915 void ScUndoMerge::Undo()
923 //----------------------------------------------------------------------------
925 void ScUndoMerge::Redo()
933 //----------------------------------------------------------------------------
935 void ScUndoMerge::Repeat(SfxRepeatTarget
& rTarget
)
937 if (rTarget
.ISA(ScTabViewTarget
))
939 ScTabViewShell
& rViewShell
= *((ScTabViewTarget
&)rTarget
).GetViewShell();
941 rViewShell
.MergeCells( FALSE
, bCont
, TRUE
);
946 //----------------------------------------------------------------------------
948 BOOL
ScUndoMerge::CanRepeat(SfxRepeatTarget
& rTarget
) const
950 return (rTarget
.ISA(ScTabViewTarget
));
954 //============================================================================
955 // class ScUndoAutoFormat
957 // Auto-Format (nur einfache Bloecke)
959 //----------------------------------------------------------------------------
961 ScUndoAutoFormat::ScUndoAutoFormat( ScDocShell
* pNewDocShell
,
962 const ScRange
& rRange
, ScDocument
* pNewUndoDoc
,
963 const ScMarkData
& rMark
, BOOL bNewSize
, USHORT nNewFormatNo
)
965 : ScBlockUndo( pNewDocShell
, rRange
, bNewSize
? SC_UNDO_MANUALHEIGHT
: SC_UNDO_AUTOHEIGHT
),
967 pUndoDoc ( pNewUndoDoc
),
970 nFormatNo ( nNewFormatNo
)
975 //----------------------------------------------------------------------------
977 __EXPORT
ScUndoAutoFormat::~ScUndoAutoFormat()
983 //----------------------------------------------------------------------------
985 String __EXPORT
ScUndoAutoFormat::GetComment() const
987 return ScGlobal::GetRscString( STR_UNDO_AUTOFORMAT
); //"Auto-Format"
991 //----------------------------------------------------------------------------
993 void __EXPORT
ScUndoAutoFormat::Undo()
997 ScDocument
* pDoc
= pDocShell
->GetDocument();
1000 // pDoc->DeleteAreaTab( aBlockRange, IDF_ATTRIB );
1001 // pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, FALSE, pDoc );
1003 SCTAB nTabCount
= pDoc
->GetTableCount();
1004 pDoc
->DeleteArea( aBlockRange
.aStart
.Col(), aBlockRange
.aStart
.Row(),
1005 aBlockRange
.aEnd
.Col(), aBlockRange
.aEnd
.Row(),
1006 aMarkData
, IDF_ATTRIB
);
1007 ScRange aCopyRange
= aBlockRange
;
1008 aCopyRange
.aStart
.SetTab(0);
1009 aCopyRange
.aEnd
.SetTab(nTabCount
-1);
1010 pUndoDoc
->CopyToDocument( aCopyRange
, IDF_ATTRIB
, FALSE
, pDoc
, &aMarkData
);
1012 // Zellhoehen und -breiten (IDF_NONE)
1015 SCCOL nStartX
= aBlockRange
.aStart
.Col();
1016 SCROW nStartY
= aBlockRange
.aStart
.Row();
1017 SCTAB nStartZ
= aBlockRange
.aStart
.Tab();
1018 SCCOL nEndX
= aBlockRange
.aEnd
.Col();
1019 SCROW nEndY
= aBlockRange
.aEnd
.Row();
1020 SCTAB nEndZ
= aBlockRange
.aEnd
.Tab();
1022 pUndoDoc
->CopyToDocument( nStartX
, 0, 0, nEndX
, MAXROW
, nTabCount
-1,
1023 IDF_NONE
, FALSE
, pDoc
, &aMarkData
);
1024 pUndoDoc
->CopyToDocument( 0, nStartY
, 0, MAXCOL
, nEndY
, nTabCount
-1,
1025 IDF_NONE
, FALSE
, pDoc
, &aMarkData
);
1026 pDocShell
->PostPaint( 0, 0, nStartZ
, MAXCOL
, MAXROW
, nEndZ
,
1027 PAINT_GRID
| PAINT_LEFT
| PAINT_TOP
, SC_PF_LINES
);
1030 pDocShell
->PostPaint( aBlockRange
, PAINT_GRID
, SC_PF_LINES
);
1036 //----------------------------------------------------------------------------
1038 void __EXPORT
ScUndoAutoFormat::Redo()
1042 ScDocument
* pDoc
= pDocShell
->GetDocument();
1044 SCCOL nStartX
= aBlockRange
.aStart
.Col();
1045 SCROW nStartY
= aBlockRange
.aStart
.Row();
1046 SCTAB nStartZ
= aBlockRange
.aStart
.Tab();
1047 SCCOL nEndX
= aBlockRange
.aEnd
.Col();
1048 SCROW nEndY
= aBlockRange
.aEnd
.Row();
1049 SCTAB nEndZ
= aBlockRange
.aEnd
.Tab();
1051 pDoc
->AutoFormat( nStartX
, nStartY
, nEndX
, nEndY
, nFormatNo
, aMarkData
);
1055 VirtualDevice aVirtDev
;
1056 Fraction
aZoomX(1,1);
1057 Fraction aZoomY
= aZoomX
;
1059 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
1062 ScViewData
* pData
= pViewShell
->GetViewData();
1063 nPPTX
= pData
->GetPPTX();
1064 nPPTY
= pData
->GetPPTY();
1065 aZoomX
= pData
->GetZoomX();
1066 aZoomY
= pData
->GetZoomY();
1070 // Zoom auf 100 lassen
1071 nPPTX
= ScGlobal::nScreenPPTX
;
1072 nPPTY
= ScGlobal::nScreenPPTY
;
1075 BOOL bFormula
= FALSE
; //! merken
1077 for (SCTAB nTab
=nStartZ
; nTab
<=nEndZ
; nTab
++)
1079 ScMarkData aDestMark
;
1080 aDestMark
.SelectOneTable( nTab
);
1081 aDestMark
.SetMarkArea( ScRange( nStartX
, nStartY
, nTab
, nEndX
, nEndY
, nTab
) );
1082 aDestMark
.MarkToMulti();
1084 // wie SC_SIZE_VISOPT
1085 SCROW nLastRow
= -1;
1086 for (SCROW nRow
=nStartY
; nRow
<=nEndY
; nRow
++)
1088 BYTE nOld
= pDoc
->GetRowFlags(nRow
,nTab
);
1089 bool bHidden
= pDoc
->RowHidden(nRow
, nTab
, nLastRow
);
1090 if ( !bHidden
&& ( nOld
& CR_MANUALSIZE
) )
1091 pDoc
->SetRowFlags( nRow
, nTab
, nOld
& ~CR_MANUALSIZE
);
1093 pDoc
->SetOptimalHeight( nStartY
, nEndY
, nTab
, 0, &aVirtDev
,
1094 nPPTX
, nPPTY
, aZoomX
, aZoomY
, FALSE
);
1096 SCCOL nLastCol
= -1;
1097 for (SCCOL nCol
=nStartX
; nCol
<=nEndX
; nCol
++)
1098 if (!pDoc
->ColHidden(nCol
, nTab
, nLastCol
))
1100 USHORT nThisSize
= STD_EXTRA_WIDTH
+ pDoc
->GetOptimalColWidth( nCol
, nTab
,
1101 &aVirtDev
, nPPTX
, nPPTY
, aZoomX
, aZoomY
, bFormula
,
1103 pDoc
->SetColWidth( nCol
, nTab
, nThisSize
);
1104 pDoc
->ShowCol( nCol
, nTab
, TRUE
);
1108 pDocShell
->PostPaint( 0, 0, nStartZ
,
1109 MAXCOL
, MAXROW
, nEndZ
,
1110 PAINT_GRID
| PAINT_LEFT
| PAINT_TOP
, SC_PF_LINES
);
1113 pDocShell
->PostPaint( aBlockRange
, PAINT_GRID
, SC_PF_LINES
);
1119 //----------------------------------------------------------------------------
1121 void __EXPORT
ScUndoAutoFormat::Repeat(SfxRepeatTarget
& rTarget
)
1123 if (rTarget
.ISA(ScTabViewTarget
))
1124 ((ScTabViewTarget
&)rTarget
).GetViewShell()->AutoFormat( nFormatNo
, TRUE
);
1128 //----------------------------------------------------------------------------
1130 BOOL __EXPORT
ScUndoAutoFormat::CanRepeat(SfxRepeatTarget
& rTarget
) const
1132 return (rTarget
.ISA(ScTabViewTarget
));
1136 //============================================================================
1137 // class ScUndoReplace
1141 //----------------------------------------------------------------------------
1143 ScUndoReplace::ScUndoReplace( ScDocShell
* pNewDocShell
, const ScMarkData
& rMark
,
1144 SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
,
1145 const String
& rNewUndoStr
, ScDocument
* pNewUndoDoc
,
1146 const SvxSearchItem
* pItem
)
1148 : ScSimpleUndo( pNewDocShell
),
1150 aCursorPos ( nCurX
, nCurY
, nCurZ
),
1151 aMarkData ( rMark
),
1152 aUndoStr ( rNewUndoStr
),
1153 pUndoDoc ( pNewUndoDoc
)
1155 pSearchItem
= new SvxSearchItem( *pItem
);
1160 //----------------------------------------------------------------------------
1162 __EXPORT
ScUndoReplace::~ScUndoReplace()
1169 //----------------------------------------------------------------------------
1171 void ScUndoReplace::SetChangeTrack()
1173 ScDocument
* pDoc
= pDocShell
->GetDocument();
1174 ScChangeTrack
* pChangeTrack
= pDoc
->GetChangeTrack();
1178 { //! im UndoDoc stehen nur die geaenderten Zellen,
1179 // deswegen per Iterator moeglich
1180 pChangeTrack
->AppendContentsIfInRefDoc( pUndoDoc
,
1181 nStartChangeAction
, nEndChangeAction
);
1185 nStartChangeAction
= pChangeTrack
->GetActionMax() + 1;
1186 ScChangeActionContent
* pContent
= new ScChangeActionContent(
1187 ScRange( aCursorPos
) );
1188 pContent
->SetOldValue( aUndoStr
, pDoc
);
1189 pContent
->SetNewValue( pDoc
->GetCell( aCursorPos
), pDoc
);
1190 pChangeTrack
->Append( pContent
);
1191 nEndChangeAction
= pChangeTrack
->GetActionMax();
1195 nStartChangeAction
= nEndChangeAction
= 0;
1198 //----------------------------------------------------------------------------
1200 String __EXPORT
ScUndoReplace::GetComment() const
1202 return ScGlobal::GetRscString( STR_UNDO_REPLACE
); // "Ersetzen"
1206 //----------------------------------------------------------------------------
1208 void __EXPORT
ScUndoReplace::Undo()
1212 ScDocument
* pDoc
= pDocShell
->GetDocument();
1213 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
1215 ShowTable( aCursorPos
.Tab() );
1217 if (pUndoDoc
) // nur bei ReplaceAll !!
1219 DBG_ASSERT(pSearchItem
->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL
,
1220 "ScUndoReplace:: Falscher Modus");
1223 pViewShell
->SetMarkData( aMarkData
);
1225 //! markierte Tabellen
1226 //! Bereich merken ?
1228 // Undo-Dokument hat keine Zeilen-/Spalten-Infos, also mit bColRowFlags = FALSE
1229 // kopieren, um Outline-Gruppen nicht kaputtzumachen.
1231 USHORT nUndoFlags
= (pSearchItem
->GetPattern()) ? IDF_ATTRIB
: IDF_CONTENTS
;
1232 pUndoDoc
->CopyToDocument( 0, 0, 0,
1233 MAXCOL
, MAXROW
, MAXTAB
,
1234 nUndoFlags
, FALSE
, pDoc
, NULL
, FALSE
); // ohne Row-Flags
1235 pDocShell
->PostPaintGridAll();
1237 else if (pSearchItem
->GetPattern() &&
1238 pSearchItem
->GetCommand() == SVX_SEARCHCMD_REPLACE
)
1240 String aTempStr
= pSearchItem
->GetSearchString(); // vertauschen
1241 pSearchItem
->SetSearchString(pSearchItem
->GetReplaceString());
1242 pSearchItem
->SetReplaceString(aTempStr
);
1243 pDoc
->ReplaceStyle( *pSearchItem
,
1244 aCursorPos
.Col(), aCursorPos
.Row(), aCursorPos
.Tab(),
1246 pSearchItem
->SetReplaceString(pSearchItem
->GetSearchString());
1247 pSearchItem
->SetSearchString(aTempStr
);
1249 pViewShell
->MoveCursorAbs( aCursorPos
.Col(), aCursorPos
.Row(),
1250 SC_FOLLOW_JUMP
, FALSE
, FALSE
);
1251 pDocShell
->PostPaintGridAll();
1253 else if (pSearchItem
->GetCellType() == SVX_SEARCHIN_NOTE
)
1255 ScPostIt
* pNote
= pDoc
->GetNote( aCursorPos
);
1256 DBG_ASSERT( pNote
, "ScUndoReplace::Undo - cell does not contain a note" );
1258 pNote
->SetText( aCursorPos
, aUndoStr
);
1260 pViewShell
->MoveCursorAbs( aCursorPos
.Col(), aCursorPos
.Row(),
1261 SC_FOLLOW_JUMP
, FALSE
, FALSE
);
1265 // #78889# aUndoStr may contain line breaks
1266 if ( aUndoStr
.Search('\n') != STRING_NOTFOUND
)
1267 pDoc
->PutCell( aCursorPos
, new ScEditCell( aUndoStr
, pDoc
) );
1269 pDoc
->SetString( aCursorPos
.Col(), aCursorPos
.Row(), aCursorPos
.Tab(), aUndoStr
);
1271 pViewShell
->MoveCursorAbs( aCursorPos
.Col(), aCursorPos
.Row(),
1272 SC_FOLLOW_JUMP
, FALSE
, FALSE
);
1273 pDocShell
->PostPaintGridAll();
1276 ScChangeTrack
* pChangeTrack
= pDoc
->GetChangeTrack();
1278 pChangeTrack
->Undo( nStartChangeAction
, nEndChangeAction
);
1284 //----------------------------------------------------------------------------
1286 void __EXPORT
ScUndoReplace::Redo()
1290 ScDocument
* pDoc
= pDocShell
->GetDocument();
1291 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
1294 pViewShell
->MoveCursorAbs( aCursorPos
.Col(), aCursorPos
.Row(),
1295 SC_FOLLOW_JUMP
, FALSE
, FALSE
);
1300 pViewShell
->SetMarkData( aMarkData
);
1302 pViewShell
->SearchAndReplace( pSearchItem
, FALSE
, TRUE
);
1305 else if (pSearchItem
->GetPattern() &&
1306 pSearchItem
->GetCommand() == SVX_SEARCHCMD_REPLACE
)
1308 pDoc
->ReplaceStyle( *pSearchItem
,
1309 aCursorPos
.Col(), aCursorPos
.Row(), aCursorPos
.Tab(),
1311 pDocShell
->PostPaintGridAll();
1315 pViewShell
->SearchAndReplace( pSearchItem
, FALSE
, TRUE
);
1323 //----------------------------------------------------------------------------
1325 void __EXPORT
ScUndoReplace::Repeat(SfxRepeatTarget
& rTarget
)
1327 if (rTarget
.ISA(ScTabViewTarget
))
1328 ((ScTabViewTarget
&)rTarget
).GetViewShell()->SearchAndReplace( pSearchItem
, TRUE
, FALSE
);
1332 //----------------------------------------------------------------------------
1334 BOOL __EXPORT
ScUndoReplace::CanRepeat(SfxRepeatTarget
& rTarget
) const
1336 return (rTarget
.ISA(ScTabViewTarget
));
1340 //============================================================================
1341 // class ScUndoTabOp
1343 // Mehrfachoperation (nur einfache Bloecke)
1345 //----------------------------------------------------------------------------
1347 ScUndoTabOp::ScUndoTabOp( ScDocShell
* pNewDocShell
,
1348 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
1349 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
, ScDocument
* pNewUndoDoc
,
1350 const ScRefAddress
& rFormulaCell
,
1351 const ScRefAddress
& rFormulaEnd
,
1352 const ScRefAddress
& rRowCell
,
1353 const ScRefAddress
& rColCell
,
1356 : ScSimpleUndo( pNewDocShell
),
1358 aRange ( nStartX
, nStartY
, nStartZ
, nEndX
, nEndY
, nEndZ
),
1359 pUndoDoc ( pNewUndoDoc
),
1360 theFormulaCell ( rFormulaCell
),
1361 theFormulaEnd ( rFormulaEnd
),
1362 theRowCell ( rRowCell
),
1363 theColCell ( rColCell
),
1369 //----------------------------------------------------------------------------
1371 __EXPORT
ScUndoTabOp::~ScUndoTabOp()
1377 //----------------------------------------------------------------------------
1379 String __EXPORT
ScUndoTabOp::GetComment() const
1381 return ScGlobal::GetRscString( STR_UNDO_TABOP
); // "Mehrfachoperation"
1385 //----------------------------------------------------------------------------
1387 void __EXPORT
ScUndoTabOp::Undo()
1391 ScUndoUtil::MarkSimpleBlock( pDocShell
, aRange
);
1393 USHORT nExtFlags
= 0;
1394 pDocShell
->UpdatePaintExt( nExtFlags
, aRange
);
1396 ScDocument
* pDoc
= pDocShell
->GetDocument();
1397 pDoc
->DeleteAreaTab( aRange
,IDF_ALL
& ~IDF_NOTE
);
1398 pUndoDoc
->CopyToDocument( aRange
, IDF_ALL
& ~IDF_NOTE
, FALSE
, pDoc
);
1399 pDocShell
->PostPaint( aRange
, PAINT_GRID
, nExtFlags
);
1400 pDocShell
->PostDataChanged();
1401 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
1403 pViewShell
->CellContentChanged();
1409 //----------------------------------------------------------------------------
1411 void __EXPORT
ScUndoTabOp::Redo()
1415 ScUndoUtil::MarkSimpleBlock( pDocShell
, aRange
);
1417 ScTabOpParam
aParam( theFormulaCell
, theFormulaEnd
,
1418 theRowCell
, theColCell
,
1421 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
1423 pViewShell
->TabOp( aParam
, FALSE
);
1429 //----------------------------------------------------------------------------
1431 void __EXPORT
ScUndoTabOp::Repeat(SfxRepeatTarget
& /* rTarget */)
1436 //----------------------------------------------------------------------------
1438 BOOL __EXPORT
ScUndoTabOp::CanRepeat(SfxRepeatTarget
& /* rTarget */) const
1444 //============================================================================
1445 // class ScUndoConversion
1449 //----------------------------------------------------------------------------
1451 ScUndoConversion::ScUndoConversion(
1452 ScDocShell
* pNewDocShell
, const ScMarkData
& rMark
,
1453 SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
, ScDocument
* pNewUndoDoc
,
1454 SCCOL nNewX
, SCROW nNewY
, SCTAB nNewZ
, ScDocument
* pNewRedoDoc
,
1455 const ScConversionParam
& rConvParam
) :
1456 ScSimpleUndo( pNewDocShell
),
1458 aCursorPos( nCurX
, nCurY
, nCurZ
),
1459 pUndoDoc( pNewUndoDoc
),
1460 aNewCursorPos( nNewX
, nNewY
, nNewZ
),
1461 pRedoDoc( pNewRedoDoc
),
1462 maConvParam( rConvParam
)
1468 //----------------------------------------------------------------------------
1470 __EXPORT
ScUndoConversion::~ScUndoConversion()
1477 //----------------------------------------------------------------------------
1479 void ScUndoConversion::SetChangeTrack()
1481 ScDocument
* pDoc
= pDocShell
->GetDocument();
1482 ScChangeTrack
* pChangeTrack
= pDoc
->GetChangeTrack();
1486 pChangeTrack
->AppendContentsIfInRefDoc( pUndoDoc
,
1487 nStartChangeAction
, nEndChangeAction
);
1490 DBG_ERROR( "ScUndoConversion::SetChangeTrack: kein UndoDoc" );
1491 nStartChangeAction
= nEndChangeAction
= 0;
1495 nStartChangeAction
= nEndChangeAction
= 0;
1498 //----------------------------------------------------------------------------
1500 String
ScUndoConversion::GetComment() const
1503 switch( maConvParam
.GetType() )
1505 case SC_CONVERSION_SPELLCHECK
: aText
= ScGlobal::GetRscString( STR_UNDO_SPELLING
); break;
1506 case SC_CONVERSION_HANGULHANJA
: aText
= ScGlobal::GetRscString( STR_UNDO_HANGULHANJA
); break;
1507 case SC_CONVERSION_CHINESE_TRANSL
: aText
= ScGlobal::GetRscString( STR_UNDO_CHINESE_TRANSLATION
); break;
1508 default: DBG_ERRORFILE( "ScUndoConversion::GetComment - unknown conversion type" );
1514 //----------------------------------------------------------------------------
1516 void ScUndoConversion::DoChange( ScDocument
* pRefDoc
, const ScAddress
& rCursorPos
)
1520 ScDocument
* pDoc
= pDocShell
->GetDocument();
1521 ShowTable( rCursorPos
.Tab() );
1523 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
1525 pViewShell
->SetMarkData( aMarkData
);
1527 SCTAB nTabCount
= pDoc
->GetTableCount();
1528 // Undo/Redo-doc has only selected tables
1530 BOOL bMulti
= aMarkData
.IsMultiMarked();
1531 pRefDoc
->CopyToDocument( 0, 0, 0,
1532 MAXCOL
, MAXROW
, nTabCount
-1,
1533 IDF_CONTENTS
, bMulti
, pDoc
, &aMarkData
);
1534 pDocShell
->PostPaintGridAll();
1538 DBG_ERROR("Kein Un-/RedoDoc bei Un-/RedoSpelling");
1543 //----------------------------------------------------------------------------
1545 void ScUndoConversion::Undo()
1548 DoChange( pUndoDoc
, aCursorPos
);
1549 ScChangeTrack
* pChangeTrack
= pDocShell
->GetDocument()->GetChangeTrack();
1551 pChangeTrack
->Undo( nStartChangeAction
, nEndChangeAction
);
1556 //----------------------------------------------------------------------------
1558 void ScUndoConversion::Redo()
1561 DoChange( pRedoDoc
, aNewCursorPos
);
1567 //----------------------------------------------------------------------------
1569 void ScUndoConversion::Repeat( SfxRepeatTarget
& rTarget
)
1571 if( rTarget
.ISA( ScTabViewTarget
) )
1572 ((ScTabViewTarget
&)rTarget
).GetViewShell()->DoSheetConversion( maConvParam
, TRUE
);
1576 //----------------------------------------------------------------------------
1578 BOOL
ScUndoConversion::CanRepeat(SfxRepeatTarget
& rTarget
) const
1580 return rTarget
.ISA( ScTabViewTarget
);
1584 //============================================================================
1585 // class ScUndoRefConversion
1587 // cell reference conversion
1589 //----------------------------------------------------------------------------
1591 ScUndoRefConversion::ScUndoRefConversion( ScDocShell
* pNewDocShell
,
1592 const ScRange
& aMarkRange
, const ScMarkData
& rMark
,
1593 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
, BOOL bNewMulti
, USHORT nNewFlag
) :
1594 ScSimpleUndo( pNewDocShell
),
1595 aMarkData ( rMark
),
1596 pUndoDoc ( pNewUndoDoc
),
1597 pRedoDoc ( pNewRedoDoc
),
1598 aRange ( aMarkRange
),
1599 bMulti ( bNewMulti
),
1605 __EXPORT
ScUndoRefConversion::~ScUndoRefConversion()
1611 String __EXPORT
ScUndoRefConversion::GetComment() const
1613 return ScGlobal::GetRscString( STR_UNDO_ENTERDATA
); // "Eingabe"
1616 void ScUndoRefConversion::SetChangeTrack()
1618 ScChangeTrack
* pChangeTrack
= pDocShell
->GetDocument()->GetChangeTrack();
1619 if ( pChangeTrack
&& (nFlags
& IDF_FORMULA
) )
1620 pChangeTrack
->AppendContentsIfInRefDoc( pUndoDoc
,
1621 nStartChangeAction
, nEndChangeAction
);
1623 nStartChangeAction
= nEndChangeAction
= 0;
1626 void ScUndoRefConversion::DoChange( ScDocument
* pRefDoc
)
1628 ScDocument
* pDoc
= pDocShell
->GetDocument();
1632 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
1634 pViewShell
->SetMarkData( aMarkData
);
1636 ScRange aCopyRange
= aRange
;
1637 SCTAB nTabCount
= pDoc
->GetTableCount();
1638 aCopyRange
.aStart
.SetTab(0);
1639 aCopyRange
.aEnd
.SetTab(nTabCount
-1);
1640 pRefDoc
->CopyToDocument( aCopyRange
, nFlags
, bMulti
, pDoc
, &aMarkData
);
1641 pDocShell
->PostPaint( aRange
, PAINT_GRID
);
1642 pDocShell
->PostDataChanged();
1644 pViewShell
->CellContentChanged();
1646 void __EXPORT
ScUndoRefConversion::Undo()
1651 ScChangeTrack
* pChangeTrack
= pDocShell
->GetDocument()->GetChangeTrack();
1653 pChangeTrack
->Undo( nStartChangeAction
, nEndChangeAction
);
1657 void __EXPORT
ScUndoRefConversion::Redo()
1666 void __EXPORT
ScUndoRefConversion::Repeat(SfxRepeatTarget
& rTarget
)
1668 if (rTarget
.ISA(ScTabViewTarget
))
1669 ((ScTabViewTarget
&)rTarget
).GetViewShell()->DoRefConversion();
1672 BOOL __EXPORT
ScUndoRefConversion::CanRepeat(SfxRepeatTarget
& rTarget
) const
1674 return (rTarget
.ISA(ScTabViewTarget
));
1676 //============================================================================
1677 // class ScUndoRefreshLink
1679 // Link aktualisieren / aendern
1681 //----------------------------------------------------------------------------
1683 ScUndoRefreshLink::ScUndoRefreshLink( ScDocShell
* pNewDocShell
,
1684 ScDocument
* pNewUndoDoc
)
1686 : ScSimpleUndo( pNewDocShell
),
1688 pUndoDoc( pNewUndoDoc
),
1694 //----------------------------------------------------------------------------
1696 __EXPORT
ScUndoRefreshLink::~ScUndoRefreshLink()
1703 //----------------------------------------------------------------------------
1705 String __EXPORT
ScUndoRefreshLink::GetComment() const
1707 return ScGlobal::GetRscString( STR_UNDO_UPDATELINK
);
1711 //----------------------------------------------------------------------------
1713 void __EXPORT
ScUndoRefreshLink::Undo()
1717 BOOL bMakeRedo
= !pRedoDoc
;
1719 pRedoDoc
= new ScDocument( SCDOCMODE_UNDO
);
1722 ScDocument
* pDoc
= pDocShell
->GetDocument();
1723 SCTAB nCount
= pDoc
->GetTableCount();
1724 for (SCTAB nTab
=0; nTab
<nCount
; nTab
++)
1725 if (pUndoDoc
->HasTable(nTab
))
1727 ScRange
aRange(0,0,nTab
,MAXCOL
,MAXROW
,nTab
);
1731 pRedoDoc
->InitUndo( pDoc
, nTab
, nTab
, TRUE
, TRUE
);
1733 pRedoDoc
->AddUndoTab( nTab
, nTab
, TRUE
, TRUE
);
1735 pDoc
->CopyToDocument(aRange
, IDF_ALL
, FALSE
, pRedoDoc
);
1736 // pRedoDoc->TransferDrawPage( pDoc, nTab, nTab );
1737 pRedoDoc
->SetLink( nTab
,
1738 pDoc
->GetLinkMode(nTab
),
1739 pDoc
->GetLinkDoc(nTab
),
1740 pDoc
->GetLinkFlt(nTab
),
1741 pDoc
->GetLinkOpt(nTab
),
1742 pDoc
->GetLinkTab(nTab
),
1743 pDoc
->GetLinkRefreshDelay(nTab
) );
1746 pDoc
->DeleteAreaTab( aRange
,IDF_ALL
);
1747 pUndoDoc
->CopyToDocument( aRange
, IDF_ALL
, FALSE
, pDoc
);
1748 // pDoc->TransferDrawPage( pUndoDoc, nTab, nTab );
1749 pDoc
->SetLink( nTab
, pUndoDoc
->GetLinkMode(nTab
), pUndoDoc
->GetLinkDoc(nTab
),
1750 pUndoDoc
->GetLinkFlt(nTab
), pUndoDoc
->GetLinkOpt(nTab
),
1751 pUndoDoc
->GetLinkTab(nTab
),
1752 pUndoDoc
->GetLinkRefreshDelay(nTab
) );
1755 pDocShell
->PostPaintGridAll();
1761 //----------------------------------------------------------------------------
1763 void __EXPORT
ScUndoRefreshLink::Redo()
1765 DBG_ASSERT(pRedoDoc
, "Kein RedoDoc bei ScUndoRefreshLink::Redo");
1769 ScDocument
* pDoc
= pDocShell
->GetDocument();
1770 SCTAB nCount
= pDoc
->GetTableCount();
1771 for (SCTAB nTab
=0; nTab
<nCount
; nTab
++)
1772 if (pRedoDoc
->HasTable(nTab
))
1774 ScRange
aRange(0,0,nTab
,MAXCOL
,MAXROW
,nTab
);
1776 pDoc
->DeleteAreaTab( aRange
, IDF_ALL
);
1777 pRedoDoc
->CopyToDocument( aRange
, IDF_ALL
, FALSE
, pDoc
);
1778 // pDoc->TransferDrawPage( pRedoDoc, nTab, nTab );
1779 pDoc
->SetLink( nTab
,
1780 pRedoDoc
->GetLinkMode(nTab
),
1781 pRedoDoc
->GetLinkDoc(nTab
),
1782 pRedoDoc
->GetLinkFlt(nTab
),
1783 pRedoDoc
->GetLinkOpt(nTab
),
1784 pRedoDoc
->GetLinkTab(nTab
),
1785 pRedoDoc
->GetLinkRefreshDelay(nTab
) );
1788 pDocShell
->PostPaintGridAll();
1794 //----------------------------------------------------------------------------
1796 void __EXPORT
ScUndoRefreshLink::Repeat(SfxRepeatTarget
& /* rTarget */)
1802 //----------------------------------------------------------------------------
1804 BOOL __EXPORT
ScUndoRefreshLink::CanRepeat(SfxRepeatTarget
& /* rTarget */) const
1810 //----------------------------------------------------------------------------
1812 ScAreaLink
* lcl_FindAreaLink( SvxLinkManager
* pLinkManager
, const String
& rDoc
,
1813 const String
& rFlt
, const String
& rOpt
,
1814 const String
& rSrc
, const ScRange
& rDest
)
1816 const ::sfx2::SvBaseLinks
& rLinks
= pLinkManager
->GetLinks();
1817 USHORT nCount
= pLinkManager
->GetLinks().Count();
1818 for (USHORT i
=0; i
<nCount
; i
++)
1820 ::sfx2::SvBaseLink
* pBase
= *rLinks
[i
];
1821 if (pBase
->ISA(ScAreaLink
))
1822 if ( ((ScAreaLink
*)pBase
)->IsEqual( rDoc
, rFlt
, rOpt
, rSrc
, rDest
) )
1823 return (ScAreaLink
*)pBase
;
1826 DBG_ERROR("ScAreaLink nicht gefunden");
1831 //============================================================================
1832 // class ScUndoInsertAreaLink
1834 // Bereichs-Verknuepfung einfuegen
1836 //----------------------------------------------------------------------------
1838 ScUndoInsertAreaLink::ScUndoInsertAreaLink( ScDocShell
* pShell
,
1840 const String
& rFlt
, const String
& rOpt
,
1841 const String
& rArea
, const ScRange
& rDestRange
,
1844 : ScSimpleUndo ( pShell
),
1849 aAreaName ( rArea
),
1850 aRange ( rDestRange
),
1851 nRefreshDelay ( nRefresh
)
1856 //----------------------------------------------------------------------------
1858 __EXPORT
ScUndoInsertAreaLink::~ScUndoInsertAreaLink()
1863 //----------------------------------------------------------------------------
1865 String __EXPORT
ScUndoInsertAreaLink::GetComment() const
1867 return ScGlobal::GetRscString( STR_UNDO_INSERTAREALINK
);
1871 //----------------------------------------------------------------------------
1873 void __EXPORT
ScUndoInsertAreaLink::Undo()
1875 ScDocument
* pDoc
= pDocShell
->GetDocument();
1876 SvxLinkManager
* pLinkManager
= pDoc
->GetLinkManager();
1878 ScAreaLink
* pLink
= lcl_FindAreaLink( pLinkManager
, aDocName
, aFltName
, aOptions
,
1879 aAreaName
, aRange
);
1881 pLinkManager
->Remove( pLink
);
1883 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED
) ); // Navigator
1887 //----------------------------------------------------------------------------
1889 void __EXPORT
ScUndoInsertAreaLink::Redo()
1891 ScDocument
* pDoc
= pDocShell
->GetDocument();
1892 SvxLinkManager
* pLinkManager
= pDoc
->GetLinkManager();
1894 ScAreaLink
* pLink
= new ScAreaLink( pDocShell
, aDocName
, aFltName
, aOptions
,
1895 aAreaName
, aRange
.aStart
, nRefreshDelay
);
1896 pLink
->SetInCreate( TRUE
);
1897 pLink
->SetDestArea( aRange
);
1898 pLinkManager
->InsertFileLink( *pLink
, OBJECT_CLIENT_FILE
, aDocName
, &aFltName
, &aAreaName
);
1900 pLink
->SetInCreate( FALSE
);
1902 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED
) ); // Navigator
1906 //----------------------------------------------------------------------------
1908 void __EXPORT
ScUndoInsertAreaLink::Repeat(SfxRepeatTarget
& /* rTarget */)
1914 //----------------------------------------------------------------------------
1916 BOOL __EXPORT
ScUndoInsertAreaLink::CanRepeat(SfxRepeatTarget
& /* rTarget */) const
1922 //============================================================================
1923 // class ScUndoRemoveAreaLink
1925 // Bereichs-Verknuepfung loeschen
1927 //----------------------------------------------------------------------------
1929 ScUndoRemoveAreaLink::ScUndoRemoveAreaLink( ScDocShell
* pShell
,
1930 const String
& rDoc
, const String
& rFlt
, const String
& rOpt
,
1931 const String
& rArea
, const ScRange
& rDestRange
,
1934 : ScSimpleUndo ( pShell
),
1939 aAreaName ( rArea
),
1940 aRange ( rDestRange
),
1941 nRefreshDelay ( nRefresh
)
1946 //----------------------------------------------------------------------------
1948 __EXPORT
ScUndoRemoveAreaLink::~ScUndoRemoveAreaLink()
1953 //----------------------------------------------------------------------------
1955 String __EXPORT
ScUndoRemoveAreaLink::GetComment() const
1957 return ScGlobal::GetRscString( STR_UNDO_REMOVELINK
); //! eigener Text ??
1961 //----------------------------------------------------------------------------
1963 void __EXPORT
ScUndoRemoveAreaLink::Undo()
1965 ScDocument
* pDoc
= pDocShell
->GetDocument();
1966 SvxLinkManager
* pLinkManager
= pDoc
->GetLinkManager();
1968 ScAreaLink
* pLink
= new ScAreaLink( pDocShell
, aDocName
, aFltName
, aOptions
,
1969 aAreaName
, aRange
.aStart
, nRefreshDelay
);
1970 pLink
->SetInCreate( TRUE
);
1971 pLink
->SetDestArea( aRange
);
1972 pLinkManager
->InsertFileLink( *pLink
, OBJECT_CLIENT_FILE
, aDocName
, &aFltName
, &aAreaName
);
1974 pLink
->SetInCreate( FALSE
);
1976 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED
) ); // Navigator
1980 //----------------------------------------------------------------------------
1982 void __EXPORT
ScUndoRemoveAreaLink::Redo()
1984 ScDocument
* pDoc
= pDocShell
->GetDocument();
1985 SvxLinkManager
* pLinkManager
= pDoc
->GetLinkManager();
1987 ScAreaLink
* pLink
= lcl_FindAreaLink( pLinkManager
, aDocName
, aFltName
, aOptions
,
1988 aAreaName
, aRange
);
1990 pLinkManager
->Remove( pLink
);
1992 SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED
) ); // Navigator
1996 //----------------------------------------------------------------------------
1998 void __EXPORT
ScUndoRemoveAreaLink::Repeat(SfxRepeatTarget
& /* rTarget */)
2004 //----------------------------------------------------------------------------
2006 BOOL __EXPORT
ScUndoRemoveAreaLink::CanRepeat(SfxRepeatTarget
& /* rTarget */) const
2012 //============================================================================
2013 // class ScUndoUpdateAreaLink
2015 // Bereichs-Verknuepfung aktualisieren
2017 //----------------------------------------------------------------------------
2019 ScUndoUpdateAreaLink::ScUndoUpdateAreaLink( ScDocShell
* pShell
,
2020 const String
& rOldD
, const String
& rOldF
, const String
& rOldO
,
2021 const String
& rOldA
, const ScRange
& rOldR
, ULONG nOldRD
,
2022 const String
& rNewD
, const String
& rNewF
, const String
& rNewO
,
2023 const String
& rNewA
, const ScRange
& rNewR
, ULONG nNewRD
,
2024 ScDocument
* pUndo
, ScDocument
* pRedo
, BOOL bDoInsert
)
2026 : ScSimpleUndo( pShell
),
2032 aOldRange ( rOldR
),
2037 aNewRange ( rNewR
),
2040 nOldRefresh ( nOldRD
),
2041 nNewRefresh ( nNewRD
),
2042 bWithInsert ( bDoInsert
)
2044 DBG_ASSERT( aOldRange
.aStart
== aNewRange
.aStart
, "AreaLink verschoben ?" );
2048 //----------------------------------------------------------------------------
2050 __EXPORT
ScUndoUpdateAreaLink::~ScUndoUpdateAreaLink()
2057 //----------------------------------------------------------------------------
2059 String __EXPORT
ScUndoUpdateAreaLink::GetComment() const
2061 return ScGlobal::GetRscString( STR_UNDO_UPDATELINK
); //! eigener Text ??
2065 //----------------------------------------------------------------------------
2067 void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo
) const
2069 ScDocument
* pDoc
= pDocShell
->GetDocument();
2071 SCCOL nEndX
= Max( aOldRange
.aEnd
.Col(), aNewRange
.aEnd
.Col() );
2072 SCROW nEndY
= Max( aOldRange
.aEnd
.Row(), aNewRange
.aEnd
.Row() );
2073 SCTAB nEndZ
= Max( aOldRange
.aEnd
.Tab(), aNewRange
.aEnd
.Tab() ); //?
2079 pDoc
->FitBlock( aNewRange
, aOldRange
);
2080 pDoc
->DeleteAreaTab( aOldRange
, IDF_ALL
& ~IDF_NOTE
);
2081 pUndoDoc
->UndoToDocument( aOldRange
, IDF_ALL
& ~IDF_NOTE
, FALSE
, pDoc
);
2085 ScRange
aCopyRange( aOldRange
.aStart
, ScAddress(nEndX
,nEndY
,nEndZ
) );
2086 pDoc
->DeleteAreaTab( aCopyRange
, IDF_ALL
& ~IDF_NOTE
);
2087 pUndoDoc
->CopyToDocument( aCopyRange
, IDF_ALL
& ~IDF_NOTE
, FALSE
, pDoc
);
2094 pDoc
->FitBlock( aOldRange
, aNewRange
);
2095 pDoc
->DeleteAreaTab( aNewRange
, IDF_ALL
& ~IDF_NOTE
);
2096 pRedoDoc
->CopyToDocument( aNewRange
, IDF_ALL
& ~IDF_NOTE
, FALSE
, pDoc
);
2100 ScRange
aCopyRange( aOldRange
.aStart
, ScAddress(nEndX
,nEndY
,nEndZ
) );
2101 pDoc
->DeleteAreaTab( aCopyRange
, IDF_ALL
& ~IDF_NOTE
);
2102 pRedoDoc
->CopyToDocument( aCopyRange
, IDF_ALL
& ~IDF_NOTE
, FALSE
, pDoc
);
2106 ScRange
aWorkRange( aNewRange
.aStart
, ScAddress( nEndX
, nEndY
, nEndZ
) );
2107 pDoc
->ExtendMerge( aWorkRange
, TRUE
);
2111 if ( aNewRange
.aEnd
.Col() != aOldRange
.aEnd
.Col() )
2112 aWorkRange
.aEnd
.SetCol(MAXCOL
);
2113 if ( aNewRange
.aEnd
.Row() != aOldRange
.aEnd
.Row() )
2114 aWorkRange
.aEnd
.SetRow(MAXROW
);
2116 if ( !pDocShell
->AdjustRowHeight( aWorkRange
.aStart
.Row(), aWorkRange
.aEnd
.Row(), aWorkRange
.aStart
.Tab() ) )
2117 pDocShell
->PostPaint( aWorkRange
, PAINT_GRID
);
2119 pDocShell
->PostDataChanged();
2120 ScTabViewShell
* pViewShell
= ScTabViewShell::GetActiveViewShell();
2122 pViewShell
->CellContentChanged();
2126 //----------------------------------------------------------------------------
2128 void __EXPORT
ScUndoUpdateAreaLink::Undo()
2130 ScDocument
* pDoc
= pDocShell
->GetDocument();
2131 SvxLinkManager
* pLinkManager
= pDoc
->GetLinkManager();
2132 ScAreaLink
* pLink
= lcl_FindAreaLink( pLinkManager
, aNewDoc
, aNewFlt
, aNewOpt
,
2133 aNewArea
, aNewRange
);
2136 pLink
->SetSource( aOldDoc
, aOldFlt
, aOldOpt
, aOldArea
); // alte Werte im Link
2137 pLink
->SetDestArea( aOldRange
);
2138 pLink
->SetRefreshDelay( nOldRefresh
);
2145 //----------------------------------------------------------------------------
2147 void __EXPORT
ScUndoUpdateAreaLink::Redo()
2149 ScDocument
* pDoc
= pDocShell
->GetDocument();
2150 SvxLinkManager
* pLinkManager
= pDoc
->GetLinkManager();
2151 ScAreaLink
* pLink
= lcl_FindAreaLink( pLinkManager
, aOldDoc
, aOldFlt
, aOldOpt
,
2152 aOldArea
, aOldRange
);
2155 pLink
->SetSource( aNewDoc
, aNewFlt
, aNewOpt
, aNewArea
); // neue Werte im Link
2156 pLink
->SetDestArea( aNewRange
);
2157 pLink
->SetRefreshDelay( nNewRefresh
);
2164 //----------------------------------------------------------------------------
2166 void __EXPORT
ScUndoUpdateAreaLink::Repeat(SfxRepeatTarget
& /* rTarget */)
2172 //----------------------------------------------------------------------------
2174 BOOL __EXPORT
ScUndoUpdateAreaLink::CanRepeat(SfxRepeatTarget
& /* rTarget */) const