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