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 && dynamic_cast<const ScUndoWrapper*>( pNextAction) != nullptr )
111  {
112  ScUndoWrapper* pWrapper = static_cast<ScUndoWrapper*>(pNextAction);
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  {
272  pViewShell->CellContentChanged();
273 
275  {
276  SCTAB nTab = pViewShell->GetViewData().GetTabNo();
277  bool bColsAffected = (eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER || eCmd == INS_CELLSRIGHT);
278  bool bRowsAffected = (eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER || eCmd == INS_CELLSDOWN);
279 
280  if (bColsAffected)
282 
283  if (bRowsAffected)
285 
287  pViewShell,
288  bColsAffected, bRowsAffected,
289  true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
290  true /* bGroups */, nTab);
291  }
292  }
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  {
546  {
547  SCTAB nTab = pViewShell->GetViewData().GetTabNo();
548  bool bColsAffected = (eCmd == DelCellCmd::Cols || eCmd == DelCellCmd::CellsLeft);
549  bool bRowsAffected = (eCmd == DelCellCmd::Rows || eCmd == DelCellCmd::CellsUp);
550 
551  if (bColsAffected)
553 
554  if (bRowsAffected)
556 
558  pViewShell,
559  bColsAffected, bRowsAffected,
560  true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
561  true /* bGroups */, nTab);
562  }
563 
564  }
565 
566 }
567 
569 {
570  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
571  BeginUndo();
572  DoChange( true );
573  EndUndo();
574 
575  ScDocument& rDoc = pDocShell->GetDocument();
576 
577  // Now that DBData have been restored in ScMoveUndo::EndUndo() via its
578  // pRefUndoDoc we can apply the AutoFilter buttons.
579  // Add one row for cases undoing deletion right above a cut AutoFilter
580  // range so the buttons are removed.
581  SCROW nRefreshEndRow = std::min<SCROW>( aEffRange.aEnd.Row() + 1, rDoc.MaxRow());
582  for (SCTAB i=0; i < nCount; ++i)
583  {
585  aEffRange.aEnd.Col(), nRefreshEndRow, pTabs[i]);
586  }
587 
588  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
589 
590  // Selection not until EndUndo
592  if (pViewShell)
593  {
594  for( SCTAB i=0; i<nCount; i++ )
595  {
597  }
598  }
599 
600  for (SCTAB i = 0; i < nCount; ++i)
601  rDoc.SetDrawPageSize(pTabs[i]);
602 }
603 
605 {
606  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
607  BeginRedo();
608  DoChange( false);
609  EndRedo();
610 
611  ScDocument& rDoc = pDocShell->GetDocument();
612 
613  for (SCTAB i=0; i < nCount; ++i)
614  {
617  }
618 
619  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
620 
622  if (pViewShell)
623  pViewShell->DoneBlockMode(); // current way
624 
625  for (SCTAB i = 0; i < nCount; ++i)
626  rDoc.SetDrawPageSize(pTabs[i]);
627 }
628 
630 {
631  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
632  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DeleteCells( eCmd );
633 }
634 
636 {
637  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
638 }
639 
640 // delete cells in multiselection
642  ScDocShell* pNewDocShell,
643  bool bNewRows, bool bNeedsRefresh, SCTAB nNewTab,
644  const std::vector<sc::ColRowSpan>& rSpans,
645  ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData ) :
646  ScMoveUndo( pNewDocShell, std::move(pUndoDocument), std::move(pRefData) ),
647  mbRows(bNewRows),
648  mbRefresh(bNeedsRefresh),
649  nTab( nNewTab ),
650  maSpans(rSpans)
651 {
652  SetChangeTrack();
653 }
654 
656 {
657 }
658 
660 {
661  return ScResId( STR_UNDO_DELETECELLS ); // like DeleteCells
662 }
663 
665 {
666  SCCOL nStartCol;
667  SCROW nStartRow;
668  PaintPartFlags nPaint;
669  ScDocument& rDoc = pDocShell->GetDocument();
670  if (mbRows)
671  {
672  nStartCol = 0;
673  nStartRow = static_cast<SCROW>(maSpans[0].mnStart);
675  }
676  else
677  {
678  nStartCol = static_cast<SCCOL>(maSpans[0].mnStart);
679  nStartRow = 0;
681  }
682 
683  if (mbRefresh)
684  {
685  SCCOL nEndCol = rDoc.MaxCol();
686  SCROW nEndRow = rDoc.MaxRow();
687  rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver );
688  rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true );
689  }
690 
691  pDocShell->PostPaint( nStartCol, nStartRow, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab, nPaint );
694  if (pViewShell)
695  pViewShell->CellContentChanged();
696 
697  ShowTable( nTab );
698 }
699 
701 {
702  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
703  if ( pChangeTrack )
704  {
705  ScDocument& rDoc = pDocShell->GetDocument();
706  nStartChangeAction = pChangeTrack->GetActionMax() + 1;
707  ScRange aRange( 0, 0, nTab, 0, 0, nTab );
708  if (mbRows)
709  aRange.aEnd.SetCol( rDoc.MaxCol() );
710  else
711  aRange.aEnd.SetRow( rDoc.MaxRow() );
712  // delete in reverse
713  std::vector<sc::ColRowSpan>::const_reverse_iterator ri = maSpans.rbegin(), riEnd = maSpans.rend();
714  for (; ri != riEnd; ++ri)
715  {
716  SCCOLROW nEnd = ri->mnEnd;
717  SCCOLROW nStart = ri->mnStart;
718  if (mbRows)
719  {
720  aRange.aStart.SetRow( nStart );
721  aRange.aEnd.SetRow( nEnd );
722  }
723  else
724  {
725  aRange.aStart.SetCol( static_cast<SCCOL>(nStart) );
726  aRange.aEnd.SetCol( static_cast<SCCOL>(nEnd) );
727  }
728  sal_uLong nDummyStart;
729  pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc.get(),
730  nDummyStart, nEndChangeAction );
731  }
732  }
733  else
735 }
736 
738 {
739  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
740  BeginUndo();
741 
742  ScDocument& rDoc = pDocShell->GetDocument();
743 
744  // reverse delete -> forward insert
745  for (const auto& rSpan : maSpans)
746  {
747  SCCOLROW nStart = rSpan.mnStart;
748  SCCOLROW nEnd = rSpan.mnEnd;
749  if (mbRows)
750  rDoc.InsertRow( 0,nTab, rDoc.MaxCol(),nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
751  else
752  rDoc.InsertCol( 0,nTab, rDoc.MaxRow(),nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
753  }
754 
755  for (const auto& rSpan : maSpans)
756  {
757  SCCOLROW nStart = rSpan.mnStart;
758  SCCOLROW nEnd = rSpan.mnEnd;
759  if (mbRows)
760  pRefUndoDoc->CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::ALL, false, rDoc);
761  else
762  pRefUndoDoc->CopyToDocument(static_cast<SCCOL>(nStart),0,nTab,
763  static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::ALL, false, rDoc);
764  }
765 
766  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
767  if ( pChangeTrack )
768  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
769 
770  DoChange();
771 
774 
775  EndUndo();
776  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
777 }
778 
780 {
781  weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
782  BeginRedo();
783 
784  ScDocument& rDoc = pDocShell->GetDocument();
785 
786  // reverse delete
787  std::vector<sc::ColRowSpan>::const_reverse_iterator ri = maSpans.rbegin(), riEnd = maSpans.rend();
788  for (; ri != riEnd; ++ri)
789  {
790  SCCOLROW nEnd = ri->mnEnd;
791  SCCOLROW nStart = ri->mnStart;
792  if (mbRows)
793  rDoc.DeleteRow( 0,nTab, rDoc.MaxCol(),nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
794  else
795  rDoc.DeleteCol( 0,nTab, rDoc.MaxRow(),nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
796  }
797 
798  SetChangeTrack();
799 
800  DoChange();
801 
802  EndRedo();
803  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
804 }
805 
807 {
808  // if single selection
809  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
810  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->DeleteCells( DelCellCmd::Rows );
811 }
812 
814 {
815  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
816 }
817 
818 ScUndoCut::ScUndoCut(ScDocShell* pNewDocShell, const ScRange& aRange, const ScAddress& aOldEnd,
819  const ScMarkData& rMark, ScDocumentUniquePtr pNewUndoDoc)
820  : ScBlockUndo(pNewDocShell, ScRange(aRange.aStart, aOldEnd), SC_UNDO_AUTOHEIGHT)
821  , aMarkData(rMark)
822  , pUndoDoc(std::move(pNewUndoDoc))
823  , aExtendedRange(aRange)
824 {
825  SetChangeTrack();
826 }
827 
829 {
830 }
831 
832 OUString ScUndoCut::GetComment() const
833 {
834  return ScResId( STR_UNDO_CUT ); // "cut"
835 }
836 
838 {
839  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
840  if ( pChangeTrack )
841  pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
843  else
844  nStartChangeAction = nEndChangeAction = 0;
845 }
846 
847 void ScUndoCut::DoChange( const bool bUndo )
848 {
849  ScDocument& rDoc = pDocShell->GetDocument();
850  sal_uInt16 nExtFlags = 0;
851 
852  // do not undo/redo objects and note captions, they are handled via drawing undo
854 
855  if (bUndo) // only for Undo
856  {
857  // all sheets - CopyToDocument skips those that don't exist in pUndoDoc
858  SCTAB nTabCount = rDoc.GetTableCount();
859  ScRange aCopyRange = aExtendedRange;
860  aCopyRange.aStart.SetTab(0);
861  aCopyRange.aEnd.SetTab(nTabCount-1);
862  pUndoDoc->CopyToDocument(aCopyRange, nUndoFlags, false, rDoc);
863  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
864  if ( pChangeTrack )
865  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
866 
867  BroadcastChanges(aCopyRange);
868  }
869  else // only for Redo
870  {
871  pDocShell->UpdatePaintExt( nExtFlags, aExtendedRange );
873  aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(), aMarkData, nUndoFlags );
874  SetChangeTrack();
875  }
876 
878  if ( !( pViewShell && pViewShell->AdjustBlockHeight() ) )
880 
881  if ( !bUndo ) // draw redo after updating row heights
882  RedoSdrUndoAction( pDrawUndo.get() );
883 
885  if (pViewShell)
886  pViewShell->CellContentChanged();
887 }
888 
890 {
891  BeginUndo();
892  DoChange( true );
893  EndUndo();
894 }
895 
897 {
898  BeginRedo();
899  ScDocument& rDoc = pDocShell->GetDocument();
900  EnableDrawAdjust( &rDoc, false );
901  DoChange( false );
902  EnableDrawAdjust( &rDoc, true );
903  EndRedo();
904 }
905 
907 {
908  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
909  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->CutToClip();
910 }
911 
913 {
914  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
915 }
916 
917 ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell, const ScRangeList& rRanges,
918  const ScMarkData& rMark,
919  ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
920  InsertDeleteFlags nNewFlags,
921  std::unique_ptr<ScRefUndoData> pRefData,
922  bool bRedoIsFilled, const ScUndoPasteOptions* pOptions ) :
923  ScMultiBlockUndo( pNewDocShell, rRanges ),
924  aMarkData( rMark ),
925  pUndoDoc( std::move(pNewUndoDoc) ),
926  pRedoDoc( std::move(pNewRedoDoc) ),
927  nFlags( nNewFlags ),
928  pRefUndoData( std::move(pRefData) ),
929  bRedoFilled( bRedoIsFilled )
930 {
931  if ( pRefUndoData )
932  pRefUndoData->DeleteUnchanged( &pDocShell->GetDocument() );
933 
934  if ( pOptions )
935  aPasteOptions = *pOptions; // used only for Repeat
936 
937  SetChangeTrack();
938 }
939 
941 {
942  pUndoDoc.reset();
943  pRedoDoc.reset();
944  pRefUndoData.reset();
945  pRefRedoData.reset();
946 }
947 
948 OUString ScUndoPaste::GetComment() const
949 {
950  return ScResId( STR_UNDO_PASTE ); // "paste"
951 }
952 
954 {
955  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
956  if ( pChangeTrack && (nFlags & InsertDeleteFlags::CONTENTS) )
957  {
958  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
959  {
960  pChangeTrack->AppendContentRange(maBlockRanges[i], pUndoDoc.get(),
962  }
963  }
964  else
966 }
967 
968 void ScUndoPaste::DoChange(bool bUndo)
969 {
970  ScDocument& rDoc = pDocShell->GetDocument();
971 
972  // RefUndoData for redo is created before first undo
973  // (with DeleteUnchanged after the DoUndo call)
974  bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
975  if ( bCreateRedoData )
976  pRefRedoData.reset( new ScRefUndoData( &rDoc ) );
977 
978  ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData.get() : pRefRedoData.get();
979 
980  // Always back-up either all or none of the content for Undo
983  nUndoFlags |= InsertDeleteFlags::CONTENTS;
985  nUndoFlags |= InsertDeleteFlags::ATTRIB;
986 
987  // do not undo/redo objects and note captions, they are handled via drawing undo
988  nUndoFlags &= ~InsertDeleteFlags::OBJECTS;
989  nUndoFlags |= InsertDeleteFlags::NOCAPTIONS;
990 
991  bool bPaintAll = false;
992 
994 
995  SCTAB nTabCount = rDoc.GetTableCount();
996  if ( bUndo && !bRedoFilled )
997  {
998  if (!pRedoDoc)
999  {
1000  bool bColInfo = true;
1001  bool bRowInfo = true;
1002  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1003  {
1004  const ScRange& r = maBlockRanges[i];
1005  bColInfo &= (r.aStart.Row() == 0 && r.aEnd.Row() == rDoc.MaxRow());
1006  bRowInfo &= (r.aStart.Col() == 0 && r.aEnd.Col() == rDoc.MaxCol());
1007  if (!bColInfo && !bRowInfo)
1008  break;
1009  }
1010 
1011  pRedoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
1012  pRedoDoc->InitUndoSelected( &rDoc, aMarkData, bColInfo, bRowInfo );
1013  }
1014  // read "redo" data from the document in the first undo
1015  // all sheets - CopyToDocument skips those that don't exist in pRedoDoc
1016  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1017  {
1018  ScRange aCopyRange = maBlockRanges[i];
1019  aCopyRange.aStart.SetTab(0);
1020  aCopyRange.aEnd.SetTab(nTabCount-1);
1021  rDoc.CopyToDocument(aCopyRange, nUndoFlags, false, *pRedoDoc);
1022  bRedoFilled = true;
1023  }
1024  }
1025 
1026  sal_uInt16 nExtFlags = 0;
1028 
1029  rDoc.ForgetNoteCaptions(maBlockRanges, false);
1031  rDoc.DeleteSelection(nUndoFlags, aMarkData, false); // no broadcasting here
1032  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1033  rDoc.BroadcastCells(maBlockRanges[i], SfxHintId::ScDataChanged);
1034 
1036 
1037  SCTAB nFirstSelected = aMarkData.GetFirstSelected();
1038 
1039  if ( !bUndo && pRedoDoc ) // Redo: UndoToDocument before handling RefData
1040  {
1041  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1042  {
1043  ScRange aRange = maBlockRanges[i];
1044  aRange.aStart.SetTab(nFirstSelected);
1045  aRange.aEnd.SetTab(nFirstSelected);
1046  pRedoDoc->UndoToDocument(aRange, nUndoFlags, false, rDoc);
1047  for (const auto& rTab : aMarkData)
1048  {
1049  if (rTab >= nTabCount)
1050  break;
1051 
1052  if (rTab == nFirstSelected)
1053  continue;
1054 
1055  aRange.aStart.SetTab(rTab);
1056  aRange.aEnd.SetTab(rTab);
1057  pRedoDoc->CopyToDocument(aRange, nUndoFlags, false, rDoc);
1058  }
1059  }
1060  }
1061 
1062  if (pWorkRefData)
1063  {
1064  pWorkRefData->DoUndo( &rDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection
1065  if (!maBlockRanges.empty() &&
1066  rDoc.RefreshAutoFilter(0, 0, rDoc.MaxCol(), rDoc.MaxRow(), maBlockRanges[0].aStart.Tab()))
1067  bPaintAll = true;
1068  }
1069 
1070  if ( bCreateRedoData && pRefRedoData )
1071  pRefRedoData->DeleteUnchanged( &rDoc );
1072 
1073  if (bUndo) // Undo: UndoToDocument after handling RefData
1074  {
1075  for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
1076  {
1077  ScRange aRange = maBlockRanges[i];
1078  for (const auto& rTab : aMarkData)
1079  {
1080  if (rTab >= nTabCount)
1081  break;
1082  aRange.aStart.SetTab(rTab);
1083  aRange.aEnd.SetTab(rTab);
1084  pUndoDoc->UndoToDocument(aRange, nUndoFlags, false, rDoc);
1085  }
1086  }
1087  }
1088 
1089  if ( bUndo )
1090  {
1091  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1092  if ( pChangeTrack )
1093  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1094  }
1095  else
1096  SetChangeTrack();
1097 
1098  ScRangeList aDrawRanges(maBlockRanges);
1100  for (size_t i = 0, n = aDrawRanges.size(); i < n; ++i)
1101  {
1102  ScRange& rDrawRange = aDrawRanges[i];
1103  rDoc.ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.)
1104  ScRangeList aRangeList(rDrawRange);
1105  ScMarkData aData(rDoc.GetSheetLimits(), aRangeList);
1106  if (bPaintAll)
1107  {
1108  rDrawRange.aStart.SetCol(0);
1109  rDrawRange.aStart.SetRow(0);
1110  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1111  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1113  if (pViewShell)
1114  pViewShell->AdjustBlockHeight(false, &aData);
1115  }
1116  else
1117  {
1118  if (maBlockRanges[i].aStart.Row() == 0 && maBlockRanges[i].aEnd.Row() == rDoc.MaxRow()) // whole column
1119  {
1120  nPaint |= PaintPartFlags::Top;
1121  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1122  }
1123  if (maBlockRanges[i].aStart.Col() == 0 && maBlockRanges[i].aEnd.Col() == rDoc.MaxCol()) // whole row
1124  {
1125  nPaint |= PaintPartFlags::Left;
1126  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1127  }
1128  if (pViewShell && pViewShell->AdjustBlockHeight(false, &aData))
1129  {
1130  rDrawRange.aStart.SetCol(0);
1131  rDrawRange.aStart.SetRow(0);
1132  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1133  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1134  nPaint |= PaintPartFlags::Left;
1135  }
1136  pDocShell->UpdatePaintExt(nExtFlags, rDrawRange);
1137  }
1138  }
1139 
1140  if ( !bUndo ) // draw redo after updating row heights
1142 
1143  pDocShell->PostPaint(aDrawRanges, nPaint, nExtFlags);
1144 
1146  if (pViewShell)
1147  pViewShell->CellContentChanged();
1148 }
1149 
1151 {
1152  BeginUndo();
1153  DoChange(true);
1154  if (!maBlockRanges.empty())
1156  EndUndo();
1157  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1158 }
1159 
1161 {
1162  BeginRedo();
1163  ScDocument& rDoc = pDocShell->GetDocument();
1164  EnableDrawAdjust( &rDoc, false );
1165  DoChange( false );
1166  EnableDrawAdjust( &rDoc, true );
1167  EndRedo();
1168  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1169 }
1170 
1172 {
1173  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
1174  {
1175  ScTabViewShell* pViewSh = static_cast<ScTabViewTarget&>(rTarget).GetViewShell();
1176  // keep a reference in case the clipboard is changed during PasteFromClip
1178  if (pOwnClip)
1179  {
1180  pViewSh->PasteFromClip( nFlags, pOwnClip->GetDocument(),
1183  true ); // allow warning dialog
1184  }
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 (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
1763  {
1764  OUString aTemp = aName;
1765  static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->UseScenario(aTemp);
1766  }
1767 }
1768 
1770 {
1771  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
1772  {
1773  ScViewData& rViewData = static_cast<ScTabViewTarget&>(rTarget).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  {
1863  ScDocument& rDoc = pDocShell->GetDocument();
1864  ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
1865  ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>( pStlPool->
1866  Find( aStyleName, SfxStyleFamily::Para ));
1867  if (!pStyleSheet)
1868  {
1869  OSL_FAIL("StyleSheet not found");
1870  return;
1871  }
1872 
1873  ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell();
1874  rViewShell.SetStyleSheetToMarked( pStyleSheet );
1875  }
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 (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
2024  static_cast<ScTabViewTarget&>(rTarget).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 (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
2079  static_cast<ScTabViewTarget&>(rTarget).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 (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
2137  {
2138  ScViewData& rViewData = static_cast<ScTabViewTarget&>(rTarget).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 (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
2200  {
2201  ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).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 (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
2330  static_cast<ScTabViewTarget&>(rTarget).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:3053
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:737
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:886
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:906
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:1585
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6223
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:4861
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:4083
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:1366
bool RefreshAutoFilter(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
Definition: document.cxx:5674
SCCOL nColEnd
Definition: rangeutl.hxx:242
void ClearSelectionItems(const sal_uInt16 *pWhich, const ScMarkData &rMark)
Definition: document.cxx:5922
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:953
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:917
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
static void notifyAllViewsSheetGeomInvalidation(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
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
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:2800
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:1675
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:832
void DoChange(const bool bUndo)
Definition: undoblk.cxx:1802
virtual void Undo() override
Definition: undoblk.cxx:889
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:3036
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
bool InsertCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1498
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:948
bool SetViewMarkData(const ScMarkData &rMarkData)
Definition: undobase.cxx:52
void SetChangeTrack()
Definition: undoblk.cxx:837
sal_uLong nStartChangeAction
Definition: undoblk.hxx:97
virtual ~ScUndoRemoveMerge() override
Definition: undoblk.cxx:2226
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:988
void EndUndo()
Definition: undobase.cxx:122
virtual ~ScUndoPaste() override
Definition: undoblk.cxx:940
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:966
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:5181
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:912
bool bIsIncrement
Definition: undoblk.hxx:866
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:6063
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:635
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
SfxUndoAction * GetWrappedUndo()
Definition: undobase.hxx:165
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:876
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:313
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:1795
SC_DLLPUBLIC void AppendMove(const ScRange &rFromRange, const ScRange &rToRange, ScDocument *pRefDoc)
Definition: chgtrack.cxx:2574
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:2075
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
ScDocument * GetDocument() const
Definition: viewdata.cxx:859
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:4771
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:2397
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:3082
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:629
virtual void Undo() override
Definition: undoblk.cxx:295
bool empty() const
Definition: rangelst.hxx:89
void OnLOKInsertDeleteColumn(SCCOL nStartCol, long nOffset)
Definition: viewfunc.cxx:1465
sal_uLong nEndChangeAction
Definition: undoblk.hxx:98
virtual ~ScUndoCut() override
Definition: undoblk.cxx:828
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:1150
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:418
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:813
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:875
virtual void Redo() override
Definition: undoblk.cxx:1160
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:4549
ScMarkData aMarkData
Definition: undoblk.hxx:863
void UpdateReference(sc::RefUpdateContext &rCxt)
Definition: validat.cxx:1012
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:863
virtual void Redo() override
Definition: undoblk.cxx:604
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:2618
sal_Int16 SCCOL
Definition: types.hxx:22
void DeleteSelection(InsertDeleteFlags nDelFlag, const ScMarkData &rMark, bool bBroadcast=true)
Definition: document.cxx:5934
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:4268
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:877
bool InsertRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1247
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1786
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:3069
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:4788
ScUndoCut(ScDocShell *pNewDocShell, const ScRange &aRange, const ScAddress &aOldEnd, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc)
Definition: undoblk.cxx:818
void OnLOKInsertDeleteRow(SCROW nStartRow, long nOffset)
Definition: viewfunc.cxx:1521
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:2438
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:6229
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:2674
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:5570
void ForgetNoteCaptions(const ScRangeList &rRanges, bool bPreserveData)
Definition: document.cxx:6633
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:876
void PostDataChanged()
Definition: docsh3.cxx:91
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:1171
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:655
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:5043
ScRange aEffRange
Definition: undoblk.hxx:91
void DoChange(bool bUndo)
Definition: undoblk.cxx:968
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
static void notifyAllViewsHeaderInvalidation(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
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:413
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:1893
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:5025
InsCellCmd
Definition: global.hxx:299
virtual void Redo() override
Definition: undoblk.cxx:779
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:196
void SetStyleSheetToMarked(const SfxStyleSheet *pStyleSheet)
Definition: viewfunc.cxx:1316
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:659
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:806
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:6068
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:568
void GetMultiMarkArea(ScRange &rRange) const
Definition: markdata.cxx:117
void DoChange() const
Definition: undoblk.cxx:664
void ChangeSelectionIndent(bool bIncrement, const ScMarkData &rMark)
Definition: document.cxx:5910
void ForgetWrappedUndo()
Definition: undobase.cxx:558
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:218
SC_DLLPUBLIC void AppendInsert(const ScRange &rRange, bool bEndOfList=false)
Definition: chgtrack.cxx:2801
virtual ~ScUndoIndent() override
Definition: undoblk.cxx:1985
void ApplySelectionFrame(const ScMarkData &rMark, const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner)
Definition: document.cxx:5755
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:1954
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:641
SCCOL mnColDelta
Amount and direction of movement in the column direction.
void SetChangeTrack()
Definition: undoblk.cxx:700
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:2549
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:847
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:503
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:896
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
void CopyToClip(const ScClipParam &rClipParam, ScDocument *pClipDoc, const ScMarkData *pMarks, bool bKeepScenarioFlags, bool bIncludeObjects)
Definition: document.cxx:2174
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