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