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 <svx/svdpage.hxx>
23 #include <svx/svditer.hxx>
24 #include <svx/svdogrp.hxx>
25 #include <svx/svdotext.hxx>
26 #include <svx/svdmodel.hxx>
27 #include <svx/svdviter.hxx>
28 #include <svx/svdview.hxx>
31 #include <drawdoc.hxx>
32 #include <fmtornt.hxx>
33 #include <viewimp.hxx>
34 #include <fmtsrnd.hxx>
35 #include <fmtanchr.hxx>
36 #include <node.hxx>
37 #include <fmtcntnt.hxx>
38 #include <fmtfsize.hxx>
39 #include <pam.hxx>
40 #include <pagefrm.hxx>
41 #include <rootfrm.hxx>
42 #include <frmtool.hxx>
43 #include <flyfrm.hxx>
44 #include <textboxhelper.hxx>
45 #include <frmfmt.hxx>
46 #include <fmtfollowtextflow.hxx>
47 #include <dflyobj.hxx>
48 #include <dcontact.hxx>
49 #include <unodraw.hxx>
52 #include <IDocumentState.hxx>
53 #include <IDocumentUndoRedo.hxx>
54 #include <doc.hxx>
55 #include <hints.hxx>
56 #include <txtfrm.hxx>
57 #include <frameformats.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  SwFrame const& rAnchorFrame)
483 {
484  // maintain invariant that a shape's textbox immediately follows the shape
485  // also for the multiple SdrVirtObj created for shapes in header/footer
486  if (SwFrameFormat const*const pDrawFormat =
488  {
489  // assume that the draw SdrVirtObj is always created before the flyframe one
490  if (SwSortedObjs const*const pObjs = rAnchorFrame.GetDrawObjs())
491  {
492  for (SwAnchoredObject const*const pAnchoredObj : *pObjs)
493  {
494  if (&pAnchoredObj->GetFrameFormat() == pDrawFormat)
495  {
496  return pAnchoredObj->GetDrawObj()->GetOrdNum() + 1;
497  }
498  }
499  }
500  // if called from AppendObjs(), this is a problem; if called from lcl_SetFlyFrameAttr() it's not
501  SAL_INFO("sw", "GetOrdNumForNewRef: cannot find SdrObject for text box's shape");
502  }
503  // search for another Writer fly frame registered at same frame format
505  const SwFlyFrame* pFlyFrame(nullptr);
506  for(pFlyFrame = aIter.First(); pFlyFrame; pFlyFrame = aIter.Next())
507  {
508  if(pFlyFrame != pFly)
509  break;
510  }
511 
512  if(pFlyFrame)
513  {
514  // another Writer fly frame found. Take its order number
515  return pFlyFrame->GetVirtDrawObj()->GetOrdNum();
516  }
517  // no other Writer fly frame found. Take order number of 'master' object
518  // #i35748# - use method <GetOrdNumDirect()> instead
519  // of method <GetOrdNum()> to avoid a recalculation of the order number,
520  // which isn't intended.
521  return GetMaster()->GetOrdNumDirect();
522 }
523 
525  SwFlyFrameFormat* pFormat, SwFrame const& rAnchorFrame)
526 {
527  // Find ContactObject from the Format. If there's already one, we just
528  // need to create a new Ref, else we create the Contact now.
529 
531  SwFlyDrawContact* pContact = pFormat->GetOrCreateContact();
532  SwVirtFlyDrawObj* pDrawObj(
533  new SwVirtFlyDrawObj(
534  pContact->GetMaster()->getSdrModelFromSdrObject(),
535  *pContact->GetMaster(),
536  pFly));
537  pDrawObj->SetUserCall(pContact);
538 
539  // The Reader creates the Masters and inserts them into the Page in
540  // order to transport the z-order.
541  // After creating the first Reference the Masters are removed from the
542  // List and are not important anymore.
543  SdrPage* pPg = pContact->GetMaster()->getSdrPageFromSdrObject();
544  if(nullptr != pPg)
545  {
546  const size_t nOrdNum = pContact->GetMaster()->GetOrdNum();
547  pPg->ReplaceObject(pDrawObj, nOrdNum);
548  }
549  // #i27030# - insert new <SwVirtFlyDrawObj> instance
550  // into drawing page with correct order number
551  else
552  rIDDMA.GetDrawModel()->GetPage(0)->InsertObject(pDrawObj, pContact->GetOrdNumForNewRef(pFly, rAnchorFrame));
553  // #i38889# - assure, that new <SwVirtFlyDrawObj> instance
554  // is in a visible layer.
555  pContact->MoveObjToVisibleLayer(pDrawObj);
556  return pDrawObj;
557 }
558 
559 // #i26791#
561 {
562  assert(pSdrObj);
563  assert(dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) != nullptr);
564  assert(GetUserCall(pSdrObj) == this &&
565  "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belong to this contact");
566 
567  const SwAnchoredObject *const pRetAnchoredObj =
568  static_cast<const SwVirtFlyDrawObj*>(pSdrObj)->GetFlyFrame();
569 
570  return pRetAnchoredObj;
571 }
572 
574 {
575  return const_cast<SwAnchoredObject *>(const_cast<SwFlyDrawContact const*>(this)->GetAnchoredObj(pSdrObj));
576 }
577 
579 {
580  return mpMasterObj.get();
581 }
582 
589 {
590  assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
591 
592  if ( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) )
593  {
594  // nothing to do
595  return;
596  }
597 
598  SwFlyFrame* pFlyFrame = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrame();
599 
600  // #i44464# - consider, that Writer fly frame content
601  // already exists - (e.g. WW8 document is inserted into an existing document).
602  if ( !pFlyFrame->Lower() )
603  {
604  pFlyFrame->InsertColumns();
605  pFlyFrame->Chain( pFlyFrame->AnchorFrame() );
606  pFlyFrame->InsertCnt();
607  }
608  if ( pFlyFrame->GetDrawObjs() )
609  {
610  for (SwAnchoredObject* i : *pFlyFrame->GetDrawObjs())
611  {
612  // #i28701# - consider type of objects in sorted object list.
613  SdrObject* pObj = i->DrawObj();
614  SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
615  pContact->MoveObjToVisibleLayer( pObj );
616  }
617  }
618 
619  // make fly frame visible
621 }
622 
629 {
630  assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
631 
632  if ( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) )
633  {
634  // nothing to do
635  return;
636  }
637 
638  SwFlyFrame* pFlyFrame = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrame();
639 
640  pFlyFrame->Unchain();
641  pFlyFrame->DeleteCnt();
642  if ( pFlyFrame->GetDrawObjs() )
643  {
644  for (SwAnchoredObject* i : *pFlyFrame->GetDrawObjs())
645  {
646  // #i28701# - consider type of objects in sorted object list.
647  SdrObject* pObj = i->DrawObj();
648  SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
649  pContact->MoveObjToInvisibleLayer( pObj );
650  }
651  }
652 
653  // make fly frame invisible
655 }
656 
658 void SwFlyDrawContact::GetAnchoredObjs( std::vector<SwAnchoredObject*>& _roAnchoredObjs ) const
659 {
660  const SwFrameFormat* pFormat = GetFormat();
661  SwFlyFrame::GetAnchoredObjects( _roAnchoredObjs, *pFormat );
662 }
663 void SwFlyDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
664 {
665  SwContact::SwClientNotify(rMod, rHint);
666  if(auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
667  {
668  // #i11176#
669  // This also needs to work when no layout exists. Thus, for
670  // FlyFrames an alternative method is used now in that case.
671  auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
672  if (pFormat && pFormat->Which() == RES_FLYFRMFMT && !pFormat->getIDocumentLayoutAccess().GetCurrentViewShell())
673  pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
674  }
675 }
676 
677 // SwDrawContact
678 
679 bool CheckControlLayer( const SdrObject *pObj )
680 {
681  if ( SdrInventor::FmForm == pObj->GetObjInventor() )
682  return true;
683  if (const SdrObjGroup *pObjGroup = dynamic_cast<const SdrObjGroup*>(pObj))
684  {
685  const SdrObjList *pLst = pObjGroup->GetSubList();
686  for ( size_t i = 0; i < pLst->GetObjCount(); ++i )
687  {
688  if ( ::CheckControlLayer( pLst->GetObj( i ) ) )
689  {
690  // #i18447# - return correct value ;-)
691  return true;
692  }
693  }
694  }
695  return false;
696 }
697 
699  SwContact( pToRegisterIn ),
700  mbMasterObjCleared( false ),
701  mbDisconnectInProgress( false ),
702  mbUserCallActive( false ),
703  // Note: value of <meEventTypeOfCurrentUserCall> isn't of relevance, because
704  // <mbUserCallActive> is false.
705  meEventTypeOfCurrentUserCall( SdrUserCallType::MoveOnly )
706 {
707  // --> #i33909# - assure, that drawing object is inserted
708  // in the drawing page.
709  if ( !pObj->IsInserted() )
710  {
711  pToRegisterIn->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
712  InsertObject( pObj, pObj->GetOrdNumDirect() );
713  }
714 
715  // Controls have to be always in the Control-Layer. This is also true for
716  // group objects, if they contain controls.
717  if ( ::CheckControlLayer( pObj ) )
718  {
719  // set layer of object to corresponding invisible layer.
720  pObj->SetLayer( pToRegisterIn->getIDocumentDrawModelAccess().GetInvisibleControlsId() );
721  }
722 
723  // #i26791#
724  pObj->SetUserCall( this );
725  maAnchoredDrawObj.SetDrawObj( *pObj );
726 
727  // if there already exists an SwXShape for the object, ensure it knows about us, and the SdrObject
728  // #i99056#
730 }
731 
733 {
734  SetInDTOR();
735 
737 
738  // remove 'master' from drawing page
740 
741  // remove and destroy 'virtual' drawing objects.
743 
744  if ( !mbMasterObjCleared )
745  {
746  SdrObject* pObject = const_cast< SdrObject* >( maAnchoredDrawObj.GetDrawObj() );
747  SdrObject::Free( pObject );
748  }
749 }
750 
751 void SwDrawContact::GetTextObjectsFromFormat(std::list<SdrTextObj*>& o_rTextObjects, SwDoc& rDoc)
752 {
753  for(auto& rpFly : *rDoc.GetSpzFrameFormats())
754  {
755  if(dynamic_cast<const SwDrawFrameFormat*>(rpFly))
756  rpFly->CallSwClientNotify(sw::CollectTextObjectsHint(o_rTextObjects));
757  }
758 }
759 
760 // #i26791#
762 {
763  // handle default parameter value
764  if (!pSdrObj)
765  {
766  pSdrObj = GetMaster();
767  }
768 
769  assert(pSdrObj);
770  assert(dynamic_cast<const SwDrawVirtObj*>(pSdrObj) != nullptr ||
771  dynamic_cast<const SdrVirtObj*>(pSdrObj) == nullptr);
772  assert((GetUserCall(pSdrObj) == this ||
773  pSdrObj == GetMaster()) &&
774  "<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
775 
776  const SwAnchoredObject* pRetAnchoredObj = nullptr;
777 
778  if (auto pVirtObj = dynamic_cast<const SwDrawVirtObj*>(pSdrObj))
779  {
780  pRetAnchoredObj = &(pVirtObj->GetAnchoredObj());
781  }
782  else
783  {
784  assert(dynamic_cast<const SdrVirtObj*>(pSdrObj) == nullptr);
785  pRetAnchoredObj = &maAnchoredDrawObj;
786  }
787 
788  return pRetAnchoredObj;
789 }
790 
792 {
793  return const_cast<SwAnchoredObject*>(const_cast<SwDrawContact const*>(this)->GetAnchoredObj(pSdrObj));
794 }
795 
797 {
798  return !mbMasterObjCleared
800  : nullptr;
801 }
802 
803 const SwFrame* SwDrawContact::GetAnchorFrame( const SdrObject* _pDrawObj ) const
804 {
805  const SwFrame* pAnchorFrame = nullptr;
806  if ( !_pDrawObj ||
807  _pDrawObj == GetMaster() ||
808  ( !_pDrawObj->GetUserCall() &&
809  GetUserCall( _pDrawObj ) == this ) )
810  {
811  pAnchorFrame = maAnchoredDrawObj.GetAnchorFrame();
812  }
813  else
814  {
815  assert(dynamic_cast<SwDrawVirtObj const*>(_pDrawObj) != nullptr);
816  pAnchorFrame = static_cast<const SwDrawVirtObj*>(_pDrawObj)->GetAnchorFrame();
817  }
818 
819  return pAnchorFrame;
820 }
821 
823 {
824  return const_cast<SwFrame *>(const_cast<SwDrawContact const*>(this)->GetAnchorFrame(pDrawObj));
825 }
826 
830 {
831  maDrawVirtObjs.push_back(
833  new SwDrawVirtObj(
834  GetMaster()->getSdrModelFromSdrObject(),
835  *GetMaster(),
836  *this)));
837  maDrawVirtObjs.back()->AddToDrawingPage(rAnchorFrame);
838  return maDrawVirtObjs.back().get();
839 }
840 
843 {
844  for(auto& rpDrawVirtObj : maDrawVirtObjs)
845  {
846  // remove and destroy 'virtual object'
847  rpDrawVirtObj->RemoveFromWriterLayout();
848  rpDrawVirtObj->RemoveFromDrawingPage();
849  }
850  maDrawVirtObjs.clear();
851 }
852 
853 
856 {
857  SdrObject* pRetDrawObj = nullptr;
858 
859  // #i26791# - compare master frames instead of direct frames
860  const SwFrame* pProposedAnchorFrame = &_rAnchorFrame;
861  if ( pProposedAnchorFrame->IsContentFrame() )
862  {
863  const SwContentFrame* pTmpFrame =
864  static_cast<const SwContentFrame*>( pProposedAnchorFrame );
865  while ( pTmpFrame->IsFollow() )
866  {
867  pTmpFrame = pTmpFrame->FindMaster();
868  }
869  pProposedAnchorFrame = pTmpFrame;
870  }
871 
872  const SwFrame* pMasterObjAnchorFrame = GetAnchorFrame();
873  if ( pMasterObjAnchorFrame && pMasterObjAnchorFrame->IsContentFrame() )
874  {
875  const SwContentFrame* pTmpFrame =
876  static_cast<const SwContentFrame*>( pMasterObjAnchorFrame );
877  while ( pTmpFrame->IsFollow() )
878  {
879  pTmpFrame = pTmpFrame->FindMaster();
880  }
881  pMasterObjAnchorFrame = pTmpFrame;
882  }
883 
884  if ( pMasterObjAnchorFrame && pMasterObjAnchorFrame == pProposedAnchorFrame )
885  {
886  pRetDrawObj = GetMaster();
887  }
888  else
889  {
890  const auto ppFoundVirtObj(std::find_if(maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
891  VirtObjAnchoredAtFramePred(pProposedAnchorFrame)));
892  if(ppFoundVirtObj != maDrawVirtObjs.end())
893  pRetDrawObj = ppFoundVirtObj->get();
894  }
895 
896  return pRetDrawObj;
897 }
898 
900 {
901  for(const auto& rpDrawVirtObj : maDrawVirtObjs)
902  {
903  SwDrawVirtObj* pDrawVirtObj(rpDrawVirtObj.get());
904  if ( pDrawVirtObj->GetAnchorFrame() )
905  {
906  // #i34640# - determine correct page frame
907  SwPageFrame* pPage = pDrawVirtObj->AnchoredObj().FindPageFrameOfAnchor();
908  if( pOldBoundRect && pPage )
909  {
910  SwRect aOldRect( *pOldBoundRect );
911  aOldRect.Pos() += pDrawVirtObj->GetOffset();
912  if( aOldRect.HasArea() )
913  ::Notify_Background( pDrawVirtObj, pPage,
914  aOldRect, PrepareHint::FlyFrameLeave,true);
915  }
916  // #i34640# - include spacing for wrapping
917  SwRect aRect( pDrawVirtObj->GetAnchoredObj().GetObjRectWithSpaces() );
918  if (aRect.HasArea() && pPage)
919  {
920  SwPageFrame* pPg = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( aRect, pPage )));
921  if ( pPg )
922  ::Notify_Background( pDrawVirtObj, pPg, aRect,
924  }
925  ::ClrContourCache( pDrawVirtObj );
926  }
927  }
928 }
929 
931 static void lcl_NotifyBackgroundOfObj( SwDrawContact const & _rDrawContact,
932  const SdrObject& _rObj,
933  const tools::Rectangle* _pOldObjRect )
934 {
935  // #i34640#
936  SwAnchoredObject* pAnchoredObj =
937  const_cast<SwAnchoredObject*>(_rDrawContact.GetAnchoredObj( &_rObj ));
938  if ( !(pAnchoredObj && pAnchoredObj->GetAnchorFrame()) )
939  return;
940 
941  // #i34640# - determine correct page frame
942  SwPageFrame* pPageFrame = pAnchoredObj->FindPageFrameOfAnchor();
943  if( _pOldObjRect && pPageFrame )
944  {
945  SwRect aOldRect( *_pOldObjRect );
946  if( aOldRect.HasArea() )
947  {
948  // #i34640# - determine correct page frame
949  SwPageFrame* pOldPageFrame = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( aOldRect, pPageFrame )));
950  ::Notify_Background( &_rObj, pOldPageFrame, aOldRect,
952  }
953  }
954  // #i34640# - include spacing for wrapping
955  SwRect aNewRect( pAnchoredObj->GetObjRectWithSpaces() );
956  if( aNewRect.HasArea() && pPageFrame )
957  {
958  pPageFrame = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( aNewRect, pPageFrame )));
959  ::Notify_Background( &_rObj, pPageFrame, aNewRect,
961  }
962  ClrContourCache( &_rObj );
963 }
964 
966  SdrUserCallType eType,
967  const tools::Rectangle& rOldBoundRect )
968 {
969  // #i26791# - no event handling, if existing <SwViewShell>
970  // is in construction
971  SwDoc* pDoc = GetFormat()->GetDoc();
974  {
975  return;
976  }
977 
978  // #i44339#
979  // no event handling, if document is in destruction.
980  // Exception: It's the SdrUserCallType::Delete event
981  if ( pDoc->IsInDtor() && eType != SdrUserCallType::Delete )
982  {
983  return;
984  }
985 
986  //Put on Action, but not if presently anywhere an action runs.
987  bool bHasActions(true);
989  if ( pTmpRoot && pTmpRoot->IsCallbackActionEnabled() )
990  {
992  if ( pSh )
993  {
994  for(SwViewShell& rShell : pSh->GetRingContainer() )
995  {
996  if ( rShell.Imp()->IsAction() || rShell.Imp()->IsIdleAction() )
997  {
998  bHasActions = true;
999  break;
1000  }
1001  bHasActions = false;
1002  }
1003  }
1004  if(!bHasActions)
1005  pTmpRoot->StartAllAction();
1006  }
1007  SdrObjUserCall::Changed( rObj, eType, rOldBoundRect );
1008  Changed_( rObj, eType, &rOldBoundRect ); //Attention, possibly suicidal!
1009 
1010  if(!bHasActions)
1011  pTmpRoot->EndAllAction();
1012 }
1013 
1017 {
1018  private:
1022 
1023  public:
1025  SdrUserCallType _eEventType )
1026  : mpDrawContact( _pDrawContact ),
1027  mbParentUserCallActive( _pDrawContact->mbUserCallActive ),
1028  meParentUserCallEventType( _pDrawContact->meEventTypeOfCurrentUserCall )
1029  {
1030  mpDrawContact->mbUserCallActive = true;
1031  mpDrawContact->meEventTypeOfCurrentUserCall = _eEventType;
1032  }
1033 
1035  {
1036  if ( mpDrawContact )
1037  {
1038  mpDrawContact->mbUserCallActive = mbParentUserCallActive;
1040  }
1041  }
1042 
1044  {
1045  mpDrawContact = nullptr;
1046  }
1047 
1048  bool IsNestedUserCall() const
1049  {
1050  return mbParentUserCallActive;
1051  }
1052 
1054  {
1055  if ( !IsNestedUserCall() )
1056  return;
1057 
1058  bool bTmpAssert( true );
1059  // Currently its known, that a nested event SdrUserCallType::Resize
1060  // could occur during parent user call SdrUserCallType::Inserted,
1061  // SdrUserCallType::Delete and SdrUserCallType::Resize for edge objects.
1062  // Also possible are nested SdrUserCallType::ChildResize events for
1063  // edge objects
1064  // Thus, assert all other combinations
1065  if ( ( meParentUserCallEventType == SdrUserCallType::Inserted ||
1066  meParentUserCallEventType == SdrUserCallType::Delete ||
1067  meParentUserCallEventType == SdrUserCallType::Resize ) &&
1068  mpDrawContact->meEventTypeOfCurrentUserCall == SdrUserCallType::Resize )
1069  {
1070  bTmpAssert = false;
1071  }
1072  else if ( meParentUserCallEventType == SdrUserCallType::ChildResize &&
1073  mpDrawContact->meEventTypeOfCurrentUserCall == SdrUserCallType::ChildResize )
1074  {
1075  bTmpAssert = false;
1076  }
1077 
1078  if ( bTmpAssert )
1079  {
1080  OSL_FAIL( "<SwDrawContact::Changed_(..)> - unknown nested <UserCall> event. This is serious." );
1081  }
1082  }
1083 };
1084 
1087 {
1089  {
1090  // Just notify the textbox that the size has changed, the actual object size is not interesting.
1091  SfxItemSet aResizeSet(pFormat->GetDoc()->GetAttrPool(), svl::Items<RES_FRM_SIZE, RES_FRM_SIZE>);
1092  SwFormatFrameSize aSize;
1093  aResizeSet.Put(aSize);
1094  SwTextBoxHelper::syncFlyFrameAttr(*pFormat, aResizeSet, pFormat->FindRealSdrObject());
1095  }
1096 }
1097 
1098 // !!!ATTENTION!!! The object may commit suicide!!!
1099 
1101  SdrUserCallType eType,
1102  const tools::Rectangle* pOldBoundRect )
1103 {
1104  // suppress handling of nested <SdrObjUserCall> events
1105  NestedUserCallHdl aNestedUserCallHdl( this, eType );
1106  if ( aNestedUserCallHdl.IsNestedUserCall() )
1107  {
1108  aNestedUserCallHdl.AssertNestedUserCall();
1109  return;
1110  }
1111  // do *not* notify, if document is destructing
1112  // #i35912# - do *not* notify for as-character anchored
1113  // drawing objects.
1114  // #i35007#
1115  // improvement: determine as-character anchored object flag only once.
1116  const bool bAnchoredAsChar = ObjAnchoredAsChar();
1117  const bool bNotify = !(GetFormat()->GetDoc()->IsInDtor()) &&
1118  ( css::text::WrapTextMode_THROUGH != GetFormat()->GetSurround().GetSurround() ) &&
1119  !bAnchoredAsChar;
1120  switch( eType )
1121  {
1122  case SdrUserCallType::Delete:
1123  {
1124  if ( bNotify )
1125  {
1126  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1127  // --> #i36181# - background of 'virtual'
1128  // drawing objects have also been notified.
1129  NotifyBackgroundOfAllVirtObjs( pOldBoundRect );
1130  }
1131  DisconnectFromLayout( false );
1132  mbMasterObjCleared = true;
1133  delete this;
1134  // --> #i65784# Prevent memory corruption
1135  aNestedUserCallHdl.DrawContactDeleted();
1136  break;
1137  }
1138  case SdrUserCallType::Inserted:
1139  {
1140  if ( mbDisconnectInProgress )
1141  {
1142  OSL_FAIL( "<SwDrawContact::Changed_(..)> - Insert event during disconnection from layout is invalid." );
1143  }
1144  else
1145  {
1146  ConnectToLayout();
1147  if ( bNotify )
1148  {
1149  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1150  }
1151  }
1152  break;
1153  }
1154  case SdrUserCallType::Removed:
1155  {
1156  if ( bNotify )
1157  {
1158  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1159  }
1160  DisconnectFromLayout( false );
1161  break;
1162  }
1163  case SdrUserCallType::ChildInserted :
1164  case SdrUserCallType::ChildRemoved :
1165  {
1166  // --> #i113730#
1167  // force layer of controls for group objects containing control objects
1168  if(dynamic_cast< SdrObjGroup* >(maAnchoredDrawObj.DrawObj()))
1169  {
1171  {
1172  const IDocumentDrawModelAccess& rIDDMA = static_cast<SwFrameFormat*>(GetRegisteredInNonConst())->getIDocumentDrawModelAccess();
1173  const SdrLayerID aCurrentLayer(maAnchoredDrawObj.DrawObj()->GetLayer());
1174  const SdrLayerID aControlLayerID(rIDDMA.GetControlsId());
1175  const SdrLayerID aInvisibleControlLayerID(rIDDMA.GetInvisibleControlsId());
1176 
1177  if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID)
1178  {
1179  if ( aCurrentLayer == rIDDMA.GetInvisibleHellId() ||
1180  aCurrentLayer == rIDDMA.GetInvisibleHeavenId() )
1181  {
1182  maAnchoredDrawObj.DrawObj()->SetLayer(aInvisibleControlLayerID);
1183  }
1184  else
1185  {
1186  maAnchoredDrawObj.DrawObj()->SetLayer(aControlLayerID);
1187  }
1188  }
1189  }
1190  }
1191  [[fallthrough]];
1192  }
1193  case SdrUserCallType::MoveOnly:
1194  case SdrUserCallType::Resize:
1195  case SdrUserCallType::ChildMoveOnly :
1196  case SdrUserCallType::ChildResize :
1197  case SdrUserCallType::ChildChangeAttr :
1198  case SdrUserCallType::ChildDelete :
1199  {
1200  // #i31698# - improvement
1201  // get instance <SwAnchoredDrawObject> only once
1202  const SwAnchoredDrawObject* pAnchoredDrawObj =
1203  static_cast<const SwAnchoredDrawObject*>( GetAnchoredObj( &rObj ) );
1204 
1205  /* protect against NULL pointer dereferencing */
1206  if(!pAnchoredDrawObj)
1207  {
1208  break;
1209  }
1210 
1211  // #i26791# - adjust positioning and alignment attributes,
1212  // if positioning of drawing object isn't in progress.
1213  // #i53320# - no adjust of positioning attributes,
1214  // if drawing object isn't positioned.
1215  if ( !pAnchoredDrawObj->IsPositioningInProgress() &&
1216  !pAnchoredDrawObj->NotYetPositioned() )
1217  {
1218  // #i34748# - If no last object rectangle is
1219  // provided by the anchored object, use parameter <pOldBoundRect>.
1220  const tools::Rectangle& aOldObjRect = pAnchoredDrawObj->GetLastObjRect()
1221  ? *(pAnchoredDrawObj->GetLastObjRect())
1222  : *pOldBoundRect;
1223  // #i79400#
1224  // always invalidate object rectangle inclusive spaces
1225  pAnchoredDrawObj->InvalidateObjRectWithSpaces();
1226  // #i41324# - notify background before
1227  // adjusting position
1228  if ( bNotify )
1229  {
1230  // #i31573# - correction
1231  // background of given drawing object.
1232  lcl_NotifyBackgroundOfObj( *this, rObj, &aOldObjRect );
1233  }
1234  // #i31698# - determine layout direction
1235  // via draw frame format.
1236  SwFrameFormat::tLayoutDir eLayoutDir =
1237  pAnchoredDrawObj->GetFrameFormat().GetLayoutDir();
1238  // use geometry of drawing object
1239  tools::Rectangle aObjRect( rObj.GetSnapRect() );
1240  // If drawing object is a member of a group, the adjustment
1241  // of the positioning and the alignment attributes has to
1242  // be done for the top group object.
1243  if ( rObj.getParentSdrObjectFromSdrObject() )
1244  {
1245  const SdrObject* pGroupObj = rObj.getParentSdrObjectFromSdrObject();
1246  while ( pGroupObj->getParentSdrObjectFromSdrObject() )
1247  {
1248  pGroupObj = pGroupObj->getParentSdrObjectFromSdrObject();
1249  }
1250  // use geometry of drawing object
1251  aObjRect = pGroupObj->GetSnapRect();
1252 
1253  for (size_t i = 0; i < pGroupObj->getChildrenOfSdrObject()->GetObjCount(); ++i )
1254  {
1256  }
1257 
1258  }
1259  SwTwips nXPosDiff(0);
1260  SwTwips nYPosDiff(0);
1261  switch ( eLayoutDir )
1262  {
1264  {
1265  nXPosDiff = aObjRect.Left() - aOldObjRect.Left();
1266  nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
1267  }
1268  break;
1270  {
1271  nXPosDiff = aOldObjRect.Right() - aObjRect.Right();
1272  nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
1273  }
1274  break;
1276  {
1277  nXPosDiff = aObjRect.Top() - aOldObjRect.Top();
1278  nYPosDiff = aOldObjRect.Right() - aObjRect.Right();
1279  }
1280  break;
1281  default:
1282  {
1283  assert(!"<SwDrawContact::Changed_(..)> - unsupported layout direction");
1284  }
1285  }
1286  SfxItemSet aSet( GetFormat()->GetDoc()->GetAttrPool(),
1287  svl::Items<RES_VERT_ORIENT, RES_HORI_ORIENT> );
1288  const SwFormatVertOrient& rVert = GetFormat()->GetVertOrient();
1289  if ( nYPosDiff != 0 )
1290  {
1291  if ( rVert.GetRelationOrient() == text::RelOrientation::CHAR ||
1292  rVert.GetRelationOrient() == text::RelOrientation::TEXT_LINE )
1293  {
1294  nYPosDiff = -nYPosDiff;
1295  }
1296  aSet.Put( SwFormatVertOrient( rVert.GetPos()+nYPosDiff,
1298  rVert.GetRelationOrient() ) );
1299  }
1300 
1301  const SwFormatHoriOrient& rHori = GetFormat()->GetHoriOrient();
1302  if ( !bAnchoredAsChar && nXPosDiff != 0 )
1303  {
1304  aSet.Put( SwFormatHoriOrient( rHori.GetPos()+nXPosDiff,
1306  rHori.GetRelationOrient() ) );
1307  }
1308 
1309  if ( nYPosDiff ||
1310  ( !bAnchoredAsChar && nXPosDiff != 0 ) )
1311  {
1312  GetFormat()->GetDoc()->SetFlyFrameAttr( *(GetFormat()), aSet );
1313  // keep new object rectangle, to avoid multiple
1314  // changes of the attributes by multiple event from
1315  // the drawing layer - e.g. group objects and its members
1316  // #i34748# - use new method
1317  // <SwAnchoredDrawObject::SetLastObjRect(..)>.
1318  const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
1319  ->SetLastObjRect( aObjRect );
1320  }
1321  else if ( aObjRect.GetSize() != aOldObjRect.GetSize() )
1322  {
1323  InvalidateObjs_();
1324  // #i35007# - notify anchor frame
1325  // of as-character anchored object
1326  if ( bAnchoredAsChar )
1327  {
1328  SwFrame* pAnchorFrame = const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)->AnchorFrame();
1329  if(pAnchorFrame)
1330  {
1332  }
1333  }
1334 
1336  }
1337  else if (eType == SdrUserCallType::Resize)
1338  // Even if the bounding box of the shape didn't change,
1339  // notify about the size change, as an adjustment change
1340  // may affect the size of the underlying textbox.
1342  }
1343 
1344  // tdf#135198: keep text box together with its shape
1345  SwRect aObjRect(rObj.GetSnapRect());
1346  const SwPageFrame* rPageFrame = pAnchoredDrawObj->GetPageFrame();
1347  if (rPageFrame && rPageFrame->isFrameAreaPositionValid() && !rObj.getChildrenOfSdrObject())
1348  {
1349  SwDoc* const pDoc = GetFormat()->GetDoc();
1350 
1351  // avoid Undo creation
1352  ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
1353 
1354  // hide any artificial "changes" made by synchronizing the textbox position
1355  const bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified();
1356  pDoc->getIDocumentState().SetEnableSetModified(false);
1357 
1358  SfxItemSet aSyncSet(
1359  pDoc->GetAttrPool(),
1360  svl::Items<RES_VERT_ORIENT, RES_HORI_ORIENT, RES_ANCHOR, RES_ANCHOR>);
1361  aSyncSet.Put(GetFormat()->GetHoriOrient());
1362  aSyncSet.Put(SwFormatVertOrient(aObjRect.Top() - rPageFrame->getFrameArea().Top(),
1364  text::RelOrientation::PAGE_FRAME));
1365  aSyncSet.Put(SwFormatAnchor(RndStdIds::FLY_AT_PAGE, pAnchoredDrawObj->GetPageFrame()->GetPhyPageNum()));
1366 
1367  auto pSdrObj = const_cast<SdrObject*>(&rObj);
1368  if (pSdrObj != GetFormat()->FindRealSdrObject())
1369  {
1370  SfxItemSet aSet(
1371  pDoc->GetAttrPool(),
1372  svl::Items<RES_FRM_SIZE, RES_FRM_SIZE>);
1373 
1374  aSet.Put(aSyncSet);
1375  aSet.Put(pSdrObj->GetMergedItem(RES_FRM_SIZE));
1376  SwTextBoxHelper::syncFlyFrameAttr(*GetFormat(), aSet, pSdrObj);
1378  }
1379  else
1380  SwTextBoxHelper::syncFlyFrameAttr(*GetFormat(), aSyncSet, GetFormat()->FindRealSdrObject());
1381 
1382  pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
1383  }
1384  }
1385  break;
1386  case SdrUserCallType::ChangeAttr:
1387  if ( bNotify )
1388  {
1389  lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
1390  }
1391  break;
1392  default:
1393  break;
1394  }
1395 }
1396 
1397 namespace
1398 {
1399  const SwFormatAnchor* lcl_getAnchorFormat( const SfxPoolItem& _rItem )
1400  {
1401  sal_uInt16 nWhich = _rItem.Which();
1402  const SwFormatAnchor* pAnchorFormat = nullptr;
1403  if ( RES_ATTRSET_CHG == nWhich )
1404  {
1405  static_cast<const SwAttrSetChg&>(_rItem).GetChgSet()->
1406  GetItemState( RES_ANCHOR, false, reinterpret_cast<const SfxPoolItem**>(&pAnchorFormat) );
1407  }
1408  else if ( RES_ANCHOR == nWhich )
1409  {
1410  pAnchorFormat = &static_cast<const SwFormatAnchor&>(_rItem);
1411  }
1412  return pAnchorFormat;
1413  }
1414 }
1415 
1416 void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
1417 {
1418  SwClient::SwClientNotify(rMod, rHint); // needed as SwContact::SwClientNotify doesn't explicitly call SwClient::SwClientNotify
1419  SwContact::SwClientNotify(rMod, rHint);
1420  if (rHint.GetId() == SfxHintId::SwLegacyModify)
1421  {
1422  auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
1423  SAL_WARN_IF(mbDisconnectInProgress, "sw.core", "<SwDrawContact::Modify(..)> called during disconnection.");
1424 
1425  const SfxPoolItem* pNew = pLegacyHint->m_pNew;
1426  sal_uInt16 nWhich = pNew ? pNew->Which() : 0;
1427  if(const SwFormatAnchor* pNewAnchorFormat = pNew ? lcl_getAnchorFormat(*pNew) : nullptr)
1428  {
1429  // Do not respond to a Reset Anchor!
1430  if(GetFormat()->GetAttrSet().GetItemState(RES_ANCHOR, false) == SfxItemState::SET)
1431  {
1432  // no connect to layout during disconnection
1434  {
1435  // determine old object rectangle of 'master' drawing object
1436  // for notification
1437  const tools::Rectangle* pOldRect = nullptr;
1438  tools::Rectangle aOldRect;
1439  if(GetAnchorFrame())
1440  {
1441  // --> #i36181# - include spacing in object
1442  // rectangle for notification.
1444  pOldRect = &aOldRect;
1445  }
1446  // re-connect to layout due to anchor format change
1447  ConnectToLayout(pNewAnchorFormat);
1448  // notify background of drawing objects
1449  lcl_NotifyBackgroundOfObj(*this, *GetMaster(), pOldRect);
1451 
1452  const SwFormatAnchor* pOldAnchorFormat = pLegacyHint->m_pOld ? lcl_getAnchorFormat(*pLegacyHint->m_pOld) : nullptr;
1453  if(!pOldAnchorFormat || (pOldAnchorFormat->GetAnchorId() != pNewAnchorFormat->GetAnchorId()))
1454  {
1456  {
1457  // --> #i102752#
1458  // assure that a ShapePropertyChangeNotifier exists
1460  }
1461  else
1462  SAL_WARN("sw.core", "SwDrawContact::Modify: no draw object here?");
1463  }
1464  }
1465  }
1466  else
1468  }
1469  else if (nWhich == RES_REMOVE_UNO_OBJECT)
1470  {} // nothing to do
1471  // --> #i62875# - no further notification, if not connected to Writer layout
1472  else if ( maAnchoredDrawObj.GetAnchorFrame() &&
1474  {
1475  bool bUpdateSortedObjsList(false);
1476  switch(nWhich)
1477  {
1478  case RES_UL_SPACE:
1479  case RES_LR_SPACE:
1480  case RES_HORI_ORIENT:
1481  case RES_VERT_ORIENT:
1482  case RES_FOLLOW_TEXT_FLOW: // #i28701# - add attribute 'Follow text flow'
1483  break;
1484  case RES_SURROUND:
1485  case RES_OPAQUE:
1487  // --> #i28701# - on change of wrapping style, hell|heaven layer,
1488  // or wrapping style influence an update of the <SwSortedObjs> list,
1489  // the drawing object is registered in, has to be performed. This is triggered
1490  // by the 1st parameter of method call <InvalidateObjs_(..)>.
1491  bUpdateSortedObjsList = true;
1492  break;
1493  case RES_ATTRSET_CHG: // #i35443#
1494  {
1495  auto pChgSet = static_cast<const SwAttrSetChg*>(pNew)->GetChgSet();
1496  if(pChgSet->GetItemState(RES_SURROUND, false) == SfxItemState::SET ||
1497  pChgSet->GetItemState(RES_OPAQUE, false) == SfxItemState::SET ||
1498  pChgSet->GetItemState(RES_WRAP_INFLUENCE_ON_OBJPOS, false) == SfxItemState::SET)
1499  bUpdateSortedObjsList = true;
1500  }
1501  break;
1502  default:
1503  assert(!"<SwDraw Contact::Modify(..)> - unhandled attribute?");
1504  }
1505  lcl_NotifyBackgroundOfObj(*this, *GetMaster(), nullptr);
1507  InvalidateObjs_(bUpdateSortedObjsList);
1508  }
1509 
1510  // #i51474#
1512  }
1513  else if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
1514  {
1515  switch(pDrawFrameFormatHint->m_eId)
1516  {
1518  delete this;
1519  break;
1522  break;
1525  // #i40845# - follow-up of #i35635#
1526  // move object to visible layer
1528  // tdf#135661 InsertMasterIntoDrawPage may have created a new
1529  // SwXShape with null m_pFormat; fix that
1531  break;
1534  break;
1538  break;
1540  ConnectToLayout();
1541  break;
1544  break;
1545  default:
1546  ;
1547  }
1548  }
1549  else if (auto pCheckDrawFrameFormatLayerHint = dynamic_cast<const sw::CheckDrawFrameFormatLayerHint*>(&rHint))
1550  {
1551  *(pCheckDrawFrameFormatLayerHint->m_bCheckControlLayer) |= (GetMaster() && CheckControlLayer(GetMaster()));
1552  }
1553  else if (auto pContactChangedHint = dynamic_cast<const sw::ContactChangedHint*>(&rHint))
1554  {
1555  if(!*pContactChangedHint->m_ppObject)
1556  *pContactChangedHint->m_ppObject = GetMaster();
1557  auto pObject = *pContactChangedHint->m_ppObject;
1558  Changed(*pObject, SdrUserCallType::Delete, pObject->GetLastBoundRect());
1559  }
1560  else if (auto pDrawFormatLayoutCopyHint = dynamic_cast<const sw::DrawFormatLayoutCopyHint*>(&rHint))
1561  {
1562  const SwDrawFrameFormat& rFormat = static_cast<const SwDrawFrameFormat&>(rMod);
1563  new SwDrawContact(
1564  &pDrawFormatLayoutCopyHint->m_rDestFormat,
1565  pDrawFormatLayoutCopyHint->m_rDestDoc.CloneSdrObj(
1566  *GetMaster(),
1567  pDrawFormatLayoutCopyHint->m_rDestDoc.IsCopyIsMove() && &pDrawFormatLayoutCopyHint->m_rDestDoc == rFormat.GetDoc()));
1568  // #i49730# - notify draw frame format that position attributes are
1569  // already set, if the position attributes are already set at the
1570  // source draw frame format.
1571  if(rFormat.IsPosAttrSet())
1572  pDrawFormatLayoutCopyHint->m_rDestFormat.PosAttrSet();
1573  }
1574  else if (auto pRestoreFlyAnchorHint = dynamic_cast<const sw::RestoreFlyAnchorHint*>(&rHint))
1575  {
1576  SdrObject* pObj = GetMaster();
1577  if(GetAnchorFrame() && !pObj->IsInserted())
1578  {
1579  auto pDrawModel = const_cast<SwDrawFrameFormat&>(static_cast<const SwDrawFrameFormat&>(rMod)).GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
1580  assert(pDrawModel);
1581  pDrawModel->GetPage(0)->InsertObject(pObj);
1582  }
1583  pObj->SetRelativePos(pRestoreFlyAnchorHint->m_aPos);
1584  }
1585  else if (auto pCreatePortionHint = dynamic_cast<const sw::CreatePortionHint*>(&rHint))
1586  {
1587  if(*pCreatePortionHint->m_ppContact)
1588  return;
1589  *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
1590  if(!GetAnchorFrame())
1591  {
1592  // No direct positioning needed any more
1593  ConnectToLayout();
1594  // Move object to visible layer
1596  }
1597  }
1598  else if (auto pCollectTextObjectsHint = dynamic_cast<const sw::CollectTextObjectsHint*>(&rHint))
1599  {
1600  auto pSdrO = GetMaster();
1601  if(!pSdrO)
1602  return;
1603  if(dynamic_cast<const SdrObjGroup*>(pSdrO))
1604  {
1605  SdrObjListIter aListIter(*pSdrO, SdrIterMode::DeepNoGroups);
1606  //iterate inside of a grouped object
1607  while(aListIter.IsMore())
1608  {
1609  SdrObject* pSdrOElement = aListIter.Next();
1610  auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrOElement));
1611  if(pTextObj && pTextObj->HasText())
1612  pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
1613  }
1614  }
1615  else if(auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrO)))
1616  {
1617  if(pTextObj->HasText())
1618  pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
1619  }
1620  }
1621  else if (auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
1622  {
1623  auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
1624  if(pFormat->Which() == RES_DRAWFRMFMT)
1625  pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
1626  }
1627  else if (auto pConnectedHint = dynamic_cast<const sw::GetObjectConnectedHint*>(&rHint))
1628  {
1629  pConnectedHint->m_risConnected |= (GetAnchorFrame() != nullptr);
1630  }
1631 }
1632 
1633 // #i26791#
1634 // #i28701# - added parameter <_bUpdateSortedObjsList>
1635 void SwDrawContact::InvalidateObjs_( const bool _bUpdateSortedObjsList )
1636 {
1637  for(const auto& rpDrawVirtObj : maDrawVirtObjs)
1638  // invalidate position of existing 'virtual' drawing objects
1639  {
1640  SwDrawVirtObj* pDrawVirtObj(rpDrawVirtObj.get());
1641  // #i33313# - invalidation only for connected
1642  // 'virtual' drawing objects
1643  if ( pDrawVirtObj->IsConnected() )
1644  {
1645  pDrawVirtObj->AnchoredObj().InvalidateObjPos();
1646  // #i28701#
1647  if ( _bUpdateSortedObjsList )
1648  {
1649  pDrawVirtObj->AnchoredObj().UpdateObjInSortedList();
1650  }
1651  }
1652  }
1653 
1654  // invalidate position of 'master' drawing object
1655  SwAnchoredObject* pAnchoredObj = GetAnchoredObj( nullptr );
1656  pAnchoredObj->InvalidateObjPos();
1657  // #i28701#
1658  if ( _bUpdateSortedObjsList )
1659  {
1660  pAnchoredObj->UpdateObjInSortedList();
1661  }
1662 }
1663 
1664 void SwDrawContact::DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer )
1665 {
1666  mbDisconnectInProgress = true;
1667 
1668  // --> #i36181# - notify background of drawing object
1669  if ( _bMoveMasterToInvisibleLayer &&
1670  !(GetFormat()->GetDoc()->IsInDtor()) &&
1671  GetAnchorFrame() && !GetAnchorFrame()->IsInDtor() )
1672  {
1674  lcl_NotifyBackgroundOfObj( *this, *GetMaster(), &aOldRect );
1675  NotifyBackgroundOfAllVirtObjs( &aOldRect );
1676  }
1677 
1678  // remove 'virtual' drawing objects from writer
1679  // layout and from drawing page
1680  for(auto& rpVirtDrawObj : maDrawVirtObjs)
1681  {
1682  rpVirtDrawObj->RemoveFromWriterLayout();
1683  rpVirtDrawObj->RemoveFromDrawingPage();
1684  }
1685 
1687  {
1689  }
1690 
1691  if ( _bMoveMasterToInvisibleLayer && GetMaster() && GetMaster()->IsInserted() )
1692  {
1693  SdrViewIter aIter( GetMaster() );
1694  for( SdrView* pView = aIter.FirstView(); pView;
1695  pView = aIter.NextView() )
1696  {
1697  pView->MarkObj( GetMaster(), pView->GetSdrPageView(), true );
1698  }
1699 
1700  // Instead of removing 'master' object from drawing page, move the
1701  // 'master' drawing object into the corresponding invisible layer.
1702  {
1703  //static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)->
1704  // RemoveObject( GetMaster()->GetOrdNum() );
1705  // #i18447# - in order to consider group object correct
1706  // use new method <SwDrawContact::MoveObjToInvisibleLayer(..)>
1708  }
1709  }
1710 
1711  mbDisconnectInProgress = false;
1712 }
1713 
1716 {
1717  if ( GetMaster() )
1718  {
1719  GetMaster()->SetUserCall( nullptr );
1720  if ( GetMaster()->IsInserted() )
1721  {
1722  static_cast<SwFrameFormat*>(GetRegisteredIn())->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
1723  RemoveObject( GetMaster()->GetOrdNum() );
1724  }
1725  }
1726 }
1727 
1728 // disconnect for a dedicated drawing object - could be 'master' or 'virtual'.
1729 // a 'master' drawing object will disconnect a 'virtual' drawing object
1730 // in order to take its place.
1731 // #i19919# - no special case, if drawing object isn't in
1732 // page header/footer, in order to get drawing objects in repeating table headers
1733 // also working.
1735 {
1736  if ( auto pSwDrawVirtObj = dynamic_cast<SwDrawVirtObj*>( _pDrawObj) )
1737  {
1738  pSwDrawVirtObj->RemoveFromWriterLayout();
1739  pSwDrawVirtObj->RemoveFromDrawingPage();
1740  }
1741  else
1742  {
1743  const auto ppVirtDrawObj(std::find_if(maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
1744  [] (const SwDrawVirtObjPtr& pObj) { return pObj->IsConnected(); }));
1745 
1746  if(ppVirtDrawObj != maDrawVirtObjs.end())
1747  {
1748  // replace found 'virtual' drawing object by 'master' drawing
1749  // object and disconnect the 'virtual' one
1750  SwDrawVirtObj* pDrawVirtObj(ppVirtDrawObj->get());
1751  SwFrame* pNewAnchorFrameOfMaster = pDrawVirtObj->AnchorFrame();
1752  // disconnect 'virtual' drawing object
1753  pDrawVirtObj->RemoveFromWriterLayout();
1754  pDrawVirtObj->RemoveFromDrawingPage();
1755  // disconnect 'master' drawing object from current frame
1757  // re-connect 'master' drawing object to frame of found 'virtual'
1758  // drawing object.
1759  pNewAnchorFrameOfMaster->AppendDrawObj( maAnchoredDrawObj );
1760  }
1761  else
1762  {
1763  // no connected 'virtual' drawing object found. Thus, disconnect
1764  // completely from layout.
1766  }
1767  }
1768 }
1769 
1770 static SwTextFrame* lcl_GetFlyInContentAnchor( SwTextFrame* _pProposedAnchorFrame,
1771  SwPosition const& rAnchorPos)
1772 {
1773  SwTextFrame* pAct = _pProposedAnchorFrame;
1774  SwTextFrame* pTmp;
1775  TextFrameIndex const nTextOffset(_pProposedAnchorFrame->MapModelToViewPos(rAnchorPos));
1776  do
1777  {
1778  pTmp = pAct;
1779  pAct = pTmp->GetFollow();
1780  }
1781  while (pAct && nTextOffset >= pAct->GetOffset());
1782  return pTmp;
1783 }
1784 
1786 {
1787  // *no* connect to layout during disconnection from layout.
1788  if ( mbDisconnectInProgress )
1789  {
1790  OSL_FAIL( "<SwDrawContact::ConnectToLayout(..)> called during disconnection.");
1791  return;
1792  }
1793 
1794  // --> #i33909# - *no* connect to layout, if 'master' drawing
1795  // object isn't inserted in the drawing page
1796  if ( !GetMaster()->IsInserted() )
1797  {
1798  OSL_FAIL( "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted -> no connect to layout. Please inform od@openoffice.org" );
1799  return;
1800  }
1801 
1802  SwFrameFormat* pDrawFrameFormat = static_cast<SwFrameFormat*>(GetRegisteredIn());
1803 
1804  if( !pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell() )
1805  return;
1806 
1807  // remove 'virtual' drawing objects from writer
1808  // layout and from drawing page, and remove 'master' drawing object from
1809  // writer layout - 'master' object will remain in drawing page.
1810  DisconnectFromLayout( false );
1811 
1812  if ( !pAnch )
1813  {
1814  pAnch = &(pDrawFrameFormat->GetAnchor());
1815  }
1816 
1817  switch ( pAnch->GetAnchorId() )
1818  {
1819  case RndStdIds::FLY_AT_PAGE:
1820  {
1821  sal_uInt16 nPgNum = pAnch->GetPageNum();
1822  SwViewShell *pShell = pDrawFrameFormat->getIDocumentLayoutAccess().GetCurrentViewShell();
1823  if( !pShell )
1824  break;
1825  SwRootFrame* pRoot = pShell->GetLayout();
1826  SwPageFrame *pPage = static_cast<SwPageFrame*>(pRoot->Lower());
1827 
1828  for ( sal_uInt16 i = 1; i < nPgNum && pPage; ++i )
1829  {
1830  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
1831  }
1832 
1833  if ( pPage )
1834  {
1835  pPage->AppendDrawObj( maAnchoredDrawObj );
1836  }
1837  else
1838  //Looks stupid but is allowed (compare SwFEShell::SetPageObjsNewPage)
1839  pRoot->SetAssertFlyPages();
1840  }
1841  break;
1842 
1843  case RndStdIds::FLY_AT_CHAR:
1844  case RndStdIds::FLY_AT_PARA:
1845  case RndStdIds::FLY_AT_FLY:
1846  case RndStdIds::FLY_AS_CHAR:
1847  {
1848  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1849  {
1851  }
1852  // support drawing objects in header/footer,
1853  // but not control objects:
1854  // anchor at first found frame the 'master' object and
1855  // at the following frames 'virtual' drawing objects.
1856  // Note: method is similar to <SwFlyFrameFormat::MakeFrames(..)>
1857  sw::BroadcastingModify *pModify = nullptr;
1858  if( pAnch->GetContentAnchor() )
1859  {
1860  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AT_FLY )
1861  {
1862  SwNodeIndex aIdx( pAnch->GetContentAnchor()->nNode );
1863  SwContentNode* pCNd = pDrawFrameFormat->GetDoc()->GetNodes().GoNext( &aIdx );
1865  pModify = pCNd;
1866  else
1867  {
1868  const SwNodeIndex& rIdx = pAnch->GetContentAnchor()->nNode;
1869  SwFrameFormats& rFormats = *(pDrawFrameFormat->GetDoc()->GetSpzFrameFormats());
1870  for( auto pFlyFormat : rFormats )
1871  {
1872  if( pFlyFormat->GetContent().GetContentIdx() &&
1873  rIdx == *(pFlyFormat->GetContent().GetContentIdx()) )
1874  {
1875  pModify = pFlyFormat;
1876  break;
1877  }
1878  }
1879  }
1880  }
1881  else
1882  {
1883  pModify = pAnch->GetContentAnchor()->nNode.GetNode().GetContentNode();
1884  }
1885  }
1886 
1887  // #i29199# - It is possible, that
1888  // the anchor doesn't exist - E.g., reordering the
1889  // sub-documents in a master document.
1890  // Note: The anchor will be inserted later.
1891  if ( !pModify )
1892  {
1893  // break to end of the current switch case.
1894  break;
1895  }
1896 
1898  SwFrame* pAnchorFrameOfMaster = nullptr;
1899  for( SwFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
1900  {
1901  // append drawing object, if
1902  // (1) proposed anchor frame isn't a follow and...
1903  const bool bFollow = pFrame->IsContentFrame() && static_cast<SwContentFrame*>(pFrame)->IsFollow();
1904  if (bFollow)
1905  continue;
1906 
1907  // (2) drawing object isn't a control object to be anchored
1908  // in header/footer.
1909  const bool bControlInHF = ::CheckControlLayer(GetMaster()) && pFrame->FindFooterOrHeader();
1910  // tdf#129542 but make an exception for control objects so they can get added to just the first frame,
1911  // the Master Anchor Frame and not the others
1912  if (bControlInHF && pAnchorFrameOfMaster)
1913  continue;
1914 
1915  bool bAdd;
1916  if (RndStdIds::FLY_AT_FLY == pAnch->GetAnchorId())
1917  bAdd = true;
1918  else
1919  {
1920  assert(pFrame->IsTextFrame());
1921  bAdd = IsAnchoredObjShown(*static_cast<SwTextFrame*>(pFrame), *pAnch);
1922  }
1923 
1924  if( bAdd )
1925  {
1926  if ( RndStdIds::FLY_AT_FLY == pAnch->GetAnchorId() && !pFrame->IsFlyFrame() )
1927  {
1928  pFrame = pFrame->FindFlyFrame();
1929  assert(pFrame);
1930  }
1931 
1932  // find correct follow for as character anchored objects
1933  if ((pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR) &&
1934  pFrame->IsTextFrame() )
1935  {
1936  pFrame = lcl_GetFlyInContentAnchor(
1937  static_cast<SwTextFrame*>(pFrame),
1938  *pAnch->GetContentAnchor());
1939  }
1940 
1941  if ( !pAnchorFrameOfMaster )
1942  {
1943  // append 'master' drawing object
1944  pAnchorFrameOfMaster = pFrame;
1945  pFrame->AppendDrawObj( maAnchoredDrawObj );
1946  }
1947  else
1948  {
1949  // append 'virtual' drawing object
1950  SwDrawVirtObj* pDrawVirtObj = AddVirtObj(*pFrame);
1951  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1952  {
1953  ClrContourCache( pDrawVirtObj );
1954  }
1955  pFrame->AppendDrawObj( pDrawVirtObj->AnchoredObj() );
1956 
1957  pDrawVirtObj->ActionChanged();
1958  }
1959 
1960  if ( pAnch->GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1961  {
1962  pFrame->InvalidatePrt();
1963  }
1964  }
1965  }
1966  }
1967  break;
1968  default:
1969  assert(!"Unknown Anchor.");
1970  break;
1971  }
1972  if ( GetAnchorFrame() )
1973  {
1975  // #i26791# - invalidate objects instead of direct positioning
1976  InvalidateObjs_();
1977  }
1978 }
1979 
1982 {
1983  if ( !GetMaster()->IsInserted() )
1984  {
1986  ->InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() );
1987  }
1988  GetMaster()->SetUserCall( this );
1989 }
1990 
1992 {
1993  // --> #i28701# - use method <GetPageFrame()>
1994  SwPageFrame* pPg = GetPageFrame();
1995  if ( !pPg && GetAnchorFrame() )
1996  pPg = GetAnchorFrame()->FindPageFrame();
1997  if ( pPg )
1998  pPg = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( rRect, pPg )));
1999  return pPg;
2000 }
2001 
2003 {
2004  if ( mbDisconnectInProgress )
2005  {
2006  OSL_FAIL( "<SwDrawContact::ChkPage()> called during disconnection." );
2007  return;
2008  }
2009 
2010  // --> #i28701#
2013  ? GetPageFrame()
2014  : FindPage( SwRect(GetMaster()->GetCurrentBoundRect()) );
2015  if ( GetPageFrame() == pPg )
2016  return;
2017 
2018  // if drawing object is anchor in header/footer a change of the page
2019  // is a dramatic change. Thus, completely re-connect to the layout
2022  {
2023  ConnectToLayout();
2024  }
2025  else
2026  {
2027  // --> #i28701# - use methods <GetPageFrame()> and <SetPageFrame>
2028  if ( GetPageFrame() )
2032  }
2033 }
2034 
2035 // Important note:
2036 // method is called by method <SwDPage::ReplaceObject(..)>, which called its
2037 // corresponding superclass method <FmFormPage::ReplaceObject(..)>.
2038 // Note: 'master' drawing object *has* to be connected to layout triggered
2039 // by the caller of this, if method is called.
2041 {
2042  DisconnectFromLayout( false );
2043  // consider 'virtual' drawing objects
2045 
2046  GetMaster()->SetUserCall( nullptr );
2047  if(pNewMaster)
2048  maAnchoredDrawObj.SetDrawObj(*pNewMaster);
2049  else
2050  mbMasterObjCleared = true;
2051  GetMaster()->SetUserCall( this );
2052 
2053  InvalidateObjs_();
2054 }
2055 
2057 void SwDrawContact::GetAnchoredObjs(std::vector<SwAnchoredObject*>& o_rAnchoredObjs) const
2058 {
2059  o_rAnchoredObjs.push_back(const_cast<SwAnchoredDrawObject*>(&maAnchoredDrawObj));
2060 
2061  for(auto& rpDrawVirtObj : maDrawVirtObjs)
2062  o_rAnchoredObjs.push_back(&rpDrawVirtObj->AnchoredObj());
2063 }
2064 
2065 // AW: own sdr::contact::ViewContact (VC) sdr::contact::ViewObjectContact (VOC) needed
2066 // since offset is defined different from SdrVirtObj's sdr::contact::ViewContactOfVirtObj.
2067 // For paint, that offset is used by setting at the OutputDevice; for primitives this is
2068 // not possible since we have no OutputDevice, but define the geometry itself.
2069 
2070 namespace sdr::contact
2071 {
2072  namespace {
2073 
2074  class VOCOfDrawVirtObj : public ViewObjectContactOfSdrObj
2075  {
2076  protected:
2085  virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override;
2086 
2087  public:
2088  VOCOfDrawVirtObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
2089  : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
2090  {
2091  }
2092  };
2093 
2094  class VCOfDrawVirtObj : public ViewContactOfVirtObj
2095  {
2096  protected:
2102  virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) override;
2103 
2104  public:
2106  explicit VCOfDrawVirtObj(SwDrawVirtObj& rObj)
2107  : ViewContactOfVirtObj(rObj)
2108  {
2109  }
2110 
2112  SwDrawVirtObj& GetSwDrawVirtObj() const
2113  {
2114  return static_cast<SwDrawVirtObj&>(mrObject);
2115  }
2116  };
2117 
2118  }
2119 } // end of namespace sdr::contact
2120 
2121 namespace sdr::contact
2122 {
2124  static void impAddPrimitivesFromGroup(const ViewObjectContact& rVOC, const basegfx::B2DHomMatrix& rOffsetMatrix, const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DContainer& rxTarget)
2125  {
2126  const sal_uInt32 nSubHierarchyCount(rVOC.GetViewContact().GetObjectCount());
2127 
2128  for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
2129  {
2131 
2132  if(rCandidate.GetViewContact().GetObjectCount())
2133  {
2134  // is a group object itself, call recursively
2135  impAddPrimitivesFromGroup(rCandidate, rOffsetMatrix, rDisplayInfo, rxTarget);
2136  }
2137  else
2138  {
2139  // single object, add primitives; check model-view visibility
2140  if(rCandidate.isPrimitiveVisible(rDisplayInfo))
2141  {
2142  drawinglayer::primitive2d::Primitive2DContainer aNewSequence(rCandidate.getPrimitive2DSequence(rDisplayInfo));
2143 
2144  if(!aNewSequence.empty())
2145  {
2146  // get ranges
2147  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(rCandidate.GetObjectContact().getViewInformation2D());
2148  const basegfx::B2DRange& aViewRange(rViewInformation2D.getViewport());
2149  basegfx::B2DRange aObjectRange(rCandidate.getObjectRange());
2150 
2151  // correct with virtual object's offset
2152  aObjectRange.transform(rOffsetMatrix);
2153 
2154  // check geometrical visibility (with offset)
2155  if(!aViewRange.overlaps(aObjectRange))
2156  {
2157  // not visible, release
2158  aNewSequence.clear();
2159  }
2160  }
2161 
2162  if(!aNewSequence.empty())
2163  {
2164  rxTarget.append(aNewSequence);
2165  }
2166  }
2167  }
2168  }
2169  }
2170 
2171  drawinglayer::primitive2d::Primitive2DContainer VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
2172  {
2173  // tdf#91260 have already checked top-level one is on the right page
2174  assert(isPrimitiveVisible(rDisplayInfo));
2175  // nasty corner case: override to clear page frame to disable the
2176  // sub-objects' anchor check, because their anchor is always on
2177  // the first page that the page style is applied to
2178  DisplayInfo aDisplayInfo(rDisplayInfo);
2179  aDisplayInfo.SetWriterPageFrame(basegfx::B2IRectangle());
2180  const VCOfDrawVirtObj& rVC = static_cast< const VCOfDrawVirtObj& >(GetViewContact());
2181  const SdrObject& rReferencedObject = rVC.GetSwDrawVirtObj().GetReferencedObj();
2183 
2184  // create offset transformation
2185  basegfx::B2DHomMatrix aOffsetMatrix;
2186  const Point aLocalOffset(rVC.GetSwDrawVirtObj().GetOffset());
2187 
2188  if(aLocalOffset.X() || aLocalOffset.Y())
2189  {
2190  aOffsetMatrix.set(0, 2, aLocalOffset.X());
2191  aOffsetMatrix.set(1, 2, aLocalOffset.Y());
2192  }
2193 
2194  if(dynamic_cast<const SdrObjGroup*>( &rReferencedObject) != nullptr)
2195  {
2196  // group object. Since the VOC/OC/VC hierarchy does not represent the
2197  // hierarchy virtual objects when they have group objects
2198  // (ViewContactOfVirtObj::GetObjectCount() returns null for that purpose)
2199  // to avoid multiple usages of VOCs (which would not work), the primitives
2200  // for the sub-hierarchy need to be collected here
2201 
2202  // Get the VOC of the referenced object (the Group) and fetch primitives from it
2203  const ViewObjectContact& rVOCOfRefObj = rReferencedObject.GetViewContact().GetViewObjectContact(GetObjectContact());
2204  impAddPrimitivesFromGroup(rVOCOfRefObj, aOffsetMatrix, aDisplayInfo, xRetval);
2205  }
2206  else
2207  {
2208  // single object, use method from referenced object to get the Primitive2DSequence
2209  xRetval = rReferencedObject.GetViewContact().getViewIndependentPrimitive2DContainer();
2210  }
2211 
2212  if(!xRetval.empty())
2213  {
2214  // create transform primitive
2216  xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference };
2217  }
2218 
2219  return xRetval;
2220  }
2221 
2222  ViewObjectContact& VCOfDrawVirtObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
2223  {
2224  return *(new VOCOfDrawVirtObj(rObjectContact, *this));
2225  }
2226 
2227 } // end of namespace sdr::contact
2228 
2230 std::unique_ptr<sdr::contact::ViewContact> SwDrawVirtObj::CreateObjectSpecificViewContact()
2231 {
2232  return std::make_unique<sdr::contact::VCOfDrawVirtObj>(*this);
2233 }
2234 
2236  SdrModel& rSdrModel,
2237  SdrObject& _rNewObj,
2238  SwDrawContact& _rDrawContact)
2239 : SdrVirtObj(rSdrModel, _rNewObj ),
2240  mrDrawContact(_rDrawContact)
2241 {
2242  // #i26791#
2243  maAnchoredDrawObj.SetDrawObj( *this );
2244 
2245  // #i35635# - set initial position out of sight
2246  NbcMove( Size( -16000, -16000 ) );
2247 }
2248 
2250  SdrModel& rSdrModel,
2251  SwDrawVirtObj const & rSource)
2252 : SdrVirtObj(rSdrModel, rSource),
2253  mrDrawContact(rSource.mrDrawContact)
2254 {
2255  // #i26791#
2256  maAnchoredDrawObj.SetDrawObj( *this );
2257 
2258  // #i35635# - set initial position out of sight
2259  NbcMove( Size( -16000, -16000 ) );
2260 
2261  // Note: Members <maAnchoredDrawObj> and <mrDrawContact>
2262  // haven't to be considered.
2263 }
2264 
2266 {
2267 }
2268 
2270 {
2271  return new SwDrawVirtObj(rTargetModel, *this);
2272 }
2273 
2275 {
2276  // #i26791# - use new member <maAnchoredDrawObj>
2278 }
2279 
2281 {
2282  // #i26791# - use new member <maAnchoredDrawObj>
2283  return maAnchoredDrawObj.AnchorFrame();
2284 }
2285 
2287 {
2288  // remove contact object from frame for 'virtual' drawing object
2289  // #i26791# - use new member <maAnchoredDrawObj>
2291  {
2293  }
2294 }
2295 
2296 void SwDrawVirtObj::AddToDrawingPage(SwFrame const& rAnchorFrame)
2297 {
2298  // determine 'master'
2299  SdrObject* pOrgMasterSdrObj = mrDrawContact.GetMaster();
2300 
2301  // insert 'virtual' drawing object into page, set layer and user call.
2302  SdrPage* pDrawPg = pOrgMasterSdrObj->getSdrPageFromSdrObject();
2303  // default: insert before master object
2304  auto nOrdNum(GetReferencedObj().GetOrdNum());
2305 
2306  // maintain invariant that a shape's textbox immediately follows the shape
2307  // also for the multiple SdrDrawVirtObj created for shapes in header/footer
2308  if (SwFrameFormat const*const pFlyFormat =
2310  {
2311  // this is for the case when the flyframe SdrVirtObj is created before the draw one
2312  if (SwSortedObjs const*const pObjs = rAnchorFrame.GetDrawObjs())
2313  {
2314  for (SwAnchoredObject const*const pAnchoredObj : *pObjs)
2315  {
2316  if (&pAnchoredObj->GetFrameFormat() == pFlyFormat)
2317  {
2318  assert(dynamic_cast<SwFlyFrame const*>(pAnchoredObj));
2319  nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum();
2320  // the master SdrObj should have the highest index
2321  assert(nOrdNum < GetReferencedObj().GetOrdNum());
2322  break;
2323  }
2324  }
2325  }
2326  // this happens on initial insertion, the draw object is created first
2327  SAL_INFO_IF(GetReferencedObj().GetOrdNum() == nOrdNum, "sw", "AddToDrawingPage: cannot find SdrObject for text box's shape");
2328  }
2329 
2330  // #i27030# - apply order number of referenced object
2331  if ( nullptr != pDrawPg )
2332  {
2333  // #i27030# - apply order number of referenced object
2334  pDrawPg->InsertObject(this, nOrdNum);
2335  }
2336  else
2337  {
2338  pDrawPg = getSdrPageFromSdrObject();
2339  if ( pDrawPg )
2340  {
2341  pDrawPg->SetObjectOrdNum(GetOrdNumDirect(), nOrdNum);
2342  }
2343  else
2344  {
2345  SetOrdNum(nOrdNum);
2346  }
2347  }
2349 }
2350 
2352 {
2353  SetUserCall( nullptr );
2354  if ( getSdrPageFromSdrObject() )
2355  {
2357  }
2358 }
2359 
2362 {
2363  bool bRetVal = GetAnchorFrame() &&
2365 
2366  return bRetVal;
2367 }
2368 
2369 void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt)
2370 {
2372 }
2373 
2374 // #i97197#
2375 // the methods relevant for positioning
2376 
2378 {
2379  if(m_aOutRect.IsEmpty())
2380  {
2381  const_cast<SwDrawVirtObj*>(this)->RecalcBoundRect();
2382  }
2383 
2384  return m_aOutRect;
2385 }
2386 
2388 {
2389  return m_aOutRect;
2390 }
2391 
2393 {
2394  // do NOT use IsEmpty() here, there is already a useful offset
2395  // in the position
2396  if(m_aOutRect == tools::Rectangle())
2397  {
2398  return Point();
2399  }
2400  else
2401  {
2403  }
2404 }
2405 
2407 {
2408  // do nothing to not lose model information in aOutRect
2409 }
2410 
2412 {
2413  // #i26791# - switch order of calling <GetOffset()> and
2414  // <ReferencedObj().GetCurrentBoundRect()>, because <GetOffset()> calculates
2415  // its value by the 'BoundRect' of the referenced object.
2416 
2417  const Point aOffset(GetOffset());
2419 }
2420 
2422 {
2425 
2426  return aRetval;
2427 }
2428 
2430 {
2433 
2434  return aRetval;
2435 }
2436 
2438 {
2439  SdrHdlList tmpList(nullptr);
2440  rRefObj.AddToHdlList(tmpList);
2441 
2442  size_t cnt = tmpList.GetHdlCount();
2443  for(size_t i=0; i < cnt; ++i)
2444  {
2445  SdrHdl* pHdl = tmpList.GetHdl(i);
2446  Point aP(pHdl->GetPos() + GetOffset());
2447  pHdl->SetPos(aP);
2448  }
2449  tmpList.MoveTo(rHdlList);
2450 }
2451 
2452 void SwDrawVirtObj::NbcMove(const Size& rSiz)
2453 {
2454  SdrObject::NbcMove( rSiz );
2455 }
2456 
2457 void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
2458 {
2459  rRefObj.NbcResize(rRef - GetOffset(), xFact, yFact);
2461 }
2462 
2463 void SwDrawVirtObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
2464 {
2465  rRefObj.NbcRotate(rRef - GetOffset(), nAngle, sn, cs);
2467 }
2468 
2469 void SwDrawVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
2470 {
2471  rRefObj.NbcMirror(rRef1 - GetOffset(), rRef2 - GetOffset());
2473 }
2474 
2475 void SwDrawVirtObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
2476 {
2477  rRefObj.NbcShear(rRef - GetOffset(), nAngle, tn, bVShear);
2479 }
2480 
2481 void SwDrawVirtObj::Move(const Size& rSiz)
2482 {
2483  SdrObject::Move( rSiz );
2484 }
2485 
2486 void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
2487 {
2488  if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
2489  {
2490  tools::Rectangle aBoundRect0; if(m_pUserCall) aBoundRect0 = GetLastBoundRect();
2491  rRefObj.Resize(rRef - GetOffset(), xFact, yFact, bUnsetRelative);
2493  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2494  }
2495 }
2496 
2497 void SwDrawVirtObj::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
2498 {
2499  if(nAngle)
2500  {
2501  tools::Rectangle aBoundRect0; if(m_pUserCall) aBoundRect0 = GetLastBoundRect();
2502  rRefObj.Rotate(rRef - GetOffset(), nAngle, sn, cs);
2504  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2505  }
2506 }
2507 
2508 void SwDrawVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
2509 {
2510  tools::Rectangle aBoundRect0; if(m_pUserCall) aBoundRect0 = GetLastBoundRect();
2511  rRefObj.Mirror(rRef1 - GetOffset(), rRef2 - GetOffset());
2513  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2514 }
2515 
2516 void SwDrawVirtObj::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
2517 {
2518  if(nAngle)
2519  {
2520  tools::Rectangle aBoundRect0; if(m_pUserCall) aBoundRect0 = GetLastBoundRect();
2521  rRefObj.Shear(rRef - GetOffset(), nAngle, tn, bVShear);
2523  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2524  }
2525 }
2526 
2528 {
2530  aSnapRect += GetOffset();
2531 }
2532 
2534 {
2535  const_cast<SwDrawVirtObj*>(this)->aSnapRect = rRefObj.GetSnapRect();
2536  const_cast<SwDrawVirtObj*>(this)->aSnapRect += GetOffset();
2537 
2538  return aSnapRect;
2539 }
2540 
2542 {
2543  tools::Rectangle aBoundRect0; if(m_pUserCall) aBoundRect0 = GetLastBoundRect();
2544  tools::Rectangle aR(rRect);
2545  aR -= GetOffset();
2546  rRefObj.SetSnapRect(aR);
2548  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2549 }
2550 
2552 {
2553  tools::Rectangle aR(rRect);
2554  aR -= GetOffset();
2556  rRefObj.NbcSetSnapRect(aR);
2557 }
2558 
2560 {
2561  const_cast<SwDrawVirtObj*>(this)->aSnapRect = rRefObj.GetLogicRect();
2562  const_cast<SwDrawVirtObj*>(this)->aSnapRect += GetOffset();
2563 
2564  return aSnapRect;
2565 }
2566 
2568 {
2569  tools::Rectangle aBoundRect0; if(m_pUserCall) aBoundRect0 = GetLastBoundRect();
2570  tools::Rectangle aR(rRect);
2571  aR -= GetOffset();
2572  rRefObj.SetLogicRect(aR);
2574  SendUserCall(SdrUserCallType::Resize, aBoundRect0);
2575 }
2576 
2578 {
2579  tools::Rectangle aR(rRect);
2580  aR -= GetOffset();
2583 }
2584 
2586 {
2587  Point aP(rRefObj.GetSnapPoint(i));
2588  aP += GetOffset();
2589 
2590  return aP;
2591 }
2592 
2593 Point SwDrawVirtObj::GetPoint(sal_uInt32 i) const
2594 {
2595  return rRefObj.GetPoint(i) + GetOffset();
2596 }
2597 
2598 void SwDrawVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
2599 {
2600  Point aP(rPnt);
2601  aP -= GetOffset();
2602  rRefObj.SetPoint(aP, i);
2604 }
2605 
2607 {
2608  return rRefObj.HasTextEdit();
2609 }
2610 
2611 // override 'layer' methods for 'virtual' drawing object to assure
2612 // that layer of 'virtual' object is the layer of the referenced object.
2614 {
2615  return GetReferencedObj().GetLayer();
2616 }
2617 
2619 {
2620  ReferencedObj().NbcSetLayer( nLayer );
2622 }
2623 
2625 {
2626  ReferencedObj().SetLayer( nLayer );
2628 }
2629 
2630 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Shear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear)
void RemoveAllVirtObjs()
remove 'virtual' drawing objects and destroy them.
Definition: dcontact.cxx:842
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:548
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:2280
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
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2783
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:2040
Base class of the Writer layout elements.
Definition: frame.hxx:315
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
SdrObject * GetDrawObjectByAnchorFrame(const SwFrame &_rAnchorFrame)
get drawing object ('master' or 'virtual') by frame.
Definition: dcontact.cxx:855
virtual SwRect GetObjRect() const =0
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
void InsertCnt()
Definition: fly.cxx:210
SwFlyDrawObjPtr mpMasterObj
Definition: dcontact.hxx:180
SwFlyDrawContact * GetOrCreateContact()
Definition: atrfrm.cxx:2924
SwDrawContact(const SwDrawContact &)=delete
void ChkPage()
Definition: dcontact.cxx:2002
bool IsFollow() const
Definition: flowfrm.hxx:166
virtual void Shear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
Definition: dcontact.cxx:2516
WW8AnchorConv
Definition: frmfmt.hxx:298
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:565
SwAnchoredDrawObject maAnchoredDrawObj
anchored drawing object instance for the 'virtual' drawing object
Definition: dcontact.hxx:218
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:1019
virtual SwDrawVirtObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: dcontact.cxx:2269
bool CheckControlLayer(const SdrObject *pObj)
Definition: dcontact.cxx:679
void InsertColumns()
Definition: fly.cxx:230
void SetPoint(const Point &rPnt, sal_uInt32 i)
void DisconnectFromLayout(bool _bMoveMasterToInvisibleLayer=true)
Definition: dcontact.cxx:1664
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:305
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:588
virtual SdrObjList * getChildrenOfSdrObject() const
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact)
constexpr tools::Long Left() const
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
SwNodeIndex nNode
Definition: pam.hxx:37
virtual ~SwContact() override
Definition: dcontact.cxx:197
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs)
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
Definition: wsfrm.cxx:597
virtual SdrLayerID GetInvisibleControlsId() const =0
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
const SwFrame * FindPage(const SwRect &rRect, const SwFrame *pPage)
Definition: frmtool.cxx:3690
SwTwips GetPos() const
Definition: fmtornt.hxx:92
#define SAL_INFO_IF(condition, area, stream)
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:931
bool mbMasterObjCleared
boolean indicating set 'master' drawing object has been cleared.
Definition: dcontact.hxx:319
helper class for method for handling nested events ...
Definition: dcontact.cxx:1016
virtual SdrLayerID GetHeavenId() const =0
SdrUserCallType
bool IsAnchoredObjShown(SwTextFrame const &rFrame, SwFormatAnchor const &rAnchor)
Definition: frmtool.cxx:1297
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
Definition: dcontact.cxx:2497
void RemoveDrawObjFromPage(SwAnchoredObject &_rToRemoveObj)
Definition: flylay.cxx:1078
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear)
virtual ~SwDrawVirtObj() override
Definition: dcontact.cxx:2265
SdrObject * GetObj(size_t nNum) const
bool IsInserted() const
Definition: doc.hxx:188
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:365
SwDrawVirtObj(SdrModel &rSdrModel, SdrObject &_rNewObj, SwDrawContact &_rDrawContact)
Definition: dcontact.cxx:2235
virtual ~SwDrawContact() override
Definition: dcontact.cxx:732
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: dcontact.cxx:2437
ViewObjectContact & GetViewObjectContact(ObjectContact &rObjectContact)
SwNode & GetNode() const
Definition: ndindex.hxx:119
void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: dcontact.cxx:663
bool IsPosAttrSet() const
Definition: frmfmt.hxx:400
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
virtual void Move(const Size &rSiz) override
Definition: dcontact.cxx:2481
void Pos(const Point &rNew)
Definition: swrect.hxx:168
SdrUserCallType meEventTypeOfCurrentUserCall
event type, which is handled for .
Definition: dcontact.hxx:330
tools::Rectangle m_aOutRect
virtual void NbcMove(const Size &rSiz) override
Definition: dcontact.cxx:2452
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
const Point & GetPos() const
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:121
virtual void AddToHdlList(SdrHdlList &rHdlList) const
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
Point GetRelPosToChar() const
method to determine position of anchored object relative to anchor character
static void Free(SdrObject *&_rpObject)
virtual SdrObjKind GetObjIdentifier() const
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
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:751
SwDrawContact & mrDrawContact
writer-drawing contact object the 'virtual' drawing object is controlled by.
Definition: dcontact.hxx:223
void Notify_Background(const SdrObject *pObj, SwPageFrame *pPage, const SwRect &rRect, const PrepareHint eHint, const bool bInva)
Definition: frmtool.cxx:3351
EmbeddedObjectRef * pObject
void Chain(SwFrame *_pAnchor)
Definition: fly.cxx:179
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:171
void DeleteCnt()
Definition: fly.cxx:317
virtual bool HasTextEdit() const override
Definition: dcontact.cxx:2606
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
SfxHintId GetId() const
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
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:1043
SdrTextAniKind
drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(const DisplayInfo &rDisplayInfo) const
virtual Point GetOffset() const override
access to offset
Definition: dcontact.cxx:2392
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
virtual const tools::Rectangle & GetSnapRect() const
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:204
SdrView * NextView()
#define SAL_MAX_UINT32
void SetDrawObj(SdrObject &_rDrawObj)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
bool IsFlyFrame() const
Definition: frame.hxx:1211
wrapper class for the positioning of Writer fly frames and drawing objects
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
void RemoveDrawObj(SwAnchoredObject &_rToRemoveObj)
Definition: fly.cxx:2319
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
bool IsMore() const
SdrPage * getSdrPageFromSdrObject() const
const SwFrame * GetAnchorFrame(const SdrObject *_pDrawObj=nullptr) const
Definition: dcontact.cxx:803
void NotifyBackgroundOfAllVirtObjs(const tools::Rectangle *pOldBoundRect)
Definition: dcontact.cxx:899
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: dcontact.cxx:1416
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:310
virtual const tools::Rectangle & GetLogicRect() const override
Definition: dcontact.cxx:2559
SdrObject & rRefObj
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: dcontact.cxx:420
bool IsTextFrame() const
Definition: frame.hxx:1235
bool mbUserCallActive
Needed data for handling of nested events in method ...
Definition: dcontact.hxx:327
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
bool mbParentUserCallActive
Definition: dcontact.cxx:1020
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1112
SwFrameFormat * FindFrameFormat(SdrObject *pObj)
The Get reverse way: seeks the format to the specified object.
Definition: dcontact.cxx:120
void AssertNestedUserCall()
Definition: dcontact.cxx:1053
SdrObject * DrawObj()
virtual bool IsEnableSetModified() const =0
virtual void GetAnchoredObjs(std::vector< SwAnchoredObject * > &_roAnchoredObjs) const override
get data collection of anchored objects handled by with contact
Definition: dcontact.cxx:658
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: dcontact.cxx:2469
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()
SwDrawVirtObj * AddVirtObj(SwFrame const &rAnchorFrame)
add a 'virtual' drawing object to drawing page.
Definition: dcontact.cxx:829
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:855
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:438
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
constexpr bool IsEmpty() const
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
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:2230
bool IsMarqueeTextObj(const SdrObject &rObj)
Returns true if the SrdObject is a Marquee-Object (scrolling text)
Definition: dcontact.cxx:182
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
Definition: dcontact.cxx:2475
bool HasWrap(const SdrObject *pObj)
Definition: dcontact.cxx:139
virtual void SetLayer(SdrLayerID nLayer)
Style of a layout element.
Definition: frmfmt.hxx:59
Point GetRelPosToLine() const
method to determine position of anchored object relative to top of line
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
Definition: txtfrm.cxx:1269
bool IsContentFrame() const
Definition: frame.hxx:1231
void InsertMasterIntoDrawPage()
method to insert 'master' drawing object into drawing page
Definition: dcontact.cxx:1981
virtual const tools::Rectangle & GetCurrentBoundRect() const override
Definition: dcontact.cxx:2377
const SdrObject * GetDrawObj() const
void InvalidatePrt()
Definition: frame.hxx:1037
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2577
uno_Any a
virtual SdrLayerID GetLayer() const override
Definition: dcontact.cxx:2613
void MoveTo(SdrHdlList &rOther)
void SetAssertFlyPages()
Makes sure that all requested page-bound Flys find a Page.
Definition: rootfrm.hxx:278
static void GetAnchoredObjects(std::vector< SwAnchoredObject * > &, const SwFormat &rFormat)
Definition: fly.cxx:2870
const drawinglayer::geometry::ViewInformation2D & getViewInformation2D() const
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:720
virtual SwFrameFormat::tLayoutDir GetLayoutDir() const
Definition: atrfrm.cxx:2841
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:681
virtual void SetBoundRectDirty() override
Definition: dcontact.cxx:2406
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, SdrObject *pObject=nullptr)
Is the frame format a text box?
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
Definition: flylay.cxx:1029
const SwFrame * Lower() const
Definition: layfrm.hxx:101
TElementType * First()
Definition: calbck.hxx:357
SwContentNode * GetContentNode()
Definition: node.hxx:616
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.
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:2124
bool HasArea() const
Definition: swrect.hxx:280
constexpr tools::Long Right() const
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
drawinglayer::primitive2d::Primitive2DContainer getViewIndependentPrimitive2DContainer() const
virtual basegfx::B2DPolyPolygon TakeContour() const
void UpdateObjInSortedList()
method to update anchored object in the lists
SdrModel & getSdrModelFromSdrObject() const
SdrObjUserCall * m_pUserCall
void transform(const basegfx::B2DHomMatrix &rMatrix)
sal_uInt32 GetOrdNum() const
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
virtual void append(const Primitive2DReference &) override
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
constexpr tools::Long Top() const
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:352
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:1635
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:123
virtual const tools::Rectangle & GetLastBoundRect() const override
Definition: dcontact.cxx:2387
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const override
Definition: dcontact.cxx:560
static bool changeAnchor(SwFrameFormat *pShape, SdrObject *pObj)
Sets the anchor of the associated textframe of the given shape, and returns true on success...
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const =0
A page of the document layout.
Definition: pagefrm.hxx:57
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:1100
SwFrame * GetAnchorFrameContainingAnchPos()
determine anchor frame containing the anchor position
virtual void Mirror(const Point &rRef1, const Point &rRef2)
tools::Long SwTwips
Definition: swtypes.hxx:52
static sal_uInt16 nPgNum
Definition: viewport.cxx:52
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
#define Y
virtual const SdrObject * GetMaster() const =0
virtual SdrInventor GetObjInventor() const
constexpr Point TopLeft() const
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetLayer() const
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2551
void AddToDrawingPage(SwFrame const &rAnchorFrame)
connection to drawing layer
Definition: dcontact.cxx:2296
virtual void RecalcBoundRect() override
All overridden methods which need to use the offset.
Definition: dcontact.cxx:2411
virtual void RecalcSnapRect() override
Definition: dcontact.cxx:2527
static void AddExistingShapeToFormat(SdrObject const &_rObj)
Definition: unodraw.cxx:919
std::optional< tools::Rectangle > const & GetLastObjRect() const
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: dcontact.cxx:2567
virtual sal_uInt32 GetObjectCount() const
SdrObject * Next()
size_t GetHdlCount() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SdrHdl * GetHdl(size_t nNum) const
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
constexpr Size GetSize() const
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: dcontact.cxx:2585
virtual SwFrameFormat & GetFrameFormat() override
virtual void SetLayer(SdrLayerID nLayer) override
Definition: dcontact.cxx:2624
tools::Rectangle SVRect() const
Definition: swrect.hxx:272
sal_Int32 GetDenominator() const
virtual SdrObject * ReplaceObject(SdrObject *pNewObj, size_t nObjNum)
virtual const tools::Rectangle & GetSnapRect() const override
Definition: dcontact.cxx:2533
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
virtual void NbcSetSnapRect(const tools::Rectangle &rRect)
virtual SwFrameFormat & GetFrameFormat()=0
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 SdrLayerID GetInvisibleHeavenId() const =0
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:738
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)
SwTwips GetPos() const
Definition: fmtornt.hxx:59
virtual void Mirror(const Point &rRef1, const Point &rRef2) override
Definition: dcontact.cxx:2508
sal_uInt32 GetOrdNumForNewRef(const SwFlyFrame *pFly, SwFrame const &rAnchorFrame)
Definition: dcontact.cxx:481
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const override
Definition: dcontact.cxx:761
void SetInDTOR()
Definition: dcontact.cxx:203
virtual void NbcMove(const Size &rSiz)
void SetPageFrame(SwPageFrame *_pNewPageFrame)
#define SAL_INFO(area, stream)
virtual void NbcSetLayer(SdrLayerID nLayer) override
Definition: dcontact.cxx:2618
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:1734
void ConnectToLayout(const SwFormatAnchor *pAnch=nullptr)
Inserts SdrObject in the arrays of the layout ((SwPageFrame and SwFrame).
Definition: dcontact.cxx:1785
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect) override
Virtual methods of SdrObjUserCall.
Definition: dcontact.cxx:965
static SwVirtFlyDrawObj * CreateNewRef(SwFlyFrame *pFly, SwFlyFrameFormat *pFormat, SwFrame const &rAnchorFrame)
Definition: dcontact.cxx:524
const SwPageFrame * GetPageFrame() const
Definition: dcontact.hxx:359
void RemoveFromDrawingPage()
Definition: dcontact.cxx:2351
SwNodes & GetNodes()
Definition: doc.hxx:409
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object...
Definition: dcontact.hxx:212
bool IsRightToLeft() const
Definition: frame.hxx:988
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:165
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
Definition: dcontact.cxx:2486
void InvalidateObjRectWithSpaces() const
bool IsPageFrame() const
Definition: frame.hxx:1179
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:2457
void RemoveMasterFromDrawPage()
method to remove 'master' drawing object from drawing page.
Definition: dcontact.cxx:1715
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
std::vector< SwDrawVirtObjPtr > maDrawVirtObjs
container for 'virtual' drawing object supporting drawing objects in headers/footers.
Definition: dcontact.hxx:315
static void syncFlyFrameAttr(SwFrameFormat &rShape, SfxItemSet const &rSet, SdrObject *pObj)
Similar to syncProperty(), but used by the internal API (e.g. for UI purposes).
void Unchain()
Definition: fly.cxx:309
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:2421
virtual ViewContact & GetViewContact(sal_uInt32 nIndex) const
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs)
SdrObject * getParentSdrObjectFromSdrObject() const
void AppendDrawObj(SwAnchoredObject &_rNewObj)
Definition: fly.cxx:2238
virtual ::basegfx::B2DPolyPolygon TakeContour() const override
Definition: dcontact.cxx:2429
void RemoveFromWriterLayout()
Definition: dcontact.cxx:2286
SdrUserCallType meParentUserCallEventType
Definition: dcontact.cxx:1021
void setContextWritingMode(SdrObject *pObj, SwFrame const *pAnchor)
Definition: dcontact.cxx:102
ViewContact & GetViewContact() const
virtual void SetSnapRect(const tools::Rectangle &rRect)
bool IsVertical() const
Definition: frame.hxx:974
virtual void SetEnableSetModified(bool bEnableSetModified)=0
bool IsInDtor() const
Definition: doc.hxx:404
const SwFrame * GetAnchorFrame() const
Definition: dcontact.cxx:2274
SwModify * GetRegisteredInNonConst() const
Definition: calbck.hxx:147
#define SAL_WARN(area, stream)
virtual void NbcSetAnchorPos(const Point &rPnt)
bool IsNestedUserCall() const
Definition: dcontact.cxx:1048
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:2541
virtual const tools::Rectangle & GetLogicRect() const
NestedUserCallHdl(SwDrawContact *_pDrawContact, SdrUserCallType _eEventType)
Definition: dcontact.cxx:1024
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
Definition: pagechg.cxx:1892
virtual void NbcSetAnchorPos(const Point &rPnt) override
Definition: dcontact.cxx:2369
SwAnchoredDrawObject maAnchoredDrawObj
anchored drawing object instance for the 'master' drawing object
Definition: dcontact.hxx:312
bool mbDisconnectInProgress
internal flag to indicate that disconnect from layout is in progress
Definition: dcontact.hxx:323
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
Definition: dcontact.cxx:2463
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:628
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(123)
void EndAllAction(bool bVirDev=false)
Definition: pagechg.cxx:1904
WW8AnchorConv m_eHoriConv
Definition: frmfmt.hxx:309
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i) override
Definition: dcontact.cxx:2598
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2067
OBJ_TEXT
bool IsPositioningInProgress() const
is positioning of anchored object in progress
class for collecting anchored objects
Definition: sortedobjs.hxx:48
virtual void GetAnchoredObjs(std::vector< SwAnchoredObject * > &_roAnchoredObjs) const override
get data collection of anchored objects, handled by with contact
Definition: dcontact.cxx:2057
virtual Point GetPoint(sal_uInt32 i) const
SdrView * FirstView()
static SwTextFrame * lcl_GetFlyInContentAnchor(SwTextFrame *_pProposedAnchorFrame, SwPosition const &rAnchorPos)
Definition: dcontact.cxx:1770
SdrObjUserCall * GetUserCall() const
virtual Point GetPoint(sal_uInt32 i) const override
Definition: dcontact.cxx:2593
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1293
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
sal_uInt16 Which() const
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2773
SwAnchoredObject & AnchoredObj()
Definition: dcontact.hxx:248
bool IsCallbackActionEnabled() const
Definition: rootfrm.hxx:388
const basegfx::B2DRange & getObjectRange() const
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:718
static bool doTextBoxPositioning(SwFrameFormat *pShape, SdrObject *pObj)
Does the positioning for the associated textframe of the shape, and returns true on success...
static void lcl_textBoxSizeNotify(SwFrameFormat *pFormat)
Notify the format's textbox that it should reconsider its position / size.
Definition: dcontact.cxx:1086
bool IsConnected() const
is 'virtual' drawing object connected to writer layout and / to drawing layer.
Definition: dcontact.cxx:2361
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:194
virtual void NbcSetLayer(SdrLayerID nLayer)
SwPageFrame * FindPage(const SwRect &rRect)
Definition: dcontact.cxx:1991