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