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