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