LibreOffice Module sw (master)  1
rolbck.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 <rolbck.hxx>
21 #include <svl/itemiter.hxx>
23 #include <hints.hxx>
24 #include <hintids.hxx>
25 #include <fmtftn.hxx>
26 #include <fchrfmt.hxx>
27 #include <fmtflcnt.hxx>
28 #include <fmtrfmrk.hxx>
29 #include <fmtfld.hxx>
30 #include <fmtpdsc.hxx>
31 #include <txtfld.hxx>
32 #include <txtrfmrk.hxx>
33 #include <txttxmrk.hxx>
34 #include <txtftn.hxx>
35 #include <txtflcnt.hxx>
36 #include <fmtanchr.hxx>
37 #include <fmtcnct.hxx>
38 #include <frmfmt.hxx>
39 #include <ftnidx.hxx>
40 #include <doc.hxx>
41 #include <IDocumentUndoRedo.hxx>
44 #include <docary.hxx>
45 #include <ndtxt.hxx>
46 #include <paratr.hxx>
47 #include <cellatr.hxx>
48 #include <fldbas.hxx>
49 #include <pam.hxx>
50 #include <swtable.hxx>
51 #include <ndgrf.hxx>
52 #include <UndoCore.hxx>
53 #include <IMark.hxx>
54 #include <charfmt.hxx>
55 #include <strings.hrc>
56 #include <bookmrk.hxx>
57 #include <memory>
58 
60 {
61  return OUString();
62 }
63 
66  , m_pAttr( pFormatHt->Clone() )
67  , m_nNodeIndex( nNd )
68 {
69  switch ( m_pAttr->Which() )
70  {
71  case RES_PAGEDESC:
72  static_cast<SwFormatPageDesc&>(*m_pAttr).ChgDefinedIn( nullptr );
73  break;
74  case RES_PARATR_DROP:
75  static_cast<SwFormatDrop&>(*m_pAttr).ChgDefinedIn( nullptr );
76  break;
77  case RES_BOXATR_FORMULA:
78  {
79  // save formulas always in plain text
80  SwTableBoxFormula& rNew = static_cast<SwTableBoxFormula&>(*m_pAttr);
81  if ( rNew.IsIntrnlName() )
82  {
83  const SwTableBoxFormula& rOld =
84  *static_cast<const SwTableBoxFormula*>(pFormatHt);
85  const SwNode* pNd = rOld.GetNodeOfFormula();
86  if ( pNd )
87  {
88  const SwTableNode* pTableNode = pNd->FindTableNode();
89  if (pTableNode)
90  {
91  SwTableFormulaUpdate aMsgHint( &pTableNode->GetTable() );
92  aMsgHint.m_eFlags = TBL_BOXNAME;
93  rNew.ChgDefinedIn( rOld.GetDefinedIn() );
94  rNew.ChangeState( &aMsgHint );
95  }
96  }
97  }
98  rNew.ChgDefinedIn( nullptr );
99  }
100  break;
101  }
102 }
103 
105 {
106  OUString aResult;
107 
108  switch (m_pAttr->Which())
109  {
110  case RES_BREAK:
111  switch (static_cast<SvxFormatBreakItem &>(*m_pAttr).GetBreak())
112  {
113  case SvxBreak::PageBefore:
114  case SvxBreak::PageAfter:
115  case SvxBreak::PageBoth:
116  aResult = SwResId(STR_UNDO_PAGEBREAKS);
117 
118  break;
119  case SvxBreak::ColumnBefore:
120  case SvxBreak::ColumnAfter:
121  case SvxBreak::ColumnBoth:
122  aResult = SwResId(STR_UNDO_COLBRKS);
123 
124  break;
125  default:
126  break;
127  }
128  break;
129  default:
130  break;
131  }
132 
133  return aResult;
134 }
135 
136 void SwHistorySetFormat::SetInDoc( SwDoc* pDoc, bool bTmpSet )
137 {
138  SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ];
139  if ( pNode->IsContentNode() )
140  {
141  static_cast<SwContentNode*>(pNode)->SetAttr( *m_pAttr );
142  }
143  else if ( pNode->IsTableNode() )
144  {
145  static_cast<SwTableNode*>(pNode)->GetTable().GetFrameFormat()->SetFormatAttr(
146  *m_pAttr );
147  }
148  else if ( pNode->IsStartNode() && (SwTableBoxStartNode ==
149  static_cast<SwStartNode*>(pNode)->GetStartNodeType()) )
150  {
151  SwTableNode* pTNd = pNode->FindTableNode();
152  if ( pTNd )
153  {
154  SwTableBox* pBox = pTNd->GetTable().GetTableBox( m_nNodeIndex );
155  if (pBox)
156  {
158  }
159  }
160  }
161 
162  if ( !bTmpSet )
163  {
164  m_pAttr.reset();
165  }
166 }
167 
169 {
170 }
171 
174  , m_nNodeIndex( nNodeIdx )
175  , m_nWhich( pFormatHt->Which() )
176 {
177 }
178 
180 {
181  SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ];
182  if ( pNode->IsContentNode() )
183  {
184  static_cast<SwContentNode*>(pNode)->ResetAttr( m_nWhich );
185  }
186  else if ( pNode->IsTableNode() )
187  {
188  static_cast<SwTableNode*>(pNode)->GetTable().GetFrameFormat()->
189  ResetFormatAttr( m_nWhich );
190  }
191 }
192 
195  , m_nNodeIndex( nNodePos )
196  , m_nStart( pTextHt->GetStart() )
197  , m_nEnd( pTextHt->GetAnyEnd() )
198  , m_bFormatIgnoreStart(pTextHt->IsFormatIgnoreStart())
199  , m_bFormatIgnoreEnd (pTextHt->IsFormatIgnoreEnd ())
200 {
201  // Caution: the following attributes generate no format attributes:
202  // - NoLineBreak, NoHyphen, Inserted, Deleted
203  // These cases must be handled separately !!!
204 
205  // a little bit complicated but works: first assign a copy of the
206  // default value and afterwards the values from text attribute
207  if ( RES_TXTATR_CHARFMT == pTextHt->Which() )
208  {
209  m_pAttr.reset( new SwFormatCharFormat( pTextHt->GetCharFormat().GetCharFormat() ) );
210  }
211  else
212  {
213  m_pAttr.reset( pTextHt->GetAttr().Clone() );
214  }
215 }
216 
218 {
219 }
220 
222 {
223  if (!m_pAttr)
224  return;
225 
226  if ( RES_TXTATR_CHARFMT == m_pAttr->Which() )
227  {
228  // ask the Doc if the CharFormat still exists
229  if (!pDoc->GetCharFormats()->IsAlive(static_cast<SwFormatCharFormat&>(*m_pAttr).GetCharFormat()))
230  return; // do not set, format does not exist
231  }
232 
233  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
234  OSL_ENSURE( pTextNd, "SwHistorySetText::SetInDoc: not a TextNode" );
235 
236  if ( pTextNd )
237  {
238  SwTextAttr *const pAttr = pTextNd->InsertItem(*m_pAttr, m_nStart, m_nEnd,
241  // shouldn't be possible to hit any error/merging path from here
242  assert(pAttr);
244  {
245  pAttr->SetFormatIgnoreStart(true);
246  }
247  if (m_bFormatIgnoreEnd)
248  {
249  pAttr->SetFormatIgnoreEnd(true);
250  }
251  }
252 }
253 
256  , m_pField( new SwFormatField( *pTextField->GetFormatField().GetField() ) )
257 {
258  // only copy if not Sys-FieldType
259  SwDoc* pDoc = pTextField->GetTextNode().GetDoc();
260 
261  m_nFieldWhich = m_pField->GetField()->GetTyp()->Which();
267  {
268  m_pFieldType = m_pField->GetField()->GetTyp()->Copy();
269  m_pField->GetField()->ChgTyp( m_pFieldType.get() ); // change field type
270  }
271  m_nNodeIndex = nNodePos;
272  m_nPos = pTextField->GetStart();
273 }
274 
276 {
277  return m_pField->GetField()->GetDescription();
278 }
279 
281 {
282 }
283 
285 {
286  if (!m_pField)
287  return;
288 
289  SwFieldType* pNewFieldType = m_pFieldType.get();
290  if ( !pNewFieldType )
291  {
292  pNewFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType( m_nFieldWhich );
293  }
294  else
295  {
296  // register type with the document
297  pNewFieldType = pDoc->getIDocumentFieldsAccess().InsertFieldType( *m_pFieldType );
298  }
299 
300  m_pField->GetField()->ChgTyp( pNewFieldType ); // change field type
301 
302  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
303  OSL_ENSURE( pTextNd, "SwHistorySetTextField: no TextNode" );
304 
305  if ( pTextNd )
306  {
307  pTextNd->InsertItem( *m_pField, m_nPos, m_nPos,
309  }
310 }
311 
314  , m_RefName( pTextHt->GetRefMark().GetRefName() )
315  , m_nNodeIndex( nNodePos )
316  , m_nStart( pTextHt->GetStart() )
317  , m_nEnd( pTextHt->GetAnyEnd() )
318 {
319 }
320 
322 {
323  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
324  OSL_ENSURE( pTextNd, "SwHistorySetRefMark: no TextNode" );
325  if ( !pTextNd )
326  return;
327 
328  SwFormatRefMark aRefMark( m_RefName );
329 
330  // if a reference mark without an end already exists here: must not insert!
331  if ( m_nStart != m_nEnd ||
333  {
334  pTextNd->InsertItem( aRefMark, m_nStart, m_nEnd,
336  }
337 }
338 
341  , m_TOXMark( pTextHt->GetTOXMark() )
342  , m_TOXName( m_TOXMark.GetTOXType()->GetTypeName() )
343  , m_eTOXTypes( m_TOXMark.GetTOXType()->GetType() )
344  , m_nNodeIndex( nNodePos )
345  , m_nStart( pTextHt->GetStart() )
346  , m_nEnd( pTextHt->GetAnyEnd() )
347 {
349 }
350 
352 {
353  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
354  OSL_ENSURE( pTextNd, "SwHistorySetTOXMark: no TextNode" );
355  if ( !pTextNd )
356  return;
357 
358  // search for respective TOX type
359  const sal_uInt16 nCnt = pDoc->GetTOXTypeCount( m_eTOXTypes );
360  SwTOXType* pToxType = nullptr;
361  for ( sal_uInt16 n = 0; n < nCnt; ++n )
362  {
363  pToxType = const_cast<SwTOXType*>(pDoc->GetTOXType( m_eTOXTypes, n ));
364  if ( pToxType->GetTypeName() == m_TOXName )
365  break;
366  pToxType = nullptr;
367  }
368 
369  if ( !pToxType ) // TOX type not found, create new
370  {
371  pToxType = const_cast<SwTOXType*>(
373  }
374 
375  SwTOXMark aNew( m_TOXMark );
376  aNew.RegisterToTOXType( *pToxType );
377 
378  pTextNd->InsertItem( aNew, m_nStart, m_nEnd,
380 }
381 
382 bool SwHistorySetTOXMark::IsEqual( const SwTOXMark& rCmp ) const
383 {
384  return m_TOXName == rCmp.GetTOXType()->GetTypeName() &&
385  m_eTOXTypes == rCmp.GetTOXType()->GetType() &&
387  ( (TOX_INDEX == m_eTOXTypes)
388  ? ( m_TOXMark.GetPrimaryKey() == rCmp.GetPrimaryKey() &&
390  : m_TOXMark.GetLevel() == rCmp.GetLevel()
391  );
392 }
393 
395  sal_Int32 nAttrStart, sal_Int32 nAttrEnd, sal_uLong nNodePos )
397  , m_nNodeIndex( nNodePos ), m_nStart( nAttrStart ), m_nEnd( nAttrEnd )
398  , m_nAttr( nWhich )
399 {
400 }
401 
403 {
404  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
405  OSL_ENSURE( pTextNd, "SwHistoryResetText: no TextNode" );
406  if ( pTextNd )
407  {
408  pTextNd->DeleteAttributes( m_nAttr, m_nStart, m_nEnd );
409  }
410 }
411 
414  , m_pUndo( new SwUndoSaveSection )
415  , m_FootnoteNumber( pTextFootnote->GetFootnote().GetNumStr() )
416  , m_nNodeIndex( nNodePos )
417  , m_nStart( pTextFootnote->GetStart() )
418  , m_bEndNote( pTextFootnote->GetFootnote().IsEndNote() )
419 {
420  OSL_ENSURE( pTextFootnote->GetStartNode(),
421  "SwHistorySetFootnote: Footnote without Section" );
422 
423  // keep the old NodePos (because who knows what later will be saved/deleted
424  // in SaveSection)
425  SwDoc* pDoc = const_cast<SwDoc*>(pTextFootnote->GetTextNode().GetDoc());
426  SwNode* pSaveNd = pDoc->GetNodes()[ m_nNodeIndex ];
427 
428  // keep pointer to StartNode of FootnoteSection and reset its attribute for now
429  // (as a result, its/all Frames will be deleted automatically)
430  SwNodeIndex aSttIdx( *pTextFootnote->GetStartNode() );
431  pTextFootnote->SetStartNode( nullptr, false );
432 
433  m_pUndo->SaveSection( aSttIdx );
434  m_nNodeIndex = pSaveNd->GetIndex();
435 }
436 
439  , m_FootnoteNumber( rTextFootnote.GetFootnote().GetNumStr() )
440  , m_nNodeIndex( SwTextFootnote_GetIndex( (&rTextFootnote) ) )
441  , m_nStart( rTextFootnote.GetStart() )
442  , m_bEndNote( rTextFootnote.GetFootnote().IsEndNote() )
443 {
444  OSL_ENSURE( rTextFootnote.GetStartNode(),
445  "SwHistorySetFootnote: Footnote without Section" );
446 }
447 
449 {
450  return SwResId(STR_FOOTNOTE);
451 }
452 
454 {
455 }
456 
458 {
459  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
460  OSL_ENSURE( pTextNd, "SwHistorySetFootnote: no TextNode" );
461  if ( !pTextNd )
462  return;
463 
464  if (m_pUndo)
465  {
466  // set the footnote in the TextNode
467  SwFormatFootnote aTemp( m_bEndNote );
468  SwFormatFootnote& rNew = const_cast<SwFormatFootnote&>(
469  pDoc->GetAttrPool().Put(aTemp) );
470  if ( !m_FootnoteNumber.isEmpty() )
471  {
472  rNew.SetNumStr( m_FootnoteNumber );
473  }
474  SwTextFootnote* pTextFootnote = new SwTextFootnote( rNew, m_nStart );
475 
476  // create the section of the Footnote
477  SwNodeIndex aIdx( *pTextNd );
478  m_pUndo->RestoreSection( pDoc, &aIdx, SwFootnoteStartNode );
479  pTextFootnote->SetStartNode( &aIdx );
480  if ( m_pUndo->GetHistory() )
481  {
482  // create frames only now
483  m_pUndo->GetHistory()->Rollback( pDoc );
484  }
485 
486  pTextNd->InsertHint( pTextFootnote );
487  }
488  else
489  {
490  SwTextFootnote * const pFootnote =
491  static_cast<SwTextFootnote*>(
492  pTextNd->GetTextAttrForCharAt( m_nStart ));
493  assert(pFootnote);
494  SwFormatFootnote &rFootnote = const_cast<SwFormatFootnote&>(pFootnote->GetFootnote());
495  rFootnote.SetNumStr( m_FootnoteNumber );
496  if ( rFootnote.IsEndNote() != m_bEndNote )
497  {
498  rFootnote.SetEndNote( m_bEndNote );
499  pFootnote->CheckCondColl();
500  }
501  }
502 }
503 
505  SwNodeType nNodeWhich )
507  , m_pColl( pFormatColl )
508  , m_nNodeIndex( nNd )
509  , m_nNodeType( nNodeWhich )
510 {
511 }
512 
514 {
515  SwContentNode * pContentNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetContentNode();
516  OSL_ENSURE( pContentNd, "SwHistoryChangeFormatColl: no ContentNode" );
517 
518  // before setting the format, check if it is still available in the
519  // document. if it has been deleted, there is no undo!
520  if ( pContentNd && m_nNodeType == pContentNd->GetNodeType() )
521  {
522  if ( SwNodeType::Text == m_nNodeType )
523  {
524  if (pDoc->GetTextFormatColls()->IsAlive(static_cast<SwTextFormatColl *>(m_pColl)))
525  {
526  pContentNd->ChgFormatColl( m_pColl );
527  }
528  }
529  else if (pDoc->GetGrfFormatColls()->IsAlive(static_cast<SwGrfFormatColl *>(m_pColl)))
530  {
531  pContentNd->ChgFormatColl( m_pColl );
532  }
533  }
534 }
535 
538  , m_pUndo( new SwUndoDelLayFormat( pFlyFormat ) )
539 {
540  OSL_ENSURE( pFlyFormat, "SwHistoryTextFlyCnt: no Format" );
541  m_pUndo->ChgShowSel( false );
542 }
543 
545 {
546 }
547 
549 {
551  assert(pISCS);
552  ::sw::UndoRedoContext context(*pDoc, *pISCS);
553  m_pUndo->UndoImpl(context);
554 }
555 
557  const ::sw::mark::IMark& rBkmk,
558  bool bSavePos,
559  bool bSaveOtherPos)
561  , m_aName(rBkmk.GetName())
562  , m_aShortName()
563  , m_aKeycode()
564  , m_nNode(bSavePos ?
565  rBkmk.GetMarkPos().nNode.GetIndex() : 0)
566  , m_nOtherNode(bSaveOtherPos ?
567  rBkmk.GetOtherMarkPos().nNode.GetIndex() : 0)
568  , m_nContent(bSavePos ?
569  rBkmk.GetMarkPos().nContent.GetIndex() : 0)
570  , m_nOtherContent(bSaveOtherPos ?
571  rBkmk.GetOtherMarkPos().nContent.GetIndex() :0)
572  , m_bSavePos(bSavePos)
573  , m_bSaveOtherPos(bSaveOtherPos)
574  , m_bHadOtherPos(rBkmk.IsExpanded())
575  , m_eBkmkType(IDocumentMarkAccess::GetType(rBkmk))
576 {
577  const ::sw::mark::IBookmark* const pBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(&rBkmk);
578  if(pBookmark)
579  {
580  m_aKeycode = pBookmark->GetKeyCode();
581  m_aShortName = pBookmark->GetShortName();
582 
583  ::sfx2::Metadatable const*const pMetadatable(
584  dynamic_cast< ::sfx2::Metadatable const* >(pBookmark));
585  if (pMetadatable)
586  {
587  m_pMetadataUndo = pMetadatable->CreateUndo();
588  }
589  }
590 }
591 
593 {
594  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
595 
596  SwNodes& rNds = pDoc->GetNodes();
597  IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
598  std::unique_ptr<SwPaM> pPam;
599  ::sw::mark::IMark* pMark = nullptr;
600 
601  if(m_bSavePos)
602  {
603  SwContentNode* const pContentNd = rNds[m_nNode]->GetContentNode();
604  OSL_ENSURE(pContentNd,
605  "<SwHistoryBookmark::SetInDoc(..)>"
606  " - wrong node for a mark");
607 
608  // #111660# don't crash when nNode1 doesn't point to content node.
609  if(pContentNd)
610  pPam.reset(new SwPaM(*pContentNd, m_nContent));
611  }
612  else
613  {
614  pMark = *pMarkAccess->findMark(m_aName);
615  pPam.reset(new SwPaM(pMark->GetMarkPos()));
616  }
617 
618  if(m_bSaveOtherPos)
619  {
620  SwContentNode* const pContentNd = rNds[m_nOtherNode]->GetContentNode();
621  OSL_ENSURE(pContentNd,
622  "<SwHistoryBookmark::SetInDoc(..)>"
623  " - wrong node for a mark");
624 
625  if (pPam != nullptr && pContentNd)
626  {
627  pPam->SetMark();
628  pPam->GetMark()->nNode = m_nOtherNode;
629  pPam->GetMark()->nContent.Assign(pContentNd, m_nOtherContent);
630  }
631  }
632  else if(m_bHadOtherPos)
633  {
634  if(!pMark)
635  pMark = *pMarkAccess->findMark(m_aName);
636  OSL_ENSURE(pMark->IsExpanded(),
637  "<SwHistoryBookmark::SetInDoc(..)>"
638  " - missing pos on old mark");
639  pPam->SetMark();
640  *pPam->GetMark() = pMark->GetOtherMarkPos();
641  }
642 
643  if (pPam)
644  {
645  if ( pMark != nullptr )
646  {
647  pMarkAccess->deleteMark( pMark );
648  }
649  ::sw::mark::IBookmark* const pBookmark =
650  dynamic_cast<::sw::mark::IBookmark*>(
651  pMarkAccess->makeMark(*pPam, m_aName, m_eBkmkType, sw::mark::InsertMode::New));
652  if ( pBookmark != nullptr )
653  {
654  pBookmark->SetKeyCode(m_aKeycode);
655  pBookmark->SetShortName(m_aShortName);
656  if (m_pMetadataUndo)
657  {
658  ::sfx2::Metadatable * const pMeta(
659  dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
660  OSL_ENSURE(pMeta, "metadata undo, but not metadatable?");
661  if (pMeta)
662  {
664  }
665  }
666  }
667  }
668 }
669 
670 bool SwHistoryBookmark::IsEqualBookmark(const ::sw::mark::IMark& rBkmk)
671 {
672  return m_nNode == rBkmk.GetMarkPos().nNode.GetIndex()
673  && m_nContent == rBkmk.GetMarkPos().nContent.GetIndex()
674  && m_aName == rBkmk.GetName();
675 }
676 
677 SwHistoryNoTextFieldmark::SwHistoryNoTextFieldmark(const ::sw::mark::IFieldmark& rFieldMark)
679  , m_sType(rFieldMark.GetFieldname())
680  , m_nNode(rFieldMark.GetMarkPos().nNode.GetIndex())
681  , m_nContent(rFieldMark.GetMarkPos().nContent.GetIndex())
682 {
683 }
684 
686 {
687  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
688 
689  SwNodes& rNds = pDoc->GetNodes();
690  std::unique_ptr<SwPaM> pPam;
691 
692  const SwContentNode* pContentNd = rNds[m_nNode]->GetContentNode();
693  if(pContentNd)
694  pPam.reset(new SwPaM(*pContentNd, m_nContent));
695 
696  if (pPam)
697  {
698  IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
699  pMarkAccess->makeNoTextFieldBookmark(*pPam, OUString(), m_sType);
700  }
701 }
702 
704 {
705  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
706 
707  SwNodes& rNds = pDoc->GetNodes();
708  std::unique_ptr<SwPaM> pPam;
709 
710  const SwContentNode* pContentNd = rNds[m_nNode]->GetContentNode();
711  if(pContentNd)
712  pPam.reset(new SwPaM(*pContentNd, m_nContent-1));
713 
714  if (pPam)
715  {
716  IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
717  pMarkAccess->deleteFieldmarkAt(*pPam->GetPoint());
718  }
719 }
720 
721 SwHistoryTextFieldmark::SwHistoryTextFieldmark(const ::sw::mark::IFieldmark& rFieldMark)
723  , m_sName(rFieldMark.GetName())
724  , m_sType(rFieldMark.GetFieldname())
725  , m_nStartNode(rFieldMark.GetMarkStart().nNode.GetIndex())
726  , m_nStartContent(rFieldMark.GetMarkStart().nContent.GetIndex())
727  , m_nEndNode(rFieldMark.GetMarkEnd().nNode.GetIndex())
728  , m_nEndContent(rFieldMark.GetMarkEnd().nContent.GetIndex())
729 {
730  SwPosition const sepPos(sw::mark::FindFieldSep(rFieldMark));
731  m_nSepNode = sepPos.nNode.GetIndex();
732  m_nSepContent = sepPos.nContent.GetIndex();
733 }
734 
736 {
737  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
738 
739  SwNodes& rNds = pDoc->GetNodes();
740 
741  assert(rNds[m_nStartNode]->IsContentNode());
742  assert(rNds[m_nEndNode]->IsContentNode());
743  assert(rNds[m_nSepNode]->IsContentNode());
744 
745  SwPaM const pam(*rNds[m_nStartNode]->GetContentNode(), m_nStartContent,
746  *rNds[m_nEndNode]->GetContentNode(),
748  ? (m_nEndContent - 2)
750  ? (m_nEndContent - 1)
751  : m_nEndContent);
752  SwPosition const sepPos(*rNds[m_nSepNode]->GetContentNode(),
754 
755  IDocumentMarkAccess & rMarksAccess(*pDoc->getIDocumentMarkAccess());
756  rMarksAccess.makeFieldBookmark(pam, m_sName, m_sType, &sepPos);
757 }
758 
760 {
761  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
762 
763  SwNodes& rNds = pDoc->GetNodes();
764 
765  assert(rNds[m_nStartNode]->IsContentNode());
766  assert(rNds[m_nEndNode]->IsContentNode());
767  assert(rNds[m_nSepNode]->IsContentNode());
768 
770 
771  IDocumentMarkAccess & rMarksAccess(*pDoc->getIDocumentMarkAccess());
772  rMarksAccess.deleteFieldmarkAt(pos);
773 }
774 
776  sal_uLong nNodePos, const std::set<sal_uInt16> &rSetArr )
778  , m_OldSet( rSet )
779  , m_ResetArray( 0, 4 )
780  , m_nNodeIndex( nNodePos )
781 {
782  SfxItemIter aIter( m_OldSet ), aOrigIter( rSet );
783  const SfxPoolItem* pItem = aIter.GetCurItem(),
784  * pOrigItem = aOrigIter.GetCurItem();
785  while (pItem && pOrigItem)
786  {
787  if( !rSetArr.count( pOrigItem->Which() ))
788  {
789  m_ResetArray.push_back( pOrigItem->Which() );
790  m_OldSet.ClearItem( pOrigItem->Which() );
791  }
792  else
793  {
794  switch ( pItem->Which() )
795  {
796  case RES_PAGEDESC:
797  static_cast<SwFormatPageDesc*>(
798  const_cast<SfxPoolItem*>(pItem))->ChgDefinedIn( nullptr );
799  break;
800 
801  case RES_PARATR_DROP:
802  static_cast<SwFormatDrop*>(
803  const_cast<SfxPoolItem*>(pItem))->ChgDefinedIn( nullptr );
804  break;
805 
806  case RES_BOXATR_FORMULA:
807  {
808  // When a formula is set, never save the value. It
809  // possibly must be recalculated!
810  // Save formulas always in plain text
812 
813  SwTableBoxFormula& rNew =
814  *static_cast<SwTableBoxFormula*>(
815  const_cast<SfxPoolItem*>(pItem));
816  if ( rNew.IsIntrnlName() )
817  {
818  const SwTableBoxFormula& rOld =
819  rSet.Get( RES_BOXATR_FORMULA );
820  const SwNode* pNd = rOld.GetNodeOfFormula();
821  if ( pNd )
822  {
823  const SwTableNode* pTableNode
824  = pNd->FindTableNode();
825  if (pTableNode)
826  {
827  SwTableFormulaUpdate aMsgHint(
828  &pTableNode->GetTable() );
829  aMsgHint.m_eFlags = TBL_BOXNAME;
830  rNew.ChgDefinedIn( rOld.GetDefinedIn() );
831  rNew.ChangeState( &aMsgHint );
832  }
833  }
834  }
835  rNew.ChgDefinedIn( nullptr );
836  }
837  break;
838  }
839  }
840 
841  pItem = aIter.NextItem();
842  pOrigItem = aOrigIter.NextItem();
843  }
844 }
845 
847 {
848  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
849 
850  SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ];
851  if ( pNode->IsContentNode() )
852  {
853  static_cast<SwContentNode*>(pNode)->SetAttr( m_OldSet );
854  if ( !m_ResetArray.empty() )
855  {
856  static_cast<SwContentNode*>(pNode)->ResetAttr( m_ResetArray );
857  }
858  }
859  else if ( pNode->IsTableNode() )
860  {
861  SwFormat& rFormat =
862  *static_cast<SwTableNode*>(pNode)->GetTable().GetFrameFormat();
863  rFormat.SetFormatAttr( m_OldSet );
864  if ( !m_ResetArray.empty() )
865  {
866  rFormat.ResetFormatAttr( m_ResetArray.front() );
867  }
868  }
869 }
870 
873  , m_rFormat( rFormat )
874  , m_nOldNodeIndex( rFormat.GetAnchor().GetContentAnchor()->nNode.GetIndex() )
875  , m_nOldContentIndex( (RndStdIds::FLY_AT_CHAR == rFormat.GetAnchor().GetAnchorId())
876  ? rFormat.GetAnchor().GetContentAnchor()->nContent.GetIndex()
877  : COMPLETE_STRING )
878 {
879 }
880 
882 {
883  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
884 
885  if (pDoc->GetSpzFrameFormats()->IsAlive(&m_rFormat)) // Format does still exist
886  {
888 
889  SwNode* pNd = pDoc->GetNodes()[ m_nOldNodeIndex ];
890  SwContentNode* pCNd = pNd->GetContentNode();
891  SwPosition aPos( *pNd );
893  {
894  OSL_ENSURE(pCNd, "SwHistoryChangeFlyAnchor: no ContentNode");
895  if (pCNd)
896  {
897  aPos.nContent.Assign( pCNd, m_nOldContentIndex );
898  }
899  }
900  aTmp.SetAnchor( &aPos );
901 
902  // so the Layout does not get confused
903  if (!pCNd || !pCNd->getLayoutFrame(pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr))
904  {
906  }
907 
908  m_rFormat.SetFormatAttr( aTmp );
909  }
910 }
911 
913  const SwFormatChain& rAttr )
915  , m_pPrevFormat( rAttr.GetPrev() )
916  , m_pNextFormat( rAttr.GetNext() )
917  , m_pFlyFormat( &rFormat )
918 {
919 }
920 
922 {
924  {
925  SwFormatChain aChain;
926 
927  if (m_pPrevFormat &&
929  {
930  aChain.SetPrev( m_pPrevFormat );
932  aTmp.SetNext( m_pFlyFormat );
933  m_pPrevFormat->SetFormatAttr( aTmp );
934  }
935 
936  if (m_pNextFormat &&
938  {
939  aChain.SetNext( m_pNextFormat );
941  aTmp.SetPrev( m_pFlyFormat );
942  m_pNextFormat->SetFormatAttr( aTmp );
943  }
944 
945  if ( aChain.GetNext() || aChain.GetPrev() )
946  {
947  m_pFlyFormat->SetFormatAttr( aChain );
948  }
949  }
950 }
951 
952 // -> #i27615#
954  const OUString & sFormat)
956  , m_OldSet(rSet), m_Format(sFormat)
957 {
958 }
959 
961 {
962  SwCharFormat * pCharFormat = pDoc->FindCharFormatByName(m_Format);
963 
964  if (pCharFormat)
965  {
966  pCharFormat->SetFormatAttr(m_OldSet);
967  }
968 }
969 // <- #i27615#
970 
972  : m_SwpHstry()
973  , m_nEndDiff( 0 )
974 {
975 }
976 
978 {
979 }
980 
982  const SfxPoolItem* pOldValue,
983  const SfxPoolItem* pNewValue,
984  sal_uLong nNodeIdx)
985 {
986  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
987  const sal_uInt16 nWhich(pNewValue->Which());
988 
989  // excluded values
990  if(nWhich == RES_TXTATR_FIELD || nWhich == RES_TXTATR_ANNOTATION)
991  {
992  return;
993  }
994 
995  // no default Attribute?
996  std::unique_ptr<SwHistoryHint> pHt;
997 
998  // To be able to include the DrawingLayer FillItems something more
999  // general has to be done to check if an Item is default than to check
1000  // if its pointer equals that in Writer's global PoolDefaults (held in
1001  // aAttrTab and used to fill the pool defaults in Writer - looks as if
1002  // Writer is *older* than the SfxItemPool ?). I checked the possibility to
1003  // get the SfxItemPool here (works), but decided to use the SfxPoolItem's
1004  // global tooling aka IsDefaultItem(const SfxPoolItem*) for now
1005  if(pOldValue && !IsDefaultItem(pOldValue))
1006  {
1007  pHt.reset( new SwHistorySetFormat( pOldValue, nNodeIdx ) );
1008  }
1009  else
1010  {
1011  pHt.reset( new SwHistoryResetFormat( pNewValue, nNodeIdx ) );
1012  }
1013 
1014  m_SwpHstry.push_back( std::move(pHt) );
1015 }
1016 
1017 // FIXME: refactor the following "Add" methods (DRY)?
1018 void SwHistory::Add( SwTextAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr )
1019 {
1020  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1021 
1022  std::unique_ptr<SwHistoryHint> pHt;
1023  if( !bNewAttr )
1024  {
1025  switch ( pHint->Which() )
1026  {
1027  case RES_TXTATR_FTN:
1028  pHt.reset( new SwHistorySetFootnote(
1029  static_cast<SwTextFootnote*>(pHint), nNodeIdx ) );
1030  break;
1031  case RES_TXTATR_FLYCNT:
1032  pHt.reset( new SwHistoryTextFlyCnt( static_cast<SwTextFlyCnt*>(pHint)
1033  ->GetFlyCnt().GetFrameFormat() ) );
1034  break;
1035  case RES_TXTATR_FIELD:
1036  case RES_TXTATR_ANNOTATION:
1037  pHt.reset( new SwHistorySetTextField(
1038  static_txtattr_cast<SwTextField*>(pHint), nNodeIdx) );
1039  break;
1040  case RES_TXTATR_TOXMARK:
1041  pHt.reset( new SwHistorySetTOXMark(
1042  static_txtattr_cast<SwTextTOXMark*>(pHint), nNodeIdx) );
1043  break;
1044  case RES_TXTATR_REFMARK:
1045  pHt.reset( new SwHistorySetRefMark(
1046  static_txtattr_cast<SwTextRefMark*>(pHint), nNodeIdx) );
1047  break;
1048  default:
1049  pHt.reset( new SwHistorySetText( pHint, nNodeIdx ) );
1050  }
1051  }
1052  else
1053  {
1054  pHt.reset( new SwHistoryResetText( pHint->Which(), pHint->GetStart(),
1055  pHint->GetAnyEnd(), nNodeIdx ) );
1056  }
1057  m_SwpHstry.push_back( std::move(pHt) );
1058 }
1059 
1060 void SwHistory::Add( SwFormatColl* pColl, sal_uLong nNodeIdx, SwNodeType nWhichNd )
1061 {
1062  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1063 
1064  std::unique_ptr<SwHistoryHint> pHt(
1065  new SwHistoryChangeFormatColl( pColl, nNodeIdx, nWhichNd ));
1066  m_SwpHstry.push_back( std::move(pHt) );
1067 }
1068 
1069 void SwHistory::Add(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOtherPos)
1070 {
1071  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1072 
1073  std::unique_ptr<SwHistoryHint> pHt;
1074 
1075  switch (IDocumentMarkAccess::GetType(rBkmk))
1076  {
1079  assert(bSavePos && bSaveOtherPos); // must be deleted completely!
1080  pHt.reset(new SwHistoryTextFieldmark(dynamic_cast<sw::mark::IFieldmark const&>(rBkmk)));
1081  break;
1084  assert(bSavePos && bSaveOtherPos); // must be deleted completely!
1085  pHt.reset(new SwHistoryNoTextFieldmark(dynamic_cast<sw::mark::IFieldmark const&>(rBkmk)));
1086  break;
1087  default:
1088  pHt.reset(new SwHistoryBookmark(rBkmk, bSavePos, bSaveOtherPos));
1089  break;
1090  }
1091 
1092  assert(pHt);
1093  m_SwpHstry.push_back( std::move(pHt) );
1094 }
1095 
1097 {
1098  std::unique_ptr<SwHistoryHint> pHt(new SwHistoryChangeFlyAnchor( rFormat ));
1099  m_SwpHstry.push_back( std::move(pHt) );
1100 }
1101 
1102 void SwHistory::Add( SwFlyFrameFormat& rFormat, sal_uInt16& rSetPos )
1103 {
1104  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1105 
1106  const sal_uInt16 nWh = rFormat.Which();
1107  if( RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh )
1108  {
1109  std::unique_ptr<SwHistoryHint> pHint(new SwHistoryTextFlyCnt( &rFormat ));
1110  m_SwpHstry.push_back( std::move(pHint) );
1111 
1112  const SwFormatChain* pChainItem;
1113  if( SfxItemState::SET == rFormat.GetItemState( RES_CHAIN, false,
1114  reinterpret_cast<const SfxPoolItem**>(&pChainItem) ))
1115  {
1116  if( pChainItem->GetNext() || pChainItem->GetPrev() )
1117  {
1118  std::unique_ptr<SwHistoryHint> pHt(
1119  new SwHistoryChangeFlyChain( rFormat, *pChainItem ));
1120  m_SwpHstry.insert( m_SwpHstry.begin() + rSetPos++, std::move(pHt) );
1121  if ( pChainItem->GetNext() )
1122  {
1123  SwFormatChain aTmp( pChainItem->GetNext()->GetChain() );
1124  aTmp.SetPrev( nullptr );
1125  pChainItem->GetNext()->SetFormatAttr( aTmp );
1126  }
1127  if ( pChainItem->GetPrev() )
1128  {
1129  SwFormatChain aTmp( pChainItem->GetPrev()->GetChain() );
1130  aTmp.SetNext( nullptr );
1131  pChainItem->GetPrev()->SetFormatAttr( aTmp );
1132  }
1133  }
1134  rFormat.ResetFormatAttr( RES_CHAIN );
1135  }
1136  }
1137 }
1138 
1139 void SwHistory::Add( const SwTextFootnote& rFootnote )
1140 {
1141  std::unique_ptr<SwHistoryHint> pHt(new SwHistorySetFootnote( rFootnote ));
1142  m_SwpHstry.push_back( std::move(pHt) );
1143 }
1144 
1145 // #i27615#
1146 void SwHistory::Add(const SfxItemSet & rSet, const SwCharFormat & rFormat)
1147 {
1148  std::unique_ptr<SwHistoryHint> pHt(new SwHistoryChangeCharFormat(rSet, rFormat.GetName()));
1149  m_SwpHstry.push_back( std::move(pHt) );
1150 }
1151 
1152 bool SwHistory::Rollback( SwDoc* pDoc, sal_uInt16 nStart )
1153 {
1154  if ( !Count() )
1155  return false;
1156 
1157  for ( sal_uInt16 i = Count(); i > nStart ; )
1158  {
1159  SwHistoryHint * pHHt = m_SwpHstry[ --i ].get();
1160  pHHt->SetInDoc( pDoc, false );
1161  }
1162  m_SwpHstry.erase( m_SwpHstry.begin() + nStart, m_SwpHstry.end() );
1163  m_nEndDiff = 0;
1164  return true;
1165 }
1166 
1167 bool SwHistory::TmpRollback( SwDoc* pDoc, sal_uInt16 nStart, bool bToFirst )
1168 {
1169  sal_uInt16 nEnd = Count() - m_nEndDiff;
1170  if ( !Count() || !nEnd || nStart >= nEnd )
1171  return false;
1172 
1173  if ( bToFirst )
1174  {
1175  for ( ; nEnd > nStart; ++m_nEndDiff )
1176  {
1177  SwHistoryHint* pHHt = m_SwpHstry[ --nEnd ].get();
1178  pHHt->SetInDoc( pDoc, true );
1179  }
1180  }
1181  else
1182  {
1183  for ( ; nStart < nEnd; ++m_nEndDiff, ++nStart )
1184  {
1185  SwHistoryHint* pHHt = m_SwpHstry[ nStart ].get();
1186  pHHt->SetInDoc( pDoc, true );
1187  }
1188  }
1189  return true;
1190 }
1191 
1192 sal_uInt16 SwHistory::SetTmpEnd( sal_uInt16 nNewTmpEnd )
1193 {
1194  OSL_ENSURE( nNewTmpEnd <= Count(), "SwHistory::SetTmpEnd: out of bounds" );
1195 
1196  const sal_uInt16 nOld = Count() - m_nEndDiff;
1197  m_nEndDiff = Count() - nNewTmpEnd;
1198 
1199  // for every SwHistoryFlyCnt, call the Redo of its UndoObject.
1200  // this saves the formats of the flys!
1201  for ( sal_uInt16 n = nOld; n < nNewTmpEnd; n++ )
1202  {
1203  if ( HSTRY_FLYCNT == (*this)[ n ]->Which() )
1204  {
1205  static_cast<SwHistoryTextFlyCnt*>((*this)[ n ])
1206  ->GetUDelLFormat()->RedoForRollback();
1207  }
1208  }
1209 
1210  return nOld;
1211 }
1212 
1214  const SfxItemSet& rSet,
1215  sal_uLong nNodeIdx)
1216 {
1217  if(rSet.Count())
1218  {
1219  SfxItemIter aIter(rSet);
1220  const SfxPoolItem* pItem = aIter.GetCurItem();
1221  do
1222  {
1223  if(!IsInvalidItem(pItem))
1224  {
1225  Add(pItem, pItem, nNodeIdx);
1226  }
1227 
1228  pItem = aIter.NextItem();
1229 
1230  } while(pItem);
1231  }
1232 }
1233 
1235  SwpHints const * pHts,
1236  const sal_uLong nNodeIdx,
1237  const sal_Int32 nStart,
1238  const sal_Int32 nEnd,
1239  const bool bCopyFields )
1240 {
1241  if( !pHts )
1242  return;
1243 
1244  // copy all attributes of the TextNode in the area from nStart to nEnd
1245  SwTextAttr* pHt;
1246  for( size_t n = 0; n < pHts->Count(); ++n )
1247  {
1248  // nAttrStt must even be set when !pEndIdx
1249  pHt = pHts->Get(n);
1250  const sal_Int32 nAttrStt = pHt->GetStart();
1251  const sal_Int32 * pEndIdx = pHt->GetEnd();
1252  if( nullptr != pEndIdx && nAttrStt > nEnd )
1253  break;
1254 
1255  // never copy Flys and Footnote !!
1256  bool bNextAttr = false;
1257  switch( pHt->Which() )
1258  {
1259  case RES_TXTATR_FIELD:
1260  case RES_TXTATR_ANNOTATION:
1261  case RES_TXTATR_INPUTFIELD:
1262  if( !bCopyFields )
1263  bNextAttr = true;
1264  break;
1265  case RES_TXTATR_FLYCNT:
1266  case RES_TXTATR_FTN:
1267  bNextAttr = true;
1268  break;
1269  }
1270 
1271  if( bNextAttr )
1272  continue;
1273 
1274  // save all attributes that are somehow in this area
1275  if ( nStart <= nAttrStt )
1276  {
1277  if ( nEnd > nAttrStt )
1278  {
1279  Add( pHt, nNodeIdx, false );
1280  }
1281  }
1282  else if ( pEndIdx && nStart < *pEndIdx )
1283  {
1284  Add( pHt, nNodeIdx, false );
1285  }
1286  }
1287 }
1288 
1289 // Class to register the history at a Node, Format, HintsArray, ...
1291  : SwClient( nullptr )
1292  , m_pHistory( pHst )
1293  , m_nNodeIndex( ULONG_MAX )
1294 {
1295  MakeSetWhichIds();
1296 }
1297 
1299  SwHistory* pHst )
1300  : SwClient( pRegIn )
1301  , m_pHistory( pHst )
1302  , m_nNodeIndex( rNd.GetIndex() )
1303 {
1304  MakeSetWhichIds();
1305 }
1306 
1308  : SwClient( nullptr )
1309  , m_pHistory( pHst )
1310  , m_nNodeIndex( rNd.GetIndex() )
1311 {
1312  MakeSetWhichIds();
1313 }
1314 
1315 void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
1316 {
1317  if ( m_pHistory && pNew && pOld != pNew )
1318  {
1319  if ( pNew->Which() < POOLATTR_END )
1320  {
1321  if(RES_UPDATE_ATTR == pNew->Which())
1322  {
1323  // const SfxItemPool& rPool = static_cast< const SwUpdateAttr* >(pNew)->GetSfxItemPool();
1324 
1325  m_pHistory->Add(
1326  // rPool,
1327  pOld,
1328  pNew,
1329  m_nNodeIndex);
1330  }
1331  else
1332  {
1333  OSL_ENSURE(false, "Unexpected update attribute (!)");
1334  }
1335  }
1336  else if (pOld && RES_ATTRSET_CHG == pNew->Which())
1337  {
1338  std::unique_ptr<SwHistoryHint> pNewHstr;
1339  const SfxItemSet& rSet = *static_cast< const SwAttrSetChg* >(pOld)->GetChgSet();
1340 
1341  if ( 1 < rSet.Count() )
1342  {
1343  pNewHstr.reset( new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet ) );
1344  }
1345  else if (const SfxPoolItem* pItem = SfxItemIter(rSet).GetCurItem())
1346  {
1347  if ( m_WhichIdSet.count( pItem->Which() ) )
1348  {
1349  pNewHstr.reset( new SwHistorySetFormat( pItem, m_nNodeIndex ) );
1350  }
1351  else
1352  {
1353  pNewHstr.reset( new SwHistoryResetFormat( pItem, m_nNodeIndex ) );
1354  }
1355  }
1356 
1357  if (pNewHstr)
1358  m_pHistory->m_SwpHstry.push_back( std::move(pNewHstr) );
1359  }
1360  }
1361 }
1362 
1363 void SwRegHistory::AddHint( SwTextAttr* pHt, const bool bNew )
1364 {
1365  m_pHistory->Add( pHt, m_nNodeIndex, bNew );
1366 }
1367 
1369  sal_Int32 const nStart, sal_Int32 const nEnd, SetAttrMode const nFlags,
1370  SwTextAttr **ppNewTextAttr )
1371 {
1372  if( !rSet.Count() )
1373  return false;
1374 
1375  SwTextNode * const pTextNode =
1376  dynamic_cast<SwTextNode *>(GetRegisteredIn());
1377 
1378  OSL_ENSURE(pTextNode, "SwRegHistory not registered at text node?");
1379  if (!pTextNode)
1380  return false;
1381 
1382  if (m_pHistory)
1383  {
1384  pTextNode->GetOrCreateSwpHints().Register(this);
1385  }
1386 
1387  const bool bInserted = pTextNode->SetAttr( rSet, nStart, nEnd, nFlags, ppNewTextAttr );
1388 
1389  // Caution: The array can be deleted when inserting an attribute!
1390  // This can happen when the value that should be added first deletes
1391  // an existing attribute but does not need to be added itself because
1392  // the paragraph attributes are identical
1393  // ( -> bForgetAttr in SwpHints::Insert )
1394  if ( pTextNode->GetpSwpHints() && m_pHistory )
1395  {
1396  pTextNode->GetpSwpHints()->DeRegister();
1397  }
1398 
1399 #ifndef NDEBUG
1400  if ( m_pHistory && bInserted )
1401  {
1402  SfxItemIter aIter(rSet);
1403  for (SfxPoolItem const* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1404  { // check that the history recorded a hint to reset every item
1405  sal_uInt16 const nWhich(pItem->Which());
1406  sal_uInt16 const nExpected(
1407  (isCHRATR(nWhich) || RES_TXTATR_UNKNOWN_CONTAINER == nWhich)
1409  : nWhich);
1410  if (RES_TXTATR_AUTOFMT == nExpected)
1411  continue; // special case, may get set on text node itself
1412  // tdf#105077 even worse, node's set could cause
1413  // nothing at all to be inserted
1414  assert(std::any_of(
1415  m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(),
1416  [nExpected](std::unique_ptr<SwHistoryHint> const& pHint) -> bool {
1417  SwHistoryResetText const*const pReset(
1418  dynamic_cast<SwHistoryResetText const*>(pHint.get()));
1419  return pReset && (pReset->GetWhich() == nExpected);
1420  }));
1421  }
1422  }
1423 #endif
1424 
1425  return bInserted;
1426 }
1427 
1429 {
1430  if ( m_pHistory && pRegIn )
1431  {
1432  pRegIn->Add( this );
1433  m_nNodeIndex = rNd.GetIndex();
1434  MakeSetWhichIds();
1435  }
1436  else
1437  {
1438  m_WhichIdSet.clear();
1439  }
1440 }
1441 
1443 {
1444  if (!m_pHistory) return;
1445 
1446  m_WhichIdSet.clear();
1447 
1448  if( GetRegisteredIn() )
1449  {
1450  const SfxItemSet* pSet = nullptr;
1451  if( dynamic_cast< const SwContentNode *>( GetRegisteredIn() ) != nullptr )
1452  {
1453  pSet = static_cast<SwContentNode*>(
1454  GetRegisteredIn())->GetpSwAttrSet();
1455  }
1456  else if ( dynamic_cast< const SwFormat *>( GetRegisteredIn() ) != nullptr )
1457  {
1458  pSet = &static_cast<SwFormat*>(
1459  GetRegisteredIn())->GetAttrSet();
1460  }
1461  if( pSet && pSet->Count() )
1462  {
1463  SfxItemIter aIter( *pSet );
1464  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1465  {
1466  sal_uInt16 nW = pItem->Which();
1467  m_WhichIdSet.insert( nW );
1468  }
1469  }
1470  }
1471 }
1472 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const std::unique_ptr< SwFormatField > m_pField
Definition: rolbck.hxx:135
void ChgDefinedIn(const SwModify *pNew)
Definition: fmtpdsc.hxx:70
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:179
bool const m_bFormatIgnoreEnd
Definition: rolbck.hxx:121
Starts a section of nodes in the document model.
Definition: node.hxx:303
History object containing all information used during undo / redo of text form field insertion...
Definition: rolbck.hxx:281
const OUString m_sType
Definition: rolbck.hxx:274
const SwGrfFormatColls * GetGrfFormatColls() const
Definition: doc.hxx:802
const TOXTypes m_eTOXTypes
Definition: rolbck.hxx:167
void SetEndNote(bool b)
Definition: atrftn.cxx:169
SwHistoryNoTextFieldmark(const ::sw::mark::IFieldmark &rFieldMark)
Definition: rolbck.cxx:677
sal_uLong GetIndex() const
Definition: node.hxx:282
void Add(SwClient *pDepend)
Definition: calbck.cxx:217
const std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > m_pUndo
Definition: rolbck.hxx:199
sal_uInt16 GetWhich() const
Definition: rolbck.hxx:191
Marks a position in the document model.
Definition: pam.hxx:35
std::vector< std::unique_ptr< SwHistoryHint > > m_SwpHstry
Definition: rolbck.hxx:350
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1344
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:343
#define RES_ATTRSET_CHG
Definition: hintids.hxx:287
const sal_Int32 m_nStart
Definition: rolbck.hxx:182
const sal_uInt16 m_nWhich
Definition: rolbck.hxx:106
virtual const SwRootFrame * GetCurrentLayout() const =0
OUString const & GetPrimaryKey() const
Definition: tox.hxx:604
const sal_uInt16 m_nAttr
Definition: rolbck.hxx:184
const bool m_bHadOtherPos
Definition: rolbck.hxx:259
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4892
void SetStartNode(const SwNodeIndex *pNode, bool bDelNodes=true)
Definition: atrftn.cxx:291
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:218
SwHistoryChangeCharFormat(const SfxItemSet &rSet, const OUString &sFormat)
Definition: rolbck.cxx:953
const sal_Int32 m_nEndContent
Definition: rolbck.hxx:294
bool Rollback(SwDoc *pDoc, sal_uInt16 nStart=0)
Definition: rolbck.cxx:1152
const bool m_bSavePos
Definition: rolbck.hxx:257
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SwNodeIndex nNode
Definition: pam.hxx:37
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
Definition: doctxm.cxx:623
void RegisterInModify(SwModify *pRegIn, const SwNode &rNd)
Definition: rolbck.cxx:1428
const SfxItemSet m_OldSet
Definition: rolbck.hxx:336
virtual const sal_Int32 * GetEnd() const
end position
Definition: txatbase.cxx:49
sal_uIntPtr sal_uLong
void CheckCondColl()
Definition: atrftn.cxx:568
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:474
virtual ~SwHistorySetFormat() override
Definition: rolbck.cxx:168
SwHistorySetTextField(const SwTextField *pTextField, sal_uLong nNode)
Definition: rolbck.cxx:254
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1147
Provides access to the marks of a document.
SwHistorySetFootnote(SwTextFootnote *pTextFootnote, sal_uLong nNode)
Definition: rolbck.cxx:412
Definition: doc.hxx:185
void SetNumStr(const OUString &rStr)
Definition: fmtftn.hxx:76
static SwContentNode * GetContentNode(SwDoc *pDoc, SwNodeIndex &rIdx, bool bNext)
Definition: fltshell.cxx:80
#define RES_TXTATR_UNKNOWN_CONTAINER
Definition: hintids.hxx:145
void SetFormatIgnoreStart(bool bFlag)
Definition: txatbase.hxx:104
virtual const SwPosition & GetMarkPos() const =0
SwPosition FindFieldSep(IFieldmark const &rMark)
return position of the CH_TXT_ATR_FIELDSEP for rMark
Definition: bookmrk.cxx:50
virtual void SetInDoc(SwDoc *pDoc, bool) override
Definition: rolbck.cxx:685
bool IsEqual(const SwTOXMark &rCmp) const
Definition: rolbck.cxx:382
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:284
virtual OUString GetDescription() const
Definition: rolbck.cxx:59
bool TmpRollback(SwDoc *pDoc, sal_uInt16 nStart, bool ToFirst=true)
Definition: rolbck.cxx:1167
bool IsEndNote() const
Definition: fmtftn.hxx:74
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1602
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
const SwTOXType * GetTOXType() const
Definition: tox.hxx:542
void SetFormatIgnoreEnd(bool bFlag)
Definition: txatbase.hxx:105
#define RES_TXTATR_CHARFMT
Definition: hintids.hxx:143
sal_Int32 m_nSepContent
Definition: rolbck.hxx:296
sal_uInt16 Which() const
Definition: txatbase.hxx:110
void SetPrev(SwFlyFrameFormat *pFormat)
Definition: atrfrm.cxx:2023
const sal_Int32 m_nEnd
Definition: rolbck.hxx:119
sal_Int32 GetAnyEnd() const
end (if available), else start
Definition: txatbase.hxx:153
void ChangeState(const SfxPoolItem *pItem)
Definition: cellatr.cxx:106
void ChgDefinedIn(const SwModify *pNew)
Definition: paratr.hxx:106
For old documents the Field-Which IDs must be preserved !!!
const sal_uLong m_nStartNode
Definition: rolbck.hxx:291
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:737
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:351
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet)=0
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:402
virtual ~SwHistorySetText() override
Definition: rolbck.cxx:217
bool IsAlive(SwFrameFormat const *) const
not so fast check that given format is still alive (i.e. contained here)
Definition: docfmt.cxx:2115
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
Definition: ndtxt.cxx:3059
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
#define RES_UPDATE_ATTR
Definition: hintids.hxx:291
#define POOLATTR_END
Definition: hintids.hxx:65
#define RES_CHAIN
Definition: hintids.hxx:221
const SfxPoolItem * NextItem()
const sal_Int32 m_nStart
Definition: rolbck.hxx:169
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:181
SwHistoryChangeFormatColl(SwFormatColl *pColl, sal_uLong nNode, SwNodeType nNodeWhich)
Definition: rolbck.cxx:504
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:321
SwNodeType GetNodeType() const
Definition: node.hxx:144
SwIndex nContent
Definition: pam.hxx:38
const sal_uLong m_nOldNodeIndex
Definition: rolbck.hxx:315
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:153
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo
Definition: rolbck.hxx:261
const IDocumentMarkAccess::MarkType m_eBkmkType
Definition: rolbck.hxx:260
History object containing all information used during undo / redo of checkbox and drop-down form fiel...
Definition: rolbck.hxx:266
SwFlyFrameFormat *const m_pPrevFormat
Definition: rolbck.hxx:325
const OUString & GetName() const
Definition: format.hxx:111
virtual ::sw::mark::IMark * makeMark(const SwPaM &rPaM, const OUString &rProposedName, MarkType eMark,::sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr)=0
Generates a new mark in the document for a certain selection.
std::unique_ptr< SwFieldType > m_pFieldType
! beware of the order for the declaration of the unique_ptrs.
Definition: rolbck.hxx:134
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
const sal_uLong m_nNode
Definition: rolbck.hxx:253
bool IsEqualBookmark(const ::sw::mark::IMark &rBkmk)
Definition: rolbck.cxx:670
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
bool IsStartNode() const
Definition: node.hxx:624
const OUString m_FootnoteNumber
Definition: rolbck.hxx:200
SwHistoryChangeFlyChain(SwFlyFrameFormat &rFormat, const SwFormatChain &rAttr)
Definition: rolbck.cxx:912
virtual OUString GetDescription() const override
Definition: rolbck.cxx:448
const sal_uLong m_nOtherNode
Definition: rolbck.hxx:254
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
Definition: thints.cxx:1226
const SwTable & GetTable() const
Definition: node.hxx:497
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage table of content types.
Definition: doctxm.cxx:605
virtual OUString GetDescription() const override
Definition: rolbck.cxx:104
SwHistorySetFormat(const SfxPoolItem *pFormatHt, sal_uLong nNode)
Definition: rolbck.cxx:64
const SwModify * GetDefinedIn() const
Definition: cellatr.hxx:64
const sal_Int32 m_nContent
Definition: rolbck.hxx:276
const OUString m_sName
Definition: rolbck.hxx:289
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:548
virtual void SetKeyCode(const vcl::KeyCode &)=0
const sal_Int32 m_nEnd
Definition: rolbck.hxx:155
SwHistoryTextFieldmark(const ::sw::mark::IFieldmark &rFieldMark)
Definition: rolbck.cxx:721
virtual void SetShortName(const OUString &)=0
SwHistory *const m_pHistory
Definition: rolbck.hxx:407
std::unique_ptr< SfxPoolItem > m_pAttr
Definition: rolbck.hxx:92
Base class for various Writer styles.
Definition: format.hxx:43
void EndListeningAll()
Definition: calbck.cxx:124
bool IsAlive(typename std::remove_pointer< Value >::type const *const p) const
check that given format is still alive (i.e. contained here)
Definition: docary.hxx:144
SwHistoryResetFormat(const SfxPoolItem *pFormatHt, sal_uLong nNodeIdx)
Definition: rolbck.cxx:172
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark)=0
Deletes a mark.
#define RES_FLYFRMFMT
Definition: hintids.hxx:276
const OUString & GetAlternativeText() const
Definition: tox.hxx:533
OUString m_aShortName
Definition: rolbck.hxx:251
SwHistoryTextFlyCnt(SwFrameFormat *const pFlyFormat)
Definition: rolbck.cxx:536
bool IsContentNode() const
Definition: node.hxx:628
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:881
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Style of a layout element.
Definition: frmfmt.hxx:57
size_t Count() const
Definition: ndhints.hxx:142
void DeRegister()
deregister the currently registered History
Definition: ndhints.hxx:197
SwNodeType
Definition: ndtyp.hxx:28
std::set< sal_uInt16 > m_WhichIdSet
Definition: rolbck.hxx:406
SwTextAttr * Get(size_t nPos) const
Definition: ndhints.hxx:144
const OUString m_TOXName
Definition: rolbck.hxx:166
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
SwHistoryResetText(sal_uInt16 nWhich, sal_Int32 nStt, sal_Int32 nEnd, sal_uLong nNode)
Definition: rolbck.cxx:394
SwFieldIds m_nFieldWhich
Definition: rolbck.hxx:139
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:218
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
#define RES_TXTATR_FTN
Definition: hintids.hxx:153
const OUString m_aName
Definition: rolbck.hxx:250
virtual ~SwHistorySetTextField() override
Definition: rolbck.cxx:280
bool IsIntrnlName() const
Definition: cellfml.hxx:130
void CopyAttr(SwpHints const *pHts, const sal_uLong nNodeIdx, const sal_Int32 nStart, const sal_Int32 nEnd, const bool bCopyFields)
Definition: rolbck.cxx:1234
SetAttrMode
Definition: swtypes.hxx:143
const sal_uLong m_nEndNode
Definition: rolbck.hxx:293
int i
SwContentNode * GetContentNode()
Definition: node.hxx:615
const bool m_bEndNote
Definition: rolbck.hxx:203
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
sal_uLong m_nNodeIndex
Definition: rolbck.hxx:137
sal_uInt16 GetLevel() const
Definition: tox.hxx:598
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:105
SwDoc * GetDoc()
Definition: node.hxx:702
void RegisterToTOXType(SwTOXType &rMark)
Definition: tox.cxx:136
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2631
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:117
virtual void SetInDoc(SwDoc *pDoc, bool) override
Definition: rolbck.cxx:735
const OUString & GetTypeName() const
Definition: tox.hxx:660
void CopyFormatAttr(const SfxItemSet &rSet, sal_uLong nNodeIdx)
Definition: rolbck.cxx:1213
std::shared_ptr< MetadatableUndo > CreateUndo() const
const sal_Int32 m_nStart
Definition: rolbck.hxx:118
const sal_uLong m_nNode
Definition: rolbck.hxx:275
std::unique_ptr< SwUndoDelLayFormat > m_pUndo
Definition: rolbck.hxx:229
const sal_Int32 m_nStart
Definition: rolbck.hxx:154
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:396
#define RES_TXTATR_TOXMARK
Definition: hintids.hxx:138
virtual ~SwHistorySetFootnote() override
Definition: rolbck.cxx:453
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
#define SwTextFootnote_GetIndex(pFIdx)
Definition: ftnidx.hxx:34
virtual sw::mark::IFieldmark * makeFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType, SwPosition const *pSepPos=nullptr)=0
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:303
void Register(SwRegHistory *pHist)
register a History, which receives all attribute changes (for Undo)
Definition: ndhints.hxx:195
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
#define RES_BOXATR_VALUE
Definition: hintids.hxx:265
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:457
void ResetInDoc(SwDoc *pDoc)
Definition: rolbck.cxx:703
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1182
SwFrameFormat & m_rFormat
Definition: rolbck.hxx:314
virtual void deleteFieldmarkAt(const SwPosition &rPos)=0
void ChgDefinedIn(const SwModify *pNew)
Definition: cellatr.hxx:65
void Add(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, sal_uLong nNodeIdx)
Definition: rolbck.cxx:981
attention: NOHINTADJUST prevents MergePortions! when using this need to pay attention to ignore start...
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:200
virtual sw::mark::IFieldmark * makeNoTextFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType)=0
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:168
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
const sal_Int32 m_nStart
Definition: rolbck.hxx:202
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
The Undo actions need to create new Shell cursors.
void ResetInDoc(SwDoc *pDoc)
Definition: rolbck.cxx:759
SwHistory()
Definition: rolbck.cxx:971
sal_uInt16 Count() const
Definition: rolbck.hxx:372
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
const OUString m_RefName
Definition: rolbck.hxx:152
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:767
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
bool const m_bFormatIgnoreStart
Definition: rolbck.hxx:120
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
Definition: thints.cxx:1675
SwHistorySetTOXMark(const SwTextTOXMark *pTextHt, sal_uLong nNode)
Definition: rolbck.cxx:339
void AddHint(SwTextAttr *pHt, const bool bNew)
Definition: rolbck.cxx:1363
const sal_Int32 m_nOldContentIndex
Definition: rolbck.hxx:316
SwHistorySetRefMark(const SwTextRefMark *pTextHt, sal_uLong nNode)
Definition: rolbck.cxx:312
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:650
#define RES_TXTATR_FIELD
Definition: hintids.hxx:151
SwCharFormat * GetCharFormat() const
Definition: fchrfmt.hxx:70
#define RES_TXTATR_AUTOFMT
Definition: hintids.hxx:141
An SwTextAttr container, stores all directly formatted text portions for a text node.
Definition: ndhints.hxx:67
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:733
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
OUString const & GetSecondaryKey() const
Definition: tox.hxx:610
virtual const SwNode * GetNodeOfFormula() const override
Get node type of the node containing this formula.
Definition: cellatr.cxx:86
#define RES_DRAWFRMFMT
Definition: hintids.hxx:279
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:774
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:921
SwHistorySetAttrSet(const SfxItemSet &rSet, sal_uLong nNode, const std::set< sal_uInt16 > &rSetArr)
Definition: rolbck.cxx:775
const sal_Int32 m_nContent
Definition: rolbck.hxx:255
#define RES_TXTATR_ANNOTATION
Definition: hintids.hxx:154
const sal_Int32 m_nEnd
Definition: rolbck.hxx:183
sal_Int32 GetIndex() const
Definition: index.hxx:95
virtual ~SwHistoryTextFlyCnt() override
Definition: rolbck.cxx:544
void MakeSetWhichIds()
Definition: rolbck.cxx:1442
SwNodes & GetNodes()
Definition: doc.hxx:402
SfxItemSet m_OldSet
Definition: rolbck.hxx:301
SwTOXMark m_TOXMark
Definition: rolbck.hxx:165
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:221
sal_uLong m_nSepNode
Definition: rolbck.hxx:295
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
sal_uInt16 SetTmpEnd(sal_uInt16 nTmpEnd)
Definition: rolbck.cxx:1192
SwFlyFrameFormat *const m_pFlyFormat
Definition: rolbck.hxx:327
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
const OUString m_Format
Definition: rolbck.hxx:337
SwFlyFrameFormat *const m_pNextFormat
Definition: rolbck.hxx:326
const OUString m_sType
Definition: rolbck.hxx:290
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:513
const sal_Int32 m_nStartContent
Definition: rolbck.hxx:292
~SwHistory()
Definition: rolbck.cxx:977
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:136
#define RES_TXTATR_FLYCNT
Definition: hintids.hxx:152
SwFrameFormat * ClaimFrameFormat()
Definition: swtable.cxx:1706
#define RES_TXTATR_REFMARK
Definition: hintids.hxx:137
TOXTypes GetType() const
Definition: tox.hxx:663
virtual void SetInDoc(SwDoc *pDoc, bool) override
Definition: rolbck.cxx:592
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:349
bool InsertHint(SwTextAttr *const pAttr, const SetAttrMode nMode=SetAttrMode::DEFAULT)
Insert pAttr into hints array.
Definition: thints.cxx:1261
const bool m_bSaveOtherPos
Definition: rolbck.hxx:258
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:159
SwHistorySetText(SwTextAttr *pTextHt, sal_uLong nNode)
Definition: rolbck.cxx:193
SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:41
vcl::KeyCode m_aKeycode
Definition: rolbck.hxx:252
void SetNext(SwFlyFrameFormat *pFormat)
Definition: atrfrm.cxx:2031
RndStdIds
bool IsTableNode() const
Definition: node.hxx:640
const sal_Int32 m_nEnd
Definition: rolbck.hxx:170
#define RES_PARATR_DROP
Definition: hintids.hxx:169
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: rolbck.cxx:1315
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:846
std::unique_ptr< SfxPoolItem > m_pAttr
Definition: rolbck.hxx:116
const SwTOXType * GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
Definition: doctxm.cxx:614
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps...
Definition: paratr.hxx:50
TableFormulaUpdateFlags m_eFlags
Definition: hints.hxx:208
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
const SwFormatCharFormat & GetCharFormat() const
Definition: txatbase.hxx:179
bool InsertItems(const SfxItemSet &rSet, sal_Int32 const nStart, sal_Int32 const nEnd, SetAttrMode const nFlags, SwTextAttr **ppNewTextAttr)
Definition: rolbck.cxx:1368
bool IsInvalidItem(const SfxPoolItem *pItem)
SwHistoryBookmark(const ::sw::mark::IMark &rBkmk, bool bSavePos, bool bSaveOtherPos)
Definition: rolbck.cxx:556
#define RES_PAGEDESC
Definition: hintids.hxx:200
#define RES_BREAK
Definition: hintids.hxx:201
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
SwFormatColl *const m_pColl
Definition: rolbck.hxx:217
virtual bool IsExpanded() const =0
const SwNodeType m_nNodeType
Definition: rolbck.hxx:219
sal_uInt16 m_nEndDiff
Definition: rolbck.hxx:351
std::vector< sal_uInt16 > m_ResetArray
Definition: rolbck.hxx:302
#define RES_TXTATR_INPUTFIELD
Definition: hintids.hxx:146
::sw::IShellCursorSupplier * GetIShellCursorSupplier()
Definition: doccorr.cxx:340
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:69
void RestoreMetadata(std::shared_ptr< MetadatableUndo > const &i_pUndo)
sal_uLong m_nNodeIndex
Definition: rolbck.hxx:201
SwHistoryChangeFlyAnchor(SwFrameFormat &rFormat)
Definition: rolbck.cxx:871
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
sal_uInt16 Which() const
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:960
const SfxPoolItem * GetCurItem() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1309
sal_uLong m_nNodeIndex
Definition: rolbck.hxx:408
SwRegHistory(SwHistory *pHst)
Definition: rolbck.cxx:1290
const sal_Int32 m_nOtherContent
Definition: rolbck.hxx:256
SwpHints & GetOrCreateSwpHints()
Definition: ndtxt.hxx:819
virtual const SwPosition & GetOtherMarkPos() const =0
#define RES_BOXATR_FORMULA
Definition: hintids.hxx:264
bool IsDefaultItem(const SfxPoolItem *pItem)
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:93
Base class of the Writer document model elements.
Definition: node.hxx:79
virtual OUString GetDescription() const override
Definition: rolbck.cxx:275
const OUString m_sName