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