LibreOffice Module sc (master) 1
undoblk3.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <memory>
23
24#include <scitems.hxx>
25#include <editeng/boxitem.hxx>
27#include <svl/srchitem.hxx>
28#include <sfx2/linkmgr.hxx>
29#include <utility>
30#include <vcl/virdev.hxx>
31#include <sfx2/app.hxx>
32#include <svx/svdundo.hxx>
33#include <osl/diagnose.h>
34
35#include <undoblk.hxx>
36#include <globstr.hrc>
37#include <scresid.hxx>
38#include <global.hxx>
39#include <arealink.hxx>
40#include <patattr.hxx>
41#include <target.hxx>
42#include <document.hxx>
43#include <docpool.hxx>
44#include <docsh.hxx>
45#include <tabvwsh.hxx>
46#include <undoolk.hxx>
47#include <undoutil.hxx>
48#include <chgtrack.hxx>
49#include <paramisc.hxx>
50#include <postit.hxx>
51#include <progress.hxx>
52#include <editutil.hxx>
53#include <editdataarray.hxx>
54#include <rowheightcontext.hxx>
55
56// TODO:
57/*A*/ // SetOptimalHeight on Document, when no View
58
60 ScDocShell* pNewDocShell,
61 const ScMarkData& rMark, const ScRange& rRange,
62 ScDocumentUniquePtr&& pNewUndoDoc, bool bNewMulti,
63 InsertDeleteFlags nNewFlags, bool bObjects )
64 : ScSimpleUndo( pNewDocShell ),
65 aRange ( rRange ),
66 aMarkData ( rMark ),
67 pUndoDoc ( std::move(pNewUndoDoc) ),
68 nFlags ( nNewFlags ),
69 bMulti ( bNewMulti ) // unnecessary
70{
71 if (bObjects)
73
74 if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) ) // if no cell is selected:
75 aMarkData.SetMarkArea( aRange ); // select cell under cursor
76
78}
79
81{
82 pUndoDoc.reset();
83 pDrawUndo.reset();
84}
85
87{
88 return ScResId( STR_UNDO_DELETECONTENTS ); // "Delete"
89}
90
91void ScUndoDeleteContents::SetDataSpans( const std::shared_ptr<DataSpansType>& pSpans )
92{
93 mpDataSpans = pSpans;
94}
95
97{
99 if ( pChangeTrack && (nFlags & InsertDeleteFlags::CONTENTS) )
100 pChangeTrack->AppendContentRange( aRange, pUndoDoc.get(),
102 else
104}
105
106void ScUndoDeleteContents::DoChange( const bool bUndo )
107{
109
111
112 sal_uInt16 nExtFlags = 0;
113
114 if (bUndo) // only Undo
115 {
116 InsertDeleteFlags nUndoFlags = InsertDeleteFlags::NONE; // copy either all or none of the content
117 if (nFlags & InsertDeleteFlags::CONTENTS) // (Only the correct ones have been copied into UndoDoc)
118 nUndoFlags |= InsertDeleteFlags::CONTENTS;
120 nUndoFlags |= InsertDeleteFlags::ATTRIB;
121 if (nFlags & InsertDeleteFlags::EDITATTR) // Edit-Engine attribute
122 nUndoFlags |= InsertDeleteFlags::STRING; // -> Cells will be changed
124 nUndoFlags |= InsertDeleteFlags::SPARKLINES;
125 // do not create clones of note captions, they will be restored via drawing undo
126 nUndoFlags |= InsertDeleteFlags::NOCAPTIONS;
127
128 ScRange aCopyRange = aRange;
129 SCTAB nTabCount = rDoc.GetTableCount();
130 aCopyRange.aStart.SetTab(0);
131 aCopyRange.aEnd.SetTab(nTabCount-1);
132
133 pUndoDoc->CopyToDocument(aCopyRange, nUndoFlags, bMulti, rDoc, &aMarkData);
134
135 DoSdrUndoAction( pDrawUndo.get(), &rDoc );
136
137 ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
138 if ( pChangeTrack )
139 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
140
141 pDocShell->UpdatePaintExt( nExtFlags, aRange ); // content after the change
142 }
143 else // only Redo
144 {
145 pDocShell->UpdatePaintExt( nExtFlags, aRange ); // content before the change
146
149 // do not delete objects and note captions, they have been removed via drawing undo
151 rDoc.DeleteSelection( nRedoFlags, aMarkData );
153
155 }
156
158 {
159 // Broadcast only when the content changes. fdo#74687
160 if (mpDataSpans)
162 else
164 }
165
167 if ( !( pViewShell && pViewShell->AdjustRowHeight(
168 aRange.aStart.Row(), aRange.aEnd.Row(), true ) ) )
170
171 if (pViewShell)
172 pViewShell->CellContentChanged();
173
174 ShowTable( aRange );
175}
176
178{
179 BeginUndo();
180 DoChange( true );
181 EndUndo();
182
184}
185
187{
188 BeginRedo();
189 DoChange( false );
190 EndRedo();
191
193}
194
195void ScUndoDeleteContents::Repeat(SfxRepeatTarget& rTarget)
196{
197 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
198 pViewTarget->GetViewShell()->DeleteContents( nFlags );
199}
200
201bool ScUndoDeleteContents::CanRepeat(SfxRepeatTarget& rTarget) const
202{
203 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
204}
205
207 const ScMarkData& rMark,
208 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
209 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
210 ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti, SCTAB nSrc,
211 InsertDeleteFlags nFlg, ScPasteFunc nFunc, bool bSkip, bool bLink )
212 : ScSimpleUndo( pNewDocShell ),
213 aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
214 aMarkData ( rMark ),
215 pUndoDoc ( std::move(pNewUndoDoc) ),
216 nFlags ( nFlg ),
217 nFunction ( nFunc ),
218 nSrcTab ( nSrc ),
219 bMulti ( bNewMulti ),
220 bSkipEmpty ( bSkip ),
221 bAsLink ( bLink )
222{
224}
225
227{
228}
229
231{
232 return ScResId( STR_FILL_TAB );
233}
234
236{
238 if ( pChangeTrack )
239 {
240 SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
241 ScRange aWorkRange(aRange);
243 sal_uLong nTmpAction;
244 for (const auto& rTab : aMarkData)
245 {
246 if (rTab >= nTabCount)
247 break;
248 if (rTab != nSrcTab)
249 {
250 aWorkRange.aStart.SetTab(rTab);
251 aWorkRange.aEnd.SetTab(rTab);
252 pChangeTrack->AppendContentRange( aWorkRange, pUndoDoc.get(),
253 nTmpAction, nEndChangeAction );
254 if ( !nStartChangeAction )
255 nStartChangeAction = nTmpAction;
256 }
257 }
258 }
259 else
261}
262
263void ScUndoFillTable::DoChange( const bool bUndo )
264{
266
268
269 if (bUndo) // only Undo
270 {
271 SCTAB nTabCount = rDoc.GetTableCount();
272 ScRange aWorkRange(aRange);
273 for (const auto& rTab : aMarkData)
274 {
275 if (rTab >= nTabCount)
276 break;
277 if (rTab != nSrcTab)
278 {
279 aWorkRange.aStart.SetTab(rTab);
280 aWorkRange.aEnd.SetTab(rTab);
281 if (bMulti)
283 else
284 rDoc.DeleteAreaTab( aWorkRange, InsertDeleteFlags::ALL );
285 pUndoDoc->CopyToDocument(aWorkRange, InsertDeleteFlags::ALL, bMulti, rDoc, &aMarkData);
286 }
287 }
288
289 ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
290 if ( pChangeTrack )
291 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
292 }
293 else // only Redo
294 {
299 }
300
303
304 // CellContentChanged comes with the selection
305
307 if (pViewShell)
308 {
309 SCTAB nTab = pViewShell->GetViewData().GetTabNo();
310 if ( !aMarkData.GetTableSelect(nTab) )
311 pViewShell->SetTabNo( nSrcTab );
312
313 pViewShell->DoneBlockMode(); // causes problems otherwise since selection is on the wrong sheet.
314 }
315}
316
318{
319 BeginUndo();
320 DoChange( true );
321 EndUndo();
322}
323
325{
326 BeginRedo();
327 DoChange( false );
328 EndRedo();
329}
330
331void ScUndoFillTable::Repeat(SfxRepeatTarget& rTarget)
332{
333 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
334 pViewTarget->GetViewShell()->FillTab( nFlags, nFunction, bSkipEmpty, bAsLink );
335}
336
337bool ScUndoFillTable::CanRepeat(SfxRepeatTarget& rTarget) const
338{
339 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
340}
341
343 const ScMarkData& rMark,
344 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
345 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
346 ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti,
347 const ScPatternAttr* pNewApply,
348 const SvxBoxItem* pNewOuter, const SvxBoxInfoItem* pNewInner,
349 const ScRange* pRangeCover )
350 : ScSimpleUndo( pNewDocShell ),
351 aMarkData ( rMark ),
352 aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
353 mpDataArray(new ScEditDataArray),
354 pUndoDoc ( std::move(pNewUndoDoc) ),
355 bMulti ( bNewMulti )
356{
358 pApplyPattern = const_cast<ScPatternAttr*>(&pPool->Put( *pNewApply ));
359 pLineOuter = pNewOuter ? const_cast<SvxBoxItem*>( &pPool->Put( *pNewOuter ) ) : nullptr;
360 pLineInner = pNewInner ? const_cast<SvxBoxInfoItem*>( &pPool->Put( *pNewInner ) ) : nullptr;
361 aRangeCover = pRangeCover ? *pRangeCover : aRange;
362}
363
365{
367 pPool->Remove(*pApplyPattern);
368 if (pLineOuter)
369 pPool->Remove(*pLineOuter);
370 if (pLineInner)
371 pPool->Remove(*pLineInner);
372
373 pUndoDoc.reset();
374}
375
377{
378 //"Attribute" "/Lines"
379 return ScResId( pLineOuter ? STR_UNDO_SELATTRLINES : STR_UNDO_SELATTR );
380}
381
383{
384 return mpDataArray.get();
385}
386
387void ScUndoSelectionAttr::DoChange( const bool bUndo )
388{
390
392
393 ScRange aEffRange( aRangeCover );
394 if ( rDoc.HasAttrib( aEffRange, HasAttrFlags::Merged ) ) // merged cells?
395 rDoc.ExtendMerge( aEffRange );
396
397 sal_uInt16 nExtFlags = 0;
398 pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
399
400 ChangeEditData(bUndo);
401
402 if (bUndo) // only for Undo
403 {
404 ScRange aCopyRange = aRangeCover;
405 SCTAB nTabCount = rDoc.GetTableCount();
406 aCopyRange.aStart.SetTab(0);
407 aCopyRange.aEnd.SetTab(nTabCount-1);
408 pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ATTRIB, bMulti, rDoc, &aMarkData);
409 }
410 else // only for Redo
411 {
415
416 if (pLineOuter)
418 }
419
421 if ( !( pViewShell && pViewShell->AdjustBlockHeight() ) )
422/*A*/ pDocShell->PostPaint( aEffRange, PaintPartFlags::Grid | PaintPartFlags::Extras, nExtFlags );
423
424 ShowTable( aRange );
425}
426
428{
430 for (const ScEditDataArray::Item* pItem = mpDataArray->First(); pItem; pItem = mpDataArray->Next())
431 {
432 ScAddress aPos(pItem->GetCol(), pItem->GetRow(), pItem->GetTab());
433 if (rDoc.GetCellType(aPos) != CELLTYPE_EDIT)
434 continue;
435
436 if (bUndo)
437 {
438 if (pItem->GetOldData())
439 rDoc.SetEditText(aPos, *pItem->GetOldData(), nullptr);
440 else
441 rDoc.SetEmptyCell(aPos);
442 }
443 else
444 {
445 if (pItem->GetNewData())
446 rDoc.SetEditText(aPos, *pItem->GetNewData(), nullptr);
447 else
448 rDoc.SetEmptyCell(aPos);
449 }
450 }
451}
452
454{
455 BeginUndo();
456 DoChange( true );
457 EndUndo();
458}
459
461{
462 BeginRedo();
463 DoChange( false );
464 EndRedo();
465}
466
467void ScUndoSelectionAttr::Repeat(SfxRepeatTarget& rTarget)
468{
469 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
470 {
471 ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
472 if (pLineOuter)
474 else
476 }
477}
478
479bool ScUndoSelectionAttr::CanRepeat(SfxRepeatTarget& rTarget) const
480{
481 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
482}
483
485 const ScRange& rRange, const ScRange& rSourceArea,
486 ScDocumentUniquePtr pNewUndoDoc, const ScMarkData& rMark,
487 FillDir eNewFillDir, FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd,
488 double fNewStartValue, double fNewStepValue, double fNewMaxValue )
489 : ScBlockUndo( pNewDocShell, rRange, SC_UNDO_AUTOHEIGHT ),
490 aSource ( rSourceArea ),
491 aMarkData ( rMark ),
492 pUndoDoc ( std::move(pNewUndoDoc) ),
493 eFillDir ( eNewFillDir ),
494 eFillCmd ( eNewFillCmd ),
495 eFillDateCmd ( eNewFillDateCmd ),
496 fStartValue ( fNewStartValue ),
497 fStepValue ( fNewStepValue ),
498 fMaxValue ( fNewMaxValue )
499{
501}
502
504{
505}
506
508{
509 return ScResId( STR_UNDO_AUTOFILL ); //"Fill"
510}
511
513{
515 if ( pChangeTrack )
516 pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
518 else
520}
521
523{
524 BeginUndo();
525
527
528 SCTAB nTabCount = rDoc.GetTableCount();
529 for (const auto& rTab : aMarkData)
530 {
531 if (rTab >= nTabCount)
532 break;
533 ScRange aWorkRange = aBlockRange;
534 aWorkRange.aStart.SetTab(rTab);
535 aWorkRange.aEnd.SetTab(rTab);
536
537 sal_uInt16 nExtFlags = 0;
538 pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
539 rDoc.DeleteAreaTab( aWorkRange, InsertDeleteFlags::AUTOFILL );
540 pUndoDoc->CopyToDocument(aWorkRange, InsertDeleteFlags::AUTOFILL, false, rDoc);
541
542 // Actually we'd only need to broadcast the cells inserted during
543 // CopyToDocument(), as DeleteAreaTab() broadcasts deleted cells. For
544 // this we'd need to either record the span sets or let
545 // CopyToDocument() broadcast.
546 BroadcastChanges( aWorkRange);
547
548 rDoc.ExtendMerge( aWorkRange, true );
549 pDocShell->PostPaint( aWorkRange, PaintPartFlags::Grid, nExtFlags );
550 }
553 if (pViewShell)
554 pViewShell->CellContentChanged();
555
556 ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
557 if ( pChangeTrack )
558 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
559
560 EndUndo();
561}
562
564{
565 BeginRedo();
566
568
569 SCCOLROW nCount = 0;
570 switch (eFillDir)
571 {
572 case FILL_TO_BOTTOM:
574 break;
575 case FILL_TO_RIGHT:
577 break;
578 case FILL_TO_TOP:
580 break;
581 case FILL_TO_LEFT:
583 break;
584 }
585
587 if ( fStartValue != MAXDOUBLE )
588 {
590 SCROW nValY = (eFillDir == FILL_TO_TOP ) ? aSource.aEnd.Row() : aSource.aStart.Row();
591 SCTAB nTab = aSource.aStart.Tab();
592 rDoc.SetValue( nValX, nValY, nTab, fStartValue );
593 }
594 sal_uLong nProgCount;
596 nProgCount = aSource.aEnd.Col() - aSource.aStart.Col() + 1;
597 else
598 nProgCount = aSource.aEnd.Row() - aSource.aStart.Row() + 1;
599 nProgCount *= nCount;
600 ScProgress aProgress( rDoc.GetDocumentShell(),
601 ScResId(STR_FILL_SERIES_PROGRESS), nProgCount, true );
602
604 aSource.aEnd.Col(), aSource.aEnd.Row(), &aProgress,
608
610
614 if (pViewShell)
615 pViewShell->CellContentChanged();
616
617 EndRedo();
618}
619
620void ScUndoAutoFill::Repeat(SfxRepeatTarget& rTarget)
621{
622 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
623 {
624 ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
626 rViewShell.FillSimple( eFillDir );
627 else
630 }
631}
632
633bool ScUndoAutoFill::CanRepeat(SfxRepeatTarget& rTarget) const
634{
635 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
636}
637
639 bool bMergeContents, ScDocumentUniquePtr pUndoDoc, std::unique_ptr<SdrUndoAction> pDrawUndo)
640 : ScSimpleUndo(pNewDocShell)
641 , maOption(std::move(aOption))
642 , mbMergeContents(bMergeContents)
643 , mxUndoDoc(std::move(pUndoDoc))
644 , mpDrawUndo(std::move(pDrawUndo))
645{
646}
647
649{
650 mpDrawUndo.reset();
651}
652
654{
655 return ScResId( STR_UNDO_MERGE );
656}
657
658void ScUndoMerge::DoChange( bool bUndo ) const
659{
660 using ::std::set;
661
662 if (maOption.maTabs.empty())
663 // Nothing to do.
664 return;
665
668
671
672 for (const SCTAB nTab : maOption.maTabs)
673 {
674 ScRange aRange = maOption.getSingleRange(nTab);
675
676 if (bUndo)
677 // remove merge (contents are copied back below from undo document)
678 rDoc.RemoveMerge( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab() );
679 else
680 {
681 // repeat merge, but do not remove note captions (will be done by drawing redo below)
682 rDoc.DoMerge( aRange.aStart.Col(), aRange.aStart.Row(),
683 aRange.aEnd.Col(), aRange.aEnd.Row(),
684 aRange.aStart.Tab(), false );
685
686 if (maOption.mbCenter)
687 {
688 rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
689 aRange.aStart.Tab(),
690 SvxHorJustifyItem( SvxCellHorJustify::Center, ATTR_HOR_JUSTIFY ) );
691 rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
692 aRange.aStart.Tab(),
693 SvxVerJustifyItem( SvxCellVerJustify::Center, ATTR_VER_JUSTIFY ) );
694 }
695 }
696
697 // undo -> copy back deleted contents
698 if (bUndo && mxUndoDoc)
699 {
700 // If there are note captions to be deleted during Undo they were
701 // kept or moved during the merge and copied to the Undo document
702 // without cloning the caption. Forget the target area's caption
703 // pointer that is identical to the one in the Undo document
704 // instead of deleting it.
705 rDoc.DeleteAreaTab( aRange,
707 mxUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL|InsertDeleteFlags::NOCAPTIONS, false, rDoc);
708 }
709
710 // redo -> merge contents again
711 else if (!bUndo && mbMergeContents)
712 {
713 rDoc.DoMergeContents( aRange.aStart.Col(), aRange.aStart.Row(),
714 aRange.aEnd.Col(), aRange.aEnd.Row(),
715 aRange.aStart.Tab() );
716 }
717
718 if (bUndo)
719 DoSdrUndoAction( mpDrawUndo.get(), &rDoc );
720 else
722
723 bool bDidPaint = false;
724 if ( pViewShell )
725 {
726 pViewShell->SetTabNo(nTab);
727 bDidPaint = pViewShell->AdjustRowHeight(maOption.mnStartRow, maOption.mnEndRow, true);
728 }
729
730 if (!bDidPaint)
732
733 rDoc.BroadcastCells(aRange, SfxHintId::ScDataChanged);
734 }
735
736 ShowTable(aCurRange);
737}
738
740{
741 BeginUndo();
742 DoChange( true );
743 EndUndo();
744}
745
747{
748 BeginRedo();
749 DoChange( false );
750 EndRedo();
751}
752
753void ScUndoMerge::Repeat(SfxRepeatTarget& rTarget)
754{
755 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
756 {
757 ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
758 bool bCont = false;
759 rViewShell.MergeCells( false, bCont, false );
760 }
761}
762
763bool ScUndoMerge::CanRepeat(SfxRepeatTarget& rTarget) const
764{
765 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
766}
767
769 const ScRange& rRange, ScDocumentUniquePtr pNewUndoDoc,
770 const ScMarkData& rMark, bool bNewSize, sal_uInt16 nNewFormatNo )
771 : ScBlockUndo( pNewDocShell, rRange, bNewSize ? SC_UNDO_MANUALHEIGHT : SC_UNDO_AUTOHEIGHT ),
772 pUndoDoc ( std::move(pNewUndoDoc) ),
773 aMarkData ( rMark ),
774 bSize ( bNewSize ),
775 nFormatNo ( nNewFormatNo )
776{
777}
778
780{
781}
782
784{
785 return ScResId( STR_UNDO_AUTOFORMAT ); //"Auto-Format"
786}
787
789{
790 BeginUndo();
791
793
794 SCTAB nTabCount = rDoc.GetTableCount();
798 ScRange aCopyRange = aBlockRange;
799 aCopyRange.aStart.SetTab(0);
800 aCopyRange.aEnd.SetTab(nTabCount-1);
801 pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ATTRIB, false, rDoc, &aMarkData);
802
803 // cell heights and widths (InsertDeleteFlags::NONE)
804 if (bSize)
805 {
806 SCCOL nStartX = aBlockRange.aStart.Col();
807 SCROW nStartY = aBlockRange.aStart.Row();
808 SCTAB nStartZ = aBlockRange.aStart.Tab();
809 SCCOL nEndX = aBlockRange.aEnd.Col();
810 SCROW nEndY = aBlockRange.aEnd.Row();
811 SCTAB nEndZ = aBlockRange.aEnd.Tab();
812
813 pUndoDoc->CopyToDocument( nStartX, 0, 0, nEndX, rDoc.MaxRow(), nTabCount-1,
814 InsertDeleteFlags::NONE, false, rDoc, &aMarkData );
815 pUndoDoc->CopyToDocument( 0, nStartY, 0, rDoc.MaxCol(), nEndY, nTabCount-1,
816 InsertDeleteFlags::NONE, false, rDoc, &aMarkData );
817 pDocShell->PostPaint( 0, 0, nStartZ, rDoc.MaxCol(), rDoc.MaxRow(), nEndZ,
819 }
820 else
822
823 EndUndo();
824}
825
827{
828 BeginRedo();
829
831
832 SCCOL nStartX = aBlockRange.aStart.Col();
833 SCROW nStartY = aBlockRange.aStart.Row();
834 SCTAB nStartZ = aBlockRange.aStart.Tab();
835 SCCOL nEndX = aBlockRange.aEnd.Col();
836 SCROW nEndY = aBlockRange.aEnd.Row();
837 SCTAB nEndZ = aBlockRange.aEnd.Tab();
838
839 rDoc.AutoFormat( nStartX, nStartY, nEndX, nEndY, nFormatNo, aMarkData );
840
841 if (bSize)
842 {
844 Fraction aZoomX(1,1);
845 Fraction aZoomY = aZoomX;
846 double nPPTX,nPPTY;
848 if (pViewShell)
849 {
850 ScViewData& rData = pViewShell->GetViewData();
851 nPPTX = rData.GetPPTX();
852 nPPTY = rData.GetPPTY();
853 aZoomX = rData.GetZoomX();
854 aZoomY = rData.GetZoomY();
855 }
856 else
857 {
858 // Keep zoom at 100
861 }
862
863 sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev);
864 for (SCTAB nTab=nStartZ; nTab<=nEndZ; nTab++)
865 {
866 ScMarkData aDestMark(rDoc.GetSheetLimits());
867 aDestMark.SelectOneTable( nTab );
868 aDestMark.SetMarkArea( ScRange( nStartX, nStartY, nTab, nEndX, nEndY, nTab ) );
869 aDestMark.MarkToMulti();
870
871 // as SC_SIZE_VISOPT
872 for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
873 {
874 CRFlags nOld = rDoc.GetRowFlags(nRow,nTab);
875 bool bHidden = rDoc.RowHidden(nRow, nTab);
876 if ( !bHidden && ( nOld & CRFlags::ManualSize ) )
877 rDoc.SetRowFlags( nRow, nTab, nOld & ~CRFlags::ManualSize );
878 }
879
880 bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab, true);
881
882 for (SCCOL nCol=nStartX; nCol<=nEndX; nCol++)
883 if (!rDoc.ColHidden(nCol, nTab))
884 {
885 sal_uInt16 nThisSize = STD_EXTRA_WIDTH + rDoc.GetOptimalColWidth( nCol, nTab,
886 pVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, false/*bFormula*/,
887 &aDestMark );
888 rDoc.SetColWidth( nCol, nTab, nThisSize );
889 rDoc.ShowCol( nCol, nTab, true );
890 }
891
892 // tdf#76183: recalculate objects' positions
893 if (bChanged)
894 rDoc.SetDrawPageSize(nTab);
895 }
896
897 pDocShell->PostPaint( 0, 0, nStartZ,
898 rDoc.MaxCol(), rDoc.MaxRow(), nEndZ,
900 }
901 else
903
904 EndRedo();
905}
906
907void ScUndoAutoFormat::Repeat(SfxRepeatTarget& rTarget)
908{
909 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
910 pViewTarget->GetViewShell()->AutoFormat( nFormatNo );
911}
912
913bool ScUndoAutoFormat::CanRepeat(SfxRepeatTarget& rTarget) const
914{
915 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
916}
917
919 SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
920 OUString aNewUndoStr, ScDocumentUniquePtr pNewUndoDoc,
921 const SvxSearchItem* pItem )
922 : ScSimpleUndo( pNewDocShell ),
923 aCursorPos ( nCurX, nCurY, nCurZ ),
924 aMarkData ( rMark ),
925 aUndoStr (std::move( aNewUndoStr )),
926 pUndoDoc ( std::move(pNewUndoDoc) )
927{
928 pSearchItem.reset( new SvxSearchItem( *pItem ) );
930}
931
933{
934 pUndoDoc.reset();
935 pSearchItem.reset();
936}
937
939{
941 ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
942 if ( pChangeTrack )
943 {
944 if ( pUndoDoc )
945 {
946 // that is why an Iterator can be used
947 pChangeTrack->AppendContentsIfInRefDoc( *pUndoDoc,
949 }
950 else
951 {
952 nStartChangeAction = pChangeTrack->GetActionMax() + 1;
955 ScCellValue aCell;
956 aCell.assign(rDoc, aCursorPos);
957 pContent->SetOldValue( aUndoStr, &rDoc );
958 pContent->SetNewValue(aCell, &rDoc);
959 pChangeTrack->Append( pContent );
960 nEndChangeAction = pChangeTrack->GetActionMax();
961 }
962 }
963 else
965}
966
968{
969 return ScResId( STR_UNDO_REPLACE ); // "Replace"
970}
971
973{
974 BeginUndo();
975
978
980
981 if (pUndoDoc) // only for ReplaceAll !!
982 {
983 OSL_ENSURE(pSearchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL,
984 "ScUndoReplace:: Wrong Mode");
985
987
990
991 // Undo document has no row/column information, thus copy with
992 // bColRowFlags = FALSE to not destroy Outline groups
993
995 pUndoDoc->CopyToDocument( 0, 0, 0,
996 rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB,
997 nUndoFlags, false, rDoc, nullptr, false ); // without row flags
999 }
1000 else if (pSearchItem->GetPattern() &&
1001 pSearchItem->GetCommand() == SvxSearchCmd::REPLACE)
1002 {
1003 OUString aTempStr = pSearchItem->GetSearchString(); // toggle
1004 pSearchItem->SetSearchString(pSearchItem->GetReplaceString());
1005 pSearchItem->SetReplaceString(aTempStr);
1008 aMarkData);
1009 pSearchItem->SetReplaceString(pSearchItem->GetSearchString());
1010 pSearchItem->SetSearchString(aTempStr);
1011 if (pViewShell)
1012 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1013 SC_FOLLOW_JUMP, false, false );
1015 }
1016 else if (pSearchItem->GetCellType() == SvxSearchCellType::NOTE)
1017 {
1018 ScPostIt* pNote = rDoc.GetNote(aCursorPos);
1019 OSL_ENSURE( pNote, "ScUndoReplace::Undo - cell does not contain a note" );
1020 if (pNote)
1021 pNote->SetText( aCursorPos, aUndoStr );
1022 if (pViewShell)
1023 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1024 SC_FOLLOW_JUMP, false, false );
1025 }
1026 else
1027 {
1028 // aUndoStr may contain line breaks
1029 if ( aUndoStr.indexOf('\n') != -1 )
1030 {
1031 ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
1033 rDoc.SetEditText(aCursorPos, rEngine.CreateTextObject());
1034 }
1035 else
1037 if (pViewShell)
1038 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1039 SC_FOLLOW_JUMP, false, false );
1041 }
1042
1043 ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1044 if ( pChangeTrack )
1045 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1046
1047 EndUndo();
1048}
1049
1051{
1052 BeginRedo();
1053
1054 ScDocument& rDoc = pDocShell->GetDocument();
1056
1057 if (pViewShell)
1058 pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
1059 SC_FOLLOW_JUMP, false, false );
1060 if (pUndoDoc)
1061 {
1062 if (pViewShell)
1063 {
1065
1066 pViewShell->SearchAndReplace( pSearchItem.get(), false, true );
1067 }
1068 }
1069 else if (pSearchItem->GetPattern() &&
1070 pSearchItem->GetCommand() == SvxSearchCmd::REPLACE)
1071 {
1074 aMarkData);
1076 }
1077 else
1078 if (pViewShell)
1079 pViewShell->SearchAndReplace( pSearchItem.get(), false, true );
1080
1082
1083 EndRedo();
1084}
1085
1086void ScUndoReplace::Repeat(SfxRepeatTarget& rTarget)
1087{
1088 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1089 pViewTarget->GetViewShell()->SearchAndReplace( pSearchItem.get(), true, false );
1090}
1091
1092bool ScUndoReplace::CanRepeat(SfxRepeatTarget& rTarget) const
1093{
1094 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1095}
1096
1097// multi-operation (only simple blocks)
1099 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
1100 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, ScDocumentUniquePtr pNewUndoDoc,
1101 const ScRefAddress& rFormulaCell,
1102 const ScRefAddress& rFormulaEnd,
1103 const ScRefAddress& rRowCell,
1104 const ScRefAddress& rColCell,
1105 ScTabOpParam::Mode eMode )
1106 : ScSimpleUndo( pNewDocShell ),
1107 aRange ( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ),
1108 pUndoDoc ( std::move(pNewUndoDoc) ),
1109 theFormulaCell ( rFormulaCell ),
1110 theFormulaEnd ( rFormulaEnd ),
1111 theRowCell ( rRowCell ),
1112 theColCell ( rColCell ),
1113 meMode(eMode)
1114{
1115}
1116
1118{
1119}
1120
1122{
1123 return ScResId( STR_UNDO_TABOP ); // "Multiple operation"
1124}
1125
1127{
1128 BeginUndo();
1129
1131
1132 sal_uInt16 nExtFlags = 0;
1133 pDocShell->UpdatePaintExt( nExtFlags, aRange );
1134
1135 ScDocument& rDoc = pDocShell->GetDocument();
1137 pUndoDoc->CopyToDocument( aRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc );
1141 if (pViewShell)
1142 pViewShell->CellContentChanged();
1143
1144 EndUndo();
1145}
1146
1148{
1149 BeginRedo();
1150
1152
1154
1156 if (pViewShell)
1157 pViewShell->TabOp( aParam, false);
1158
1159 EndRedo();
1160}
1161
1162void ScUndoTabOp::Repeat(SfxRepeatTarget& /* rTarget */)
1163{
1164}
1165
1166bool ScUndoTabOp::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1167{
1168 return false;
1169}
1170
1172 ScDocShell* pNewDocShell, const ScMarkData& rMark,
1173 SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScDocumentUniquePtr pNewUndoDoc,
1174 SCCOL nNewX, SCROW nNewY, SCTAB nNewZ, ScDocumentUniquePtr pNewRedoDoc,
1175 ScConversionParam aConvParam ) :
1176 ScSimpleUndo( pNewDocShell ),
1177 aMarkData( rMark ),
1178 aCursorPos( nCurX, nCurY, nCurZ ),
1179 pUndoDoc( std::move(pNewUndoDoc) ),
1180 aNewCursorPos( nNewX, nNewY, nNewZ ),
1181 pRedoDoc( std::move(pNewRedoDoc) ),
1182 maConvParam(std::move( aConvParam ))
1183{
1185}
1186
1188{
1189 pUndoDoc.reset();
1190 pRedoDoc.reset();
1191}
1192
1194{
1195 ScDocument& rDoc = pDocShell->GetDocument();
1196 ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1197 if ( pChangeTrack )
1198 {
1199 if ( pUndoDoc )
1200 pChangeTrack->AppendContentsIfInRefDoc( *pUndoDoc,
1202 else
1203 {
1204 OSL_FAIL( "ScUndoConversion::SetChangeTrack: no UndoDoc" );
1206 }
1207 }
1208 else
1210}
1211
1213{
1214 OUString aText;
1215 switch( maConvParam.GetType() )
1216 {
1217 case SC_CONVERSION_SPELLCHECK: aText = ScResId( STR_UNDO_SPELLING ); break;
1218 case SC_CONVERSION_HANGULHANJA: aText = ScResId( STR_UNDO_HANGULHANJA ); break;
1219 case SC_CONVERSION_CHINESE_TRANSL: aText = ScResId( STR_UNDO_CHINESE_TRANSLATION ); break;
1220 default: OSL_FAIL( "ScUndoConversion::GetComment - unknown conversion type" );
1221 }
1222 return aText;
1223}
1224
1225void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPos )
1226{
1227 if (pRefDoc)
1228 {
1229 ScDocument& rDoc = pDocShell->GetDocument();
1230 ShowTable( rCursorPos.Tab() );
1231
1233
1234 SCTAB nTabCount = rDoc.GetTableCount();
1235 // Undo/Redo-doc has only selected tables
1236
1237 bool bMulti = aMarkData.IsMultiMarked();
1238 pRefDoc->CopyToDocument( 0, 0, 0,
1239 rDoc.MaxCol(), rDoc.MaxRow(), nTabCount-1,
1240 InsertDeleteFlags::CONTENTS, bMulti, rDoc, &aMarkData );
1241
1242 // Reset the spell checking results to re-check on paint, otherwise
1243 // we show the previous spelling markers (or lack thereof on misspellings).
1244 if (ScViewData* pViewData = ScDocShell::GetViewData())
1245 pViewData->GetActiveWin()->ResetAutoSpell();
1247 }
1248 else
1249 {
1250 OSL_FAIL("no Un-/RedoDoc for Un-/RedoSpelling");
1251 }
1252}
1253
1255{
1256 BeginUndo();
1257 DoChange( pUndoDoc.get(), aCursorPos );
1259 if ( pChangeTrack )
1260 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1261 EndUndo();
1262}
1263
1265{
1266 BeginRedo();
1269 EndRedo();
1270}
1271
1272void ScUndoConversion::Repeat( SfxRepeatTarget& rTarget )
1273{
1274 if( auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget) )
1275 pViewTarget->GetViewShell()->DoSheetConversion( maConvParam );
1276}
1277
1278bool ScUndoConversion::CanRepeat(SfxRepeatTarget& rTarget) const
1279{
1280 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1281}
1282
1284 const ScRange& aMarkRange, const ScMarkData& rMark,
1285 ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc, bool bNewMulti) :
1286ScSimpleUndo( pNewDocShell ),
1287aMarkData ( rMark ),
1288pUndoDoc ( std::move(pNewUndoDoc) ),
1289pRedoDoc ( std::move(pNewRedoDoc) ),
1290aRange ( aMarkRange ),
1291bMulti ( bNewMulti )
1292{
1293 assert(pUndoDoc && pRedoDoc);
1295}
1296
1298{
1299 pUndoDoc.reset();
1300 pRedoDoc.reset();
1301}
1302
1304{
1305 return ScResId( STR_UNDO_ENTERDATA ); // "Input"
1306}
1307
1309{
1311 if ( pChangeTrack )
1312 pChangeTrack->AppendContentsIfInRefDoc( *pUndoDoc,
1314 else
1316}
1317
1319{
1320 ScDocument& rDoc = pDocShell->GetDocument();
1321
1323
1325
1326 ScRange aCopyRange = aRange;
1327 SCTAB nTabCount = rDoc.GetTableCount();
1328 aCopyRange.aStart.SetTab(0);
1329 aCopyRange.aEnd.SetTab(nTabCount-1);
1330 pRefDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, rDoc, &aMarkData );
1334 if (pViewShell)
1335 pViewShell->CellContentChanged();
1336}
1337
1339{
1340 BeginUndo();
1341 if (pUndoDoc)
1342 DoChange(pUndoDoc.get());
1344 if ( pChangeTrack )
1345 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1346 EndUndo();
1347}
1348
1350{
1351 BeginRedo();
1352 if (pRedoDoc)
1353 DoChange(pRedoDoc.get());
1355 EndRedo();
1356}
1357
1358void ScUndoRefConversion::Repeat(SfxRepeatTarget& rTarget)
1359{
1360 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1361 pViewTarget->GetViewShell()->DoRefConversion();
1362}
1363
1364bool ScUndoRefConversion::CanRepeat(SfxRepeatTarget& rTarget) const
1365{
1366 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1367}
1368
1370 ScDocumentUniquePtr pNewUndoDoc)
1371 : ScSimpleUndo(pNewDocShell)
1372 , xUndoDoc(std::move(pNewUndoDoc))
1373{
1374}
1375
1377{
1378 return ScResId( STR_UNDO_UPDATELINK );
1379}
1380
1382{
1383 BeginUndo();
1384
1385 bool bMakeRedo = !xRedoDoc;
1386 if (bMakeRedo)
1388
1389 bool bFirst = true;
1390 ScDocument& rDoc = pDocShell->GetDocument();
1391 SCTAB nCount = rDoc.GetTableCount();
1392 for (SCTAB nTab=0; nTab<nCount; nTab++)
1393 if (xUndoDoc->HasTable(nTab))
1394 {
1395 ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab);
1396 if (bMakeRedo)
1397 {
1398 if (bFirst)
1399 xRedoDoc->InitUndo(rDoc, nTab, nTab, true, true);
1400 else
1401 xRedoDoc->AddUndoTab(nTab, nTab, true, true);
1402 bFirst = false;
1403 rDoc.CopyToDocument(aRange, InsertDeleteFlags::ALL, false, *xRedoDoc);
1404 xRedoDoc->SetLink(nTab,
1405 rDoc.GetLinkMode(nTab),
1406 rDoc.GetLinkDoc(nTab),
1407 rDoc.GetLinkFlt(nTab),
1408 rDoc.GetLinkOpt(nTab),
1409 rDoc.GetLinkTab(nTab),
1410 rDoc.GetLinkRefreshDelay(nTab));
1411 xRedoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
1412 }
1413
1415 xUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, false, rDoc);
1416 rDoc.SetLink(nTab, xUndoDoc->GetLinkMode(nTab), xUndoDoc->GetLinkDoc(nTab),
1417 xUndoDoc->GetLinkFlt(nTab), xUndoDoc->GetLinkOpt(nTab),
1418 xUndoDoc->GetLinkTab(nTab),
1419 xUndoDoc->GetLinkRefreshDelay(nTab) );
1420 rDoc.SetTabBgColor(nTab, xUndoDoc->GetTabBgColor(nTab));
1421 }
1422
1425
1426 EndUndo();
1427}
1428
1430{
1431 OSL_ENSURE(xRedoDoc, "No RedoDoc for ScUndoRefreshLink::Redo");
1432
1433 BeginUndo();
1434
1435 ScDocument& rDoc = pDocShell->GetDocument();
1436 SCTAB nCount = rDoc.GetTableCount();
1437 for (SCTAB nTab=0; nTab<nCount; nTab++)
1438 if (xRedoDoc->HasTable(nTab))
1439 {
1440 ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab);
1441
1442 rDoc.DeleteAreaTab( aRange, InsertDeleteFlags::ALL );
1443 xRedoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, false, rDoc);
1444 rDoc.SetLink(nTab,
1445 xRedoDoc->GetLinkMode(nTab),
1446 xRedoDoc->GetLinkDoc(nTab),
1447 xRedoDoc->GetLinkFlt(nTab),
1448 xRedoDoc->GetLinkOpt(nTab),
1449 xRedoDoc->GetLinkTab(nTab),
1450 xRedoDoc->GetLinkRefreshDelay(nTab) );
1451 rDoc.SetTabBgColor(nTab, xRedoDoc->GetTabBgColor(nTab));
1452 }
1453
1456
1457 EndUndo();
1458}
1459
1460void ScUndoRefreshLink::Repeat(SfxRepeatTarget& /* rTarget */)
1461{
1462 // makes no sense
1463}
1464
1465bool ScUndoRefreshLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1466{
1467 return false;
1468}
1469
1470static ScAreaLink* lcl_FindAreaLink( const sfx2::LinkManager* pLinkManager, std::u16string_view rDoc,
1471 std::u16string_view rFlt, std::u16string_view rOpt,
1472 std::u16string_view rSrc, const ScRange& rDest )
1473{
1474 const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
1475 sal_uInt16 nCount = pLinkManager->GetLinks().size();
1476 for (sal_uInt16 i=0; i<nCount; i++)
1477 {
1478 ::sfx2::SvBaseLink* pBase = rLinks[i].get();
1479 if (auto pAreaLink = dynamic_cast<ScAreaLink*>( pBase))
1480 if ( pAreaLink->IsEqual( rDoc, rFlt, rOpt, rSrc, rDest ) )
1481 return pAreaLink;
1482 }
1483
1484 OSL_FAIL("ScAreaLink not found");
1485 return nullptr;
1486}
1487
1489 OUString aDoc,
1490 OUString aFlt, OUString aOpt,
1491 OUString aArea, const ScRange& rDestRange,
1492 sal_uLong nRefresh )
1493 : ScSimpleUndo ( pShell ),
1494 aDocName (std::move( aDoc )),
1495 aFltName (std::move( aFlt )),
1496 aOptions (std::move( aOpt )),
1497 aAreaName (std::move( aArea )),
1498 aRange ( rDestRange ),
1499 nRefreshDelay ( nRefresh )
1500{
1501}
1502
1504{
1505}
1506
1508{
1509 return ScResId( STR_UNDO_INSERTAREALINK );
1510}
1511
1513{
1514 ScDocument& rDoc = pDocShell->GetDocument();
1515 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1516
1518 aAreaName, aRange );
1519 if (pLink)
1520 pLinkManager->Remove( pLink );
1521
1522 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1523}
1524
1526{
1527 ScDocument& rDoc = pDocShell->GetDocument();
1528 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1529
1532 pLink->SetInCreate( true );
1533 pLink->SetDestArea( aRange );
1535 pLink->Update();
1536 pLink->SetInCreate( false );
1537
1538 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1539}
1540
1541void ScUndoInsertAreaLink::Repeat(SfxRepeatTarget& /* rTarget */)
1542{
1543 // makes no sense
1544}
1545
1546bool ScUndoInsertAreaLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1547{
1548 return false;
1549}
1550
1552 OUString aDoc, OUString aFlt, OUString aOpt,
1553 OUString aArea, const ScRange& rDestRange,
1554 sal_uLong nRefresh )
1555 : ScSimpleUndo ( pShell ),
1556 aDocName (std::move( aDoc )),
1557 aFltName (std::move( aFlt )),
1558 aOptions (std::move( aOpt )),
1559 aAreaName (std::move( aArea )),
1560 aRange ( rDestRange ),
1561 nRefreshDelay ( nRefresh )
1562{
1563}
1564
1566{
1567}
1568
1570{
1571 return ScResId( STR_UNDO_REMOVELINK );
1572}
1573
1575{
1576 ScDocument& rDoc = pDocShell->GetDocument();
1577 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1578
1581 pLink->SetInCreate( true );
1582 pLink->SetDestArea( aRange );
1584 pLink->Update();
1585 pLink->SetInCreate( false );
1586
1587 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1588}
1589
1591{
1592 ScDocument& rDoc = pDocShell->GetDocument();
1593 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1594
1596 aAreaName, aRange );
1597 if (pLink)
1598 pLinkManager->Remove( pLink );
1599
1600 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1601}
1602
1603void ScUndoRemoveAreaLink::Repeat(SfxRepeatTarget& /* rTarget */)
1604{
1605 // makes no sense
1606}
1607
1608bool ScUndoRemoveAreaLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1609{
1610 return false;
1611}
1612
1614 OUString aOldD, OUString aOldF, OUString aOldO,
1615 OUString aOldA, const ScRange& rOldR, sal_uLong nOldRD,
1616 OUString aNewD, OUString aNewF, OUString aNewO,
1617 OUString aNewA, const ScRange& rNewR, sal_uLong nNewRD,
1618 ScDocumentUniquePtr pUndo, ScDocumentUniquePtr pRedo, bool bDoInsert )
1619 : ScSimpleUndo( pShell ),
1620 aOldDoc (std::move( aOldD )),
1621 aOldFlt (std::move( aOldF )),
1622 aOldOpt (std::move( aOldO )),
1623 aOldArea (std::move( aOldA )),
1624 aOldRange ( rOldR ),
1625 aNewDoc (std::move( aNewD )),
1626 aNewFlt (std::move( aNewF )),
1627 aNewOpt (std::move( aNewO )),
1628 aNewArea (std::move( aNewA )),
1629 aNewRange ( rNewR ),
1630 xUndoDoc ( std::move(pUndo) ),
1631 xRedoDoc ( std::move(pRedo) ),
1632 nOldRefresh ( nOldRD ),
1633 nNewRefresh ( nNewRD ),
1634 bWithInsert ( bDoInsert )
1635{
1636 OSL_ENSURE( aOldRange.aStart == aNewRange.aStart, "AreaLink moved ?" );
1637}
1638
1640{
1641 return ScResId( STR_UNDO_UPDATELINK );
1642}
1643
1644void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
1645{
1646 ScDocument& rDoc = pDocShell->GetDocument();
1647
1648 SCCOL nEndX = std::max( aOldRange.aEnd.Col(), aNewRange.aEnd.Col() );
1649 SCROW nEndY = std::max( aOldRange.aEnd.Row(), aNewRange.aEnd.Row() );
1650 SCTAB nEndZ = std::max( aOldRange.aEnd.Tab(), aNewRange.aEnd.Tab() ); //?
1651
1652 if ( bUndo )
1653 {
1654 if ( bWithInsert )
1655 {
1656 rDoc.FitBlock( aNewRange, aOldRange );
1658 xUndoDoc->UndoToDocument(aOldRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1659 }
1660 else
1661 {
1662 ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
1664 xUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1665 }
1666 }
1667 else
1668 {
1669 if ( bWithInsert )
1670 {
1671 rDoc.FitBlock( aOldRange, aNewRange );
1673 xRedoDoc->CopyToDocument(aNewRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1674 }
1675 else
1676 {
1677 ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
1679 xRedoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1680 }
1681 }
1682
1683 ScRange aWorkRange( aNewRange.aStart, ScAddress( nEndX, nEndY, nEndZ ) );
1684 rDoc.ExtendMerge( aWorkRange, true );
1685
1686 // Paint
1687
1688 if ( aNewRange.aEnd.Col() != aOldRange.aEnd.Col() )
1689 aWorkRange.aEnd.SetCol(rDoc.MaxCol());
1690 if ( aNewRange.aEnd.Row() != aOldRange.aEnd.Row() )
1691 aWorkRange.aEnd.SetRow(rDoc.MaxRow());
1692
1693 if ( !pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), aWorkRange.aStart.Tab() ) )
1695
1698 if (pViewShell)
1699 pViewShell->CellContentChanged();
1700}
1701
1703{
1704 ScDocument& rDoc = pDocShell->GetDocument();
1705 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1708 if (pLink)
1709 {
1710 pLink->SetSource( aOldDoc, aOldFlt, aOldOpt, aOldArea ); // old data in Link
1711 pLink->SetDestArea( aOldRange );
1712 pLink->SetRefreshDelay( nOldRefresh );
1713 }
1714
1715 DoChange(true);
1716}
1717
1719{
1720 ScDocument& rDoc = pDocShell->GetDocument();
1721 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1724 if (pLink)
1725 {
1726 pLink->SetSource( aNewDoc, aNewFlt, aNewOpt, aNewArea ); // new values in link
1727 pLink->SetDestArea( aNewRange );
1728 pLink->SetRefreshDelay( nNewRefresh );
1729 }
1730
1731 DoChange(false);
1732}
1733
1734void ScUndoUpdateAreaLink::Repeat(SfxRepeatTarget& /* rTarget */)
1735{
1736 // makes no sense
1737}
1738
1739bool ScUndoUpdateAreaLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1740{
1741 return false;
1742}
1743
1744/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SCTAB MAXTAB
Definition: address.hxx:70
SfxApplication * SfxGetpApp()
std::unique_ptr< EditTextObject > CreateTextObject()
SCTAB Tab() const
Definition: address.hxx:283
void SetCol(SCCOL nColP)
Definition: address.hxx:291
SCROW Row() const
Definition: address.hxx:274
void SetRow(SCROW nRowP)
Definition: address.hxx:287
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
SCCOL Col() const
Definition: address.hxx:279
ScRange aBlockRange
Definition: undobase.hxx:90
void EndRedo()
Definition: undobase.cxx:276
void BeginUndo()
Definition: undobase.cxx:258
void EndUndo()
Definition: undobase.cxx:264
void SetOldValue(const ScCellValue &rCell, const ScDocument *pFromDoc, ScDocument *pToDoc, sal_uLong nFormat)
Definition: chgtrack.cxx:1321
void SetNewValue(const ScCellValue &rCell, ScDocument *pDoc)
Definition: chgtrack.cxx:1333
void Append(ScChangeAction *pAppend, sal_uLong nAction)
Definition: chgtrack.cxx:2336
void AppendContentsIfInRefDoc(ScDocument &rRefDoc, sal_uLong &nStartAction, sal_uLong &nEndAction)
Definition: chgtrack.cxx:2727
void AppendContentRange(const ScRange &rRange, ScDocument *pRefDoc, sal_uLong &nStartAction, sal_uLong &nEndAction, ScChangeActionClipMode eMode=SC_CACM_NONE)
Definition: chgtrack.cxx:2631
sal_uLong GetActionMax() const
Definition: chgtrack.hxx:953
SC_DLLPUBLIC void Undo(sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge=false)
Definition: chgtrack.cxx:3044
Parameters for conversion.
Definition: spellparam.hxx:33
ScConversionType GetType() const
Definition: spellparam.hxx:54
void PostPaintGridAll()
Definition: docsh3.cxx:183
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void UpdatePaintExt(sal_uInt16 &rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab)
Definition: docsh3.cxx:228
void PostDataChanged()
Definition: docsh3.cxx:93
void PostPaintExtras()
Definition: docsh3.cxx:198
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:101
static ScViewData * GetViewData()
Definition: docsh4.cxx:2607
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
Definition: docsh5.cxx:405
static SCTAB GetCurTab()
Definition: docsh4.cxx:2614
void SetEmptyCell(const ScAddress &rPos)
Definition: document.cxx:3471
SC_DLLPUBLIC bool SetEditText(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
This method manages the lifecycle of the passed edit text object.
Definition: document.cxx:3422
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:898
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:530
SC_DLLPUBLIC void Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScProgress *pProgress, const ScMarkData &rMark, sal_uInt64 nFillCount, FillDir eFillDir=FILL_TO_BOTTOM, FillCmd eFillCmd=FILL_LINEAR, FillDateCmd eFillDateCmd=FILL_DAY, double nStepValue=1.0, double nMaxValue=1E307)
Definition: documen3.cxx:1156
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5556
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:449
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
SC_DLLPUBLIC void DoMergeContents(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
Definition: documen3.cxx:2026
OUString GetLinkOpt(SCTAB nTab) const
Definition: documen3.cxx:523
SC_DLLPUBLIC bool SetOptimalHeight(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bApi)
Definition: document.cxx:4267
void FillTabMarked(SCTAB nSrcTab, const ScMarkData &rMark, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink)
Definition: document.cxx:3325
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6050
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
Definition: documen2.cxx:483
SC_DLLPUBLIC void DoMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bDeleteCaptions=true)
Definition: documen3.cxx:2063
void BroadcastCells(const ScRange &rRange, SfxHintId nHint, bool bBroadcastSingleBroadcasters=true)
Definition: documen7.cxx:158
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Definition: document.cxx:6587
SC_DLLPUBLIC void DeleteSelection(InsertDeleteFlags nDelFlag, const ScMarkData &rMark, bool bBroadcast=true)
Definition: document.cxx:5921
void RemoveMerge(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: documen3.cxx:2080
SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow)
Definition: document.cxx:4297
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3391
void ReplaceStyle(const SvxSearchItem &rSearchItem, SCCOL nCol, SCROW nRow, SCTAB nTab, const ScMarkData &rMark)
Definition: documen4.cxx:546
void DeleteSelectionTab(SCTAB nTab, InsertDeleteFlags nDelFlag, const ScMarkData &rMark)
Definition: document.cxx:5979
SC_DLLPUBLIC void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData &rMark, InsertDeleteFlags nDelFlag, bool bBroadcast=true, sc::ColumnSpanSet *pBroadcastSpans=nullptr)
Definition: document.cxx:1859
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
Definition: documen9.cxx:203
SC_DLLPUBLIC void ApplySelectionPattern(const ScPatternAttr &rAttr, const ScMarkData &rMark, ScEditDataArray *pDataArray=nullptr, bool *pIsChanged=nullptr)
Definition: document.cxx:5864
sal_uInt16 GetOptimalColWidth(SCCOL nCol, SCTAB nTab, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY, bool bFormula, const ScMarkData *pMarkData=nullptr, const ScColWidthParam *pParam=nullptr)
Definition: document.cxx:4240
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4416
SC_DLLPUBLIC CRFlags GetRowFlags(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4335
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:502
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5161
void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, InsertDeleteFlags nFlags, bool bMarked, ScDocument &rDestDoc, const ScMarkData *pMarks=nullptr, bool bColRowFlags=true)
Definition: document.cxx:2041
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3477
void ApplySelectionFrame(const ScMarkData &rMark, const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner)
Definition: document.cxx:5743
void FitBlock(const ScRange &rOld, const ScRange &rNew, bool bClear=true)
Definition: document.cxx:1827
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
Definition: document.cxx:4741
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1083
sal_uLong GetLinkRefreshDelay(SCTAB nTab) const
Definition: documen3.cxx:537
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
Definition: documen3.cxx:544
SC_DLLPUBLIC void SetRowFlags(SCROW nRow, SCTAB nTab, CRFlags nNewFlags)
Definition: document.cxx:4315
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4430
void AutoFormat(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_uInt16 nFormatNo, const ScMarkData &rMark)
Definition: documen3.cxx:1187
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
Definition: document.cxx:1920
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:509
SC_DLLPUBLIC void SetColWidth(SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth)
Definition: document.cxx:4086
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2494
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3736
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:231
SC_DLLPUBLIC void SetTabBgColor(SCTAB nTab, const Color &rColor)
Definition: documen3.cxx:456
OUString GetLinkFlt(SCTAB nTab) const
Definition: documen3.cxx:516
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:619
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:589
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:591
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:174
bool IsMultiMarked() const
Definition: markdata.hxx:81
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:169
void MarkToMulti()
Definition: markdata.cxx:209
bool IsMarked() const
Definition: markdata.hxx:80
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:92
void MarkToSimple()
Definition: markdata.cxx:222
Additional class containing cell annotation data.
Definition: postit.hxx:58
void SetText(const ScAddress &rPos, const OUString &rText)
Changes the caption text of this note.
Definition: postit.cxx:548
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
void BroadcastChanges(const ScRange &rRange)
Definition: undobase.cxx:177
void BeginRedo()
Definition: undobase.cxx:145
static void ShowTable(SCTAB nTab)
Definition: undobase.cxx:224
void EndRedo()
Definition: undobase.cxx:154
bool SetViewMarkData(const ScMarkData &rMarkData)
Definition: undobase.cxx:55
void EndUndo()
Definition: undobase.cxx:125
ScDocShell * pDocShell
Definition: undobase.hxx:50
void BeginUndo()
Definition: undobase.cxx:90
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1076
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:509
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1191
ScViewData & GetViewData()
Definition: tabview.hxx:344
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:513
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1819
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:414
sal_uLong nEndChangeAction
Definition: undoblk.hxx:422
void SetChangeTrack()
Definition: undoblk3.cxx:512
ScUndoAutoFill(ScDocShell *pNewDocShell, const ScRange &rRange, const ScRange &rSourceArea, ScDocumentUniquePtr pNewUndoDoc, const ScMarkData &rMark, FillDir eNewFillDir, FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd, double fNewStartValue, double fNewStepValue, double fNewMaxValue)
Definition: undoblk3.cxx:484
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:620
virtual void Redo() override
Definition: undoblk3.cxx:563
ScMarkData aMarkData
Definition: undoblk.hxx:412
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:633
virtual OUString GetComment() const override
Definition: undoblk3.cxx:507
FillDateCmd eFillDateCmd
Definition: undoblk.hxx:417
FillCmd eFillCmd
Definition: undoblk.hxx:416
double fStartValue
Definition: undoblk.hxx:418
virtual void Undo() override
Definition: undoblk3.cxx:522
FillDir eFillDir
Definition: undoblk.hxx:415
double fStepValue
Definition: undoblk.hxx:419
virtual ~ScUndoAutoFill() override
Definition: undoblk3.cxx:503
ScRange aSource
Definition: undoblk.hxx:411
double fMaxValue
Definition: undoblk.hxx:420
sal_uLong nStartChangeAction
Definition: undoblk.hxx:421
ScMarkData aMarkData
Definition: undoblk.hxx:470
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:907
virtual OUString GetComment() const override
Definition: undoblk3.cxx:783
virtual void Redo() override
Definition: undoblk3.cxx:826
virtual ~ScUndoAutoFormat() override
Definition: undoblk3.cxx:779
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:913
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:469
virtual void Undo() override
Definition: undoblk3.cxx:788
ScUndoAutoFormat(ScDocShell *pNewDocShell, const ScRange &rRange, ScDocumentUniquePtr pNewUndoDoc, const ScMarkData &rMark, bool bNewSize, sal_uInt16 nNewFormatNo)
Definition: undoblk3.cxx:768
sal_uInt16 nFormatNo
Definition: undoblk.hxx:472
ScDocumentUniquePtr pRedoDoc
Definition: undoblk.hxx:558
ScAddress aCursorPos
Definition: undoblk.hxx:555
void DoChange(ScDocument *pRefDoc, const ScAddress &rCursorPos)
Conversion type and parameters.
Definition: undoblk3.cxx:1225
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:556
virtual void Undo() override
Definition: undoblk3.cxx:1254
virtual OUString GetComment() const override
Definition: undoblk3.cxx:1212
sal_uLong nStartChangeAction
Definition: undoblk.hxx:559
ScAddress aNewCursorPos
Definition: undoblk.hxx:557
void SetChangeTrack()
Definition: undoblk3.cxx:1193
ScUndoConversion(ScDocShell *pNewDocShell, const ScMarkData &rMark, SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScDocumentUniquePtr pNewUndoDoc, SCCOL nNewX, SCROW nNewY, SCTAB nNewZ, ScDocumentUniquePtr pNewRedoDoc, ScConversionParam aConvParam)
Definition: undoblk3.cxx:1171
sal_uLong nEndChangeAction
Definition: undoblk.hxx:560
ScConversionParam maConvParam
Definition: undoblk.hxx:561
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:1278
virtual void Redo() override
Definition: undoblk3.cxx:1264
ScMarkData aMarkData
Definition: undoblk.hxx:554
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:1272
virtual ~ScUndoConversion() override
Definition: undoblk3.cxx:1187
void DoChange(const bool bUndo)
Definition: undoblk3.cxx:106
ScMarkData aMarkData
Definition: undoblk.hxx:271
sal_uLong nStartChangeAction
Definition: undoblk.hxx:274
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:201
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:272
virtual void Redo() override
Definition: undoblk3.cxx:186
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:195
std::shared_ptr< DataSpansType > mpDataSpans
Definition: undoblk.hxx:268
virtual void Undo() override
Definition: undoblk3.cxx:177
virtual ~ScUndoDeleteContents() override
Definition: undoblk3.cxx:80
InsertDeleteFlags nFlags
Definition: undoblk.hxx:276
sal_uLong nEndChangeAction
Definition: undoblk.hxx:275
std::unique_ptr< SdrUndoAction > pDrawUndo
Definition: undoblk.hxx:273
virtual OUString GetComment() const override
Definition: undoblk3.cxx:86
void SetDataSpans(const std::shared_ptr< DataSpansType > &pSpans)
Definition: undoblk3.cxx:91
ScUndoDeleteContents(ScDocShell *pNewDocShell, const ScMarkData &rMark, const ScRange &rRange, ScDocumentUniquePtr &&pNewUndoDoc, bool bNewMulti, InsertDeleteFlags nNewFlags, bool bObjects)
Definition: undoblk3.cxx:59
InsertDeleteFlags nFlags
Definition: undoblk.hxx:308
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:337
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:331
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:305
ScMarkData aMarkData
Definition: undoblk.hxx:303
virtual ~ScUndoFillTable() override
Definition: undoblk3.cxx:226
virtual void Undo() override
Definition: undoblk3.cxx:317
ScRange aRange
Definition: undoblk.hxx:302
ScPasteFunc nFunction
Definition: undoblk.hxx:309
virtual void Redo() override
Definition: undoblk3.cxx:324
ScUndoFillTable(ScDocShell *pNewDocShell, const ScMarkData &rMark, SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti, SCTAB nSrc, InsertDeleteFlags nFlg, ScPasteFunc nFunc, bool bSkip, bool bLink)
Definition: undoblk3.cxx:206
void DoChange(const bool bUndo)
Definition: undoblk3.cxx:263
sal_uLong nStartChangeAction
Definition: undoblk.hxx:306
virtual OUString GetComment() const override
Definition: undoblk3.cxx:230
void SetChangeTrack()
Definition: undoblk3.cxx:235
sal_uLong nEndChangeAction
Definition: undoblk.hxx:307
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:753
virtual ~ScUndoMerge() override
Definition: undoblk3.cxx:648
ScCellMergeOption maOption
Definition: undoblk.hxx:443
virtual void Redo() override
Definition: undoblk3.cxx:746
ScDocumentUniquePtr mxUndoDoc
Definition: undoblk.hxx:445
virtual OUString GetComment() const override
Definition: undoblk3.cxx:653
bool mbMergeContents
Definition: undoblk.hxx:444
ScUndoMerge(ScDocShell *pNewDocShell, ScCellMergeOption aOption, bool bMergeContents, ScDocumentUniquePtr pUndoDoc, std::unique_ptr< SdrUndoAction > pDrawUndo)
Definition: undoblk3.cxx:638
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:763
void DoChange(bool bUndo) const
Definition: undoblk3.cxx:658
virtual void Undo() override
Definition: undoblk3.cxx:739
std::unique_ptr< SdrUndoAction > mpDrawUndo
Definition: undoblk.hxx:446
virtual void Redo() override
Definition: undoblk3.cxx:1349
virtual OUString GetComment() const override
Definition: undoblk3.cxx:1303
sal_uLong nEndChangeAction
Definition: undoblk.hxx:589
ScMarkData aMarkData
Definition: undoblk.hxx:583
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:584
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:1364
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:1358
ScDocumentUniquePtr pRedoDoc
Definition: undoblk.hxx:585
void DoChange(ScDocument *pRefDoc)
Definition: undoblk3.cxx:1318
virtual void Undo() override
Definition: undoblk3.cxx:1338
sal_uLong nStartChangeAction
Definition: undoblk.hxx:588
ScUndoRefConversion(ScDocShell *pNewDocShell, const ScRange &aMarkRange, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc, bool bNewMulti)
Definition: undoblk3.cxx:1283
virtual ~ScUndoRefConversion() override
Definition: undoblk3.cxx:1297
ScAddress aCursorPos
Definition: undoblk.hxx:493
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:1086
virtual OUString GetComment() const override
Definition: undoblk3.cxx:967
virtual void Redo() override
Definition: undoblk3.cxx:1050
OUString aUndoStr
Definition: undoblk.hxx:495
std::unique_ptr< SvxSearchItem > pSearchItem
Definition: undoblk.hxx:497
sal_uLong nStartChangeAction
Definition: undoblk.hxx:498
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:1092
virtual ~ScUndoReplace() override
Definition: undoblk3.cxx:932
void SetChangeTrack()
Definition: undoblk3.cxx:938
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:496
ScMarkData aMarkData
Definition: undoblk.hxx:494
ScUndoReplace(ScDocShell *pNewDocShell, const ScMarkData &rMark, SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, OUString aNewUndoStr, ScDocumentUniquePtr pNewUndoDoc, const SvxSearchItem *pItem)
Definition: undoblk3.cxx:918
virtual void Undo() override
Definition: undoblk3.cxx:972
sal_uLong nEndChangeAction
Definition: undoblk.hxx:499
virtual void Redo() override
Definition: undoblk3.cxx:460
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:479
ScUndoSelectionAttr(ScDocShell *pNewDocShell, const ScMarkData &rMark, SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti, const ScPatternAttr *pNewApply, const SvxBoxItem *pNewOuter=nullptr, const SvxBoxInfoItem *pNewInner=nullptr, const ScRange *pRangeCover=nullptr)
Definition: undoblk3.cxx:342
SvxBoxInfoItem * pLineInner
Definition: undoblk.hxx:350
virtual OUString GetComment() const override
Definition: undoblk3.cxx:376
virtual ~ScUndoSelectionAttr() override
Definition: undoblk3.cxx:364
SvxBoxItem * pLineOuter
Definition: undoblk.hxx:349
std::unique_ptr< ScEditDataArray > mpDataArray
Definition: undoblk.hxx:345
ScPatternAttr * pApplyPattern
Definition: undoblk.hxx:348
virtual void Undo() override
Definition: undoblk3.cxx:453
void DoChange(const bool bUndo)
Definition: undoblk3.cxx:387
ScMarkData aMarkData
Definition: undoblk.hxx:342
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:346
void ChangeEditData(const bool bUndo)
Definition: undoblk3.cxx:427
ScEditDataArray * GetDataArray()
Definition: undoblk3.cxx:382
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:467
ScRefAddress theColCell
Definition: undoblk.hxx:532
virtual OUString GetComment() const override
Definition: undoblk3.cxx:1121
virtual ~ScUndoTabOp() override
Definition: undoblk3.cxx:1117
ScRefAddress theRowCell
Definition: undoblk.hxx:531
ScRange aRange
Definition: undoblk.hxx:526
ScTabOpParam::Mode meMode
Definition: undoblk.hxx:533
ScUndoTabOp(ScDocShell *pNewDocShell, SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, ScDocumentUniquePtr pNewUndoDoc, const ScRefAddress &rFormulaCell, const ScRefAddress &rFormulaEnd, const ScRefAddress &rRowCell, const ScRefAddress &rColCell, ScTabOpParam::Mode eMode)
Definition: undoblk3.cxx:1098
virtual void Redo() override
Definition: undoblk3.cxx:1147
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:1162
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:528
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk3.cxx:1166
ScRefAddress theFormulaEnd
Definition: undoblk.hxx:530
ScRefAddress theFormulaCell
Definition: undoblk.hxx:529
virtual void Undo() override
Definition: undoblk3.cxx:1126
static void PaintMore(ScDocShell *pDocShell, const ScRange &rRange)
Definition: undoutil.cxx:97
static void MarkSimpleBlock(const ScDocShell *pDocShell, SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, SCCOL nEndX, SCROW nEndY, SCTAB nEndZ)
Mark Block (invisible - has to be repainted)
Definition: undoutil.cxx:31
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
double GetPPTY() const
Definition: viewdata.hxx:469
const Fraction & GetZoomX() const
Definition: viewdata.hxx:459
double GetPPTX() const
Definition: viewdata.hxx:468
void TabOp(const ScTabOpParam &rParam, bool bRecord=true)
Definition: viewfun2.cxx:2317
SC_DLLPUBLIC void FillSimple(FillDir eDir)
Definition: viewfun2.cxx:1395
void FillSeries(FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, double fStart, double fStep, double fMax)
Definition: viewfun2.cxx:1444
void ApplyPatternLines(const ScPatternAttr &rAttr, const SvxBoxItem &rNewOuter, const SvxBoxInfoItem *pNewInner)
Definition: viewfunc.cxx:1114
void ApplySelectionPattern(const ScPatternAttr &rAttr, bool bCursorOnly=false)
Definition: viewfunc.cxx:1227
bool MergeCells(bool bApi, bool &rDoContents, bool bCenter)
Definition: viewfun2.cxx:1179
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:115
bool SearchAndReplace(const SvxSearchItem *pSearchItem, bool bAddUndo, bool bIsApi)
Definition: viewfun2.cxx:1942
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, bool bApi)
Definition: viewfun2.cxx:193
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
void Remove(const SfxPoolItem &)
SfxViewShell * GetViewShell() const
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
void Remove(SvBaseLink const *pLink)
const SvBaseLinks & GetLinks() const
ColorMode meMode
int nCount
constexpr double nPPTX
constexpr double nPPTY
#define SC_PF_LINES
Definition: docsh.hxx:76
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2720
@ SCDOCMODE_UNDO
Definition: document.hxx:258
FilterGroup & rTarget
@ CELLTYPE_EDIT
Definition: global.hxx:277
ScPasteFunc
Definition: global.hxx:181
InsertDeleteFlags
Definition: global.hxx:149
@ SPARKLINES
Sheet / outlining (grouping) information.
@ NOTE
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
@ NOCAPTIONS
Sparklines in a cell.
@ EDITATTR
Drawing objects.
@ AUTOFILL
Copy flags for auto/series fill functions: do not touch notes and drawing objects.
@ OBJECTS
Cell styles.
@ STRING
Dates, times, datetime values.
@ ATTRIB
Internal use only (d&d undo): do not delete caption objects of cell notes.
FillDateCmd
Definition: global.hxx:334
constexpr sal_Int32 STD_EXTRA_WIDTH
Definition: global.hxx:88
#define MAXDOUBLE
Definition: global.hxx:77
CRFlags
Definition: global.hxx:125
FillCmd
Definition: global.hxx:317
@ FILL_SIMPLE
Definition: global.hxx:318
FillDir
Definition: global.hxx:309
@ FILL_TO_TOP
Definition: global.hxx:312
@ FILL_TO_RIGHT
Definition: global.hxx:311
@ FILL_TO_LEFT
Definition: global.hxx:313
@ FILL_TO_BOTTOM
Definition: global.hxx:310
Mode eMode
SvBaseLink * pLink
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
Definition: docsh.hxx:506
int i
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
sal_uIntPtr sal_uLong
@ SC_CONVERSION_CHINESE_TRANSL
Hangul-Hanja converter.
Definition: spellparam.hxx:28
@ SC_CONVERSION_SPELLCHECK
Definition: spellparam.hxx:26
@ SC_CONVERSION_HANGULHANJA
Spell checker.
Definition: spellparam.hxx:27
ScRange getSingleRange(SCTAB nTab) const
::std::set< SCTAB > maTabs
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:32
void assign(const ScDocument &rDoc, const ScAddress &rPos)
Take cell value from specified position in specified document.
Definition: cellvalue.cxx:359
Parameter for data table aka multiple operations.
Definition: paramisc.hxx:46
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
@ SC_UNDO_AUTOHEIGHT
Definition: undobase.hxx:78
@ SC_UNDO_MANUALHEIGHT
Definition: undobase.hxx:78
static ScAreaLink * lcl_FindAreaLink(const sfx2::LinkManager *pLinkManager, std::u16string_view rDoc, std::u16string_view rFlt, std::u16string_view rOpt, std::u16string_view rSrc, const ScRange &rDest)
Definition: undoblk3.cxx:1470
std::unique_ptr< SdrUndoAction > GetSdrUndoAction(ScDocument *pDoc)
Definition: undoolk.cxx:26
void DoSdrUndoAction(SdrUndoAction *pUndoAction, ScDocument *pDoc)
Definition: undoolk.cxx:35
void RedoSdrUndoAction(SdrUndoAction *pUndoAction)
Definition: undoolk.cxx:61
@ SC_FOLLOW_JUMP
Definition: viewdata.hxx:52