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