LibreOffice Module sw (master)  1
unattr.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 <sal/config.h>
21 
22 #include <utility>
23 
24 #include <UndoAttribute.hxx>
25 #include <svl/itemiter.hxx>
26 #include <editeng/tstpitem.hxx>
27 #include <svx/svdobj.hxx>
28 #include <osl/diagnose.h>
29 #include <hintids.hxx>
30 #include <fmtflcnt.hxx>
31 #include <txtftn.hxx>
32 #include <fmtanchr.hxx>
33 #include <fmtfsize.hxx>
34 #include <frmfmt.hxx>
35 #include <fmtcntnt.hxx>
36 #include <ftnidx.hxx>
37 #include <doc.hxx>
40 #include <IShellCursorSupplier.hxx>
41 #include <docary.hxx>
42 #include <swcrsr.hxx>
43 #include <swundo.hxx>
44 #include <pam.hxx>
45 #include <ndtxt.hxx>
46 #include <swtable.hxx>
47 #include <swtblfmt.hxx>
48 #include <UndoCore.hxx>
49 #include <hints.hxx>
50 #include <rolbck.hxx>
51 #include <ndnotxt.hxx>
52 #include <ftninfo.hxx>
53 #include <redline.hxx>
54 #include <section.hxx>
55 #include <charfmt.hxx>
56 #include <calbck.hxx>
57 #include <frameformats.hxx>
58 
60  : SwClient(&rFormat)
61  , m_rFormat(rFormat)
62  , m_bSaveDrawPt(bSvDrwPt)
63 {
64 }
65 
67 {
68  if (rHint.GetId() != SfxHintId::SwLegacyModify)
69  return;
70  auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
71  if(!pLegacy->m_pOld)
72  return;
73  assert(pLegacy->m_pOld->Which() != RES_OBJECTDYING);
74  if(!pLegacy->m_pNew)
75  return;
76  const SwDoc& rDoc = *m_rFormat.GetDoc();
77  auto pOld = pLegacy->m_pOld;
78  if(POOLATTR_END >= pLegacy->m_pOld->Which()) {
79  if(!GetUndo())
80  m_pUndo.reset(new SwUndoFormatAttr(*pOld, m_rFormat, m_bSaveDrawPt));
81  else
82  m_pUndo->PutAttr(*pOld, rDoc);
83  } else if(RES_ATTRSET_CHG == pOld->Which()) {
84  auto& rChgSet = *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet();
85  if(!GetUndo())
87  else {
88  SfxItemIter aIter(rChgSet);
89  for(auto pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
90  m_pUndo->PutAttr(*pItem, rDoc);
91  }
92  }
93 }
94 
96  SwFormat& rChgFormat,
97  bool bSaveDrawPt )
98  : SwUndo( SwUndoId::INSFMTATTR, rChgFormat.GetDoc() )
99  , m_sFormatName ( rChgFormat.GetName() )
100  // #i56253#
101  , m_oOldSet( std::move( rOldSet ) )
102  , m_nNodeIndex( 0 )
103  , m_nFormatWhich( rChgFormat.Which() )
104  , m_bSaveDrawPt( bSaveDrawPt )
105 {
106  assert(m_sFormatName.getLength());
107 
108  Init( rChgFormat );
109 }
110 
112  bool bSaveDrawPt )
113  : SwUndo( SwUndoId::INSFMTATTR, rChgFormat.GetDoc() )
114  , m_sFormatName(rChgFormat.GetName())
115  , m_oOldSet( rChgFormat.GetAttrSet().CloneAsValue( false ) )
116  , m_nNodeIndex( 0 )
117  , m_nFormatWhich( rChgFormat.Which() )
118  , m_bSaveDrawPt( bSaveDrawPt )
119 {
120  assert(m_sFormatName.getLength());
121 
122  m_oOldSet->Put( rItem );
123  Init( rChgFormat );
124 }
125 
126 void SwUndoFormatAttr::Init( const SwFormat & rFormat )
127 {
128  // tdf#126017 never save SwNodeIndex, it will go stale
129  m_oOldSet->ClearItem(RES_CNTNT);
130  // treat change of anchor specially
131  if ( SfxItemState::SET == m_oOldSet->GetItemState( RES_ANCHOR, false )) {
132  SaveFlyAnchor( &rFormat, m_bSaveDrawPt );
133  } else if ( RES_FRMFMT == m_nFormatWhich ) {
134  const SwDoc* pDoc = rFormat.GetDoc();
135  if (pDoc->GetTableFrameFormats()->ContainsFormat(dynamic_cast<const SwFrameFormat&>(rFormat)))
136  {
137  // Table Format: save table position, table formats are volatile!
138  SwTable * pTable = SwIterator<SwTable,SwFormat>( rFormat ).First();
139  if ( pTable ) {
140  m_nNodeIndex = pTable->GetTabSortBoxes()[ 0 ]->GetSttNd()
141  ->FindTableNode()->GetIndex();
142  }
143  } else if (dynamic_cast<const SwSectionFormat*>(&rFormat)) {
145  } else if(auto pBoxFormat = dynamic_cast<const SwTableBoxFormat*>(&rFormat))
146  {
147  auto pTableBox = pBoxFormat->GetTableBox();
148  if(pTableBox)
149  m_nNodeIndex = pTableBox->GetSttIdx();
150  }
151  }
152 }
153 
155 {
156 }
157 
159 {
160  // OD 2004-10-26 #i35443#
161  // Important note: <Undo(..)> also called by <ReDo(..)>
162 
163  if (!m_oOldSet)
164  return;
165 
166  SwFormat * pFormat = GetFormat(rContext.GetDoc());
167  if (!pFormat)
168  return;
169 
170  // #i35443# - If anchor attribute has been successful
171  // restored, all other attributes are also restored.
172  // Thus, keep track of its restoration
173  bool bAnchorAttrRestored( false );
174  if ( SfxItemState::SET == m_oOldSet->GetItemState( RES_ANCHOR, false )) {
175  bAnchorAttrRestored = RestoreFlyAnchor(rContext);
176  if ( bAnchorAttrRestored ) {
177  // Anchor attribute successful restored.
178  // Thus, keep anchor position for redo
179  SaveFlyAnchor(pFormat);
180  } else {
181  // Anchor attribute not restored due to invalid anchor position.
182  // Thus, delete anchor attribute.
183  m_oOldSet->ClearItem( RES_ANCHOR );
184  }
185  }
186 
187  if ( bAnchorAttrRestored ) return;
188 
189  SwUndoFormatAttrHelper aTmp( *pFormat, m_bSaveDrawPt );
190  pFormat->SetFormatAttr( *m_oOldSet );
191  if ( aTmp.GetUndo() ) {
192  // transfer ownership of helper object's old set
193  if (aTmp.GetUndo()->m_oOldSet)
194  m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
195  else
196  m_oOldSet.reset();
197  } else {
198  m_oOldSet->ClearItem();
199  }
200 
202  rContext.SetSelections(static_cast<SwFrameFormat*>(pFormat), nullptr);
203  }
204 }
205 
206 // Check if it is still in Doc
208 {
209  switch (m_nFormatWhich)
210  {
211  case RES_TXTFMTCOLL:
212  case RES_CONDTXTFMTCOLL:
214 
215  case RES_GRFFMTCOLL:
217 
218  case RES_CHRFMT:
219  return rDoc.FindCharFormatByName(m_sFormatName);
220 
221  case RES_FRMFMT:
222  if (m_nNodeIndex && (m_nNodeIndex < rDoc.GetNodes().Count()))
223  {
224  SwNode* pNd = rDoc.GetNodes()[m_nNodeIndex];
225  if (pNd->IsTableNode())
226  {
227  return static_cast<SwTableNode*>(pNd)->GetTable().GetFrameFormat();
228  }
229  else if (pNd->IsSectionNode())
230  {
231  return static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat();
232  }
233  else if (pNd->IsStartNode() && (SwTableBoxStartNode ==
234  static_cast<SwStartNode*>(pNd)->GetStartNodeType()))
235  {
236  SwTableNode* pTableNode = pNd->FindTableNode();
237  if (pTableNode)
238  {
239  SwTableBox* pBox = pTableNode->GetTable().GetTableBox(m_nNodeIndex);
240  if (pBox)
241  {
242  return pBox->GetFrameFormat();
243  }
244  }
245  }
246  }
247  [[fallthrough]];
248  case RES_DRAWFRMFMT:
249  case RES_FLYFRMFMT:
250  {
252  if (pFormat)
253  return pFormat;
255  if (pFormat)
256  return pFormat;
257  }
258  break;
259  }
260 
261  return nullptr;
262 }
263 
265 {
266  // #i35443# - Because the undo stores the attributes for
267  // redo, the same code as for <Undo(..)> can be applied for <Redo(..)>
268  UndoImpl(rContext);
269 }
270 
272 {
273  if (!m_oOldSet)
274  return;
275 
276  SwDoc & rDoc(rContext.GetDoc());
277 
278  SwFormat * pFormat = GetFormat(rDoc);
279  if (!pFormat)
280  return;
281 
282  switch ( m_nFormatWhich ) {
283  case RES_GRFFMTCOLL: {
284  SwNoTextNode *const pNd =
285  rContext.GetRepeatPaM().GetNode().GetNoTextNode();
286  if( pNd ) {
287  rDoc.SetAttr( pFormat->GetAttrSet(), *pNd->GetFormatColl() );
288  }
289  }
290  break;
291 
292  case RES_TXTFMTCOLL:
293  case RES_CONDTXTFMTCOLL:
294  {
295  SwTextNode *const pNd =
296  rContext.GetRepeatPaM().GetNode().GetTextNode();
297  if( pNd ) {
298  rDoc.SetAttr( pFormat->GetAttrSet(), *pNd->GetFormatColl() );
299  }
300  }
301  break;
302 
303  case RES_FLYFRMFMT: {
304  // Check if the cursor is in a flying frame
305  // Steps: search in all FlyFrameFormats for the FlyContent attribute
306  // and validate if the cursor is in the respective section
307  SwFrameFormat *const pFly =
308  rContext.GetRepeatPaM().GetNode().GetFlyFormat();
309  if( pFly ) {
310  // Bug 43672: do not set all attributes!
311  if (SfxItemState::SET ==
312  pFormat->GetAttrSet().GetItemState( RES_CNTNT )) {
313  SfxItemSet aTmpSet( pFormat->GetAttrSet() );
314  aTmpSet.ClearItem( RES_CNTNT );
315  if( aTmpSet.Count() ) {
316  rDoc.SetAttr( aTmpSet, *pFly );
317  }
318  } else {
319  rDoc.SetAttr( pFormat->GetAttrSet(), *pFly );
320  }
321  }
322  break;
323  }
324  }
325 }
326 
328 {
329  SwRewriter aRewriter;
330 
331  aRewriter.AddRule(UndoArg1, m_sFormatName);
332 
333  return aRewriter;
334 }
335 
336 void SwUndoFormatAttr::PutAttr( const SfxPoolItem& rItem, const SwDoc& rDoc )
337 {
338  if (RES_CNTNT == rItem.Which())
339  {
340  return; // tdf#126017 never save SwNodeIndex, it will go stale
341  }
342  m_oOldSet->Put( rItem );
343  if ( RES_ANCHOR == rItem.Which() )
344  {
345  SwFormat * pFormat = GetFormat( rDoc );
346  SaveFlyAnchor( pFormat, m_bSaveDrawPt );
347  }
348 }
349 
350 void SwUndoFormatAttr::SaveFlyAnchor( const SwFormat * pFormat, bool bSvDrwPt )
351 {
352  // Format is valid, otherwise you would not reach this point here
353  if( bSvDrwPt ) {
354  if ( RES_DRAWFRMFMT == pFormat->Which() ) {
355  Point aPt( static_cast<const SwFrameFormat*>(pFormat)->FindSdrObject()
356  ->GetRelativePos() );
357  // store old value as attribute, to keep SwUndoFormatAttr small
358  m_oOldSet->Put( SwFormatFrameSize( SwFrameSize::Variable, aPt.X(), aPt.Y() ) );
359  }
360  }
361 
362  const SwFormatAnchor& rAnchor =
363  m_oOldSet->Get( RES_ANCHOR, false );
364  if( !rAnchor.GetContentAnchor() )
365  return;
366 
367  sal_Int32 nContent = 0;
368  switch( rAnchor.GetAnchorId() ) {
369  case RndStdIds::FLY_AS_CHAR:
370  case RndStdIds::FLY_AT_CHAR:
371  nContent = rAnchor.GetContentAnchor()->nContent.GetIndex();
372  [[fallthrough]];
373  case RndStdIds::FLY_AT_PARA:
374  case RndStdIds::FLY_AT_FLY:
376  break;
377  default:
378  return;
379  }
380 
381  SwFormatAnchor aAnchor( rAnchor.GetAnchorId(), nContent );
382  m_oOldSet->Put( aAnchor );
383 }
384 
385 // #i35443# - Add return value, type <bool>.
386 // Return value indicates, if anchor attribute is restored.
387 // Note: If anchor attribute is restored, all other existing attributes
388 // are also restored.
390 {
391  SwDoc *const pDoc = & rContext.GetDoc();
392  SwFrameFormat* pFrameFormat = static_cast<SwFrameFormat*>( GetFormat( *pDoc ) );
393  const SwFormatAnchor& rAnchor =
394  m_oOldSet->Get( RES_ANCHOR, false );
395 
396  SwFormatAnchor aNewAnchor( rAnchor.GetAnchorId() );
397  if (RndStdIds::FLY_AT_PAGE != rAnchor.GetAnchorId()) {
398  SwNode* pNd = pDoc->GetNodes()[ m_nNodeIndex ];
399 
400  if ( (RndStdIds::FLY_AT_FLY == rAnchor.GetAnchorId())
401  ? ( !pNd->IsStartNode() || (SwFlyStartNode !=
402  static_cast<SwStartNode*>(pNd)->GetStartNodeType()) )
403  : !pNd->IsTextNode() ) {
404  // #i35443# - invalid position.
405  // Thus, anchor attribute not restored
406  return false;
407  }
408 
409  SwPosition aPos( *pNd );
410  if ((RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()) ||
411  (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId())) {
412  aPos.nContent.Assign( static_cast<SwTextNode*>(pNd), rAnchor.GetPageNum() );
413  if ( aPos.nContent.GetIndex() > pNd->GetTextNode()->GetText().getLength()) {
414  // #i35443# - invalid position.
415  // Thus, anchor attribute not restored
416  return false;
417  }
418  }
419  aNewAnchor.SetAnchor( &aPos );
420  } else
421  aNewAnchor.SetPageNum( rAnchor.GetPageNum() );
422 
423  Point aDrawSavePt, aDrawOldPt;
425  if( RES_DRAWFRMFMT == pFrameFormat->Which() ) {
426  // get the old cached value
427  const SwFormatFrameSize& rOldSize = m_oOldSet->Get( RES_FRM_SIZE );
428  aDrawSavePt.setX( rOldSize.GetWidth() );
429  aDrawSavePt.setY( rOldSize.GetHeight() );
430  m_oOldSet->ClearItem( RES_FRM_SIZE );
431 
432  // write the current value into cache
433  aDrawOldPt = pFrameFormat->FindSdrObject()->GetRelativePos();
434  } else {
435  pFrameFormat->DelFrames(); // delete Frames
436  }
437  }
438 
439  const SwFormatAnchor &rOldAnch = pFrameFormat->GetAnchor();
440  // #i54336#
441  // Consider case, that as-character anchored object has moved its anchor position.
442  if (RndStdIds::FLY_AS_CHAR == rOldAnch.GetAnchorId()) {
443  // With InContents it's tricky: the text attribute needs to be deleted.
444  // Unfortunately, this not only destroys the Frames but also the format.
445  // To prevent that, first detach the connection between attribute and
446  // format.
447  const SwPosition *pPos = rOldAnch.GetContentAnchor();
448  SwTextNode *pTextNode = static_cast<SwTextNode*>(&pPos->nNode.GetNode());
449  OSL_ENSURE( pTextNode->HasHints(), "Missing FlyInCnt-Hint." );
450  const sal_Int32 nIdx = pPos->nContent.GetIndex();
451  SwTextAttr * const pHint =
452  pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
453  assert(pHint && "Missing Hint.");
454  OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
455  "Missing FlyInCnt-Hint." );
456  OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat,
457  "Wrong TextFlyCnt-Hint." );
458  const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat();
459 
460  // Connection is now detached, therefore the attribute can be deleted
461  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
462  }
463 
464  {
465  m_oOldSet->Put( aNewAnchor );
466  SwUndoFormatAttrHelper aTmp( *pFrameFormat, m_bSaveDrawPt );
467  pFrameFormat->SetFormatAttr( *m_oOldSet );
468  if ( aTmp.GetUndo() ) {
470  // transfer ownership of helper object's old set
471  if (aTmp.GetUndo()->m_oOldSet)
472  m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
473  else
474  m_oOldSet.reset();
475  } else {
476  m_oOldSet->ClearItem();
477  }
478  }
479 
480  if ( RES_DRAWFRMFMT == pFrameFormat->Which() )
481  {
482  // The Draw model also prepared an Undo object for its right positioning
483  // which unfortunately is relative. Therefore block here a position
484  // change of the Contact object by setting the anchor.
485  pFrameFormat->CallSwClientNotify(sw::RestoreFlyAnchorHint(aDrawSavePt));
486  // cache the old value again
487  m_oOldSet->Put(SwFormatFrameSize(SwFrameSize::Variable, aDrawOldPt.X(), aDrawOldPt.Y()));
488  }
489 
490  if (RndStdIds::FLY_AS_CHAR == aNewAnchor.GetAnchorId()) {
491  const SwPosition* pPos = aNewAnchor.GetContentAnchor();
492  SwTextNode* pTextNd = pPos->nNode.GetNode().GetTextNode();
493  OSL_ENSURE( pTextNd, "no Text Node at position." );
494  SwFormatFlyCnt aFormat( pFrameFormat );
495  pTextNd->InsertItem( aFormat, pPos->nContent.GetIndex(), 0 );
496  }
497 
498  if (RES_DRAWFRMFMT != pFrameFormat->Which())
499  pFrameFormat->MakeFrames();
500  else
501  {
503  }
504 
505  rContext.SetSelections(pFrameFormat, nullptr);
506 
507  // #i35443# - anchor attribute restored.
508  return true;
509 }
510 
512  const sal_uInt16 nWhichId )
513  : SwUndo( SwUndoId::RESETATTR, rChangedFormat.GetDoc() )
514  , m_pChangedFormat( &rChangedFormat )
515  , m_nWhichId( nWhichId )
516 {
517  const SfxPoolItem* pItem = nullptr;
518  if (rChangedFormat.GetItemState(nWhichId, false, &pItem ) == SfxItemState::SET && pItem) {
519  m_pOldItem.reset( pItem->Clone() );
520  }
521 }
522 
524 {
525 }
526 
528 {
529  if (m_pOldItem)
530  {
532  }
533 }
534 
536 {
537  if (m_pOldItem)
538  {
540  }
541 }
542 
543 SwUndoResetAttr::SwUndoResetAttr( const SwPaM& rRange, sal_uInt16 nFormatId )
544  : SwUndo( SwUndoId::RESETATTR, &rRange.GetDoc() ), SwUndRng( rRange )
545  , m_pHistory( new SwHistory )
546  , m_nFormatId( nFormatId )
547 {
548 }
549 
550 SwUndoResetAttr::SwUndoResetAttr( const SwPosition& rPos, sal_uInt16 nFormatId )
551  : SwUndo( SwUndoId::RESETATTR, &rPos.GetDoc() )
552  , m_pHistory( new SwHistory )
553  , m_nFormatId( nFormatId )
554 {
555  m_nSttNode = m_nEndNode = rPos.nNode.GetIndex();
557 }
558 
560 {
561 }
562 
564 {
565  // reset old values
566  SwDoc & rDoc = rContext.GetDoc();
567  m_pHistory->TmpRollback( &rDoc, 0 );
568  m_pHistory->SetTmpEnd( m_pHistory->Count() );
569 
570  if ((RES_CONDTXTFMTCOLL == m_nFormatId) &&
572  SwTextNode* pTNd = rDoc.GetNodes()[ m_nSttNode ]->GetTextNode();
573  if( pTNd ) {
574  SwIndex aIdx( pTNd, m_nSttContent );
575  pTNd->DontExpandFormat( aIdx, false );
576  }
577  }
578 
579  AddUndoRedoPaM(rContext);
580 }
581 
583 {
584  SwDoc & rDoc = rContext.GetDoc();
585  SwPaM & rPam = AddUndoRedoPaM(rContext);
586 
587  switch ( m_nFormatId ) {
588  case RES_CHRFMT:
589  rDoc.RstTextAttrs(rPam);
590  break;
591  case RES_TXTFMTCOLL:
592  rDoc.ResetAttrs(rPam, false, m_Ids );
593  break;
594  case RES_CONDTXTFMTCOLL:
595  rDoc.ResetAttrs(rPam, true, m_Ids );
596 
597  break;
598  case RES_TXTATR_TOXMARK:
599  // special treatment for TOXMarks
600  {
602  SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode );
603  SwPosition aPos( aIdx, SwIndex( aIdx.GetNode().GetContentNode(),
604  m_nSttContent ));
605 
606  sal_uInt16 nCnt = SwDoc::GetCurTOXMark( aPos, aArr );
607  if( nCnt ) {
608  if( 1 < nCnt ) {
609  // search for the right one
610  SwHistoryHint* pHHint = (GetHistory())[ 0 ];
611  if( pHHint && HSTRY_SETTOXMARKHNT == pHHint->Which() ) {
612  while( nCnt ) {
613  if ( static_cast<SwHistorySetTOXMark*>(pHHint)
614  ->IsEqual( *aArr[ --nCnt ] ) ) {
615  ++nCnt;
616  break;
617  }
618  }
619  } else
620  nCnt = 0;
621  }
622  // found one, thus delete it
623  if( nCnt-- ) {
624  rDoc.DeleteTOXMark( aArr[ nCnt ] );
625  }
626  }
627  }
628  break;
629  }
630 }
631 
633 {
634  if (m_nFormatId < RES_FMT_BEGIN) {
635  return;
636  }
637 
638  switch ( m_nFormatId ) {
639  case RES_CHRFMT:
640  rContext.GetDoc().RstTextAttrs(rContext.GetRepeatPaM());
641  break;
642  case RES_TXTFMTCOLL:
643  rContext.GetDoc().ResetAttrs(rContext.GetRepeatPaM(), false, m_Ids);
644  break;
645  case RES_CONDTXTFMTCOLL:
646  rContext.GetDoc().ResetAttrs(rContext.GetRepeatPaM(), true, m_Ids);
647  break;
648  }
649 }
650 
652 {
653  m_Ids = std::move(rAttrs);
654 }
655 
656 SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr,
657  const SetAttrMode nFlags )
658  : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange )
659  , m_AttrSet( rRange.GetDoc().GetAttrPool(), rAttr.Which(), rAttr.Which() )
660  , m_pHistory( new SwHistory )
661  , m_nNodeIndex( ULONG_MAX )
662  , m_nInsertFlags( nFlags )
663 {
664  m_AttrSet.Put( rAttr );
665 
666  // Save character style as a style name, not as a reference
668  if (pItem)
669  {
670  uno::Any aValue;
671  pItem->QueryValue(aValue, RES_TXTATR_CHARFMT);
672  aValue >>= m_aChrFormatName;
673  }
674 }
675 
676 SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxItemSet& rSet,
677  const SetAttrMode nFlags )
678  : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange )
679  , m_AttrSet( rSet )
680  , m_pHistory( new SwHistory )
681  , m_nNodeIndex( ULONG_MAX )
682  , m_nInsertFlags( nFlags )
683 {
684  // Save character style as a style name, not as a reference
686  if (pItem)
687  {
688  uno::Any aValue;
689  pItem->QueryValue(aValue, RES_TXTATR_CHARFMT);
690  aValue >>= m_aChrFormatName;
691  }
692 }
693 
695 {
696 }
697 
698 void SwUndoAttr::SaveRedlineData( const SwPaM& rPam, bool bIsContent )
699 {
700  SwDoc& rDoc = rPam.GetDoc();
701  if ( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) {
702  m_pRedlineData.reset( new SwRedlineData( bIsContent
703  ? RedlineType::Insert
704  : RedlineType::Format,
706  }
707 
710  m_pRedlineSaveData.reset();
711 
713  if ( bIsContent ) {
714  m_nNodeIndex = rPam.GetPoint()->nNode.GetIndex();
715  }
716 }
717 
719 {
720  SwDoc *const pDoc = & rContext.GetDoc();
721 
722  RemoveIdx( *pDoc );
723 
725  SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
726  if ( ULONG_MAX != m_nNodeIndex ) {
727  aPam.DeleteMark();
728  aPam.GetPoint()->nNode = m_nNodeIndex;
729  aPam.GetPoint()->nContent.Assign( aPam.GetContentNode(), m_nSttContent );
730  aPam.SetMark();
731  ++aPam.GetPoint()->nContent;
732  pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Any);
733  } else {
734  // remove all format redlines, will be recreated if needed
735  SetPaM(aPam);
736  pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Format);
737  if (m_pRedlineSaveData)
738  {
739  SetSaveData( *pDoc, *m_pRedlineSaveData );
740  }
741  }
742  }
743 
744  const bool bToLast = (1 == m_AttrSet.Count())
745  && (RES_TXTATR_FIELD <= m_AttrSet.GetRanges()[0].first)
746  && (m_AttrSet.GetRanges()[0].first <= RES_TXTATR_ANNOTATION);
747 
748  // restore old values
749  m_pHistory->TmpRollback( pDoc, 0, !bToLast );
750  m_pHistory->SetTmpEnd( m_pHistory->Count() );
751 
752  // set cursor onto Undo area
753  AddUndoRedoPaM(rContext);
754 }
755 
757 {
758  // RefMarks are not repeat capable
759  if ( SfxItemState::SET != m_AttrSet.GetItemState( RES_TXTATR_REFMARK, false ) ) {
762  } else if ( 1 < m_AttrSet.Count() ) {
763  SfxItemSet aTmpSet( m_AttrSet );
764  aTmpSet.ClearItem( RES_TXTATR_REFMARK );
766  aTmpSet, m_nInsertFlags );
767  }
768 }
769 
771 {
772  SwDoc & rDoc = rContext.GetDoc();
773  SwPaM & rPam = AddUndoRedoPaM(rContext);
774 
775  // Restore pointer to char format from name
776  if (!m_aChrFormatName.isEmpty())
777  {
779  if (pCharFormat)
780  {
781  SwFormatCharFormat aFormat(pCharFormat);
782  m_AttrSet.Put(aFormat);
783  }
784  }
785 
786  if ( m_pRedlineData &&
791 
792  if ( ULONG_MAX != m_nNodeIndex ) {
793  rPam.SetMark();
794  if ( rPam.Move( fnMoveBackward ) ) {
796  true);
797  }
798  rPam.DeleteMark();
799  } else {
801  }
802 
804  } else {
806  }
807 }
808 
810 {
811  if ( SfxItemState::SET != m_AttrSet.GetItemState( RES_TXTATR_FTN, false ))
812  return ;
813 
814  SwNodes& rNds = rDoc.GetNodes();
815  for ( sal_uInt16 n = 0; n < m_pHistory->Count(); ++n ) {
816  sal_Int32 nContent = 0;
817  sal_uLong nNode = 0;
818  SwHistoryHint* pHstHint = (*m_pHistory)[ n ];
819  switch ( pHstHint->Which() ) {
820  case HSTRY_RESETTXTHNT: {
821  SwHistoryResetText * pHistoryHint
822  = static_cast<SwHistoryResetText*>(pHstHint);
823  if ( RES_TXTATR_FTN == pHistoryHint->GetWhich() ) {
824  nNode = pHistoryHint->GetNode();
825  nContent = pHistoryHint->GetContent();
826  }
827  }
828  break;
829 
830  default:
831  break;
832  }
833 
834  if( nNode ) {
835  SwTextNode* pTextNd = rNds[ nNode ]->GetTextNode();
836  if( pTextNd ) {
837  SwTextAttr *const pTextHt =
838  pTextNd->GetTextAttrForCharAt(nContent, RES_TXTATR_FTN);
839  if( pTextHt ) {
840  // ok, so get values
841  SwTextFootnote* pFootnote = static_cast<SwTextFootnote*>(pTextHt);
842  RemoveIdxFromSection( rDoc, pFootnote->GetStartNode()->GetIndex() );
843  return ;
844  }
845  }
846  }
847  }
848 }
849 
851  : SwUndo( SwUndoId::SETDEFTATTR, &rDoc )
852 {
853  const SfxPoolItem* pItem;
854  if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_TABSTOP, false, &pItem ) ) {
855  // store separately, because it may change!
857  if ( 1 != rSet.Count() ) { // are there more attributes?
858  m_oOldSet.emplace( rSet );
859  }
860  } else {
861  m_oOldSet.emplace( rSet );
862  }
863 }
864 
866 {
867 }
868 
870 {
871  SwDoc & rDoc = rContext.GetDoc();
872  if (m_oOldSet)
873  {
875  *rDoc.GetDfltTextFormatColl() );
876  rDoc.SetDefault( *m_oOldSet );
877  m_oOldSet.reset();
878  if ( aTmp.GetUndo() ) {
879  // transfer ownership of helper object's old set
880  if (aTmp.GetUndo()->m_oOldSet)
881  m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
882  }
883  }
884  if (m_pTabStop)
885  {
886  std::unique_ptr<SvxTabStopItem> pOld(rDoc.GetDefault(RES_PARATR_TABSTOP).Clone());
887  rDoc.SetDefault( *m_pTabStop );
888  m_pTabStop = std::move( pOld );
889  }
890 }
891 
893 {
894  UndoImpl(rContext);
895 }
896 
898  const SwPaM& rPam, bool bFlag, bool bMod )
899  : SwUndo( bFlag ? SwUndoId::INC_LEFTMARGIN : SwUndoId::DEC_LEFTMARGIN, &rPam.GetDoc() )
900  , SwUndRng( rPam )
901  , m_pHistory( new SwHistory )
902  , m_bModulus( bMod )
903 {
904 }
905 
907 {
908 }
909 
911 {
912  SwDoc & rDoc = rContext.GetDoc();
913 
914  // restore old values
915  m_pHistory->TmpRollback( & rDoc, 0 );
916  m_pHistory->SetTmpEnd( m_pHistory->Count() );
917 
918  AddUndoRedoPaM(rContext);
919 }
920 
922 {
923  SwDoc & rDoc = rContext.GetDoc();
924  SwPaM & rPam = AddUndoRedoPaM(rContext);
925 
926  rDoc.MoveLeftMargin( rPam,
929 }
930 
932 {
933  SwDoc & rDoc = rContext.GetDoc();
936 }
937 
939  const SwPaM& rRange, const OUString& rText,
940  bool const bIsEndNote)
941  : SwUndo( SwUndoId::CHGFTN, &rRange.GetDoc() ), SwUndRng( rRange )
942  , m_pHistory( new SwHistory() )
943  , m_Text( rText )
944  , m_bEndNote( bIsEndNote )
945 {
946 }
947 
949 {
950 }
951 
953 {
954  SwDoc & rDoc = rContext.GetDoc();
955 
956  m_pHistory->TmpRollback( &rDoc, 0 );
957  m_pHistory->SetTmpEnd( m_pHistory->Count() );
958 
960 
961  AddUndoRedoPaM(rContext);
962 }
963 
965 {
966  SwDoc & rDoc( rContext.GetDoc() );
967  SwPaM & rPaM = AddUndoRedoPaM(rContext);
968  rDoc.SetCurFootnote(rPaM, m_Text, m_bEndNote);
969  SetPaM(rPaM);
970 }
971 
973 {
974  SwDoc & rDoc = rContext.GetDoc();
975  rDoc.SetCurFootnote(rContext.GetRepeatPaM(), m_Text, m_bEndNote);
976 }
977 
979  : SwUndo( SwUndoId::FTNINFO, &rDoc )
980  , m_pFootNoteInfo( new SwFootnoteInfo( rInfo ) )
981 {
982 }
983 
985 {
986 }
987 
989 {
990  SwDoc & rDoc = rContext.GetDoc();
991  SwFootnoteInfo *pInf = new SwFootnoteInfo( rDoc.GetFootnoteInfo() );
993  m_pFootNoteInfo.reset( pInf );
994 }
995 
997 {
998  SwDoc & rDoc = rContext.GetDoc();
999  SwFootnoteInfo *pInf = new SwFootnoteInfo( rDoc.GetFootnoteInfo() );
1001  m_pFootNoteInfo.reset( pInf );
1002 }
1003 
1005  : SwUndo( SwUndoId::FTNINFO, &rDoc )
1006  , m_pEndNoteInfo( new SwEndNoteInfo( rInfo ) )
1007 {
1008 }
1009 
1011 {
1012 }
1013 
1015 {
1016  SwDoc & rDoc = rContext.GetDoc();
1017  SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
1018  rDoc.SetEndNoteInfo( *m_pEndNoteInfo );
1019  m_pEndNoteInfo.reset( pInf );
1020 }
1021 
1023 {
1024  SwDoc & rDoc = rContext.GetDoc();
1025  SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
1026  rDoc.SetEndNoteInfo( *m_pEndNoteInfo );
1027  m_pEndNoteInfo.reset( pInf );
1028 }
1029 
1031  : SwUndo( SwUndoId::DONTEXPAND, &rPos.GetDoc() )
1032  , m_nNodeIndex( rPos.nNode.GetIndex() )
1033  , m_nContentIndex( rPos.nContent.GetIndex() )
1034 {
1035 }
1036 
1038 {
1039  SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
1040  SwDoc *const pDoc = & rContext.GetDoc();
1041 
1042  SwPosition& rPos = *pPam->GetPoint();
1043  rPos.nNode = m_nNodeIndex;
1045  pDoc->DontExpandFormat( rPos, false );
1046 }
1047 
1049 {
1050  SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
1051  SwDoc *const pDoc = & rContext.GetDoc();
1052 
1053  SwPosition& rPos = *pPam->GetPoint();
1054  rPos.nNode = m_nNodeIndex;
1056  pDoc->DontExpandFormat( rPos );
1057 }
1058 
1060 {
1061  SwPaM & rPam = rContext.GetRepeatPaM();
1062  SwDoc & rDoc = rContext.GetDoc();
1063  rDoc.DontExpandFormat( *rPam.GetPoint() );
1064 }
1065 
1066 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Starts a section of nodes in the document model.
Definition: node.hxx:312
virtual SwCursor & CreateNewShellCursor()=0
SwPaM & AddUndoRedoPaM(::sw::UndoRedoContext &, bool const bCorrToContent=false) const
Definition: undobj.cxx:110
const SwGrfFormatColls * GetGrfFormatColls() const
Definition: doc.hxx:806
SwUndoResetAttr(const SwPaM &, sal_uInt16 nFormatId)
Definition: unattr.cxx:543
tools::Long GetWidth() const
void DeleteMark()
Definition: pam.hxx:177
const sal_uInt16 m_nFormatWhich
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
virtual Value FindFormatByName(const OUString &rName) const override
Definition: docary.hxx:166
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
Definition: UndoCore.hxx:99
sal_uLong Count() const
Definition: ndarr.hxx:139
sal_uLong m_nNodeIndex
sal_uInt16 GetWhich() const
Definition: rolbck.hxx:195
Marks a position in the document model.
Definition: pam.hxx:35
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:892
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:921
std::unique_ptr< SfxPoolItem > m_pOldItem
std::optional< SfxItemSet > m_oOldSet
bool IsSectionNode() const
Definition: node.hxx:645
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1336
void SetFootnoteInfo(const SwFootnoteInfo &rInfo)
Definition: docftn.cxx:294
const OUString & GetText() const
Definition: ndtxt.hxx:218
virtual const SwRootFrame * GetCurrentLayout() const =0
SwUndoId
Definition: swundo.hxx:29
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4832
const sal_uLong m_nNodeIndex
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
const SwFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:811
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
SwUndoFootNoteInfo(const SwFootnoteInfo &rInfo, const SwDoc &rDoc)
Definition: unattr.cxx:978
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
static bool FillSaveDataForFormat(const SwPaM &, SwRedlineSaveDatas &)
Definition: undobj.cxx:1445
SwNodeIndex nNode
Definition: pam.hxx:37
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1037
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:799
o3tl::sorted_vector< sal_uInt16 > m_Ids
const std::unique_ptr< SwHistory > m_pHistory
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
SwUndoChangeFootNote(const SwPaM &rRange, const OUString &rText, bool bIsEndNote)
Definition: unattr.cxx:938
SwHistory & GetHistory()
sal_uIntPtr sal_uLong
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:129
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:46
virtual Point GetRelativePos() const
sal_uLong m_nEndNode
Definition: undobj.hxx:230
bool DontExpandFormat(const SwIndex &rIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
Definition: ndtxt.cxx:1570
sal_Int64 n
const WhichRangesContainer & GetRanges() const
Definition: doc.hxx:188
const std::unique_ptr< SwHistory > m_pHistory
const sal_uInt16 m_nFormatId
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(57)
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:120
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
SwNode & GetNode() const
Definition: ndindex.hxx:119
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
SfxItemSet m_AttrSet
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:271
sal_uInt16 Which() const
Definition: txatbase.hxx:114
static void RemoveIdxFromSection(SwDoc &, sal_uLong nSttIdx, const sal_uLong *pEndIdx=nullptr)
Definition: undobj.cxx:118
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:972
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:996
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
SwUndoId GetId() const
Definition: undobj.hxx:101
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(59)
std::unique_ptr< SvxTabStopItem > m_pTabStop
void SaveFlyAnchor(const SwFormat *pFormat, bool bSaveDrawPt=false)
Definition: unattr.cxx:350
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
SfxHintId GetId() const
IShellCursorSupplier & GetCursorSupplier()
Definition: UndoCore.hxx:97
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
void SetAttrs(o3tl::sorted_vector< sal_uInt16 > &&rAttrs)
Definition: unattr.cxx:651
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:3012
virtual ~SwUndoChangeFootNote() override
Definition: unattr.cxx:948
const SfxPoolItem * NextItem()
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
const SetAttrMode m_nInsertFlags
SwIndex nContent
Definition: pam.hxx:38
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const o3tl::sorted_vector< sal_uInt16 > &rAttrs=o3tl::sorted_vector< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
Definition: docfmt.cxx:242
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:776
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:127
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:666
void Init(const SwFormat &rFormat)
Definition: unattr.cxx:126
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:527
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1022
bool IsStartNode() const
Definition: node.hxx:625
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
Definition: thints.cxx:1270
const SwTable & GetTable() const
Definition: node.hxx:499
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr TypedWhichId< SwFrameFormat > RES_FRMFMT(155)
SwUndoMoveLeftMargin(const SwPaM &, bool bRight, bool bModulus)
Definition: unattr.cxx:897
void PutAttr(const SfxPoolItem &rItem, const SwDoc &rDoc)
Definition: unattr.cxx:336
SwDoc & GetDoc() const
Definition: UndoCore.hxx:95
SwUndoEndNoteInfo(const SwEndNoteInfo &rInfo, const SwDoc &rDoc)
Definition: unattr.cxx:1004
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:119
std::unique_ptr< SwFootnoteInfo > m_pFootNoteInfo
virtual ~SwUndoEndNoteInfo() override
Definition: unattr.cxx:1010
SwUndoFormatAttr * GetUndo() const
sal_uLong GetNode() const
Definition: rolbck.hxx:196
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:718
Base class for various Writer styles.
Definition: format.hxx:46
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:264
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:160
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:262
virtual std::size_t GetRedlineAuthor()=0
bool SetCurFootnote(const SwPaM &rPam, const OUString &rNumStr, bool bIsEndNote)
change footnotes in range
Definition: docftn.cxx:432
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:504
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Style of a layout element.
Definition: frmfmt.hxx:59
SwUndoDefaultAttr(const SfxItemSet &rOldSet, const SwDoc &rDoc)
Definition: unattr.cxx:850
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:988
bool RestoreFlyAnchor(::sw::UndoRedoContext &rContext)
Definition: unattr.cxx:389
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:931
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
T & StaticWhichCast(TypedWhichId< T > nId)
OUString m_aChrFormatName
const SwPosition * GetPoint() const
Definition: pam.hxx:207
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: unattr.cxx:66
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:535
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:158
void SaveRedlineData(const SwPaM &rPam, bool bInsContent)
Definition: unattr.cxx:698
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
constexpr TypedWhichId< SwGrfFormatColl > RES_GRFFMTCOLL(158)
virtual ~SwUndoMoveLeftMargin() override
Definition: unattr.cxx:906
const OUString m_Text
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1475
SetAttrMode
Definition: swtypes.hxx:133
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
SwContentNode * GetContentNode()
Definition: node.hxx:616
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
const SvxPageUsage aArr[]
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:96
sal_Int32 m_nEndContent
Definition: undobj.hxx:231
virtual ~SwUndoFormatResetAttr() override
Definition: unattr.cxx:523
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
const sal_uInt16 m_nWhichId
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2704
Marks a character position inside a document model node.
Definition: index.hxx:33
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
SwUndoAttr(const SwPaM &, const SfxItemSet &, const SetAttrMode nFlags)
Definition: unattr.cxx:676
SwUndoFormatResetAttr(SwFormat &rChangedFormat, const sal_uInt16 nWhichId)
Definition: unattr.cxx:511
const std::unique_ptr< SwHistory > m_pHistory
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:388
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(157)
Marks a node in the document model.
Definition: ndindex.hxx:31
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:444
virtual ~SwUndoFootNoteInfo() override
Definition: unattr.cxx:984
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
std::unique_ptr< SwRedlineData > m_pRedlineData
tools::Long GetHeight() const
SwFormat *const m_pChangedFormat
Represents the style of a text portion.
Definition: charfmt.hxx:26
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:756
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:112
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
std::unique_ptr< SwUndoFormatAttr > m_pUndo
void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark=false, bool bExactRange=false, SwRootFrame const *pLayout=nullptr)
Definition: docfmt.cxx:221
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
OUString m_sFormatName
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
sal_uLong m_nSttNode
Definition: undobj.hxx:230
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
ignore Redlines
virtual ~SwUndoResetAttr() override
Definition: unattr.cxx:559
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:771
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
Definition: docftn.cxx:365
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:540
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:952
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
Definition: thints.cxx:1719
void DeleteTOXMark(const SwTOXMark *pTOXMark)
Delete table of contents Mark.
Definition: doctxm.cxx:154
void MoveLeftMargin(const SwPaM &rPam, bool bRight, bool bModulus, SwRootFrame const *pLayout=nullptr)
Adjust left margin via object bar (similar to adjustment of numerations).
Definition: docfmt.cxx:1642
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:624
void RemoveIdx(SwDoc &rDoc)
Definition: unattr.cxx:809
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
constexpr sal_uInt16 RES_FMT_BEGIN(RES_UNKNOWNATR_END)
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:563
OUString m_Text
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1563
std::optional< SfxItemSet > m_oOldSet
void SetPaM(SwPaM &, bool bCorrToContent=false) const
Definition: undobj.cxx:82
sal_uLong m_nNodeIndex
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:582
static sal_uInt16 GetCurTOXMark(const SwPosition &rPos, SwTOXMarks &)
Get current table of contents Mark.
Definition: doctxm.cxx:116
std::unique_ptr< SwEndNoteInfo > m_pEndNoteInfo
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
Definition: docfmt.cxx:1706
constexpr TypedWhichId< SwCharFormat > RES_CHRFMT(RES_FMT_BEGIN)
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2715
SwUndoDontExpandFormat(const SwPosition &rPos)
Definition: unattr.cxx:1030
virtual bool IsRedlineOn() const =0
Query if redlining is on.
SwNodes & GetNodes()
Definition: doc.hxx:409
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:964
virtual ~SwUndoAttr() override
Definition: unattr.cxx:694
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:405
sal_Int32 GetContent() const
Definition: rolbck.hxx:197
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:770
HISTORY_HINT Which() const
Definition: rolbck.hxx:87
const bool m_bSaveDrawPt
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:1059
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1014
Format of a fly content.
Definition: fmtflcnt.hxx:32
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:326
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwFormat * GetFormat(const SwDoc &rDoc)
Definition: unattr.cxx:207
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:357
SwUndoFormatAttr(SfxItemSet &&rOldSet, SwFormat &rFormat, bool bSaveDrawPt)
Definition: unattr.cxx:95
SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:41
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:634
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
SwFrameFormat * GetFrameFormat() const
Definition: fmtflcnt.hxx:45
bool ContainsFormat(SwFrameFormat const &rFormat) const
fast check if given format is contained here pFormat must not have been deleted
Definition: docfmt.cxx:2154
bool IsTableNode() const
Definition: node.hxx:641
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:910
SwFormatColl * GetFormatColl() const
Definition: node.hxx:454
SwDoc & GetDoc() const
Definition: pam.hxx:243
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:478
virtual ~SwUndoFormatAttr() override
Definition: unattr.cxx:154
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
Frame is variable in Var-direction.
SwUndoFormatAttrHelper(SwFormat &rFormat, bool bSaveDrawPt=true)
Definition: unattr.cxx:59
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:738
void UpdateAllFootnote()
Definition: ftnidx.cxx:267
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
bool IsTextNode() const
Definition: node.hxx:637
virtual SwFrameFormat * FindFormatByName(const OUString &rName) const override
Definition: docfmt.cxx:2101
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:719
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:140
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:869
const sal_Int32 m_nContentIndex
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:630
sal_uInt16 Which() const
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:632
sal_Int32 m_nSttContent
Definition: undobj.hxx:231
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
const SfxPoolItem * GetCurItem() const
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: unattr.cxx:327
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:856
bool HasHints() const
Definition: ndtxt.hxx:228
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1048
virtual ~SwUndoDefaultAttr() override
Definition: unattr.cxx:865
const std::unique_ptr< SwHistory > m_pHistory
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:632
const SwFormatFlyCnt & GetFlyCnt() const
Definition: txatbase.hxx:210
Base class of the Writer document model elements.
Definition: node.hxx:80