LibreOffice Module sw (master)  1
dcontact.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 <memory>
21 #include <hintids.hxx>
22 #include <editeng/lrspitem.hxx>
23 #include <svx/svdpage.hxx>
24 #include <svx/svditer.hxx>
25 #include <svx/svdogrp.hxx>
26 #include <svx/svdotext.hxx>
27 #include <svx/svdmodel.hxx>
28 #include <svx/svdviter.hxx>
29 #include <svx/svdview.hxx>
32 #include <drawdoc.hxx>
33 #include <fmtornt.hxx>
34 #include <viewimp.hxx>
35 #include <fmtsrnd.hxx>
36 #include <fmtanchr.hxx>
37 #include <node.hxx>
38 #include <fmtcntnt.hxx>
39 #include <fmtfsize.hxx>
40 #include <pam.hxx>
41 #include <pagefrm.hxx>
42 #include <rootfrm.hxx>
43 #include <frmtool.hxx>
44 #include <flyfrm.hxx>
45 #include <textboxhelper.hxx>
46 #include <frmfmt.hxx>
47 #include <fmtfollowtextflow.hxx>
48 #include <dflyobj.hxx>
49 #include <dcontact.hxx>
50 #include <unodraw.hxx>
53 #include <doc.hxx>
54 #include <hints.hxx>
55 #include <txtfrm.hxx>
56 #include <frameformats.hxx>
57 #include <docary.hxx>
58 #include <sortedobjs.hxx>
65 #include <com/sun/star/text/WritingMode2.hpp>
66 #include <calbck.hxx>
67 #include <algorithm>
68 #include <txtfly.hxx>
69 #include <sal/log.hxx>
70 
71 using namespace ::com::sun::star;
72 
73 namespace
74 {
76  struct VirtObjAnchoredAtFramePred
77  {
78  const SwFrame* m_pAnchorFrame;
79 
80  // #i26791# - compare with master frame
81  static const SwFrame* FindFrame(const SwFrame* pFrame)
82  {
83  if(!pFrame || !pFrame->IsContentFrame())
84  return pFrame;
85  auto pContentFrame = static_cast<const SwContentFrame*>(pFrame);
86  while(pContentFrame->IsFollow())
87  pContentFrame = pContentFrame->FindMaster();
88  return pContentFrame;
89  }
90 
91  VirtObjAnchoredAtFramePred(const SwFrame* pAnchorFrame)
92  : m_pAnchorFrame(FindFrame(pAnchorFrame))
93  {}
94 
95  bool operator()(const SwDrawVirtObjPtr& rpDrawVirtObj)
96  {
97  return FindFrame(rpDrawVirtObj->GetAnchorFrame()) == m_pAnchorFrame;
98  }
99  };
100 }
101 
102 void setContextWritingMode(SdrObject* pObj, SwFrame const * pAnchor)
103 {
104  if(!pObj || !pAnchor)
105  return;
106  short nWritingDirection =
107  pAnchor->IsVertical() ? text::WritingMode2::TB_RL :
108  pAnchor->IsRightToLeft() ? text::WritingMode2::RL_TB :
109  text::WritingMode2::LR_TB;
110  pObj->SetContextWritingMode(nWritingDirection);
111 }
112 
113 
121 {
122  SwFrameFormat* pRetval = nullptr;
123 
124  if (SwVirtFlyDrawObj* pFlyDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
125  {
126  pRetval = pFlyDrawObj->GetFormat();
127  }
128  else
129  {
130  SwContact* pContact = GetUserCall(pObj);
131  if ( pContact )
132  {
133  pRetval = pContact->GetFormat();
134  }
135  }
136  return pRetval;
137 }
138 
139 bool HasWrap( const SdrObject* pObj )
140 {
141  if ( pObj )
142  {
143  const SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
144  if ( pFormat )
145  {
146  return css::text::WrapTextMode_THROUGH != pFormat->GetSurround().GetSurround();
147  }
148  }
149 
150  return false;
151 }
152 
155 {
156  SwRect aRet( pObj->GetCurrentBoundRect() );
157  // #i68520# - call cache of <SwAnchoredObject>
158  SwContact* pContact( GetUserCall( pObj ) );
159  if ( pContact )
160  {
161  const SwAnchoredObject* pAnchoredObj( pContact->GetAnchoredObj( pObj ) );
162  if ( pAnchoredObj )
163  {
164  aRet = pAnchoredObj->GetObjRectWithSpaces();
165  }
166  }
167  return aRet;
168 }
169 
172 {
173  SdrObject *pTmp;
174  while ( !pObj->GetUserCall() && nullptr != (pTmp = pObj->getParentSdrObjectFromSdrObject()) )
175  pObj = pTmp;
176  assert((!pObj->GetUserCall() || nullptr != dynamic_cast<const SwContact*>(pObj->GetUserCall())) &&
177  "<::GetUserCall(..)> - wrong type of found object user call." );
178  return static_cast<SwContact*>(pObj->GetUserCall());
179 }
180 
182 bool IsMarqueeTextObj( const SdrObject& rObj )
183 {
184  if (SdrInventor::Default != rObj.GetObjInventor() ||
185  OBJ_TEXT != rObj.GetObjIdentifier())
186  return false;
187  SdrTextAniKind eTKind = static_cast<const SdrTextObj&>(rObj).GetTextAniKind();
188  return ( SdrTextAniKind::Scroll == eTKind
189  || SdrTextAniKind::Alternate == eTKind || SdrTextAniKind::Slide == eTKind );
190 }
191 
193  SwClient( pToRegisterIn ),
194  mbInDTOR( false )
195 {}
196 
198 {
199  SetInDTOR();
200 }
201 
202 
204 {
205  mbInDTOR = true;
206 }
207 
210 {
211  // #i46297# - notify background about the arriving of
212  // the object and invalidate its position.
213  const bool bNotify( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) );
214 
215  MoveObjToLayer( true, _pDrawObj );
216 
217  // #i46297#
218  if ( !bNotify )
219  return;
220 
221  SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj );
222  assert(pAnchoredObj);
223  ::setContextWritingMode( _pDrawObj, pAnchoredObj->GetAnchorFrameContainingAnchPos() );
224  // Note: as-character anchored objects aren't registered at a page frame and
225  // a notification of its background isn't needed.
226  if ( pAnchoredObj->GetPageFrame() )
227  {
228  ::Notify_Background( _pDrawObj, pAnchoredObj->GetPageFrame(),
229  pAnchoredObj->GetObjRect(), PrepareHint::FlyFrameArrive, true );
230  }
231 
232  pAnchoredObj->InvalidateObjPos();
233 }
234 
237 {
238  // #i46297# - notify background about the leaving of the object.
239  const bool bNotify( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) );
240 
241  MoveObjToLayer( false, _pDrawObj );
242 
243  // #i46297#
244  if ( bNotify )
245  {
246  SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj );
247  assert(pAnchoredObj);
248  // Note: as-character anchored objects aren't registered at a page frame and
249  // a notification of its background isn't needed.
250  if (pAnchoredObj->GetPageFrame())
251  {
252  ::Notify_Background( _pDrawObj, pAnchoredObj->GetPageFrame(),
253  pAnchoredObj->GetObjRect(), PrepareHint::FlyFrameLeave, true );
254  }
255  }
256 }
257 
263 void SwContact::MoveObjToLayer( const bool _bToVisible,
264  SdrObject* _pDrawObj )
265 {
266  if ( !_pDrawObj )
267  {
268  OSL_FAIL( "SwDrawContact::MoveObjToLayer(..) - no drawing object!" );
269  return;
270  }
271 
272  if ( !GetRegisteredIn() )
273  {
274  OSL_FAIL( "SwDrawContact::MoveObjToLayer(..) - no drawing frame format!" );
275  return;
276  }
277 
278  const IDocumentDrawModelAccess& rIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess();
279 
280  SdrLayerID nToHellLayerId =
281  _bToVisible ? rIDDMA.GetHellId() : rIDDMA.GetInvisibleHellId();
282  SdrLayerID nToHeavenLayerId =
283  _bToVisible ? rIDDMA.GetHeavenId() : rIDDMA.GetInvisibleHeavenId();
284  SdrLayerID nToControlLayerId =
285  _bToVisible ? rIDDMA.GetControlsId() : rIDDMA.GetInvisibleControlsId();
286  SdrLayerID nFromHellLayerId =
287  _bToVisible ? rIDDMA.GetInvisibleHellId() : rIDDMA.GetHellId();
288  SdrLayerID nFromHeavenLayerId =
289  _bToVisible ? rIDDMA.GetInvisibleHeavenId() : rIDDMA.GetHeavenId();
290  SdrLayerID nFromControlLayerId =
291  _bToVisible ? rIDDMA.GetInvisibleControlsId() : rIDDMA.GetControlsId();
292 
293  if ( dynamic_cast<const SdrObjGroup*>( _pDrawObj) != nullptr )
294  {
295  // determine layer for group object
296  {
297  // proposed layer of a group object is the hell layer
298  SdrLayerID nNewLayerId = nToHellLayerId;
299  if ( ::CheckControlLayer( _pDrawObj ) )
300  {
301  // it has to be the control layer, if one of the member
302  // is a control
303  nNewLayerId = nToControlLayerId;
304  }
305  else if ( _pDrawObj->GetLayer() == rIDDMA.GetHeavenId() ||
306  _pDrawObj->GetLayer() == rIDDMA.GetInvisibleHeavenId() )
307  {
308  // it has to be the heaven layer, if method <GetLayer()> reveals
309  // a heaven layer
310  nNewLayerId = nToHeavenLayerId;
311  }
312  // set layer at group object, but do *not* broadcast and
313  // no propagation to the members.
314  // Thus, call <NbcSetLayer(..)> at super class
315  _pDrawObj->SdrObject::NbcSetLayer( nNewLayerId );
316  }
317 
318  // call method recursively for group object members
319  const SdrObjList* pLst =
320  static_cast<SdrObjGroup*>(_pDrawObj)->GetSubList();
321  if ( pLst )
322  {
323  for ( size_t i = 0; i < pLst->GetObjCount(); ++i )
324  {
325  MoveObjToLayer( _bToVisible, pLst->GetObj( i ) );
326  }
327  }
328  }
329  else
330  {
331  const SdrLayerID nLayerIdOfObj = _pDrawObj->GetLayer();
332  if ( nLayerIdOfObj == nFromHellLayerId )
333  {
334  _pDrawObj->SetLayer( nToHellLayerId );
335  }
336  else if ( nLayerIdOfObj == nFromHeavenLayerId )
337  {
338  _pDrawObj->SetLayer( nToHeavenLayerId );
339  }
340  else if ( nLayerIdOfObj == nFromControlLayerId )
341  {
342  _pDrawObj->SetLayer( nToControlLayerId );
343  }
344  }
345 }
346 
348 sal_uInt32 SwContact::GetMinOrdNum() const
349 {
350  sal_uInt32 nMinOrdNum( SAL_MAX_UINT32 );
351 
352  std::vector< SwAnchoredObject* > aObjs;
353  GetAnchoredObjs( aObjs );
354 
355  while ( !aObjs.empty() )
356  {
357  sal_uInt32 nTmpOrdNum = aObjs.back()->GetDrawObj()->GetOrdNum();
358 
359  if ( nTmpOrdNum < nMinOrdNum )
360  {
361  nMinOrdNum = nTmpOrdNum;
362  }
363 
364  aObjs.pop_back();
365  }
366 
367  OSL_ENSURE( nMinOrdNum != SAL_MAX_UINT32,
368  "<SwContact::GetMinOrdNum()> - no order number found." );
369  return nMinOrdNum;
370 }
371 
373 sal_uInt32 SwContact::GetMaxOrdNum() const
374 {
375  sal_uInt32 nMaxOrdNum( 0 );
376 
377  std::vector< SwAnchoredObject* > aObjs;
378  GetAnchoredObjs( aObjs );
379 
380  while ( !aObjs.empty() )
381  {
382  sal_uInt32 nTmpOrdNum = aObjs.back()->GetDrawObj()->GetOrdNum();
383 
384  if ( nTmpOrdNum > nMaxOrdNum )
385  {
386  nMaxOrdNum = nTmpOrdNum;
387  }
388 
389  aObjs.pop_back();
390  }
391 
392  return nMaxOrdNum;
393 }
394 
395 namespace
396 {
397  Point lcl_GetWW8Pos(SwAnchoredObject const * pAnchoredObj, const bool bFollowTextFlow, sw::WW8AnchorConv& reConv)
398  {
399  switch(reConv)
400  {
402  {
403  bool bRelToTableCell(false);
404  Point aPos(pAnchoredObj->GetRelPosToPageFrame(bFollowTextFlow, bRelToTableCell));
405  if(bRelToTableCell)
407  return aPos;
408  }
410  return pAnchoredObj->GetRelPosToAnchorFrame();
412  return pAnchoredObj->GetRelPosToChar();
414  return pAnchoredObj->GetRelPosToLine();
415  default: ;
416  }
417  return Point();
418  }
419 }
420 void SwContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
421 {
422  // this does not call SwClient::SwClientNotify and thus doesn't handle RES_OBJECTDYING as usual. Is this intentional?
423  if (auto pFindSdrObjectHint = dynamic_cast<const sw::FindSdrObjectHint*>(&rHint))
424  {
425  if(!pFindSdrObjectHint->m_rpObject)
426  pFindSdrObjectHint->m_rpObject = GetMaster();
427  }
428  else if (auto pWW8AnchorConvHint = dynamic_cast<const sw::WW8AnchorConvHint*>(&rHint))
429  {
430  // determine anchored object
431  SwAnchoredObject* pAnchoredObj(nullptr);
432  {
433  std::vector<SwAnchoredObject*> aAnchoredObjs;
434  GetAnchoredObjs(aAnchoredObjs);
435  if(!aAnchoredObjs.empty())
436  pAnchoredObj = aAnchoredObjs.front();
437  }
438  // no anchored object found. Thus, the needed layout information can't
439  // be determined. --> no conversion
440  if(!pAnchoredObj)
441  return;
442  // no conversion for anchored drawing object, which aren't attached to an
443  // anchor frame.
444  // This is the case for drawing objects, which are anchored inside a page
445  // header/footer of an *unused* page style.
446  if(dynamic_cast<SwAnchoredDrawObject*>(pAnchoredObj) && !pAnchoredObj->GetAnchorFrame())
447  return;
448  const bool bFollowTextFlow = static_cast<const SwFrameFormat&>(rMod).GetFollowTextFlow().GetValue();
449  sw::WW8AnchorConvResult& rResult(pWW8AnchorConvHint->m_rResult);
450  // No distinction between layout directions, because of missing
451  // information about WW8 in vertical layout.
452  rResult.m_aPos.setX(lcl_GetWW8Pos(pAnchoredObj, bFollowTextFlow, rResult.m_eHoriConv).getX());
453  rResult.m_aPos.setY(lcl_GetWW8Pos(pAnchoredObj, bFollowTextFlow, rResult.m_eVertConv).getY());
454  rResult.m_bConverted = true;
455  }
456 }
457 
458 
460  SwFlyFrameFormat *pToRegisterIn,
461  SdrModel& rTargetModel)
462 : SwContact(pToRegisterIn),
463  mpMasterObj(new SwFlyDrawObj(rTargetModel))
464 {
465  // #i26791# - class <SwFlyDrawContact> contains the 'master'
466  // drawing object of type <SwFlyDrawObj> on its own.
467  mpMasterObj->SetOrdNum( 0xFFFFFFFE );
468  mpMasterObj->SetUserCall( this );
469 }
470 
472 {
473  if ( mpMasterObj )
474  {
475  mpMasterObj->SetUserCall( nullptr );
476  if ( mpMasterObj->getSdrPageFromSdrObject() )
477  mpMasterObj->getSdrPageFromSdrObject()->RemoveObject( mpMasterObj->GetOrdNum() );
478  }
479 }
480 
482 {
483  // search for another Writer fly frame registered at same frame format
485  const SwFlyFrame* pFlyFrame(nullptr);
486  for(pFlyFrame = aIter.First(); pFlyFrame; pFlyFrame = aIter.Next())
487  {
488  if(pFlyFrame != pFly)
489  break;
490  }
491 
492  if(pFlyFrame)
493  {
494  // another Writer fly frame found. Take its order number
495  return pFlyFrame->GetVirtDrawObj()->GetOrdNum();
496  }
497  // no other Writer fly frame found. Take order number of 'master' object
498  // #i35748# - use method <GetOrdNumDirect()> instead
499  // of method <GetOrdNum()> to avoid a recalculation of the order number,
500  // which isn't intended.
501  return GetMaster()->GetOrdNumDirect();
502 }
503 
505 {
506  // Find ContactObject from the Format. If there's already one, we just
507  // need to create a new Ref, else we create the Contact now.
508 
510  SwFlyDrawContact* pContact = pFormat->GetOrCreateContact();
511  SwVirtFlyDrawObj* pDrawObj(
512  new SwVirtFlyDrawObj(
513  pContact->GetMaster()->getSdrModelFromSdrObject(),
514  *pContact->GetMaster(),
515  pFly));
516  pDrawObj->SetUserCall(pContact);
517 
518  // The Reader creates the Masters and inserts them into the Page in
519  // order to transport the z-order.
520  // After creating the first Reference the Masters are removed from the
521  // List and are not important anymore.
522  SdrPage* pPg = pContact->GetMaster()->getSdrPageFromSdrObject();
523  if(nullptr != pPg)
524  {
525  const size_t nOrdNum = pContact->GetMaster()->GetOrdNum();
526  pPg->ReplaceObject(pDrawObj, nOrdNum);
527  }
528  // #i27030# - insert new <SwVirtFlyDrawObj> instance
529  // into drawing page with correct order number
530  else
531  rIDDMA.GetDrawModel()->GetPage(0)->InsertObject(pDrawObj, pContact->GetOrdNumForNewRef(pFly));
532  // #i38889# - assure, that new <SwVirtFlyDrawObj> instance
533  // is in a visible layer.
534  pContact->MoveObjToVisibleLayer(pDrawObj);
535  return pDrawObj;
536 }
537 
538 // #i26791#
540 {
541  assert(pSdrObj);
542  assert(dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) != nullptr);
543  assert(GetUserCall(pSdrObj) == this &&
544  "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belong to this contact");
545 
546  const SwAnchoredObject *const pRetAnchoredObj =
547  static_cast<const SwVirtFlyDrawObj*>(pSdrObj)->GetFlyFrame();
548 
549  return pRetAnchoredObj;
550 }
551 
553 {
554  return const_cast<SwAnchoredObject *>(const_cast<SwFlyDrawContact const*>(this)->GetAnchoredObj(pSdrObj));
555 }
556 
558 {
559  return mpMasterObj.get();
560 }
561 
568 {
569  assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
570 
571  if ( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) )
572  {
573  // nothing to do
574  return;
575  }
576 
577  SwFlyFrame* pFlyFrame = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrame();
578 
579  // #i44464# - consider, that Writer fly frame content
580  // already exists - (e.g. WW8 document is inserted into an existing document).
581  if ( !pFlyFrame->Lower() )
582  {
583  pFlyFrame->InsertColumns();
584  pFlyFrame->Chain( pFlyFrame->AnchorFrame() );
585  pFlyFrame->InsertCnt();
586  }
587  if ( pFlyFrame->GetDrawObjs() )
588  {
589  for (SwAnchoredObject* i : *pFlyFrame->GetDrawObjs())
590  {
591  // #i28701# - consider type of objects in sorted object list.
592  SdrObject* pObj = i->DrawObj();
593  SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
594  pContact->MoveObjToVisibleLayer( pObj );
595  }
596  }
597 
598  // make fly frame visible
600 }
601 
608 {
609  assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
610 
611  if ( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) )
612  {
613  // nothing to do
614  return;
615  }
616 
617  SwFlyFrame* pFlyFrame = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrame();
618 
619  pFlyFrame->Unchain();
620  pFlyFrame->DeleteCnt();
621  if ( pFlyFrame->GetDrawObjs() )
622  {
623  for (SwAnchoredObject* i : *pFlyFrame->GetDrawObjs())
624  {
625  // #i28701# - consider type of objects in sorted object list.
626  SdrObject* pObj = i->DrawObj();
627  SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
628  pContact->MoveObjToInvisibleLayer( pObj );
629  }
630  }
631 
632  // make fly frame invisible
634 }
635 
637 void SwFlyDrawContact::GetAnchoredObjs( std::vector<SwAnchoredObject*>& _roAnchoredObjs ) const
638 {
639  const SwFrameFormat* pFormat = GetFormat();
640  SwFlyFrame::GetAnchoredObjects( _roAnchoredObjs, *pFormat );
641 }
642 void SwFlyDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
643 {
644  SwContact::SwClientNotify(rMod, rHint);
645  if(auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
646  {
647  // #i11176#
648  // This also needs to work when no layout exists. Thus, for
649  // FlyFrames an alternative method is used now in that case.
650  auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
651  if (pFormat && pFormat->Which() == RES_FLYFRMFMT && !pFormat->getIDocumentLayoutAccess().GetCurrentViewShell())
652  pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
653  }
654 }
655 
656 // SwDrawContact
657 
658 bool CheckControlLayer( const SdrObject *pObj )
659 {
660  if ( SdrInventor::FmForm == pObj->GetObjInventor() )
661  return true;
662  if (const SdrObjGroup *pObjGroup = dynamic_cast<const SdrObjGroup*>(pObj))
663  {
664  const SdrObjList *pLst = pObjGroup->GetSubList();
665  for ( size_t i = 0; i < pLst->GetObjCount(); ++i )
666  {
667  if ( ::CheckControlLayer( pLst->GetObj( i ) ) )
668  {
669  // #i18447# - return correct value ;-)
670  return true;
671  }
672  }
673  }
674  return false;
675 }
676 
678  SwContact( pToRegisterIn ),
679  maAnchoredDrawObj(),
680  mbMasterObjCleared( false ),
681  mbDisconnectInProgress( false ),
682  mbUserCallActive( false ),
683  // Note: value of <meEventTypeOfCurrentUserCall> isn't of relevance, because
684  // <mbUserCallActive> is false.
685  meEventTypeOfCurrentUserCall( SdrUserCallType::MoveOnly )
686 {
687  // --> #i33909# - assure, that drawing object is inserted
688  // in the drawing page.
689  if ( !pObj->IsInserted() )
690  {
691  pToRegisterIn->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
692  InsertObject( pObj, pObj->GetOrdNumDirect() );
693  }
694 
695  // Controls have to be always in the Control-Layer. This is also true for
696  // group objects, if they contain controls.
697  if ( ::CheckControlLayer( pObj ) )
698  {
699  // set layer of object to corresponding invisible layer.
700  pObj->SetLayer( pToRegisterIn->getIDocumentDrawModelAccess().GetInvisibleControlsId() );
701  }
702 
703  // #i26791#
704  pObj->SetUserCall( this );
705  maAnchoredDrawObj.SetDrawObj( *pObj );
706 
707  // if there already exists an SwXShape for the object, ensure it knows about us, and the SdrObject
708  // #i99056#
710 }
711 
713 {
714  SetInDTOR();
715 
717 
718  // remove 'master' from drawing page
720 
721  // remove and destroy 'virtual' drawing objects.
723 
724  if ( !mbMasterObjCleared )
725  {
726  SdrObject* pObject = const_cast< SdrObject* >( maAnchoredDrawObj.GetDrawObj() );
727  SdrObject::Free( pObject );
728  }
729 }
730 
731 void SwDrawContact::GetTextObjectsFromFormat(std::list<SdrTextObj*>& o_rTextObjects, SwDoc* pDoc)
732 {
733  for(auto& rpFly : *pDoc->GetSpzFrameFormats())
734  {
735  if(dynamic_cast<const SwDrawFrameFormat*>(rpFly))
736  rpFly->CallSwClientNotify(sw::CollectTextObjectsHint(o_rTextObjects));
737  }
738 }
739 
740 // #i26791#
742 {
743  // handle default parameter value
744  if (!pSdrObj)
745  {
746  pSdrObj = GetMaster();
747  }
748 
749  assert(pSdrObj);
750  assert(dynamic_cast<const SwDrawVirtObj*>(pSdrObj) != nullptr ||
751  dynamic_cast<const SdrVirtObj*>(pSdrObj) == nullptr);
752  assert((GetUserCall(pSdrObj) == this ||
753  pSdrObj == GetMaster()) &&
754  "<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
755 
756  const SwAnchoredObject* pRetAnchoredObj = nullptr;
757 
758  if (auto pVirtObj = dynamic_cast<const SwDrawVirtObj*>(pSdrObj))
759  {
760  pRetAnchoredObj = &(pVirtObj->GetAnchoredObj());
761  }
762  else
763  {
764  assert(dynamic_cast<const SdrVirtObj*>(pSdrObj) == nullptr);
765  pRetAnchoredObj = &maAnchoredDrawObj;
766  }
767 
768  return pRetAnchoredObj;
769 }
770 
772 {
773  return const_cast<SwAnchoredObject*>(const_cast<SwDrawContact const*>(this)->GetAnchoredObj(pSdrObj));
774 }
775 
777 {
778  return !mbMasterObjCleared
780  : nullptr;
781 }
782 
783 const SwFrame* SwDrawContact::GetAnchorFrame( const SdrObject* _pDrawObj ) const
784 {
785  const SwFrame* pAnchorFrame = nullptr;
786  if ( !_pDrawObj ||
787  _pDrawObj == GetMaster() ||
788  ( !_pDrawObj->GetUserCall() &&
789  GetUserCall( _pDrawObj ) == this ) )
790  {
791  pAnchorFrame = maAnchoredDrawObj.GetAnchorFrame();
792  }
793  else
794  {
795  assert(dynamic_cast<SwDrawVirtObj const*>(_pDrawObj) != nullptr);
796  pAnchorFrame = static_cast<const SwDrawVirtObj*>(_pDrawObj)->GetAnchorFrame();
797  }
798 
799  return pAnchorFrame;
800 }
801 
803 {
804  return const_cast<SwFrame *>(const_cast<SwDrawContact const*>(this)->GetAnchorFrame(pDrawObj));
805 }
806 
810 {
811  maDrawVirtObjs.push_back(
813  new SwDrawVirtObj(
814  GetMaster()->getSdrModelFromSdrObject(),
815  *GetMaster(),
816  *this)));
817  maDrawVirtObjs.back()->AddToDrawingPage();
818  return maDrawVirtObjs.back().get();
819 }
820 
823 {
824  for(auto& rpDrawVirtObj : maDrawVirtObjs)
825  {
826  // remove and destroy 'virtual object'
827  rpDrawVirtObj->RemoveFromWriterLayout();
828  rpDrawVirtObj->RemoveFromDrawingPage();
829  }
830  maDrawVirtObjs.clear();
831 }
832 
833 
836 {
837  SdrObject* pRetDrawObj = nullptr;
838 
839  // #i26791# - compare master frames instead of direct frames
840  const SwFrame* pProposedAnchorFrame = &_rAnchorFrame;
841  if ( pProposedAnchorFrame->IsContentFrame() )
842  {
843  const SwContentFrame* pTmpFrame =
844  static_cast<const SwContentFrame*>( pProposedAnchorFrame );
845  while ( pTmpFrame->IsFollow() )
846  {
847  pTmpFrame = pTmpFrame->FindMaster();
848  }
849  pProposedAnchorFrame = pTmpFrame;
850  }
851 
852  const SwFrame* pMasterObjAnchorFrame = GetAnchorFrame();
853  if ( pMasterObjAnchorFrame && pMasterObjAnchorFrame->IsContentFrame() )
854  {
855  const SwContentFrame* pTmpFrame =
856  static_cast<const SwContentFrame*>( pMasterObjAnchorFrame );
857  while ( pTmpFrame->IsFollow() )
858  {
859  pTmpFrame = pTmpFrame->FindMaster();
860  }
861  pMasterObjAnchorFrame = pTmpFrame;
862  }
863 
864  if ( pMasterObjAnchorFrame && pMasterObjAnchorFrame == pProposedAnchorFrame )
865  {
866  pRetDrawObj = GetMaster();
867  }
868  else
869  {
870  const auto ppFoundVirtObj(std::find_if(maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
871  VirtObjAnchoredAtFramePred(pProposedAnchorFrame)));
872  if(ppFoundVirtObj != maDrawVirtObjs.end())
873  pRetDrawObj = ppFoundVirtObj->get();
874  }
875 
876  return pRetDrawObj;
877 }
878 
880 {
881  for(const auto& rpDrawVirtObj : maDrawVirtObjs)
882  {
883  SwDrawVirtObj* pDrawVirtObj(rpDrawVirtObj.get());
884  if ( pDrawVirtObj->GetAnchorFrame() )
885  {
886  // #i34640# - determine correct page frame
887  SwPageFrame* pPage = pDrawVirtObj->AnchoredObj().FindPageFrameOfAnchor();
888  if( pOldBoundRect && pPage )
889  {
890  SwRect aOldRect( *pOldBoundRect );
891  aOldRect.Pos() += pDrawVirtObj->GetOffset();
892  if( aOldRect.HasArea() )
893  ::Notify_Background( pDrawVirtObj, pPage,
894  aOldRect, PrepareHint::FlyFrameLeave,true);
895  }
896  // #i34640# - include spacing for wrapping
897  SwRect aRect( pDrawVirtObj->GetAnchoredObj().GetObjRectWithSpaces() );
898  if (aRect.HasArea() && pPage)
899  {
900  SwPageFrame* pPg = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( aRect, pPage )));
901  if ( pPg )
902  ::Notify_Background( pDrawVirtObj, pPg, aRect,
904  }
905  ::ClrContourCache( pDrawVirtObj );
906  }
907  }
908 }
909 
911 static void lcl_NotifyBackgroundOfObj( SwDrawContact const & _rDrawContact,
912  const SdrObject& _rObj,
913  const tools::Rectangle* _pOldObjRect )
914 {
915  // #i34640#
916  SwAnchoredObject* pAnchoredObj =
917  const_cast<SwAnchoredObject*>(_rDrawContact.GetAnchoredObj( &_rObj ));
918  if ( !(pAnchoredObj && pAnchoredObj->GetAnchorFrame()) )
919  return;
920 
921  // #i34640# - determine correct page frame
922  SwPageFrame* pPageFrame = pAnchoredObj->FindPageFrameOfAnchor();
923  if( _pOldObjRect && pPageFrame )
924  {
925  SwRect aOldRect( *_pOldObjRect );
926  if( aOldRect.HasArea() )
927  {
928  // #i34640# - determine correct page frame
929  SwPageFrame* pOldPageFrame = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( aOldRect, pPageFrame )));
930  ::Notify_Background( &_rObj, pOldPageFrame, aOldRect,
932  }
933  }
934  // #i34640# - include spacing for wrapping
935  SwRect aNewRect( pAnchoredObj->GetObjRectWithSpaces() );
936  if( aNewRect.HasArea() && pPageFrame )
937  {
938  pPageFrame = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( aNewRect, pPageFrame )));
939  ::Notify_Background( &_rObj, pPageFrame, aNewRect,
941  }
942  ClrContourCache( &_rObj );
943 }
944 
946  SdrUserCallType eType,
947  const tools::Rectangle& rOldBoundRect )
948 {
949  // #i26791# - no event handling, if existing <SwViewShell>
950  // is in construction
951  SwDoc* pDoc = GetFormat()->GetDoc();
954  {
955  return;
956  }
957 
958  // #i44339#
959  // no event handling, if document is in destruction.
960  // Exception: It's the SdrUserCallType::Delete event
961  if ( pDoc->IsInDtor() && eType != SdrUserCallType::Delete )
962  {
963  return;
964  }
965 
966  //Put on Action, but not if presently anywhere an action runs.
967  bool bHasActions(true);
969  if ( pTmpRoot && pTmpRoot->IsCallbackActionEnabled() )
970  {
972  if ( pSh )
973  {
974  for(SwViewShell& rShell : pSh->GetRingContainer() )
975  {
976  if ( rShell.Imp()->IsAction() || rShell.Imp()->IsIdleAction() )
977  {
978  bHasActions = true;
979  break;
980  }
981  bHasActions = false;
982  }
983  }
984  if(!bHasActions)
985  pTmpRoot->StartAllAction();
986  }
987  SdrObjUserCall::Changed( rObj, eType, rOldBoundRect );
988  Changed_( rObj, eType, &rOldBoundRect ); //Attention, possibly suicidal!
989 
990  if(!bHasActions)
991  pTmpRoot->EndAllAction();
992 }
993 
997 {
998  private:
1002 
1003  public:
1005  SdrUserCallType _eEventType )
1006  : mpDrawContact( _pDrawContact ),
1007  mbParentUserCallActive( _pDrawContact->mbUserCallActive ),
1008  meParentUserCallEventType( _pDrawContact->meEventTypeOfCurrentUserCall )
1009  {
1010  mpDrawContact->mbUserCallActive = true;
1011  mpDrawContact->meEventTypeOfCurrentUserCall = _eEventType;
1012  }
1013 
1015  {
1016  if ( mpDrawContact )
1017  {
1018  mpDrawContact->mbUserCallActive = mbParentUserCallActive;
1020  }
1021  }
1022 
1024  {
1025  mpDrawContact = nullptr;
1026  }
1027 
1028  bool IsNestedUserCall() const
1029  {
1030  return mbParentUserCallActive;
1031  }
1032 
1034  {
1035  if ( !IsNestedUserCall() )
1036  return;
1037 
1038  bool bTmpAssert( true );
1039  // Currently its known, that a nested event SdrUserCallType::Resize
1040  // could occur during parent user call SdrUserCallType::Inserted,
1041  // SdrUserCallType::Delete and SdrUserCallType::Resize for edge objects.
1042  // Also possible are nested SdrUserCallType::ChildResize events for
1043  // edge objects
1044  // Thus, assert all other combinations
1045  if ( ( meParentUserCallEventType == SdrUserCallType::Inserted ||
1046  meParentUserCallEventType == SdrUserCallType::Delete ||
1047  meParentUserCallEventType == SdrUserCallType::Resize ) &&
1048  mpDrawContact->meEventTypeOfCurrentUserCall == SdrUserCallType::Resize )
1049  {
1050  bTmpAssert = false;
1051  }
1052  else if ( meParentUserCallEventType == SdrUserCallType::ChildResize &&
1053  mpDrawContact->meEventTypeOfCurrentUserCall == SdrUserCallType::ChildResize )
1054  {
1055  bTmpAssert = false;
1056  }
1057 
1058  if ( bTmpAssert )
1059  {
1060  OSL_FAIL( "<SwDrawContact::Changed_(..)> - unknown nested <UserCall> event. This is serious." );
1061  }
1062  }
1063 };
1064 
1067 {
1069  {
1070  // Just notify the textbox that the size has changed, the actual object size is not interesting.
1072  SwFormatFrameSize aSize;
1073  aResizeSet.Put(aSize);
1074  SwTextBoxHelper::syncFlyFrameAttr(*pFormat, aResizeSet);
1075  }
1076 }
1077 
1078 // !!!ATTENTION!!! The object may commit suicide!!!
1079 
1081  SdrUserCallType eType,
1082  const tools::Rectangle* pOldBoundRect )
1083 {
1084  // suppress handling of nested <SdrObjUserCall> events
1085  NestedUserCallHdl aNestedUserCallHdl( this, eType );
1086  if ( aNestedUserCallHdl.IsNestedUserCall() )
1087  {
1088  aNestedUserCallHdl.AssertNestedUserCall();
1089  return;
1090  }
1091  // do *not* notify, if document is destructing
1092  // #i35912# - do *not* notify for as-character anchored
1093  // drawing objects.
1094  // #i35007#
1095  // improvement: determine as-character anchored object flag only once.
1096  const bool bAnchoredAsChar = ObjAnchoredAsChar();
1097  const bool bNotify = !(GetFormat()->GetDoc()->IsInDtor()) &&
1098  ( css::text::WrapTextMode_THROUGH != GetFormat()->GetSurround().GetSurround() ) &&
1099  !bAnchoredAsChar;
1100  switch( eType )
1101  {
1102  case SdrUserCallType::Delete:
1103  {
1104  if ( bNotify )
1105  {
1106  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1107  // --> #i36181# - background of 'virtual'
1108  // drawing objects have also been notified.
1109  NotifyBackgrdOfAllVirtObjs( pOldBoundRect );
1110  }
1111  DisconnectFromLayout( false );
1112  mbMasterObjCleared = true;
1113  delete this;
1114  // --> #i65784# Prevent memory corruption
1115  aNestedUserCallHdl.DrawContactDeleted();
1116  break;
1117  }
1118  case SdrUserCallType::Inserted:
1119  {
1120  if ( mbDisconnectInProgress )
1121  {
1122  OSL_FAIL( "<SwDrawContact::Changed_(..)> - Insert event during disconnection from layout is invalid." );
1123  }
1124  else
1125  {
1126  ConnectToLayout();
1127  if ( bNotify )
1128  {
1129  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1130  }
1131  }
1132  break;
1133  }
1134  case SdrUserCallType::Removed:
1135  {
1136  if ( bNotify )
1137  {
1138  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1139  }
1140  DisconnectFromLayout( false );
1141  break;
1142  }
1143  case SdrUserCallType::ChildInserted :
1144  case SdrUserCallType::ChildRemoved :
1145  {
1146  // --> #i113730#
1147  // force layer of controls for group objects containing control objects
1148  if(dynamic_cast< SdrObjGroup* >(maAnchoredDrawObj.DrawObj()))
1149  {
1151  {
1152  const IDocumentDrawModelAccess& rIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess();
1153  const SdrLayerID aCurrentLayer(maAnchoredDrawObj.DrawObj()->GetLayer());
1154  const SdrLayerID aControlLayerID(rIDDMA.GetControlsId());
1155  const SdrLayerID aInvisibleControlLayerID(rIDDMA.GetInvisibleControlsId());
1156 
1157  if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID)
1158  {
1159  if ( aCurrentLayer == rIDDMA.GetInvisibleHellId() ||
1160  aCurrentLayer == rIDDMA.GetInvisibleHeavenId() )
1161  {
1162  maAnchoredDrawObj.DrawObj()->SetLayer(aInvisibleControlLayerID);
1163  }
1164  else
1165  {
1166  maAnchoredDrawObj.DrawObj()->SetLayer(aControlLayerID);
1167  }
1168  }
1169  }
1170  }
1171  [[fallthrough]];
1172  }
1173  case SdrUserCallType::MoveOnly:
1174  case SdrUserCallType::Resize:
1175  case SdrUserCallType::ChildMoveOnly :
1176  case SdrUserCallType::ChildResize :
1177  case SdrUserCallType::ChildChangeAttr :
1178  case SdrUserCallType::ChildDelete :
1179  {
1180  // #i31698# - improvement
1181  // get instance <SwAnchoredDrawObject> only once
1182  const SwAnchoredDrawObject* pAnchoredDrawObj =
1183  static_cast<const SwAnchoredDrawObject*>( GetAnchoredObj( &rObj ) );
1184 
1185  /* protect against NULL pointer dereferencing */
1186  if(!pAnchoredDrawObj)
1187  {
1188  break;
1189  }
1190 
1191  // #i26791# - adjust positioning and alignment attributes,
1192  // if positioning of drawing object isn't in progress.
1193  // #i53320# - no adjust of positioning attributes,
1194  // if drawing object isn't positioned.
1195  if ( !pAnchoredDrawObj->IsPositioningInProgress() &&
1196  !pAnchoredDrawObj->NotYetPositioned() )
1197  {
1198  // #i34748# - If no last object rectangle is
1199  // provided by the anchored object, use parameter <pOldBoundRect>.
1200  const tools::Rectangle& aOldObjRect = pAnchoredDrawObj->GetLastObjRect()
1201  ? *(pAnchoredDrawObj->GetLastObjRect())
1202  : *pOldBoundRect;
1203  // #i79400#
1204  // always invalidate object rectangle inclusive spaces
1205  pAnchoredDrawObj->InvalidateObjRectWithSpaces();
1206  // #i41324# - notify background before
1207  // adjusting position
1208  if ( bNotify )
1209  {
1210  // #i31573# - correction
1211  // background of given drawing object.
1212  lcl_NotifyBackgroundOfObj( *this, rObj, &aOldObjRect );
1213  }
1214  // #i31698# - determine layout direction
1215  // via draw frame format.
1216  SwFrameFormat::tLayoutDir eLayoutDir =
1217  pAnchoredDrawObj->GetFrameFormat().GetLayoutDir();
1218  // use geometry of drawing object
1219  SwRect aObjRect( rObj.GetSnapRect() );
1220  // If drawing object is a member of a group, the adjustment
1221  // of the positioning and the alignment attributes has to
1222  // be done for the top group object.
1223  if ( rObj.getParentSdrObjectFromSdrObject() )
1224  {
1225  const SdrObject* pGroupObj = rObj.getParentSdrObjectFromSdrObject();
1226  while ( pGroupObj->getParentSdrObjectFromSdrObject() )
1227  {
1228  pGroupObj = pGroupObj->getParentSdrObjectFromSdrObject();
1229  }
1230  // use geometry of drawing object
1231  aObjRect = pGroupObj->GetSnapRect();
1232  }
1233  SwTwips nXPosDiff(0);
1234  SwTwips nYPosDiff(0);
1235  switch ( eLayoutDir )
1236  {
1238  {
1239  nXPosDiff = aObjRect.Left() - aOldObjRect.Left();
1240  nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
1241  }
1242  break;
1244  {
1245  nXPosDiff = aOldObjRect.Right() - aObjRect.Right();
1246  nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
1247  }
1248  break;
1250  {
1251  nXPosDiff = aObjRect.Top() - aOldObjRect.Top();
1252  nYPosDiff = aOldObjRect.Right() - aObjRect.Right();
1253  }
1254  break;
1255  default:
1256  {
1257  assert(!"<SwDrawContact::Changed_(..)> - unsupported layout direction");
1258  }
1259  }
1260  SfxItemSet aSet( GetFormat()->GetDoc()->GetAttrPool(),
1262  const SwFormatVertOrient& rVert = GetFormat()->GetVertOrient();
1263  if ( nYPosDiff != 0 )
1264  {
1265 
1266  if ( rVert.GetRelationOrient() == text::RelOrientation::CHAR ||
1267  rVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
1268  {
1269  nYPosDiff = -nYPosDiff;
1270  }
1271  aSet.Put( SwFormatVertOrient( rVert.GetPos()+nYPosDiff,
1273  rVert.GetRelationOrient() ) );
1274  }
1275 
1276  const SwFormatHoriOrient& rHori = GetFormat()->GetHoriOrient();
1277  if ( !bAnchoredAsChar && nXPosDiff != 0 )
1278  {
1279  aSet.Put( SwFormatHoriOrient( rHori.GetPos()+nXPosDiff,
1281  rHori.GetRelationOrient() ) );
1282  }
1283 
1284  if ( nYPosDiff ||
1285  ( !bAnchoredAsChar && nXPosDiff != 0 ) )
1286  {
1287  GetFormat()->GetDoc()->SetFlyFrameAttr( *(GetFormat()), aSet );
1288  // keep new object rectangle, to avoid multiple
1289  // changes of the attributes by multiple event from
1290  // the drawing layer - e.g. group objects and its members
1291  // #i34748# - use new method
1292  // <SwAnchoredDrawObject::SetLastObjRect(..)>.
1293  const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
1294  ->SetLastObjRect( aObjRect.SVRect() );
1295  }
1296  else if ( aObjRect.SSize() != aOldObjRect.GetSize() )
1297  {
1298  InvalidateObjs_();
1299  // #i35007# - notify anchor frame
1300  // of as-character anchored object
1301  if ( bAnchoredAsChar )
1302  {
1303  SwFrame* pAnchorFrame = const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)->AnchorFrame();
1304  if(pAnchorFrame)
1305  {
1307  }
1308  }
1309 
1311  }
1312  else if (eType == SdrUserCallType::Resize)
1313  // Even if the bounding box of the shape didn't change,
1314  // notify about the size change, as an adjustment change
1315  // may affect the size of the underlying textbox.
1317  }
1318  }
1319  break;
1320  case SdrUserCallType::ChangeAttr:
1321  if ( bNotify )
1322  {
1323  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1324  }
1325  break;
1326  default:
1327  break;
1328  }
1329 }
1330 
1331 namespace
1332 {
1333  const SwFormatAnchor* lcl_getAnchorFormat( const SfxPoolItem& _rItem )
1334  {
1335  sal_uInt16 nWhich = _rItem.Which();
1336  const SwFormatAnchor* pAnchorFormat = nullptr;
1337  if ( RES_ATTRSET_CHG == nWhich )
1338  {
1339  static_cast<const SwAttrSetChg&>(_rItem).GetChgSet()->
1340  GetItemState( RES_ANCHOR, false, reinterpret_cast<const SfxPoolItem**>(&pAnchorFormat) );
1341  }
1342  else if ( RES_ANCHOR == nWhich )
1343  {
1344  pAnchorFormat = &static_cast<const SwFormatAnchor&>(_rItem);
1345  }
1346  return pAnchorFormat;
1347  }
1348 }
1349 
1350 void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
1351 {
1352  SwClient::SwClientNotify(rMod, rHint); // needed as SwContact::SwClientNotify doesn't explicitly call SwClient::SwClientNotify
1353  SwContact::SwClientNotify(rMod, rHint);
1354  if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
1355  {
1356  SAL_WARN_IF(mbDisconnectInProgress, "sw.core", "<SwDrawContact::Modify(..)> called during disconnection.");
1357 
1358  const SfxPoolItem* pNew = pLegacyHint->m_pNew;
1359  sal_uInt16 nWhich = pNew ? pNew->Which() : 0;
1360  if(const SwFormatAnchor* pNewAnchorFormat = pNew ? lcl_getAnchorFormat(*pNew) : nullptr)
1361  {
1362  // Do not respond to a Reset Anchor!
1363  if(GetFormat()->GetAttrSet().GetItemState(RES_ANCHOR, false) == SfxItemState::SET)
1364  {
1365  // no connect to layout during disconnection
1367  {
1368  // determine old object rectangle of 'master' drawing object
1369  // for notification
1370  const tools::Rectangle* pOldRect = nullptr;
1371  tools::Rectangle aOldRect;
1372  if(GetAnchorFrame())
1373  {
1374  // --> #i36181# - include spacing in object
1375  // rectangle for notification.
1377  pOldRect = &aOldRect;
1378  }
1379  // re-connect to layout due to anchor format change
1380  ConnectToLayout(pNewAnchorFormat);
1381  // notify background of drawing objects
1382  lcl_NotifyBackgroundOfObj(*this, *GetMaster(), pOldRect);
1383  NotifyBackgrdOfAllVirtObjs(pOldRect);
1384 
1385  const SwFormatAnchor* pOldAnchorFormat = pLegacyHint->m_pOld ? lcl_getAnchorFormat(*pLegacyHint->m_pOld) : nullptr;
1386  if(!pOldAnchorFormat || (pOldAnchorFormat->GetAnchorId() != pNewAnchorFormat->GetAnchorId()))
1387  {
1389  {
1390  // --> #i102752#
1391  // assure that a ShapePropertyChangeNotifier exists
1393  }
1394  else
1395  SAL_WARN("sw.core", "SwDrawContact::Modify: no draw object here?");
1396  }
1397  }
1398  }
1399  else
1401  }
1402  else if (nWhich == RES_REMOVE_UNO_OBJECT)
1403  {} // nothing to do
1404  // --> #i62875# - no further notification, if not connected to Writer layout
1405  else if ( maAnchoredDrawObj.GetAnchorFrame() &&
1407  {
1408  bool bUpdateSortedObjsList(false);
1409  switch(nWhich)
1410  {
1411  case RES_UL_SPACE:
1412  case RES_LR_SPACE:
1413  case RES_HORI_ORIENT:
1414  case RES_VERT_ORIENT:
1415  case RES_FOLLOW_TEXT_FLOW: // #i28701# - add attribute 'Follow text flow'
1416  break;
1417  case RES_SURROUND:
1418  case RES_OPAQUE:
1420  // --> #i28701# - on change of wrapping style, hell|heaven layer,
1421  // or wrapping style influence an update of the <SwSortedObjs> list,
1422  // the drawing object is registered in, has to be performed. This is triggered
1423  // by the 1st parameter of method call <InvalidateObjs_(..)>.
1424  bUpdateSortedObjsList = true;
1425  break;
1426  case RES_ATTRSET_CHG: // #i35443#
1427  {
1428  auto pChgSet = static_cast<const SwAttrSetChg*>(pNew)->GetChgSet();
1429  if(pChgSet->GetItemState(RES_SURROUND, false) == SfxItemState::SET ||
1430  pChgSet->GetItemState(RES_OPAQUE, false) == SfxItemState::SET ||
1431  pChgSet->GetItemState(RES_WRAP_INFLUENCE_ON_OBJPOS, false) == SfxItemState::SET)
1432  bUpdateSortedObjsList = true;
1433  }
1434  break;
1435  default:
1436  assert(!"<SwDraw Contact::Modify(..)> - unhandled attribute?");
1437  }
1438  lcl_NotifyBackgroundOfObj(*this, *GetMaster(), nullptr);
1439  NotifyBackgrdOfAllVirtObjs(nullptr);
1440  InvalidateObjs_(bUpdateSortedObjsList);
1441  }
1442 
1443  // #i51474#
1445  }
1446  else if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
1447  {
1448  switch(pDrawFrameFormatHint->m_eId)
1449  {
1451  delete this;
1452  break;
1455  break;
1458  // #i40845# - follow-up of #i35635#
1459  // move object to visible layer
1461  break;
1464  break;
1468  break;
1470  ConnectToLayout();
1471  break;
1474  break;
1475  default:
1476  ;
1477  }
1478  }
1479  else if (auto pCheckDrawFrameFormatLayerHint = dynamic_cast<const sw::CheckDrawFrameFormatLayerHint*>(&rHint))
1480  {
1481  *(pCheckDrawFrameFormatLayerHint->m_bCheckControlLayer) |= (GetMaster() && CheckControlLayer(GetMaster()));
1482  }
1483  else if (auto pContactChangedHint = dynamic_cast<const sw::ContactChangedHint*>(&rHint))
1484  {
1485  if(!*pContactChangedHint->m_ppObject)
1486  *pContactChangedHint->m_ppObject = GetMaster();
1487  auto pObject = *pContactChangedHint->m_ppObject;
1488  Changed(*pObject, SdrUserCallType::Delete, pObject->GetLastBoundRect());
1489  }
1490  else if (auto pDrawFormatLayoutCopyHint = dynamic_cast<const sw::DrawFormatLayoutCopyHint*>(&rHint))
1491  {
1492  const SwDrawFrameFormat& rFormat = static_cast<const SwDrawFrameFormat&>(rMod);
1493  new SwDrawContact(
1494  &pDrawFormatLayoutCopyHint->m_rDestFormat,
1495  pDrawFormatLayoutCopyHint->m_rDestDoc.CloneSdrObj(
1496  *GetMaster(),
1497  pDrawFormatLayoutCopyHint->m_rDestDoc.IsCopyIsMove() && &pDrawFormatLayoutCopyHint->m_rDestDoc == rFormat.GetDoc()));
1498  // #i49730# - notify draw frame format that position attributes are
1499  // already set, if the position attributes are already set at the
1500  // source draw frame format.
1501  if(rFormat.IsPosAttrSet())
1502  pDrawFormatLayoutCopyHint->m_rDestFormat.PosAttrSet();
1503  }
1504  else if (auto pRestoreFlyAnchorHint = dynamic_cast<const sw::RestoreFlyAnchorHint*>(&rHint))
1505  {
1506  SdrObject* pObj = GetMaster();
1507  if(GetAnchorFrame() && !pObj->IsInserted())
1508  {
1509  auto pDrawModel = const_cast<SwDrawFrameFormat&>(static_cast<const SwDrawFrameFormat&>(rMod)).GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
1510  assert(pDrawModel);
1511  pDrawModel->GetPage(0)->InsertObject(pObj);
1512  }
1513  pObj->SetRelativePos(pRestoreFlyAnchorHint->m_aPos);
1514  }
1515  else if (auto pCreatePortionHint = dynamic_cast<const sw::CreatePortionHint*>(&rHint))
1516  {
1517  if(*pCreatePortionHint->m_ppContact)
1518  return;
1519  *pCreatePortionHint->m_ppContact = this; // This is kind of ridiculous: the FrameFormat doesn't even hold a pointer to the contact itself, but here we are leaking it out randomly
1520  if(!GetAnchorFrame())
1521  {
1522  // No direct positioning needed any more
1523  ConnectToLayout();
1524  // Move object to visible layer
1526  }
1527  }
1528  else if (auto pCollectTextObjectsHint = dynamic_cast<const sw::CollectTextObjectsHint*>(&rHint))
1529  {
1530  auto pSdrO = GetMaster();
1531  if(!pSdrO)
1532  return;
1533  if(dynamic_cast<const SdrObjGroup*>(pSdrO))
1534  {
1535  SdrObjListIter aListIter(*pSdrO, SdrIterMode::DeepNoGroups);
1536  //iterate inside of a grouped object
1537  while(aListIter.IsMore())
1538  {
1539  SdrObject* pSdrOElement = aListIter.Next();
1540  auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrOElement));
1541  if(pTextObj && pTextObj->HasText())
1542  pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
1543  }
1544  }
1545  else if(auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrO)))
1546  {
1547  if(pTextObj->HasText())
1548  pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
1549  }
1550  }
1551  else if (auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
1552  {
1553  auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
1554  if(pFormat->Which() == RES_DRAWFRMFMT)
1555  pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
1556  }
1557  else if (auto pConnectedHint = dynamic_cast<const sw::GetObjectConnectedHint*>(&rHint))
1558  {
1559  pConnectedHint->m_risConnected |= (GetAnchorFrame() != nullptr);
1560  }
1561 }
1562 
1563 // #i26791#
1564 // #i28701# - added parameter <_bUpdateSortedObjsList>
1565 void SwDrawContact::InvalidateObjs_( const bool _bUpdateSortedObjsList )
1566 {
1567  for(const auto& rpDrawVirtObj : maDrawVirtObjs)
1568  // invalidate position of existing 'virtual' drawing objects
1569  {
1570  SwDrawVirtObj* pDrawVirtObj(rpDrawVirtObj.get());
1571  // #i33313# - invalidation only for connected
1572  // 'virtual' drawing objects
1573  if ( pDrawVirtObj->IsConnected() )
1574  {
1575  pDrawVirtObj->AnchoredObj().InvalidateObjPos();
1576  // #i28701#
1577  if ( _bUpdateSortedObjsList )
1578  {
1579  pDrawVirtObj->AnchoredObj().UpdateObjInSortedList();
1580  }
1581  }
1582  }
1583 
1584  // invalidate position of 'master' drawing object
1585  SwAnchoredObject* pAnchoredObj = GetAnchoredObj( nullptr );
1586  pAnchoredObj->InvalidateObjPos();
1587  // #i28701#
1588  if ( _bUpdateSortedObjsList )
1589  {
1590  pAnchoredObj->UpdateObjInSortedList();
1591  }
1592 }
1593 
1594 void SwDrawContact::DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer )
1595 {
1596  mbDisconnectInProgress = true;
1597 
1598  // --> #i36181# - notify background of drawing object
1599  if ( _bMoveMasterToInvisibleLayer &&
1600  !(GetFormat()->GetDoc()->IsInDtor()) &&
1601  GetAnchorFrame() && !GetAnchorFrame()->IsInDtor() )
1602  {
1604  lcl_NotifyBackgroundOfObj( *this, *GetMaster(), &aOldRect );
1605  NotifyBackgrdOfAllVirtObjs( &aOldRect );
1606  }
1607 
1608  // remove 'virtual' drawing objects from writer
1609  // layout and from drawing page
1610  for(auto& rpVirtDrawObj : maDrawVirtObjs)
1611  {
1612  rpVirtDrawObj->RemoveFromWriterLayout();
1613  rpVirtDrawObj->RemoveFromDrawingPage();
1614  }
1615 
1617  {
1619  }
1620 
1621  if ( _bMoveMasterToInvisibleLayer && GetMaster() && GetMaster()->IsInserted() )
1622  {
1623  SdrViewIter aIter( GetMaster() );
1624  for( SdrView* pView = aIter.FirstView(); pView;
1625  pView = aIter.NextView() )
1626  {
1627  pView->MarkObj( GetMaster(), pView->GetSdrPageView(), true );
1628  }
1629 
1630  // Instead of removing 'master' object from drawing page, move the
1631  // 'master' drawing object into the corresponding invisible layer.
1632  {
1633  //static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)->
1634  // RemoveObject( GetMaster()->GetOrdNum() );
1635  // #i18447# - in order to consider group object correct
1636  // use new method <SwDrawContact::MoveObjToInvisibleLayer(..)>
1638  }
1639  }
1640 
1641  mbDisconnectInProgress = false;
1642 }
1643 
1646 {
1647  if ( GetMaster() )
1648  {
1649  GetMaster()->SetUserCall( nullptr );
1650  if ( GetMaster()->IsInserted() )
1651  {
1652  static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
1653  RemoveObject( GetMaster()->GetOrdNum() );
1654  }
1655  }
1656 }
1657 
1658 // disconnect for a dedicated drawing object - could be 'master' or 'virtual'.
1659 // a 'master' drawing object will disconnect a 'virtual' drawing object
1660 // in order to take its place.
1661 // #i19919# - no special case, if drawing object isn't in
1662 // page header/footer, in order to get drawing objects in repeating table headers
1663 // also working.
1665 {
1666  if ( dynamic_cast<const SwDrawVirtObj*>( _pDrawObj) != nullptr )
1667  {
1668  SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(_pDrawObj);
1669  pDrawVirtObj->RemoveFromWriterLayout();
1670  pDrawVirtObj->RemoveFromDrawingPage();
1671  }
1672  else
1673  {
1674  const auto ppVirtDrawObj(std::find_if(maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
1675  [] (const SwDrawVirtObjPtr& pObj) { return pObj->IsConnected(); }));
1676 
1677  if(ppVirtDrawObj != maDrawVirtObjs.end())
1678  {
1679  // replace found 'virtual' drawing object by 'master' drawing
1680  // object and disconnect the 'virtual' one
1681  SwDrawVirtObj* pDrawVirtObj(ppVirtDrawObj->get());
1682  SwFrame* pNewAnchorFrameOfMaster = pDrawVirtObj->AnchorFrame();
1683  // disconnect 'virtual' drawing object
1684  pDrawVirtObj->RemoveFromWriterLayout();
1685  pDrawVirtObj->RemoveFromDrawingPage();
1686  // disconnect 'master' drawing object from current frame
1688  // re-connect 'master' drawing object to frame of found 'virtual'
1689  // drawing object.
1690  pNewAnchorFrameOfMaster->AppendDrawObj( maAnchoredDrawObj );
1691  }
1692  else
1693  {
1694  // no connected 'virtual' drawing object found. Thus, disconnect
1695  // completely from layout.
1697  }
1698  }
1699 }
1700 
1701 static SwTextFrame* lcl_GetFlyInContentAnchor( SwTextFrame* _pProposedAnchorFrame,
1702  SwPosition const& rAnchorPos)
1703 {
1704  SwTextFrame* pAct = _pProposedAnchorFrame;
1705  SwTextFrame* pTmp;
1706  TextFrameIndex const nTextOffset(_pProposedAnchorFrame->MapModelToViewPos(rAnchorPos));
1707  do
1708  {
1709  pTmp = pAct;
1710  pAct = pTmp->GetFollow();
1711  }
1712  while (pAct && nTextOffset >= pAct->GetOffset());
1713  return pTmp;
1714 }
1715 
1717 {
1718  // *no* connect to layout during disconnection from layout.
1719  if ( mbDisconnectInProgress )
1720  {
1721  OSL_FAIL( "<SwDrawContact::ConnectToLayout(..)> called during disconnection.");
1722  return;
1723  }
1724 
1725  // --> #i33909# - *no* connect to layout, if 'master' drawing
1726  // object isn't inserted in the drawing page
1727  if ( !GetMaster()->IsInserted() )
1728  {
1729  OSL_FAIL( "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted -> no connect to layout. Please inform od@openoffice.org" );
1730  return;
1731  }
1732 
1733  SwFrameFormat* pDrawFrameFormat = static_cast<SwFrameFormat*>(GetRegisteredIn());
1734 
1735  if( !pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell() )
1736  return;
1737 
1738  // remove 'virtual' drawing objects from writer
1739  // layout and from drawing page, and remove 'master' drawing object from
1740  // writer layout - 'master' object will remain in drawing page.
1741  DisconnectFromLayout( false );
1742 
1743  if ( !pAnch )
1744  {
1745  pAnch = &(pDrawFrameFormat->GetAnchor());
1746  }
1747 
1748  switch ( pAnch->GetAnchorId() )
1749  {
1750  case RndStdIds::FLY_AT_PAGE:
1751  {
1752  sal_uInt16 nPgNum = pAnch->GetPageNum();
1753  SwViewShell *pShell = pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell();
1754  if( !pShell )
1755  break;
1756  SwRootFrame* pRoot = pShell->GetLayout();
1757  SwPageFrame *pPage = static_cast<SwPageFrame*>(pRoot->Lower());
1758 
1759  for ( sal_uInt16 i = 1; i < nPgNum && pPage; ++i )
1760  {
1761  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
1762  }
1763 
1764  if ( pPage )
1765  {
1766  pPage->AppendDrawObj( maAnchoredDrawObj );
1767  }
1768  else
1769  //Looks stupid but is allowed (compare SwFEShell::SetPageObjsNewPage)
1770  pRoot->SetAssertFlyPages();
1771  }
1772  break;
1773 
1774  case RndStdIds::FLY_AT_CHAR:
1775  case RndStdIds::FLY_AT_PARA:
1776  case RndStdIds::FLY_AT_FLY:
1777  case RndStdIds::FLY_AS_CHAR:
1778  {
1779  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1780  {
1782  }
1783  // support drawing objects in header/footer,
1784  // but not control objects:
1785  // anchor at first found frame the 'master' object and
1786  // at the following frames 'virtual' drawing objects.
1787  // Note: method is similar to <SwFlyFrameFormat::MakeFrames(..)>
1788  SwModify *pModify = nullptr;
1789  if( pAnch->GetContentAnchor() )
1790  {
1791  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AT_FLY )
1792  {
1793  SwNodeIndex aIdx( pAnch->GetContentAnchor()->nNode );
1794  SwContentNode* pCNd = pDrawFrameFormat->GetDoc()->GetNodes().GoNext( &aIdx );
1796  pModify = pCNd;
1797  else
1798  {
1799  const SwNodeIndex& rIdx = pAnch->GetContentAnchor()->nNode;
1800  SwFrameFormats& rFormats = *(pDrawFrameFormat->GetDoc()->GetSpzFrameFormats());
1801  for( auto pFlyFormat : rFormats )
1802  {
1803  if( pFlyFormat->GetContent().GetContentIdx() &&
1804  rIdx == *(pFlyFormat->GetContent().GetContentIdx()) )
1805  {
1806  pModify = pFlyFormat;
1807  break;
1808  }
1809  }
1810  }
1811  }
1812  else
1813  {
1814  pModify = pAnch->GetContentAnchor()->nNode.GetNode().GetContentNode();
1815  }
1816  }
1817 
1818  // #i29199# - It is possible, that
1819  // the anchor doesn't exist - E.g., reordering the
1820  // sub-documents in a master document.
1821  // Note: The anchor will be inserted later.
1822  if ( !pModify )
1823  {
1824  // break to end of the current switch case.
1825  break;
1826  }
1827 
1829  SwFrame* pAnchorFrameOfMaster = nullptr;
1830  for( SwFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
1831  {
1832  // append drawing object, if
1833  // (1) proposed anchor frame isn't a follow and
1834  const bool bFollow = pFrame->IsContentFrame() && static_cast<SwContentFrame*>(pFrame)->IsFollow();
1835  if (bFollow)
1836  continue;
1837 
1838  // (2) drawing object isn't a control object to be anchored
1839  // in header/footer.
1840  const bool bControlInHF = ::CheckControlLayer(GetMaster()) && pFrame->FindFooterOrHeader();
1841  if (bControlInHF)
1842  continue;
1843 
1844  bool bAdd;
1845  if (RndStdIds::FLY_AT_FLY == pAnch->GetAnchorId())
1846  bAdd = true;
1847  else
1848  {
1849  assert(pFrame->IsTextFrame());
1850  bAdd = IsAnchoredObjShown(*static_cast<SwTextFrame*>(pFrame), *pAnch);
1851  }
1852 
1853  if( bAdd )
1854  {
1855  if ( RndStdIds::FLY_AT_FLY == pAnch->GetAnchorId() && !pFrame->IsFlyFrame() )
1856  {
1857  pFrame = pFrame->FindFlyFrame();
1858  assert(pFrame);
1859  }
1860 
1861  // find correct follow for as character anchored objects
1862  if ((pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR) &&
1863  pFrame->IsTextFrame() )
1864  {
1865  pFrame = lcl_GetFlyInContentAnchor(
1866  static_cast<SwTextFrame*>(pFrame),
1867  *pAnch->GetContentAnchor());
1868  }
1869 
1870  if ( !pAnchorFrameOfMaster )
1871  {
1872  // append 'master' drawing object
1873  pAnchorFrameOfMaster = pFrame;
1874  pFrame->AppendDrawObj( maAnchoredDrawObj );
1875  }
1876  else
1877  {
1878  // append 'virtual' drawing object
1879  SwDrawVirtObj* pDrawVirtObj = AddVirtObj();
1880  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1881  {
1882  ClrContourCache( pDrawVirtObj );
1883  }
1884  pFrame->AppendDrawObj( pDrawVirtObj->AnchoredObj() );
1885 
1886  pDrawVirtObj->ActionChanged();
1887  }
1888 
1889  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1890  {
1891  pFrame->InvalidatePrt();
1892  }
1893  }
1894  }
1895  }
1896  break;
1897  default:
1898  assert(!"Unknown Anchor.");
1899  break;
1900  }
1901  if ( GetAnchorFrame() )
1902  {
1904  // #i26791# - invalidate objects instead of direct positioning
1905  InvalidateObjs_();
1906  }
1907 }
1908 
1911 {
1912  if ( !GetMaster()->IsInserted() )
1913  {
1915  ->InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() );
1916  }
1917  GetMaster()->SetUserCall( this );
1918 }
1919 
1921 {
1922  // --> #i28701# - use method <GetPageFrame()>
1923  SwPageFrame* pPg = GetPageFrame();
1924  if ( !pPg && GetAnchorFrame() )
1925  pPg = GetAnchorFrame()->FindPageFrame();
1926  if ( pPg )
1927  pPg = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( rRect, pPg )));
1928  return pPg;
1929 }
1930 
1932 {
1933  if ( mbDisconnectInProgress )
1934  {
1935  OSL_FAIL( "<SwDrawContact::ChkPage()> called during disconnection." );
1936  return;
1937  }
1938 
1939  // --> #i28701#
1942  ? GetPageFrame()
1943  : FindPage( GetMaster()->GetCurrentBoundRect() );
1944  if ( GetPageFrame() == pPg )
1945  return;
1946 
1947  // if drawing object is anchor in header/footer a change of the page
1948  // is a dramatic change. Thus, completely re-connect to the layout
1951  {
1952  ConnectToLayout();
1953  }
1954  else
1955  {
1956  // --> #i28701# - use methods <GetPageFrame()> and <SetPageFrame>
1957  if ( GetPageFrame() )
1961  }
1962 }
1963 
1964 // Important note:
1965 // method is called by method <SwDPage::ReplaceObject(..)>, which called its
1966 // corresponding superclass method <FmFormPage::ReplaceObject(..)>.
1967 // Note: 'master' drawing object *has* to be connected to layout triggered
1968 // by the caller of this, if method is called.
1970 {
1971  DisconnectFromLayout( false );
1972  // consider 'virtual' drawing objects
1974 
1975  GetMaster()->SetUserCall( nullptr );
1976  if(pNewMaster)
1977  maAnchoredDrawObj.SetDrawObj(*pNewMaster);
1978  else
1979  mbMasterObjCleared = true;
1980  GetMaster()->SetUserCall( this );
1981 
1982  InvalidateObjs_();
1983 }
1984 
1986 void SwDrawContact::GetAnchoredObjs(std::vector<SwAnchoredObject*>& o_rAnchoredObjs) const
1987 {
1988  o_rAnchoredObjs.push_back(const_cast<SwAnchoredDrawObject*>(&maAnchoredDrawObj));
1989 
1990  for(auto& rpDrawVirtObj : maDrawVirtObjs)
1991  o_rAnchoredObjs.push_back(&rpDrawVirtObj->AnchoredObj());
1992 }
1993 
1994 // AW: own sdr::contact::ViewContact (VC) sdr::contact::ViewObjectContact (VOC) needed
1995 // since offset is defined different from SdrVirtObj's sdr::contact::ViewContactOfVirtObj.
1996 // For paint, that offset is used by setting at the OutputDevice; for primitives this is
1997 // not possible since we have no OutputDevice, but define the geometry itself.
1998 
1999 namespace sdr::contact
2000 {
2001  namespace {
2002 
2003  class VOCOfDrawVirtObj : public ViewObjectContactOfSdrObj
2004  {
2005  protected:
2014  virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override;
2015 
2016  public:
2017  VOCOfDrawVirtObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
2018  : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
2019  {
2020  }
2021  };
2022 
2023  class VCOfDrawVirtObj : public ViewContactOfVirtObj
2024  {
2025  protected:
2031  virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override;
2032 
2033  public:
2035  explicit VCOfDrawVirtObj(SwDrawVirtObj& rObj)
2036  : ViewContactOfVirtObj(rObj)
2037  {
2038  }
2039 
2041  SwDrawVirtObj& GetSwDrawVirtObj() const
2042  {
2043  return static_cast<SwDrawVirtObj&>(mrObject);
2044  }
2045  };
2046 
2047  }
2048 } // end of namespace sdr::contact
2049 
2050 namespace sdr::contact
2051 {
2053  static void impAddPrimitivesFromGroup(const ViewObjectContact& rVOC, const basegfx::B2DHomMatrix& rOffsetMatrix, const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rxTarget)
2054  {
2055  const sal_uInt32 nSubHierarchyCount(rVOC.GetViewContact().GetObjectCount());
2056 
2057  for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
2058  {
2060 
2061  if(rCandidate.GetViewContact().GetObjectCount())
2062  {
2063  // is a group object itself, call recursively
2064  impAddPrimitivesFromGroup(rCandidate, rOffsetMatrix, rDisplayInfo, rxTarget);
2065  }
2066  else
2067  {
2068  // single object, add primitives; check model-view visibility
2069  if(rCandidate.isPrimitiveVisible(rDisplayInfo))
2070  {
2071  drawinglayer::primitive2d::Primitive2DContainer aNewSequence(rCandidate.getPrimitive2DSequence(rDisplayInfo));
2072 
2073  if(!aNewSequence.empty())
2074  {
2075  // get ranges
2076  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(rCandidate.GetObjectContact().getViewInformation2D());
2077  const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
2078  basegfx::B2DRange aObjectRange(rCandidate.getObjectRange());
2079 
2080  // correct with virtual object's offset
2081  aObjectRange.transform(rOffsetMatrix);
2082 
2083  // check geometrical visibility (with offset)
2084  if(!aViewRange.overlaps(aObjectRange))
2085  {
2086  // not visible, release
2087  aNewSequence.clear();
2088  }
2089  }
2090 
2091  if(!aNewSequence.empty())
2092  {
2093  rxTarget.append(aNewSequence);
2094  }
2095  }
2096  }
2097  }
2098  }
2099 
2100  drawinglayer::primitive2d::Primitive2DContainer VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
2101  {
2102  // tdf#91260 have already checked top-level one is on the right page
2103  assert(isPrimitiveVisible(rDisplayInfo));
2104  // nasty corner case: override to clear page frame to disable the
2105  // sub-objects' anchor check, because their anchor is always on
2106  // the first page that the page style is applied to
2107  DisplayInfo aDisplayInfo(rDisplayInfo);
2108  aDisplayInfo.SetWriterPageFrame(basegfx::B2IRectangle());
2109  const VCOfDrawVirtObj& rVC = static_cast< const VCOfDrawVirtObj& >(GetViewContact());
2110  const SdrObject& rReferencedObject = rVC.GetSwDrawVirtObj().GetReferencedObj();
2112 
2113  // create offset transformation
2114  basegfx::B2DHomMatrix aOffsetMatrix;
2115  const Point aLocalOffset(rVC.GetSwDrawVirtObj().GetOffset());
2116 
2117  if(aLocalOffset.X() || aLocalOffset.Y())
2118  {
2119  aOffsetMatrix.set(0, 2, aLocalOffset.X());
2120  aOffsetMatrix.set(1, 2, aLocalOffset.Y());
2121  }
2122 
2123  if(dynamic_cast<const SdrObjGroup*>( &rReferencedObject) != nullptr)
2124  {
2125  // group object. Since the VOC/OC/VC hierarchy does not represent the
2126  // hierarchy virtual objects when they have group objects
2127  // (ViewContactOfVirtObj::GetObjectCount() returns null for that purpose)
2128  // to avoid multiple usages of VOCs (which would not work), the primitives
2129  // for the sub-hierarchy need to be collected here
2130 
2131  // Get the VOC of the referenced object (the Group) and fetch primitives from it
2132  const ViewObjectContact& rVOCOfRefObj = rReferencedObject.GetViewContact().GetViewObjectContact(GetObjectContact());
2133  impAddPrimitivesFromGroup(rVOCOfRefObj, aOffsetMatrix, aDisplayInfo, xRetval);
2134  }
2135  else
2136  {
2137  // single object, use method from referenced object to get the Primitive2DSequence
2138  xRetval = rReferencedObject.GetViewContact().getViewIndependentPrimitive2DContainer();
2139  }
2140 
2141  if(!xRetval.empty())
2142  {
2143  // create transform primitive
2145  xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference };
2146  }
2147 
2148  return xRetval;
2149  }
2150 
2151  ViewObjectContact& VCOfDrawVirtObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
2152  {
2153  return *(new VOCOfDrawVirtObj(rObjectContact, *this));
2154  }
2155 
2156 } // end of namespace sdr::contact
2157 
2159 std::unique_ptr<sdr::contact::ViewContact> SwDrawVirtObj::CreateObjectSpecificViewContact()
2160 {
2161  return std::make_unique<sdr::contact::VCOfDrawVirtObj>(*this);
2162 }
2163 
2165  SdrModel& rSdrModel,
2166  SdrObject& _rNewObj,
2167  SwDrawContact& _rDrawContact)
2168 : SdrVirtObj(rSdrModel, _rNewObj ),
2169  maAnchoredDrawObj(),
2170  mrDrawContact(_rDrawContact)
2171 {
2172  // #i26791#
2173  maAnchoredDrawObj.SetDrawObj( *this );
2174 
2175  // #i35635# - set initial position out of sight
2176  NbcMove( Size( -16000, -16000 ) );
2177 }
2178 
2180 {
2181 }
2182 
2184 {
2185  SdrVirtObj::operator=(rObj);
2186  // Note: Members <maAnchoredDrawObj> and <mrDrawContact>
2187  // haven't to be considered.
2188  return *this;
2189 }
2190 
2192 {
2193  SwDrawVirtObj* pObj = new SwDrawVirtObj(
2194  rTargetModel,
2195  rRefObj,
2196  mrDrawContact);
2197 
2198  pObj->operator=( *this );
2199  // Note: Member <maAnchoredDrawObj> hasn't to be considered.
2200 
2201  return pObj;
2202 }
2203 
2205 {
2206  // #i26791# - use new member <maAnchoredDrawObj>
2208 }
2209 
2211 {
2212  // #i26791# - use new member <maAnchoredDrawObj>
2213  return maAnchoredDrawObj.AnchorFrame();
2214 }
2215 
2217 {
2218  // remove contact object from frame for 'virtual' drawing object
2219  // #i26791# - use new member <maAnchoredDrawObj>
2221  {
2223  }
2224 }
2225 
2227 {
2228  // determine 'master'
2229  SdrObject* pOrgMasterSdrObj = mrDrawContact.GetMaster();
2230 
2231  // insert 'virtual' drawing object into page, set layer and user call.
2232  SdrPage* pDrawPg = pOrgMasterSdrObj->getSdrPageFromSdrObject();
2233  // #i27030# - apply order number of referenced object
2234  if ( nullptr != pDrawPg )
2235  {
2236  // #i27030# - apply order number of referenced object
2237  pDrawPg->InsertObject( this, GetReferencedObj().GetOrdNum() );
2238  }
2239  else
2240  {
2241  pDrawPg = getSdrPageFromSdrObject();
2242  if ( pDrawPg )
2243  {
2244  pDrawPg->SetObjectOrdNum( GetOrdNumDirect(),
2246  }
2247  else
2248  {
2250  }
2251  }
2253 }
2254 
2256 {
2257  SetUserCall( nullptr );
2258  if ( getSdrPageFromSdrObject() )
2259  {
2261  }
2262 }
2263 
2266 {
2267  bool bRetVal = GetAnchorFrame() &&
2269 
2270  return bRetVal;
2271 }
2272 
2273 void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt)
2274 {
2276 }
2277 
2278 // #i97197#
2279 // the methods relevant for positioning
2280 
2282 {
2283  if(aOutRect.IsEmpty())
2284  {
2285  const_cast<SwDrawVirtObj*>(this)->RecalcBoundRect();
2286  }
2287 
2288  return aOutRect;
2289 }
2290 
2292 {
2293  return aOutRect;
2294 }
2295 
2297 {
2298  // do NOT use IsEmpty() here, there is already a useful offset
2299  // in the position
2300  if(aOutRect == tools::Rectangle())
2301  {
2302  return Point();
2303  }
2304  else
2305  {
2307  }
2308 }
2309 
2311 {
2312  // do nothing to not lose model information in aOutRect
2313 }
2314 
2316 {
2317  // #i26791# - switch order of calling <GetOffset()> and
2318  // <ReferencedObj().GetCurrentBoundRect()>, because <GetOffset()> calculates
2319  // its value by the 'BoundRect' of the referenced object.
2320 
2321  const Point aOffset(GetOffset());
2322  aOutRect = ReferencedObj().GetCurrentBoundRect() + aOffset;
2323 }
2324 
2326 {
2329 
2330  return aRetval;
2331 }
2332 
2334 {
2337 
2338  return aRetval;
2339 }
2340 
2342 {
2343  SdrHdlList tmpList(nullptr);
2344  rRefObj.AddToHdlList(tmpList);
2345 
2346  size_t cnt = tmpList.GetHdlCount();
2347  for(size_t i=0; i < cnt; ++i)
2348  {
2349  SdrHdl* pHdl = tmpList.GetHdl(i);
2350  Point aP(pHdl->GetPos() + GetOffset());
2351  pHdl->SetPos(aP);
2352  }
2353  tmpList.MoveTo(rHdlList);
2354 }
2355 
2356 void SwDrawVirtObj::NbcMove(const Size& rSiz)
2357 {
2358  SdrObject::NbcMove( rSiz );
2359 }
2360 
2361 void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
2362 {
2363  rRefObj.NbcResize(rRef - GetOffset(), xFact, yFact);
2364  SetRectsDirty();
2365 }
2366 
2367 void SwDrawVirtObj::NbcRotate(const Point& rRef, long nAngle, double sn, double cs)
2368 {
2369  rRefObj.NbcRotate(rRef - GetOffset(), nAngle, sn, cs);
2370  SetRectsDirty();
2371 }
2372 
2373 void SwDrawVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
2374 {
2375  rRefObj.NbcMirror(rRef1 - GetOffset(), rRef2 - GetOffset());
2376  SetRectsDirty();
2377 }
2378 
2379 void SwDrawVirtObj::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShear)
2380 {
2381  rRefObj.NbcShear(rRef - GetOffset(), nAngle, tn, bVShear);
2382  SetRectsDirty();
2383 }
2384 
2385 void SwDrawVirtObj::Move(const Size& rSiz)
2386 {
2387  SdrObject::Move( rSiz );
2388 }
2389 
2390 void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
2391 {
2392  if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
2393  {
2394  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2395  rRefObj.Resize(rRef - GetOffset(), xFact, yFact, bUnsetRelative);
2396  SetRectsDirty();
2397  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2398  }
2399 }
2400 
2401 void SwDrawVirtObj::Rotate(const Point& rRef, long nAngle, double sn, double cs)
2402 {
2403  if(nAngle)
2404  {
2405  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2406  rRefObj.Rotate(rRef - GetOffset(), nAngle, sn, cs);
2407  SetRectsDirty();
2408  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2409  }
2410 }
2411 
2412 void SwDrawVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
2413 {
2414  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2415  rRefObj.Mirror(rRef1 - GetOffset(), rRef2 - GetOffset());
2416  SetRectsDirty();
2417  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2418 }
2419 
2420 void SwDrawVirtObj::Shear(const Point& rRef, long nAngle, double tn, bool bVShear)
2421 {
2422  if(nAngle)
2423  {
2424  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2425  rRefObj.Shear(rRef - GetOffset(), nAngle, tn, bVShear);
2426  SetRectsDirty();
2427  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2428  }
2429 }
2430 
2432 {
2434  aSnapRect += GetOffset();
2435 }
2436 
2438 {
2439  const_cast<SwDrawVirtObj*>(this)->aSnapRect = rRefObj.GetSnapRect();
2440  const_cast<SwDrawVirtObj*>(this)->aSnapRect += GetOffset();
2441 
2442  return aSnapRect;
2443 }
2444 
2446 {
2447  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2448  tools::Rectangle aR(rRect);
2449  aR -= GetOffset();
2450  rRefObj.SetSnapRect(aR);
2451  SetRectsDirty();
2452  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2453 }
2454 
2456 {
2457  tools::Rectangle aR(rRect);
2458  aR -= GetOffset();
2459  SetRectsDirty();
2460  rRefObj.NbcSetSnapRect(aR);
2461 }
2462 
2464 {
2465  const_cast<SwDrawVirtObj*>(this)->aSnapRect = rRefObj.GetLogicRect();
2466  const_cast<SwDrawVirtObj*>(this)->aSnapRect += GetOffset();
2467 
2468  return aSnapRect;
2469 }
2470 
2472 {
2473  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2474  tools::Rectangle aR(rRect);
2475  aR -= GetOffset();
2476  rRefObj.SetLogicRect(aR);
2477  SetRectsDirty();
2478  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2479 }
2480 
2482 {
2483  tools::Rectangle aR(rRect);
2484  aR -= GetOffset();
2486  SetRectsDirty();
2487 }
2488 
2490 {
2491  Point aP(rRefObj.GetSnapPoint(i));
2492  aP += GetOffset();
2493 
2494  return aP;
2495 }
2496 
2497 Point SwDrawVirtObj::GetPoint(sal_uInt32 i) const
2498 {
2499  return rRefObj.GetPoint(i) + GetOffset();
2500 }
2501 
2502 void SwDrawVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
2503 {
2504  Point aP(rPnt);
2505  aP -= GetOffset();
2506  rRefObj.SetPoint(aP, i);
2507  SetRectsDirty();
2508 }
2509 
2511 {
2512  return rRefObj.HasTextEdit();
2513 }
2514 
2515 // override 'layer' methods for 'virtual' drawing object to assure
2516 // that layer of 'virtual' object is the layer of the referenced object.
2518 {
2519  return GetReferencedObj().GetLayer();
2520 }
2521 
2523 {
2524  ReferencedObj().NbcSetLayer( nLayer );
2526 }
2527 
2529 {
2530  ReferencedObj().SetLayer( nLayer );
2532 }
2533 
2534 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
void RemoveAllVirtObjs()
remove 'virtual' drawing objects and destroy them.
Definition: dcontact.cxx:822
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:547
sal_uInt32 GetMaxOrdNum() const
get maximum order number of anchored objects handled by with contact
Definition: dcontact.cxx:373
virtual bool HasTextEdit() const
SwFrame * AnchorFrame()
Definition: dcontact.cxx:2210
virtual void MakeObjPos()=0
method to determine position for the object and set the position at the object
SwRect GetBoundRectOfAnchoredObj(const SdrObject *pObj)
returns the BoundRect inclusive distance of the object.
Definition: dcontact.cxx:154
sal_uInt32 GetOrdNumForNewRef(const SwFlyFrame *pFly)
Definition: dcontact.cxx:481
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2718
Base class for the following contact objects (frame + draw objects).
Definition: dcontact.hxx:66
void ChangeMasterObject(SdrObject *pNewMaster)
Moves all SW-connections to new Master)
Definition: dcontact.cxx:1969
Base class of the Writer layout elements.
Definition: frame.hxx:297
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:151
SdrObject * GetDrawObjectByAnchorFrame(const SwFrame &_rAnchorFrame)
get drawing object ('master' or 'virtual') by frame.
Definition: dcontact.cxx:835
virtual SwRect GetObjRect() const =0
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
void InsertCnt()
Definition: fly.cxx:208
SwFlyDrawObjPtr mpMasterObj
Definition: dcontact.hxx:180
SwFlyDrawContact * GetOrCreateContact()
Definition: atrfrm.cxx:2890
SwDrawContact(const SwDrawContact &)=delete
void ChkPage()
Definition: dcontact.cxx:1931
bool IsFollow() const
Definition: flowfrm.hxx:166
WW8AnchorConv
Definition: frmfmt.hxx:294
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:545
SwAnchoredDrawObject maAnchoredDrawObj
anchored drawing object instance for the 'virtual' drawing object
Definition: dcontact.hxx:216
SdrObject & ReferencedObj()
Marks a position in the document model.
Definition: pam.hxx:35
class for the positioning of drawing objects
virtual const tools::Rectangle & GetCurrentBoundRect() const
tools::Rectangle aSnapRect
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true)
void SetPos(const Point &rPnt)
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
SwDrawContact * mpDrawContact
Definition: dcontact.cxx:999
virtual SwDrawVirtObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: dcontact.cxx:2191
bool CheckControlLayer(const SdrObject *pObj)
Definition: dcontact.cxx:658
void InsertColumns()
Definition: fly.cxx:228
void SetPoint(const Point &rPnt, sal_uInt32 i)
SdrObjUserCall * pUserCall
void DisconnectFromLayout(bool _bMoveMasterToInvisibleLayer=true)
Definition: dcontact.cxx:1594
virtual const SwRootFrame * GetCurrentLayout() const =0
std::unique_ptr< SwDrawVirtObj, SdrObjectFreeOp > SwDrawVirtObjPtr
ContactObject for connection of formats as representatives of draw objects in SwClient and the object...
Definition: dcontact.hxx:302
virtual void MoveObjToVisibleLayer(SdrObject *_pDrawObj) override
override methods to control Writer fly frames, which are linked, and to assure that all objects ancho...
Definition: dcontact.cxx:567
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact)
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
SwNodeIndex nNode
Definition: pam.hxx:37
virtual ~SwContact() override
Definition: dcontact.cxx:197
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
Definition: wsfrm.cxx:587
virtual SdrLayerID GetInvisibleControlsId() const =0
OBJ_TEXT
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
const SwFrame * FindPage(const SwRect &rRect, const SwFrame *pPage)
Definition: frmtool.cxx:3605
SwTwips GetPos() const
Definition: fmtornt.hxx:92
static void lcl_NotifyBackgroundOfObj(SwDrawContact const &_rDrawContact, const SdrObject &_rObj, const tools::Rectangle *_pOldObjRect)
local method to notify the background for a drawing object - #i26791#
Definition: dcontact.cxx:911
bool mbMasterObjCleared
boolean indicating set 'master' drawing object has been cleared.
Definition: dcontact.hxx:316
helper class for method for handling nested events ...
Definition: dcontact.cxx:996
virtual SdrLayerID GetHeavenId() const =0
SdrUserCallType
bool IsAnchoredObjShown(SwTextFrame const &rFrame, SwFormatAnchor const &rAnchor)
Definition: frmtool.cxx:1266
void RemoveDrawObjFromPage(SwAnchoredObject &_rToRemoveObj)
Definition: flylay.cxx:1095
virtual ~SwDrawVirtObj() override
Definition: dcontact.cxx:2179
SdrObject * GetObj(size_t nNum) const
bool IsInserted() const
Definition: doc.hxx:184
SwContact(SwFrameFormat *pToRegisterIn)
For reader. Only the connection is created.
Definition: dcontact.cxx:192
virtual SdrLayerID GetControlsId() const =0
size_t GetObjCount() const
TElementType * Next()
Definition: calbck.hxx:351
SwDrawVirtObj(SdrModel &rSdrModel, SdrObject &_rNewObj, SwDrawContact &_rDrawContact)
Definition: dcontact.cxx:2164
virtual ~SwDrawContact() override
Definition: dcontact.cxx:712
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: dcontact.cxx:2341
ViewObjectContact & GetViewObjectContact(ObjectContact &rObjectContact)
SwNode & GetNode() const
Definition: ndindex.hxx:119
void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: dcontact.cxx:642
bool IsPosAttrSet() const
Definition: frmfmt.hxx:397
long SwTwips
Definition: swtypes.hxx:49
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
virtual void Move(const Size &rSiz) override
Definition: dcontact.cxx:2385
void Pos(const Point &rNew)
Definition: swrect.hxx:169
SdrUserCallType meEventTypeOfCurrentUserCall
event type, which is handled for .
Definition: dcontact.hxx:327
virtual void NbcMove(const Size &rSiz) override
Definition: dcontact.cxx:2356
const Point & GetPos() const
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:108
virtual void AddToHdlList(SdrHdlList &rHdlList) const
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
Point GetRelPosToChar() const
method to determine position of anchored object relative to anchor character
static void Free(SdrObject *&_rpObject)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
SwDrawContact & mrDrawContact
writer-drawing contact object the 'virtual' drawing object is controlled by.
Definition: dcontact.hxx:221
void Notify_Background(const SdrObject *pObj, SwPageFrame *pPage, const SwRect &rRect, const PrepareHint eHint, const bool bInva)
Definition: frmtool.cxx:3266
EmbeddedObjectRef * pObject
void Chain(SwFrame *_pAnchor)
Definition: fly.cxx:177
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:171
void DeleteCnt()
Definition: fly.cxx:315
virtual bool HasTextEdit() const override
Definition: dcontact.cxx:2510
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:739
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs)
void MoveObjToLayer(const bool _bToVisible, SdrObject *_pDrawObj)
method to move object to visible/invisible layer
Definition: dcontact.cxx:263
sdr::contact::ViewContact & GetViewContact() const
void DrawContactDeleted()
Definition: dcontact.cxx:1023
SdrTextAniKind
drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(const DisplayInfo &rDisplayInfo) const
virtual Point GetOffset() const override
access to offset
Definition: dcontact.cxx:2296
SwDrawVirtObj * AddVirtObj()
add a 'virtual' drawing object to drawing page.
Definition: dcontact.cxx:809
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:154
virtual const tools::Rectangle & GetSnapRect() const
bool IsEmpty() const
SdrView * NextView()
#define SAL_MAX_UINT32
void SetDrawObj(SdrObject &_rDrawObj)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
bool IsFlyFrame() const
Definition: frame.hxx:1188
wrapper class for the positioning of Writer fly frames and drawing objects
long Right() const
static SwVirtFlyDrawObj * CreateNewRef(SwFlyFrame *pFly, SwFlyFrameFormat *pFormat)
Definition: dcontact.cxx:504
void RemoveDrawObj(SwAnchoredObject &_rToRemoveObj)
Definition: fly.cxx:2258
SwDrawVirtObj & operator=(const SwDrawVirtObj &rObj)
Definition: dcontact.cxx:2183
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
bool IsMore() const
SdrPage * getSdrPageFromSdrObject() const
const SwFrame * GetAnchorFrame(const SdrObject *_pDrawObj=nullptr) const
Definition: dcontact.cxx:783
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: dcontact.cxx:1350
Point GetRelPosToPageFrame(const bool _bFollowTextFlow, bool &_obRelToTableCell) const
method to determine position of anchored object relative to page frame
virtual Point GetSnapPoint(sal_uInt32 i) const
WW8AnchorConv m_eVertConv
Definition: frmfmt.hxx:306
virtual const tools::Rectangle & GetLogicRect() const override
Definition: dcontact.cxx:2463
#define X
SdrObject & rRefObj
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: dcontact.cxx:420
bool IsTextFrame() const
Definition: frame.hxx:1212
bool mbUserCallActive
Needed data for handling of nested events in method ...
Definition: dcontact.hxx:324
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(161)
const SdrObject & GetReferencedObj() const
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
sal_uInt32 GetMinOrdNum() const
get minimum order number of anchored objects handled by with contact
Definition: dcontact.cxx:348
long Top() const
bool mbParentUserCallActive
Definition: dcontact.cxx:1000
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1089
SwFrameFormat * FindFrameFormat(SdrObject *pObj)
The Get reverse way: seeks the format to the specified object.
Definition: dcontact.cxx:120
void AssertNestedUserCall()
Definition: dcontact.cxx:1033
SdrObject * DrawObj()
virtual void GetAnchoredObjs(std::vector< SwAnchoredObject * > &_roAnchoredObjs) const override
get data collection of anchored objects handled by with contact
Definition: dcontact.cxx:637
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: dcontact.cxx:2373
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs)
constexpr TypedWhichId< SwFormatWrapInfluenceOnObjPos > RES_WRAP_INFLUENCE_ON_OBJPOS(125)
virtual void MoveObjToVisibleLayer(SdrObject *_pDrawObj)
method to move drawing object to corresponding visible layer
Definition: dcontact.cxx:209
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect)
bool IsInConstructor() const
Definition: viewsh.hxx:552
SwFrame * AnchorFrame()
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:846
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:429
sal_uInt32 GetOrdNumDirect() const
Specific frame formats (frames, DrawObjects).
bool mbInDTOR
boolean, indicating destruction of contact object important note: boolean has to be set at the beginn...
Definition: dcontact.hxx:71
virtual SdrLayerID GetInvisibleHellId() const =0
ObjectContact & GetObjectContact() const
ContactObject for connection between frames (or their formats respectively) in SwClient and the drawo...
Definition: dcontact.hxx:175
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
AW: Need own sdr::contact::ViewContact since AnchorPos from parent is not used but something own (top...
Definition: dcontact.cxx:2159
bool IsMarqueeTextObj(const SdrObject &rObj)
Returns true if the SrdObject is a Marquee-Object (scrolling text)
Definition: dcontact.cxx:182
bool HasWrap(const SdrObject *pObj)
Definition: dcontact.cxx:139
void AddToDrawingPage()
connection to drawing layer
Definition: dcontact.cxx:2226
virtual void SetLayer(SdrLayerID nLayer)
Style of a layout element.
Definition: frmfmt.hxx:57
Point GetRelPosToLine() const
method to determine position of anchored object relative to top of line
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
Definition: txtfrm.cxx:1259
bool IsContentFrame() const
Definition: frame.hxx:1208
void InsertMasterIntoDrawPage()
method to insert 'master' drawing object into drawing page
Definition: dcontact.cxx:1910
virtual const tools::Rectangle & GetCurrentBoundRect() const override
Definition: dcontact.cxx:2281
const SdrObject * GetDrawObj() const
void InvalidatePrt()
Definition: frame.hxx:1014
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2481
uno_Any a
virtual SdrLayerID GetLayer() const override
Definition: dcontact.cxx:2517
void MoveTo(SdrHdlList &rOther)
void SetAssertFlyPages()
Makes sure that all requested page-bound Flys find a Page.
Definition: rootfrm.hxx:276
static void GetAnchoredObjects(std::vector< SwAnchoredObject * > &, const SwFormat &rFormat)
Definition: fly.cxx:2800
const drawinglayer::geometry::ViewInformation2D & getViewInformation2D() const
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:760
virtual sal_uInt16 GetObjIdentifier() const
virtual SwFrameFormat::tLayoutDir GetLayoutDir() const
Definition: atrfrm.cxx:2807
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
virtual void NbcMirror(const Point &rRef1, const Point &rRef2)
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwPageFrame * FindPageFrame()
Definition: frame.hxx:660
virtual void SetBoundRectDirty() override
Definition: dcontact.cxx:2310
tools::Rectangle aOutRect
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
Definition: flylay.cxx:1046
const SwFrame * Lower() const
Definition: layfrm.hxx:101
TElementType * First()
Definition: calbck.hxx:343
SwContentNode * GetContentNode()
Definition: node.hxx:615
FlyAnchors.
Definition: fmtanchr.hxx:34
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void ActionChanged() const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: dcontact.cxx:2379
static void impAddPrimitivesFromGroup(const ViewObjectContact &rVOC, const basegfx::B2DHomMatrix &rOffsetMatrix, const DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer &rxTarget)
recursively collect primitive data from given VOC with given offset
Definition: dcontact.cxx:2053
bool HasArea() const
Definition: swrect.hxx:288
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
virtual basegfx::B2DPolyPolygon TakeContour() const
void UpdateObjInSortedList()
method to update anchored object in the lists
SdrModel & getSdrModelFromSdrObject() const
void transform(const basegfx::B2DHomMatrix &rMatrix)
sal_uInt32 GetOrdNum() const
virtual void append(const Primitive2DReference &) override
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:349
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const
SwFlyDrawContact(SwFlyFrameFormat *pToRegisterIn, SdrModel &rTargetModel)
Creates DrawObject and registers it with the Model.
Definition: dcontact.cxx:459
virtual void SetLogicRect(const tools::Rectangle &rRect)
Marks a node in the document model.
Definition: ndindex.hxx:31
virtual void Move(const Size &rSiz)
ring_container GetRingContainer()
Definition: ring.hxx:240
void InvalidateObjs_(const bool _bUpdateSortedObjsList=false)
Definition: dcontact.cxx:1565
virtual void InvalidateObjPos()=0
method to invalidate position of the anchored object
virtual void SetRelativePos(const Point &rPnt)
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 const tools::Rectangle & GetLastBoundRect() const override
Definition: dcontact.cxx:2291
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const override
Definition: dcontact.cxx:539
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const =0
void NotifyBackgrdOfAllVirtObjs(const tools::Rectangle *pOldBoundRect)
Definition: dcontact.cxx:879
A page of the document layout.
Definition: pagefrm.hxx:41
virtual SdrObject * RemoveObject(size_t nObjNum)
void notifyShapePropertyChange(const svx::ShapeProperty _eProperty) const
bool SetFlyFrameAttr(SwFrameFormat &rFlyFormat, SfxItemSet &rSet)
Definition: docfly.cxx:558
void Changed_(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle *pOldBoundRect)
Used by Changed() and by UndoDraw.
Definition: dcontact.cxx:1080
SwFrame * GetAnchorFrameContainingAnchPos()
determine anchor frame containing the anchor position
virtual void Mirror(const Point &rRef1, const Point &rRef2)
static sal_uInt16 nPgNum
Definition: viewport.cxx:49
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
Size GetSize() const
#define Y
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(179)
virtual const SdrObject * GetMaster() const =0
virtual SdrInventor GetObjInventor() const
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetLayer() const
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2455
virtual void RecalcBoundRect() override
All overridden methods which need to use the offset.
Definition: dcontact.cxx:2315
virtual void RecalcSnapRect() override
Definition: dcontact.cxx:2431
static void AddExistingShapeToFormat(SdrObject const &_rObj)
Definition: unodraw.cxx:928
std::optional< tools::Rectangle > const & GetLastObjRect() const
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2471
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear)
virtual sal_uInt32 GetObjectCount() const
SdrObject * Next()
size_t GetHdlCount() const
SdrHdl * GetHdl(size_t nNum) const
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: dcontact.cxx:2489
virtual SwFrameFormat & GetFrameFormat() override
virtual void SetLayer(SdrLayerID nLayer) override
Definition: dcontact.cxx:2528
drawinglayer::primitive2d::Primitive2DContainer const & getViewIndependentPrimitive2DContainer() const
tools::Rectangle SVRect() const
Definition: swrect.hxx:280
sal_Int32 GetDenominator() const
virtual SdrObject * ReplaceObject(SdrObject *pNewObj, size_t nObjNum)
virtual const tools::Rectangle & GetSnapRect() const override
Definition: dcontact.cxx:2437
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
virtual void NbcSetSnapRect(const tools::Rectangle &rRect)
SwPageFrame * FindPageFrameOfAnchor()
method to determine the page frame, on which the 'anchor' of the given anchored object is...
#define SAL_WARN_IF(condition, area, stream)
virtual void Shear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: dcontact.cxx:2420
virtual SdrLayerID GetInvisibleHeavenId() const =0
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:681
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
SwPageFrame * GetPageFrame()
virtual void NbcSetLogicRect(const tools::Rectangle &rRect)
void ClrContourCache(const SdrObject *pObj)
Definition: txtfly.cxx:133
void SetOrdNum(sal_uInt32 nNum)
virtual void Mirror(const Point &rRef1, const Point &rRef2) override
Definition: dcontact.cxx:2412
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const override
Definition: dcontact.cxx:741
void SetInDTOR()
Definition: dcontact.cxx:203
virtual void NbcMove(const Size &rSiz)
void SetPageFrame(SwPageFrame *_pNewPageFrame)
virtual void NbcSetLayer(SdrLayerID nLayer) override
Definition: dcontact.cxx:2522
Point GetRelPosToAnchorFrame() const
method to determine position of anchored object relative to anchor frame
void DisconnectObjFromLayout(SdrObject *_pDrawObj)
disconnect for a dedicated drawing object - could be 'master' or 'virtual'.
Definition: dcontact.cxx:1664
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
const SwPageFrame * GetPageFrame() const
Definition: dcontact.hxx:356
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: dcontact.cxx:2367
void RemoveFromDrawingPage()
Definition: dcontact.cxx:2255
SwNodes & GetNodes()
Definition: doc.hxx:403
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object...
Definition: dcontact.hxx:210
bool IsRightToLeft() const
Definition: frame.hxx:965
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
Definition: dcontact.cxx:2390
void InvalidateObjRectWithSpaces() const
bool IsPageFrame() const
Definition: frame.hxx:1156
bool ObjAnchoredAsChar() const
Definition: dcontact.hxx:150
sal_Int32 GetNumerator() const
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: dcontact.cxx:2361
void RemoveMasterFromDrawPage()
method to remove 'master' drawing object from drawing page.
Definition: dcontact.cxx:1645
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
std::vector< SwDrawVirtObjPtr > maDrawVirtObjs
container for 'virtual' drawing object supporting drawing objects in headers/footers.
Definition: dcontact.hxx:312
long Left() const
void Unchain()
Definition: fly.cxx:307
virtual void GetAnchoredObjs(std::vector< SwAnchoredObject * > &_roAnchoredObjs) const =0
get data collection of anchored objects, handled by with contact
virtual void MoveObjToInvisibleLayer(SdrObject *_pDrawObj)
method to move drawing object to corresponding invisible layer
Definition: dcontact.cxx:236
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override
Definition: dcontact.cxx:2325
virtual ViewContact & GetViewContact(sal_uInt32 nIndex) const
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
SdrObject * getParentSdrObjectFromSdrObject() const
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
void AppendDrawObj(SwAnchoredObject &_rNewObj)
Definition: fly.cxx:2177
virtual ::basegfx::B2DPolyPolygon TakeContour() const override
Definition: dcontact.cxx:2333
virtual void Shear(const Point &rRef, long nAngle, double tn, bool bVShear)
void RemoveFromWriterLayout()
Definition: dcontact.cxx:2216
SdrUserCallType meParentUserCallEventType
Definition: dcontact.cxx:1001
void setContextWritingMode(SdrObject *pObj, SwFrame const *pAnchor)
Definition: dcontact.cxx:102
ViewContact & GetViewContact() const
virtual void SetSnapRect(const tools::Rectangle &rRect)
static void syncFlyFrameAttr(SwFrameFormat &rShape, SfxItemSet const &rSet)
Similar to syncProperty(), but used by the internal API (e.g. for UI purposes).
bool IsVertical() const
Definition: frame.hxx:951
static void GetTextObjectsFromFormat(std::list< SdrTextObj * > &, SwDoc *)
get data collection of anchored objects, handled by with contact
Definition: dcontact.cxx:731
bool IsInDtor() const
Definition: doc.hxx:398
const SwFrame * GetAnchorFrame() const
Definition: dcontact.cxx:2204
SwModify * GetRegisteredInNonConst() const
Definition: calbck.hxx:134
#define SAL_WARN(area, stream)
virtual void NbcSetAnchorPos(const Point &rPnt)
bool IsNestedUserCall() const
Definition: dcontact.cxx:1028
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
virtual void SetContextWritingMode(const sal_Int16 _nContextWritingMode)
virtual void SetSnapRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2445
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: dcontact.cxx:2401
virtual const tools::Rectangle & GetLogicRect() const
NestedUserCallHdl(SwDrawContact *_pDrawContact, SdrUserCallType _eEventType)
Definition: dcontact.cxx:1004
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
Definition: pagechg.cxx:1865
virtual void NbcSetAnchorPos(const Point &rPnt) override
Definition: dcontact.cxx:2273
SwAnchoredDrawObject maAnchoredDrawObj
anchored drawing object instance for the 'master' drawing object
Definition: dcontact.hxx:309
SdrVirtObj & operator=(const SdrVirtObj &rObj)
bool mbDisconnectInProgress
internal flag to indicate that disconnect from layout is in progress
Definition: dcontact.hxx:320
virtual ~SwFlyDrawContact() override
Definition: dcontact.cxx:471
const SwFrame * GetAnchorFrame() const
void ResetLayoutProcessBools()
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
virtual void MoveObjToInvisibleLayer(SdrObject *_pDrawObj) override
Definition: dcontact.cxx:607
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(123)
void EndAllAction(bool bVirDev=false)
Definition: pagechg.cxx:1877
WW8AnchorConv m_eHoriConv
Definition: frmfmt.hxx:305
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i) override
Definition: dcontact.cxx:2502
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2069
bool IsPositioningInProgress() const
is positioning of anchored object in progress
virtual void GetAnchoredObjs(std::vector< SwAnchoredObject * > &_roAnchoredObjs) const override
get data collection of anchored objects, handled by with contact
Definition: dcontact.cxx:1986
virtual Point GetPoint(sal_uInt32 i) const
SdrView * FirstView()
static SwTextFrame * lcl_GetFlyInContentAnchor(SwTextFrame *_pProposedAnchorFrame, SwPosition const &rAnchorPos)
Definition: dcontact.cxx:1701
SdrObjUserCall * GetUserCall() const
virtual Point GetPoint(sal_uInt32 i) const override
Definition: dcontact.cxx:2497
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1283
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
sal_uInt16 Which() const
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
SwAnchoredObject & AnchoredObj()
Definition: dcontact.hxx:245
bool IsCallbackActionEnabled() const
Definition: rootfrm.hxx:383
const basegfx::B2DRange & getObjectRange() const
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:758
static void lcl_textBoxSizeNotify(SwFrameFormat *pFormat)
Notify the format's textbox that it should reconsider its position / size.
Definition: dcontact.cxx:1066
bool IsConnected() const
is 'virtual' drawing object connected to writer layout and / to drawing layer.
Definition: dcontact.cxx:2265
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:194
virtual void NbcSetLayer(SdrLayerID nLayer)
SwPageFrame * FindPage(const SwRect &rRect)
Definition: dcontact.cxx:1920