LibreOffice Module sw (master)  1
undobj1.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 <svl/itemiter.hxx>
21 #include <svx/svdundo.hxx>
22 #include <hintids.hxx>
23 #include <hints.hxx>
24 #include <fmtflcnt.hxx>
25 #include <fmtanchr.hxx>
26 #include <fmtcntnt.hxx>
27 #include <txtflcnt.hxx>
28 #include <frmfmt.hxx>
29 #include <UndoCore.hxx>
30 #include <rolbck.hxx>
31 #include <doc.hxx>
33 #include <docary.hxx>
34 #include <rootfrm.hxx>
35 #include <swundo.hxx>
36 #include <pam.hxx>
37 #include <ndtxt.hxx>
38 #include <ndole.hxx>
39 
41  : SwUndo(nUndoId, pFormat->GetDoc())
42  , m_pFrameFormat(pFormat)
43  , m_nNodePagePos(0)
44  , m_nContentPos(0)
45  , m_nRndId(RndStdIds::FLY_AT_PARA)
46  , m_bDelFormat(false)
47 {
48 }
49 
51 {
52  if( m_bDelFormat ) // delete during an Undo?
53  {
55  { // clear that before delete
57  }
58  delete m_pFrameFormat;
59  }
60 }
61 
62 void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrame)
63 {
64  SwDoc *const pDoc = & rContext.GetDoc();
65 
66  // add again into array
67  SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
68  rFlyFormats.push_back( m_pFrameFormat );
69 
70  // OD 26.06.2003 #108784# - insert 'master' drawing object into drawing page
73 
74  SwFormatAnchor aAnchor( m_nRndId );
75 
76  if (RndStdIds::FLY_AT_PAGE == m_nRndId)
77  {
78  aAnchor.SetPageNum( static_cast<sal_uInt16>(m_nNodePagePos) );
79  }
80  else
81  {
82  SwPosition aNewPos(pDoc->GetNodes().GetEndOfContent());
83  aNewPos.nNode = m_nNodePagePos;
84  if ((RndStdIds::FLY_AS_CHAR == m_nRndId) || (RndStdIds::FLY_AT_CHAR == m_nRndId))
85  {
86  aNewPos.nContent.Assign( aNewPos.nNode.GetNode().GetContentNode(),
87  m_nContentPos );
88  }
89  aAnchor.SetAnchor( &aNewPos );
90  }
91 
92  m_pFrameFormat->SetFormatAttr( aAnchor ); // reset anchor
93 
95  {
96  // get Content and reset ContentAttribute
97  SwNodeIndex aIdx( pDoc->GetNodes() );
98  RestoreSection( pDoc, &aIdx, SwFlyStartNode );
99  m_pFrameFormat->SetFormatAttr( SwFormatContent( aIdx.GetNode().GetStartNode() ));
100  }
101 
102  // Set InContentAttribute not until there is content!
103  // Otherwise the layout would format the Fly beforehand but would not find
104  // content; this happened with graphics from the internet.
105  if (RndStdIds::FLY_AS_CHAR == m_nRndId)
106  {
107  // there must be at least the attribute in a TextNode
109  OSL_ENSURE( pCNd->IsTextNode(), "no Text Node at position." );
110  SwFormatFlyCnt aFormat( m_pFrameFormat );
112  }
113 
115  {
116  // recklessly assume that this thing will live longer than the
117  // SwUndoFlyBase - not sure what could be done if that isn't the case...
119  }
120 
122 
123  if( bShowSelFrame )
124  {
125  rContext.SetSelections(m_pFrameFormat, nullptr);
126  }
127 
128  if( GetHistory() )
129  GetHistory()->Rollback( pDoc );
130 
131  switch( m_nRndId )
132  {
133  case RndStdIds::FLY_AS_CHAR:
134  case RndStdIds::FLY_AT_CHAR:
135  {
136  const SwFormatAnchor& rAnchor = m_pFrameFormat->GetAnchor();
139  }
140  break;
141  case RndStdIds::FLY_AT_PARA:
142  case RndStdIds::FLY_AT_FLY:
143  {
144  const SwFormatAnchor& rAnchor = m_pFrameFormat->GetAnchor();
146  }
147  break;
148  case RndStdIds::FLY_AT_PAGE:
149  break;
150  default: break;
151  }
152  m_bDelFormat = false;
153 }
154 
156 {
157  m_bDelFormat = true; // delete Format in DTOR
158  m_pFrameFormat->DelFrames(); // destroy Frames
159 
161  { // tdf#108867 clear that pointer
163  }
164 
165  // all Uno objects should now log themselves off
166  {
168  m_pFrameFormat->ModifyNotification( &aMsgHint, &aMsgHint );
169  }
170 
171  if ( RES_DRAWFRMFMT != m_pFrameFormat->Which() )
172  {
173  // if there is content than save it
174  const SwFormatContent& rContent = m_pFrameFormat->GetContent();
175  OSL_ENSURE( rContent.GetContentIdx(), "Fly without content" );
176 
177  SaveSection( *rContent.GetContentIdx() );
178  const_cast<SwFormatContent&>(rContent).SetNewContentIdx( nullptr );
179  }
180  // OD 02.07.2003 #108784# - remove 'master' drawing object from drawing page
181  else
183 
184  const SwFormatAnchor& rAnchor = m_pFrameFormat->GetAnchor();
185  const SwPosition* pPos = rAnchor.GetContentAnchor();
186  // The positions in Nodes array got shifted.
187  m_nRndId = rAnchor.GetAnchorId();
188  if (RndStdIds::FLY_AS_CHAR == m_nRndId)
189  {
190  m_nNodePagePos = pPos->nNode.GetIndex();
191  m_nContentPos = pPos->nContent.GetIndex();
192  SwTextNode *const pTextNd = pPos->nNode.GetNode().GetTextNode();
193  OSL_ENSURE( pTextNd, "No Textnode found" );
194  SwTextFlyCnt* const pAttr = static_cast<SwTextFlyCnt*>(
196  // attribute is still in TextNode, delete
197  if( pAttr && pAttr->GetFlyCnt().GetFrameFormat() == m_pFrameFormat )
198  {
199  // Pointer to 0, do not delete
200  const_cast<SwFormatFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFormat();
201  SwIndex aIdx( pPos->nContent );
202  pTextNd->EraseText( aIdx, 1 );
203  }
204  }
205  else if (RndStdIds::FLY_AT_CHAR == m_nRndId)
206  {
207  m_nNodePagePos = pPos->nNode.GetIndex();
208  m_nContentPos = pPos->nContent.GetIndex();
209  }
210  else if ((RndStdIds::FLY_AT_PARA == m_nRndId) || (RndStdIds::FLY_AT_FLY == m_nRndId))
211  {
212  m_nNodePagePos = pPos->nNode.GetIndex();
213  }
214  else
215  {
216  m_nNodePagePos = rAnchor.GetPageNum();
217  }
218 
219  m_pFrameFormat->ResetFormatAttr( RES_ANCHOR ); // delete anchor
220 
221  // delete from array
222  SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
223  rFlyFormats.erase( m_pFrameFormat );
224 }
225 
226 SwUndoInsLayFormat::SwUndoInsLayFormat( SwFrameFormat* pFormat, sal_uLong nNodeIdx, sal_Int32 nCntIdx )
227  : SwUndoFlyBase( pFormat, RES_DRAWFRMFMT == pFormat->Which() ?
229  mnCursorSaveIndexPara( nNodeIdx ), mnCursorSaveIndexPos( nCntIdx )
230 {
231  const SwFormatAnchor& rAnchor = m_pFrameFormat->GetAnchor();
232  m_nRndId = rAnchor.GetAnchorId();
233  m_bDelFormat = false;
234  switch( m_nRndId )
235  {
236  case RndStdIds::FLY_AT_PAGE:
237  m_nNodePagePos = rAnchor.GetPageNum();
238  break;
239  case RndStdIds::FLY_AT_PARA:
240  case RndStdIds::FLY_AT_FLY:
242  break;
243  case RndStdIds::FLY_AS_CHAR:
244  case RndStdIds::FLY_AT_CHAR:
245  {
246  const SwPosition* pPos = rAnchor.GetContentAnchor();
247  m_nContentPos = pPos->nContent.GetIndex();
248  m_nNodePagePos = pPos->nNode.GetIndex();
249  }
250  break;
251  default:
252  OSL_FAIL( "Which FlyFrame?" );
253  }
254 }
255 
257 {
258 }
259 
261 {
262  SwDoc & rDoc(rContext.GetDoc());
263  const SwFormatContent& rContent = m_pFrameFormat->GetContent();
264  if( rContent.GetContentIdx() ) // no content
265  {
266  bool bRemoveIdx = true;
267  if( mnCursorSaveIndexPara > 0 )
268  {
269  SwTextNode *const pNode =
270  rDoc.GetNodes()[mnCursorSaveIndexPara]->GetTextNode();
271  if( pNode )
272  {
273  SwNodeIndex aIdx( rDoc.GetNodes(),
274  rContent.GetContentIdx()->GetIndex() );
275  SwNodeIndex aEndIdx( rDoc.GetNodes(),
276  aIdx.GetNode().EndOfSectionIndex() );
278  SwPosition aPos( *pNode, aIndex );
279  SwDoc::CorrAbs( aIdx, aEndIdx, aPos, true );
280  bRemoveIdx = false;
281  }
282  }
283  if( bRemoveIdx )
284  {
285  RemoveIdxFromSection( rDoc, rContent.GetContentIdx()->GetIndex() );
286  }
287  }
288  DelFly(& rDoc);
289 }
290 
292 {
293  InsFly(rContext);
294 }
295 
297 {
298  SwDoc *const pDoc = & rContext.GetDoc();
299  // get anchor and reset it
301  if ((RndStdIds::FLY_AT_PARA == aAnchor.GetAnchorId()) ||
302  (RndStdIds::FLY_AT_CHAR == aAnchor.GetAnchorId()) ||
303  (RndStdIds::FLY_AS_CHAR == aAnchor.GetAnchorId()))
304  {
305  SwPosition aPos( *rContext.GetRepeatPaM().GetPoint() );
306  if (RndStdIds::FLY_AT_PARA == aAnchor.GetAnchorId())
307  {
308  aPos.nContent.Assign( nullptr, 0 );
309  }
310  aAnchor.SetAnchor( &aPos );
311  }
312  else if( RndStdIds::FLY_AT_FLY == aAnchor.GetAnchorId() )
313  {
314  SwStartNode const*const pSttNd =
315  rContext.GetRepeatPaM().GetNode().FindFlyStartNode();
316  if( pSttNd )
317  {
318  SwPosition aPos( *pSttNd );
319  aAnchor.SetAnchor( &aPos );
320  }
321  else
322  {
323  return ;
324  }
325  }
326  else if (RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId())
327  {
328  aAnchor.SetPageNum( pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCurrPage( &rContext.GetRepeatPaM() ));
329  }
330  else {
331  OSL_FAIL( "What kind of anchor is this?" );
332  }
333 
334  (void) pDoc->getIDocumentLayoutAccess().CopyLayoutFormat( *m_pFrameFormat, aAnchor, true, true );
335 }
336 
338 {
339  OUString aResult;
340 
341  // HACK: disable caching:
342  // the SfxUndoManager calls GetComment() too early: the pFrameFormat does not
343  // have a SwDrawContact yet, so it will fall back to SwUndo::GetComment(),
344  // which sets pComment to a wrong value.
345 // if (! pComment)
346  if ((true))
347  {
348  /*
349  If frame format is present and has an SdrObject use the undo
350  comment of the SdrObject. Otherwise use the default comment.
351  */
352  bool bDone = false;
353  if (m_pFrameFormat)
354  {
355  const SdrObject * pSdrObj = m_pFrameFormat->FindSdrObject();
356  if ( pSdrObj )
357  {
358  aResult = SdrUndoNewObj::GetComment( *pSdrObj );
359  bDone = true;
360  }
361  }
362 
363  if (! bDone)
364  aResult = SwUndo::GetComment();
365  }
366  else
367  aResult = *maComment;
368 
369  return aResult;
370 }
371 
372 static SwUndoId
373 lcl_GetSwUndoId(SwFrameFormat const *const pFrameFormat)
374 {
375  if (RES_DRAWFRMFMT != pFrameFormat->Which())
376  {
377  const SwFormatContent& rContent = pFrameFormat->GetContent();
378  OSL_ENSURE( rContent.GetContentIdx(), "Fly without content" );
379 
380  SwNodeIndex firstNode(*rContent.GetContentIdx(), 1);
381  SwNoTextNode *const pNoTextNode(firstNode.GetNode().GetNoTextNode());
382  if (pNoTextNode && pNoTextNode->IsGrfNode())
383  {
384  return SwUndoId::DELGRF;
385  }
386  else if (pNoTextNode && pNoTextNode->IsOLENode())
387  {
388  // surprisingly not SwUndoId::DELOLE, which does not seem to work
389  return SwUndoId::DELETE;
390  }
391  }
392  return SwUndoId::DELLAYFMT;
393 }
394 
396  : SwUndoFlyBase( pFormat, lcl_GetSwUndoId(pFormat) )
397  , m_bShowSelFrame( true )
398 {
399  SwDoc* pDoc = pFormat->GetDoc();
400  DelFly( pDoc );
401 }
402 
404 {
405  SwRewriter aRewriter;
406 
407  SwDoc * pDoc = m_pFrameFormat->GetDoc();
408 
409  if (pDoc)
410  {
411  SwNodeIndex* pIdx = GetMvSttIdx();
412  if( 1 == GetMvNodeCnt() && pIdx)
413  {
414  SwNode *const pNd = & pIdx->GetNode();
415 
416  if ( pNd->IsNoTextNode() && pNd->IsOLENode())
417  {
418  SwOLENode * pOLENd = pNd->GetOLENode();
419 
420  aRewriter.AddRule(UndoArg1, pOLENd->GetDescription());
421  }
422  }
423  }
424 
425  return aRewriter;
426 }
427 
429 {
430  InsFly( rContext, m_bShowSelFrame );
431 }
432 
434 {
435  SwDoc & rDoc(rContext.GetDoc());
436  const SwFormatContent& rContent = m_pFrameFormat->GetContent();
437  if( rContent.GetContentIdx() ) // no content
438  {
439  RemoveIdxFromSection(rDoc, rContent.GetContentIdx()->GetIndex());
440  }
441 
442  DelFly(& rDoc);
443 }
444 
446 {
447  const SwFormatContent& rContent = m_pFrameFormat->GetContent();
448  if( rContent.GetContentIdx() ) // no content
450  rContent.GetContentIdx()->GetIndex() );
451 
453 }
454 
456  : SwUndo( SwUndoId::SETFLYFRMFMT, rFlyFormat.GetDoc() ), SwClient( &rFlyFormat ), m_pFrameFormat( &rFlyFormat ),
457  m_DerivedFromFormatName( rFlyFormat.IsDefault() ? "" : rFlyFormat.DerivedFrom()->GetName() ),
458  m_NewFormatName( rNewFrameFormat.GetName() ),
459  m_pItemSet( new SfxItemSet( *rFlyFormat.GetAttrSet().GetPool(),
460  rFlyFormat.GetAttrSet().GetRanges() )),
461  m_nOldNode( 0 ), m_nNewNode( 0 ),
462  m_nOldContent( 0 ), m_nNewContent( 0 ),
463  m_nOldAnchorType( RndStdIds::FLY_AT_PARA ), m_nNewAnchorType( RndStdIds::FLY_AT_PARA ), m_bAnchorChanged( false )
464 {
465 }
466 
468 {
469  SwRewriter aRewriter;
470 
471  aRewriter.AddRule(UndoArg1, m_NewFormatName);
472 
473  return aRewriter;
474 }
475 
477 {
478 }
479 
481  sal_uLong nNode, sal_Int32 nContent )
482 {
483  RndStdIds nAnchorTyp = rAnchor.GetAnchorId();
484  if (RndStdIds::FLY_AT_PAGE != nAnchorTyp)
485  {
486  SwNode* pNd = m_pFrameFormat->GetDoc()->GetNodes()[ nNode ];
487 
488  if( RndStdIds::FLY_AT_FLY == nAnchorTyp
489  ? ( !pNd->IsStartNode() || SwFlyStartNode !=
490  static_cast<SwStartNode*>(pNd)->GetStartNodeType() )
491  : !pNd->IsTextNode() )
492  {
493  pNd = nullptr; // invalid position
494  }
495  else
496  {
497  SwPosition aPos( *pNd );
498  if ((RndStdIds::FLY_AS_CHAR == nAnchorTyp) ||
499  (RndStdIds::FLY_AT_CHAR == nAnchorTyp))
500  {
501  if (nContent > pNd->GetTextNode()->GetText().getLength())
502  {
503  pNd = nullptr; // invalid position
504  }
505  else
506  {
507  aPos.nContent.Assign(pNd->GetTextNode(), nContent);
508  }
509  }
510  if ( pNd )
511  {
512  rAnchor.SetAnchor( &aPos );
513  }
514  }
515 
516  if( !pNd )
517  {
518  // invalid position - assign first page
519  rAnchor.SetType( RndStdIds::FLY_AT_PAGE );
520  rAnchor.SetPageNum( 1 );
521  }
522  }
523  else
524  rAnchor.SetPageNum( nContent );
525 }
526 
528 {
529  SwDoc & rDoc = rContext.GetDoc();
530 
531  // Is the new Format still existent?
532  SwFrameFormat* pDerivedFromFrameFormat = rDoc.FindFrameFormatByName(m_DerivedFromFormatName);
533  if (pDerivedFromFrameFormat)
534  {
535  if( m_bAnchorChanged )
537 
538  if( m_pFrameFormat->DerivedFrom() != pDerivedFromFrameFormat)
539  m_pFrameFormat->SetDerivedFrom(pDerivedFromFrameFormat);
540 
541  SfxItemIter aIter( *m_pItemSet );
542  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
543  {
544  if( IsInvalidItem( pItem ))
545  m_pFrameFormat->ResetFormatAttr( m_pItemSet->GetWhichByPos(
546  aIter.GetCurPos() ));
547  else
548  m_pFrameFormat->SetFormatAttr( *pItem );
549  }
550 
551  if( m_bAnchorChanged )
552  {
553  const SwFormatAnchor& rOldAnch = m_pFrameFormat->GetAnchor();
554  if (RndStdIds::FLY_AS_CHAR == rOldAnch.GetAnchorId())
555  {
556  // With InContents it's tricky: the text attribute needs to be
557  // deleted. Unfortunately, this not only destroys the Frames but
558  // also the format. To prevent that, first detach the
559  // connection between attribute and format.
560  const SwPosition *pPos = rOldAnch.GetContentAnchor();
561  SwTextNode *pTextNode = pPos->nNode.GetNode().GetTextNode();
562  OSL_ENSURE( pTextNode->HasHints(), "Missing FlyInCnt-Hint." );
563  const sal_Int32 nIdx = pPos->nContent.GetIndex();
564  SwTextAttr * pHint = pTextNode->GetTextAttrForCharAt(
565  nIdx, RES_TXTATR_FLYCNT );
566  assert(pHint && "Missing Hint.");
567  OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
568  "Missing FlyInCnt-Hint." );
569  OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == m_pFrameFormat,
570  "Wrong TextFlyCnt-Hint." );
571  const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat();
572 
573  // Connection is now detached, therefore the attribute can be
574  // deleted
575  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
576  }
577 
578  // reposition anchor
579  SwFormatAnchor aNewAnchor( m_nOldAnchorType );
580  GetAnchor( aNewAnchor, m_nOldNode, m_nOldContent );
581  m_pFrameFormat->SetFormatAttr( aNewAnchor );
582 
583  if (RndStdIds::FLY_AS_CHAR == aNewAnchor.GetAnchorId())
584  {
585  const SwPosition* pPos = aNewAnchor.GetContentAnchor();
586  SwFormatFlyCnt aFormat( m_pFrameFormat );
587  pPos->nNode.GetNode().GetTextNode()->InsertItem( aFormat,
588  m_nOldContent, 0 );
589  }
590 
592  }
593  rContext.SetSelections(m_pFrameFormat, nullptr);
594  }
595 }
596 
598 {
599  SwDoc & rDoc = rContext.GetDoc();
600 
601  // Is the new Format still existent?
602  SwFrameFormat* pNewFrameFormat = rDoc.FindFrameFormatByName(m_NewFormatName);
603  if (pNewFrameFormat)
604  {
605  if( m_bAnchorChanged )
606  {
607  SwFormatAnchor aNewAnchor( m_nNewAnchorType );
608  GetAnchor( aNewAnchor, m_nNewNode, m_nNewContent );
610  aSet.Put( aNewAnchor );
611  rDoc.SetFrameFormatToFly( *m_pFrameFormat, *pNewFrameFormat, &aSet );
612  }
613  else
614  rDoc.SetFrameFormatToFly( *m_pFrameFormat, *pNewFrameFormat);
615 
616  rContext.SetSelections(m_pFrameFormat, nullptr);
617  }
618 }
619 
620 void SwUndoSetFlyFormat::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem )
621 {
622  if( pItem && pItem != GetDfltAttr( nWhich ) )
623  {
624  // Special treatment for this anchor
625  if( RES_ANCHOR == nWhich )
626  {
627  // only keep the first change
628  OSL_ENSURE( !m_bAnchorChanged, "multiple changes of an anchor are not allowed!" );
629 
630  m_bAnchorChanged = true;
631 
632  const SwFormatAnchor* pAnchor = static_cast<const SwFormatAnchor*>(pItem);
633  m_nOldAnchorType = pAnchor->GetAnchorId();
634  switch( m_nOldAnchorType )
635  {
636  case RndStdIds::FLY_AS_CHAR:
637  case RndStdIds::FLY_AT_CHAR:
639  [[fallthrough]];
640  case RndStdIds::FLY_AT_PARA:
641  case RndStdIds::FLY_AT_FLY:
642  m_nOldNode = pAnchor->GetContentAnchor()->nNode.GetIndex();
643  break;
644 
645  default:
646  m_nOldContent = pAnchor->GetPageNum();
647  }
648 
649  pAnchor = &m_pFrameFormat->GetAnchor();
650  m_nNewAnchorType = pAnchor->GetAnchorId();
651  switch( m_nNewAnchorType )
652  {
653  case RndStdIds::FLY_AS_CHAR:
654  case RndStdIds::FLY_AT_CHAR:
656  [[fallthrough]];
657  case RndStdIds::FLY_AT_PARA:
658  case RndStdIds::FLY_AT_FLY:
659  m_nNewNode = pAnchor->GetContentAnchor()->nNode.GetIndex();
660  break;
661 
662  default:
663  m_nNewContent = pAnchor->GetPageNum();
664  }
665  }
666  else
667  m_pItemSet->Put( *pItem );
668  }
669  else
670  m_pItemSet->InvalidateItem( nWhich );
671 }
672 
674 {
675  if( pOld )
676  {
677  sal_uInt16 nWhich = pOld->Which();
678 
679  if( nWhich < POOLATTR_END )
680  PutAttr( nWhich, pOld );
681  else if( RES_ATTRSET_CHG == nWhich )
682  {
683  SfxItemIter aIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
684  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
685  {
686  PutAttr( pItem->Which(), pItem );
687  }
688  }
689  }
690 }
691 
692 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Starts a section of nodes in the document model.
Definition: node.hxx:303
bool erase(const value_type &x)
Definition: docfmt.cxx:2086
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
Definition: UndoCore.hxx:98
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor >> &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
Definition: autofmt.cxx:1116
Marks a position in the document model.
Definition: pam.hxx:35
RndStdIds m_nOldAnchorType
Definition: UndoCore.hxx:195
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:161
#define RES_ATTRSET_CHG
Definition: hintids.hxx:287
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2078
const OUString & GetText() const
Definition: ndtxt.hxx:210
virtual const SwRootFrame * GetCurrentLayout() const =0
SwUndoId
Definition: swundo.hxx:29
sal_uInt16 GetCurrPage(const SwPaM *) const
Query/set the current Page and the collective Page count We'll format as much as necessary.
Definition: trvlfrm.cxx:979
bool Rollback(SwDoc *pDoc, sal_uInt16 nStart=0)
Definition: rolbck.cxx:1157
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
sal_Int32 m_nNewContent
Definition: UndoCore.hxx:194
sal_uIntPtr sal_uLong
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:128
Definition: doc.hxx:185
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
SwNode & GetNode() const
Definition: ndindex.hxx:119
sal_Int32 m_nContentPos
Definition: undobj.hxx:292
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwUndoDelLayFormat(SwFrameFormat *pFormat)
Definition: undobj1.cxx:395
const SwHistory * GetHistory() const
Definition: undobj.hxx:214
sal_uInt16 Which() const
Definition: txatbase.hxx:110
sal_Int32 const mnCursorSaveIndexPos
Definition: undobj.hxx:312
static void RemoveIdxFromSection(SwDoc &, sal_uLong nSttIdx, const sal_uLong *pEndIdx=nullptr)
Definition: undobj.cxx:113
#define RES_REMOVE_UNO_OBJECT
Definition: hintids.hxx:305
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
void InsFly(::sw::UndoRedoContext &rContext, bool bShowSel=true)
Definition: undobj1.cxx:62
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:738
sal_Int32 m_nOldContent
Definition: UndoCore.hxx:194
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
const OUString m_DerivedFromFormatName
Definition: UndoCore.hxx:190
void DelFly(SwDoc *)
Definition: undobj1.cxx:155
#define POOLATTR_END
Definition: hintids.hxx:65
const SfxPoolItem * NextItem()
SwIndex nContent
Definition: pam.hxx:38
void SetOtherTextBoxFormat(SwFrameFormat *pFormat)
Definition: atrfrm.cxx:2477
SwDoc & GetDoc() const
Definition: UndoCore.hxx:126
for Undo, translated to SwInsertFlags::NOHINTEXPAND
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
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 SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
SwDoc & GetDoc() const
Definition: UndoCore.hxx:94
SwUndoInsLayFormat(SwFrameFormat *pFormat, sal_uLong nNodeIdx, sal_Int32 nCntIdx)
Definition: undobj1.cxx:226
sal_uLong m_nNodePagePos
Definition: undobj.hxx:291
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:326
virtual void ModifyNotification(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.hxx:154
Specific frame formats (frames, DrawObjects).
Definition: docary.hxx:201
bool IsOLENode() const
Definition: node.hxx:652
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: doc.hxx:761
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undobj1.cxx:597
sal_uLong m_nOldNode
Definition: UndoCore.hxx:193
SwNodeIndex * GetMvSttIdx() const
Definition: undobj.hxx:301
Style of a layout element.
Definition: frmfmt.hxx:57
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undobj1.cxx:433
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: undobj1.cxx:467
#define RES_ANCHOR
Definition: hintids.hxx:211
SwFrameFormat * m_pFrameFormat
Definition: undobj.hxx:290
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
const SwPosition * GetPoint() const
Definition: pam.hxx:207
SwFrameFormat * GetOtherTextBoxFormat() const
Definition: frmfmt.hxx:101
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
sal_uLong m_nNewNode
Definition: UndoCore.hxx:193
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
static SwUndoId lcl_GetSwUndoId(SwFrameFormat const *const pFrameFormat)
Definition: undobj1.cxx:373
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undobj1.cxx:260
bool SetFrameFormatToFly(SwFrameFormat &rFlyFormat, SwFrameFormat &rNewFormat, SfxItemSet *pSet=nullptr, bool bKeepOrient=false)
Definition: docfly.cxx:614
SwContentNode * GetContentNode()
Definition: node.hxx:615
FlyAnchors.
Definition: fmtanchr.hxx:34
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undobj1.cxx:291
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
bool m_bDelFormat
Definition: undobj.hxx:294
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
RndStdIds m_nRndId
Definition: undobj.hxx:293
bool IsNoTextNode() const
Definition: node.hxx:648
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: undobj1.cxx:403
virtual OUString GetComment() const override
Returns textual comment for this undo object.
Definition: undobj.cxx:656
sal_uLong GetMvNodeCnt() const
Definition: undobj.hxx:302
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
virtual ~SwUndoFlyBase() override
Definition: undobj1.cxx:50
void GetAnchor(SwFormatAnchor &rAnhor, sal_uLong nNode, sal_Int32 nContent)
Definition: undobj1.cxx:480
void PutAttr(sal_uInt16 nWhich, const SfxPoolItem *pItem)
Definition: undobj1.cxx:620
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
sal_uInt16 const aFrameFormatSetRange[]
Definition: init.cxx:234
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
sal_uInt16 GetCurPos() const
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
void EraseText(const SwIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
Definition: ndtxt.cxx:2659
SwFormat * DerivedFrom() const
Definition: format.hxx:108
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
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 RestoreSection(SwDoc *pDoc, SwNodeIndex *pIdx, sal_uInt16 nSectType)
Definition: undobj.cxx:1246
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:650
SwFrameFormat * m_pFrameFormat
Definition: UndoCore.hxx:189
virtual ~SwUndoSetFlyFormat() override
Definition: undobj1.cxx:476
std::deque< AttacherIndex_Impl > aIndex
void CorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:162
#define RES_DRAWFRMFMT
Definition: hintids.hxx:279
virtual ~SwUndoInsLayFormat() override
Definition: undobj1.cxx:256
sal_Int32 GetIndex() const
Definition: index.hxx:95
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2642
SwNodes & GetNodes()
Definition: doc.hxx:403
RndStdIds m_nNewAnchorType
Definition: UndoCore.hxx:195
o3tl::optional< OUString > maComment
Definition: undobj.hxx:61
#define RES_TXTATR_FLYCNT
Definition: hintids.hxx:152
SwUndoFlyBase(SwFrameFormat *pFormat, SwUndoId nUndoId)
Definition: undobj1.cxx:40
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
SwUndoSetFlyFormat(SwFrameFormat &rFlyFormat, const SwFrameFormat &rNewFrameFormat)
Definition: undobj1.cxx:455
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:198
SwFrameFormat * GetFrameFormat() const
Definition: fmtflcnt.hxx:45
RndStdIds
virtual OUString GetComment() const override
void RedoForRollback()
Definition: undobj1.cxx:445
bool IsInvalidItem(const SfxPoolItem *pItem)
std::unique_ptr< SfxItemSet > m_pItemSet
Definition: UndoCore.hxx:192
virtual OUString GetComment() const override
Returns textual comment for this undo object.
Definition: undobj1.cxx:337
void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: undobj1.cxx:673
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undobj1.cxx:428
bool IsTextNode() const
Definition: node.hxx:636
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undobj1.cxx:527
void SaveSection(const SwNodeIndex &rSttIdx)
Definition: undobj.cxx:1194
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:137
sal_uInt16 Which() const
sal_uLong mnCursorSaveIndexPara
Definition: undobj.hxx:311
const SfxPoolItem * GetCurItem() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1313
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
bool HasHints() const
Definition: ndtxt.hxx:220
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1477
const OUString m_NewFormatName
Definition: UndoCore.hxx:191
const SwFormatFlyCnt & GetFlyCnt() const
Definition: txatbase.hxx:206
Base class of the Writer document model elements.
Definition: node.hxx:79
OUString GetDescription() const
Remove OLE-object from "memory".
Definition: ndole.hxx:141
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: undobj1.cxx:296
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo