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