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& rDoc)
732 {
733  for(auto& rpFly : *rDoc.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  // tdf#135661 InsertMasterIntoDrawPage may have created a new
1462  // SwXShape with null m_pFormat; fix that
1464  break;
1467  break;
1471  break;
1473  ConnectToLayout();
1474  break;
1477  break;
1478  default:
1479  ;
1480  }
1481  }
1482  else if (auto pCheckDrawFrameFormatLayerHint = dynamic_cast<const sw::CheckDrawFrameFormatLayerHint*>(&rHint))
1483  {
1484  *(pCheckDrawFrameFormatLayerHint->m_bCheckControlLayer) |= (GetMaster() && CheckControlLayer(GetMaster()));
1485  }
1486  else if (auto pContactChangedHint = dynamic_cast<const sw::ContactChangedHint*>(&rHint))
1487  {
1488  if(!*pContactChangedHint->m_ppObject)
1489  *pContactChangedHint->m_ppObject = GetMaster();
1490  auto pObject = *pContactChangedHint->m_ppObject;
1491  Changed(*pObject, SdrUserCallType::Delete, pObject->GetLastBoundRect());
1492  }
1493  else if (auto pDrawFormatLayoutCopyHint = dynamic_cast<const sw::DrawFormatLayoutCopyHint*>(&rHint))
1494  {
1495  const SwDrawFrameFormat& rFormat = static_cast<const SwDrawFrameFormat&>(rMod);
1496  new SwDrawContact(
1497  &pDrawFormatLayoutCopyHint->m_rDestFormat,
1498  pDrawFormatLayoutCopyHint->m_rDestDoc.CloneSdrObj(
1499  *GetMaster(),
1500  pDrawFormatLayoutCopyHint->m_rDestDoc.IsCopyIsMove() && &pDrawFormatLayoutCopyHint->m_rDestDoc == rFormat.GetDoc()));
1501  // #i49730# - notify draw frame format that position attributes are
1502  // already set, if the position attributes are already set at the
1503  // source draw frame format.
1504  if(rFormat.IsPosAttrSet())
1505  pDrawFormatLayoutCopyHint->m_rDestFormat.PosAttrSet();
1506  }
1507  else if (auto pRestoreFlyAnchorHint = dynamic_cast<const sw::RestoreFlyAnchorHint*>(&rHint))
1508  {
1509  SdrObject* pObj = GetMaster();
1510  if(GetAnchorFrame() && !pObj->IsInserted())
1511  {
1512  auto pDrawModel = const_cast<SwDrawFrameFormat&>(static_cast<const SwDrawFrameFormat&>(rMod)).GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
1513  assert(pDrawModel);
1514  pDrawModel->GetPage(0)->InsertObject(pObj);
1515  }
1516  pObj->SetRelativePos(pRestoreFlyAnchorHint->m_aPos);
1517  }
1518  else if (auto pCreatePortionHint = dynamic_cast<const sw::CreatePortionHint*>(&rHint))
1519  {
1520  if(*pCreatePortionHint->m_ppContact)
1521  return;
1522  *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
1523  if(!GetAnchorFrame())
1524  {
1525  // No direct positioning needed any more
1526  ConnectToLayout();
1527  // Move object to visible layer
1529  }
1530  }
1531  else if (auto pCollectTextObjectsHint = dynamic_cast<const sw::CollectTextObjectsHint*>(&rHint))
1532  {
1533  auto pSdrO = GetMaster();
1534  if(!pSdrO)
1535  return;
1536  if(dynamic_cast<const SdrObjGroup*>(pSdrO))
1537  {
1538  SdrObjListIter aListIter(*pSdrO, SdrIterMode::DeepNoGroups);
1539  //iterate inside of a grouped object
1540  while(aListIter.IsMore())
1541  {
1542  SdrObject* pSdrOElement = aListIter.Next();
1543  auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrOElement));
1544  if(pTextObj && pTextObj->HasText())
1545  pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
1546  }
1547  }
1548  else if(auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrO)))
1549  {
1550  if(pTextObj->HasText())
1551  pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
1552  }
1553  }
1554  else if (auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
1555  {
1556  auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
1557  if(pFormat->Which() == RES_DRAWFRMFMT)
1558  pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
1559  }
1560  else if (auto pConnectedHint = dynamic_cast<const sw::GetObjectConnectedHint*>(&rHint))
1561  {
1562  pConnectedHint->m_risConnected |= (GetAnchorFrame() != nullptr);
1563  }
1564 }
1565 
1566 // #i26791#
1567 // #i28701# - added parameter <_bUpdateSortedObjsList>
1568 void SwDrawContact::InvalidateObjs_( const bool _bUpdateSortedObjsList )
1569 {
1570  for(const auto& rpDrawVirtObj : maDrawVirtObjs)
1571  // invalidate position of existing 'virtual' drawing objects
1572  {
1573  SwDrawVirtObj* pDrawVirtObj(rpDrawVirtObj.get());
1574  // #i33313# - invalidation only for connected
1575  // 'virtual' drawing objects
1576  if ( pDrawVirtObj->IsConnected() )
1577  {
1578  pDrawVirtObj->AnchoredObj().InvalidateObjPos();
1579  // #i28701#
1580  if ( _bUpdateSortedObjsList )
1581  {
1582  pDrawVirtObj->AnchoredObj().UpdateObjInSortedList();
1583  }
1584  }
1585  }
1586 
1587  // invalidate position of 'master' drawing object
1588  SwAnchoredObject* pAnchoredObj = GetAnchoredObj( nullptr );
1589  pAnchoredObj->InvalidateObjPos();
1590  // #i28701#
1591  if ( _bUpdateSortedObjsList )
1592  {
1593  pAnchoredObj->UpdateObjInSortedList();
1594  }
1595 }
1596 
1597 void SwDrawContact::DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer )
1598 {
1599  mbDisconnectInProgress = true;
1600 
1601  // --> #i36181# - notify background of drawing object
1602  if ( _bMoveMasterToInvisibleLayer &&
1603  !(GetFormat()->GetDoc()->IsInDtor()) &&
1604  GetAnchorFrame() && !GetAnchorFrame()->IsInDtor() )
1605  {
1607  lcl_NotifyBackgroundOfObj( *this, *GetMaster(), &aOldRect );
1608  NotifyBackgrdOfAllVirtObjs( &aOldRect );
1609  }
1610 
1611  // remove 'virtual' drawing objects from writer
1612  // layout and from drawing page
1613  for(auto& rpVirtDrawObj : maDrawVirtObjs)
1614  {
1615  rpVirtDrawObj->RemoveFromWriterLayout();
1616  rpVirtDrawObj->RemoveFromDrawingPage();
1617  }
1618 
1620  {
1622  }
1623 
1624  if ( _bMoveMasterToInvisibleLayer && GetMaster() && GetMaster()->IsInserted() )
1625  {
1626  SdrViewIter aIter( GetMaster() );
1627  for( SdrView* pView = aIter.FirstView(); pView;
1628  pView = aIter.NextView() )
1629  {
1630  pView->MarkObj( GetMaster(), pView->GetSdrPageView(), true );
1631  }
1632 
1633  // Instead of removing 'master' object from drawing page, move the
1634  // 'master' drawing object into the corresponding invisible layer.
1635  {
1636  //static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)->
1637  // RemoveObject( GetMaster()->GetOrdNum() );
1638  // #i18447# - in order to consider group object correct
1639  // use new method <SwDrawContact::MoveObjToInvisibleLayer(..)>
1641  }
1642  }
1643 
1644  mbDisconnectInProgress = false;
1645 }
1646 
1649 {
1650  if ( GetMaster() )
1651  {
1652  GetMaster()->SetUserCall( nullptr );
1653  if ( GetMaster()->IsInserted() )
1654  {
1655  static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
1656  RemoveObject( GetMaster()->GetOrdNum() );
1657  }
1658  }
1659 }
1660 
1661 // disconnect for a dedicated drawing object - could be 'master' or 'virtual'.
1662 // a 'master' drawing object will disconnect a 'virtual' drawing object
1663 // in order to take its place.
1664 // #i19919# - no special case, if drawing object isn't in
1665 // page header/footer, in order to get drawing objects in repeating table headers
1666 // also working.
1668 {
1669  if ( auto pSwDrawVirtObj = dynamic_cast<SwDrawVirtObj*>( _pDrawObj) )
1670  {
1671  pSwDrawVirtObj->RemoveFromWriterLayout();
1672  pSwDrawVirtObj->RemoveFromDrawingPage();
1673  }
1674  else
1675  {
1676  const auto ppVirtDrawObj(std::find_if(maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
1677  [] (const SwDrawVirtObjPtr& pObj) { return pObj->IsConnected(); }));
1678 
1679  if(ppVirtDrawObj != maDrawVirtObjs.end())
1680  {
1681  // replace found 'virtual' drawing object by 'master' drawing
1682  // object and disconnect the 'virtual' one
1683  SwDrawVirtObj* pDrawVirtObj(ppVirtDrawObj->get());
1684  SwFrame* pNewAnchorFrameOfMaster = pDrawVirtObj->AnchorFrame();
1685  // disconnect 'virtual' drawing object
1686  pDrawVirtObj->RemoveFromWriterLayout();
1687  pDrawVirtObj->RemoveFromDrawingPage();
1688  // disconnect 'master' drawing object from current frame
1690  // re-connect 'master' drawing object to frame of found 'virtual'
1691  // drawing object.
1692  pNewAnchorFrameOfMaster->AppendDrawObj( maAnchoredDrawObj );
1693  }
1694  else
1695  {
1696  // no connected 'virtual' drawing object found. Thus, disconnect
1697  // completely from layout.
1699  }
1700  }
1701 }
1702 
1703 static SwTextFrame* lcl_GetFlyInContentAnchor( SwTextFrame* _pProposedAnchorFrame,
1704  SwPosition const& rAnchorPos)
1705 {
1706  SwTextFrame* pAct = _pProposedAnchorFrame;
1707  SwTextFrame* pTmp;
1708  TextFrameIndex const nTextOffset(_pProposedAnchorFrame->MapModelToViewPos(rAnchorPos));
1709  do
1710  {
1711  pTmp = pAct;
1712  pAct = pTmp->GetFollow();
1713  }
1714  while (pAct && nTextOffset >= pAct->GetOffset());
1715  return pTmp;
1716 }
1717 
1719 {
1720  // *no* connect to layout during disconnection from layout.
1721  if ( mbDisconnectInProgress )
1722  {
1723  OSL_FAIL( "<SwDrawContact::ConnectToLayout(..)> called during disconnection.");
1724  return;
1725  }
1726 
1727  // --> #i33909# - *no* connect to layout, if 'master' drawing
1728  // object isn't inserted in the drawing page
1729  if ( !GetMaster()->IsInserted() )
1730  {
1731  OSL_FAIL( "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted -> no connect to layout. Please inform od@openoffice.org" );
1732  return;
1733  }
1734 
1735  SwFrameFormat* pDrawFrameFormat = static_cast<SwFrameFormat*>(GetRegisteredIn());
1736 
1737  if( !pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell() )
1738  return;
1739 
1740  // remove 'virtual' drawing objects from writer
1741  // layout and from drawing page, and remove 'master' drawing object from
1742  // writer layout - 'master' object will remain in drawing page.
1743  DisconnectFromLayout( false );
1744 
1745  if ( !pAnch )
1746  {
1747  pAnch = &(pDrawFrameFormat->GetAnchor());
1748  }
1749 
1750  switch ( pAnch->GetAnchorId() )
1751  {
1752  case RndStdIds::FLY_AT_PAGE:
1753  {
1754  sal_uInt16 nPgNum = pAnch->GetPageNum();
1755  SwViewShell *pShell = pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell();
1756  if( !pShell )
1757  break;
1758  SwRootFrame* pRoot = pShell->GetLayout();
1759  SwPageFrame *pPage = static_cast<SwPageFrame*>(pRoot->Lower());
1760 
1761  for ( sal_uInt16 i = 1; i < nPgNum && pPage; ++i )
1762  {
1763  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
1764  }
1765 
1766  if ( pPage )
1767  {
1768  pPage->AppendDrawObj( maAnchoredDrawObj );
1769  }
1770  else
1771  //Looks stupid but is allowed (compare SwFEShell::SetPageObjsNewPage)
1772  pRoot->SetAssertFlyPages();
1773  }
1774  break;
1775 
1776  case RndStdIds::FLY_AT_CHAR:
1777  case RndStdIds::FLY_AT_PARA:
1778  case RndStdIds::FLY_AT_FLY:
1779  case RndStdIds::FLY_AS_CHAR:
1780  {
1781  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1782  {
1784  }
1785  // support drawing objects in header/footer,
1786  // but not control objects:
1787  // anchor at first found frame the 'master' object and
1788  // at the following frames 'virtual' drawing objects.
1789  // Note: method is similar to <SwFlyFrameFormat::MakeFrames(..)>
1790  SwModify *pModify = nullptr;
1791  if( pAnch->GetContentAnchor() )
1792  {
1793  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AT_FLY )
1794  {
1795  SwNodeIndex aIdx( pAnch->GetContentAnchor()->nNode );
1796  SwContentNode* pCNd = pDrawFrameFormat->GetDoc()->GetNodes().GoNext( &aIdx );
1798  pModify = pCNd;
1799  else
1800  {
1801  const SwNodeIndex& rIdx = pAnch->GetContentAnchor()->nNode;
1802  SwFrameFormats& rFormats = *(pDrawFrameFormat->GetDoc()->GetSpzFrameFormats());
1803  for( auto pFlyFormat : rFormats )
1804  {
1805  if( pFlyFormat->GetContent().GetContentIdx() &&
1806  rIdx == *(pFlyFormat->GetContent().GetContentIdx()) )
1807  {
1808  pModify = pFlyFormat;
1809  break;
1810  }
1811  }
1812  }
1813  }
1814  else
1815  {
1816  pModify = pAnch->GetContentAnchor()->nNode.GetNode().GetContentNode();
1817  }
1818  }
1819 
1820  // #i29199# - It is possible, that
1821  // the anchor doesn't exist - E.g., reordering the
1822  // sub-documents in a master document.
1823  // Note: The anchor will be inserted later.
1824  if ( !pModify )
1825  {
1826  // break to end of the current switch case.
1827  break;
1828  }
1829 
1831  SwFrame* pAnchorFrameOfMaster = nullptr;
1832  for( SwFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
1833  {
1834  // append drawing object, if
1835  // (1) proposed anchor frame isn't a follow and...
1836  const bool bFollow = pFrame->IsContentFrame() && static_cast<SwContentFrame*>(pFrame)->IsFollow();
1837  if (bFollow)
1838  continue;
1839 
1840  // (2) drawing object isn't a control object to be anchored
1841  // in header/footer.
1842  const bool bControlInHF = ::CheckControlLayer(GetMaster()) && pFrame->FindFooterOrHeader();
1843  // tdf#129542 but make an exception for control objects so they can get added to just the first frame,
1844  // the Master Anchor Frame and not the others
1845  if (bControlInHF && pAnchorFrameOfMaster)
1846  continue;
1847 
1848  bool bAdd;
1849  if (RndStdIds::FLY_AT_FLY == pAnch->GetAnchorId())
1850  bAdd = true;
1851  else
1852  {
1853  assert(pFrame->IsTextFrame());
1854  bAdd = IsAnchoredObjShown(*static_cast<SwTextFrame*>(pFrame), *pAnch);
1855  }
1856 
1857  if( bAdd )
1858  {
1859  if ( RndStdIds::FLY_AT_FLY == pAnch->GetAnchorId() && !pFrame->IsFlyFrame() )
1860  {
1861  pFrame = pFrame->FindFlyFrame();
1862  assert(pFrame);
1863  }
1864 
1865  // find correct follow for as character anchored objects
1866  if ((pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR) &&
1867  pFrame->IsTextFrame() )
1868  {
1869  pFrame = lcl_GetFlyInContentAnchor(
1870  static_cast<SwTextFrame*>(pFrame),
1871  *pAnch->GetContentAnchor());
1872  }
1873 
1874  if ( !pAnchorFrameOfMaster )
1875  {
1876  // append 'master' drawing object
1877  pAnchorFrameOfMaster = pFrame;
1878  pFrame->AppendDrawObj( maAnchoredDrawObj );
1879  }
1880  else
1881  {
1882  // append 'virtual' drawing object
1883  SwDrawVirtObj* pDrawVirtObj = AddVirtObj();
1884  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1885  {
1886  ClrContourCache( pDrawVirtObj );
1887  }
1888  pFrame->AppendDrawObj( pDrawVirtObj->AnchoredObj() );
1889 
1890  pDrawVirtObj->ActionChanged();
1891  }
1892 
1893  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1894  {
1895  pFrame->InvalidatePrt();
1896  }
1897  }
1898  }
1899  }
1900  break;
1901  default:
1902  assert(!"Unknown Anchor.");
1903  break;
1904  }
1905  if ( GetAnchorFrame() )
1906  {
1908  // #i26791# - invalidate objects instead of direct positioning
1909  InvalidateObjs_();
1910  }
1911 }
1912 
1915 {
1916  if ( !GetMaster()->IsInserted() )
1917  {
1919  ->InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() );
1920  }
1921  GetMaster()->SetUserCall( this );
1922 }
1923 
1925 {
1926  // --> #i28701# - use method <GetPageFrame()>
1927  SwPageFrame* pPg = GetPageFrame();
1928  if ( !pPg && GetAnchorFrame() )
1929  pPg = GetAnchorFrame()->FindPageFrame();
1930  if ( pPg )
1931  pPg = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( rRect, pPg )));
1932  return pPg;
1933 }
1934 
1936 {
1937  if ( mbDisconnectInProgress )
1938  {
1939  OSL_FAIL( "<SwDrawContact::ChkPage()> called during disconnection." );
1940  return;
1941  }
1942 
1943  // --> #i28701#
1946  ? GetPageFrame()
1947  : FindPage( GetMaster()->GetCurrentBoundRect() );
1948  if ( GetPageFrame() == pPg )
1949  return;
1950 
1951  // if drawing object is anchor in header/footer a change of the page
1952  // is a dramatic change. Thus, completely re-connect to the layout
1955  {
1956  ConnectToLayout();
1957  }
1958  else
1959  {
1960  // --> #i28701# - use methods <GetPageFrame()> and <SetPageFrame>
1961  if ( GetPageFrame() )
1965  }
1966 }
1967 
1968 // Important note:
1969 // method is called by method <SwDPage::ReplaceObject(..)>, which called its
1970 // corresponding superclass method <FmFormPage::ReplaceObject(..)>.
1971 // Note: 'master' drawing object *has* to be connected to layout triggered
1972 // by the caller of this, if method is called.
1974 {
1975  DisconnectFromLayout( false );
1976  // consider 'virtual' drawing objects
1978 
1979  GetMaster()->SetUserCall( nullptr );
1980  if(pNewMaster)
1981  maAnchoredDrawObj.SetDrawObj(*pNewMaster);
1982  else
1983  mbMasterObjCleared = true;
1984  GetMaster()->SetUserCall( this );
1985 
1986  InvalidateObjs_();
1987 }
1988 
1990 void SwDrawContact::GetAnchoredObjs(std::vector<SwAnchoredObject*>& o_rAnchoredObjs) const
1991 {
1992  o_rAnchoredObjs.push_back(const_cast<SwAnchoredDrawObject*>(&maAnchoredDrawObj));
1993 
1994  for(auto& rpDrawVirtObj : maDrawVirtObjs)
1995  o_rAnchoredObjs.push_back(&rpDrawVirtObj->AnchoredObj());
1996 }
1997 
1998 // AW: own sdr::contact::ViewContact (VC) sdr::contact::ViewObjectContact (VOC) needed
1999 // since offset is defined different from SdrVirtObj's sdr::contact::ViewContactOfVirtObj.
2000 // For paint, that offset is used by setting at the OutputDevice; for primitives this is
2001 // not possible since we have no OutputDevice, but define the geometry itself.
2002 
2003 namespace sdr::contact
2004 {
2005  namespace {
2006 
2007  class VOCOfDrawVirtObj : public ViewObjectContactOfSdrObj
2008  {
2009  protected:
2018  virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override;
2019 
2020  public:
2021  VOCOfDrawVirtObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
2022  : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
2023  {
2024  }
2025  };
2026 
2027  class VCOfDrawVirtObj : public ViewContactOfVirtObj
2028  {
2029  protected:
2035  virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override;
2036 
2037  public:
2039  explicit VCOfDrawVirtObj(SwDrawVirtObj& rObj)
2040  : ViewContactOfVirtObj(rObj)
2041  {
2042  }
2043 
2045  SwDrawVirtObj& GetSwDrawVirtObj() const
2046  {
2047  return static_cast<SwDrawVirtObj&>(mrObject);
2048  }
2049  };
2050 
2051  }
2052 } // end of namespace sdr::contact
2053 
2054 namespace sdr::contact
2055 {
2057  static void impAddPrimitivesFromGroup(const ViewObjectContact& rVOC, const basegfx::B2DHomMatrix& rOffsetMatrix, const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rxTarget)
2058  {
2059  const sal_uInt32 nSubHierarchyCount(rVOC.GetViewContact().GetObjectCount());
2060 
2061  for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
2062  {
2064 
2065  if(rCandidate.GetViewContact().GetObjectCount())
2066  {
2067  // is a group object itself, call recursively
2068  impAddPrimitivesFromGroup(rCandidate, rOffsetMatrix, rDisplayInfo, rxTarget);
2069  }
2070  else
2071  {
2072  // single object, add primitives; check model-view visibility
2073  if(rCandidate.isPrimitiveVisible(rDisplayInfo))
2074  {
2075  drawinglayer::primitive2d::Primitive2DContainer aNewSequence(rCandidate.getPrimitive2DSequence(rDisplayInfo));
2076 
2077  if(!aNewSequence.empty())
2078  {
2079  // get ranges
2080  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(rCandidate.GetObjectContact().getViewInformation2D());
2081  const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
2082  basegfx::B2DRange aObjectRange(rCandidate.getObjectRange());
2083 
2084  // correct with virtual object's offset
2085  aObjectRange.transform(rOffsetMatrix);
2086 
2087  // check geometrical visibility (with offset)
2088  if(!aViewRange.overlaps(aObjectRange))
2089  {
2090  // not visible, release
2091  aNewSequence.clear();
2092  }
2093  }
2094 
2095  if(!aNewSequence.empty())
2096  {
2097  rxTarget.append(aNewSequence);
2098  }
2099  }
2100  }
2101  }
2102  }
2103 
2104  drawinglayer::primitive2d::Primitive2DContainer VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
2105  {
2106  // tdf#91260 have already checked top-level one is on the right page
2107  assert(isPrimitiveVisible(rDisplayInfo));
2108  // nasty corner case: override to clear page frame to disable the
2109  // sub-objects' anchor check, because their anchor is always on
2110  // the first page that the page style is applied to
2111  DisplayInfo aDisplayInfo(rDisplayInfo);
2112  aDisplayInfo.SetWriterPageFrame(basegfx::B2IRectangle());
2113  const VCOfDrawVirtObj& rVC = static_cast< const VCOfDrawVirtObj& >(GetViewContact());
2114  const SdrObject& rReferencedObject = rVC.GetSwDrawVirtObj().GetReferencedObj();
2116 
2117  // create offset transformation
2118  basegfx::B2DHomMatrix aOffsetMatrix;
2119  const Point aLocalOffset(rVC.GetSwDrawVirtObj().GetOffset());
2120 
2121  if(aLocalOffset.X() || aLocalOffset.Y())
2122  {
2123  aOffsetMatrix.set(0, 2, aLocalOffset.X());
2124  aOffsetMatrix.set(1, 2, aLocalOffset.Y());
2125  }
2126 
2127  if(dynamic_cast<const SdrObjGroup*>( &rReferencedObject) != nullptr)
2128  {
2129  // group object. Since the VOC/OC/VC hierarchy does not represent the
2130  // hierarchy virtual objects when they have group objects
2131  // (ViewContactOfVirtObj::GetObjectCount() returns null for that purpose)
2132  // to avoid multiple usages of VOCs (which would not work), the primitives
2133  // for the sub-hierarchy need to be collected here
2134 
2135  // Get the VOC of the referenced object (the Group) and fetch primitives from it
2136  const ViewObjectContact& rVOCOfRefObj = rReferencedObject.GetViewContact().GetViewObjectContact(GetObjectContact());
2137  impAddPrimitivesFromGroup(rVOCOfRefObj, aOffsetMatrix, aDisplayInfo, xRetval);
2138  }
2139  else
2140  {
2141  // single object, use method from referenced object to get the Primitive2DSequence
2142  xRetval = rReferencedObject.GetViewContact().getViewIndependentPrimitive2DContainer();
2143  }
2144 
2145  if(!xRetval.empty())
2146  {
2147  // create transform primitive
2149  xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference };
2150  }
2151 
2152  return xRetval;
2153  }
2154 
2155  ViewObjectContact& VCOfDrawVirtObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
2156  {
2157  return *(new VOCOfDrawVirtObj(rObjectContact, *this));
2158  }
2159 
2160 } // end of namespace sdr::contact
2161 
2163 std::unique_ptr<sdr::contact::ViewContact> SwDrawVirtObj::CreateObjectSpecificViewContact()
2164 {
2165  return std::make_unique<sdr::contact::VCOfDrawVirtObj>(*this);
2166 }
2167 
2169  SdrModel& rSdrModel,
2170  SdrObject& _rNewObj,
2171  SwDrawContact& _rDrawContact)
2172 : SdrVirtObj(rSdrModel, _rNewObj ),
2173  maAnchoredDrawObj(),
2174  mrDrawContact(_rDrawContact)
2175 {
2176  // #i26791#
2177  maAnchoredDrawObj.SetDrawObj( *this );
2178 
2179  // #i35635# - set initial position out of sight
2180  NbcMove( Size( -16000, -16000 ) );
2181 }
2182 
2184 {
2185 }
2186 
2188 {
2189  SdrVirtObj::operator=(rObj);
2190  // Note: Members <maAnchoredDrawObj> and <mrDrawContact>
2191  // haven't to be considered.
2192  return *this;
2193 }
2194 
2196 {
2197  SwDrawVirtObj* pObj = new SwDrawVirtObj(
2198  rTargetModel,
2199  rRefObj,
2200  mrDrawContact);
2201 
2202  pObj->operator=( *this );
2203  // Note: Member <maAnchoredDrawObj> hasn't to be considered.
2204 
2205  return pObj;
2206 }
2207 
2209 {
2210  // #i26791# - use new member <maAnchoredDrawObj>
2212 }
2213 
2215 {
2216  // #i26791# - use new member <maAnchoredDrawObj>
2217  return maAnchoredDrawObj.AnchorFrame();
2218 }
2219 
2221 {
2222  // remove contact object from frame for 'virtual' drawing object
2223  // #i26791# - use new member <maAnchoredDrawObj>
2225  {
2227  }
2228 }
2229 
2231 {
2232  // determine 'master'
2233  SdrObject* pOrgMasterSdrObj = mrDrawContact.GetMaster();
2234 
2235  // insert 'virtual' drawing object into page, set layer and user call.
2236  SdrPage* pDrawPg = pOrgMasterSdrObj->getSdrPageFromSdrObject();
2237  // #i27030# - apply order number of referenced object
2238  if ( nullptr != pDrawPg )
2239  {
2240  // #i27030# - apply order number of referenced object
2241  pDrawPg->InsertObject( this, GetReferencedObj().GetOrdNum() );
2242  }
2243  else
2244  {
2245  pDrawPg = getSdrPageFromSdrObject();
2246  if ( pDrawPg )
2247  {
2248  pDrawPg->SetObjectOrdNum( GetOrdNumDirect(),
2250  }
2251  else
2252  {
2254  }
2255  }
2257 }
2258 
2260 {
2261  SetUserCall( nullptr );
2262  if ( getSdrPageFromSdrObject() )
2263  {
2265  }
2266 }
2267 
2270 {
2271  bool bRetVal = GetAnchorFrame() &&
2273 
2274  return bRetVal;
2275 }
2276 
2277 void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt)
2278 {
2280 }
2281 
2282 // #i97197#
2283 // the methods relevant for positioning
2284 
2286 {
2287  if(aOutRect.IsEmpty())
2288  {
2289  const_cast<SwDrawVirtObj*>(this)->RecalcBoundRect();
2290  }
2291 
2292  return aOutRect;
2293 }
2294 
2296 {
2297  return aOutRect;
2298 }
2299 
2301 {
2302  // do NOT use IsEmpty() here, there is already a useful offset
2303  // in the position
2304  if(aOutRect == tools::Rectangle())
2305  {
2306  return Point();
2307  }
2308  else
2309  {
2311  }
2312 }
2313 
2315 {
2316  // do nothing to not lose model information in aOutRect
2317 }
2318 
2320 {
2321  // #i26791# - switch order of calling <GetOffset()> and
2322  // <ReferencedObj().GetCurrentBoundRect()>, because <GetOffset()> calculates
2323  // its value by the 'BoundRect' of the referenced object.
2324 
2325  const Point aOffset(GetOffset());
2326  aOutRect = ReferencedObj().GetCurrentBoundRect() + aOffset;
2327 }
2328 
2330 {
2333 
2334  return aRetval;
2335 }
2336 
2338 {
2341 
2342  return aRetval;
2343 }
2344 
2346 {
2347  SdrHdlList tmpList(nullptr);
2348  rRefObj.AddToHdlList(tmpList);
2349 
2350  size_t cnt = tmpList.GetHdlCount();
2351  for(size_t i=0; i < cnt; ++i)
2352  {
2353  SdrHdl* pHdl = tmpList.GetHdl(i);
2354  Point aP(pHdl->GetPos() + GetOffset());
2355  pHdl->SetPos(aP);
2356  }
2357  tmpList.MoveTo(rHdlList);
2358 }
2359 
2360 void SwDrawVirtObj::NbcMove(const Size& rSiz)
2361 {
2362  SdrObject::NbcMove( rSiz );
2363 }
2364 
2365 void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
2366 {
2367  rRefObj.NbcResize(rRef - GetOffset(), xFact, yFact);
2368  SetRectsDirty();
2369 }
2370 
2371 void SwDrawVirtObj::NbcRotate(const Point& rRef, long nAngle, double sn, double cs)
2372 {
2373  rRefObj.NbcRotate(rRef - GetOffset(), nAngle, sn, cs);
2374  SetRectsDirty();
2375 }
2376 
2377 void SwDrawVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
2378 {
2379  rRefObj.NbcMirror(rRef1 - GetOffset(), rRef2 - GetOffset());
2380  SetRectsDirty();
2381 }
2382 
2383 void SwDrawVirtObj::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShear)
2384 {
2385  rRefObj.NbcShear(rRef - GetOffset(), nAngle, tn, bVShear);
2386  SetRectsDirty();
2387 }
2388 
2389 void SwDrawVirtObj::Move(const Size& rSiz)
2390 {
2391  SdrObject::Move( rSiz );
2392 }
2393 
2394 void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
2395 {
2396  if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
2397  {
2398  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2399  rRefObj.Resize(rRef - GetOffset(), xFact, yFact, bUnsetRelative);
2400  SetRectsDirty();
2401  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2402  }
2403 }
2404 
2405 void SwDrawVirtObj::Rotate(const Point& rRef, long nAngle, double sn, double cs)
2406 {
2407  if(nAngle)
2408  {
2409  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2410  rRefObj.Rotate(rRef - GetOffset(), nAngle, sn, cs);
2411  SetRectsDirty();
2412  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2413  }
2414 }
2415 
2416 void SwDrawVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
2417 {
2418  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2419  rRefObj.Mirror(rRef1 - GetOffset(), rRef2 - GetOffset());
2420  SetRectsDirty();
2421  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2422 }
2423 
2424 void SwDrawVirtObj::Shear(const Point& rRef, long nAngle, double tn, bool bVShear)
2425 {
2426  if(nAngle)
2427  {
2428  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2429  rRefObj.Shear(rRef - GetOffset(), nAngle, tn, bVShear);
2430  SetRectsDirty();
2431  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2432  }
2433 }
2434 
2436 {
2438  aSnapRect += GetOffset();
2439 }
2440 
2442 {
2443  const_cast<SwDrawVirtObj*>(this)->aSnapRect = rRefObj.GetSnapRect();
2444  const_cast<SwDrawVirtObj*>(this)->aSnapRect += GetOffset();
2445 
2446  return aSnapRect;
2447 }
2448 
2450 {
2451  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2452  tools::Rectangle aR(rRect);
2453  aR -= GetOffset();
2454  rRefObj.SetSnapRect(aR);
2455  SetRectsDirty();
2456  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2457 }
2458 
2460 {
2461  tools::Rectangle aR(rRect);
2462  aR -= GetOffset();
2463  SetRectsDirty();
2464  rRefObj.NbcSetSnapRect(aR);
2465 }
2466 
2468 {
2469  const_cast<SwDrawVirtObj*>(this)->aSnapRect = rRefObj.GetLogicRect();
2470  const_cast<SwDrawVirtObj*>(this)->aSnapRect += GetOffset();
2471 
2472  return aSnapRect;
2473 }
2474 
2476 {
2477  tools::Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
2478  tools::Rectangle aR(rRect);
2479  aR -= GetOffset();
2480  rRefObj.SetLogicRect(aR);
2481  SetRectsDirty();
2482  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2483 }
2484 
2486 {
2487  tools::Rectangle aR(rRect);
2488  aR -= GetOffset();
2490  SetRectsDirty();
2491 }
2492 
2494 {
2495  Point aP(rRefObj.GetSnapPoint(i));
2496  aP += GetOffset();
2497 
2498  return aP;
2499 }
2500 
2501 Point SwDrawVirtObj::GetPoint(sal_uInt32 i) const
2502 {
2503  return rRefObj.GetPoint(i) + GetOffset();
2504 }
2505 
2506 void SwDrawVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
2507 {
2508  Point aP(rPnt);
2509  aP -= GetOffset();
2510  rRefObj.SetPoint(aP, i);
2511  SetRectsDirty();
2512 }
2513 
2515 {
2516  return rRefObj.HasTextEdit();
2517 }
2518 
2519 // override 'layer' methods for 'virtual' drawing object to assure
2520 // that layer of 'virtual' object is the layer of the referenced object.
2522 {
2523  return GetReferencedObj().GetLayer();
2524 }
2525 
2527 {
2528  ReferencedObj().NbcSetLayer( nLayer );
2530 }
2531 
2533 {
2534  ReferencedObj().SetLayer( nLayer );
2536 }
2537 
2538 /* 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:2214
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:2722
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:1973
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:1935
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:2195
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:1597
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:3607
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:1273
void RemoveDrawObjFromPage(SwAnchoredObject &_rToRemoveObj)
Definition: flylay.cxx:1093
virtual ~SwDrawVirtObj() override
Definition: dcontact.cxx:2183
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:353
SwDrawVirtObj(SdrModel &rSdrModel, SdrObject &_rNewObj, SwDrawContact &_rDrawContact)
Definition: dcontact.cxx:2168
virtual ~SwDrawContact() override
Definition: dcontact.cxx:712
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: dcontact.cxx:2345
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:2389
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:2360
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)
static void GetTextObjectsFromFormat(std::list< SdrTextObj * > &, SwDoc &)
get data collection of anchored objects, handled by with contact
Definition: dcontact.cxx:731
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:3268
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:2514
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:2300
SwDrawVirtObj * AddVirtObj()
add a 'virtual' drawing object to drawing page.
Definition: dcontact.cxx:809
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
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:2257
SwDrawVirtObj & operator=(const SwDrawVirtObj &rObj)
Definition: dcontact.cxx:2187
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:2467
#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:2377
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:551
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:2163
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:2230
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:1914
virtual const tools::Rectangle & GetCurrentBoundRect() const override
Definition: dcontact.cxx:2285
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:2485
uno_Any a
virtual SdrLayerID GetLayer() const override
Definition: dcontact.cxx:2521
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:2804
const drawinglayer::geometry::ViewInformation2D & getViewInformation2D() const
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:762
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:2314
tools::Rectangle aOutRect
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
Definition: flylay.cxx:1044
const SwFrame * Lower() const
Definition: layfrm.hxx:101
TElementType * First()
Definition: calbck.hxx:345
SwContentNode * GetContentNode()
Definition: node.hxx:623
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:2383
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:2057
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:1568
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:2295
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:405
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:2459
virtual void RecalcBoundRect() override
All overridden methods which need to use the offset.
Definition: dcontact.cxx:2319
virtual void RecalcSnapRect() override
Definition: dcontact.cxx:2435
static void AddExistingShapeToFormat(SdrObject const &_rObj)
Definition: unodraw.cxx:932
std::optional< tools::Rectangle > const & GetLastObjRect() const
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2475
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:2493
virtual SwFrameFormat & GetFrameFormat() override
virtual void SetLayer(SdrLayerID nLayer) override
Definition: dcontact.cxx:2532
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:2441
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:2424
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:134
void SetOrdNum(sal_uInt32 nNum)
virtual void Mirror(const Point &rRef1, const Point &rRef2) override
Definition: dcontact.cxx:2416
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:2526
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:1667
void ConnectToLayout(const SwFormatAnchor *pAnch=nullptr)
Inserts SdrObject in the arrays of the layout ((SwPageFrame and SwFrame).
Definition: dcontact.cxx:1718
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:2371
void RemoveFromDrawingPage()
Definition: dcontact.cxx:2259
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:159
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
Definition: dcontact.cxx:2394
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:2365
void RemoveMasterFromDrawPage()
method to remove 'master' drawing object from drawing page.
Definition: dcontact.cxx:1648
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:2329
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:2176
virtual ::basegfx::B2DPolyPolygon TakeContour() const override
Definition: dcontact.cxx:2337
virtual void Shear(const Point &rRef, long nAngle, double tn, bool bVShear)
void RemoveFromWriterLayout()
Definition: dcontact.cxx:2220
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
bool IsInDtor() const
Definition: doc.hxx:398
const SwFrame * GetAnchorFrame() const
Definition: dcontact.cxx:2208
SwModify * GetRegisteredInNonConst() const
Definition: calbck.hxx:136
#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:2449
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: dcontact.cxx:2405
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:1861
virtual void NbcSetAnchorPos(const Point &rPnt) override
Definition: dcontact.cxx:2277
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:1873
WW8AnchorConv m_eHoriConv
Definition: frmfmt.hxx:305
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i) override
Definition: dcontact.cxx:2506
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2073
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:1990
virtual Point GetPoint(sal_uInt32 i) const
SdrView * FirstView()
static SwTextFrame * lcl_GetFlyInContentAnchor(SwTextFrame *_pProposedAnchorFrame, SwPosition const &rAnchorPos)
Definition: dcontact.cxx:1703
SdrObjUserCall * GetUserCall() const
virtual Point GetPoint(sal_uInt32 i) const override
Definition: dcontact.cxx:2501
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1284
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:760
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:2269
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:194
virtual void NbcSetLayer(SdrLayerID nLayer)
SwPageFrame * FindPage(const SwRect &rRect)
Definition: dcontact.cxx:1924