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