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