LibreOffice Module sc (master)  1
undocell.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 <undocell.hxx>
21 
22 #include <scitems.hxx>
23 #include <editeng/editobj.hxx>
24 #include <sfx2/app.hxx>
25 #include <comphelper/lok.hxx>
26 #include <osl/diagnose.h>
27 
28 #include <document.hxx>
29 #include <docpool.hxx>
30 #include <patattr.hxx>
31 #include <docsh.hxx>
32 #include <tabvwsh.hxx>
33 #include <globstr.hrc>
34 #include <scresid.hxx>
35 #include <global.hxx>
36 #include <formulacell.hxx>
37 #include <target.hxx>
38 #include <undoolk.hxx>
39 #include <detdata.hxx>
40 #include <stlpool.hxx>
41 #include <printfun.hxx>
42 #include <rangenam.hxx>
43 #include <chgtrack.hxx>
44 #include <stringutil.hxx>
45 
46 namespace HelperNotifyChanges
47 {
48  static void NotifyIfChangesListeners(const ScDocShell& rDocShell, const ScAddress &rPos,
49  const ScUndoEnterData::ValuesType &rOldValues)
50  {
51  if (ScModelObj* pModelObj = getMustPropagateChangesModel(rDocShell))
52  {
53  ScRangeList aChangeRanges;
54 
55  for (const auto & rOldValue : rOldValues)
56  {
57  aChangeRanges.push_back( ScRange(rPos.Col(), rPos.Row(), rOldValue.mnTab));
58  }
59 
60  Notify(*pModelObj, aChangeRanges, "cell-change");
61  }
62  }
63 }
64 
65 
67  SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
68  const ScPatternAttr* pOldPat, const ScPatternAttr* pNewPat,
69  const ScPatternAttr* pApplyPat ) :
70  ScSimpleUndo( pNewDocShell ),
71  nCol( nNewCol ),
72  nRow( nNewRow ),
73  nTab( nNewTab ),
74  pOldEditData( static_cast<EditTextObject*>(nullptr) ),
75  pNewEditData( static_cast<EditTextObject*>(nullptr) )
76 {
78  pNewPattern = const_cast<ScPatternAttr*>( &pPool->Put( *pNewPat ) );
79  pOldPattern = const_cast<ScPatternAttr*>( &pPool->Put( *pOldPat ) );
80  pApplyPattern = const_cast<ScPatternAttr*>( &pPool->Put( *pApplyPat ) );
81 }
82 
84 {
86  pPool->Remove(*pNewPattern);
87  pPool->Remove(*pOldPattern);
88  pPool->Remove(*pApplyPattern);
89 }
90 
92 {
94  return ScResId( STR_UNDO_CURSORATTR ); // "Attribute"
95 }
96 
97 void ScUndoCursorAttr::SetEditData( std::unique_ptr<EditTextObject> pOld, std::unique_ptr<EditTextObject> pNew )
98 {
99  pOldEditData = std::move(pOld);
100  pNewEditData = std::move(pNew);
101 }
102 
103 void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const std::unique_ptr<EditTextObject>& pEditData ) const
104 {
105  ScDocument& rDoc = pDocShell->GetDocument();
106  ScAddress aPos(nCol, nRow, nTab);
107  rDoc.SetPattern( nCol, nRow, nTab, *pWhichPattern );
108 
109  if (rDoc.GetCellType(aPos) == CELLTYPE_EDIT && pEditData)
110  rDoc.SetEditText(aPos, *pEditData, nullptr);
111 
113  if (pViewShell)
114  {
115  pViewShell->SetTabNo( nTab );
116  pViewShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_JUMP, false, false );
117  pViewShell->AdjustBlockHeight();
118  }
119 
120  const SfxItemSet& rApplySet = pApplyPattern->GetItemSet();
121  bool bPaintExt = ( rApplySet.GetItemState( ATTR_SHADOW ) != SfxItemState::DEFAULT ||
122  rApplySet.GetItemState( ATTR_CONDITIONAL ) != SfxItemState::DEFAULT );
123  bool bPaintRows = ( rApplySet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DEFAULT );
124 
125  sal_uInt16 nFlags = SC_PF_TESTMERGE;
126  if (bPaintExt)
127  nFlags |= SC_PF_LINES;
128  if (bPaintRows)
129  nFlags |= SC_PF_WHOLEROWS;
131 }
132 
134 {
135  BeginUndo();
137  EndUndo();
138 }
139 
141 {
142  BeginRedo();
144  EndRedo();
145 }
146 
148 {
149  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
150  pViewTarget->GetViewShell()->ApplySelectionPattern( *pApplyPattern );
151 }
152 
154 {
155  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
156 }
157 
158 ScUndoEnterData::Value::Value() : mnTab(-1), mbHasFormat(false), mnFormat(0) {}
159 
161  ScDocShell* pNewDocShell, const ScAddress& rPos, ValuesType& rOldValues,
162  const OUString& rNewStr, std::unique_ptr<EditTextObject> pObj ) :
163  ScSimpleUndo( pNewDocShell ),
164  maNewString(rNewStr),
165  mpNewEditData(std::move(pObj)),
167  maPos(rPos)
168 {
169  maOldValues.swap(rOldValues);
170 
171  SetChangeTrack();
172 }
173 
175 {
176  return ScResId( STR_UNDO_ENTERDATA ); // "Input"
177 }
178 
180 {
181  // only when needed (old or new Edit cell, or Attribute)?
182  bool bHeightChanged = false;
183  for (const auto & i : maOldValues)
184  {
185  if (pDocShell->AdjustRowHeight(maPos.Row(), maPos.Row(), i.mnTab))
186  bHeightChanged = true;
187  }
188 
190  if (pViewShell)
191  {
192  if (comphelper::LibreOfficeKit::isActive() && bHeightChanged)
193  {
196  pViewShell, false /* bColumns */, true /* bRows */, true /* bSizes*/,
197  false /* bHidden */, false /* bFiltered */, false /* bGroups */, maPos.Tab());
198  }
199  pViewShell->SetTabNo(maPos.Tab());
200  pViewShell->MoveCursorAbs(maPos.Col(), maPos.Row(), SC_FOLLOW_JUMP, false, false);
201  }
202 
204 }
205 
207 {
208  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
209  if ( pChangeTrack )
210  {
211  mnEndChangeAction = pChangeTrack->GetActionMax() + 1;
212  ScAddress aPos(maPos);
213  for (const Value & rOldValue : maOldValues)
214  {
215  aPos.SetTab(rOldValue.mnTab);
216  sal_uLong nFormat = 0;
217  if (rOldValue.mbHasFormat)
218  nFormat = rOldValue.mnFormat;
219  pChangeTrack->AppendContent(aPos, rOldValue.maCell, nFormat);
220  }
221  if ( mnEndChangeAction > pChangeTrack->GetActionMax() )
222  mnEndChangeAction = 0; // nothing is appended
223  }
224  else
225  mnEndChangeAction = 0;
226 }
227 
229 {
230  BeginUndo();
231 
232  ScDocument& rDoc = pDocShell->GetDocument();
233  for (const Value & rVal : maOldValues)
234  {
235  ScCellValue aNewCell;
236  aNewCell.assign(rVal.maCell, rDoc, ScCloneFlags::StartListening);
237  ScAddress aPos = maPos;
238  aPos.SetTab(rVal.mnTab);
239  aNewCell.release(rDoc, aPos);
240 
241  if (rVal.mbHasFormat)
242  rDoc.ApplyAttr(maPos.Col(), maPos.Row(), rVal.mnTab,
243  SfxUInt32Item(ATTR_VALUE_FORMAT, rVal.mnFormat));
244  else
245  {
246  auto pPattern = std::make_unique<ScPatternAttr>(*rDoc.GetPattern(maPos.Col(), maPos.Row(), rVal.mnTab));
247  pPattern->GetItemSet().ClearItem( ATTR_VALUE_FORMAT );
248  rDoc.SetPattern(maPos.Col(), maPos.Row(), rVal.mnTab, std::move(pPattern));
249  }
250  pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), rVal.mnTab);
251  }
252 
253  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
254  size_t nCount = maOldValues.size();
255  if ( pChangeTrack && mnEndChangeAction >= sal::static_int_cast<sal_uLong>(nCount) )
256  pChangeTrack->Undo( mnEndChangeAction - nCount + 1, mnEndChangeAction );
257 
258  DoChange();
259  EndUndo();
260 
262 }
263 
265 {
266  BeginRedo();
267 
268  ScDocument& rDoc = pDocShell->GetDocument();
269  for (const Value & rOldValue : maOldValues)
270  {
271  SCTAB nTab = rOldValue.mnTab;
272  if (mpNewEditData)
273  {
274  ScAddress aPos = maPos;
275  aPos.SetTab(nTab);
276  // edit text will be cloned.
277  rDoc.SetEditText(aPos, *mpNewEditData, nullptr);
278  }
279  else
280  rDoc.SetString(maPos.Col(), maPos.Row(), nTab, maNewString);
281 
282  pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), nTab);
283  }
284 
285  SetChangeTrack();
286 
287  DoChange();
288  EndRedo();
289 
291 }
292 
294 {
295  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
296  {
297  OUString aTemp = maNewString;
298  pViewTarget->GetViewShell()->EnterDataAtCursor( aTemp );
299  }
300 }
301 
303 {
304  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
305 }
306 
308  ScDocShell* pNewDocShell, const ScAddress& rNewPos,
309  const ScCellValue& rUndoCell, double nVal ) :
310  ScSimpleUndo( pNewDocShell ),
311  aPos ( rNewPos ),
312  maOldCell(rUndoCell),
313  nValue ( nVal )
314 {
315  SetChangeTrack();
316 }
317 
319 {
320 }
321 
323 {
324  return ScResId( STR_UNDO_ENTERDATA ); // "Input"
325 }
326 
328 {
329  ScDocument& rDoc = pDocShell->GetDocument();
330  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
331  if ( pChangeTrack )
332  {
333  nEndChangeAction = pChangeTrack->GetActionMax() + 1;
334  pChangeTrack->AppendContent(aPos, maOldCell);
335  if ( nEndChangeAction > pChangeTrack->GetActionMax() )
336  nEndChangeAction = 0; // nothing is appended
337  }
338  else
339  nEndChangeAction = 0;
340 }
341 
343 {
344  BeginUndo();
345 
346  ScDocument& rDoc = pDocShell->GetDocument();
347  ScCellValue aNewCell;
349  aNewCell.release(rDoc, aPos);
350 
352 
353  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
354  if ( pChangeTrack )
355  pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
356 
357  EndUndo();
358 }
359 
361 {
362  BeginRedo();
363 
364  ScDocument& rDoc = pDocShell->GetDocument();
365  rDoc.SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
367 
368  SetChangeTrack();
369 
370  EndRedo();
371 }
372 
374 {
375  // makes no sense
376 }
377 
379 {
380  return false;
381 }
382 
383 ScUndoSetCell::ScUndoSetCell( ScDocShell* pDocSh, const ScAddress& rPos, const ScCellValue& rOldVal, const ScCellValue& rNewVal ) :
384  ScSimpleUndo(pDocSh), maPos(rPos), maOldValue(rOldVal), maNewValue(rNewVal), mnEndChangeAction(0)
385 {
386  SetChangeTrack();
387 }
388 
390 
392 {
393  BeginUndo();
397 
398  ScDocument& rDoc = pDocShell->GetDocument();
399  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
400  if (pChangeTrack)
401  pChangeTrack->Undo(mnEndChangeAction, mnEndChangeAction);
402 
403  EndUndo();
404 }
405 
407 {
408  BeginRedo();
412  SetChangeTrack();
413  EndRedo();
414 }
415 
417 {
418  // Makes no sense.
419 }
420 
421 bool ScUndoSetCell::CanRepeat( SfxRepeatTarget& /*rTarget*/ ) const
422 {
423  return false;
424 }
425 
427 {
428  return ScResId(STR_UNDO_ENTERDATA); // "Input"
429 }
430 
432 {
433  ScDocument& rDoc = pDocShell->GetDocument();
434  ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
435  if (pChangeTrack)
436  {
437  mnEndChangeAction = pChangeTrack->GetActionMax() + 1;
438 
439  pChangeTrack->AppendContent(maPos, maOldValue);
440 
441  if (mnEndChangeAction > pChangeTrack->GetActionMax())
442  mnEndChangeAction = 0; // Nothing is appended
443  }
444  else
445  mnEndChangeAction = 0;
446 }
447 
449 {
450  ScDocument& rDoc = pDocShell->GetDocument();
451 
452  switch (rVal.meType)
453  {
454  case CELLTYPE_NONE:
455  // empty cell
456  rDoc.SetEmptyCell(maPos);
457  break;
458  case CELLTYPE_VALUE:
459  rDoc.SetValue(maPos, rVal.mfValue);
460  break;
461  case CELLTYPE_STRING:
462  {
463  ScSetStringParam aParam;
464  aParam.setTextInput();
465  // Undo only cell content, without setting any number format.
467  rDoc.SetString(maPos, rVal.mpString->getString(), &aParam);
468  }
469  break;
470  case CELLTYPE_EDIT:
471  rDoc.SetEditText(maPos, rVal.mpEditText->Clone());
472  break;
473  case CELLTYPE_FORMULA:
474  rDoc.SetFormulaCell(maPos, rVal.mpFormula->Clone());
475  break;
476  default:
477  ;
478  }
479 }
480 
482 {
484  if ( pViewShell )
485  {
486  pViewShell->SetTabNo( maPos.Tab() );
487  pViewShell->MoveCursorAbs( maPos.Col(), maPos.Row(), SC_FOLLOW_JUMP, false, false );
488  }
489 }
490 
492  SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
493  bool bNewColumn, bool bNewInsert ) :
494  ScSimpleUndo( pNewDocShell ),
495  nCol( nNewCol ),
496  nRow( nNewRow ),
497  nTab( nNewTab ),
498  bColumn( bNewColumn ),
499  bInsert( bNewInsert )
500 {
501 }
502 
504 {
505 }
506 
508 {
509  //"Column break" | "Row break" "insert" | "delete"
510  return bColumn ?
511  ( bInsert ?
512  ScResId( STR_UNDO_INSCOLBREAK ) :
513  ScResId( STR_UNDO_DELCOLBREAK )
514  ) :
515  ( bInsert ?
516  ScResId( STR_UNDO_INSROWBREAK ) :
517  ScResId( STR_UNDO_DELROWBREAK )
518  );
519 }
520 
521 void ScUndoPageBreak::DoChange( bool bInsertP ) const
522 {
524 
525  if (pViewShell)
526  {
527  pViewShell->SetTabNo( nTab );
528  pViewShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_JUMP, false, false );
529 
530  if (bInsertP)
531  pViewShell->InsertPageBreak(bColumn, false);
532  else
533  pViewShell->DeletePageBreak(bColumn, false);
534 
536  }
537 }
538 
540 {
541  BeginUndo();
542  DoChange(!bInsert);
543  EndUndo();
544 }
545 
547 {
548  BeginRedo();
549  DoChange(bInsert);
550  EndRedo();
551 }
552 
554 {
555  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
556  {
557  ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
558 
559  if (bInsert)
560  rViewShell.InsertPageBreak(bColumn);
561  else
562  rViewShell.DeletePageBreak(bColumn);
563  }
564 }
565 
567 {
568  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
569 }
570 
572  SCTAB nT, sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP ) :
573  ScSimpleUndo( pNewDocShell ),
574  nTab( nT ),
575  nOldScale( nOS ),
576  nOldPages( nOP ),
577  nNewScale( nNS ),
578  nNewPages( nNP )
579 {
580 }
581 
583 {
584 }
585 
587 {
588  return ScResId( STR_UNDO_PRINTSCALE );
589 }
590 
591 void ScUndoPrintZoom::DoChange( bool bUndo )
592 {
593  sal_uInt16 nScale = bUndo ? nOldScale : nNewScale;
594  sal_uInt16 nPages = bUndo ? nOldPages : nNewPages;
595 
596  ScDocument& rDoc = pDocShell->GetDocument();
597  OUString aStyleName = rDoc.GetPageStyle( nTab );
598  ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
599  SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SfxStyleFamily::Page );
600  OSL_ENSURE( pStyleSheet, "PageStyle not found" );
601  if ( pStyleSheet )
602  {
603  SfxItemSet& rSet = pStyleSheet->GetItemSet();
604  rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, nScale ) );
605  rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALETOPAGES, nPages ) );
606 
607  ScPrintFunc aPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab );
608  aPrintFunc.UpdatePages();
609  }
610 }
611 
613 {
614  BeginUndo();
615  DoChange(true);
616  EndUndo();
617 }
618 
620 {
621  BeginRedo();
622  DoChange(false);
623  EndRedo();
624 }
625 
627 {
628  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
629  {
630  ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
631  ScViewData& rViewData = rViewShell.GetViewData();
632  rViewData.GetDocShell()->SetPrintZoom( rViewData.GetTabNo(), nNewScale, nNewPages );
633  }
634 }
635 
637 {
638  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
639 }
640 
642  ScDocShell* pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
643  const ScCellValue& rOldText, const ScCellValue& rNewText ) :
644  ScSimpleUndo( pNewDocShell ),
645  nCol( nNewCol ),
646  nRow( nNewRow ),
647  nTab( nNewTab ),
648  maOldText(rOldText),
649  maNewText(rNewText)
650 {
652 }
653 
655 
657 {
658  return ScResId( STR_UNDO_THESAURUS ); // "Thesaurus"
659 }
660 
662 {
663  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
664  if ( pChangeTrack )
665  {
666  nEndChangeAction = pChangeTrack->GetActionMax() + 1;
667  pChangeTrack->AppendContent(ScAddress(nCol, nRow, nTab), rOldCell);
668  if ( nEndChangeAction > pChangeTrack->GetActionMax() )
669  nEndChangeAction = 0; // nothing is appended
670  }
671  else
672  nEndChangeAction = 0;
673 }
674 
675 void ScUndoThesaurus::DoChange( bool bUndo, const ScCellValue& rText )
676 {
677  ScDocument& rDoc = pDocShell->GetDocument();
678 
680  if (pViewShell)
681  {
682  pViewShell->SetTabNo( nTab );
683  pViewShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_JUMP, false, false );
684  }
685 
686  ScAddress aPos(nCol, nRow, nTab);
687  rText.commit(rDoc, aPos);
688  if (!bUndo)
690 
692 }
693 
695 {
696  BeginUndo();
697  DoChange(true, maOldText);
698  ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
699  if ( pChangeTrack )
700  pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
701  EndUndo();
702 }
703 
705 {
706  BeginRedo();
707  DoChange(false, maNewText);
708  EndRedo();
709 }
710 
712 {
713  if (auto pViewTarget = dynamic_cast<ScTabViewTarget*>( &rTarget))
714  pViewTarget->GetViewShell()->DoThesaurus();
715 }
716 
718 {
719  return dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr;
720 }
721 
722 
724  const ScNoteData& rNoteData, bool bInsert, std::unique_ptr<SdrUndoAction> pDrawUndo ) :
725  ScSimpleUndo( &rDocShell ),
726  maPos( rPos ),
727  mpDrawUndo( std::move(pDrawUndo) )
728 {
729  OSL_ENSURE( rNoteData.mxCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note caption" );
730  if (bInsert)
731  {
732  maNewData = rNoteData;
734  }
735  else
736  {
737  maOldData = rNoteData;
739  }
740 }
741 
743  const ScNoteData& rOldData, const ScNoteData& rNewData, std::unique_ptr<SdrUndoAction> pDrawUndo ) :
744  ScSimpleUndo( &rDocShell ),
745  maPos( rPos ),
746  maOldData( rOldData ),
747  maNewData( rNewData ),
748  mpDrawUndo( std::move(pDrawUndo) )
749 {
750  OSL_ENSURE( maOldData.mxCaption || maNewData.mxCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note captions" );
751  OSL_ENSURE( !maOldData.mxInitData && !maNewData.mxInitData, "ScUndoReplaceNote::ScUndoReplaceNote - unexpected uninitialized note" );
754 }
755 
757 {
758  mpDrawUndo.reset();
759 }
760 
762 {
763  BeginUndo();
765  /* Undo insert -> remove new note.
766  Undo remove -> insert old note.
767  Undo replace -> remove new note, insert old note. */
771  EndUndo();
772 }
773 
775 {
776  BeginRedo();
777  RedoSdrUndoAction( mpDrawUndo.get() );
778  /* Redo insert -> insert new note.
779  Redo remove -> remove old note.
780  Redo replace -> remove old note, insert new note. */
784  EndRedo();
785 }
786 
788 {
789 }
790 
792 {
793  return false;
794 }
795 
797 {
798  return ScResId( maNewData.mxCaption ?
799  (maOldData.mxCaption ? STR_UNDO_EDITNOTE : STR_UNDO_INSERTNOTE) : STR_UNDO_DELETENOTE );
800 }
801 
803 {
804  if( rNoteData.mxCaption )
805  {
806  ScDocument& rDoc = pDocShell->GetDocument();
807  OSL_ENSURE( !rDoc.GetNote(maPos), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
808  ScPostIt* pNote = new ScPostIt( rDoc, maPos, rNoteData, false );
809  rDoc.SetNote( maPos, std::unique_ptr<ScPostIt>(pNote) );
811  }
812 }
813 
815 {
816  if( !rNoteData.mxCaption )
817  return;
818 
819  ScDocument& rDoc = pDocShell->GetDocument();
820  OSL_ENSURE( rDoc.GetNote(maPos), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
821  if( std::unique_ptr<ScPostIt> pNote = rDoc.ReleaseNote( maPos ) )
822  {
823  /* Forget pointer to caption object to suppress removing the
824  caption object from the drawing layer while deleting pNote
825  (removing the caption is done by a drawing undo action). */
826  pNote->ForgetCaption();
828  }
829 }
830 
831 ScUndoShowHideNote::ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow ) :
832  ScSimpleUndo( &rDocShell ),
833  maPos( rPos ),
834  mbShown( bShow )
835 {
836 }
837 
839 {
840 }
841 
843 {
844  BeginUndo();
845  if( ScPostIt* pNote = pDocShell->GetDocument().GetNote(maPos) )
846  pNote->ShowCaption( maPos, !mbShown );
847  EndUndo();
848 }
849 
851 {
852  BeginRedo();
853  if( ScPostIt* pNote = pDocShell->GetDocument().GetNote(maPos) )
854  pNote->ShowCaption( maPos, mbShown );
855  EndRedo();
856 }
857 
859 {
860 }
861 
863 {
864  return false;
865 }
866 
868 {
869  return ScResId( mbShown ? STR_UNDO_SHOWNOTE : STR_UNDO_HIDENOTE );
870 }
871 
873  std::unique_ptr<SdrUndoAction> pDraw, const ScDetOpData* pOperation,
874  std::unique_ptr<ScDetOpList> pUndoList ) :
875  ScSimpleUndo( pNewDocShell ),
876  pOldList ( std::move(pUndoList) ),
877  nAction ( 0 ),
878  pDrawUndo ( std::move(pDraw) )
879 {
880  bIsDelete = ( pOperation == nullptr );
881  if (!bIsDelete)
882  {
883  nAction = static_cast<sal_uInt16>(pOperation->GetOperation());
884  aPos = pOperation->GetPos();
885  }
886 }
887 
889 {
890  pDrawUndo.reset();
891  pOldList.reset();
892 }
893 
895 {
896  const char* pId = STR_UNDO_DETDELALL;
897  if ( !bIsDelete )
898  switch ( static_cast<ScDetOpType>(nAction) )
899  {
900  case SCDETOP_ADDSUCC: pId = STR_UNDO_DETADDSUCC; break;
901  case SCDETOP_DELSUCC: pId = STR_UNDO_DETDELSUCC; break;
902  case SCDETOP_ADDPRED: pId = STR_UNDO_DETADDPRED; break;
903  case SCDETOP_DELPRED: pId = STR_UNDO_DETDELPRED; break;
904  case SCDETOP_ADDERROR: pId = STR_UNDO_DETADDERROR; break;
905  }
906 
907  return ScResId(pId);
908 }
909 
911 {
912  BeginUndo();
913 
914  ScDocument& rDoc = pDocShell->GetDocument();
915  DoSdrUndoAction(pDrawUndo.get(), &rDoc);
916 
917  if (bIsDelete)
918  {
919  if ( pOldList )
920  rDoc.SetDetOpList( std::unique_ptr<ScDetOpList>(new ScDetOpList(*pOldList)) );
921  }
922  else
923  {
924  // Remove entry from list
925 
926  ScDetOpList* pList = rDoc.GetDetOpList();
927  if (pList && pList->Count())
928  {
929  ScDetOpDataVector& rVec = pList->GetDataVector();
930  ScDetOpDataVector::iterator it = rVec.begin() + rVec.size() - 1;
931  if ( (*it)->GetOperation() == static_cast<ScDetOpType>(nAction) && (*it)->GetPos() == aPos )
932  rVec.erase( it);
933  else
934  {
935  OSL_FAIL("Detective entry could not be found in list");
936  }
937  }
938  }
939 
941  if (pViewShell)
942  pViewShell->RecalcPPT();
943 
944  EndUndo();
945 }
946 
948 {
949  BeginRedo();
950 
952 
953  ScDocument& rDoc = pDocShell->GetDocument();
954 
955  if (bIsDelete)
957  else
958  rDoc.AddDetectiveOperation( ScDetOpData( aPos, static_cast<ScDetOpType>(nAction) ) );
959 
961  if (pViewShell)
962  pViewShell->RecalcPPT();
963 
964  EndRedo();
965 }
966 
968 {
969  // makes no sense
970 }
971 
972 bool ScUndoDetective::CanRepeat(SfxRepeatTarget& /* rTarget */) const
973 {
974  return false;
975 }
976 
978  std::unique_ptr<ScRangeName> pOld, std::unique_ptr<ScRangeName> pNew, SCTAB nTab ) :
979  ScSimpleUndo( pNewDocShell ),
980  pOldRanges ( std::move(pOld) ),
981  pNewRanges ( std::move(pNew) ),
982  mnTab ( nTab )
983 {
984 }
985 
987 {
988  pOldRanges.reset();
989  pNewRanges.reset();
990 }
991 
993 {
994  return ScResId( STR_UNDO_RANGENAMES );
995 }
996 
997 void ScUndoRangeNames::DoChange( bool bUndo )
998 {
999  ScDocument& rDoc = pDocShell->GetDocument();
1001 
1002  if ( bUndo )
1003  {
1004  auto p = std::make_unique<ScRangeName>(*pOldRanges);
1005  if (mnTab >= 0)
1006  rDoc.SetRangeName( mnTab, std::move(p) );
1007  else
1008  rDoc.SetRangeName( std::move(p) );
1009  }
1010  else
1011  {
1012  auto p = std::make_unique<ScRangeName>(*pNewRanges);
1013  if (mnTab >= 0)
1014  rDoc.SetRangeName( mnTab, std::move(p) );
1015  else
1016  rDoc.SetRangeName( std::move(p) );
1017  }
1018 
1019  rDoc.CompileHybridFormula();
1020 
1021  SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreasChanged ) );
1022 }
1023 
1025 {
1026  BeginUndo();
1027  DoChange( true );
1028  EndUndo();
1029 }
1030 
1032 {
1033  BeginRedo();
1034  DoChange( false );
1035  EndRedo();
1036 }
1037 
1039 {
1040  // makes no sense
1041 }
1042 
1044 {
1045  return false;
1046 }
1047 
1048 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uLong mnEndChangeAction
Definition: undocell.hxx:156
If set, cloned formula cells will start to listen to the document.
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
Definition: viewfun2.cxx:940
#define SC_PF_TESTMERGE
Definition: docsh.hxx:75
void ClearDetectiveOperations()
Definition: documen4.cxx:899
std::unique_ptr< SdrUndoAction > mpDrawUndo
Definition: undocell.hxx:274
void DoInsertNote(const ScNoteData &rNoteData)
Definition: undocell.cxx:802
ScCaptionInitDataRef mxInitData
Author of the note.
Definition: postit.hxx:149
CellType meType
Definition: cellvalue.hxx:37
OUString getString() const
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
ScUndoDetective(ScDocShell *pNewDocShell, std::unique_ptr< SdrUndoAction > pDraw, const ScDetOpData *pOperation, std::unique_ptr< ScDetOpList > pUndoList=nullptr)
Definition: undocell.cxx:872
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
Definition: viewfun2.cxx:113
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: docsh3.cxx:450
Store parameters used in the ScDocument::SetString() method.
Definition: stringutil.hxx:34
std::unique_ptr< SdrUndoAction > pDrawUndo
Definition: undocell.hxx:316
void DoRemoveNote(const ScNoteData &rNoteData)
Definition: undocell.cxx:814
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:862
SCROW Row() const
Definition: address.hxx:261
ScCellValue maOldCell
Definition: undocell.hxx:127
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
Definition: docsh5.cxx:404
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is...
Definition: stringutil.cxx:37
ScUndoShowHideNote(ScDocShell &rDocShell, const ScAddress &rPos, bool bShow)
Definition: undocell.cxx:831
virtual void Redo() override
Definition: undocell.cxx:546
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:153
virtual OUString GetComment() const override
Definition: undocell.cxx:992
sal_uLong nEndChangeAction
Definition: undocell.hxx:129
virtual OUString GetComment() const override
Definition: undocell.cxx:174
virtual void Redo() override
Definition: undocell.cxx:947
virtual void Undo() override
Definition: undocell.cxx:1024
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: docsh3.cxx:187
ScFormulaCell * Clone() const
virtual void Undo() override
Definition: undocell.cxx:612
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(175)
ScDetOpList * GetDetOpList() const
Definition: document.hxx:1775
sal_uIntPtr sal_uLong
SC_DLLPUBLIC void CompileHybridFormula()
Call this immediately after updating named ranges.
Definition: document10.cxx:315
std::unique_ptr< EditTextObject > pNewEditData
Definition: undocell.hxx:65
ScUndoEnterValue(ScDocShell *pNewDocShell, const ScAddress &rNewPos, const ScCellValue &rUndoCell, double nVal)
Definition: undocell.cxx:307
ScAddress maPos
Definition: undocell.hxx:271
sal_uInt16 nOldScale
Definition: undocell.hxx:200
virtual void Undo() override
Definition: undocell.cxx:391
std::unique_ptr< EditTextObject > mpNewEditData
Definition: undocell.hxx:101
const SfxItemSet & GetItemSet() const
virtual ~ScUndoThesaurus() override
Definition: undocell.cxx:654
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:378
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:553
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
ScUndoEnterData(ScDocShell *pNewDocShell, const ScAddress &rPos, ValuesType &rOldValues, const OUString &rNewStr, std::unique_ptr< EditTextObject > pObj)
Definition: undocell.cxx:160
double mfValue
Definition: cellvalue.hxx:39
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:302
virtual ~ScUndoPrintZoom() override
Definition: undocell.cxx:582
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3489
virtual SfxItemSet & GetItemSet()
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:566
void EndUndo()
Definition: undobase.cxx:122
void Remove(const SfxPoolItem &)
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
Definition: document.cxx:4788
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:711
sal_uLong GetActionMax() const
Definition: chgtrack.hxx:960
ScUndoSetCell(ScDocShell *pDocSh, const ScAddress &rPos, const ScCellValue &rOldVal, const ScCellValue &rNewVal)
Definition: undocell.cxx:383
std::unique_ptr< ScRangeName > pNewRanges
Definition: undocell.hxx:336
sal_uInt16 nNewPages
Definition: undocell.hxx:203
virtual void Undo() override
Definition: undocell.cxx:910
virtual OUString GetComment() const override
Definition: undocell.cxx:507
virtual void Undo() override
Definition: undocell.cxx:539
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:560
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:1043
virtual OUString GetComment() const override
Definition: undocell.cxx:867
ValuesType maOldValues
Definition: undocell.hxx:98
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1190
SfxApplication * SfxGetpApp()
TextFormatPolicy meSetTextNumFormat
Determine when to set the 'Text' number format to the cell where the input string is being set...
Definition: stringutil.hxx:83
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6087
size_t Count() const
Definition: detdata.hxx:82
virtual void Redo() override
Definition: undocell.cxx:619
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:35
ScPatternAttr * pNewPattern
Definition: undocell.hxx:62
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Notes.
Definition: document.cxx:6534
sal_uInt16 nAction
Definition: undocell.hxx:314
virtual ~ScUndoSetCell() override
Definition: undocell.cxx:389
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:626
ScFormulaCell * mpFormula
Definition: cellvalue.hxx:42
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
ScAddress aPos
Definition: undocell.hxx:315
Additional class containing cell annotation data.
Definition: postit.hxx:159
static void LOKCommentNotify(LOKCommentNotificationType nType, const ScDocument *pDocument, const ScAddress &rPos, const ScPostIt *pNote)
Definition: docsh4.cxx:2491
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:967
int nCount
sal_uInt16 nNewScale
Definition: undocell.hxx:202
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:1038
void DoChange(bool bUndo, const ScCellValue &rText)
Definition: undocell.cxx:675
const ScAddress & GetPos() const
Definition: detdata.hxx:48
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1142
ScUndoRangeNames(ScDocShell *pNewDocShell, std::unique_ptr< ScRangeName > pOld, std::unique_ptr< ScRangeName > pNew, SCTAB nTab)
Definition: undocell.cxx:977
void RedoSdrUndoAction(SdrUndoAction *pUndoAction)
Definition: undoolk.cxx:61
SCTAB Tab() const
Definition: address.hxx:270
void release(ScDocument &rDoc, const ScAddress &rPos)
Set cell value at specified position in specified document.
Definition: cellvalue.cxx:432
void RecalcPPT()
Definition: tabview3.cxx:2774
void setNotOwner()
Flag that this instance is in Undo, so drawing layer owns it.
Definition: postit.cxx:548
ScUndoThesaurus(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, const ScCellValue &rOldText, const ScCellValue &rNewText)
Definition: undocell.cxx:641
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:791
ScNoteData maOldData
Definition: undocell.hxx:272
virtual ~ScUndoRangeNames() override
Definition: undocell.cxx:986
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4766
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:636
ScViewData & GetViewData()
Definition: tabview.hxx:333
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2403
SC_DLLPUBLIC void DeletePageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
Definition: viewfun2.cxx:957
SC_DLLPUBLIC void Undo(sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge=false)
Definition: chgtrack.cxx:3057
virtual ~ScUndoEnterValue() override
Definition: undocell.cxx:318
virtual ~ScUndoPageBreak() override
Definition: undocell.cxx:503
SC_DLLPUBLIC bool SetEditText(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
This method manages the lifecycle of the passed edit text object.
Definition: document.cxx:3425
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3394
virtual void Redo() override
Definition: undocell.cxx:1031
virtual OUString GetComment() const override
Definition: undocell.cxx:426
void SetTab(SCTAB nTabP)
Definition: address.hxx:282
void BeginRedo()
Definition: undobase.cxx:142
bool UpdatePages()
Definition: printfun.cxx:2401
void DoChange(const ScPatternAttr *pWhichPattern, const std::unique_ptr< EditTextObject > &pEditData) const
Definition: undocell.cxx:103
SC_DLLPUBLIC void SetPattern(const ScAddress &, const ScPatternAttr &rAttr)
Definition: document.cxx:5075
void SetChangeTrack()
Definition: undocell.cxx:327
void InvalidatePageBreaks(SCTAB nTab)
Definition: document.cxx:6241
virtual void Undo() override
Definition: undocell.cxx:133
virtual OUString GetComment() const override
Definition: undocell.cxx:656
ScNoteData maNewData
Definition: undocell.hxx:273
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
ScPatternAttr * pApplyPattern
Definition: undocell.hxx:63
int i
void SetValue(const ScCellValue &rVal)
Definition: undocell.cxx:448
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:972
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
Definition: docsh.hxx:478
sal_Int16 SCCOL
Definition: types.hxx:21
void DoChange(bool bUndo)
Definition: undocell.cxx:591
virtual OUString GetComment() const override
Definition: undocell.cxx:586
std::vector< std::unique_ptr< ScDetOpData > > ScDetOpDataVector
Definition: detdata.hxx:60
ScDocShell * pDocShell
Definition: undobase.hxx:47
svl::SharedString * mpString
Definition: cellvalue.hxx:40
virtual ~ScUndoCursorAttr() override
Definition: undocell.cxx:83
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1798
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:293
ScUndoReplaceNote(ScDocShell &rDocShell, const ScAddress &rPos, const ScNoteData &rNoteData, bool bInsert, std::unique_ptr< SdrUndoAction > pDrawUndo)
Constructs an undo action for inserting or removing a cell note.
Definition: undocell.cxx:723
void SetPrintZoom(SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages)
Definition: docsh4.cxx:1618
ScDetOpDataVector & GetDataVector()
Definition: detdata.hxx:78
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
void DoSdrUndoAction(SdrUndoAction *pUndoAction, ScDocument *pDoc)
Definition: undoolk.cxx:35
void SetNote(const ScAddress &rPos, std::unique_ptr< ScPostIt > pNote)
Definition: document.cxx:6549
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
Keep an existing number format, do not set Text number format and do not set another number format...
Definition: stringutil.hxx:57
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6212
virtual void Undo() override
Definition: undocell.cxx:228
std::unique_ptr< ScDetOpList > pOldList
Definition: undocell.hxx:313
virtual ~ScUndoShowHideNote() override
Definition: undocell.cxx:838
void DoChange() const
Definition: undocell.cxx:179
std::unique_ptr< ScRangeName > pOldRanges
Definition: undocell.hxx:335
virtual void Undo() override
Definition: undocell.cxx:761
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:502
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:100
std::vector< Value > ValuesType
Definition: undocell.hxx:84
void PostDataChanged()
Definition: docsh3.cxx:92
SfxViewShell * GetViewShell() const
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:373
sal_uLong nEndChangeAction
Definition: undocell.hxx:227
SCCOL Col() const
Definition: address.hxx:266
ScUndoPrintZoom(ScDocShell *pNewDocShell, SCTAB nT, sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP)
Definition: undocell.cxx:571
sal_uLong mnEndChangeAction
Definition: undocell.hxx:102
virtual void Undo() override
Definition: undocell.cxx:694
virtual OUString GetComment() const override
Definition: undocell.cxx:796
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:147
ScModelObj * getMustPropagateChangesModel(const ScDocShell &rDocShell)
Definition: docsh.hxx:470
void SetDetOpList(std::unique_ptr< ScDetOpList > pNew)
Definition: documen4.cxx:904
void MoveCursorToCell()
Definition: undocell.cxx:481
ScPatternAttr * pOldPattern
Definition: undocell.hxx:61
void DoChange(bool bInsert) const
Definition: undocell.cxx:521
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:17
#define SC_PF_LINES
Definition: docsh.hxx:74
virtual void Redo() override
Definition: undocell.cxx:140
virtual void Redo() override
Definition: undocell.cxx:406
ScCaptionPtr mxCaption
Initial data for invisible notes without SdrObject.
Definition: postit.hxx:150
SC_DLLPUBLIC ScFormulaCell * SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell)
Set formula cell, and transfer its ownership to the document.
Definition: documen2.cxx:1083
ScDetOpType GetOperation() const
Definition: detdata.hxx:49
OUString maNewString
Definition: undocell.hxx:100
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:416
virtual OUString GetComment() const override
Definition: undocell.cxx:322
ScDetOpType
Definition: detdata.hxx:27
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1038
void SetEditData(std::unique_ptr< EditTextObject > pOld, std::unique_ptr< EditTextObject > pNew)
once the objects are passed to this class, their life-cycle is managed by this class; the calling fun...
Definition: undocell.cxx:97
virtual OUString GetComment() const override
Definition: undocell.cxx:91
Internal data for a cell annotation.
Definition: postit.hxx:143
void DoChange(bool bUndo)
Definition: undocell.cxx:997
ScCellValue maNewValue
Definition: undocell.hxx:155
ScCellValue maOldText
Definition: undocell.hxx:229
virtual void Undo() override
Definition: undocell.cxx:342
ScAddress aPos
Definition: undocell.hxx:126
ScUndoCursorAttr(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, const ScPatternAttr *pOldPat, const ScPatternAttr *pNewPat, const ScPatternAttr *pApplyPat)
Definition: undocell.cxx:66
void assign(const ScDocument &rDoc, const ScAddress &rPos)
Take cell value from specified position in specified document.
Definition: cellvalue.cxx:330
sal_uInt16 nOldPages
Definition: undocell.hxx:201
virtual void Redo() override
Definition: undocell.cxx:360
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
ScUndoPageBreak(ScDocShell *pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, bool bNewColumn, bool bNewInsert)
Definition: undocell.cxx:491
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
void * p
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
ScCellValue maNewText
Definition: undocell.hxx:230
EditTextObject * mpEditText
Definition: cellvalue.hxx:41
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6092
ScAddress maPos
Definition: undocell.hxx:153
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
Definition: docsh.hxx:486
void SetEmptyCell(const ScAddress &rPos)
Definition: document.cxx:3481
void SetRangeName(SCTAB nTab, std::unique_ptr< ScRangeName > pNew)
Definition: documen3.cxx:183
virtual void Redo() override
Definition: undocell.cxx:704
#define SC_PF_WHOLEROWS
Definition: docsh.hxx:76
void SetChangeTrack()
Definition: undocell.cxx:431
virtual ~ScUndoDetective() override
Definition: undocell.cxx:888
virtual void Redo() override
Definition: undocell.cxx:774
ScAddress maPos
Definition: undocell.hxx:103
virtual void Undo() override
Definition: undocell.cxx:842
std::unique_ptr< EditTextObject > pOldEditData
Definition: undocell.hxx:64
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:421
ScCellValue maOldValue
Definition: undocell.hxx:154
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(174)
virtual OUString GetComment() const override
Definition: undocell.cxx:894
void SetChangeTrack(const ScCellValue &rOldCell)
Definition: undocell.cxx:661
std::unique_ptr< EditTextObject > Clone() const
virtual ~ScUndoReplaceNote() override
Definition: undocell.cxx:756
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
Definition: undocell.cxx:717
SC_DLLPUBLIC std::unique_ptr< ScPostIt > ReleaseNote(const ScAddress &rPos)
Definition: document.cxx:6630
void commit(ScDocument &rDoc, const ScAddress &rPos) const
Set cell value at specified position in specified document.
Definition: cellvalue.cxx:402
void EndRedo()
Definition: undobase.cxx:151
SC_DLLPUBLIC void GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab, CellType &rCellType) const
Definition: document.cxx:3778
void SetChangeTrack()
Definition: undocell.cxx:206
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:787
SC_DLLPUBLIC void PreprocessRangeNameUpdate()
Definition: document10.cxx:291
sal_Int16 SCTAB
Definition: types.hxx:22
void BeginUndo()
Definition: undobase.cxx:87
void AppendContent(const ScAddress &rPos, const ScDocument *pRefDoc)
Definition: chgtrack.cxx:2598
virtual void Redo() override
Definition: undocell.cxx:850
sal_Int16 nValue
virtual void Redo() override
Definition: undocell.cxx:264
virtual void Repeat(SfxRepeatTarget &rTarget) override
Definition: undocell.cxx:858