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