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