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