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