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 
1098  // For sheet geometry invalidation.
1099  bool bColsAffected = false;
1100  bool bRowsAffected = false;
1101 
1102  for (size_t i = 0, n = aDrawRanges.size(); i < n; ++i)
1103  {
1104  ScRange& rDrawRange = aDrawRanges[i];
1105  rDoc.ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.)
1106  ScRangeList aRangeList(rDrawRange);
1107  ScMarkData aData(rDoc.GetSheetLimits(), aRangeList);
1108  if (bPaintAll)
1109  {
1110  rDrawRange.aStart.SetCol(0);
1111  rDrawRange.aStart.SetRow(0);
1112  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1113  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1115  if (pViewShell)
1116  pViewShell->AdjustBlockHeight(false, &aData);
1117  }
1118  else
1119  {
1120  if (maBlockRanges[i].aStart.Row() == 0 && maBlockRanges[i].aEnd.Row() == rDoc.MaxRow()) // whole column
1121  {
1122  nPaint |= PaintPartFlags::Top;
1123  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1124  bColsAffected = true;
1125  }
1126  if (maBlockRanges[i].aStart.Col() == 0 && maBlockRanges[i].aEnd.Col() == rDoc.MaxCol()) // whole row
1127  {
1128  nPaint |= PaintPartFlags::Left;
1129  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1130  bRowsAffected = true;
1131  }
1132  if (pViewShell && pViewShell->AdjustBlockHeight(false, &aData))
1133  {
1134  rDrawRange.aStart.SetCol(0);
1135  rDrawRange.aStart.SetRow(0);
1136  rDrawRange.aEnd.SetCol(rDoc.MaxCol());
1137  rDrawRange.aEnd.SetRow(rDoc.MaxRow());
1138  nPaint |= PaintPartFlags::Left;
1139  }
1140  pDocShell->UpdatePaintExt(nExtFlags, rDrawRange);
1141  }
1142  }
1143 
1144  if ( !bUndo ) // draw redo after updating row heights
1146 
1147  pDocShell->PostPaint(aDrawRanges, nPaint, nExtFlags);
1148 
1150  if (pViewShell)
1151  pViewShell->CellContentChanged();
1152 
1153  if (bColsAffected || bRowsAffected)
1155  pViewShell,
1156  bColsAffected, bRowsAffected,
1157  true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
1158  true /* bGroups */, aDrawRanges[0].aStart.Tab());
1159 }
1160 
1162 {
1163  BeginUndo();
1164  DoChange(true);
1165  if (!maBlockRanges.empty())
1167  EndUndo();
1168  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1169 }
1170 
1172 {
1173  BeginRedo();
1174  ScDocument& rDoc = pDocShell->GetDocument();
1175  EnableDrawAdjust( &rDoc, false );
1176  DoChange( false );
1177  EnableDrawAdjust( &rDoc, true );
1178  EndRedo();
1179  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1180 }
1181 
1183 {
1184  auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget);
1185  if (!pViewTarget)
1186  return;
1187 
1188  ScTabViewShell* pViewSh = pViewTarget->GetViewShell();
1189  // keep a reference in case the clipboard is changed during PasteFromClip
1191  if (pOwnClip)
1192  {
1193  pViewSh->PasteFromClip( nFlags, pOwnClip->GetDocument(),
1196  true ); // allow warning dialog
1197  }
1198 }
1199 
1201 {
1202  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1203 }
1204 
1206  const ScRange& rRange, const ScAddress& aNewDestPos, bool bNewCut,
1207  ScDocumentUniquePtr pUndoDocument, bool bScenario ) :
1208  ScMoveUndo( pNewDocShell, std::move(pUndoDocument), nullptr ),
1209  mnPaintExtFlags( 0 ),
1210  aSrcRange( rRange ),
1211  bCut( bNewCut ),
1212  bKeepScenarioFlags( bScenario )
1213 {
1214  ScAddress aDestEnd(aNewDestPos);
1215  aDestEnd.IncRow(aSrcRange.aEnd.Row() - aSrcRange.aStart.Row());
1216  aDestEnd.IncCol(aSrcRange.aEnd.Col() - aSrcRange.aStart.Col());
1217  aDestEnd.IncTab(aSrcRange.aEnd.Tab() - aSrcRange.aStart.Tab());
1218 
1219  bool bIncludeFiltered = bCut;
1220  if ( !bIncludeFiltered )
1221  {
1222  // find number of non-filtered rows
1223  SCROW nPastedCount = pDocShell->GetDocument().CountNonFilteredRows(
1225 
1226  if ( nPastedCount == 0 )
1227  nPastedCount = 1;
1228  aDestEnd.SetRow( aNewDestPos.Row() + nPastedCount - 1 );
1229  }
1230 
1231  aDestRange.aStart = aNewDestPos;
1232  aDestRange.aEnd = aDestEnd;
1233 
1234  SetChangeTrack();
1235 }
1236 
1238 {
1239 }
1240 
1242 { // "Move" : "Copy"
1243  return bCut ?
1244  ScResId( STR_UNDO_MOVE ) :
1245  ScResId( STR_UNDO_COPY );
1246 }
1247 
1249 {
1250  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
1251  if ( pChangeTrack )
1252  {
1253  if ( bCut )
1254  {
1255  nStartChangeAction = pChangeTrack->GetActionMax() + 1;
1256  pChangeTrack->AppendMove( aSrcRange, aDestRange, pRefUndoDoc.get() );
1257  nEndChangeAction = pChangeTrack->GetActionMax();
1258  }
1259  else
1260  pChangeTrack->AppendContentRange( aDestRange, pRefUndoDoc.get(),
1262  }
1263  else
1265 }
1266 
1267 void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
1268 {
1271  ScDocument& rDoc = pDocShell->GetDocument();
1272 
1273  if (pViewShell)
1274  {
1276  ScViewData& rViewData = pViewShell->GetViewData();
1277  sc::RowHeightContext aCxt(
1278  rDoc.MaxRow(), rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(),
1279  pVirtDev);
1280 
1281  if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab(), true))
1282  {
1283  // tdf#76183: recalculate objects' positions
1284  rDoc.SetDrawPageSize(aRange.aStart.Tab());
1285  aRange.aStart.SetCol(0);
1286  aRange.aEnd.SetCol(rDoc.MaxCol());
1287  aRange.aEnd.SetRow(rDoc.MaxRow());
1288  nPaint |= PaintPartFlags::Left;
1289  }
1290  }
1291 
1292  if ( bKeepScenarioFlags )
1293  {
1294  // Copy scenario -> also paint scenario boarder
1295  aRange.aStart.SetCol(0);
1296  aRange.aStart.SetRow(0);
1297  aRange.aEnd.SetCol(rDoc.MaxCol());
1298  aRange.aEnd.SetRow(rDoc.MaxRow());
1299  }
1300 
1301  // column/row info (width/height) included if whole columns/rows were copied
1302  if ( aSrcRange.aStart.Col() == 0 && aSrcRange.aEnd.Col() == rDoc.MaxCol() )
1303  {
1304  nPaint |= PaintPartFlags::Left;
1305  aRange.aEnd.SetRow(rDoc.MaxRow());
1306  }
1307  if ( aSrcRange.aStart.Row() == 0 && aSrcRange.aEnd.Row() == rDoc.MaxRow() )
1308  {
1309  nPaint |= PaintPartFlags::Top;
1310  aRange.aEnd.SetCol(rDoc.MaxCol());
1311  }
1312 
1313  pDocShell->PostPaint( aRange, nPaint, nExtFlags );
1314 }
1315 
1317 {
1318  ScDocument& rDoc = pDocShell->GetDocument();
1319 
1320  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1321  if ( pChangeTrack )
1322  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1323 
1324  // Database range before data, so that the Autofilter button match up in ExtendMerge
1325 
1326  ScRange aPaintRange = aRange;
1327  rDoc.ExtendMerge( aPaintRange ); // before deleting
1328 
1329  pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
1330 
1331  // do not undo objects and note captions, they are handled via drawing undo
1333 
1334  // Additionally discard/forget caption ownership during deletion, as
1335  // Drag&Drop is a special case in that the Undo holds captions of the
1336  // transferred target range, which would get deleted and
1337  // SdrGroupUndo::Undo() would attempt to access invalidated captions and
1338  // crash, tdf#92995
1339  InsertDeleteFlags nDelFlags = nUndoFlags | InsertDeleteFlags::FORGETCAPTIONS;
1340 
1341  rDoc.DeleteAreaTab( aRange, nDelFlags );
1342  pRefUndoDoc->CopyToDocument(aRange, nUndoFlags, false, rDoc);
1343  if ( rDoc.HasAttrib( aRange, HasAttrFlags::Merged ) )
1344  rDoc.ExtendMerge( aRange, true );
1345 
1346  aPaintRange.aEnd.SetCol( std::max( aPaintRange.aEnd.Col(), aRange.aEnd.Col() ) );
1347  aPaintRange.aEnd.SetRow( std::max( aPaintRange.aEnd.Row(), aRange.aEnd.Row() ) );
1348 
1349  pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
1350  maPaintRanges.Join(aPaintRange);
1351 }
1352 
1354 {
1355  mnPaintExtFlags = 0;
1357 
1358  BeginUndo();
1359 
1360  if (bCut)
1361  {
1362  // During undo, we move cells from aDestRange to aSrcRange.
1363 
1364  ScDocument& rDoc = pDocShell->GetDocument();
1365 
1366  SCCOL nColDelta = aSrcRange.aStart.Col() - aDestRange.aStart.Col();
1367  SCROW nRowDelta = aSrcRange.aStart.Row() - aDestRange.aStart.Row();
1368  SCTAB nTabDelta = aSrcRange.aStart.Tab() - aDestRange.aStart.Tab();
1369 
1370  sc::RefUpdateContext aCxt(rDoc);
1371  aCxt.meMode = URM_MOVE;
1372  aCxt.maRange = aSrcRange;
1373  aCxt.mnColDelta = nColDelta;
1374  aCxt.mnRowDelta = nRowDelta;
1375  aCxt.mnTabDelta = nTabDelta;
1376 
1377  // Global range names.
1378  ScRangeName* pName = rDoc.GetRangeName();
1379  if (pName)
1380  pName->UpdateReference(aCxt);
1381 
1382  SCTAB nTabCount = rDoc.GetTableCount();
1383  for (SCTAB nTab = 0; nTab < nTabCount; ++nTab)
1384  {
1385  // Sheet-local range names.
1386  pName = rDoc.GetRangeName(nTab);
1387  if (pName)
1388  pName->UpdateReference(aCxt, nTab);
1389  }
1390 
1391  ScValidationDataList* pValidList = rDoc.GetValidationList();
1392  if (pValidList)
1393  {
1394  // Update the references of validation entries.
1395  pValidList->UpdateReference(aCxt);
1396  }
1397 
1398  DoUndo(aDestRange);
1399  DoUndo(aSrcRange);
1400 
1401  rDoc.BroadcastCells(aSrcRange, SfxHintId::ScDataChanged, false);
1402  }
1403  else
1404  DoUndo(aDestRange);
1405 
1406  for (size_t i = 0; i < maPaintRanges.size(); ++i)
1407  {
1408  const ScRange& r = maPaintRanges[i];
1410  }
1411 
1412  EndUndo();
1413  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1414 }
1415 
1417 {
1418  BeginRedo();
1419 
1420  ScDocument& rDoc = pDocShell->GetDocument();
1422 
1423  EnableDrawAdjust( &rDoc, false );
1424 
1425  // do not undo/redo objects and note captions, they are handled via drawing undo
1427 
1428  /* TODO: Redoing note captions is quite tricky due to the fact that a
1429  helper clip document is used. While (re-)pasting the contents to the
1430  destination area, the original pointers to the captions created while
1431  dropping have to be restored. A simple CopyFromClip() would create new
1432  caption objects that are not tracked by drawing undo, and the captions
1433  restored by drawing redo would live without cell note objects pointing
1434  to them. So, first, CopyToClip() and CopyFromClip() are called without
1435  cloning the caption objects. This leads to cell notes pointing to the
1436  wrong captions from source area that will be removed by drawing redo
1437  later. Second, the pointers to the new captions have to be restored.
1438  Sadly, currently these pointers are not stored anywhere but in the list
1439  of drawing undo actions. */
1440 
1441  SCTAB nTab;
1442  ScMarkData aSourceMark(rDoc.GetSheetLimits());
1443  for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
1444  aSourceMark.SelectTable( nTab, true );
1445 
1446  // do not clone objects and note captions into clipdoc (see above)
1447  // but at least copy notes
1448  ScClipParam aClipParam(aSrcRange, bCut);
1449  rDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, bKeepScenarioFlags, false);
1450 
1451  if (bCut)
1452  {
1453  ScRange aSrcPaintRange = aSrcRange;
1454  rDoc.ExtendMerge( aSrcPaintRange ); // before deleting
1455  sal_uInt16 nExtFlags = 0;
1456  pDocShell->UpdatePaintExt( nExtFlags, aSrcPaintRange );
1457  rDoc.DeleteAreaTab( aSrcRange, nRedoFlags );
1458  PaintArea( aSrcPaintRange, nExtFlags );
1459  }
1460 
1461  ScMarkData aDestMark(rDoc.GetSheetLimits());
1462  for (nTab=aDestRange.aStart.Tab(); nTab<=aDestRange.aEnd.Tab(); nTab++)
1463  aDestMark.SelectTable( nTab, true );
1464 
1465  bool bIncludeFiltered = bCut;
1466  // TODO: restore old note captions instead of cloning new captions...
1467  rDoc.CopyFromClip( aDestRange, aDestMark, InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS, nullptr, pClipDoc.get(), true, false, bIncludeFiltered );
1468 
1469  if (bCut)
1470  for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
1472  aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(), nTab );
1473 
1474  // skipped rows and merged cells don't mix
1475  if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
1476  pDocShell->GetDocFunc().UnmergeCells( aDestRange, false, nullptr );
1477 
1478  for (nTab=aDestRange.aStart.Tab(); nTab<=aDestRange.aEnd.Tab(); nTab++)
1479  {
1480  SCCOL nEndCol = aDestRange.aEnd.Col();
1481  SCROW nEndRow = aDestRange.aEnd.Row();
1483  nEndCol, nEndRow, nTab, true );
1485  nEndCol, nEndRow, nTab ), 0 );
1486  }
1487 
1488  SetChangeTrack();
1489 
1490  pClipDoc.reset();
1492 
1493  RedoSdrUndoAction( pDrawUndo.get() );
1494  EnableDrawAdjust( &rDoc, true );
1495 
1496  EndRedo();
1497  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
1498 }
1499 
1501 {
1502 }
1503 
1504 bool ScUndoDragDrop::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1505 {
1506  return false; // not possible
1507 }
1508 
1509 // Insert list containing range names
1510 // (Insert|Name|Insert =>[List])
1512  ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc)
1513  : ScBlockUndo(pNewDocShell, rRange, SC_UNDO_AUTOHEIGHT)
1514  , xUndoDoc(std::move(pNewUndoDoc))
1515  , xRedoDoc(std::move(pNewRedoDoc))
1516 {
1517 }
1518 
1520 {
1521  return ScResId( STR_UNDO_LISTNAMES );
1522 }
1523 
1525 {
1526  ScDocument& rDoc = pDocShell->GetDocument();
1527 
1529  pSrcDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ALL, false, rDoc);
1533  if (pViewShell)
1534  pViewShell->CellContentChanged();
1535 }
1536 
1538 {
1539  BeginUndo();
1540  DoChange(xUndoDoc.get());
1541  EndUndo();
1542 }
1543 
1545 {
1546  BeginRedo();
1547  DoChange(xRedoDoc.get());
1548  EndRedo();
1549 }
1550 
1552 {
1553  if (auto pTabViewTarget = dynamic_cast<ScTabViewTarget*>(&rTarget))
1554  pTabViewTarget->GetViewShell()->InsertNameList();
1555 }
1556 
1558 {
1559  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1560 }
1561 
1563  ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange& rRange):
1564  ScSimpleUndo( pNewDocShell ),
1565  mpUndoDoc(std::move(pUndoDoc)),
1566  mpRedoDoc(std::move(pRedoDoc)),
1567  maRange(rRange)
1568 {
1569 }
1570 
1572 {
1573 }
1574 
1576 {
1577  return ScResId( STR_UNDO_CONDFORMAT );
1578 }
1579 
1581 {
1582  DoChange(mpUndoDoc.get());
1583 }
1584 
1586 {
1587  DoChange(mpRedoDoc.get());
1588 }
1589 
1591 {
1592  ScDocument& rDoc = pDocShell->GetDocument();
1593 
1595  pSrcDoc->CopyToDocument(maRange, InsertDeleteFlags::ALL, false, rDoc);
1599  if (pViewShell)
1600  pViewShell->CellContentChanged();
1601 }
1602 
1604 {
1605 }
1606 
1608 {
1609  return false;
1610 }
1611 
1613  ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab):
1614  ScSimpleUndo( pNewDocShell ),
1615  mpUndoDoc(std::move(pUndoDoc)),
1616  mpRedoDoc(std::move(pRedoDoc)),
1617  mnTab(nTab)
1618 {
1619 }
1620 
1622 {
1623 }
1624 
1626 {
1627  return ScResId( STR_UNDO_CONDFORMAT_LIST );
1628 }
1629 
1631 {
1632  DoChange(mpUndoDoc.get());
1633 }
1634 
1636 {
1637  DoChange(mpRedoDoc.get());
1638 }
1639 
1641 {
1642  ScDocument& rDoc = pDocShell->GetDocument();
1643 
1644  if (pSrcDoc == mpUndoDoc.get())
1645  {
1646  mpRedoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc);
1647  mpUndoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc);
1648  }
1649  else
1650  {
1651  mpUndoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc);
1652  mpRedoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc);
1653  }
1654  rDoc.SetCondFormList(new ScConditionalFormatList(rDoc, *pSrcDoc->GetCondFormList(mnTab)), mnTab);
1655 
1659  if (pViewShell)
1660  pViewShell->CellContentChanged();
1661 }
1662 
1664 {
1665 }
1666 
1668 {
1669  return false;
1670 }
1671 
1673  const ScMarkData& rMark,
1674 /*C*/ const ScArea& rDestArea,
1675  ScDocumentUniquePtr pNewUndoDoc,
1676  const OUString& rNewName ) :
1677  ScSimpleUndo( pNewDocShell ),
1678  pUndoDoc( std::move(pNewUndoDoc) ),
1679  aMarkData( rMark ),
1680  aName( rNewName )
1681 {
1682  aRange.aStart.SetCol(rDestArea.nColStart);
1683  aRange.aStart.SetRow(rDestArea.nRowStart);
1684  aRange.aStart.SetTab(rDestArea.nTab);
1685  aRange.aEnd.SetCol(rDestArea.nColEnd);
1686  aRange.aEnd.SetRow(rDestArea.nRowEnd);
1687  aRange.aEnd.SetTab(rDestArea.nTab);
1688 }
1689 
1691 {
1692 }
1693 
1695 {
1696  return ScResId( STR_UNDO_USESCENARIO );
1697 }
1698 
1700 {
1701  BeginUndo();
1702 
1704  if (pViewShell)
1705  {
1706  pViewShell->DoneBlockMode();
1707  pViewShell->InitOwnBlockMode( aRange );
1708  }
1709 
1710  ScDocument& rDoc = pDocShell->GetDocument();
1712  pUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, true, rDoc, &aMarkData);
1713 
1714  // scenario table
1715  bool bFrame = false;
1716  SCTAB nTab = aRange.aStart.Tab();
1717  SCTAB nEndTab = nTab;
1718  while ( pUndoDoc->HasTable(nEndTab+1) && pUndoDoc->IsScenario(nEndTab+1) )
1719  ++nEndTab;
1720  for (SCTAB i = nTab+1; i<=nEndTab; i++)
1721  {
1722  // Flags always
1723  OUString aComment;
1724  Color aColor;
1725  ScScenarioFlags nScenFlags;
1726  pUndoDoc->GetScenarioData( i, aComment, aColor, nScenFlags );
1727  rDoc.SetScenarioData( i, aComment, aColor, nScenFlags );
1728  bool bActive = pUndoDoc->IsActiveScenario( i );
1729  rDoc.SetActiveScenario( i, bActive );
1730  // For copy-back scenario also consider content
1731  if ( nScenFlags & ScScenarioFlags::TwoWay )
1732  {
1733  rDoc.DeleteAreaTab( 0,0, rDoc.MaxCol(),rDoc.MaxRow(), i, InsertDeleteFlags::ALL );
1734  pUndoDoc->CopyToDocument(0,0,i, rDoc.MaxCol(),rDoc.MaxRow(),i, InsertDeleteFlags::ALL,false, rDoc);
1735  }
1736  if ( nScenFlags & ScScenarioFlags::ShowFrame )
1737  bFrame = true;
1738  }
1739 
1740  // if visible borders, then paint all
1741  if (bFrame)
1742  pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid | PaintPartFlags::Extras );
1743  else
1746  if (pViewShell)
1747  pViewShell->CellContentChanged();
1748 
1749  ShowTable( aRange.aStart.Tab() );
1750 
1751  EndUndo();
1752 }
1753 
1755 {
1756  SCTAB nTab = aRange.aStart.Tab();
1757  BeginRedo();
1758 
1760  if (pViewShell)
1761  {
1762  pViewShell->SetTabNo( nTab );
1763  pViewShell->DoneBlockMode();
1764  pViewShell->InitOwnBlockMode( aRange );
1765  }
1766 
1767  pDocShell->UseScenario( nTab, aName, false );
1768 
1769  EndRedo();
1770 }
1771 
1773 {
1774  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1775  {
1776  OUString aTemp = aName;
1777  pViewTarget->GetViewShell()->UseScenario(aTemp);
1778  }
1779 }
1780 
1782 {
1783  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
1784  {
1785  ScViewData& rViewData = pViewTarget->GetViewShell()->GetViewData();
1786  return !rViewData.GetDocument().IsScenario( rViewData.GetTabNo() );
1787  }
1788  return false;
1789 }
1790 
1792  const ScMarkData& rMark,
1793  const ScRange& rRange,
1794  const OUString& rName,
1795  ScDocumentUniquePtr pNewUndoDoc ) :
1796  ScSimpleUndo( pNewDocShell ),
1797  aMarkData( rMark ),
1798  pUndoDoc( std::move(pNewUndoDoc) ),
1799  aStyleName( rName ),
1800  aRange( rRange )
1801 {
1803 }
1804 
1806 {
1807 }
1808 
1810 {
1811  return ScResId( STR_UNDO_APPLYCELLSTYLE );
1812 }
1813 
1814 void ScUndoSelectionStyle::DoChange( const bool bUndo )
1815 {
1816  ScDocument& rDoc = pDocShell->GetDocument();
1817 
1819 
1820  ScRange aWorkRange( aRange );
1821  if ( rDoc.HasAttrib( aWorkRange, HasAttrFlags::Merged ) ) // Merged cells?
1822  rDoc.ExtendMerge( aWorkRange, true );
1823 
1824  sal_uInt16 nExtFlags = 0;
1825  pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
1826 
1827  if (bUndo) // if Undo then push back all old data again
1828  {
1829  SCTAB nTabCount = rDoc.GetTableCount();
1830  ScRange aCopyRange = aWorkRange;
1831  aCopyRange.aStart.SetTab(0);
1832  aCopyRange.aEnd.SetTab(nTabCount-1);
1833  pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
1834  }
1835  else // if Redo, then reapply style
1836  {
1837  ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
1838  ScStyleSheet* pStyleSheet =
1839  static_cast<ScStyleSheet*>( pStlPool->Find( aStyleName, SfxStyleFamily::Para ) );
1840  if (!pStyleSheet)
1841  {
1842  OSL_FAIL("StyleSheet not found");
1843  return;
1844  }
1845  rDoc.ApplySelectionStyle( *pStyleSheet, aMarkData );
1846  }
1847 
1848  pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
1849 
1851  if ( !( pViewShell && pViewShell->AdjustBlockHeight() ) )
1852 /*A*/ pDocShell->PostPaint( aWorkRange, PaintPartFlags::Grid | PaintPartFlags::Extras, nExtFlags );
1853 
1854  ShowTable( aWorkRange.aStart.Tab() );
1855 }
1856 
1858 {
1859  BeginUndo();
1860  DoChange( true );
1861  EndUndo();
1862 }
1863 
1865 {
1866  BeginRedo();
1867  DoChange( false );
1868  EndRedo();
1869 }
1870 
1872 {
1873  if (dynamic_cast<const ScTabViewTarget*>( &rTarget) == nullptr)
1874  return;
1875 
1876  ScDocument& rDoc = pDocShell->GetDocument();
1877  ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
1878  ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>( pStlPool->
1879  Find( aStyleName, SfxStyleFamily::Para ));
1880  if (!pStyleSheet)
1881  {
1882  OSL_FAIL("StyleSheet not found");
1883  return;
1884  }
1885 
1886  ScTabViewShell& rViewShell = *static_cast<ScTabViewTarget&>(rTarget).GetViewShell();
1887  rViewShell.SetStyleSheetToMarked( pStyleSheet );
1888 }
1889 
1891 {
1892  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1893 }
1894 
1896  ScDocumentUniquePtr pNewUndoDoc, const OUString& rForm ) :
1897  ScBlockUndo( pNewDocShell, rArea, SC_UNDO_SIMPLE ),
1898  pUndoDoc( std::move(pNewUndoDoc) ),
1899  aFormula( rForm )
1900 {
1901  SetChangeTrack();
1902 }
1903 
1905 {
1906 }
1907 
1909 {
1910  return ScResId( STR_UNDO_ENTERMATRIX );
1911 }
1912 
1914 {
1915  ScDocument& rDoc = pDocShell->GetDocument();
1916  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1917  if ( pChangeTrack )
1918  pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
1920  else
1922 }
1923 
1925 {
1926  BeginUndo();
1927 
1928  ScDocument& rDoc = pDocShell->GetDocument();
1929 
1931  pUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
1935  if (pViewShell)
1936  pViewShell->CellContentChanged();
1937 
1938  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
1939  if ( pChangeTrack )
1940  pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
1941 
1942  EndUndo();
1943 }
1944 
1946 {
1947  BeginRedo();
1948 
1949  ScDocument& rDoc = pDocShell->GetDocument();
1950 
1951  ScMarkData aDestMark(rDoc.GetSheetLimits());
1952  aDestMark.SelectOneTable( aBlockRange.aStart.Tab() );
1953  aDestMark.SetMarkArea( aBlockRange );
1954 
1957  aDestMark, aFormula );
1958 
1959  SetChangeTrack();
1960 
1961  EndRedo();
1962 }
1963 
1965 {
1966  if (auto pTabViewTarget = dynamic_cast<ScTabViewTarget*>(&rTarget))
1967  {
1968  OUString aTemp = aFormula;
1969  ScDocument& rDoc = pDocShell->GetDocument();
1970  pTabViewTarget->GetViewShell()->EnterMatrix(aTemp, rDoc.GetGrammar());
1971  }
1972 }
1973 
1975 {
1976  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
1977 }
1978 
1980 {
1981  OSL_ENSURE( rMark.IsMultiMarked(), "wrong mark type" );
1982  return rMark.GetMultiMarkArea();
1983 }
1984 
1985 ScUndoIndent::ScUndoIndent( ScDocShell* pNewDocShell, const ScMarkData& rMark,
1986  ScDocumentUniquePtr pNewUndoDoc, bool bIncrement ) :
1987  ScBlockUndo( pNewDocShell, lcl_GetMultiMarkRange(rMark), SC_UNDO_AUTOHEIGHT ),
1988  aMarkData( rMark ),
1989  pUndoDoc( std::move(pNewUndoDoc) ),
1990  bIsIncrement( bIncrement )
1991 {
1992 }
1993 
1995 {
1996 }
1997 
1999 {
2000  TranslateId pId = bIsIncrement ? STR_UNDO_INC_INDENT : STR_UNDO_DEC_INDENT;
2001  return ScResId(pId);
2002 }
2003 
2005 {
2006  BeginUndo();
2007 
2008  ScDocument& rDoc = pDocShell->GetDocument();
2009  SCTAB nTabCount = rDoc.GetTableCount();
2010  ScRange aCopyRange = aBlockRange;
2011  aCopyRange.aStart.SetTab(0);
2012  aCopyRange.aEnd.SetTab(nTabCount-1);
2013  pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
2015 
2016  EndUndo();
2017 }
2018 
2020 {
2021  BeginRedo();
2022 
2023  ScDocument& rDoc = pDocShell->GetDocument();
2026 
2027  EndRedo();
2028 }
2029 
2031 {
2032  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2033  pViewTarget->GetViewShell()->ChangeIndent( bIsIncrement );
2034 }
2035 
2037 {
2038  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2039 }
2040 
2043  ScBlockUndo( pNewDocShell, lcl_GetMultiMarkRange(rMark), SC_UNDO_AUTOHEIGHT ),
2044  aMarkData( rMark ),
2045  pUndoDoc( std::move(pNewUndoDoc) ),
2046  nTransliterationType( nType )
2047 {
2048 }
2049 
2051 {
2052 }
2053 
2055 {
2056  return ScResId( STR_UNDO_TRANSLITERATE );
2057 }
2058 
2060 {
2061  BeginUndo();
2062 
2063  ScDocument& rDoc = pDocShell->GetDocument();
2064  SCTAB nTabCount = rDoc.GetTableCount();
2065  ScRange aCopyRange = aBlockRange;
2066  aCopyRange.aStart.SetTab(0);
2067  aCopyRange.aEnd.SetTab(nTabCount-1);
2068  pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::CONTENTS, true, rDoc, &aMarkData);
2070 
2071  EndUndo();
2072 }
2073 
2075 {
2076  BeginRedo();
2077 
2078  ScDocument& rDoc = pDocShell->GetDocument();
2081 
2082  EndRedo();
2083 }
2084 
2086 {
2087  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2088  pViewTarget->GetViewShell()->TransliterateText( nTransliterationType );
2089 }
2090 
2092 {
2093  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2094 }
2095 
2097  ScDocumentUniquePtr pNewUndoDoc, const sal_uInt16* pW ) :
2098  ScBlockUndo( pNewDocShell, lcl_GetMultiMarkRange(rMark), SC_UNDO_AUTOHEIGHT ),
2099  aMarkData( rMark ),
2100  pUndoDoc( std::move(pNewUndoDoc) )
2101 {
2102  OSL_ENSURE( pW, "ScUndoClearItems: Which-Pointer is Null" );
2103 
2104  sal_uInt16 nCount = 0;
2105  while ( pW[nCount] )
2106  ++nCount;
2107  pWhich.reset( new sal_uInt16[nCount+1] );
2108  for (sal_uInt16 i=0; i<=nCount; i++)
2109  pWhich[i] = pW[i];
2110 }
2111 
2113 {
2114 }
2115 
2117 {
2118  return ScResId( STR_UNDO_DELETECONTENTS );
2119 }
2120 
2122 {
2123  BeginUndo();
2124 
2125  ScDocument& rDoc = pDocShell->GetDocument();
2126  pUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
2128 
2129  EndUndo();
2130 }
2131 
2133 {
2134  BeginRedo();
2135 
2136  ScDocument& rDoc = pDocShell->GetDocument();
2137  rDoc.ClearSelectionItems( pWhich.get(), aMarkData );
2139 
2140  EndRedo();
2141 }
2142 
2144 {
2145  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2146  {
2147  ScViewData& rViewData = pViewTarget->GetViewShell()->GetViewData();
2148  rViewData.GetDocFunc().ClearItems( rViewData.GetMarkData(), pWhich.get(), false );
2149  }
2150 }
2151 
2153 {
2154  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2155 }
2156 
2157 // remove all line breaks of a table
2159  SCTAB nNewTab, ScDocumentUniquePtr pNewUndoDoc ) :
2160  ScSimpleUndo( pNewDocShell ),
2161  nTab( nNewTab ),
2162  pUndoDoc( std::move(pNewUndoDoc) )
2163 {
2164 }
2165 
2167 {
2168 }
2169 
2171 {
2172  return ScResId( STR_UNDO_REMOVEBREAKS );
2173 }
2174 
2176 {
2177  BeginUndo();
2178 
2179  ScDocument& rDoc = pDocShell->GetDocument();
2181 
2182  pUndoDoc->CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, rDoc);
2183  if (pViewShell)
2184  pViewShell->UpdatePageBreakData( true );
2185  pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid );
2186 
2187  EndUndo();
2188 }
2189 
2191 {
2192  BeginRedo();
2193 
2194  ScDocument& rDoc = pDocShell->GetDocument();
2196 
2197  rDoc.RemoveManualBreaks(nTab);
2198  rDoc.UpdatePageBreaks(nTab);
2199  if (pViewShell)
2200  pViewShell->UpdatePageBreakData( true );
2201  pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid );
2202 
2203  EndRedo();
2204 }
2205 
2207 {
2208  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2209  {
2210  ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
2211  rViewShell.RemoveManualBreaks();
2212  }
2213 }
2214 
2216 {
2217  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2218 }
2219 
2221  const ScCellMergeOption& rOption, ScDocumentUniquePtr pNewUndoDoc ) :
2222  ScBlockUndo( pNewDocShell, rOption.getFirstSingleRange(), SC_UNDO_SIMPLE ),
2223  pUndoDoc( std::move(pNewUndoDoc) )
2224 {
2225  maOptions.push_back( rOption);
2226 }
2227 
2229  const ScRange& rRange, ScDocumentUniquePtr pNewUndoDoc ) :
2230  ScBlockUndo( pNewDocShell, rRange, SC_UNDO_SIMPLE ),
2231  pUndoDoc( std::move(pNewUndoDoc) )
2232 {
2233 }
2234 
2236 {
2237 }
2238 
2240 {
2241  return ScResId( STR_UNDO_REMERGE ); // "remove merge"
2242 }
2243 
2245 {
2246  return pUndoDoc.get();
2247 }
2248 
2250 {
2251  maOptions.push_back( rOption);
2252 }
2253 
2255 {
2256  using ::std::set;
2257 
2258  SetCurTab();
2259  BeginUndo();
2260 
2262 
2263  ScDocument& rDoc = pDocShell->GetDocument();
2264  for (const auto & rOption : maOptions)
2265  {
2266  for (const auto& rTab : rOption.maTabs)
2267  {
2268  OSL_ENSURE(pUndoDoc, "NULL pUndoDoc!");
2269  if (!pUndoDoc)
2270  continue;
2271  // There is no need to extend merge area because it's already been extended.
2272  ScRange aRange = rOption.getSingleRange(rTab);
2274  pUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::ATTRIB, false, rDoc);
2275 
2276  bool bDidPaint = false;
2277  if ( pViewShell )
2278  {
2279  pViewShell->SetTabNo(rTab);
2280  bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow, true);
2281  }
2282  if (!bDidPaint)
2284  }
2285  }
2286 
2287  EndUndo();
2288 }
2289 
2291 {
2292  using ::std::set;
2293 
2294  SetCurTab();
2295  BeginRedo();
2296 
2297  ScDocument& rDoc = pDocShell->GetDocument();
2299 
2300  for (const auto & rOption : maOptions)
2301  {
2302  for (const SCTAB nTab : rOption.maTabs)
2303  {
2304  // There is no need to extend merge area because it's already been extended.
2305  ScRange aRange = rOption.getSingleRange(nTab);
2306 
2307  const SfxPoolItem& rDefAttr = rDoc.GetPool()->GetDefaultItem( ATTR_MERGE );
2308  ScPatternAttr aPattern( rDoc.GetPool() );
2309  aPattern.GetItemSet().Put( rDefAttr );
2310  rDoc.ApplyPatternAreaTab( rOption.mnStartCol, rOption.mnStartRow,
2311  rOption.mnEndCol, rOption.mnEndRow, nTab,
2312  aPattern );
2313 
2314  rDoc.RemoveFlagsTab( rOption.mnStartCol, rOption.mnStartRow,
2315  rOption.mnEndCol, rOption.mnEndRow, nTab,
2316  ScMF::Hor | ScMF::Ver );
2317 
2318  rDoc.ExtendMerge(aRange, true);
2319 
2320  // Paint
2321 
2322  bool bDidPaint = false;
2323  if ( pViewShell )
2324  {
2325  pViewShell->SetTabNo(nTab);
2326  bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow, true);
2327  }
2328  if (!bDidPaint)
2330  }
2331  }
2332 
2333  EndRedo();
2334 }
2335 
2337 {
2338  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
2339  pViewTarget->GetViewShell()->RemoveMerge();
2340 }
2341 
2343 {
2344  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
2345 }
2346 
2348 {
2349  SCTAB nCurTab = ScDocShell::GetCurTab();
2350  aBlockRange.aStart.SetTab(nCurTab);
2351  aBlockRange.aEnd.SetTab(nCurTab);
2352 }
2353 
2355 static ScRange lcl_TotalRange( const ScRangeList& rRanges )
2356 {
2357  ScRange aTotal;
2358  if ( !rRanges.empty() )
2359  {
2360  aTotal = rRanges[ 0 ];
2361  for ( size_t i = 1, nCount = rRanges.size(); i < nCount; ++i )
2362  {
2363  ScRange const & rRange = rRanges[ i ];
2364  if (rRange.aStart.Col() < aTotal.aStart.Col()) aTotal.aStart.SetCol(rRange.aStart.Col());
2365  if (rRange.aStart.Row() < aTotal.aStart.Row()) aTotal.aStart.SetRow(rRange.aStart.Row());
2366  if (rRange.aStart.Tab() < aTotal.aStart.Tab()) aTotal.aStart.SetTab(rRange.aStart.Tab());
2367  if (rRange.aEnd.Col() > aTotal.aEnd.Col() ) aTotal.aEnd.SetCol( rRange.aEnd.Col() );
2368  if (rRange.aEnd.Row() > aTotal.aEnd.Row() ) aTotal.aEnd.SetRow( rRange.aEnd.Row() );
2369  if (rRange.aEnd.Tab() > aTotal.aEnd.Tab() ) aTotal.aEnd.SetTab(rRange.aEnd.Tab() );
2370  }
2371  }
2372  return aTotal;
2373 }
2374 
2376  const ScRangeList& rRangeList, ScDocumentUniquePtr pNewUndoDoc,
2377  const SvxBoxItem& rNewOuter, const SvxBoxInfoItem& rNewInner)
2378  : ScBlockUndo(pNewDocShell, lcl_TotalRange(rRangeList), SC_UNDO_SIMPLE)
2379  , xUndoDoc(std::move(pNewUndoDoc))
2380 {
2381  xRanges.reset(new ScRangeList(rRangeList));
2382  xOuter.reset(new SvxBoxItem(rNewOuter));
2383  xInner.reset(new SvxBoxInfoItem(rNewInner));
2384 }
2385 
2387 {
2388  return ScResId( STR_UNDO_SELATTRLINES );
2389 }
2390 
2392 {
2393  BeginUndo();
2394 
2395  ScDocument& rDoc = pDocShell->GetDocument();
2396  ScMarkData aMarkData(rDoc.GetSheetLimits());
2397  aMarkData.MarkFromRangeList(*xRanges, false);
2398  xUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
2400 
2401  EndUndo();
2402 }
2403 
2405 {
2406  BeginRedo();
2407 
2408  ScDocument& rDoc = pDocShell->GetDocument(); // call function at docfunc
2409  size_t nCount = xRanges->size();
2410  for (size_t i = 0; i < nCount; ++i )
2411  {
2412  ScRange const & rRange = (*xRanges)[i];
2413  SCTAB nTab = rRange.aStart.Tab();
2414 
2415  ScMarkData aMark(rDoc.GetSheetLimits());
2416  aMark.SetMarkArea( rRange );
2417  aMark.SelectTable( nTab, true );
2418 
2419  rDoc.ApplySelectionFrame(aMark, *xOuter, xInner.get());
2420  }
2421  for (size_t i = 0; i < nCount; ++i)
2423 
2424  EndRedo();
2425 }
2426 
2428 {
2429  //TODO later (when the function has moved from cellsuno to docfunc)
2430 }
2431 
2432 bool ScUndoBorder::CanRepeat(SfxRepeatTarget& /* rTarget */) const
2433 {
2434  return false; // See above
2435 }
2436 
2437 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3135
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:1985
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:1590
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6323
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:4923
virtual ~ScUndoRemoveBreaks() override
Definition: undoblk.cxx:2166
virtual void Undo() override
Definition: undoblk.cxx:1580
sal_uLong nStartChangeAction
Definition: undoblk.hxx:206
void ClearItems(const ScMarkData &rMark, const sal_uInt16 *pWhich, bool bApi)
Definition: docfunc.cxx:4091
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2432
void DeleteRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1365
bool RefreshAutoFilter(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
Definition: document.cxx:5766
SCCOL nColEnd
Definition: rangeutl.hxx:250
void ClearSelectionItems(const sal_uInt16 *pWhich, const ScMarkData &rMark)
Definition: document.cxx:6015
SCCOL nColStart
Definition: rangeutl.hxx:248
void MarkToSimple()
Definition: markdata.cxx:222
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1772
void SetChangeTrack()
Definition: undoblk.cxx:950
ScAddress aStart
Definition: address.hxx:497
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1667
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:114
void RemoveManualBreaks()
Definition: viewfun2.cxx:1005
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1964
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:1575
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:90
ScUndoTransliterate(ScDocShell *pNewDocShell, const ScMarkData &rMark, ScDocumentUniquePtr pNewUndoDoc, TransliterationFlags nType)
Definition: undoblk.cxx:2041
void InitOwnBlockMode(const ScRange &rMarkRange)
Definition: tabview2.cxx:332
SCROW nRowStart
Definition: rangeutl.hxx:249
void IncTab(SCTAB nDelta=1)
Definition: address.hxx:320
virtual void Redo() override
Definition: undoblk.cxx:1544
virtual void Redo() override
Definition: undoblk.cxx:308
Sparklines in a cell.
SCROW Row() const
Definition: address.hxx:274
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:209
virtual ~ScUndoEnterMatrix() override
Definition: undoblk.cxx:1904
virtual void Undo() override
Definition: undoblk.cxx:1353
static weld::Window * GetActiveDialogParent()
Definition: docsh.cxx:3076
const Fraction & GetZoomX() const
Definition: viewdata.hxx:459
static ScRange lcl_GetMultiMarkRange(const ScMarkData &rMark)
Definition: undoblk.cxx:1979
virtual void Undo() override
Definition: undoblk.cxx:2004
std::unique_ptr< SCTAB[]> pScenarios
Definition: undoblk.hxx:62
OUString aFormula
Definition: undoblk.hxx:746
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2143
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1689
virtual void Undo() override
Definition: undoblk.cxx:2121
void SetChangeTrack()
Definition: undoblk.cxx:1913
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
Definition: documen9.cxx:195
ScScenarioFlags
Definition: global.hxx:224
virtual OUString GetComment() const override
Definition: undoblk.cxx:829
void DoChange(const bool bUndo)
Definition: undoblk.cxx:1814
virtual void Undo() override
Definition: undoblk.cxx:886
sal_uIntPtr sal_uLong
void AddCellMergeOption(const ScCellMergeOption &rOption)
Definition: undoblk.cxx:2249
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:2220
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2427
ScDocFunc & GetDocFunc() const
Definition: viewdata.cxx:3118
ScDocumentUniquePtr mpRedoDoc
Definition: undoblk.hxx:633
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1974
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:1635
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:1805
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:468
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:395
void BeginUndo()
Definition: undobase.cxx:255
InsertDeleteFlags nFlags
Definition: undoblk.hxx:203
ScRange Combine() const
Definition: rangelst.cxx:1107
ScAddress aEnd
Definition: address.hxx:498
ScMarkData aMarkData
Definition: undoblk.hxx:678
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
bool InsertCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1497
virtual void Redo() override
Definition: undoblk.cxx:1754
void OnLOKInsertDeleteRow(SCROW nStartRow, tools::Long nOffset)
Definition: viewfunc.cxx:1549
static css::uno::Reference< css::datatransfer::XTransferable2 > GetClipData(vcl::Window *pWin)
Definition: tabvwshc.cxx:494
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:2235
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:1007
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:1791
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1603
ScDocumentUniquePtr mpUndoDoc
Definition: undoblk.hxx:632
virtual OUString GetComment() const override
Definition: undoblk.cxx:1908
sal_uLong GetActionMax() const
Definition: chgtrack.hxx:955
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1607
virtual void Redo() override
Definition: undoblk.cxx:1864
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:1316
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5264
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:568
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:319
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
virtual OUString GetComment() const override
Definition: undoblk.cxx:1694
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:278
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6156
void TransliterateText(const ScMarkData &rMultiMark, TransliterationFlags nType)
Definition: documen8.cxx:1210
virtual void Undo() override
Definition: undoblk.cxx:1857
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 bSkipEmptyCells=false, const ScRangeList *pDestRanges=nullptr)
Paste data from a clipboard document into this document.
Definition: document.cxx:2843
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:1200
void SetChangeTrack()
Definition: undoblk.cxx:127
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:874
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:891
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:1248
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:315
sal_uLong nStartChangeAction
Definition: undoblk.hxx:156
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2036
bool IsMultiMarked() const
Definition: markdata.hxx:81
bool bKeepScenarioFlags
Definition: undoblk.hxx:240
int nCount
const ScValidationDataList * GetValidationList() const
Definition: document.hxx:1871
SC_DLLPUBLIC void AppendMove(const ScRange &rFromRange, const ScRange &rToRange, ScDocument *pRefDoc)
Definition: chgtrack.cxx:2525
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:2063
ScDocument * GetUndoDoc()
Definition: undoblk.cxx:2244
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:1511
SCTAB Tab() const
Definition: address.hxx:283
void SetRow(SCROW nRowP)
Definition: address.hxx:287
ScDocumentUniquePtr xRedoDoc
Definition: undoblk.hxx:611
virtual void Undo() override
Definition: undoblk.cxx:2391
ScUndoConditionalFormat(ScDocShell *pNewDocShell, ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange &rRange)
Definition: undoblk.cxx:1562
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
virtual void Undo() override
Definition: undoblk.cxx:1699
void SetChangeTrack()
Definition: undoblk.cxx:380
virtual void Undo() override
Definition: undoblk.cxx:1630
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2085
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:4833
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
void UpdateReference(sc::RefUpdateContext &rCxt, SCTAB nLocalTab=-1)
Definition: rangenam.cxx:726
void SetCol(SCCOL nColP)
Definition: address.hxx:291
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:2485
static void PaintMore(ScDocShell *pDocShell, const ScRange &rRange)
Definition: undoutil.cxx:97
TransliterationFlags
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2206
SC_DLLPUBLIC void Undo(sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge=false)
Definition: chgtrack.cxx:3034
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:357
virtual void Undo() override
Definition: undoblk.cxx:2059
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:259
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:2096
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:92
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
void BeginRedo()
Definition: undobase.cxx:142
virtual void Undo() override
Definition: undoblk.cxx:1161
virtual void Redo() override
Definition: undoblk.cxx:1416
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:890
virtual void Redo() override
Definition: undoblk.cxx:1171
virtual void Undo() override
Definition: undoblk.cxx:2175
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1890
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:4597
ScMarkData aMarkData
Definition: undoblk.hxx:862
void UpdateReference(sc::RefUpdateContext &rCxt)
Definition: validat.cxx:1043
ScUndoConditionalFormatList(ScDocShell *pNewDocShell, ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab)
Definition: undoblk.cxx:1612
virtual ~ScUndoConditionalFormatList() override
Definition: undoblk.cxx:1621
virtual void Redo() override
Definition: undoblk.cxx:2132
sal_uLong nEndChangeAction
Definition: undoblk.hxx:238
virtual OUString GetComment() const override
Definition: undoblk.cxx:1625
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:885
virtual void Redo() override
Definition: undoblk.cxx:601
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:316
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:157
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2715
sal_Int16 SCCOL
Definition: types.hxx:21
SC_DLLPUBLIC void DeleteSelection(InsertDeleteFlags nDelFlag, const ScMarkData &rMark, bool bBroadcast=true)
Definition: document.cxx:6027
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:2091
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:896
bool InsertRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
Definition: document.cxx:1243
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1800
ScUndoRemoveBreaks(ScDocShell *pNewDocShell, SCTAB nNewTab, ScDocumentUniquePtr pNewUndoDoc)
Definition: undoblk.cxx:2158
virtual OUString GetComment() const override
Definition: undoblk.cxx:1809
std::unique_ptr< ScRefUndoData > pRefRedoData
Definition: undoblk.hxx:205
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:2336
ScUndoUseScenario(ScDocShell *pNewDocShell, const ScMarkData &rMark, const ScArea &rDestArea, ScDocumentUniquePtr pNewUndoDoc, const OUString &rNewName)
Definition: undoblk.cxx:1672
ScUndoBorder(ScDocShell *pNewDocShell, const ScRangeList &rRangeList, ScDocumentUniquePtr pNewUndoDoc, const SvxBoxItem &rNewOuter, const SvxBoxInfoItem &rNewInner)
Definition: undoblk.cxx:2375
size_t size() const
Definition: rangelst.hxx:89
void IncRow(SCROW nDelta=1)
Definition: address.hxx:312
void DoChange(const bool bUndo)
Definition: undoblk.cxx:390
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:174
SfxItemSet & GetItemSet()
Definition: patattr.hxx:155
ScDocumentUniquePtr pRefUndoDoc
Definition: undobase.hxx:143
ScMarkData aMarkData
Definition: undoblk.hxx:200
virtual ~ScUndoUseScenario() override
Definition: undoblk.cxx:1690
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3151
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2342
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:4850
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:1998
ScPasteFunc nFunction
Definition: undoblk.hxx:165
SC_DLLPUBLIC bool PasteFromClip(InsertDeleteFlags nFlags, ScDocument *pClipDoc, ScPasteFunc nFunction=ScPasteFunc::NONE, bool bSkipEmptyCells=false, bool bTranspose=false, bool bAsLink=false, InsCellCmd eMoveMode=INS_NONE, InsertDeleteFlags nUndoExtraFlags=InsertDeleteFlags::NONE, bool bAllowDialogs=false)
Definition: viewfun3.cxx:872
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:2389
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2215
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1551
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:702
ScDocumentUniquePtr mpUndoDoc
Definition: undoblk.hxx:653
void RemoveManualBreaks(SCTAB nTab)
Definition: document.cxx:6329
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:510
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:2621
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:1267
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5662
void ForgetNoteCaptions(const ScRangeList &rRanges, bool bPreserveData)
Definition: document.cxx:6857
ScRange maRange
Range of cells that are about to be moved for insert/delete/move modes.
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:158
SCCOL Col() const
Definition: address.hxx:279
ScDocumentUniquePtr xUndoDoc
Definition: undoblk.hxx:977
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1663
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1182
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:2152
virtual void Undo() override
Definition: undoblk.cxx:2254
sal_uLong nStartChangeAction
Definition: undoblk.hxx:127
void BeginUndo()
Definition: undobase.cxx:435
virtual void Redo() override
Definition: undoblk.cxx:2404
OUString aName
Definition: undoblk.hxx:679
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1781
virtual ~ScUndoDeleteMulti() override
Definition: undoblk.cxx:652
ScRange aExtendedRange
Definition: undoblk.hxx:155
virtual void Undo() override
Definition: undoblk.cxx:1537
bool UnmergeCells(const ScRange &rRange, bool bRecord, ScUndoRemoveMerge *pUndoRemoveMerge)
Definition: docfunc.cxx:5049
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:4316
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:2355
#define SC_PF_LINES
Definition: docsh.hxx:76
double GetPPTY() const
Definition: viewdata.hxx:469
virtual OUString GetComment() const override
Definition: undoblk.cxx:2116
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1075
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:154
virtual void Redo() override
Definition: undoblk.cxx:2074
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:432
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:152
sal_uLong nEndChangeAction
Definition: undoblk.hxx:207
virtual void Redo() override
Definition: undoblk.cxx:2019
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:907
virtual OUString GetComment() const override
Definition: undoblk.cxx:2239
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:1504
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:1881
virtual ~ScUndoDragDrop() override
Definition: undoblk.cxx:1237
virtual OUString GetComment() const override
Definition: undoblk.cxx:1241
OUString aName
SCTAB GetFirstSelected() const
Definition: markdata.cxx:185
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:5080
InsCellCmd
Definition: global.hxx:287
virtual void Redo() override
Definition: undoblk.cxx:776
virtual void Undo() override
Definition: undoblk.cxx:1924
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1871
void DoChange(ScDocument *pDoc)
Definition: undoblk.cxx:1590
ScUndoDragDrop(ScDocShell *pNewDocShell, const ScRange &rRange, const ScAddress &aNewDestPos, bool bNewCut, ScDocumentUniquePtr pUndoDocument, bool bScenario)
Definition: undoblk.cxx:1205
static SC_DLLPUBLIC ScTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: transobj.cxx:197
void SetStyleSheetToMarked(const SfxStyleSheet *pStyleSheet)
Definition: viewfunc.cxx:1344
void EndUndo()
Definition: undobase.cxx:261
void OnLOKInsertDeleteColumn(SCCOL nStartCol, tools::Long nOffset)
Definition: viewfunc.cxx:1492
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:1895
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:2386
virtual OUString GetComment() const override
Definition: undoblk.cxx:2170
void DoChange(ScDocument *pSrcDoc) const
Definition: undoblk.cxx:1524
virtual void Redo() override
Definition: undoblk.cxx:1945
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6161
virtual void Redo() override
Definition: undoblk.cxx:2290
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:2030
TransliterationFlags nTransliterationType
Definition: undoblk.hxx:887
void DoChange(const ScDocument *pDoc)
Definition: undoblk.cxx:1640
virtual ~ScUndoClearItems() override
Definition: undoblk.cxx:2112
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undoblk.cxx:1557
void BroadcastChanges(const ScRange &rRange)
Definition: undobase.cxx:174
virtual void Redo() override
Definition: undoblk.cxx:1585
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 DoChange() const
Definition: undoblk.cxx:661
void ChangeSelectionIndent(bool bIncrement, const ScMarkData &rMark)
Definition: document.cxx:6003
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:222
SC_DLLPUBLIC void AppendInsert(const ScRange &rRange, bool bEndOfList=false)
Definition: chgtrack.cxx:2753
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, bool bApi)
Definition: viewfun2.cxx:192
virtual ~ScUndoIndent() override
Definition: undoblk.cxx:1994
void ApplySelectionFrame(const ScMarkData &rMark, const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner)
Definition: document.cxx:5849
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:1942
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undoblk.cxx:1500
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:2190
std::unique_ptr< SCTAB[]> pTabs
Definition: undoblk.hxx:60
static SCTAB GetCurTab()
Definition: docsh4.cxx:2599
sal_uLong nEndChangeAction
Definition: undoblk.hxx:63
sal_uLong nEndChangeAction
Definition: undoblk.hxx:128
virtual OUString GetComment() const override
Definition: undoblk.cxx:1519
void DoChange(const bool bUndo)
Definition: undoblk.cxx:844
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:513
const ScRange & GetMultiMarkArea() const
Definition: markdata.hxx:84
void EndRedo()
Definition: undobase.cxx:151
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1479
void RemoveAll()
Definition: rangelst.cxx:1101
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:882
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:2054
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:2164
virtual ~ScUndoConditionalFormat() override
Definition: undoblk.cxx:1571
virtual ~ScUndoTransliterate() override
Definition: undoblk.cxx:2050
bool m_bDetectedRangeSegmentation false
ScDocumentUniquePtr pUndoDoc
Definition: undoblk.hxx:745
bool bRedoFilled
Definition: undoblk.hxx:208