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