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