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