LibreOffice Module sc (master)  1
undoblk.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 <scitems.hxx>
21 #include <vcl/virdev.hxx>
22 #include <editeng/boxitem.hxx>
23 #include <sfx2/app.hxx>
24 #include <comphelper/lok.hxx>
25 
26 #include <undoblk.hxx>
27 #include <undoutil.hxx>
28 #include <document.hxx>
29 #include <patattr.hxx>
30 #include <docsh.hxx>
31 #include <tabvwsh.hxx>
32 #include <rangenam.hxx>
33 #include <rangeutl.hxx>
34 #include <stlpool.hxx>
35 #include <stlsheet.hxx>
36 #include <globstr.hrc>
37 #include <scresid.hxx>
38 #include <global.hxx>
39 #include <target.hxx>
40 #include <docpool.hxx>
41 #include <docfunc.hxx>
42 #include <attrib.hxx>
43 #include <chgtrack.hxx>
44 #include <transobj.hxx>
45 #include <refundo.hxx>
46 #include <undoolk.hxx>
47 #include <clipparam.hxx>
48 #include <brdcst.hxx>
49 #include <rowheightcontext.hxx>
50 #include <refhint.hxx>
51 #include <refupdatecontext.hxx>
52 #include <validat.hxx>
53 #include <gridwin.hxx>
54 #include <svl/listener.hxx>
55 #include <columnspanset.hxx>
56 
57 #include <memory>
58 #include <set>
59 
60 // TODO:
61 /*A*/ // SetOptimalHeight on Document, if no View
62 /*B*/ // linked sheets
63 /*C*/ // ScArea
64 //? // check later
65 
67  const ScRange& rRange,
68  SCTAB nNewCount, std::unique_ptr<SCTAB[]> pNewTabs, std::unique_ptr<SCTAB[]> pNewScenarios,
69  InsCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData,
70  bool bNewPartOfPaste ) :
71  ScMoveUndo( pNewDocShell, std::move(pUndoDocument), std::move(pRefData) ),
72  aEffRange( rRange ),
73  nCount( nNewCount ),
74  pTabs( std::move(pNewTabs) ),
75  pScenarios( std::move(pNewScenarios) ),
76  eCmd( eNewCmd ),
77  bPartOfPaste( bNewPartOfPaste )
78 {
79  ScDocument& rDoc = pDocShell->GetDocument();
80  if (eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER) // whole row?
81  {
83  aEffRange.aEnd.SetCol(rDoc.MaxCol());
84  }
85 
86  if (eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER) // whole column?
87  {
89  aEffRange.aEnd.SetRow(rDoc.MaxRow());
90  }
91 
93 }
94 
96 {
97 }
98 
100 {
101  return ScResId( pPasteUndo ? STR_UNDO_PASTE : STR_UNDO_INSERTCELLS );
102 }
103 
105 {
106  // If a paste undo action has already been added, append (detective) action there.
107  if ( pPasteUndo )
108  return pPasteUndo->Merge( pNextAction );
109 
110  if ( bPartOfPaste )
111  if ( auto pWrapper = dynamic_cast<ScUndoWrapper*>( pNextAction) )
112  {
113  SfxUndoAction* pWrappedAction = pWrapper->GetWrappedUndo();
114  if ( dynamic_cast<const ScUndoPaste*>( pWrappedAction) )
115  {
116  // Store paste action if this is part of paste with inserting cells.
117  // A list action isn't used because Repeat wouldn't work (insert wrong cells).
118 
119  pPasteUndo.reset( pWrappedAction );
120  pWrapper->ForgetWrappedUndo(); // pWrapper is deleted by UndoManager
121  return true;
122  }
123  }
124 
125  // Call base class for detective handling
126  return ScMoveUndo::Merge( pNextAction );
127 }
128 
130 {
131  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
132  if ( pChangeTrack )
133  {
134  pChangeTrack->AppendInsert( aEffRange );
135  nEndChangeAction = pChangeTrack->GetActionMax();
136  }
137  else
138  nEndChangeAction = 0;
139 }
140 
141 void ScUndoInsertCells::DoChange( const bool bUndo )
142 {
143  ScDocument& rDoc = pDocShell->GetDocument();
144  SCTAB i;
145 
146  if ( bUndo )
147  {
148  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
149  if ( pChangeTrack )
150  pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
151  }
152  else
153  SetChangeTrack();
154 
155  // refresh of merged cells has to be after inserting/deleting
156 
158  switch (eCmd)
159  {
160  case INS_INSROWS_BEFORE:
161  case INS_INSROWS_AFTER:
162  case INS_CELLSDOWN:
163  for( i=0; i<nCount; i++ )
164  {
165 
166  if (bUndo)
168  aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
169  else
170  rDoc.InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
171  aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
172 
173  if (pViewShell)
174  {
175  const long nSign = bUndo ? -1 : 1;
176  pViewShell->OnLOKInsertDeleteRow(aEffRange.aStart.Row(), nSign * (aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
177  }
178  }
179  break;
180  case INS_INSCOLS_BEFORE:
181  case INS_INSCOLS_AFTER:
182  case INS_CELLSRIGHT:
183  for( i=0; i<nCount; i++ )
184  {
185  if (bUndo)
187  aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
188  else
189  rDoc.InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
190  aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
191 
192  if (pViewShell)
193  {
194  const long nSign = bUndo ? -1 : 1;
196  }
197  }
198  break;
199  default:
200  {
201  // added to avoid warnings
202  }
203  }
204 
205  ScRange aWorkRange( aEffRange );
206  if ( eCmd == INS_CELLSRIGHT ) // only "shift right" requires refresh of the moved area
207  aWorkRange.aEnd.SetCol(rDoc.MaxCol());
208  for( i=0; i<nCount; i++ )
209  {
210  if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
211  aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HasAttrFlags::Merged ) )
212  {
213  SCCOL nEndCol = aWorkRange.aEnd.Col();
214  SCROW nEndRow = aWorkRange.aEnd.Row();
215  rDoc.ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
216  }
217  }
218 
219  // Undo for displaced attributes?
220 
222 
223  switch (eCmd)
224  {
225  case INS_INSROWS_BEFORE:
226  case INS_INSROWS_AFTER:
227  nPaint |= PaintPartFlags::Left;
228  aWorkRange.aEnd.SetRow(rDoc.MaxRow());
229  break;
230  case INS_CELLSDOWN:
231  for( i=0; i<nCount; i++ )
232  {
233  aWorkRange.aEnd.SetRow(rDoc.MaxRow());
234  if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] ))
235  {
236  aWorkRange.aStart.SetCol(0);
237  aWorkRange.aEnd.SetCol(rDoc.MaxCol());
238  nPaint |= PaintPartFlags::Left;
239  }
240  }
241  break;
242  case INS_INSCOLS_BEFORE:
243  case INS_INSCOLS_AFTER:
244  nPaint |= PaintPartFlags::Top; // top bar
245  [[fallthrough]];
246  case INS_CELLSRIGHT:
247  for( i=0; i<nCount; i++ )
248  {
249  aWorkRange.aEnd.SetCol(rDoc.MaxCol()); // to the far right
250  if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i]) )
251  { // AdjustDraw does not paint PaintPartFlags::Top,
252  aWorkRange.aStart.SetCol(0); // thus solved like this
253  aWorkRange.aEnd.SetRow(rDoc.MaxRow());
254  nPaint |= PaintPartFlags::Left;
255  }
256  }
257  break;
258  default:
259  {
260  // added to avoid warnings
261  }
262  }
263 
264  for( i=0; i<nCount; i++ )
265  {
266  pDocShell->PostPaint( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
267  aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i]+pScenarios[i], nPaint );
268  }
270  if (!pViewShell)
271  return;
272 
273  pViewShell->CellContentChanged();
274 
276  return;
277 
278  SCTAB nTab = pViewShell->GetViewData().GetTabNo();
279  bool bColsAffected = (eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER || eCmd == INS_CELLSRIGHT);
280  bool bRowsAffected = (eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER || eCmd == INS_CELLSDOWN);
281 
282  if (bColsAffected)
284 
285  if (bRowsAffected)
287 
289  pViewShell,
290  bColsAffected, bRowsAffected,
291  true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
292  true /* bGroups */, nTab);
293 }
294 
296 {
297  if ( pPasteUndo )
298  pPasteUndo->Undo(); // undo paste first
299 
300  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas in UpdateReference
301  BeginUndo();
302  DoChange( true );
303  EndUndo();
304 
305  ScDocument& rDoc = pDocShell->GetDocument();
306  for (SCTAB i = 0; i < nCount; ++i)
307  rDoc.SetDrawPageSize(pTabs[i]);
308 }
309 
311 {
312  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas in UpdateReference
313  BeginRedo();
314  DoChange( false );
315  EndRedo();
316 
317  if ( pPasteUndo )
318  pPasteUndo->Redo(); // redo paste last
319 
320  ScDocument& rDoc = pDocShell->GetDocument();
321  for (SCTAB i = 0; i < nCount; ++i)
322  rDoc.SetDrawPageSize(pTabs[i]);
323 }
324 
326 {
327  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
328  {
329  if ( pPasteUndo )
330  {
331  // Repeat for paste with inserting cells is handled completely
332  // by the Paste undo action
333 
334  pPasteUndo->Repeat( rTarget );
335  }
336  else
337  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->InsertCells( eCmd );
338  }
339 }
340 
342 {
343  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
344 }
345 
347  const ScRange& rRange,
348  SCTAB nNewCount, std::unique_ptr<SCTAB[]> pNewTabs, std::unique_ptr<SCTAB[]> pNewScenarios,
349  DelCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData ) :
350  ScMoveUndo( pNewDocShell, std::move(pUndoDocument), std::move(pRefData) ),
351  aEffRange( rRange ),
352  nCount( nNewCount ),
353  pTabs( std::move(pNewTabs) ),
354  pScenarios( std::move(pNewScenarios) ),
355  eCmd( eNewCmd )
356 {
357  ScDocument& rDoc = pDocShell->GetDocument();
358  if (eCmd == DelCellCmd::Rows) // whole row?
359  {
361  aEffRange.aEnd.SetCol(rDoc.MaxCol());
362  }
363 
364  if (eCmd == DelCellCmd::Cols) // whole column?
365  {
367  aEffRange.aEnd.SetRow(rDoc.MaxRow());
368  }
369 
370  SetChangeTrack();
371 }
372 
374 {
375 }
376 
378 {
379  return ScResId( STR_UNDO_DELETECELLS ); // "Delete"
380 }
381 
383 {
384  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
385  if ( pChangeTrack )
386  pChangeTrack->AppendDeleteRange( aEffRange, pRefUndoDoc.get(),
388  else
390 }
391 
392 void ScUndoDeleteCells::DoChange( const bool bUndo )
393 {
394  ScDocument& rDoc = pDocShell->GetDocument();
395  SCTAB i;
396 
397  if ( bUndo )
398  {
399  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
400  if ( pChangeTrack )
401  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
402  }
403  else
404  SetChangeTrack();
405 
407 
408  switch (eCmd)
409  {
410  case DelCellCmd::Rows:
411  case DelCellCmd::CellsUp:
412  for( i=0; i<nCount; i++ )
413  {
414  if (bUndo)
416  aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
417  else
418  rDoc.DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
419  aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
420 
421  if (pViewShell)
422  {
423  const long nSign = bUndo ? 1 : -1;
424  pViewShell->OnLOKInsertDeleteRow(aEffRange.aStart.Row(), nSign * (aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
425  }
426  }
427  break;
428  case DelCellCmd::Cols:
430  for( i=0; i<nCount; i++ )
431  {
432  if (bUndo)
434  aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
435  else
436  rDoc.DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
437  aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
438 
439  if (pViewShell)
440  {
441  const long nSign = bUndo ? 1 : -1;
443  }
444  }
445  break;
446  default:
447  {
448  // added to avoid warnings
449  }
450  }
451 
452  // if Undo, restore references
453  for( i=0; i<nCount && bUndo; i++ )
454  {
457  }
458 
459  ScRange aWorkRange( aEffRange );
460  if ( eCmd == DelCellCmd::CellsLeft ) // only "shift left" requires refresh of the moved area
461  aWorkRange.aEnd.SetCol(rDoc.MaxCol());
462 
463  for( i=0; i<nCount; i++ )
464  {
465  if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
466  aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HasAttrFlags::Merged | HasAttrFlags::Overlapped ) )
467  {
468  // #i51445# old merge flag attributes must be deleted also for single cells,
469  // not only for whole columns/rows
470 
471  if ( !bUndo )
472  {
474  aWorkRange.aEnd.SetCol(rDoc.MaxCol());
476  aWorkRange.aEnd.SetRow(rDoc.MaxRow());
477  ScMarkData aMarkData(rDoc.GetSheetLimits());
478  aMarkData.SelectOneTable( aWorkRange.aStart.Tab() );
479  ScPatternAttr aPattern( rDoc.GetPool() );
480  aPattern.GetItemSet().Put( ScMergeFlagAttr() );
481  rDoc.ApplyPatternArea( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(),
482  aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(),
483  aMarkData, aPattern );
484  }
485 
486  SCCOL nEndCol = aWorkRange.aEnd.Col();
487  SCROW nEndRow = aWorkRange.aEnd.Row();
488  rDoc.ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
489  }
490  }
491 
492  // paint
494  switch (eCmd)
495  {
496  case DelCellCmd::Rows:
497  nPaint |= PaintPartFlags::Left;
498  aWorkRange.aEnd.SetRow(rDoc.MaxRow());
499  break;
500  case DelCellCmd::CellsUp:
501  for( i=0; i<nCount; i++ )
502  {
503  aWorkRange.aEnd.SetRow(rDoc.MaxRow());
504  if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] ))
505  {
506  aWorkRange.aStart.SetCol(0);
507  aWorkRange.aEnd.SetCol(rDoc.MaxCol());
508  nPaint |= PaintPartFlags::Left;
509  }
510  }
511  break;
512  case DelCellCmd::Cols:
513  nPaint |= PaintPartFlags::Top; // top bar
514  [[fallthrough]];
516  for( i=0; i<nCount; i++ )
517  {
518  aWorkRange.aEnd.SetCol(rDoc.MaxCol()); // to the far right
519  if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] ) )
520  {
521  aWorkRange.aStart.SetCol(0);
522  aWorkRange.aEnd.SetRow(rDoc.MaxRow());
523  nPaint |= PaintPartFlags::Left;
524  }
525  }
526  break;
527  default:
528  {
529  // added to avoid warnings
530  }
531  }
532 
533  for( i=0; i<nCount; i++ )
534  {
535  pDocShell->PostPaint( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
536  aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i]+pScenarios[i], nPaint, SC_PF_LINES );
537  }
538  // Selection not until EndUndo
539 
541  // CellContentChanged comes with the selection
542 
543  if (!pViewShell)
544  return;
545 
547  return;
548 
549  SCTAB nTab = pViewShell->GetViewData().GetTabNo();
550  bool bColsAffected = (eCmd == DelCellCmd::Cols || eCmd == DelCellCmd::CellsLeft);
551  bool bRowsAffected = (eCmd == DelCellCmd::Rows || eCmd == DelCellCmd::CellsUp);
552 
553  if (bColsAffected)
555 
556  if (bRowsAffected)
558 
560  pViewShell,
561  bColsAffected, bRowsAffected,
562  true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
563  true /* bGroups */, nTab);
564 
565 }
566 
568 {
569  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
570  BeginUndo();
571  DoChange( true );
572  EndUndo();
573 
574  ScDocument& rDoc = pDocShell->GetDocument();
575 
576  // Now that DBData have been restored in ScMoveUndo::EndUndo() via its
577  // pRefUndoDoc we can apply the AutoFilter buttons.
578  // Add one row for cases undoing deletion right above a cut AutoFilter
579  // range so the buttons are removed.
580  SCROW nRefreshEndRow = std::min<SCROW>( aEffRange.aEnd.Row() + 1, rDoc.MaxRow());
581  for (SCTAB i=0; i < nCount; ++i)
582  {
584  aEffRange.aEnd.Col(), nRefreshEndRow, pTabs[i]);
585  }
586 
587  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
588 
589  // Selection not until EndUndo
591  if (pViewShell)
592  {
593  for( SCTAB i=0; i<nCount; i++ )
594  {
596  }
597  }
598 
599  for (SCTAB i = 0; i < nCount; ++i)
600  rDoc.SetDrawPageSize(pTabs[i]);
601 }
602 
604 {
605  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
606  BeginRedo();
607  DoChange( false);
608  EndRedo();
609 
610  ScDocument& rDoc = pDocShell->GetDocument();
611 
612  for (SCTAB i=0; i < nCount; ++i)
613  {
616  }
617 
618  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
619 
621  if (pViewShell)
622  pViewShell->DoneBlockMode(); // current way
623 
624  for (SCTAB i = 0; i < nCount; ++i)
625  rDoc.SetDrawPageSize(pTabs[i]);
626 }
627 
629 {
630  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget) )
631  pViewTarget->GetViewShell()->DeleteCells( eCmd );
632 }
633 
635 {
636  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
637 }
638 
639 // delete cells in multiselection
641  ScDocShell* pNewDocShell,
642  bool bNewRows, bool bNeedsRefresh, SCTAB nNewTab,
643  const std::vector<sc::ColRowSpan>& rSpans,
644  ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData ) :
645  ScMoveUndo( pNewDocShell, std::move(pUndoDocument), std::move(pRefData) ),
646  mbRows(bNewRows),
647  mbRefresh(bNeedsRefresh),
648  nTab( nNewTab ),
649  maSpans(rSpans)
650 {
651  SetChangeTrack();
652 }
653 
655 {
656 }
657 
659 {
660  return ScResId( STR_UNDO_DELETECELLS ); // like DeleteCells
661 }
662 
664 {
665  SCCOL nStartCol;
666  SCROW nStartRow;
667  PaintPartFlags nPaint;
668  ScDocument& rDoc = pDocShell->GetDocument();
669  if (mbRows)
670  {
671  nStartCol = 0;
672  nStartRow = static_cast<SCROW>(maSpans[0].mnStart);
674  }
675  else
676  {
677  nStartCol = static_cast<SCCOL>(maSpans[0].mnStart);
678  nStartRow = 0;
680  }
681 
682  if (mbRefresh)
683  {
684  SCCOL nEndCol = rDoc.MaxCol();
685  SCROW nEndRow = rDoc.MaxRow();
686  rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver );
687  rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true );
688  }
689 
690  pDocShell->PostPaint( nStartCol, nStartRow, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab, nPaint );
693  if (pViewShell)
694  pViewShell->CellContentChanged();
695 
696  ShowTable( nTab );
697 }
698 
700 {
701  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
702  if ( pChangeTrack )
703  {
704  ScDocument& rDoc = pDocShell->GetDocument();
705  nStartChangeAction = pChangeTrack->GetActionMax() + 1;
706  ScRange aRange( 0, 0, nTab, 0, 0, nTab );
707  if (mbRows)
708  aRange.aEnd.SetCol( rDoc.MaxCol() );
709  else
710  aRange.aEnd.SetRow( rDoc.MaxRow() );
711  // delete in reverse
712  std::vector<sc::ColRowSpan>::const_reverse_iterator ri = maSpans.rbegin(), riEnd = maSpans.rend();
713  for (; ri != riEnd; ++ri)
714  {
715  SCCOLROW nEnd = ri->mnEnd;
716  SCCOLROW nStart = ri->mnStart;
717  if (mbRows)
718  {
719  aRange.aStart.SetRow( nStart );
720  aRange.aEnd.SetRow( nEnd );
721  }
722  else
723  {
724  aRange.aStart.SetCol( static_cast<SCCOL>(nStart) );
725  aRange.aEnd.SetCol( static_cast<SCCOL>(nEnd) );
726  }
727  sal_uLong nDummyStart;
728  pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc.get(),
729  nDummyStart, nEndChangeAction );
730  }
731  }
732  else
734 }
735 
737 {
738  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
739  BeginUndo();
740 
741  ScDocument& rDoc = pDocShell->GetDocument();
742 
743  // reverse delete -> forward insert
744  for (const auto& rSpan : maSpans)
745  {
746  SCCOLROW nStart = rSpan.mnStart;
747  SCCOLROW nEnd = rSpan.mnEnd;
748  if (mbRows)
749  rDoc.InsertRow( 0,nTab, rDoc.MaxCol(),nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
750  else
751  rDoc.InsertCol( 0,nTab, rDoc.MaxRow(),nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
752  }
753 
754  for (const auto& rSpan : maSpans)
755  {
756  SCCOLROW nStart = rSpan.mnStart;
757  SCCOLROW nEnd = rSpan.mnEnd;
758  if (mbRows)
759  pRefUndoDoc->CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::ALL, false, rDoc);
760  else
761  pRefUndoDoc->CopyToDocument(static_cast<SCCOL>(nStart),0,nTab,
762  static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::ALL, false, rDoc);
763  }
764 
765  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
766  if ( pChangeTrack )
767  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
768 
769  DoChange();
770 
773 
774  EndUndo();
775  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
776 }
777 
779 {
780  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
781  BeginRedo();
782 
783  ScDocument& rDoc = pDocShell->GetDocument();
784 
785  // reverse delete
786  std::vector<sc::ColRowSpan>::const_reverse_iterator ri = maSpans.rbegin(), riEnd = maSpans.rend();
787  for (; ri != riEnd; ++ri)
788  {
789  SCCOLROW nEnd = ri->mnEnd;
790  SCCOLROW nStart = ri->mnStart;
791  if (mbRows)
792  rDoc.DeleteRow( 0,nTab, rDoc.MaxCol(),nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
793  else
794  rDoc.DeleteCol( 0,nTab, rDoc.MaxRow(),nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
795  }
796 
797  SetChangeTrack();
798 
799  DoChange();
800 
801  EndRedo();
802  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
803 }
804 
806 {
807  // if single selection
808  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
809  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DeleteCells( DelCellCmd::Rows );
810 }
811 
813 {
814  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
815 }
816 
817 ScUndoCut::ScUndoCut(ScDocShell* pNewDocShell, const ScRange& aRange, const ScAddress& aOldEnd,
818  const ScMarkData& rMark, ScDocumentUniquePtr pNewUndoDoc)
819  : ScBlockUndo(pNewDocShell, ScRange(aRange.aStart, aOldEnd), SC_UNDO_AUTOHEIGHT)
820  , aMarkData(rMark)
821  , pUndoDoc(std::move(pNewUndoDoc))
822  , aExtendedRange(aRange)
823 {
824  SetChangeTrack();
825 }
826 
828 {
829 }
830 
831 OUString ScUndoCut::GetComment() const
832 {
833  return ScResId( STR_UNDO_CUT ); // "cut"
834 }
835 
837 {
838  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
839  if ( pChangeTrack )
840  pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
842  else
843  nStartChangeAction = nEndChangeAction = 0;
844 }
845 
846 void ScUndoCut::DoChange( const bool bUndo )
847 {
848  ScDocument& rDoc = pDocShell->GetDocument();
849  sal_uInt16 nExtFlags = 0;
850 
851  // do not undo/redo objects and note captions, they are handled via drawing undo
853 
854  if (bUndo) // only for Undo
855  {
856  // all sheets - CopyToDocument skips those that don't exist in pUndoDoc
857  SCTAB nTabCount = rDoc.GetTableCount();
858  ScRange aCopyRange = aExtendedRange;
859  aCopyRange.aStart.SetTab(0);
860  aCopyRange.aEnd.SetTab(nTabCount-1);
861  pUndoDoc->CopyToDocument(aCopyRange, nUndoFlags, false, rDoc);
862  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
863  if ( pChangeTrack )
864  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
865 
866  BroadcastChanges(aCopyRange);
867  }
868  else // only for Redo
869  {
870  pDocShell->UpdatePaintExt( nExtFlags, aExtendedRange );
872  aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(), aMarkData, nUndoFlags );
873  SetChangeTrack();
874  }
875 
877  if ( !( pViewShell && pViewShell->AdjustBlockHeight() ) )
879 
880  if ( !bUndo ) // draw redo after updating row heights
881  RedoSdrUndoAction( pDrawUndo.get() );
882 
884  if (pViewShell)
885  pViewShell->CellContentChanged();
886 }
887 
889 {
890  BeginUndo();
891  DoChange( true );
892  EndUndo();
893 }
894 
896 {
897  BeginRedo();
898  ScDocument& rDoc = pDocShell->GetDocument();
899  EnableDrawAdjust( &rDoc, false );
900  DoChange( false );
901  EnableDrawAdjust( &rDoc, true );
902  EndRedo();
903 }
904 
906 {
907  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
908  pViewTarget->GetViewShell()->CutToClip();
909 }
910 
912 {
913  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
914 }
915 
916 ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell, const ScRangeList& rRanges,
917  const ScMarkData& rMark,
918  ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
919  InsertDeleteFlags nNewFlags,
920  std::unique_ptr<ScRefUndoData> pRefData,
921  bool bRedoIsFilled, const ScUndoPasteOptions* pOptions ) :
922  ScMultiBlockUndo( pNewDocShell, rRanges ),
923  aMarkData( rMark ),
924  pUndoDoc( std::move(pNewUndoDoc) ),
925  pRedoDoc( std::move(pNewRedoDoc) ),
926  nFlags( nNewFlags ),
927  pRefUndoData( std::move(pRefData) ),
928  bRedoFilled( bRedoIsFilled )
929 {
930  if ( pRefUndoData )
931  pRefUndoData->DeleteUnchanged( &pDocShell->GetDocument() );
932 
933  if ( pOptions )
934  aPasteOptions = *pOptions; // used only for Repeat
935 
936  SetChangeTrack();
937 }
938 
940 {
941  pUndoDoc.reset();
942  pRedoDoc.reset();
943  pRefUndoData.reset();
944  pRefRedoData.reset();
945 }
946 
947 OUString ScUndoPaste::GetComment() const
948 {
949  return ScResId( STR_UNDO_PASTE ); // "paste"
950 }
951 
953 {
954  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
955  if ( pChangeTrack && (nFlags & InsertDeleteFlags::CONTENTS) )
956  {
957  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
958  {
959  pChangeTrack->AppendContentRange(maBlockRanges[i], pUndoDoc.get(),
961  }
962  }
963  else
965 }
966 
967 void ScUndoPaste::DoChange(bool bUndo)
968 {
969  ScDocument& rDoc = pDocShell->GetDocument();
970 
971  // RefUndoData for redo is created before first undo
972  // (with DeleteUnchanged after the DoUndo call)
973  bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
974  if ( bCreateRedoData )
975  pRefRedoData.reset( new ScRefUndoData( &rDoc ) );
976 
977  ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData.get() : pRefRedoData.get();
978 
979  // Always back-up either all or none of the content for Undo
982  nUndoFlags |= InsertDeleteFlags::CONTENTS;
984  nUndoFlags |= InsertDeleteFlags::ATTRIB;
985 
986  // do not undo/redo objects and note captions, they are handled via drawing undo
987  nUndoFlags &= ~InsertDeleteFlags::OBJECTS;
988  nUndoFlags |= InsertDeleteFlags::NOCAPTIONS;
989 
990  bool bPaintAll = false;
991 
993 
994  SCTAB nTabCount = rDoc.GetTableCount();
995  if ( bUndo && !bRedoFilled )
996  {
997  if (!pRedoDoc)
998  {
999  bool bColInfo = true;
1000  bool bRowInfo = true;
1001  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1002  {
1003  const ScRange& r = maBlockRanges[i];
1004  bColInfo &= (r.aStart.Row() == 0 && r.aEnd.Row() == rDoc.MaxRow());
1005  bRowInfo &= (r.aStart.Col() == 0 && r.aEnd.Col() == rDoc.MaxCol());
1006  if (!bColInfo && !bRowInfo)
1007  break;
1008  }
1009 
1010  pRedoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
1011  pRedoDoc->InitUndoSelected( rDoc, aMarkData, bColInfo, bRowInfo );
1012  }
1013  // read "redo" data from the document in the first undo
1014  // all sheets - CopyToDocument skips those that don't exist in pRedoDoc
1015  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1016  {
1017  ScRange aCopyRange = maBlockRanges[i];
1018  aCopyRange.aStart.SetTab(0);
1019  aCopyRange.aEnd.SetTab(nTabCount-1);
1020  rDoc.CopyToDocument(aCopyRange, nUndoFlags, false, *pRedoDoc);
1021  bRedoFilled = true;
1022  }
1023  }
1024 
1025  sal_uInt16 nExtFlags = 0;
1027 
1028  rDoc.ForgetNoteCaptions(maBlockRanges, false);
1030  rDoc.DeleteSelection(nUndoFlags, aMarkData, false); // no broadcasting here
1031  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1032  rDoc.BroadcastCells(maBlockRanges[i], SfxHintId::ScDataChanged);
1033 
1035 
1036  SCTAB nFirstSelected = aMarkData.GetFirstSelected();
1037 
1038  if ( !bUndo && pRedoDoc ) // Redo: UndoToDocument before handling RefData
1039  {
1040  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1041  {
1042  ScRange aRange = maBlockRanges[i];
1043  aRange.aStart.SetTab(nFirstSelected);
1044  aRange.aEnd.SetTab(nFirstSelected);
1045  pRedoDoc->UndoToDocument(aRange, nUndoFlags, false, rDoc);
1046  for (const auto& rTab : aMarkData)
1047  {
1048  if (rTab >= nTabCount)
1049  break;
1050 
1051  if (rTab == nFirstSelected)
1052  continue;
1053 
1054  aRange.aStart.SetTab(rTab);
1055  aRange.aEnd.SetTab(rTab);
1056  pRedoDoc->CopyToDocument(aRange, nUndoFlags, false, rDoc);
1057  }
1058  }
1059  }
1060 
1061  if (pWorkRefData)
1062  {
1063  pWorkRefData->DoUndo( &rDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection
1064  if (!maBlockRanges.empty() &&
1065  rDoc.RefreshAutoFilter(0, 0, rDoc.MaxCol(), rDoc.MaxRow(), maBlockRanges[0].aStart.Tab()))
1066  bPaintAll = true;
1067  }
1068 
1069  if ( bCreateRedoData && pRefRedoData )
1070  pRefRedoData->DeleteUnchanged( &rDoc );
1071 
1072  if (bUndo) // Undo: UndoToDocument after handling RefData
1073  {
1074  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1075  {
1076  ScRange aRange = maBlockRanges[i];
1077  for (const auto& rTab : aMarkData)
1078  {
1079  if (rTab >= nTabCount)
1080  break;
1081  aRange.aStart.SetTab(rTab);
1082  aRange.aEnd.SetTab(rTab);
1083  pUndoDoc->UndoToDocument(aRange, nUndoFlags, false, rDoc);
1084  }
1085  }
1086  }
1087 
1088  if ( bUndo )
1089  {
1090  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1091  if ( pChangeTrack )
1092  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1093  }
1094  else
1095  SetChangeTrack();
1096 
1097  ScRangeList aDrawRanges(maBlockRanges);
1099  for (size_t i = 0, n = aDrawRanges.size(); i < n; ++i)
1100  {
1101  ScRange& rDrawRange = aDrawRanges[i];
1102  rDoc.ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.)
1103  ScRangeList aRangeList(rDrawRange);
1104  ScMarkData aData(rDoc.GetSheetLimits(), aRangeList);
1105  if (bPaintAll)
1106  {
1107  rDrawRange.aStart.SetCol(0);
1108  rDrawRange.aStart.SetRow(0);
1109  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1110  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1112  if (pViewShell)
1113  pViewShell->AdjustBlockHeight(false, &aData);
1114  }
1115  else
1116  {
1117  if (maBlockRanges[i].aStart.Row() == 0 && maBlockRanges[i].aEnd.Row() == rDoc.MaxRow()) // whole column
1118  {
1119  nPaint |= PaintPartFlags::Top;
1120  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1121  }
1122  if (maBlockRanges[i].aStart.Col() == 0 && maBlockRanges[i].aEnd.Col() == rDoc.MaxCol()) // whole row
1123  {
1124  nPaint |= PaintPartFlags::Left;
1125  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1126  }
1127  if (pViewShell && pViewShell->AdjustBlockHeight(false, &aData))
1128  {
1129  rDrawRange.aStart.SetCol(0);
1130  rDrawRange.aStart.SetRow(0);
1131  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1132  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1133  nPaint |= PaintPartFlags::Left;
1134  }
1135  pDocShell->UpdatePaintExt(nExtFlags, rDrawRange);
1136  }
1137  }
1138 
1139  if ( !bUndo ) // draw redo after updating row heights
1141 
1142  pDocShell->PostPaint(aDrawRanges, nPaint, nExtFlags);
1143 
1145  if (pViewShell)
1146  pViewShell->CellContentChanged();
1147 }
1148 
1150 {
1151  BeginUndo();
1152  DoChange(true);
1153  if (!maBlockRanges.empty())
1155  EndUndo();
1156  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1157 }
1158 
1160 {
1161  BeginRedo();
1162  ScDocument& rDoc = pDocShell->GetDocument();
1163  EnableDrawAdjust( &rDoc, false );
1164  DoChange( false );
1165  EnableDrawAdjust( &rDoc, true );
1166  EndRedo();
1167  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1168 }
1169 
1171 {
1172  auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget);
1173  if (!pViewTarget)
1174  return;
1175 
1176  ScTabViewShell* pViewSh = pViewTarget->GetViewShell();
1177  // keep a reference in case the clipboard is changed during PasteFromClip
1179  if (pOwnClip)
1180  {
1181  pViewSh->PasteFromClip( nFlags, pOwnClip->GetDocument(),
1184  true ); // allow warning dialog
1185  }
1186 }
1187 
1189 {
1190  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1191 }
1192 
1194  const ScRange& rRange, const ScAddress& aNewDestPos, bool bNewCut,
1195  ScDocumentUniquePtr pUndoDocument, bool bScenario ) :
1196  ScMoveUndo( pNewDocShell, std::move(pUndoDocument), nullptr ),
1197  mnPaintExtFlags( 0 ),
1198  aSrcRange( rRange ),
1199  bCut( bNewCut ),
1200  bKeepScenarioFlags( bScenario )
1201 {
1202  ScAddress aDestEnd(aNewDestPos);
1203  aDestEnd.IncRow(aSrcRange.aEnd.Row() - aSrcRange.aStart.Row());
1204  aDestEnd.IncCol(aSrcRange.aEnd.Col() - aSrcRange.aStart.Col());
1205  aDestEnd.IncTab(aSrcRange.aEnd.Tab() - aSrcRange.aStart.Tab());
1206 
1207  bool bIncludeFiltered = bCut;
1208  if ( !bIncludeFiltered )
1209  {
1210  // find number of non-filtered rows
1211  SCROW nPastedCount = pDocShell->GetDocument().CountNonFilteredRows(
1213 
1214  if ( nPastedCount == 0 )
1215  nPastedCount = 1;
1216  aDestEnd.SetRow( aNewDestPos.Row() + nPastedCount - 1 );
1217  }
1218 
1219  aDestRange.aStart = aNewDestPos;
1220  aDestRange.aEnd = aDestEnd;
1221 
1222  SetChangeTrack();
1223 }
1224 
1226 {
1227 }
1228 
1230 { // "Move" : "Copy"
1231  return bCut ?
1232  ScResId( STR_UNDO_MOVE ) :
1233  ScResId( STR_UNDO_COPY );
1234 }
1235 
1237 {
1238  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
1239  if ( pChangeTrack )
1240  {
1241  if ( bCut )
1242  {
1243  nStartChangeAction = pChangeTrack->GetActionMax() + 1;
1244  pChangeTrack->AppendMove( aSrcRange, aDestRange, pRefUndoDoc.get() );
1245  nEndChangeAction = pChangeTrack->GetActionMax();
1246  }
1247  else
1248  pChangeTrack->AppendContentRange( aDestRange, pRefUndoDoc.get(),
1250  }
1251  else
1253 }
1254 
1255 void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
1256 {
1259  ScDocument& rDoc = pDocShell->GetDocument();
1260 
1261  if (pViewShell)
1262  {
1264  ScViewData& rViewData = pViewShell->GetViewData();
1265  sc::RowHeightContext aCxt(
1266  rDoc.MaxRow(), rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(),
1267  pVirtDev);
1268 
1269  if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
1270  {
1271  // tdf#76183: recalculate objects' positions
1272  rDoc.SetDrawPageSize(aRange.aStart.Tab());
1273  aRange.aStart.SetCol(0);
1274  aRange.aEnd.SetCol(rDoc.MaxCol());
1275  aRange.aEnd.SetRow(rDoc.MaxRow());
1276  nPaint |= PaintPartFlags::Left;
1277  }
1278  }
1279 
1280  if ( bKeepScenarioFlags )
1281  {
1282  // Copy scenario -> also paint scenario boarder
1283  aRange.aStart.SetCol(0);
1284  aRange.aStart.SetRow(0);
1285  aRange.aEnd.SetCol(rDoc.MaxCol());
1286  aRange.aEnd.SetRow(rDoc.MaxRow());
1287  }
1288 
1289  // column/row info (width/height) included if whole columns/rows were copied
1290  if ( aSrcRange.aStart.Col() == 0 && aSrcRange.aEnd.Col() == rDoc.MaxCol() )
1291  {
1292  nPaint |= PaintPartFlags::Left;
1293  aRange.aEnd.SetRow(rDoc.MaxRow());
1294  }
1295  if ( aSrcRange.aStart.Row() == 0 && aSrcRange.aEnd.Row() == rDoc.MaxRow() )
1296  {
1297  nPaint |= PaintPartFlags::Top;
1298  aRange.aEnd.SetCol(rDoc.MaxCol());
1299  }
1300 
1301  pDocShell->PostPaint( aRange, nPaint, nExtFlags );
1302 }
1303 
1305 {
1306  ScDocument& rDoc = pDocShell->GetDocument();
1307 
1308  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1309  if ( pChangeTrack )
1310  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1311 
1312  // Database range before data, so that the Autofilter button match up in ExtendMerge
1313 
1314  ScRange aPaintRange = aRange;
1315  rDoc.ExtendMerge( aPaintRange ); // before deleting
1316 
1317  pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
1318 
1319  // do not undo objects and note captions, they are handled via drawing undo
1321 
1322  // Additionally discard/forget caption ownership during deletion, as
1323  // Drag&Drop is a special case in that the Undo holds captions of the
1324  // transferred target range, which would get deleted and
1325  // SdrGroupUndo::Undo() would attempt to access invalidated captions and
1326  // crash, tdf#92995
1327  InsertDeleteFlags nDelFlags = nUndoFlags | InsertDeleteFlags::FORGETCAPTIONS;
1328 
1329  rDoc.DeleteAreaTab( aRange, nDelFlags );
1330  pRefUndoDoc->CopyToDocument(aRange, nUndoFlags, false, rDoc);
1331  if ( rDoc.HasAttrib( aRange, HasAttrFlags::Merged ) )
1332  rDoc.ExtendMerge( aRange, true );
1333 
1334  aPaintRange.aEnd.SetCol( std::max( aPaintRange.aEnd.Col(), aRange.aEnd.Col() ) );
1335  aPaintRange.aEnd.SetRow( std::max( aPaintRange.aEnd.Row(), aRange.aEnd.Row() ) );
1336 
1337  pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
1338  maPaintRanges.Join(aPaintRange);
1339 }
1340 
1342 {
1343  mnPaintExtFlags = 0;
1345 
1346  BeginUndo();
1347 
1348  if (bCut)
1349  {
1350  // During undo, we move cells from aDestRange to aSrcRange.
1351 
1352  ScDocument& rDoc = pDocShell->GetDocument();
1353 
1354  SCCOL nColDelta = aSrcRange.aStart.Col() - aDestRange.aStart.Col();
1355  SCROW nRowDelta = aSrcRange.aStart.Row() - aDestRange.aStart.Row();
1356  SCTAB nTabDelta = aSrcRange.aStart.Tab() - aDestRange.aStart.Tab();
1357 
1358  sc::RefUpdateContext aCxt(rDoc);
1359  aCxt.meMode = URM_MOVE;
1360  aCxt.maRange = aSrcRange;
1361  aCxt.mnColDelta = nColDelta;
1362  aCxt.mnRowDelta = nRowDelta;
1363  aCxt.mnTabDelta = nTabDelta;
1364 
1365  // Global range names.
1366  ScRangeName* pName = rDoc.GetRangeName();
1367  if (pName)
1368  pName->UpdateReference(aCxt);
1369 
1370  SCTAB nTabCount = rDoc.GetTableCount();
1371  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
1372  {
1373  // Sheet-local range names.
1374  pName = rDoc.GetRangeName(nTab);
1375  if (pName)
1376  pName->UpdateReference(aCxt, nTab);
1377  }
1378 
1379  ScValidationDataList* pValidList = rDoc.GetValidationList();
1380  if (pValidList)
1381  {
1382  // Update the references of validation entries.
1383  pValidList->UpdateReference(aCxt);
1384  }
1385 
1386  DoUndo(aDestRange);
1387  DoUndo(aSrcRange);
1388 
1389  rDoc.BroadcastCells(aSrcRange, SfxHintId::ScDataChanged, false);
1390  }
1391  else
1392  DoUndo(aDestRange);
1393 
1394  for (size_t i = 0; i < maPaintRanges.size(); ++i)
1395  {
1396  const ScRange& r = maPaintRanges[i];
1398  }
1399 
1400  EndUndo();
1401  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1402 }
1403 
1405 {
1406  BeginRedo();
1407 
1408  ScDocument& rDoc = pDocShell->GetDocument();
1410 
1411  EnableDrawAdjust( &rDoc, false );
1412 
1413  // do not undo/redo objects and note captions, they are handled via drawing undo
1415 
1416  /* TODO: Redoing note captions is quite tricky due to the fact that a
1417  helper clip document is used. While (re-)pasting the contents to the
1418  destination area, the original pointers to the captions created while
1419  dropping have to be restored. A simple CopyFromClip() would create new
1420  caption objects that are not tracked by drawing undo, and the captions
1421  restored by drawing redo would live without cell note objects pointing
1422  to them. So, first, CopyToClip() and CopyFromClip() are called without
1423  cloning the caption objects. This leads to cell notes pointing to the
1424  wrong captions from source area that will be removed by drawing redo
1425  later. Second, the pointers to the new captions have to be restored.
1426  Sadly, currently these pointers are not stored anywhere but in the list
1427  of drawing undo actions. */
1428 
1429  SCTAB nTab;
1430  ScMarkData aSourceMark(rDoc.GetSheetLimits());
1431  for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
1432  aSourceMark.SelectTable( nTab, true );
1433 
1434  // do not clone objects and note captions into clipdoc (see above)
1435  // but at least copy notes
1436  ScClipParam aClipParam(aSrcRange, bCut);
1437  rDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, bKeepScenarioFlags, false);
1438 
1439  if (bCut)
1440  {
1441  ScRange aSrcPaintRange = aSrcRange;
1442  rDoc.ExtendMerge( aSrcPaintRange ); // before deleting
1443  sal_uInt16 nExtFlags = 0;
1444  pDocShell->UpdatePaintExt( nExtFlags, aSrcPaintRange );
1445  rDoc.DeleteAreaTab( aSrcRange, nRedoFlags );
1446  PaintArea( aSrcPaintRange, nExtFlags );
1447  }
1448 
1449  ScMarkData aDestMark(rDoc.GetSheetLimits());
1450  for (nTab=aDestRange.aStart.Tab(); nTab<=aDestRange.aEnd.Tab(); nTab++)
1451  aDestMark.SelectTable( nTab, true );
1452 
1453  bool bIncludeFiltered = bCut;
1454  // TODO: restore old note captions instead of cloning new captions...
1455  rDoc.CopyFromClip( aDestRange, aDestMark, InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS, nullptr, pClipDoc.get(), true, false, bIncludeFiltered );
1456 
1457  if (bCut)
1458  for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
1460  aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(), nTab );
1461 
1462  // skipped rows and merged cells don't mix
1463  if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
1464  pDocShell->GetDocFunc().UnmergeCells( aDestRange, false, nullptr );
1465 
1466  for (nTab=aDestRange.aStart.Tab(); nTab<=aDestRange.aEnd.Tab(); nTab++)
1467  {
1468  SCCOL nEndCol = aDestRange.aEnd.Col();
1469  SCROW nEndRow = aDestRange.aEnd.Row();
1471  nEndCol, nEndRow, nTab, true );
1473  nEndCol, nEndRow, nTab ), 0 );
1474  }
1475 
1476  SetChangeTrack();
1477 
1478  pClipDoc.reset();
1480 
1481  RedoSdrUndoAction( pDrawUndo.get() );
1482  EnableDrawAdjust( &rDoc, true );
1483 
1484  EndRedo();
1485  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1486 }
1487 
1489 {
1490 }
1491 
1492 bool ScUndoDragDrop::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1493 {
1494  return false; // not possible
1495 }
1496 
1497 // Insert list containing range names
1498 // (Insert|Name|Insert =>[List])
1500  ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc)
1501  : ScBlockUndo(pNewDocShell, rRange, SC_UNDO_AUTOHEIGHT)
1502  , xUndoDoc(std::move(pNewUndoDoc))
1503  , xRedoDoc(std::move(pNewRedoDoc))
1504 {
1505 }
1506 
1508 {
1509  return ScResId( STR_UNDO_LISTNAMES );
1510 }
1511 
1513 {
1514  ScDocument& rDoc = pDocShell->GetDocument();
1515 
1517  pSrcDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ALL, false, rDoc);
1521  if (pViewShell)
1522  pViewShell->CellContentChanged();
1523 }
1524 
1526 {
1527  BeginUndo();
1528  DoChange(xUndoDoc.get());
1529  EndUndo();
1530 }
1531 
1533 {
1534  BeginRedo();
1535  DoChange(xRedoDoc.get());
1536  EndRedo();
1537 }
1538 
1540 {
1541  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
1542  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->InsertNameList();
1543 }
1544 
1546 {
1547  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1548 }
1549 
1551  ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange& rRange):
1552  ScSimpleUndo( pNewDocShell ),
1553  mpUndoDoc(std::move(pUndoDoc)),
1554  mpRedoDoc(std::move(pRedoDoc)),
1555  maRange(rRange)
1556 {
1557 }
1558 
1560 {
1561 }
1562 
1564 {
1565  return ScResId( STR_UNDO_CONDFORMAT );
1566 }
1567 
1569 {
1570  DoChange(mpUndoDoc.get());
1571 }
1572 
1574 {
1575  DoChange(mpRedoDoc.get());
1576 }
1577 
1579 {
1580  ScDocument& rDoc = pDocShell->GetDocument();
1581 
1583  pSrcDoc->CopyToDocument(maRange, InsertDeleteFlags::ALL, false, rDoc);
1587  if (pViewShell)
1588  pViewShell->CellContentChanged();
1589 }
1590 
1592 {
1593 }
1594 
1596 {
1597  return false;
1598 }
1599 
1601  ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab):
1602  ScSimpleUndo( pNewDocShell ),
1603  mpUndoDoc(std::move(pUndoDoc)),
1604  mpRedoDoc(std::move(pRedoDoc)),
1605  mnTab(nTab)
1606 {
1607 }
1608 
1610 {
1611 }
1612 
1614 {
1615  return ScResId( STR_UNDO_CONDFORMAT_LIST );
1616 }
1617 
1619 {
1620  DoChange(mpUndoDoc.get());
1621 }
1622 
1624 {
1625  DoChange(mpRedoDoc.get());
1626 }
1627 
1629 {
1630  ScDocument& rDoc = pDocShell->GetDocument();
1631 
1632  if (pSrcDoc == mpUndoDoc.get())
1633  {
1634  mpRedoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc);
1635  mpUndoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc);
1636  }
1637  else
1638  {
1639  mpUndoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc);
1640  mpRedoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc);
1641  }
1642  rDoc.SetCondFormList(new ScConditionalFormatList(rDoc, *pSrcDoc->GetCondFormList(mnTab)), mnTab);
1643 
1647  if (pViewShell)
1648  pViewShell->CellContentChanged();
1649 }
1650 
1652 {
1653 }
1654 
1656 {
1657  return false;
1658 }
1659 
1661  const ScMarkData& rMark,
1662 /*C*/ const ScArea& rDestArea,
1663  ScDocumentUniquePtr pNewUndoDoc,
1664  const OUString& rNewName ) :
1665  ScSimpleUndo( pNewDocShell ),
1666  pUndoDoc( std::move(pNewUndoDoc) ),
1667  aMarkData( rMark ),
1668  aName( rNewName )
1669 {
1670  aRange.aStart.SetCol(rDestArea.nColStart);
1671  aRange.aStart.SetRow(rDestArea.nRowStart);
1672  aRange.aStart.SetTab(rDestArea.nTab);
1673  aRange.aEnd.SetCol(rDestArea.nColEnd);
1674  aRange.aEnd.SetRow(rDestArea.nRowEnd);
1675  aRange.aEnd.SetTab(rDestArea.nTab);
1676 }
1677 
1679 {
1680 }
1681 
1683 {
1684  return ScResId( STR_UNDO_USESCENARIO );
1685 }
1686 
1688 {
1689  BeginUndo();
1690 
1692  if (pViewShell)
1693  {
1694  pViewShell->DoneBlockMode();
1695  pViewShell->InitOwnBlockMode();
1696  }
1697 
1698  ScDocument& rDoc = pDocShell->GetDocument();
1700  pUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, true, rDoc, &aMarkData);
1701 
1702  // scenario table
1703  bool bFrame = false;
1704  SCTAB nTab = aRange.aStart.Tab();
1705  SCTAB nEndTab = nTab;
1706  while ( pUndoDoc->HasTable(nEndTab+1) && pUndoDoc->IsScenario(nEndTab+1) )
1707  ++nEndTab;
1708  for (SCTAB i = nTab+1; i<=nEndTab; i++)
1709  {
1710  // Flags always
1711  OUString aComment;
1712  Color aColor;
1713  ScScenarioFlags nScenFlags;
1714  pUndoDoc->GetScenarioData( i, aComment, aColor, nScenFlags );
1715  rDoc.SetScenarioData( i, aComment, aColor, nScenFlags );
1716  bool bActive = pUndoDoc->IsActiveScenario( i );
1717  rDoc.SetActiveScenario( i, bActive );
1718  // For copy-back scenario also consider content
1719  if ( nScenFlags & ScScenarioFlags::TwoWay )
1720  {
1721  rDoc.DeleteAreaTab( 0,0, rDoc.MaxCol(),rDoc.MaxRow(), i, InsertDeleteFlags::ALL );
1722  pUndoDoc->CopyToDocument(0,0,i, rDoc.MaxCol(),rDoc.MaxRow(),i, InsertDeleteFlags::ALL,false, rDoc);
1723  }
1724  if ( nScenFlags & ScScenarioFlags::ShowFrame )
1725  bFrame = true;
1726  }
1727 
1728  // if visible borders, then paint all
1729  if (bFrame)
1730  pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid | PaintPartFlags::Extras );
1731  else
1734  if (pViewShell)
1735  pViewShell->CellContentChanged();
1736 
1737  ShowTable( aRange.aStart.Tab() );
1738 
1739  EndUndo();
1740 }
1741 
1743 {
1744  SCTAB nTab = aRange.aStart.Tab();
1745  BeginRedo();
1746 
1748  if (pViewShell)
1749  {
1750  pViewShell->SetTabNo( nTab );
1751  pViewShell->DoneBlockMode();
1752  pViewShell->InitOwnBlockMode();
1753  }
1754 
1755  pDocShell->UseScenario( nTab, aName, false );
1756 
1757  EndRedo();
1758 }
1759 
1761 {
1762  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1763  {
1764  OUString aTemp = aName;
1765  pViewTarget->GetViewShell()->UseScenario(aTemp);
1766  }
1767 }
1768 
1770 {
1771  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1772  {
1773  ScViewData& rViewData = pViewTarget->GetViewShell()->GetViewData();
1774  return !rViewData.GetDocument().IsScenario( rViewData.GetTabNo() );
1775  }
1776  return false;
1777 }
1778 
1780  const ScMarkData& rMark,
1781  const ScRange& rRange,
1782  const OUString& rName,
1783  ScDocumentUniquePtr pNewUndoDoc ) :
1784  ScSimpleUndo( pNewDocShell ),
1785  aMarkData( rMark ),
1786  pUndoDoc( std::move(pNewUndoDoc) ),
1787  aStyleName( rName ),
1788  aRange( rRange )
1789 {
1791 }
1792 
1794 {
1795 }
1796 
1798 {
1799  return ScResId( STR_UNDO_APPLYCELLSTYLE );
1800 }
1801 
1802 void ScUndoSelectionStyle::DoChange( const bool bUndo )
1803 {
1804  ScDocument& rDoc = pDocShell->GetDocument();
1805 
1807 
1808  ScRange aWorkRange( aRange );
1809  if ( rDoc.HasAttrib( aWorkRange, HasAttrFlags::Merged ) ) // Merged cells?
1810  rDoc.ExtendMerge( aWorkRange, true );
1811 
1812  sal_uInt16 nExtFlags = 0;
1813  pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
1814 
1815  if (bUndo) // if Undo then push back all old data again
1816  {
1817  SCTAB nTabCount = rDoc.GetTableCount();
1818  ScRange aCopyRange = aWorkRange;
1819  aCopyRange.aStart.SetTab(0);
1820  aCopyRange.aEnd.SetTab(nTabCount-1);
1821  pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
1822  }
1823  else // if Redo, then reapply style
1824  {
1825  ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
1826  ScStyleSheet* pStyleSheet =
1827  static_cast<ScStyleSheet*>( pStlPool->Find( aStyleName, SfxStyleFamily::Para ) );
1828  if (!pStyleSheet)
1829  {
1830  OSL_FAIL("StyleSheet not found");
1831  return;
1832  }
1833  rDoc.ApplySelectionStyle( *pStyleSheet, aMarkData );
1834  }
1835 
1836  pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
1837 
1839  if ( !( pViewShell && pViewShell->AdjustBlockHeight() ) )
1840 /*A*/ pDocShell->PostPaint( aWorkRange, PaintPartFlags::Grid | PaintPartFlags::Extras, nExtFlags );
1841 
1842  ShowTable( aWorkRange.aStart.Tab() );
1843 }
1844 
1846 {
1847  BeginUndo();
1848  DoChange( true );
1849  EndUndo();
1850 }
1851 
1853 {
1854  BeginRedo();
1855  DoChange( false );
1856  EndRedo();
1857 }
1858 
1860 {
1861  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) == nullptr)
1862  return;
1863 
1864  ScDocument& rDoc = pDocShell->GetDocument();
1865  ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
1866  ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>( pStlPool->
1867  Find( aStyleName, SfxStyleFamily::Para ));
1868  if (!pStyleSheet)
1869  {
1870  OSL_FAIL("StyleSheet not found");
1871  return;
1872  }
1873 
1874  ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell();
1875  rViewShell.SetStyleSheetToMarked( pStyleSheet );
1876 }
1877 
1879 {
1880  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1881 }
1882 
1884  ScDocumentUniquePtr pNewUndoDoc, const OUString& rForm ) :
1885  ScBlockUndo( pNewDocShell, rArea, SC_UNDO_SIMPLE ),
1886  pUndoDoc( std::move(pNewUndoDoc) ),
1887  aFormula( rForm )
1888 {
1889  SetChangeTrack();
1890 }
1891 
1893 {
1894 }
1895 
1897 {
1898  return ScResId( STR_UNDO_ENTERMATRIX );
1899 }
1900 
1902 {
1903  ScDocument& rDoc = pDocShell->GetDocument();
1904  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1905  if ( pChangeTrack )
1906  pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
1908  else
1910 }
1911 
1913 {
1914  BeginUndo();
1915 
1916  ScDocument& rDoc = pDocShell->GetDocument();
1917 
1919  pUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1923  if (pViewShell)
1924  pViewShell->CellContentChanged();
1925 
1926  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1927  if ( pChangeTrack )
1928  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1929 
1930  EndUndo();
1931 }
1932 
1934 {
1935  BeginRedo();
1936 
1937  ScDocument& rDoc = pDocShell->GetDocument();
1938 
1939  ScMarkData aDestMark(rDoc.GetSheetLimits());
1940  aDestMark.SelectOneTable( aBlockRange.aStart.Tab() );
1941  aDestMark.SetMarkArea( aBlockRange );
1942 
1945  aDestMark, aFormula );
1946 
1947  SetChangeTrack();
1948 
1949  EndRedo();
1950 }
1951 
1953 {
1954  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
1955  {
1956  OUString aTemp = aFormula;
1957  ScDocument& rDoc = pDocShell->GetDocument();
1958  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->EnterMatrix(aTemp, rDoc.GetGrammar());
1959  }
1960 }
1961 
1963 {
1964  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1965 }
1966 
1968 {
1969  OSL_ENSURE( rMark.IsMultiMarked(), "wrong mark type" );
1970 
1971  ScRange aRange;
1972  rMark.GetMultiMarkArea( aRange );
1973  return aRange;
1974 }
1975 
1976 ScUndoIndent::ScUndoIndent( ScDocShell* pNewDocShell, const ScMarkData& rMark,
1977  ScDocumentUniquePtr pNewUndoDoc, bool bIncrement ) :
1978  ScBlockUndo( pNewDocShell, lcl_GetMultiMarkRange(rMark), SC_UNDO_AUTOHEIGHT ),
1979  aMarkData( rMark ),
1980  pUndoDoc( std::move(pNewUndoDoc) ),
1981  bIsIncrement( bIncrement )
1982 {
1983 }
1984 
1986 {
1987 }
1988 
1990 {
1991  const char* pId = bIsIncrement ? STR_UNDO_INC_INDENT : STR_UNDO_DEC_INDENT;
1992  return ScResId(pId);
1993 }
1994 
1996 {
1997  BeginUndo();
1998 
1999  ScDocument& rDoc = pDocShell->GetDocument();
2000  SCTAB nTabCount = rDoc.GetTableCount();
2001  ScRange aCopyRange = aBlockRange;
2002  aCopyRange.aStart.SetTab(0);
2003  aCopyRange.aEnd.SetTab(nTabCount-1);
2004  pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
2006 
2007  EndUndo();
2008 }
2009 
2011 {
2012  BeginRedo();
2013 
2014  ScDocument& rDoc = pDocShell->GetDocument();
2017 
2018  EndRedo();
2019 }
2020 
2022 {
2023  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2024  pViewTarget->GetViewShell()->ChangeIndent( bIsIncrement );
2025 }
2026 
2028 {
2029  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2030 }
2031 
2034  ScBlockUndo( pNewDocShell, lcl_GetMultiMarkRange(rMark), SC_UNDO_AUTOHEIGHT ),
2035  aMarkData( rMark ),
2036  pUndoDoc( std::move(pNewUndoDoc) ),
2037  nTransliterationType( nType )
2038 {
2039 }
2040 
2042 {
2043 }
2044 
2046 {
2047  return ScResId( STR_UNDO_TRANSLITERATE );
2048 }
2049 
2051 {
2052  BeginUndo();
2053 
2054  ScDocument& rDoc = pDocShell->GetDocument();
2055  SCTAB nTabCount = rDoc.GetTableCount();
2056  ScRange aCopyRange = aBlockRange;
2057  aCopyRange.aStart.SetTab(0);
2058  aCopyRange.aEnd.SetTab(nTabCount-1);
2059  pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::CONTENTS, true, rDoc, &aMarkData);
2061 
2062  EndUndo();
2063 }
2064 
2066 {
2067  BeginRedo();
2068 
2069  ScDocument& rDoc = pDocShell->GetDocument();
2072 
2073  EndRedo();
2074 }
2075 
2077 {
2078  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2079  pViewTarget->GetViewShell()->TransliterateText( nTransliterationType );
2080 }
2081 
2083 {
2084  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2085 }
2086 
2088  ScDocumentUniquePtr pNewUndoDoc, const sal_uInt16* pW ) :
2089  ScBlockUndo( pNewDocShell, lcl_GetMultiMarkRange(rMark), SC_UNDO_AUTOHEIGHT ),
2090  aMarkData( rMark ),
2091  pUndoDoc( std::move(pNewUndoDoc) )
2092 {
2093  OSL_ENSURE( pW, "ScUndoClearItems: Which-Pointer is Null" );
2094 
2095  sal_uInt16 nCount = 0;
2096  while ( pW[nCount] )
2097  ++nCount;
2098  pWhich.reset( new sal_uInt16[nCount+1] );
2099  for (sal_uInt16 i=0; i<=nCount; i++)
2100  pWhich[i] = pW[i];
2101 }
2102 
2104 {
2105 }
2106 
2108 {
2109  return ScResId( STR_UNDO_DELETECONTENTS );
2110 }
2111 
2113 {
2114  BeginUndo();
2115 
2116  ScDocument& rDoc = pDocShell->GetDocument();
2117  pUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
2119 
2120  EndUndo();
2121 }
2122 
2124 {
2125  BeginRedo();
2126 
2127  ScDocument& rDoc = pDocShell->GetDocument();
2128  rDoc.ClearSelectionItems( pWhich.get(), aMarkData );
2130 
2131  EndRedo();
2132 }
2133 
2135 {
2136  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2137  {
2138  ScViewData& rViewData = pViewTarget->GetViewShell()->GetViewData();
2139  rViewData.GetDocFunc().ClearItems( rViewData.GetMarkData(), pWhich.get(), false );
2140  }
2141 }
2142 
2144 {
2145  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2146 }
2147 
2148 // remove all line breaks of a table
2150  SCTAB nNewTab, ScDocumentUniquePtr pNewUndoDoc ) :
2151  ScSimpleUndo( pNewDocShell ),
2152  nTab( nNewTab ),
2153  pUndoDoc( std::move(pNewUndoDoc) )
2154 {
2155 }
2156 
2158 {
2159 }
2160 
2162 {
2163  return ScResId( STR_UNDO_REMOVEBREAKS );
2164 }
2165 
2167 {
2168  BeginUndo();
2169 
2170  ScDocument& rDoc = pDocShell->GetDocument();
2172 
2173  pUndoDoc->CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, rDoc);
2174  if (pViewShell)
2175  pViewShell->UpdatePageBreakData( true );
2176  pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid );
2177 
2178  EndUndo();
2179 }
2180 
2182 {
2183  BeginRedo();
2184 
2185  ScDocument& rDoc = pDocShell->GetDocument();
2187 
2188  rDoc.RemoveManualBreaks(nTab);
2189  rDoc.UpdatePageBreaks(nTab);
2190  if (pViewShell)
2191  pViewShell->UpdatePageBreakData( true );
2192  pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid );
2193 
2194  EndRedo();
2195 }
2196 
2198 {
2199  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2200  {
2201  ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
2202  rViewShell.RemoveManualBreaks();
2203  }
2204 }
2205 
2207 {
2208  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2209 }
2210 
2212  const ScCellMergeOption& rOption, ScDocumentUniquePtr pNewUndoDoc ) :
2213  ScBlockUndo( pNewDocShell, rOption.getFirstSingleRange(), SC_UNDO_SIMPLE ),
2214  pUndoDoc( std::move(pNewUndoDoc) )
2215 {
2216  maOptions.push_back( rOption);
2217 }
2218 
2220  const ScRange& rRange, ScDocumentUniquePtr pNewUndoDoc ) :
2221  ScBlockUndo( pNewDocShell, rRange, SC_UNDO_SIMPLE ),
2222  pUndoDoc( std::move(pNewUndoDoc) )
2223 {
2224 }
2225 
2227 {
2228 }
2229 
2231 {
2232  return ScResId( STR_UNDO_REMERGE ); // "remove merge"
2233 }
2234 
2236 {
2237  return pUndoDoc.get();
2238 }
2239 
2241 {
2242  maOptions.push_back( rOption);
2243 }
2244 
2246 {
2247  using ::std::set;
2248 
2249  SetCurTab();
2250  BeginUndo();
2251 
2253 
2254  ScDocument& rDoc = pDocShell->GetDocument();
2255  for (const auto & rOption : maOptions)
2256  {
2257  for (const auto& rTab : rOption.maTabs)
2258  {
2259  OSL_ENSURE(pUndoDoc, "NULL pUndoDoc!");
2260  if (!pUndoDoc)
2261  continue;
2262  // There is no need to extend merge area because it's already been extended.
2263  ScRange aRange = rOption.getSingleRange(rTab);
2265  pUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::ATTRIB, false, rDoc);
2266 
2267  bool bDidPaint = false;
2268  if ( pViewShell )
2269  {
2270  pViewShell->SetTabNo(rTab);
2271  bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow);
2272  }
2273  if (!bDidPaint)
2275  }
2276  }
2277 
2278  EndUndo();
2279 }
2280 
2282 {
2283  using ::std::set;
2284 
2285  SetCurTab();
2286  BeginRedo();
2287 
2288  ScDocument& rDoc = pDocShell->GetDocument();
2290 
2291  for (const auto & rOption : maOptions)
2292  {
2293  for (const SCTAB nTab : rOption.maTabs)
2294  {
2295  // There is no need to extend merge area because it's already been extended.
2296  ScRange aRange = rOption.getSingleRange(nTab);
2297 
2298  const SfxPoolItem& rDefAttr = rDoc.GetPool()->GetDefaultItem( ATTR_MERGE );
2299  ScPatternAttr aPattern( rDoc.GetPool() );
2300  aPattern.GetItemSet().Put( rDefAttr );
2301  rDoc.ApplyPatternAreaTab( rOption.mnStartCol, rOption.mnStartRow,
2302  rOption.mnEndCol, rOption.mnEndRow, nTab,
2303  aPattern );
2304 
2305  rDoc.RemoveFlagsTab( rOption.mnStartCol, rOption.mnStartRow,
2306  rOption.mnEndCol, rOption.mnEndRow, nTab,
2307  ScMF::Hor | ScMF::Ver );
2308 
2309  rDoc.ExtendMerge(aRange, true);
2310 
2311  // Paint
2312 
2313  bool bDidPaint = false;
2314  if ( pViewShell )
2315  {
2316  pViewShell->SetTabNo(nTab);
2317  bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow);
2318  }
2319  if (!bDidPaint)
2321  }
2322  }
2323 
2324  EndRedo();
2325 }
2326 
2328 {
2329  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2330  pViewTarget->GetViewShell()->RemoveMerge();
2331 }
2332 
2334 {
2335  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2336 }
2337 
2339 {
2340  SCTAB nCurTab = ScDocShell::GetCurTab();
2341  aBlockRange.aStart.SetTab(nCurTab);
2342  aBlockRange.aEnd.SetTab(nCurTab);
2343 }
2344 
2346 static ScRange lcl_TotalRange( const ScRangeList& rRanges )
2347 {
2348  ScRange aTotal;
2349  if ( !rRanges.empty() )
2350  {
2351  aTotal = rRanges[ 0 ];
2352  for ( size_t i = 1, nCount = rRanges.size(); i < nCount; ++i )
2353  {
2354  ScRange const & rRange = rRanges[ i ];
2355  if (rRange.aStart.Col() < aTotal.aStart.Col()) aTotal.aStart.SetCol(rRange.aStart.Col());
2356  if (rRange.aStart.Row() < aTotal.aStart.Row()) aTotal.aStart.SetRow(rRange.aStart.Row());
2357  if (rRange.aStart.Tab() < aTotal.aStart.Tab()) aTotal.aStart.SetTab(rRange.aStart.Tab());
2358  if (rRange.aEnd.Col() > aTotal.aEnd.Col() ) aTotal.aEnd.SetCol( rRange.aEnd.Col() );
2359  if (rRange.aEnd.Row() > aTotal.aEnd.Row() ) aTotal.aEnd.SetRow( rRange.aEnd.Row() );
2360  if (rRange.aEnd.Tab() > aTotal.aEnd.Tab() ) aTotal.aEnd.SetTab(rRange.aEnd.Tab() );
2361  }
2362  }
2363  return aTotal;
2364 }
2365 
2367  const ScRangeList& rRangeList, ScDocumentUniquePtr pNewUndoDoc,
2368  const SvxBoxItem& rNewOuter, const SvxBoxInfoItem& rNewInner)
2369  : ScBlockUndo(pNewDocShell, lcl_TotalRange(rRangeList), SC_UNDO_SIMPLE)
2370  , xUndoDoc(std::move(pNewUndoDoc))
2371 {
2372  xRanges.reset(new ScRangeList(rRangeList));
2373  xOuter.reset(new SvxBoxItem(rNewOuter));
2374  xInner.reset(new SvxBoxInfoItem(rNewInner));
2375 }
2376 
2378 {
2379  return ScResId( STR_UNDO_SELATTRLINES );
2380 }
2381 
2383 {
2384  BeginUndo();
2385 
2386  ScDocument& rDoc = pDocShell->GetDocument();
2387  ScMarkData aMarkData(rDoc.GetSheetLimits());
2388  aMarkData.MarkFromRangeList(*xRanges, false);
2389  xUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
2391 
2392  EndUndo();
2393 }
2394 
2396 {
2397  BeginRedo();
2398 
2399  ScDocument& rDoc = pDocShell->GetDocument(); // call function at docfunc
2400  size_t nCount = xRanges->size();
2401  for (size_t i = 0; i < nCount; ++i )
2402  {
2403  ScRange const & rRange = (*xRanges)[i];
2404  SCTAB nTab = rRange.aStart.Tab();
2405 
2406  ScMarkData aMark(rDoc.GetSheetLimits());
2407  aMark.SetMarkArea( rRange );
2408  aMark.SelectTable( nTab, true );
2409 
2410  rDoc.ApplySelectionFrame(aMark, *xOuter, xInner.get());
2411  }
2412  for (size_t i = 0; i < nCount; ++i)
2414 
2415  EndRedo();
2416 }
2417 
2419 {
2420  //TODO later (when the function has moved from cellsuno to docfunc)
2421 }
2422 
2423 bool ScUndoBorder::CanRepeat(SfxRepeatTarget& /* rTarget */) const
2424 {
2425  return false; // See above
2426 }
2427 
2428 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3046
std::unique_ptr< SdrUndoAction > pDrawUndo
Definition: undobase.hxx:87
#define SC_PF_TESTMERGE
Definition: docsh.hxx:75
ScUndoIndent(ScDocShell *pNewDocShell, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc, bool bIncrement)
Definition: undoblk.cxx:1976
virtual void Undo() override
Definition: undoblk.cxx:736
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:886
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:905
void DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1586
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6221
SCROW mnRowDelta
Amount and direction of movement in the row direction.
sal_uLong nEndChangeAction
Definition: undoblk.hxx:749
SC_DLLPUBLIC void ApplySelectionStyle(const ScStyleSheet &rStyle, const ScMarkData &rMark)
Definition: document.cxx:4859
virtual ~ScUndoRemoveBreaks() override
Definition: undoblk.cxx:2157
virtual void Undo() override
Definition: undoblk.cxx:1568
sal_uLong nStartChangeAction
Definition: undoblk.hxx:207
void ClearItems(const ScMarkData &rMark, const sal_uInt16 *pWhich, bool bApi)
Definition: docfunc.cxx:4093
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2423
void DeleteRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1367
bool RefreshAutoFilter(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
Definition: document.cxx:5672
SCCOL nColEnd
Definition: rangeutl.hxx:242
void ClearSelectionItems(const sal_uInt16 *pWhich, const ScMarkData &rMark)
Definition: document.cxx:5920
SCCOL nColStart
Definition: rangeutl.hxx:240
void MarkToSimple()
Definition: markdata.cxx:237
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1760
void SetChangeTrack()
Definition: undoblk.cxx:952
ScAddress aStart
Definition: address.hxx:500
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1655
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:113
void RemoveManualBreaks()
Definition: viewfun2.cxx:975
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1952
ScUndoPaste(ScDocShell *pNewDocShell, const ScRangeList &rRanges, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc, InsertDeleteFlags nNewFlags, std::unique_ptr< ScRefUndoData > pRefData, bool bRedoIsFilled=true, const ScUndoPasteOptions *pOptions=nullptr)
Definition: undoblk.cxx:916
virtual OUString GetComment() const override
Definition: undoblk.cxx:1563
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
ScUndoTransliterate(ScDocShell *pNewDocShell, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc, TransliterationFlags nType)
Definition: undoblk.cxx:2032
SCROW nRowStart
Definition: rangeutl.hxx:241
void IncTab(SCTAB nDelta=1)
Definition: address.hxx:308
virtual void Redo() override
Definition: undoblk.cxx:1532
virtual void Redo() override
Definition: undoblk.cxx:310
Sheet / outlining (grouping) information.
SCROW Row() const
Definition: address.hxx:262
void PostPaintGridAll()
Definition: docsh3.cxx:181
const char aData[]
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
Definition: docsh5.cxx:405
ScRangeList maPaintRanges
Definition: undoblk.hxx:234
void MarkToMulti()
Definition: markdata.cxx:224
virtual ~ScUndoEnterMatrix() override
Definition: undoblk.cxx:1892
virtual void Undo() override
Definition: undoblk.cxx:1341
static weld::Window * GetActiveDialogParent()
Definition: docsh.cxx:2949
const Fraction & GetZoomX() const
Definition: viewdata.hxx:459
SC_DLLPUBLIC void CopyFromClip(const ScRange &rDestRange, const ScMarkData &rMark, InsertDeleteFlags nInsFlag, ScDocument *pRefUndoDoc, ScDocument *pClipDoc, bool bResetCut=true, bool bAsLink=false, bool bIncludeFiltered=true, bool bSkipAttrForEmpty=false, const ScRangeList *pDestRanges=nullptr)
If pDestRanges is given it overrides rDestRange, rDestRange in this case is the overall encompassing ...
Definition: document.cxx:2798
static ScRange lcl_GetMultiMarkRange(const ScMarkData &rMark)
Definition: undoblk.cxx:1967
virtual void Undo() override
Definition: undoblk.cxx:1995
std::unique_ptr< SCTAB[]> pScenarios
Definition: undoblk.hxx:63
OUString aFormula
Definition: undoblk.hxx:747
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2134
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1682
virtual void Undo() override
Definition: undoblk.cxx:2112
void SetChangeTrack()
Definition: undoblk.cxx:1901
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
Definition: documen9.cxx:193
ScScenarioFlags
Definition: global.hxx:236
virtual OUString GetComment() const override
Definition: undoblk.cxx:831
void DoChange(const bool bUndo)
Definition: undoblk.cxx:1802
virtual void Undo() override
Definition: undoblk.cxx:888
sal_uIntPtr sal_uLong
void AddCellMergeOption(const ScCellMergeOption &rOption)
Definition: undoblk.cxx:2240
Context for reference update during shifting, moving or copying of cell ranges.
ScUndoRemoveMerge(ScDocShell *pNewDocShell, const ScCellMergeOption &rOption, ScDocumentUniquePtr pNewUndoDoc)
Definition: undoblk.cxx:2211
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2418
ScDocFunc & GetDocFunc() const
Definition: viewdata.cxx:3029
ScDocumentUniquePtr mpRedoDoc
Definition: undoblk.hxx:634
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1962
sal_Int64 n
virtual ~ScUndoDeleteCells() override
Definition: undoblk.cxx:373
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:325
virtual void Redo() override
Definition: undoblk.cxx:1623
std::unique_ptr< ScRangeList > xRanges
Definition: undoblk.hxx:979
ScRange aDestRange
Definition: undoblk.hxx:237
ScRange aEffRange
Definition: undoblk.hxx:58
virtual ~ScUndoSelectionStyle() override
Definition: undoblk.cxx:1793
const SfxItemSet & GetItemSet() const
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: undobase.cxx:65
virtual OUString GetComment() const override
Definition: undoblk.cxx:99
double GetPPTX() const
Definition: viewdata.hxx:468
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: undoblk.cxx:104
std::unique_ptr< SdrUndoAction > pDrawUndo
Definition: undobase.hxx:143
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void BeginUndo()
Definition: undobase.cxx:255
InsertDeleteFlags nFlags
Definition: undoblk.hxx:204
ScRange Combine() const
Definition: rangelst.cxx:1114
ScAddress aEnd
Definition: address.hxx:501
ScMarkData aMarkData
Definition: undoblk.hxx:679
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
bool InsertCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1499
virtual void Redo() override
Definition: undoblk.cxx:1742
static css::uno::Reference< css::datatransfer::XTransferable2 > GetClipData(vcl::Window *pWin)
Definition: tabvwshc.cxx:483
virtual OUString GetComment() const override
Definition: undoblk.cxx:947
bool SetViewMarkData(const ScMarkData &rMarkData)
Definition: undobase.cxx:52
void SetChangeTrack()
Definition: undoblk.cxx:836
sal_uLong nStartChangeAction
Definition: undoblk.hxx:97
virtual ~ScUndoRemoveMerge() override
Definition: undoblk.cxx:2226
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:985
void EndUndo()
Definition: undobase.cxx:122
virtual ~ScUndoPaste() override
Definition: undoblk.cxx:939
ScUndoSelectionStyle(ScDocShell *pNewDocShell, const ScMarkData &rMark, const ScRange &rRange, const OUString &rName, ScDocumentUniquePtr pNewUndoDoc)
Definition: undoblk.cxx:1779
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1591
ScDocumentUniquePtr mpUndoDoc
Definition: undoblk.hxx:633
virtual OUString GetComment() const override
Definition: undoblk.cxx:1896
sal_uLong GetActionMax() const
Definition: chgtrack.hxx:961
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1595
virtual void Redo() override
Definition: undoblk.cxx:1852
sal_uLong nStartChangeAction
Definition: undoblk.hxx:238
ScMarkData aMarkData
Definition: undoblk.hxx:906
virtual OUString GetComment() const override
Definition: undoblk.cxx:377
void DoUndo(ScRange aRange)
Definition: undoblk.cxx:1304
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5179
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:911
bool bIsIncrement
Definition: undoblk.hxx:866
static void notifyAllViewsSheetGeomInvalidation(const SfxViewShell *pForViewShell, bool bColumns, bool bRows, bool bSizes, bool bHidden, bool bFiltered, bool bGroups, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY for all views whose current tab is equal to nCurrentTa...
Definition: tabvwshc.cxx:556
ScMarkData aMarkData
Definition: undoblk.hxx:884
static void ShowTable(SCTAB nTab)
Definition: undobase.cxx:221
void MarkFromRangeList(const ScRangeList &rList, bool bReset)
Definition: markdata.cxx:334
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
virtual OUString GetComment() const override
Definition: undoblk.cxx:1682
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:958
virtual ~ScUndoInsertCells() override
Definition: undoblk.cxx:95
SfxApplication * SfxGetpApp()
Internal use only (d&d undo): do not delete caption objects of cell notes.
DelCellCmd
Definition: global.hxx:290
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6061
void TransliterateText(const ScMarkData &rMultiMark, TransliterationFlags nType)
Definition: documen8.cxx:1208
virtual void Undo() override
Definition: undoblk.cxx:1845
ScRange aBlockRange
Definition: undobase.hxx:86
void EndUndo()
Definition: undobase.cxx:442
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:634
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1188
void SetChangeTrack()
Definition: undoblk.cxx:129
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:857
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:202
ScDocumentUniquePtr mpRedoDoc
Definition: undoblk.hxx:655
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
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:45
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:24
void SetChangeTrack()
Definition: undoblk.cxx:1236
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
sal_uLong nStartChangeAction
Definition: undoblk.hxx:157
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2027
bool IsMultiMarked() const
Definition: markdata.hxx:83
bool bKeepScenarioFlags
Definition: undoblk.hxx:241
int nCount
const ScValidationDataList * GetValidationList() const
Definition: document.hxx:1792
SC_DLLPUBLIC void AppendMove(const ScRange &rFromRange, const ScRange &rToRange, ScDocument *pRefDoc)
Definition: chgtrack.cxx:2580
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:865
std::unique_ptr< SvxBoxItem > xOuter
Definition: undoblk.hxx:980
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
ScDocument * GetUndoDoc()
Definition: undoblk.cxx:2235
SCROW nRowEnd
Definition: rangeutl.hxx:243
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:930
InsCellCmd eCmd
Definition: undoblk.hxx:65
void RedoSdrUndoAction(SdrUndoAction *pUndoAction)
Definition: undoolk.cxx:61
ScUndoListNames(ScDocShell *pNewDocShell, const ScRange &rRange, ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc)
Definition: undoblk.cxx:1499
SCTAB Tab() const
Definition: address.hxx:271
void SetRow(SCROW nRowP)
Definition: address.hxx:275
ScDocumentUniquePtr xRedoDoc
Definition: undoblk.hxx:612
virtual void Undo() override
Definition: undoblk.cxx:2382
ScUndoConditionalFormat(ScDocShell *pNewDocShell, ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange &rRange)
Definition: undoblk.cxx:1550
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:408
virtual void Undo() override
Definition: undoblk.cxx:1687
void SetChangeTrack()
Definition: undoblk.cxx:382
virtual void Undo() override
Definition: undoblk.cxx:1618
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2076
ScDocument * GetDocument() const
Definition: transobj.hxx:81
SC_DLLPUBLIC void ApplyPatternArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScMarkData &rMark, const ScPatternAttr &rAttr, ScEditDataArray *pDataArray=nullptr, bool *const pIsChanged=nullptr)
Definition: document.cxx:4769
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
void UpdateReference(sc::RefUpdateContext &rCxt, SCTAB nLocalTab=-1)
Definition: rangenam.cxx:704
void SetCol(SCCOL nColP)
Definition: address.hxx:279
std::unique_ptr< SfxUndoAction > pPasteUndo
Definition: undoblk.hxx:68
ScUndoPasteOptions aPasteOptions
Definition: undoblk.hxx:210
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
TransliterationFlags
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2197
SC_DLLPUBLIC void Undo(sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge=false)
Definition: chgtrack.cxx:3088
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:628
virtual void Undo() override
Definition: undoblk.cxx:295
bool empty() const
Definition: rangelst.hxx:89
void OnLOKInsertDeleteColumn(SCCOL nStartCol, long nOffset)
Definition: viewfunc.cxx:1464
sal_uLong nEndChangeAction
Definition: undoblk.hxx:98
virtual ~ScUndoCut() override
Definition: undoblk.cxx:827
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
virtual void Undo() override
Definition: undoblk.cxx:2050
SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData &rMark, const OUString &rFormula, const ScTokenArray *p=nullptr, const formula::FormulaGrammar::Grammar=formula::FormulaGrammar::GRAM_DEFAULT)
Definition: documen4.cxx:257
ScUndoDeleteCells(ScDocShell *pNewDocShell, const ScRange &rRange, SCTAB nNewCount, std::unique_ptr< SCTAB[]> pNewTabs, std::unique_ptr< SCTAB[]> pNewScenarios, DelCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr< ScRefUndoData > pRefData)
Definition: undoblk.cxx:346
ScUndoClearItems(ScDocShell *pNewDocShell, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc, const sal_uInt16 *pW)
Definition: undoblk.cxx:2087
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:97
void SetTab(SCTAB nTabP)
Definition: address.hxx:283
void BeginRedo()
Definition: undobase.cxx:142
virtual void Undo() override
Definition: undoblk.cxx:1149
virtual void Redo() override
Definition: undoblk.cxx:1404
SC_DLLPUBLIC void SetScenarioData(SCTAB nTab, const OUString &rComment, const Color &rColor, ScScenarioFlags nFlags)
Definition: documen3.cxx:432
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:812
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:872
virtual void Redo() override
Definition: undoblk.cxx:1159
virtual void Undo() override
Definition: undoblk.cxx:2166
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1878
sal_uInt16 char * pName
Definition: callform.cxx:58
ScUndoInsertCells(ScDocShell *pNewDocShell, const ScRange &rRange, SCTAB nNewCount, std::unique_ptr< SCTAB[]> pNewTabs, std::unique_ptr< SCTAB[]> pNewScenarios, InsCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr< ScRefUndoData > pRefData, bool bNewPartOfPaste)
Definition: undoblk.cxx:66
SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:4547
ScMarkData aMarkData
Definition: undoblk.hxx:863
void UpdateReference(sc::RefUpdateContext &rCxt)
Definition: validat.cxx:1051
ScUndoConditionalFormatList(ScDocShell *pNewDocShell, ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab)
Definition: undoblk.cxx:1600
virtual ~ScUndoConditionalFormatList() override
Definition: undoblk.cxx:1609
virtual void Redo() override
Definition: undoblk.cxx:2123
sal_uLong nEndChangeAction
Definition: undoblk.hxx:239
virtual OUString GetComment() const override
Definition: undoblk.cxx:1613
std::vector< ScCellMergeOption > maOptions
Definition: undoblk.hxx:957
int i
sal_uLong nStartChangeAction
Definition: undoblk.hxx:748
ScDocumentUniquePtr xUndoDoc
Definition: undoblk.hxx:611
UpdateRefMode meMode
update mode - insert/delete, copy, or move.
SC_DLLPUBLIC void SetActiveScenario(SCTAB nTab, bool bActive)
Definition: documen3.cxx:877
virtual void Redo() override
Definition: undoblk.cxx:603
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:304
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
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:158
std::unique_ptr< SvxBoxInfoItem > xInner
Definition: undoblk.hxx:981
ScDocShell * pDocShell
Definition: undobase.hxx:48
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2082
SC_DLLPUBLIC bool SetOptimalHeight(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
Definition: document.cxx:4266
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:874
bool InsertRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1248
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1793
ScUndoRemoveBreaks(ScDocShell *pNewDocShell, SCTAB nNewTab, ScDocumentUniquePtr pNewUndoDoc)
Definition: undoblk.cxx:2149
virtual OUString GetComment() const override
Definition: undoblk.cxx:1797
std::unique_ptr< ScRefUndoData > pRefRedoData
Definition: undoblk.hxx:206
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2327
ScUndoUseScenario(ScDocShell *pNewDocShell, const ScMarkData &rMark, const ScArea &rDestArea, ScDocumentUniquePtr pNewUndoDoc, const OUString &rNewName)
Definition: undoblk.cxx:1660
ScUndoBorder(ScDocShell *pNewDocShell, const ScRangeList &rRangeList, ScDocumentUniquePtr pNewUndoDoc, const SvxBoxItem &rNewOuter, const SvxBoxInfoItem &rNewInner)
Definition: undoblk.cxx:2366
size_t size() const
Definition: rangelst.hxx:90
void IncRow(SCROW nDelta=1)
Definition: address.hxx:300
void DoChange(const bool bUndo)
Definition: undoblk.cxx:392
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:189
OUString ScResId(const char *pId)
Definition: scdll.cxx:95
ScDocumentUniquePtr pRefUndoDoc
Definition: undobase.hxx:144
ScMarkData aMarkData
Definition: undoblk.hxx:201
virtual ~ScUndoUseScenario() override
Definition: undoblk.cxx:1678
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3062
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2333
ScMarkData aMarkData
Definition: undoblk.hxx:701
ScMarkData aMarkData
Definition: undoblk.hxx:153
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4786
ScUndoCut(ScDocShell *pNewDocShell, const ScRange &aRange, const ScAddress &aOldEnd, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc)
Definition: undoblk.cxx:817
void OnLOKInsertDeleteRow(SCROW nStartRow, long nOffset)
Definition: viewfunc.cxx:1520
virtual OUString GetComment() const override
Definition: undoblk.cxx:1989
ScPasteFunc nFunction
Definition: undoblk.hxx:166
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:677
ScRange aSrcRange
Definition: undoblk.hxx:236
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:341
void UseScenario(SCTAB nTab, const OUString &rName, bool bRecord=true)
Definition: docsh5.cxx:660
SC_DLLPUBLIC void AppendDeleteRange(const ScRange &, ScDocument *pRefDoc, SCTAB nDz, sal_uLong nRejectingInsert)
Definition: chgtrack.cxx:2444
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2206
void InitOwnBlockMode()
Definition: tabview2.cxx:331
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1539
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:703
ScDocumentUniquePtr mpUndoDoc
Definition: undoblk.hxx:654
void RemoveManualBreaks(SCTAB nTab)
Definition: document.cxx:6227
static void notifyAllViewsHeaderInvalidation(const SfxViewShell *pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex...
Definition: tabvwshc.cxx:499
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
std::unique_ptr< sal_uInt16[]> pWhich
Definition: undoblk.hxx:910
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
void PaintArea(ScRange aRange, sal_uInt16 nExtFlags) const
Definition: undoblk.cxx:1255
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5568
void ForgetNoteCaptions(const ScRangeList &rRanges, bool bPreserveData)
Definition: document.cxx:6631
ScRange maRange
Range of cells that are about to be moved for insert/delete/move modes.
SC_DLLPUBLIC bool PasteFromClip(InsertDeleteFlags nFlags, ScDocument *pClipDoc, ScPasteFunc nFunction=ScPasteFunc::NONE, bool bSkipEmpty=false, bool bTranspose=false, bool bAsLink=false, InsCellCmd eMoveMode=INS_NONE, InsertDeleteFlags nUndoExtraFlags=InsertDeleteFlags::NONE, bool bAllowDialogs=false)
Definition: viewfun3.cxx:875
void PostDataChanged()
Definition: docsh3.cxx:91
SfxViewShell * GetViewShell() const
sal_uInt16 mnPaintExtFlags
Definition: undoblk.hxx:233
void DoChange(const bool bUndo)
Definition: undoblk.cxx:141
void BroadcastCells(const ScRange &rRange, SfxHintId nHint, bool bBroadcastSingleBroadcasters=true)
Definition: documen7.cxx:143
SCCOL Col() const
Definition: address.hxx:267
ScDocumentUniquePtr xUndoDoc
Definition: undoblk.hxx:978
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1651
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1170
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2143
virtual void Undo() override
Definition: undoblk.cxx:2245
sal_uLong nStartChangeAction
Definition: undoblk.hxx:128
void BeginUndo()
Definition: undobase.cxx:435
virtual void Redo() override
Definition: undoblk.cxx:2395
OUString aName
Definition: undoblk.hxx:680
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1769
virtual ~ScUndoDeleteMulti() override
Definition: undoblk.cxx:654
ScRange aExtendedRange
Definition: undoblk.hxx:156
virtual void Undo() override
Definition: undoblk.cxx:1525
bool UnmergeCells(const ScRange &rRange, bool bRecord, ScUndoRemoveMerge *pUndoRemoveMerge)
Definition: docfunc.cxx:5053
ScRange aEffRange
Definition: undoblk.hxx:91
void DoChange(bool bUndo)
Definition: undoblk.cxx:967
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:18
static ScRange lcl_TotalRange(const ScRangeList &rRanges)
set only border, for ScRangeList (StarOne)
Definition: undoblk.cxx:2346
#define SC_PF_LINES
Definition: docsh.hxx:74
double GetPPTY() const
Definition: viewdata.hxx:469
virtual OUString GetComment() const override
Definition: undoblk.cxx:2107
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow)
Definition: viewfun2.cxx:191
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1023
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:155
virtual void Redo() override
Definition: undoblk.cxx:2065
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:427
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:166
sal_uLong nEndChangeAction
Definition: undoblk.hxx:208
virtual void Redo() override
Definition: undoblk.cxx:2010
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:908
virtual OUString GetComment() const override
Definition: undoblk.cxx:2230
void DoUndo(ScDocument *pDoc, bool bUndoRefFirst)
Definition: refundo.cxx:135
std::unique_ptr< SCTAB[]> pTabs
Definition: undoblk.hxx:94
SCTAB mnTabDelta
Amount and direction of movement in the sheet direction.
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1492
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 ~ScUndoDragDrop() override
Definition: undoblk.cxx:1225
virtual OUString GetComment() const override
Definition: undoblk.cxx:1229
OUString aName
SCTAB GetFirstSelected() const
Definition: markdata.cxx:200
ScRangeList maBlockRanges
Definition: undobase.hxx:106
SC_DLLPUBLIC bool RemoveFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:5023
InsCellCmd
Definition: global.hxx:299
virtual void Redo() override
Definition: undoblk.cxx:778
virtual void Undo() override
Definition: undoblk.cxx:1912
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1859
void DoChange(ScDocument *pDoc)
Definition: undoblk.cxx:1578
ScUndoDragDrop(ScDocShell *pNewDocShell, const ScRange &rRange, const ScAddress &aNewDestPos, bool bNewCut, ScDocumentUniquePtr pUndoDocument, bool bScenario)
Definition: undoblk.cxx:1193
static SC_DLLPUBLIC ScTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: transobj.cxx:192
void SetStyleSheetToMarked(const SfxStyleSheet *pStyleSheet)
Definition: viewfunc.cxx:1315
void EndUndo()
Definition: undobase.cxx:261
std::unique_ptr< SdrUndoAction > mpDrawUndo
Definition: undobase.hxx:107
sal_uLong nEndChangeAction
Definition: undoblk.hxx:158
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
ScUndoEnterMatrix(ScDocShell *pNewDocShell, const ScRange &rArea, ScDocumentUniquePtr pNewUndoDoc, const OUString &rForm)
Definition: undoblk.cxx:1883
virtual OUString GetComment() const override
Definition: undoblk.cxx:658
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:805
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
virtual OUString GetComment() const override
Definition: undoblk.cxx:2377
virtual OUString GetComment() const override
Definition: undoblk.cxx:2161
void DoChange(ScDocument *pSrcDoc) const
Definition: undoblk.cxx:1512
virtual void Redo() override
Definition: undoblk.cxx:1933
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6066
virtual void Redo() override
Definition: undoblk.cxx:2281
ScDocumentUniquePtr pRedoDoc
Definition: undoblk.hxx:203
std::unique_ptr< SCTAB[]> pScenarios
Definition: undoblk.hxx:96
void EndRedo()
Definition: undobase.cxx:273
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2021
TransliterationFlags nTransliterationType
Definition: undoblk.hxx:888
void DoChange(const ScDocument *pDoc)
Definition: undoblk.cxx:1628
virtual ~ScUndoClearItems() override
Definition: undoblk.cxx:2103
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1545
void BroadcastChanges(const ScRange &rRange)
Definition: undobase.cxx:174
virtual void Redo() override
Definition: undoblk.cxx:1573
ScRange & front()
Definition: rangelst.hxx:93
SCTAB nTab
Definition: rangeutl.hxx:239
DelCellCmd eCmd
Definition: undoblk.hxx:99
InsCellCmd eMoveMode
Definition: undoblk.hxx:170
virtual void Undo() override
Definition: undoblk.cxx:567
void GetMultiMarkArea(ScRange &rRange) const
Definition: markdata.cxx:117
void DoChange() const
Definition: undoblk.cxx:663
void ChangeSelectionIndent(bool bIncrement, const ScMarkData &rMark)
Definition: document.cxx:5908
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:218
SC_DLLPUBLIC void AppendInsert(const ScRange &rRange, bool bEndOfList=false)
Definition: chgtrack.cxx:2807
virtual ~ScUndoIndent() override
Definition: undoblk.cxx:1985
void ApplySelectionFrame(const ScMarkData &rMark, const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner)
Definition: document.cxx:5753
PaintPartFlags
Definition: global.hxx:119
This struct stores general clipboard parameters associated with a ScDocument instance created in clip...
Definition: clipparam.hxx:30
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
Definition: document.cxx:1955
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1488
ScUndoDeleteMulti(ScDocShell *pNewDocShell, bool bNewRows, bool bNeedsRefresh, SCTAB nNewTab, const std::vector< sc::ColRowSpan > &rSpans, ScDocumentUniquePtr pUndoDocument, std::unique_ptr< ScRefUndoData > pRefData)
Definition: undoblk.cxx:640
SCCOL mnColDelta
Amount and direction of movement in the column direction.
void SetChangeTrack()
Definition: undoblk.cxx:699
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual void Redo() override
Definition: undoblk.cxx:2181
std::unique_ptr< SCTAB[]> pTabs
Definition: undoblk.hxx:61
static SCTAB GetCurTab()
Definition: docsh4.cxx:2547
sal_uLong nEndChangeAction
Definition: undoblk.hxx:64
sal_uLong nEndChangeAction
Definition: undoblk.hxx:129
virtual OUString GetComment() const override
Definition: undoblk.cxx:1507
void DoChange(const bool bUndo)
Definition: undoblk.cxx:846
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:509
void EndRedo()
Definition: undobase.cxx:151
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1445
void RemoveAll()
Definition: rangelst.cxx:1108
std::vector< sc::ColRowSpan > maSpans
Definition: undoblk.hxx:127
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
void SetCondFormList(ScConditionalFormatList *pList, SCTAB nTab)
Definition: documen4.cxx:865
virtual void Redo() override
Definition: undoblk.cxx:895
void EnableDrawAdjust(ScDocument *pDoc, bool bEnable)
Definition: undoolk.cxx:68
B2DRange maRange
sal_Int16 SCTAB
Definition: types.hxx:23
std::unique_ptr< ScRefUndoData > pRefUndoData
Definition: undoblk.hxx:205
virtual OUString GetComment() const override
Definition: undoblk.cxx:2045
void BeginUndo()
Definition: undobase.cxx:87
SC_DLLPUBLIC void CopyToClip(const ScClipParam &rClipParam, ScDocument *pClipDoc, const ScMarkData *pMarks, bool bKeepScenarioFlags, bool bIncludeObjects)
Definition: document.cxx:2175
virtual ~ScUndoConditionalFormat() override
Definition: undoblk.cxx:1559
virtual ~ScUndoTransliterate() override
Definition: undoblk.cxx:2041
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:746
bool bRedoFilled
Definition: undoblk.hxx:209