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