LibreOffice Module sw (master)  1
undraw.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 <UndoDraw.hxx>
21 
22 #include <svx/svdogrp.hxx>
23 #include <svx/svdundo.hxx>
24 #include <svx/svdpage.hxx>
25 #include <svx/svdmark.hxx>
26 #include <svx/svdview.hxx>
27 
28 #include <hintids.hxx>
29 #include <hints.hxx>
30 #include <fmtanchr.hxx>
31 #include <fmtflcnt.hxx>
32 #include <txtflcnt.hxx>
33 #include <frmfmt.hxx>
34 #include <doc.hxx>
35 #include <IDocumentUndoRedo.hxx>
37 #include <docary.hxx>
38 #include <swundo.hxx>
39 #include <pam.hxx>
40 #include <ndtxt.hxx>
41 #include <UndoCore.hxx>
42 #include <dcontact.hxx>
43 #include <viewsh.hxx>
44 #include <frameformats.hxx>
45 
47 {
51 };
52 
53 // Draw-Objecte
54 
55 void SwDoc::AddDrawUndo( std::unique_ptr<SdrUndoAction> pUndo )
56 {
57  if (GetIDocumentUndoRedo().DoesUndo() &&
58  GetIDocumentUndoRedo().DoesDrawUndo())
59  {
60  const SdrMarkList* pMarkList = nullptr;
62  if( pSh && pSh->HasDrawView() )
63  pMarkList = &pSh->GetDrawView()->GetMarkedObjectList();
64 
65  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwSdrUndo>(std::move(pUndo), pMarkList, this) );
66  }
67 }
68 
69 SwSdrUndo::SwSdrUndo( std::unique_ptr<SdrUndoAction> pUndo, const SdrMarkList* pMrkLst, const SwDoc* pDoc )
70  : SwUndo( SwUndoId::DRAWUNDO, pDoc ), m_pSdrUndo( std::move(pUndo) )
71 {
72  if( pMrkLst && pMrkLst->GetMarkCount() )
73  m_pMarkList.reset( new SdrMarkList( *pMrkLst ) );
74 }
75 
77 {
78  m_pSdrUndo.reset();
79  m_pMarkList.reset();
80 }
81 
83 {
84  m_pSdrUndo->Undo();
85  rContext.SetSelections(nullptr, m_pMarkList.get());
86 }
87 
89 {
90  m_pSdrUndo->Redo();
91  rContext.SetSelections(nullptr, m_pMarkList.get());
92 }
93 
94 OUString SwSdrUndo::GetComment() const
95 {
96  return m_pSdrUndo->GetComment();
97 }
98 
99 static void lcl_SendRemoveToUno( SwFormat& rFormat )
100 {
101  SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, &rFormat );
102  rFormat.ModifyNotification( &aMsgHint, &aMsgHint );
103 }
104 
105 static void lcl_SaveAnchor( SwFrameFormat* pFormat, sal_uLong& rNodePos )
106 {
107  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
108  if ((RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId()) ||
109  (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId()) ||
110  (RndStdIds::FLY_AT_FLY == rAnchor.GetAnchorId()) ||
111  (RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()))
112  {
113  rNodePos = rAnchor.GetContentAnchor()->nNode.GetIndex();
114  sal_Int32 nContentPos = 0;
115 
116  if (RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId())
117  {
118  nContentPos = rAnchor.GetContentAnchor()->nContent.GetIndex();
119 
120  // destroy TextAttribute
121  SwTextNode *pTextNd = pFormat->GetDoc()->GetNodes()[ rNodePos ]->GetTextNode();
122  OSL_ENSURE( pTextNd, "No text node found!" );
123  SwTextFlyCnt* pAttr = static_cast<SwTextFlyCnt*>(
124  pTextNd->GetTextAttrForCharAt( nContentPos, RES_TXTATR_FLYCNT ));
125  // attribute still in text node, delete
126  if( pAttr && pAttr->GetFlyCnt().GetFrameFormat() == pFormat )
127  {
128  // just set pointer to 0, don't delete
129  const_cast<SwFormatFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFormat();
130  SwIndex aIdx( pTextNd, nContentPos );
131  pTextNd->EraseText( aIdx, 1 );
132  }
133  }
134  else if (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId())
135  {
136  nContentPos = rAnchor.GetContentAnchor()->nContent.GetIndex();
137  }
138 
139  pFormat->SetFormatAttr( SwFormatAnchor( rAnchor.GetAnchorId(), nContentPos ) );
140  }
141 }
142 
143 static void lcl_RestoreAnchor( SwFrameFormat* pFormat, sal_uLong nNodePos )
144 {
145  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
146  if ((RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId()) ||
147  (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId()) ||
148  (RndStdIds::FLY_AT_FLY == rAnchor.GetAnchorId()) ||
149  (RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()))
150  {
151  const sal_Int32 nContentPos = rAnchor.GetPageNum();
152  SwNodes& rNds = pFormat->GetDoc()->GetNodes();
153 
154  SwNodeIndex aIdx( rNds, nNodePos );
155  SwPosition aPos( aIdx );
156 
157  SwFormatAnchor aTmp( rAnchor.GetAnchorId() );
158  if ((RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()) ||
159  (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId()))
160  {
161  aPos.nContent.Assign( aIdx.GetNode().GetContentNode(), nContentPos );
162  }
163  aTmp.SetAnchor( &aPos );
164  RndStdIds nAnchorId = rAnchor.GetAnchorId();
165  pFormat->SetFormatAttr( aTmp );
166 
167  if (RndStdIds::FLY_AS_CHAR == nAnchorId)
168  {
169  SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
170  OSL_ENSURE( pTextNd, "no Text Node" );
171  SwFormatFlyCnt aFormat( pFormat );
172  pTextNd->InsertItem( aFormat, nContentPos, nContentPos );
173  }
174  }
175 }
176 
177 SwUndoDrawGroup::SwUndoDrawGroup( sal_uInt16 nCnt, const SwDoc* pDoc )
178  : SwUndo( SwUndoId::DRAWGROUP, pDoc ), m_nSize( nCnt + 1 ), m_bDeleteFormat( true )
179 {
180  m_pObjArray.reset( new SwUndoGroupObjImpl[ m_nSize ] );
181 }
182 
184 {
185  if( m_bDeleteFormat )
186  {
187  SwUndoGroupObjImpl* pTmp = m_pObjArray.get() + 1;
188  for( sal_uInt16 n = 1; n < m_nSize; ++n, ++pTmp )
189  delete pTmp->pFormat;
190  }
191  else
192  delete m_pObjArray[0].pFormat;
193 }
194 
196 {
197  m_bDeleteFormat = false;
198 
199  // save group object
200  SwDrawFrameFormat* pFormat = m_pObjArray[0].pFormat;
201 
203  auto pObj = m_pObjArray[0].pObj;
204  pObj->SetUserCall(nullptr);
205 
206  ::lcl_SaveAnchor( pFormat, m_pObjArray[0].nNodeIdx );
207 
208  // notify UNO objects to decouple
209  ::lcl_SendRemoveToUno( *pFormat );
210 
211  // remove from array
212  SwDoc* pDoc = pFormat->GetDoc();
213  SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
214  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat ));
215 
216  for( sal_uInt16 n = 1; n < m_nSize; ++n )
217  {
218  SwUndoGroupObjImpl& rSave = m_pObjArray[n];
219 
220  ::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx );
221  rFlyFormats.push_back( rSave.pFormat );
222 
223  pObj = rSave.pObj;
224 
225  SwDrawContact *pContact = new SwDrawContact( rSave.pFormat, pObj );
226  pContact->ConnectToLayout();
227  // #i45718# - follow-up of #i35635# move object to visible layer
228  pContact->MoveObjToVisibleLayer( pObj );
229 
230  SwDrawFrameFormat* pDrawFrameFormat = rSave.pFormat;
231 
232  // #i45952# - notify that position attributes are already set
233  OSL_ENSURE(pDrawFrameFormat,
234  "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
235  if (pDrawFrameFormat)
236  pDrawFrameFormat->PosAttrSet();
237  }
238 }
239 
241 {
242  m_bDeleteFormat = true;
243 
244  // remove from array
245  SwDoc* pDoc = m_pObjArray[0].pFormat->GetDoc();
246  SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
247 
248  for( sal_uInt16 n = 1; n < m_nSize; ++n )
249  {
250  SwUndoGroupObjImpl& rSave = m_pObjArray[n];
251 
252  SdrObject* pObj = rSave.pObj;
253 
254  SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
255 
256  // object will destroy itself
257  pContact->Changed( *pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
258  pObj->SetUserCall( nullptr );
259 
260  ::lcl_SaveAnchor( rSave.pFormat, rSave.nNodeIdx );
261 
262  // notify UNO objects to decouple
263  ::lcl_SendRemoveToUno( *rSave.pFormat );
264 
265  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), rSave.pFormat ));
266  }
267 
268  // re-insert group object
269  ::lcl_RestoreAnchor( m_pObjArray[0].pFormat, m_pObjArray[0].nNodeIdx );
270  rFlyFormats.push_back( m_pObjArray[0].pFormat );
271 
272  SwDrawContact *pContact = new SwDrawContact( m_pObjArray[0].pFormat, m_pObjArray[0].pObj );
273  // #i26791# - correction: connect object to layout
274  pContact->ConnectToLayout();
275  // #i45718# - follow-up of #i35635# move object to visible layer
276  pContact->MoveObjToVisibleLayer( m_pObjArray[0].pObj );
277 
278  SwDrawFrameFormat* pDrawFrameFormat = m_pObjArray[0].pFormat;
279 
280  // #i45952# - notify that position attributes are already set
281  OSL_ENSURE(pDrawFrameFormat,
282  "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
283  if (pDrawFrameFormat)
284  pDrawFrameFormat->PosAttrSet();
285 }
286 
287 void SwUndoDrawGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat, SdrObject* pObj )
288 {
289  SwUndoGroupObjImpl& rSave = m_pObjArray[nPos + 1];
290  rSave.pObj = pObj;
291  rSave.pFormat = pFormat;
292  ::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
293 
294  // notify UNO objects to decouple
295  ::lcl_SendRemoveToUno( *pFormat );
296 
297  // remove from array
298  SwFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats();
299  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat ));
300 }
301 
303 {
304  m_pObjArray[0].pObj = nullptr;
305  m_pObjArray[0].pFormat = pFormat;
306 }
307 
309  : SwUndo( SwUndoId::DRAWUNGROUP, pDoc ), m_bDeleteFormat( false )
310 {
311  m_nSize = static_cast<sal_uInt16>(pObj->GetSubList()->GetObjCount()) + 1;
312  m_pObjArray.reset( new SwUndoGroupObjImpl[ m_nSize ] );
313 
314  SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
315  SwDrawFrameFormat* pFormat = static_cast<SwDrawFrameFormat*>(pContact->GetFormat());
316 
317  m_pObjArray[0].pObj = pObj;
318  m_pObjArray[0].pFormat = pFormat;
319 
320  // object will destroy itself
321  pContact->Changed( *pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
322  pObj->SetUserCall( nullptr );
323 
324  ::lcl_SaveAnchor( pFormat, m_pObjArray[0].nNodeIdx );
325 
326  // notify UNO objects to decouple
327  ::lcl_SendRemoveToUno( *pFormat );
328 
329  // remove from array
330  SwFrameFormats& rFlyFormats = *pFormat->GetDoc()->GetSpzFrameFormats();
331  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat ));
332 }
333 
335 {
336  if( m_bDeleteFormat )
337  {
338  SwUndoGroupObjImpl* pTmp = m_pObjArray.get() + 1;
339  for( sal_uInt16 n = 1; n < m_nSize; ++n, ++pTmp )
340  delete pTmp->pFormat;
341  }
342  else
343  delete m_pObjArray[0].pFormat;
344 }
345 
347 {
348  m_bDeleteFormat = true;
349 
350  SwDoc *const pDoc = & rContext.GetDoc();
351  SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
352 
353  // remove from array
354  for( sal_uInt16 n = 1; n < m_nSize; ++n )
355  {
356  SwUndoGroupObjImpl& rSave = m_pObjArray[n];
357 
358  ::lcl_SaveAnchor( rSave.pFormat, rSave.nNodeIdx );
359 
360  // notify UNO objects to decouple
361  ::lcl_SendRemoveToUno( *rSave.pFormat );
362 
363  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), rSave.pFormat ));
364  }
365 
366  // re-insert group object
367  ::lcl_RestoreAnchor( m_pObjArray[0].pFormat, m_pObjArray[0].nNodeIdx );
368  rFlyFormats.push_back( m_pObjArray[0].pFormat );
369 
370  SwDrawContact *pContact = new SwDrawContact( m_pObjArray[0].pFormat, m_pObjArray[0].pObj );
371  pContact->ConnectToLayout();
372  // #i45718# - follow-up of #i35635# move object to visible layer
373  pContact->MoveObjToVisibleLayer( m_pObjArray[0].pObj );
374 
375  SwDrawFrameFormat* pDrawFrameFormat = m_pObjArray[0].pFormat;
376 
377  // #i45952# - notify that position attributes are already set
378  OSL_ENSURE(pDrawFrameFormat,
379  "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
380  if (pDrawFrameFormat)
381  pDrawFrameFormat->PosAttrSet();
382 }
383 
385 {
386  m_bDeleteFormat = false;
387 
388  // save group object
389  SwDrawFrameFormat* pFormat = m_pObjArray[0].pFormat;
391  m_pObjArray[0].pObj->SetUserCall( nullptr );
392 
393  ::lcl_SaveAnchor( pFormat, m_pObjArray[0].nNodeIdx );
394 
395  // notify UNO objects to decouple
396  ::lcl_SendRemoveToUno( *pFormat );
397 
398  // remove from array
399  SwDoc* pDoc = pFormat->GetDoc();
400  SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
401  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat ));
402 
403  for( sal_uInt16 n = 1; n < m_nSize; ++n )
404  {
405  SwUndoGroupObjImpl& rSave = m_pObjArray[n];
406 
407  ::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx );
408  rFlyFormats.push_back( rSave.pFormat );
409 
410  SwDrawFrameFormat* pDrawFrameFormat = rSave.pFormat;
411 
412  // #i45952# - notify that position attributes are already set
413  OSL_ENSURE(pDrawFrameFormat,
414  "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
415  if (pDrawFrameFormat)
416  pDrawFrameFormat->PosAttrSet();
417  }
418 }
419 
420 void SwUndoDrawUnGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat )
421 {
422  SwUndoGroupObjImpl& rSave = m_pObjArray[ nPos + 1 ];
423  rSave.pFormat = pFormat;
424  rSave.pObj = nullptr;
425 }
426 
428  : SwUndo( SwUndoId::DRAWUNGROUP, pDoc )
429 {
430 }
431 
433 {
434 }
435 
436 void
438 {
439  for (const std::pair< SwDrawFrameFormat*, SdrObject* > & rPair : m_aDrawFormatsAndObjs)
440  {
441  SdrObject* pObj( rPair.second );
442  SwDrawContact* pDrawContact( dynamic_cast<SwDrawContact*>(pObj->GetUserCall()) );
443  OSL_ENSURE( pDrawContact,
444  "<SwUndoDrawUnGroupConnectToLayout::Undo(..)> -- missing SwDrawContact instance" );
445  if ( pDrawContact )
446  {
447  // deletion of instance <pDrawContact> and thus disconnection from
448  // the Writer layout.
449  pDrawContact->Changed( *pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
450  pObj->SetUserCall( nullptr );
451  }
452  }
453 }
454 
455 void
457 {
458  for (const std::pair< SwDrawFrameFormat*, SdrObject* > & rPair : m_aDrawFormatsAndObjs)
459  {
460  SwDrawFrameFormat* pFormat( rPair.first );
461  SdrObject* pObj( rPair.second );
462  SwDrawContact *pContact = new SwDrawContact( pFormat, pObj );
463  pContact->ConnectToLayout();
464  pContact->MoveObjToVisibleLayer( pObj );
465  }
466 }
467 
469  SdrObject* pDrawObject )
470 {
471  m_aDrawFormatsAndObjs.emplace_back( pDrawFrameFormat, pDrawObject );
472 }
473 
474 SwUndoDrawDelete::SwUndoDrawDelete( sal_uInt16 nCnt, const SwDoc* pDoc )
475  : SwUndo( SwUndoId::DRAWDELETE, pDoc ), m_bDeleteFormat( true )
476 {
477  m_pObjArray.reset( new SwUndoGroupObjImpl[ nCnt ] );
478  m_pMarkList.reset( new SdrMarkList() );
479 }
480 
482 {
483  if( m_bDeleteFormat )
484  {
485  SwUndoGroupObjImpl* pTmp = m_pObjArray.get();
486  for( size_t n = 0; n < m_pMarkList->GetMarkCount(); ++n, ++pTmp )
487  delete pTmp->pFormat;
488  }
489 }
490 
492 {
493  m_bDeleteFormat = false;
494  SwFrameFormats & rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats();
495  for( size_t n = 0; n < m_pMarkList->GetMarkCount(); ++n )
496  {
497  SwUndoGroupObjImpl& rSave = m_pObjArray[n];
498  ::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx );
499  rFlyFormats.push_back( rSave.pFormat );
500  SdrObject *pObj = rSave.pObj;
501  SwDrawContact *pContact = new SwDrawContact( rSave.pFormat, pObj );
502  pContact->Changed_( *pObj, SdrUserCallType::Inserted, nullptr );
503  // #i45718# - follow-up of #i35635# move object to visible layer
504  pContact->MoveObjToVisibleLayer( pObj );
505 
506  SwDrawFrameFormat* pDrawFrameFormat = rSave.pFormat;
507 
508  // #i45952# - notify that position attributes are already set
509  OSL_ENSURE(pDrawFrameFormat,
510  "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
511  if (pDrawFrameFormat)
512  pDrawFrameFormat->PosAttrSet();
513  }
514  rContext.SetSelections(nullptr, m_pMarkList.get());
515 }
516 
518 {
519  m_bDeleteFormat = true;
520  SwFrameFormats & rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats();
521  for( size_t n = 0; n < m_pMarkList->GetMarkCount(); ++n )
522  {
523  SwUndoGroupObjImpl& rSave = m_pObjArray[n];
524  SdrObject *pObj = rSave.pObj;
525  SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
526  SwDrawFrameFormat *pFormat = static_cast<SwDrawFrameFormat*>(pContact->GetFormat());
527 
528  // object will destroy itself
529  pContact->Changed( *pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
530  pObj->SetUserCall( nullptr );
531 
532  // notify UNO objects to decouple
533  ::lcl_SendRemoveToUno( *pFormat );
534 
535  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat ));
536  ::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
537  }
538 }
539 
541  const SdrMark& rMark )
542 {
543  SwUndoGroupObjImpl& rSave = m_pObjArray[ m_pMarkList->GetMarkCount() ];
544  rSave.pObj = rMark.GetMarkedSdrObj();
545  rSave.pFormat = pFormat;
546  ::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
547 
548  // notify UNO objects to decouple
549  ::lcl_SendRemoveToUno( *pFormat );
550 
551  // remove from array
552  SwDoc* pDoc = pFormat->GetDoc();
553  SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
554  rFlyFormats.erase( std::find( rFlyFormats.begin(), rFlyFormats.end(), pFormat ));
555 
556  m_pMarkList->InsertEntry( rMark );
557 }
558 
559 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwUndoDrawUnGroupConnectToLayout(const SwDoc *pDoc)
Definition: undraw.cxx:427
bool erase(const value_type &x)
Definition: docfmt.cxx:2099
std::unique_ptr< SdrMarkList > m_pMarkList
Definition: UndoDraw.hxx:39
virtual ~SwUndoDrawUnGroupConnectToLayout() override
Definition: undraw.cxx:432
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
Definition: UndoCore.hxx:98
size_t GetMarkCount() const
Marks a position in the document model.
Definition: pam.hxx:35
std::unique_ptr< SdrMarkList > m_pMarkList
Definition: UndoDraw.hxx:118
SdrView * GetDrawView()
Definition: vnew.cxx:375
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2091
SwUndoId
Definition: swundo.hxx:29
SwNodeIndex nNode
Definition: pam.hxx:37
const_iterator begin() const
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
sal_uIntPtr sal_uLong
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *, SdrObject *)
Definition: undraw.cxx:287
sal_Int64 n
Definition: doc.hxx:184
size_t GetObjCount() const
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(57)
void PosAttrSet()
Definition: frmfmt.hxx:398
void AddFormatAndObj(SwDrawFrameFormat *pDrawFrameFormat, SdrObject *pDrawObject)
Definition: undraw.cxx:468
bool HasDrawView() const
Definition: vnew.cxx:360
SwNode & GetNode() const
Definition: ndindex.hxx:119
sal_uLong nNodeIdx
Definition: undraw.cxx:50
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
const_iterator end() const
static void lcl_SaveAnchor(SwFrameFormat *pFormat, sal_uLong &rNodePos)
Definition: undraw.cxx:105
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:171
bool m_bDeleteFormat
Definition: UndoDraw.hxx:56
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:739
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
Definition: UndoDraw.hxx:83
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
void SetGroupFormat(SwDrawFrameFormat *)
Definition: undraw.cxx:302
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:491
sal_uInt16 m_nSize
Definition: UndoDraw.hxx:84
SwIndex nContent
Definition: pam.hxx:38
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:88
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
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
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:437
SwDoc & GetDoc() const
Definition: UndoCore.hxx:94
SwUndoDrawGroup(sal_uInt16 nCnt, const SwDoc *pDoc)
Definition: undraw.cxx:177
virtual void MoveObjToVisibleLayer(SdrObject *_pDrawObj)
method to move drawing object to corresponding visible layer
Definition: dcontact.cxx:209
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:195
virtual void ModifyNotification(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.hxx:154
Specific frame formats (frames, DrawObjects).
Base class for various Writer styles.
Definition: format.hxx:43
std::vector< std::pair< SwDrawFrameFormat *, SdrObject * > > m_aDrawFormatsAndObjs
Definition: UndoDraw.hxx:101
SdrObject * GetMarkedSdrObj() const
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:456
Style of a layout element.
Definition: frmfmt.hxx:57
void AddObj(SwDrawFrameFormat *, const SdrMark &)
Definition: undraw.cxx:540
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwUndoDrawDelete(sal_uInt16 nCnt, const SwDoc *pDoc)
Definition: undraw.cxx:474
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:517
SwContentNode * GetContentNode()
Definition: node.hxx:615
const SdrMarkList & GetMarkedObjectList() const
FlyAnchors.
Definition: fmtanchr.hxx:34
static void lcl_RestoreAnchor(SwFrameFormat *pFormat, sal_uLong nNodePos)
Definition: undraw.cxx:143
Marks a character position inside a document model node.
Definition: index.hxx:37
virtual ~SwUndoDrawUnGroup() override
Definition: undraw.cxx:334
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
Definition: UndoDraw.hxx:54
void AddDrawUndo(std::unique_ptr< SdrUndoAction >)
Definition: undraw.cxx:55
Marks a node in the document model.
Definition: ndindex.hxx:31
virtual SdrObjList * GetSubList() const override
void SetUserCall(SdrObjUserCall *pUser)
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
virtual ~SwUndoDrawDelete() override
Definition: undraw.cxx:481
void Changed_(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle *pOldBoundRect)
Used by Changed() and by UndoDraw.
Definition: dcontact.cxx:1080
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(179)
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:240
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
virtual const tools::Rectangle & GetLastBoundRect() const
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
virtual ~SwUndoDrawGroup() override
Definition: undraw.cxx:183
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *)
Definition: undraw.cxx:420
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
SwUndoDrawUnGroup(SdrObjGroup *, const SwDoc *pDoc)
Definition: undraw.cxx:308
virtual OUString GetComment() const override
Returns textual comment for this undo object.
Definition: undraw.cxx:94
sal_Int32 GetIndex() const
Definition: index.hxx:95
void ConnectToLayout(const SwFormatAnchor *pAnch=nullptr)
Inserts SdrObject in the arrays of the layout ((SwPageFrame and SwFrame).
Definition: dcontact.cxx:1716
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect) override
Virtual methods of SdrObjUserCall.
Definition: dcontact.cxx:945
SwNodes & GetNodes()
Definition: doc.hxx:403
SwDrawFrameFormat * pFormat
Definition: undraw.cxx:48
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
Definition: UndoDraw.hxx:117
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:82
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:346
virtual ~SwSdrUndo() override
Definition: undraw.cxx:76
Format of a fly content.
Definition: fmtflcnt.hxx:32
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:376
SdrObject * pObj
Definition: undraw.cxx:49
SwFrameFormat * GetFrameFormat() const
Definition: fmtflcnt.hxx:45
RndStdIds
sal_uInt16 m_nSize
Definition: UndoDraw.hxx:55
std::unique_ptr< SdrUndoAction > m_pSdrUndo
Definition: UndoDraw.hxx:38
SdrObjUserCall * GetUserCall() const
static void lcl_SendRemoveToUno(SwFormat &rFormat)
Definition: undraw.cxx:99
SwSdrUndo(std::unique_ptr< SdrUndoAction >, const SdrMarkList *pMarkList, const SwDoc *pDoc)
Definition: undraw.cxx:69
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:384
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:836
sal_uInt32 m_nSize
const SwFormatFlyCnt & GetFlyCnt() const
Definition: txatbase.hxx:206