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* pDoc = 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 
380 {
381  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
382  OSL_ENSURE( pTextNd, "SwHistorySetTOXMark: no TextNode" );
383  if ( !pTextNd )
384  return;
385 
386  // search for respective TOX type
387  const sal_uInt16 nCnt = pDoc->GetTOXTypeCount( m_eTOXTypes );
388  SwTOXType* pToxType = nullptr;
389  for ( sal_uInt16 n = 0; n < nCnt; ++n )
390  {
391  pToxType = const_cast<SwTOXType*>(pDoc->GetTOXType( m_eTOXTypes, n ));
392  if ( pToxType->GetTypeName() == m_TOXName )
393  break;
394  pToxType = nullptr;
395  }
396 
397  if ( !pToxType ) // TOX type not found, create new
398  {
399  pToxType = const_cast<SwTOXType*>(
401  }
402 
403  SwTOXMark aNew( m_TOXMark );
404  aNew.RegisterToTOXType( *pToxType );
405 
406  pTextNd->InsertItem( aNew, m_nStart, m_nEnd,
408 }
409 
410 bool SwHistorySetTOXMark::IsEqual( const SwTOXMark& rCmp ) const
411 {
412  return m_TOXName == rCmp.GetTOXType()->GetTypeName() &&
413  m_eTOXTypes == rCmp.GetTOXType()->GetType() &&
415  ( (TOX_INDEX == m_eTOXTypes)
416  ? ( m_TOXMark.GetPrimaryKey() == rCmp.GetPrimaryKey() &&
418  : m_TOXMark.GetLevel() == rCmp.GetLevel()
419  );
420 }
421 
423  sal_Int32 nAttrStart, sal_Int32 nAttrEnd, sal_uLong nNodePos )
425  , m_nNodeIndex( nNodePos ), m_nStart( nAttrStart ), m_nEnd( nAttrEnd )
426  , m_nAttr( nWhich )
427 {
428 }
429 
431 {
432  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
433  OSL_ENSURE( pTextNd, "SwHistoryResetText: no TextNode" );
434  if ( pTextNd )
435  {
436  pTextNd->DeleteAttributes( m_nAttr, m_nStart, m_nEnd );
437  }
438 }
439 
442  , m_pUndo( new SwUndoSaveSection )
443  , m_FootnoteNumber( pTextFootnote->GetFootnote().GetNumStr() )
444  , m_nNodeIndex( nNodePos )
445  , m_nStart( pTextFootnote->GetStart() )
446  , m_bEndNote( pTextFootnote->GetFootnote().IsEndNote() )
447 {
448  OSL_ENSURE( pTextFootnote->GetStartNode(),
449  "SwHistorySetFootnote: Footnote without Section" );
450 
451  // keep the old NodePos (because who knows what later will be saved/deleted
452  // in SaveSection)
453  SwDoc* pDoc = const_cast<SwDoc*>(pTextFootnote->GetTextNode().GetDoc());
454  SwNode* pSaveNd = pDoc->GetNodes()[ m_nNodeIndex ];
455 
456  // keep pointer to StartNode of FootnoteSection and reset its attribute for now
457  // (as a result, its/all Frames will be deleted automatically)
458  SwNodeIndex aSttIdx( *pTextFootnote->GetStartNode() );
459  pTextFootnote->SetStartNode( nullptr, false );
460 
461  m_pUndo->SaveSection( aSttIdx );
462  m_nNodeIndex = pSaveNd->GetIndex();
463 }
464 
467  , m_FootnoteNumber( rTextFootnote.GetFootnote().GetNumStr() )
468  , m_nNodeIndex( SwTextFootnote_GetIndex( (&rTextFootnote) ) )
469  , m_nStart( rTextFootnote.GetStart() )
470  , m_bEndNote( rTextFootnote.GetFootnote().IsEndNote() )
471 {
472  OSL_ENSURE( rTextFootnote.GetStartNode(),
473  "SwHistorySetFootnote: Footnote without Section" );
474 }
475 
477 {
478  return SwResId(STR_FOOTNOTE);
479 }
480 
482 {
483 }
484 
486 {
487  SwTextNode * pTextNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetTextNode();
488  OSL_ENSURE( pTextNd, "SwHistorySetFootnote: no TextNode" );
489  if ( !pTextNd )
490  return;
491 
492  if (m_pUndo)
493  {
494  // set the footnote in the TextNode
495  SwFormatFootnote aTemp( m_bEndNote );
496  SwFormatFootnote& rNew = const_cast<SwFormatFootnote&>(
497  pDoc->GetAttrPool().Put(aTemp) );
498  if ( !m_FootnoteNumber.isEmpty() )
499  {
500  rNew.SetNumStr( m_FootnoteNumber );
501  }
502  SwTextFootnote* pTextFootnote = new SwTextFootnote( rNew, m_nStart );
503 
504  // create the section of the Footnote
505  SwNodeIndex aIdx( *pTextNd );
506  m_pUndo->RestoreSection( pDoc, &aIdx, SwFootnoteStartNode );
507  pTextFootnote->SetStartNode( &aIdx );
508  if ( m_pUndo->GetHistory() )
509  {
510  // create frames only now
511  m_pUndo->GetHistory()->Rollback( pDoc );
512  }
513 
514  pTextNd->InsertHint( pTextFootnote );
515  }
516  else
517  {
518  SwTextFootnote * const pFootnote =
519  static_cast<SwTextFootnote*>(
520  pTextNd->GetTextAttrForCharAt( m_nStart ));
521  assert(pFootnote);
522  SwFormatFootnote &rFootnote = const_cast<SwFormatFootnote&>(pFootnote->GetFootnote());
523  rFootnote.SetNumStr( m_FootnoteNumber );
524  if ( rFootnote.IsEndNote() != m_bEndNote )
525  {
526  rFootnote.SetEndNote( m_bEndNote );
527  pFootnote->CheckCondColl();
528  }
529  }
530 }
531 
533  SwNodeType nNodeWhich )
535  , m_pColl( pFormatColl )
536  , m_nNodeIndex( nNd )
537  , m_nNodeType( nNodeWhich )
538 {
539 }
540 
542 {
543  SwContentNode * pContentNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetContentNode();
544  OSL_ENSURE( pContentNd, "SwHistoryChangeFormatColl: no ContentNode" );
545 
546  // before setting the format, check if it is still available in the
547  // document. if it has been deleted, there is no undo!
548  if ( !(pContentNd && m_nNodeType == pContentNd->GetNodeType()) )
549  return;
550 
551  if ( SwNodeType::Text == m_nNodeType )
552  {
553  if (pDoc->GetTextFormatColls()->IsAlive(static_cast<SwTextFormatColl *>(m_pColl)))
554  {
555  pContentNd->ChgFormatColl( m_pColl );
556  }
557  }
558  else if (pDoc->GetGrfFormatColls()->IsAlive(static_cast<SwGrfFormatColl *>(m_pColl)))
559  {
560  pContentNd->ChgFormatColl( m_pColl );
561  }
562 }
563 
566  , m_pUndo( new SwUndoDelLayFormat( pFlyFormat ) )
567 {
568  OSL_ENSURE( pFlyFormat, "SwHistoryTextFlyCnt: no Format" );
569  m_pUndo->ChgShowSel( false );
570 }
571 
573 {
574 }
575 
577 {
579  assert(pISCS);
580  ::sw::UndoRedoContext context(*pDoc, *pISCS);
581  m_pUndo->UndoImpl(context);
582 }
583 
585 {
586  xmlTextWriterStartElement(pWriter, BAD_CAST("SwHistoryTextFlyCnt"));
587  SwHistoryHint::dumpAsXml(pWriter);
588 
589  if (m_pUndo)
590  {
591  m_pUndo->dumpAsXml(pWriter);
592  }
593 
594  xmlTextWriterEndElement(pWriter);
595 }
596 
598  const ::sw::mark::IMark& rBkmk,
599  bool bSavePos,
600  bool bSaveOtherPos)
602  , m_aName(rBkmk.GetName())
603  , m_bHidden(false)
604  , m_nNode(bSavePos ?
605  rBkmk.GetMarkPos().nNode.GetIndex() : 0)
606  , m_nOtherNode(bSaveOtherPos ?
607  rBkmk.GetOtherMarkPos().nNode.GetIndex() : 0)
608  , m_nContent(bSavePos ?
609  rBkmk.GetMarkPos().nContent.GetIndex() : 0)
610  , m_nOtherContent(bSaveOtherPos ?
611  rBkmk.GetOtherMarkPos().nContent.GetIndex() :0)
612  , m_bSavePos(bSavePos)
613  , m_bSaveOtherPos(bSaveOtherPos)
614  , m_bHadOtherPos(rBkmk.IsExpanded())
615  , m_eBkmkType(IDocumentMarkAccess::GetType(rBkmk))
616 {
617  const ::sw::mark::IBookmark* const pBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(&rBkmk);
618  if(!pBookmark)
619  return;
620 
621  m_aKeycode = pBookmark->GetKeyCode();
622  m_aShortName = pBookmark->GetShortName();
623  m_bHidden = pBookmark->IsHidden();
624  m_aHideCondition = pBookmark->GetHideCondition();
625 
626  ::sfx2::Metadatable const*const pMetadatable(
627  dynamic_cast< ::sfx2::Metadatable const* >(pBookmark));
628  if (pMetadatable)
629  {
630  m_pMetadataUndo = pMetadatable->CreateUndo();
631  }
632 }
633 
635 {
636  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
637 
638  SwNodes& rNds = pDoc->GetNodes();
639  IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
640  std::unique_ptr<SwPaM> pPam;
641  ::sw::mark::IMark* pMark = nullptr;
642 
643  if(m_bSavePos)
644  {
645  SwContentNode* const pContentNd = rNds[m_nNode]->GetContentNode();
646  OSL_ENSURE(pContentNd,
647  "<SwHistoryBookmark::SetInDoc(..)>"
648  " - wrong node for a mark");
649 
650  // #111660# don't crash when nNode1 doesn't point to content node.
651  if(pContentNd)
652  pPam.reset(new SwPaM(*pContentNd, m_nContent));
653  }
654  else
655  {
656  pMark = *pMarkAccess->findMark(m_aName);
657  pPam.reset(new SwPaM(pMark->GetMarkPos()));
658  }
659 
660  if(m_bSaveOtherPos)
661  {
662  SwContentNode* const pContentNd = rNds[m_nOtherNode]->GetContentNode();
663  OSL_ENSURE(pContentNd,
664  "<SwHistoryBookmark::SetInDoc(..)>"
665  " - wrong node for a mark");
666 
667  if (pPam != nullptr && pContentNd)
668  {
669  pPam->SetMark();
670  pPam->GetMark()->nNode = m_nOtherNode;
671  pPam->GetMark()->nContent.Assign(pContentNd, m_nOtherContent);
672  }
673  }
674  else if(m_bHadOtherPos)
675  {
676  if(!pMark)
677  pMark = *pMarkAccess->findMark(m_aName);
678  OSL_ENSURE(pMark->IsExpanded(),
679  "<SwHistoryBookmark::SetInDoc(..)>"
680  " - missing pos on old mark");
681  pPam->SetMark();
682  *pPam->GetMark() = pMark->GetOtherMarkPos();
683  }
684 
685  if (!pPam)
686  return;
687 
688  if ( pMark != nullptr )
689  {
690  pMarkAccess->deleteMark( pMark );
691  }
692  ::sw::mark::IBookmark* const pBookmark =
693  dynamic_cast<::sw::mark::IBookmark*>(
694  pMarkAccess->makeMark(*pPam, m_aName, m_eBkmkType, sw::mark::InsertMode::New));
695  if ( pBookmark == nullptr )
696  return;
697 
698  pBookmark->SetKeyCode(m_aKeycode);
699  pBookmark->SetShortName(m_aShortName);
700  pBookmark->Hide(m_bHidden);
702 
703  if (m_pMetadataUndo)
704  {
705  ::sfx2::Metadatable * const pMeta(
706  dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
707  OSL_ENSURE(pMeta, "metadata undo, but not metadatable?");
708  if (pMeta)
709  {
711  }
712  }
713 }
714 
715 bool SwHistoryBookmark::IsEqualBookmark(const ::sw::mark::IMark& rBkmk)
716 {
717  return m_nNode == rBkmk.GetMarkPos().nNode.GetIndex()
718  && m_nContent == rBkmk.GetMarkPos().nContent.GetIndex()
719  && m_aName == rBkmk.GetName();
720 }
721 
722 SwHistoryNoTextFieldmark::SwHistoryNoTextFieldmark(const ::sw::mark::IFieldmark& rFieldMark)
724  , m_sType(rFieldMark.GetFieldname())
725  , m_nNode(rFieldMark.GetMarkPos().nNode.GetIndex())
726  , m_nContent(rFieldMark.GetMarkPos().nContent.GetIndex())
727 {
728 }
729 
731 {
732  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
733 
734  SwNodes& rNds = pDoc->GetNodes();
735  std::unique_ptr<SwPaM> pPam;
736 
737  const SwContentNode* pContentNd = rNds[m_nNode]->GetContentNode();
738  if(pContentNd)
739  pPam.reset(new SwPaM(*pContentNd, m_nContent));
740 
741  if (pPam)
742  {
743  IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
744  pMarkAccess->makeNoTextFieldBookmark(*pPam, OUString(), m_sType);
745  }
746 }
747 
749 {
750  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
751 
752  SwNodes& rNds = pDoc->GetNodes();
753  std::unique_ptr<SwPaM> pPam;
754 
755  const SwContentNode* pContentNd = rNds[m_nNode]->GetContentNode();
756  if(pContentNd)
757  pPam.reset(new SwPaM(*pContentNd, m_nContent-1));
758 
759  if (pPam)
760  {
761  IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
762  pMarkAccess->deleteFieldmarkAt(*pPam->GetPoint());
763  }
764 }
765 
766 SwHistoryTextFieldmark::SwHistoryTextFieldmark(const ::sw::mark::IFieldmark& rFieldMark)
768  , m_sName(rFieldMark.GetName())
769  , m_sType(rFieldMark.GetFieldname())
770  , m_nStartNode(rFieldMark.GetMarkStart().nNode.GetIndex())
771  , m_nStartContent(rFieldMark.GetMarkStart().nContent.GetIndex())
772  , m_nEndNode(rFieldMark.GetMarkEnd().nNode.GetIndex())
773  , m_nEndContent(rFieldMark.GetMarkEnd().nContent.GetIndex())
774 {
775  SwPosition const sepPos(sw::mark::FindFieldSep(rFieldMark));
776  m_nSepNode = sepPos.nNode.GetIndex();
777  m_nSepContent = sepPos.nContent.GetIndex();
778 }
779 
781 {
782  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
783 
784  SwNodes& rNds = pDoc->GetNodes();
785 
786  assert(rNds[m_nStartNode]->IsContentNode());
787  assert(rNds[m_nEndNode]->IsContentNode());
788  assert(rNds[m_nSepNode]->IsContentNode());
789 
790  SwPaM const pam(*rNds[m_nStartNode]->GetContentNode(), m_nStartContent,
791  *rNds[m_nEndNode]->GetContentNode(),
792  // subtract 1 for the CH_TXT_ATR_FIELDEND itself,
793  // plus more if same node as other CH_TXT_ATR
795  ? (m_nEndContent - 3)
797  ? (m_nEndContent - 2)
798  : (m_nEndContent - 1));
799  SwPosition const sepPos(*rNds[m_nSepNode]->GetContentNode(),
801 
802  IDocumentMarkAccess & rMarksAccess(*pDoc->getIDocumentMarkAccess());
803  rMarksAccess.makeFieldBookmark(pam, m_sName, m_sType, &sepPos);
804 }
805 
807 {
808  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
809 
810  SwNodes& rNds = pDoc->GetNodes();
811 
812  assert(rNds[m_nStartNode]->IsContentNode());
813  assert(rNds[m_nEndNode]->IsContentNode());
814  assert(rNds[m_nSepNode]->IsContentNode());
815 
817 
818  IDocumentMarkAccess & rMarksAccess(*pDoc->getIDocumentMarkAccess());
819  rMarksAccess.deleteFieldmarkAt(pos);
820 }
821 
823  sal_uLong nNodePos, const std::set<sal_uInt16> &rSetArr )
825  , m_OldSet( rSet )
826  , m_ResetArray( 0, 4 )
827  , m_nNodeIndex( nNodePos )
828 {
829  SfxItemIter aIter( m_OldSet ), aOrigIter( rSet );
830  const SfxPoolItem* pItem = aIter.GetCurItem(),
831  * pOrigItem = aOrigIter.GetCurItem();
832  while (pItem && pOrigItem)
833  {
834  if( !rSetArr.count( pOrigItem->Which() ))
835  {
836  m_ResetArray.push_back( pOrigItem->Which() );
837  m_OldSet.ClearItem( pOrigItem->Which() );
838  }
839  else
840  {
841  switch ( pItem->Which() )
842  {
843  case RES_PAGEDESC:
844  static_cast<SwFormatPageDesc*>(
845  const_cast<SfxPoolItem*>(pItem))->ChgDefinedIn( nullptr );
846  break;
847 
848  case RES_PARATR_DROP:
849  static_cast<SwFormatDrop*>(
850  const_cast<SfxPoolItem*>(pItem))->ChgDefinedIn( nullptr );
851  break;
852 
853  case RES_BOXATR_FORMULA:
854  {
855  // When a formula is set, never save the value. It
856  // possibly must be recalculated!
857  // Save formulas always in plain text
859 
860  SwTableBoxFormula& rNew =
861  *static_cast<SwTableBoxFormula*>(
862  const_cast<SfxPoolItem*>(pItem));
863  if ( rNew.IsIntrnlName() )
864  {
865  const SwTableBoxFormula& rOld =
866  rSet.Get( RES_BOXATR_FORMULA );
867  const SwNode* pNd = rOld.GetNodeOfFormula();
868  if ( pNd )
869  {
870  const SwTableNode* pTableNode
871  = pNd->FindTableNode();
872  if (pTableNode)
873  {
874  SwTableFormulaUpdate aMsgHint(
875  &pTableNode->GetTable() );
876  aMsgHint.m_eFlags = TBL_BOXNAME;
877  rNew.ChgDefinedIn( rOld.GetDefinedIn() );
878  rNew.ChangeState( &aMsgHint );
879  }
880  }
881  }
882  rNew.ChgDefinedIn( nullptr );
883  }
884  break;
885  }
886  }
887 
888  pItem = aIter.NextItem();
889  pOrigItem = aOrigIter.NextItem();
890  }
891 }
892 
894 {
895  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
896 
897  SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ];
898  if ( pNode->IsContentNode() )
899  {
900  static_cast<SwContentNode*>(pNode)->SetAttr( m_OldSet );
901  if ( !m_ResetArray.empty() )
902  {
903  static_cast<SwContentNode*>(pNode)->ResetAttr( m_ResetArray );
904  }
905  }
906  else if ( pNode->IsTableNode() )
907  {
908  SwFormat& rFormat =
909  *static_cast<SwTableNode*>(pNode)->GetTable().GetFrameFormat();
910  rFormat.SetFormatAttr( m_OldSet );
911  if ( !m_ResetArray.empty() )
912  {
913  rFormat.ResetFormatAttr( m_ResetArray.front() );
914  }
915  }
916 }
917 
920  , m_rFormat( rFormat )
921  , m_nOldNodeIndex( rFormat.GetAnchor().GetContentAnchor()->nNode.GetIndex() )
922  , m_nOldContentIndex( (RndStdIds::FLY_AT_CHAR == rFormat.GetAnchor().GetAnchorId())
923  ? rFormat.GetAnchor().GetContentAnchor()->nContent.GetIndex()
924  : COMPLETE_STRING )
925 {
926 }
927 
929 {
930  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
931 
932  if (!pDoc->GetSpzFrameFormats()->IsAlive(&m_rFormat)) // Format does still exist
933  return;
934 
936 
937  SwNode* pNd = pDoc->GetNodes()[ m_nOldNodeIndex ];
938  SwContentNode* pCNd = pNd->GetContentNode();
939  SwPosition aPos( *pNd );
941  {
942  OSL_ENSURE(pCNd, "SwHistoryChangeFlyAnchor: no ContentNode");
943  if (pCNd)
944  {
945  aPos.nContent.Assign( pCNd, m_nOldContentIndex );
946  }
947  }
948  aTmp.SetAnchor( &aPos );
949 
950  // so the Layout does not get confused
951  if (!pCNd || !pCNd->getLayoutFrame(pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr))
952  {
954  }
955 
956  m_rFormat.SetFormatAttr( aTmp );
957 }
958 
960  const SwFormatChain& rAttr )
962  , m_pPrevFormat( rAttr.GetPrev() )
963  , m_pNextFormat( rAttr.GetNext() )
964  , m_pFlyFormat( &rFormat )
965 {
966 }
967 
969 {
970  if (!pDoc->GetSpzFrameFormats()->IsAlive(m_pFlyFormat))
971  return;
972 
973  SwFormatChain aChain;
974 
975  if (m_pPrevFormat &&
977  {
978  aChain.SetPrev( m_pPrevFormat );
980  aTmp.SetNext( m_pFlyFormat );
981  m_pPrevFormat->SetFormatAttr( aTmp );
982  }
983 
984  if (m_pNextFormat &&
986  {
987  aChain.SetNext( m_pNextFormat );
989  aTmp.SetPrev( m_pFlyFormat );
990  m_pNextFormat->SetFormatAttr( aTmp );
991  }
992 
993  if ( aChain.GetNext() || aChain.GetPrev() )
994  {
995  m_pFlyFormat->SetFormatAttr( aChain );
996  }
997 }
998 
999 // -> #i27615#
1001  const OUString & sFormat)
1003  , m_OldSet(rSet), m_Format(sFormat)
1004 {
1005 }
1006 
1008 {
1009  SwCharFormat * pCharFormat = pDoc->FindCharFormatByName(m_Format);
1010 
1011  if (pCharFormat)
1012  {
1013  pCharFormat->SetFormatAttr(m_OldSet);
1014  }
1015 }
1016 // <- #i27615#
1017 
1019  : m_SwpHstry()
1020  , m_nEndDiff( 0 )
1021 {
1022 }
1023 
1025 {
1026 }
1027 
1029  const SfxPoolItem* pOldValue,
1030  const SfxPoolItem* pNewValue,
1031  sal_uLong nNodeIdx)
1032 {
1033  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1034  const sal_uInt16 nWhich(pNewValue->Which());
1035 
1036  // excluded values
1037  if(nWhich == RES_TXTATR_FIELD || nWhich == RES_TXTATR_ANNOTATION)
1038  {
1039  return;
1040  }
1041 
1042  // no default Attribute?
1043  std::unique_ptr<SwHistoryHint> pHt;
1044 
1045  // To be able to include the DrawingLayer FillItems something more
1046  // general has to be done to check if an Item is default than to check
1047  // if its pointer equals that in Writer's global PoolDefaults (held in
1048  // aAttrTab and used to fill the pool defaults in Writer - looks as if
1049  // Writer is *older* than the SfxItemPool ?). I checked the possibility to
1050  // get the SfxItemPool here (works), but decided to use the SfxPoolItem's
1051  // global tooling aka IsDefaultItem(const SfxPoolItem*) for now
1052  if(pOldValue && !IsDefaultItem(pOldValue))
1053  {
1054  pHt.reset( new SwHistorySetFormat( pOldValue, nNodeIdx ) );
1055  }
1056  else
1057  {
1058  pHt.reset( new SwHistoryResetFormat( pNewValue, nNodeIdx ) );
1059  }
1060 
1061  m_SwpHstry.push_back( std::move(pHt) );
1062 }
1063 
1064 // FIXME: refactor the following "Add" methods (DRY)?
1065 void SwHistory::Add( SwTextAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr )
1066 {
1067  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1068 
1069  std::unique_ptr<SwHistoryHint> pHt;
1070  if( !bNewAttr )
1071  {
1072  switch ( pHint->Which() )
1073  {
1074  case RES_TXTATR_FTN:
1075  pHt.reset( new SwHistorySetFootnote(
1076  static_cast<SwTextFootnote*>(pHint), nNodeIdx ) );
1077  break;
1078  case RES_TXTATR_FLYCNT:
1079  pHt.reset( new SwHistoryTextFlyCnt( static_cast<SwTextFlyCnt*>(pHint)
1080  ->GetFlyCnt().GetFrameFormat() ) );
1081  break;
1082  case RES_TXTATR_FIELD:
1083  case RES_TXTATR_ANNOTATION:
1084  pHt.reset( new SwHistorySetTextField(
1085  static_txtattr_cast<SwTextField*>(pHint), nNodeIdx) );
1086  break;
1087  case RES_TXTATR_TOXMARK:
1088  pHt.reset( new SwHistorySetTOXMark(
1089  static_txtattr_cast<SwTextTOXMark*>(pHint), nNodeIdx) );
1090  break;
1091  case RES_TXTATR_REFMARK:
1092  pHt.reset( new SwHistorySetRefMark(
1093  static_txtattr_cast<SwTextRefMark*>(pHint), nNodeIdx) );
1094  break;
1095  default:
1096  pHt.reset( new SwHistorySetText( pHint, nNodeIdx ) );
1097  }
1098  }
1099  else
1100  {
1101  pHt.reset( new SwHistoryResetText( pHint->Which(), pHint->GetStart(),
1102  pHint->GetAnyEnd(), nNodeIdx ) );
1103  }
1104  m_SwpHstry.push_back( std::move(pHt) );
1105 }
1106 
1107 void SwHistory::Add( SwFormatColl* pColl, sal_uLong nNodeIdx, SwNodeType nWhichNd )
1108 {
1109  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1110 
1111  std::unique_ptr<SwHistoryHint> pHt(
1112  new SwHistoryChangeFormatColl( pColl, nNodeIdx, nWhichNd ));
1113  m_SwpHstry.push_back( std::move(pHt) );
1114 }
1115 
1116 void SwHistory::Add(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOtherPos)
1117 {
1118  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1119 
1120  std::unique_ptr<SwHistoryHint> pHt;
1121 
1122  switch (IDocumentMarkAccess::GetType(rBkmk))
1123  {
1126  assert(bSavePos && bSaveOtherPos); // must be deleted completely!
1127  pHt.reset(new SwHistoryTextFieldmark(dynamic_cast<sw::mark::IFieldmark const&>(rBkmk)));
1128  break;
1131  assert(bSavePos && bSaveOtherPos); // must be deleted completely!
1132  pHt.reset(new SwHistoryNoTextFieldmark(dynamic_cast<sw::mark::IFieldmark const&>(rBkmk)));
1133  break;
1134  default:
1135  pHt.reset(new SwHistoryBookmark(rBkmk, bSavePos, bSaveOtherPos));
1136  break;
1137  }
1138 
1139  assert(pHt);
1140  m_SwpHstry.push_back( std::move(pHt) );
1141 }
1142 
1144 {
1145  std::unique_ptr<SwHistoryHint> pHt(new SwHistoryChangeFlyAnchor( rFormat ));
1146  m_SwpHstry.push_back( std::move(pHt) );
1147 }
1148 
1149 void SwHistory::AddDeleteFly(SwFrameFormat& rFormat, sal_uInt16& rSetPos)
1150 {
1151  OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
1152 
1153  const sal_uInt16 nWh = rFormat.Which();
1154  (void) nWh;
1155  // only Flys!
1156  assert((RES_FLYFRMFMT == nWh && dynamic_cast<SwFlyFrameFormat*>(&rFormat))
1157  || (RES_DRAWFRMFMT == nWh && dynamic_cast<SwDrawFrameFormat*>(&rFormat)));
1158  {
1159  std::unique_ptr<SwHistoryHint> pHint(new SwHistoryTextFlyCnt( &rFormat ));
1160  m_SwpHstry.push_back( std::move(pHint) );
1161 
1162  const SwFormatChain* pChainItem;
1163  if( SfxItemState::SET == rFormat.GetItemState( RES_CHAIN, false,
1164  reinterpret_cast<const SfxPoolItem**>(&pChainItem) ))
1165  {
1166  assert(RES_FLYFRMFMT == nWh); // not supported on SdrObjects
1167  if( pChainItem->GetNext() || pChainItem->GetPrev() )
1168  {
1169  std::unique_ptr<SwHistoryHint> pHt(
1170  new SwHistoryChangeFlyChain(static_cast<SwFlyFrameFormat&>(rFormat), *pChainItem));
1171  m_SwpHstry.insert( m_SwpHstry.begin() + rSetPos++, std::move(pHt) );
1172  if ( pChainItem->GetNext() )
1173  {
1174  SwFormatChain aTmp( pChainItem->GetNext()->GetChain() );
1175  aTmp.SetPrev( nullptr );
1176  pChainItem->GetNext()->SetFormatAttr( aTmp );
1177  }
1178  if ( pChainItem->GetPrev() )
1179  {
1180  SwFormatChain aTmp( pChainItem->GetPrev()->GetChain() );
1181  aTmp.SetNext( nullptr );
1182  pChainItem->GetPrev()->SetFormatAttr( aTmp );
1183  }
1184  }
1185  rFormat.ResetFormatAttr( RES_CHAIN );
1186  }
1187  }
1188 }
1189 
1190 void SwHistory::Add( const SwTextFootnote& rFootnote )
1191 {
1192  std::unique_ptr<SwHistoryHint> pHt(new SwHistorySetFootnote( rFootnote ));
1193  m_SwpHstry.push_back( std::move(pHt) );
1194 }
1195 
1196 // #i27615#
1197 void SwHistory::Add(const SfxItemSet & rSet, const SwCharFormat & rFormat)
1198 {
1199  std::unique_ptr<SwHistoryHint> pHt(new SwHistoryChangeCharFormat(rSet, rFormat.GetName()));
1200  m_SwpHstry.push_back( std::move(pHt) );
1201 }
1202 
1203 bool SwHistory::Rollback( SwDoc* pDoc, sal_uInt16 nStart )
1204 {
1205  if ( !Count() )
1206  return false;
1207 
1208  for ( sal_uInt16 i = Count(); i > nStart ; )
1209  {
1210  SwHistoryHint * pHHt = m_SwpHstry[ --i ].get();
1211  pHHt->SetInDoc( pDoc, false );
1212  }
1213  m_SwpHstry.erase( m_SwpHstry.begin() + nStart, m_SwpHstry.end() );
1214  m_nEndDiff = 0;
1215  return true;
1216 }
1217 
1218 bool SwHistory::TmpRollback( SwDoc* pDoc, sal_uInt16 nStart, bool bToFirst )
1219 {
1220  sal_uInt16 nEnd = Count() - m_nEndDiff;
1221  if ( !Count() || !nEnd || nStart >= nEnd )
1222  return false;
1223 
1224  if ( bToFirst )
1225  {
1226  for ( ; nEnd > nStart; ++m_nEndDiff )
1227  {
1228  SwHistoryHint* pHHt = m_SwpHstry[ --nEnd ].get();
1229  pHHt->SetInDoc( pDoc, true );
1230  }
1231  }
1232  else
1233  {
1234  for ( ; nStart < nEnd; ++m_nEndDiff, ++nStart )
1235  {
1236  SwHistoryHint* pHHt = m_SwpHstry[ nStart ].get();
1237  pHHt->SetInDoc( pDoc, true );
1238  }
1239  }
1240  return true;
1241 }
1242 
1243 sal_uInt16 SwHistory::SetTmpEnd( sal_uInt16 nNewTmpEnd )
1244 {
1245  OSL_ENSURE( nNewTmpEnd <= Count(), "SwHistory::SetTmpEnd: out of bounds" );
1246 
1247  const sal_uInt16 nOld = Count() - m_nEndDiff;
1248  m_nEndDiff = Count() - nNewTmpEnd;
1249 
1250  // for every SwHistoryFlyCnt, call the Redo of its UndoObject.
1251  // this saves the formats of the flys!
1252  for ( sal_uInt16 n = nOld; n < nNewTmpEnd; n++ )
1253  {
1254  if ( HSTRY_FLYCNT == (*this)[ n ]->Which() )
1255  {
1256  static_cast<SwHistoryTextFlyCnt*>((*this)[ n ])
1257  ->GetUDelLFormat()->RedoForRollback();
1258  }
1259  }
1260 
1261  return nOld;
1262 }
1263 
1265  const SfxItemSet& rSet,
1266  sal_uLong nNodeIdx)
1267 {
1268  if(!rSet.Count())
1269  return;
1270 
1271  SfxItemIter aIter(rSet);
1272  const SfxPoolItem* pItem = aIter.GetCurItem();
1273  do
1274  {
1275  if(!IsInvalidItem(pItem))
1276  {
1277  Add(pItem, pItem, nNodeIdx);
1278  }
1279 
1280  pItem = aIter.NextItem();
1281 
1282  } while(pItem);
1283 }
1284 
1286 {
1287  xmlTextWriterStartElement(pWriter, BAD_CAST("SwHistory"));
1288  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1289 
1290  xmlTextWriterStartElement(pWriter, BAD_CAST("m_SwpHstry"));
1291  for (const auto& pHistory : m_SwpHstry)
1292  {
1293  pHistory->dumpAsXml(pWriter);
1294  }
1295  xmlTextWriterEndElement(pWriter);
1296 
1297  xmlTextWriterEndElement(pWriter);
1298 }
1299 
1301  SwpHints const * pHts,
1302  const sal_uLong nNodeIdx,
1303  const sal_Int32 nStart,
1304  const sal_Int32 nEnd,
1305  const bool bCopyFields )
1306 {
1307  if( !pHts )
1308  return;
1309 
1310  // copy all attributes of the TextNode in the area from nStart to nEnd
1311  SwTextAttr* pHt;
1312  for( size_t n = 0; n < pHts->Count(); ++n )
1313  {
1314  // nAttrStt must even be set when !pEndIdx
1315  pHt = pHts->Get(n);
1316  const sal_Int32 nAttrStt = pHt->GetStart();
1317  const sal_Int32 * pEndIdx = pHt->GetEnd();
1318  if( nullptr != pEndIdx && nAttrStt > nEnd )
1319  break;
1320 
1321  // never copy Flys and Footnote !!
1322  bool bNextAttr = false;
1323  switch( pHt->Which() )
1324  {
1325  case RES_TXTATR_FIELD:
1326  case RES_TXTATR_ANNOTATION:
1327  case RES_TXTATR_INPUTFIELD:
1328  if( !bCopyFields )
1329  bNextAttr = true;
1330  break;
1331  case RES_TXTATR_FLYCNT:
1332  case RES_TXTATR_FTN:
1333  bNextAttr = true;
1334  break;
1335  }
1336 
1337  if( bNextAttr )
1338  continue;
1339 
1340  // save all attributes that are somehow in this area
1341  if ( nStart <= nAttrStt )
1342  {
1343  if ( nEnd > nAttrStt )
1344  {
1345  Add( pHt, nNodeIdx, false );
1346  }
1347  }
1348  else if ( pEndIdx && nStart < *pEndIdx )
1349  {
1350  Add( pHt, nNodeIdx, false );
1351  }
1352  }
1353 }
1354 
1355 // Class to register the history at a Node, Format, HintsArray, ...
1357  : SwClient( nullptr )
1358  , m_pHistory( pHst )
1359  , m_nNodeIndex( ULONG_MAX )
1360 {
1361  MakeSetWhichIds();
1362 }
1363 
1365  SwHistory* pHst )
1366  : SwClient( pRegIn )
1367  , m_pHistory( pHst )
1368  , m_nNodeIndex( rNd.GetIndex() )
1369 {
1370  MakeSetWhichIds();
1371 }
1372 
1374  : SwClient( nullptr )
1375  , m_pHistory( pHst )
1376  , m_nNodeIndex( rNd.GetIndex() )
1377 {
1378  MakeSetWhichIds();
1379 }
1380 
1381 void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
1382 {
1383  if ( !(m_pHistory && pNew && pOld != pNew) )
1384  return;
1385 
1386  if ( pNew->Which() < POOLATTR_END )
1387  {
1388  if(RES_UPDATE_ATTR == pNew->Which())
1389  {
1390  // const SfxItemPool& rPool = static_cast< const SwUpdateAttr* >(pNew)->GetSfxItemPool();
1391 
1392  m_pHistory->Add(
1393  // rPool,
1394  pOld,
1395  pNew,
1396  m_nNodeIndex);
1397  }
1398  else
1399  {
1400  OSL_ENSURE(false, "Unexpected update attribute (!)");
1401  }
1402  }
1403  else if (pOld && RES_ATTRSET_CHG == pNew->Which())
1404  {
1405  std::unique_ptr<SwHistoryHint> pNewHstr;
1406  const SfxItemSet& rSet = *static_cast< const SwAttrSetChg* >(pOld)->GetChgSet();
1407 
1408  if ( 1 < rSet.Count() )
1409  {
1410  pNewHstr.reset( new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet ) );
1411  }
1412  else if (const SfxPoolItem* pItem = SfxItemIter(rSet).GetCurItem())
1413  {
1414  if ( m_WhichIdSet.count( pItem->Which() ) )
1415  {
1416  pNewHstr.reset( new SwHistorySetFormat( pItem, m_nNodeIndex ) );
1417  }
1418  else
1419  {
1420  pNewHstr.reset( new SwHistoryResetFormat( pItem, m_nNodeIndex ) );
1421  }
1422  }
1423 
1424  if (pNewHstr)
1425  m_pHistory->m_SwpHstry.push_back( std::move(pNewHstr) );
1426  }
1427 }
1428 
1429 void SwRegHistory::AddHint( SwTextAttr* pHt, const bool bNew )
1430 {
1431  m_pHistory->Add( pHt, m_nNodeIndex, bNew );
1432 }
1433 
1435  sal_Int32 const nStart, sal_Int32 const nEnd, SetAttrMode const nFlags,
1436  SwTextAttr **ppNewTextAttr )
1437 {
1438  if( !rSet.Count() )
1439  return false;
1440 
1441  SwTextNode * const pTextNode =
1442  dynamic_cast<SwTextNode *>(GetRegisteredIn());
1443 
1444  OSL_ENSURE(pTextNode, "SwRegHistory not registered at text node?");
1445  if (!pTextNode)
1446  return false;
1447 
1448  if (m_pHistory)
1449  {
1450  pTextNode->GetOrCreateSwpHints().Register(this);
1451  }
1452 
1453  const bool bInserted = pTextNode->SetAttr( rSet, nStart, nEnd, nFlags, ppNewTextAttr );
1454 
1455  // Caution: The array can be deleted when inserting an attribute!
1456  // This can happen when the value that should be added first deletes
1457  // an existing attribute but does not need to be added itself because
1458  // the paragraph attributes are identical
1459  // ( -> bForgetAttr in SwpHints::Insert )
1460  if ( pTextNode->GetpSwpHints() && m_pHistory )
1461  {
1462  pTextNode->GetpSwpHints()->DeRegister();
1463  }
1464 
1465 #ifndef NDEBUG
1466  if ( m_pHistory && bInserted )
1467  {
1468  SfxItemIter aIter(rSet);
1469  for (SfxPoolItem const* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1470  { // check that the history recorded a hint to reset every item
1471  sal_uInt16 const nWhich(pItem->Which());
1472  sal_uInt16 const nExpected(
1473  (isCHRATR(nWhich) || RES_TXTATR_UNKNOWN_CONTAINER == nWhich)
1475  : nWhich);
1476  if (RES_TXTATR_AUTOFMT == nExpected)
1477  continue; // special case, may get set on text node itself
1478  // tdf#105077 even worse, node's set could cause
1479  // nothing at all to be inserted
1480  assert(std::any_of(
1481  m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(),
1482  [nExpected](std::unique_ptr<SwHistoryHint> const& pHint) -> bool {
1483  SwHistoryResetText const*const pReset(
1484  dynamic_cast<SwHistoryResetText const*>(pHint.get()));
1485  return pReset && (pReset->GetWhich() == nExpected);
1486  }));
1487  }
1488  }
1489 #endif
1490 
1491  return bInserted;
1492 }
1493 
1495 {
1496  if ( m_pHistory && pRegIn )
1497  {
1498  pRegIn->Add( this );
1499  m_nNodeIndex = rNd.GetIndex();
1500  MakeSetWhichIds();
1501  }
1502  else
1503  {
1504  m_WhichIdSet.clear();
1505  }
1506 }
1507 
1509 {
1510  if (!m_pHistory) return;
1511 
1512  m_WhichIdSet.clear();
1513 
1514  if( !GetRegisteredIn() )
1515  return;
1516 
1517  const SfxItemSet* pSet = nullptr;
1518  if( dynamic_cast< const SwContentNode *>( GetRegisteredIn() ) != nullptr )
1519  {
1520  pSet = static_cast<SwContentNode*>(
1521  GetRegisteredIn())->GetpSwAttrSet();
1522  }
1523  else if ( dynamic_cast< const SwFormat *>( GetRegisteredIn() ) != nullptr )
1524  {
1525  pSet = &static_cast<SwFormat*>(
1526  GetRegisteredIn())->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
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: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:303
History object containing all information used during undo / redo of text form field insertion...
Definition: rolbck.hxx:287
const OUString m_sType
Definition: rolbck.hxx:280
const SwGrfFormatColls * GetGrfFormatColls() const
Definition: doc.hxx:803
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:169
SwHistoryNoTextFieldmark(const ::sw::mark::IFieldmark &rFieldMark)
Definition: rolbck.cxx:722
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:202
sal_uInt16 GetWhich() const
Definition: rolbck.hxx:194
Marks a position in the document model.
Definition: pam.hxx:35
std::vector< std::unique_ptr< SwHistoryHint > > m_SwpHstry
Definition: rolbck.hxx:356
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:1345
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:471
OUString m_aName
const sal_Int32 m_nStart
Definition: rolbck.hxx:185
const sal_uInt16 m_nWhich
Definition: rolbck.hxx:109
virtual const SwRootFrame * GetCurrentLayout() const =0
OUString const & GetPrimaryKey() const
Definition: tox.hxx:639
const sal_uInt16 m_nAttr
Definition: rolbck.hxx:187
const bool m_bHadOtherPos
Definition: rolbck.hxx:265
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4904
void SetStartNode(const SwNodeIndex *pNode, bool bDelNodes=true)
Definition: atrftn.cxx:291
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:219
SwHistoryChangeCharFormat(const SfxItemSet &rSet, const OUString &sFormat)
Definition: rolbck.cxx:1000
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(150)
const sal_Int32 m_nEndContent
Definition: rolbck.hxx:300
bool Rollback(SwDoc *pDoc, sal_uInt16 nStart=0)
Definition: rolbck.cxx:1203
const bool m_bSavePos
Definition: rolbck.hxx:263
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SwNodeIndex nNode
Definition: pam.hxx:37
const SwTOXType * InsertTOXType(const SwTOXType &rTyp)
Definition: doctxm.cxx:629
void RegisterInModify(SwModify *pRegIn, const SwNode &rNd)
Definition: rolbck.cxx:1494
const SfxItemSet m_OldSet
Definition: rolbck.hxx:342
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:569
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: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:1190
sal_Int64 n
Provides access to the marks of a document.
SwHistorySetFootnote(SwTextFootnote *pTextFootnote, sal_uLong nNode)
Definition: rolbck.cxx:440
Definition: doc.hxx:184
void SetNumStr(const OUString &rStr)
Definition: fmtftn.hxx:76
static SwContentNode * GetContentNode(SwDoc *pDoc, SwNodeIndex &rIdx, bool bNext)
Definition: fltshell.cxx:54
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:57
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
virtual void SetInDoc(SwDoc *pDoc, bool) override
Definition: rolbck.cxx:730
bool IsEqual(const SwTOXMark &rCmp) const
Definition: rolbck.cxx:410
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:1218
bool IsEndNote() const
Definition: fmtftn.hxx:74
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1682
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: rolbck.cxx:1285
const SwTOXType * GetTOXType() const
Definition: tox.hxx:577
void SetFormatIgnoreEnd(bool bFlag)
Definition: txatbase.hxx:105
sal_Int32 m_nSepContent
Definition: rolbck.hxx:302
sal_uInt16 Which() const
Definition: txatbase.hxx:110
void SetPrev(SwFlyFrameFormat *pFormat)
Definition: atrfrm.cxx:2063
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:106
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(59)
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:297
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:739
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:379
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet)=0
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:430
virtual ~SwHistorySetText() override
Definition: rolbck.cxx:245
void AddDeleteFly(SwFrameFormat &, sal_uInt16 &rSetPos)
Definition: rolbck.cxx:1149
bool IsAlive(SwFrameFormat const *) const
not so fast check that given format is still alive (i.e. contained here)
Definition: docfmt.cxx:2130
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:3052
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
const SfxPoolItem * NextItem()
const sal_Int32 m_nStart
Definition: rolbck.hxx:172
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:184
OUString m_sName
SwHistoryChangeFormatColl(SwFormatColl *pColl, sal_uLong nNode, SwNodeType nNodeWhich)
Definition: rolbck.cxx:532
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
SwIndex nContent
Definition: pam.hxx:38
const sal_uLong m_nOldNodeIndex
Definition: rolbck.hxx:321
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:156
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo
Definition: rolbck.hxx:267
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
size_t pos
const IDocumentMarkAccess::MarkType m_eBkmkType
Definition: rolbck.hxx:266
History object containing all information used during undo / redo of checkbox and drop-down form fiel...
Definition: rolbck.hxx:272
SwFlyFrameFormat *const m_pPrevFormat
Definition: rolbck.hxx:331
const OUString & GetName() const
Definition: format.hxx:111
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:259
bool IsEqualBookmark(const ::sw::mark::IMark &rBkmk)
Definition: rolbck.cxx:715
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
bool IsStartNode() const
Definition: node.hxx:624
const OUString m_FootnoteNumber
Definition: rolbck.hxx:203
OUString m_aHideCondition
Definition: rolbck.hxx:257
SwHistoryChangeFlyChain(SwFlyFrameFormat &rFormat, const SwFormatChain &rAttr)
Definition: rolbck.cxx:959
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(161)
virtual OUString GetDescription() const override
Definition: rolbck.cxx:476
const sal_uLong m_nOtherNode
Definition: rolbck.hxx:260
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:1255
const SwTable & GetTable() const
Definition: node.hxx:497
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage table of content types.
Definition: doctxm.cxx:611
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
const SwModify * GetDefinedIn() const
Definition: cellatr.hxx:64
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
const sal_Int32 m_nContent
Definition: rolbck.hxx:282
const OUString m_sName
Definition: rolbck.hxx:295
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:576
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:766
virtual void SetShortName(const OUString &)=0
SwHistory *const m_pHistory
Definition: rolbck.hxx:415
std::unique_ptr< SfxPoolItem > m_pAttr
Definition: rolbck.hxx:94
Base class for various Writer styles.
Definition: format.hxx:43
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 std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark)=0
Deletes a mark.
const OUString & GetAlternativeText() const
Definition: tox.hxx:568
OUString m_aShortName
Definition: rolbck.hxx:255
SwHistoryTextFlyCnt(SwFrameFormat *const pFlyFormat)
Definition: rolbck.cxx:564
bool IsContentNode() const
Definition: node.hxx:628
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:928
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:414
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:422
SwFieldIds m_nFieldWhich
Definition: rolbck.hxx:142
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:221
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
const OUString m_aName
Definition: rolbck.hxx:254
virtual ~SwHistorySetTextField() override
Definition: rolbck.cxx:308
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:1300
SetAttrMode
Definition: swtypes.hxx:139
const sal_uLong m_nEndNode
Definition: rolbck.hxx:299
SwContentNode * GetContentNode()
Definition: node.hxx:615
const bool m_bEndNote
Definition: rolbck.hxx:206
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
sal_uLong m_nNodeIndex
Definition: rolbck.hxx:140
sal_uInt16 GetLevel() const
Definition: tox.hxx:633
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:108
SwDoc * GetDoc()
Definition: node.hxx:702
void RegisterToTOXType(SwTOXType &rMark)
Definition: tox.cxx:139
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2670
const sal_uLong m_nNodeIndex
Definition: rolbck.hxx:120
virtual void SetInDoc(SwDoc *pDoc, bool) override
Definition: rolbck.cxx:780
const OUString & GetTypeName() const
Definition: tox.hxx:695
void CopyFormatAttr(const SfxItemSet &rSet, sal_uLong nNodeIdx)
Definition: rolbck.cxx:1264
std::shared_ptr< MetadatableUndo > CreateUndo() const
const sal_Int32 m_nStart
Definition: rolbck.hxx:121
const sal_uLong m_nNode
Definition: rolbck.hxx:281
std::unique_ptr< SwUndoDelLayFormat > m_pUndo
Definition: rolbck.hxx:232
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:396
virtual ~SwHistorySetFootnote() override
Definition: rolbck.cxx:481
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:309
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:165
virtual void SetHideCondition(const OUString &)=0
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:485
void ResetInDoc(SwDoc *pDoc)
Definition: rolbck.cxx:748
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1225
SwFrameFormat & m_rFormat
Definition: rolbck.hxx:320
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:1028
attention: NOHINTADJUST prevents MergePortions! when using this need to pay attention to ignore start...
void AddChangeFlyAnchor(SwFrameFormat &rFormat)
Definition: rolbck.cxx:1143
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:404
const sal_Int32 m_nStart
Definition: rolbck.hxx:205
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
The Undo actions need to create new Shell cursors.
void ResetInDoc(SwDoc *pDoc)
Definition: rolbck.cxx:806
sal_uInt16 Count() const
Definition: rolbck.hxx:378
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
const OUString m_RefName
Definition: rolbck.hxx:155
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:768
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:1704
SwHistorySetTOXMark(const SwTextTOXMark *pTextHt, sal_uLong nNode)
Definition: rolbck.cxx:367
void AddHint(SwTextAttr *pHt, const bool bNew)
Definition: rolbck.cxx:1429
const sal_Int32 m_nOldContentIndex
Definition: rolbck.hxx:322
SwHistorySetRefMark(const SwTextRefMark *pTextHt, sal_uLong nNode)
Definition: rolbck.cxx:340
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:650
constexpr TypedWhichId< SwFormatChain > RES_CHAIN(114)
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:735
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:645
virtual const SwNode * GetNodeOfFormula() const override
Get node type of the node containing this formula.
Definition: cellatr.cxx:86
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:775
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:968
SwHistorySetAttrSet(const SfxItemSet &rSet, sal_uLong nNode, const std::set< sal_uInt16 > &rSetArr)
Definition: rolbck.cxx:822
const sal_Int32 m_nContent
Definition: rolbck.hxx:261
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: rolbck.cxx:584
const sal_Int32 m_nEnd
Definition: rolbck.hxx:186
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual ~SwHistoryTextFlyCnt() override
Definition: rolbck.cxx:572
void MakeSetWhichIds()
Definition: rolbck.cxx:1508
SwNodes & GetNodes()
Definition: doc.hxx:403
SfxItemSet m_OldSet
Definition: rolbck.hxx:307
SwTOXMark m_TOXMark
Definition: rolbck.hxx:168
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:249
sal_uLong m_nSepNode
Definition: rolbck.hxx:301
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
sal_uInt16 SetTmpEnd(sal_uInt16 nTmpEnd)
Definition: rolbck.cxx:1243
SwFlyFrameFormat *const m_pFlyFormat
Definition: rolbck.hxx:333
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:343
SwFlyFrameFormat *const m_pNextFormat
Definition: rolbck.hxx:332
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
const OUString m_sType
Definition: rolbck.hxx:296
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:541
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
const sal_Int32 m_nStartContent
Definition: rolbck.hxx:298
~SwHistory()
Definition: rolbck.cxx:1024
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:164
SwFrameFormat * ClaimFrameFormat()
Definition: swtable.cxx:1707
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
TOXTypes GetType() const
Definition: tox.hxx:698
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
virtual void SetInDoc(SwDoc *pDoc, bool) override
Definition: rolbck.cxx:634
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:352
bool InsertHint(SwTextAttr *const pAttr, const SetAttrMode nMode=SetAttrMode::DEFAULT)
Insert pAttr into hints array.
Definition: thints.cxx:1290
const bool m_bSaveOtherPos
Definition: rolbck.hxx:264
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:258
void SetNext(SwFlyFrameFormat *pFormat)
Definition: atrfrm.cxx:2071
RndStdIds
bool IsTableNode() const
Definition: node.hxx:640
const sal_Int32 m_nEnd
Definition: rolbck.hxx:173
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: rolbck.cxx:1381
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:893
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:620
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:1434
bool IsInvalidItem(const SfxPoolItem *pItem)
SwHistoryBookmark(const ::sw::mark::IMark &rBkmk, bool bSavePos, bool bSaveOtherPos)
Definition: rolbck.cxx:597
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
SwFormatColl *const m_pColl
Definition: rolbck.hxx:220
virtual bool IsExpanded() const =0
const SwNodeType m_nNodeType
Definition: rolbck.hxx:222
sal_uInt16 m_nEndDiff
Definition: rolbck.hxx:357
std::vector< sal_uInt16 > m_ResetArray
Definition: rolbck.hxx:308
::sw::IShellCursorSupplier * GetIShellCursorSupplier()
Definition: doccorr.cxx:350
bool m_bFormatIgnoreStart
Definition: rolbck.hxx:123
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:69
void RestoreMetadata(std::shared_ptr< MetadatableUndo > const &i_pUndo)
sal_uLong m_nNodeIndex
Definition: rolbck.hxx:204
SwHistoryChangeFlyAnchor(SwFrameFormat &rFormat)
Definition: rolbck.cxx:918
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
sal_uInt16 Which() const
virtual void SetInDoc(SwDoc *pDoc, bool bTmpSet) override
Definition: rolbck.cxx:1007
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
const SfxPoolItem * GetCurItem() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
sal_uLong m_nNodeIndex
Definition: rolbck.hxx:416
SwRegHistory(SwHistory *pHst)
Definition: rolbck.cxx:1356
const sal_Int32 m_nOtherContent
Definition: rolbck.hxx:262
SwpHints & GetOrCreateSwpHints()
Definition: ndtxt.hxx:821
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