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