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