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