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