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