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
196{
197 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
198 pViewTarget->GetViewShell()->DeleteContents( nFlags );
199}
200
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
332{
333 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
334 pViewTarget->GetViewShell()->FillTab( nFlags, nFunction, bSkipEmpty, bAsLink );
335}
336
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
468{
469 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
470 {
471 ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
472 if (pLineOuter)
474 else
476 }
477}
478
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
621{
622 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
623 {
624 ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
626 rViewShell.FillSimple( eFillDir );
627 else
630 }
631}
632
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
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
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
908{
909 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
910 pViewTarget->GetViewShell()->AutoFormat( nFormatNo );
911}
912
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
1087{
1088 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1089 pViewTarget->GetViewShell()->SearchAndReplace( pSearchItem.get(), true, false );
1090}
1091
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
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).
1246 }
1247 else
1248 {
1249 OSL_FAIL("no Un-/RedoDoc for Un-/RedoSpelling");
1250 }
1251}
1252
1254{
1255 BeginUndo();
1256 DoChange( pUndoDoc.get(), aCursorPos );
1258 if ( pChangeTrack )
1259 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1260 EndUndo();
1261}
1262
1264{
1265 BeginRedo();
1268 EndRedo();
1269}
1270
1272{
1273 if( auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget) )
1274 pViewTarget->GetViewShell()->DoSheetConversion( maConvParam );
1275}
1276
1278{
1279 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1280}
1281
1283 const ScRange& aMarkRange, const ScMarkData& rMark,
1284 ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc, bool bNewMulti) :
1285ScSimpleUndo( pNewDocShell ),
1286aMarkData ( rMark ),
1287pUndoDoc ( std::move(pNewUndoDoc) ),
1288pRedoDoc ( std::move(pNewRedoDoc) ),
1289aRange ( aMarkRange ),
1290bMulti ( bNewMulti )
1291{
1292 assert(pUndoDoc && pRedoDoc);
1294}
1295
1297{
1298 pUndoDoc.reset();
1299 pRedoDoc.reset();
1300}
1301
1303{
1304 return ScResId( STR_UNDO_ENTERDATA ); // "Input"
1305}
1306
1308{
1310 if ( pChangeTrack )
1311 pChangeTrack->AppendContentsIfInRefDoc( *pUndoDoc,
1313 else
1315}
1316
1318{
1319 ScDocument& rDoc = pDocShell->GetDocument();
1320
1322
1324
1325 ScRange aCopyRange = aRange;
1326 SCTAB nTabCount = rDoc.GetTableCount();
1327 aCopyRange.aStart.SetTab(0);
1328 aCopyRange.aEnd.SetTab(nTabCount-1);
1329 pRefDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, rDoc, &aMarkData );
1333 if (pViewShell)
1334 pViewShell->CellContentChanged();
1335}
1336
1338{
1339 BeginUndo();
1340 if (pUndoDoc)
1341 DoChange(pUndoDoc.get());
1343 if ( pChangeTrack )
1344 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1345 EndUndo();
1346}
1347
1349{
1350 BeginRedo();
1351 if (pRedoDoc)
1352 DoChange(pRedoDoc.get());
1354 EndRedo();
1355}
1356
1358{
1359 if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1360 pViewTarget->GetViewShell()->DoRefConversion();
1361}
1362
1364{
1365 return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1366}
1367
1369 ScDocumentUniquePtr pNewUndoDoc)
1370 : ScSimpleUndo(pNewDocShell)
1371 , xUndoDoc(std::move(pNewUndoDoc))
1372{
1373}
1374
1376{
1377 return ScResId( STR_UNDO_UPDATELINK );
1378}
1379
1381{
1382 BeginUndo();
1383
1384 bool bMakeRedo = !xRedoDoc;
1385 if (bMakeRedo)
1387
1388 bool bFirst = true;
1389 ScDocument& rDoc = pDocShell->GetDocument();
1390 SCTAB nCount = rDoc.GetTableCount();
1391 for (SCTAB nTab=0; nTab<nCount; nTab++)
1392 if (xUndoDoc->HasTable(nTab))
1393 {
1394 ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab);
1395 if (bMakeRedo)
1396 {
1397 if (bFirst)
1398 xRedoDoc->InitUndo(rDoc, nTab, nTab, true, true);
1399 else
1400 xRedoDoc->AddUndoTab(nTab, nTab, true, true);
1401 bFirst = false;
1402 rDoc.CopyToDocument(aRange, InsertDeleteFlags::ALL, false, *xRedoDoc);
1403 xRedoDoc->SetLink(nTab,
1404 rDoc.GetLinkMode(nTab),
1405 rDoc.GetLinkDoc(nTab),
1406 rDoc.GetLinkFlt(nTab),
1407 rDoc.GetLinkOpt(nTab),
1408 rDoc.GetLinkTab(nTab),
1409 rDoc.GetLinkRefreshDelay(nTab));
1410 xRedoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
1411 }
1412
1414 xUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, false, rDoc);
1415 rDoc.SetLink(nTab, xUndoDoc->GetLinkMode(nTab), xUndoDoc->GetLinkDoc(nTab),
1416 xUndoDoc->GetLinkFlt(nTab), xUndoDoc->GetLinkOpt(nTab),
1417 xUndoDoc->GetLinkTab(nTab),
1418 xUndoDoc->GetLinkRefreshDelay(nTab) );
1419 rDoc.SetTabBgColor(nTab, xUndoDoc->GetTabBgColor(nTab));
1420 }
1421
1424
1425 EndUndo();
1426}
1427
1429{
1430 OSL_ENSURE(xRedoDoc, "No RedoDoc for ScUndoRefreshLink::Redo");
1431
1432 BeginUndo();
1433
1434 ScDocument& rDoc = pDocShell->GetDocument();
1435 SCTAB nCount = rDoc.GetTableCount();
1436 for (SCTAB nTab=0; nTab<nCount; nTab++)
1437 if (xRedoDoc->HasTable(nTab))
1438 {
1439 ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab);
1440
1441 rDoc.DeleteAreaTab( aRange, InsertDeleteFlags::ALL );
1442 xRedoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, false, rDoc);
1443 rDoc.SetLink(nTab,
1444 xRedoDoc->GetLinkMode(nTab),
1445 xRedoDoc->GetLinkDoc(nTab),
1446 xRedoDoc->GetLinkFlt(nTab),
1447 xRedoDoc->GetLinkOpt(nTab),
1448 xRedoDoc->GetLinkTab(nTab),
1449 xRedoDoc->GetLinkRefreshDelay(nTab) );
1450 rDoc.SetTabBgColor(nTab, xRedoDoc->GetTabBgColor(nTab));
1451 }
1452
1455
1456 EndUndo();
1457}
1458
1460{
1461 // makes no sense
1462}
1463
1465{
1466 return false;
1467}
1468
1469static ScAreaLink* lcl_FindAreaLink( const sfx2::LinkManager* pLinkManager, std::u16string_view rDoc,
1470 std::u16string_view rFlt, std::u16string_view rOpt,
1471 std::u16string_view rSrc, const ScRange& rDest )
1472{
1473 const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
1474 sal_uInt16 nCount = pLinkManager->GetLinks().size();
1475 for (sal_uInt16 i=0; i<nCount; i++)
1476 {
1477 ::sfx2::SvBaseLink* pBase = rLinks[i].get();
1478 if (auto pAreaLink = dynamic_cast<ScAreaLink*>( pBase))
1479 if ( pAreaLink->IsEqual( rDoc, rFlt, rOpt, rSrc, rDest ) )
1480 return pAreaLink;
1481 }
1482
1483 OSL_FAIL("ScAreaLink not found");
1484 return nullptr;
1485}
1486
1488 OUString aDoc,
1489 OUString aFlt, OUString aOpt,
1490 OUString aArea, const ScRange& rDestRange,
1491 sal_uLong nRefresh )
1492 : ScSimpleUndo ( pShell ),
1493 aDocName (std::move( aDoc )),
1494 aFltName (std::move( aFlt )),
1495 aOptions (std::move( aOpt )),
1496 aAreaName (std::move( aArea )),
1497 aRange ( rDestRange ),
1498 nRefreshDelay ( nRefresh )
1499{
1500}
1501
1503{
1504}
1505
1507{
1508 return ScResId( STR_UNDO_INSERTAREALINK );
1509}
1510
1512{
1513 ScDocument& rDoc = pDocShell->GetDocument();
1514 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1515
1517 aAreaName, aRange );
1518 if (pLink)
1519 pLinkManager->Remove( pLink );
1520
1521 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1522}
1523
1525{
1526 ScDocument& rDoc = pDocShell->GetDocument();
1527 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1528
1531 pLink->SetInCreate( true );
1532 pLink->SetDestArea( aRange );
1534 pLink->Update();
1535 pLink->SetInCreate( false );
1536
1537 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1538}
1539
1541{
1542 // makes no sense
1543}
1544
1546{
1547 return false;
1548}
1549
1551 OUString aDoc, OUString aFlt, OUString aOpt,
1552 OUString aArea, const ScRange& rDestRange,
1553 sal_uLong nRefresh )
1554 : ScSimpleUndo ( pShell ),
1555 aDocName (std::move( aDoc )),
1556 aFltName (std::move( aFlt )),
1557 aOptions (std::move( aOpt )),
1558 aAreaName (std::move( aArea )),
1559 aRange ( rDestRange ),
1560 nRefreshDelay ( nRefresh )
1561{
1562}
1563
1565{
1566}
1567
1569{
1570 return ScResId( STR_UNDO_REMOVELINK );
1571}
1572
1574{
1575 ScDocument& rDoc = pDocShell->GetDocument();
1576 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1577
1580 pLink->SetInCreate( true );
1581 pLink->SetDestArea( aRange );
1583 pLink->Update();
1584 pLink->SetInCreate( false );
1585
1586 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1587}
1588
1590{
1591 ScDocument& rDoc = pDocShell->GetDocument();
1592 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1593
1595 aAreaName, aRange );
1596 if (pLink)
1597 pLinkManager->Remove( pLink );
1598
1599 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator
1600}
1601
1603{
1604 // makes no sense
1605}
1606
1608{
1609 return false;
1610}
1611
1613 OUString aOldD, OUString aOldF, OUString aOldO,
1614 OUString aOldA, const ScRange& rOldR, sal_uLong nOldRD,
1615 OUString aNewD, OUString aNewF, OUString aNewO,
1616 OUString aNewA, const ScRange& rNewR, sal_uLong nNewRD,
1617 ScDocumentUniquePtr pUndo, ScDocumentUniquePtr pRedo, bool bDoInsert )
1618 : ScSimpleUndo( pShell ),
1619 aOldDoc (std::move( aOldD )),
1620 aOldFlt (std::move( aOldF )),
1621 aOldOpt (std::move( aOldO )),
1622 aOldArea (std::move( aOldA )),
1623 aOldRange ( rOldR ),
1624 aNewDoc (std::move( aNewD )),
1625 aNewFlt (std::move( aNewF )),
1626 aNewOpt (std::move( aNewO )),
1627 aNewArea (std::move( aNewA )),
1628 aNewRange ( rNewR ),
1629 xUndoDoc ( std::move(pUndo) ),
1630 xRedoDoc ( std::move(pRedo) ),
1631 nOldRefresh ( nOldRD ),
1632 nNewRefresh ( nNewRD ),
1633 bWithInsert ( bDoInsert )
1634{
1635 OSL_ENSURE( aOldRange.aStart == aNewRange.aStart, "AreaLink moved ?" );
1636}
1637
1639{
1640 return ScResId( STR_UNDO_UPDATELINK );
1641}
1642
1643void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
1644{
1645 ScDocument& rDoc = pDocShell->GetDocument();
1646
1647 SCCOL nEndX = std::max( aOldRange.aEnd.Col(), aNewRange.aEnd.Col() );
1648 SCROW nEndY = std::max( aOldRange.aEnd.Row(), aNewRange.aEnd.Row() );
1649 SCTAB nEndZ = std::max( aOldRange.aEnd.Tab(), aNewRange.aEnd.Tab() ); //?
1650
1651 if ( bUndo )
1652 {
1653 if ( bWithInsert )
1654 {
1655 rDoc.FitBlock( aNewRange, aOldRange );
1657 xUndoDoc->UndoToDocument(aOldRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1658 }
1659 else
1660 {
1661 ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
1663 xUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1664 }
1665 }
1666 else
1667 {
1668 if ( bWithInsert )
1669 {
1670 rDoc.FitBlock( aOldRange, aNewRange );
1672 xRedoDoc->CopyToDocument(aNewRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1673 }
1674 else
1675 {
1676 ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
1678 xRedoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1679 }
1680 }
1681
1682 ScRange aWorkRange( aNewRange.aStart, ScAddress( nEndX, nEndY, nEndZ ) );
1683 rDoc.ExtendMerge( aWorkRange, true );
1684
1685 // Paint
1686
1687 if ( aNewRange.aEnd.Col() != aOldRange.aEnd.Col() )
1688 aWorkRange.aEnd.SetCol(rDoc.MaxCol());
1689 if ( aNewRange.aEnd.Row() != aOldRange.aEnd.Row() )
1690 aWorkRange.aEnd.SetRow(rDoc.MaxRow());
1691
1692 if ( !pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), aWorkRange.aStart.Tab() ) )
1694
1697 if (pViewShell)
1698 pViewShell->CellContentChanged();
1699}
1700
1702{
1703 ScDocument& rDoc = pDocShell->GetDocument();
1704 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1707 if (pLink)
1708 {
1709 pLink->SetSource( aOldDoc, aOldFlt, aOldOpt, aOldArea ); // old data in Link
1710 pLink->SetDestArea( aOldRange );
1711 pLink->SetRefreshDelay( nOldRefresh );
1712 }
1713
1714 DoChange(true);
1715}
1716
1718{
1719 ScDocument& rDoc = pDocShell->GetDocument();
1720 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
1723 if (pLink)
1724 {
1725 pLink->SetSource( aNewDoc, aNewFlt, aNewOpt, aNewArea ); // new values in link
1726 pLink->SetDestArea( aNewRange );
1727 pLink->SetRefreshDelay( nNewRefresh );
1728 }
1729
1730 DoChange(false);
1731}
1732
1734{
1735 // makes no sense
1736}
1737
1739{
1740 return false;
1741}
1742
1743/* 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:1324
void SetNewValue(const ScCellValue &rCell, ScDocument *pDoc)
Definition: chgtrack.cxx:1336
void Append(ScChangeAction *pAppend, sal_uLong nAction)
Definition: chgtrack.cxx:2326
void AppendContentsIfInRefDoc(ScDocument &rRefDoc, sal_uLong &nStartAction, sal_uLong &nEndAction)
Definition: chgtrack.cxx:2717
void AppendContentRange(const ScRange &rRange, ScDocument *pRefDoc, sal_uLong &nStartAction, sal_uLong &nEndAction, ScChangeActionClipMode eMode=SC_CACM_NONE)
Definition: chgtrack.cxx:2621
sal_uLong GetActionMax() const
Definition: chgtrack.hxx:955
SC_DLLPUBLIC void Undo(sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge=false)
Definition: chgtrack.cxx:3034
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:220
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:2592
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
Definition: docsh5.cxx:404
static SCTAB GetCurTab()
Definition: docsh4.cxx:2599
void SetEmptyCell(const ScAddress &rPos)
Definition: document.cxx:3509
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:3453
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:897
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:538
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:1162
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5676
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:454
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:891
SC_DLLPUBLIC void DoMergeContents(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
Definition: documen3.cxx:2042
OUString GetLinkOpt(SCTAB nTab) const
Definition: documen3.cxx:531
SC_DLLPUBLIC bool SetOptimalHeight(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bApi)
Definition: document.cxx:4330
void FillTabMarked(SCTAB nSrcTab, const ScMarkData &rMark, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink)
Definition: document.cxx:3356
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6170
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:892
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:2079
void BroadcastCells(const ScRange &rRange, SfxHintId nHint, bool bBroadcastSingleBroadcasters=true)
Definition: documen7.cxx:158
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Definition: document.cxx:6730
SC_DLLPUBLIC void DeleteSelection(InsertDeleteFlags nDelFlag, const ScMarkData &rMark, bool bBroadcast=true)
Definition: document.cxx:6041
void RemoveMerge(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: documen3.cxx:2096
SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow)
Definition: document.cxx:4362
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3422
void ReplaceStyle(const SvxSearchItem &rSearchItem, SCCOL nCol, SCROW nRow, SCTAB nTab, const ScMarkData &rMark)
Definition: documen4.cxx:549
void DeleteSelectionTab(SCTAB nTab, InsertDeleteFlags nDelFlag, const ScMarkData &rMark)
Definition: document.cxx:6099
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:1890
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
Definition: documen9.cxx:195
SC_DLLPUBLIC void ApplySelectionPattern(const ScPatternAttr &rAttr, const ScMarkData &rMark, ScEditDataArray *pDataArray=nullptr, bool *pIsChanged=nullptr)
Definition: document.cxx:5984
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:4304
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4493
SC_DLLPUBLIC CRFlags GetRowFlags(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4400
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:510
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5278
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:2072
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3517
void ApplySelectionFrame(const ScMarkData &rMark, const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner)
Definition: document.cxx:5863
void FitBlock(const ScRange &rOld, const ScRange &rNew, bool bClear=true)
Definition: document.cxx:1858
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
Definition: document.cxx:4835
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1081
sal_uLong GetLinkRefreshDelay(SCTAB nTab) const
Definition: documen3.cxx:545
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
Definition: documen3.cxx:552
SC_DLLPUBLIC void SetRowFlags(SCROW nRow, SCTAB nTab, CRFlags nNewFlags)
Definition: document.cxx:4380
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4509
void AutoFormat(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_uInt16 nFormatNo, const ScMarkData &rMark)
Definition: documen3.cxx:1193
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
Definition: document.cxx:1951
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:517
SC_DLLPUBLIC void SetColWidth(SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth)
Definition: document.cxx:4147
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2487
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3790
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:231
SC_DLLPUBLIC void SetTabBgColor(SCTAB nTab, const Color &rColor)
Definition: documen3.cxx:461
OUString GetLinkFlt(SCTAB nTab) const
Definition: documen3.cxx:524
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:317
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:616
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:588
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:590
void ResetAutoSpell()
Definition: gridwin.cxx:5755
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:581
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:409
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1194
ScViewData & GetViewData()
Definition: tabview.hxx:335
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:1822
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:1253
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:1277
virtual void Redo() override
Definition: undoblk3.cxx:1263
ScMarkData aMarkData
Definition: undoblk.hxx:554
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:1271
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:1348
virtual OUString GetComment() const override
Definition: undoblk3.cxx:1302
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:1363
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk3.cxx:1357
ScDocumentUniquePtr pRedoDoc
Definition: undoblk.hxx:585
void DoChange(ScDocument *pRefDoc)
Definition: undoblk3.cxx:1317
virtual void Undo() override
Definition: undoblk3.cxx:1337
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:1282
virtual ~ScUndoRefConversion() override
Definition: undoblk3.cxx:1296
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
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3157
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:2319
SC_DLLPUBLIC void FillSimple(FillDir eDir)
Definition: viewfun2.cxx:1397
void FillSeries(FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, double fStart, double fStep, double fMax)
Definition: viewfun2.cxx:1446
void ApplyPatternLines(const ScPatternAttr &rAttr, const SvxBoxItem &rNewOuter, const SvxBoxInfoItem *pNewInner)
Definition: viewfunc.cxx:1104
void ApplySelectionPattern(const ScPatternAttr &rAttr, bool bCursorOnly=false)
Definition: viewfunc.cxx:1214
bool MergeCells(bool bApi, bool &rDoContents, bool bCenter)
Definition: viewfun2.cxx:1181
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:115
bool SearchAndReplace(const SvxSearchItem *pSearchItem, bool bAddUndo, bool bIsApi)
Definition: viewfun2.cxx:1944
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:77
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2717
@ SCDOCMODE_UNDO
Definition: document.hxx:257
FilterGroup & rTarget
@ CELLTYPE_EDIT
Definition: global.hxx:276
ScPasteFunc
Definition: global.hxx:180
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:333
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:316
@ FILL_SIMPLE
Definition: global.hxx:317
FillDir
Definition: global.hxx:308
@ FILL_TO_TOP
Definition: global.hxx:311
@ FILL_TO_RIGHT
Definition: global.hxx:310
@ FILL_TO_LEFT
Definition: global.hxx:312
@ FILL_TO_BOTTOM
Definition: global.hxx:309
Mode eMode
SvBaseLink * pLink
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
Definition: docsh.hxx:511
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:1469
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