LibreOffice Module sw (master) 1
fly.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 <config_wasm_strip.h>
21
22#include <svl/itemiter.hxx>
23#include <vcl/imap.hxx>
24#include <tools/helpers.hxx>
25#include <editeng/protitem.hxx>
26#include <editeng/opaqitem.hxx>
27#include <editeng/ulspitem.hxx>
29#include <fmtfsize.hxx>
30#include <fmtclds.hxx>
31#include <fmtcntnt.hxx>
32#include <fmturl.hxx>
33#include <fmtsrnd.hxx>
34#include <fmtornt.hxx>
35#include <fmtcnct.hxx>
36#include <ndgrf.hxx>
38#include <fmtfollowtextflow.hxx>
39#include <sortedobjs.hxx>
40#include <objectformatter.hxx>
41#include <ndole.hxx>
42#include <swtable.hxx>
43#include <svx/svdoashp.hxx>
44#include <svx/svdpage.hxx>
45#include <layouter.hxx>
46#include <pagefrm.hxx>
47#include <rootfrm.hxx>
48#include <viewimp.hxx>
49#include <viewopt.hxx>
50#include <dcontact.hxx>
51#include <dflyobj.hxx>
52#include <dview.hxx>
53#include <frmatr.hxx>
54#include <frmtool.hxx>
55#include <hints.hxx>
56#include <tabfrm.hxx>
57#include <txtfrm.hxx>
58#include <notxtfrm.hxx>
59#include <flyfrms.hxx>
60#include <sectfrm.hxx>
61#include <vcl/svapp.hxx>
62#include <calbck.hxx>
66#include <textboxhelper.hxx>
67#include <txtfly.hxx>
68#include <ndindex.hxx>
70#include <osl/diagnose.h>
71
72#include <wrtsh.hxx>
73#include <view.hxx>
74#include <edtwin.hxx>
75#include <bodyfrm.hxx>
77#include <ndtxt.hxx>
78#include <formatflysplit.hxx>
79
80using namespace ::com::sun::star;
81
82namespace
83{
85SwTwips GetFlyAnchorBottom(SwFlyFrame* pFly, const SwFrame& rAnchor)
86{
87 SwRectFnSet aRectFnSet(pFly);
88
90 bool bLegacy = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN);
91 if (bLegacy)
92 {
93 // Word <= 2010 style: the fly can overlap with the bottom margin / footer area in case the
94 // fly height fits the body height and the fly bottom fits the page.
95 const SwPageFrame* pPage = rAnchor.FindPageFrame();
96 if (!pPage)
97 {
98 return 0;
99 }
100
101 const SwFrame* pBody = pPage->FindBodyCont();
102 if (!pBody)
103 {
104 return 0;
105 }
106
107 // See if the fly height would fit at least the page height, ignoring the vertical offset.
108 SwTwips nFlyHeight = aRectFnSet.GetHeight(pFly->getFrameArea());
109 SwTwips nPageHeight = aRectFnSet.GetHeight(pPage->getFramePrintArea());
110 if (nFlyHeight <= nPageHeight)
111 {
112 // Yes, it would fit: allow overlap if there is no problematic vertical offset.
113 SwTwips nDeadline = aRectFnSet.GetBottom(pPage->getFrameArea());
114 SwTwips nFlyTop = aRectFnSet.GetTop(pFly->getFrameArea());
115 SwTwips nBodyHeight = aRectFnSet.GetHeight(pBody->getFramePrintArea());
116 if (nDeadline - nFlyTop > nBodyHeight)
117 {
118 // If the fly would now grow to nDeadline then it would not fit the body height, so
119 // limit the height.
120 nDeadline = nFlyTop + nBodyHeight;
121 }
122 return nDeadline;
123 }
124 }
125
126 // Word >= 2013 style: the fly has to stay inside the body frame.
127 const SwFrame* pAnchorUpper = rAnchor.GetUpper();
128 if (!pAnchorUpper)
129 {
130 return 0;
131 }
132
133 return aRectFnSet.GetPrtBottom(*pAnchorUpper);
134}
135}
136
137static SwTwips lcl_CalcAutoWidth( const SwLayoutFrame& rFrame );
138
139SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch, bool bFollow ) :
140 SwLayoutFrame( pFormat, pSib ),
141 // #i26791#
142 m_pPrevLink( nullptr ),
143 m_pNextLink( nullptr ),
144 m_bInCnt( false ),
145 m_bAtCnt( false ),
146 m_bLayout( false ),
147 m_bAutoPosition( false ),
148 m_bDeleted( false ),
149 m_nAuthor( std::string::npos ),
150 m_bValidContentPos( false )
151{
153
154 m_bInvalid = m_bNotifyBack = true;
157
158 // Size setting: Fixed size is always the width
159 const SwFormatFrameSize &rFrameSize = pFormat->GetFrameSize();
160 const SvxFrameDirection nDir = pFormat->GetFormatAttr( RES_FRAMEDIR ).GetValue();
161 if( SvxFrameDirection::Environment == nDir )
162 {
163 mbDerivedVert = true;
164 mbDerivedR2L = true;
165 }
166 else
167 {
168 mbInvalidVert = false;
169 mbDerivedVert = false;
170 mbDerivedR2L = false;
171 if( SvxFrameDirection::Horizontal_LR_TB == nDir || SvxFrameDirection::Horizontal_RL_TB == nDir )
172 {
173 mbVertLR = false;
174 mbVertical = false;
175 }
176 else
177 {
178 const SwViewShell *pSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr;
179 if( pSh && pSh->GetViewOptions()->getBrowseMode() )
180 {
181 mbVertLR = false;
182 mbVertical = false;
183 }
184 else
185 {
186 mbVertical = true;
187
188 if ( SvxFrameDirection::Vertical_LR_TB == nDir )
189 mbVertLR = true;
190 else if (nDir == SvxFrameDirection::Vertical_LR_BT)
191 {
192 mbVertLR = true;
193 mbVertLRBT = true;
194 }
195 else
196 mbVertLR = false;
197 }
198 }
199
200 mbInvalidR2L = false;
201 if( SvxFrameDirection::Horizontal_RL_TB == nDir )
202 mbRightToLeft = true;
203 else
204 mbRightToLeft = false;
205 }
206
207 {
209 aFrm.Width( rFrameSize.GetWidth() );
210 aFrm.Height( rFrameSize.GetHeightSizeType() == SwFrameSize::Variable ? MINFLY : rFrameSize.GetHeight() );
211 }
212
213 // Fixed or variable Height?
214 if ( rFrameSize.GetHeightSizeType() == SwFrameSize::Minimum )
215 m_bMinHeight = true;
216 else if ( rFrameSize.GetHeightSizeType() == SwFrameSize::Fixed )
217 mbFixSize = true;
218
219 // insert columns, if necessary
221
222 // First the Init, then the Content:
223 // This is due to the fact that the Content may have Objects/Frames,
224 // which are then registered
225 InitDrawObj(*pAnch);
226
227 Chain( pAnch );
228
229 if (!bFollow)
230 {
231 InsertCnt();
232 }
233
234 // Put it somewhere outside so that out document is not formatted unnecessarily often
236 aFrm.Pos().setX(FAR_AWAY);
237 aFrm.Pos().setY(FAR_AWAY);
238}
239
241{
242 // Connect to chain neighbours.
243 // No problem, if a neighbor doesn't exist - the construction of the
244 // neighbor will make the connection
245 const SwFormatChain& rChain = GetFormat()->GetChain();
246 if ( !(rChain.GetPrev() || rChain.GetNext()) )
247 return;
248
249 if ( rChain.GetNext() )
250 {
251 SwFlyFrame* pFollow = FindChainNeighbour( *rChain.GetNext(), _pAnch );
252 if ( pFollow )
253 {
254 OSL_ENSURE( !pFollow->GetPrevLink(), "wrong chain detected" );
255 if ( !pFollow->GetPrevLink() )
256 SwFlyFrame::ChainFrames( this, pFollow );
257 }
258 }
259 if ( rChain.GetPrev() )
260 {
261 SwFlyFrame *pMaster = FindChainNeighbour( *rChain.GetPrev(), _pAnch );
262 if ( pMaster )
263 {
264 OSL_ENSURE( !pMaster->GetNextLink(), "wrong chain detected" );
265 if ( !pMaster->GetNextLink() )
266 SwFlyFrame::ChainFrames( pMaster, this );
267 }
268 }
269}
270
272{
273 if ( GetPrevLink() )
274 return;
275
276 const SwFormatContent& rContent = GetFormat()->GetContent();
277 OSL_ENSURE( rContent.GetContentIdx(), ":-( no content prepared." );
279 // Lower() means SwColumnFrame; the Content then needs to be inserted into the (Column)BodyFrame
280 ::InsertCnt_( Lower() ? static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(Lower())->Lower()) : static_cast<SwLayoutFrame*>(this),
281 GetFormat()->GetDoc(), nIndex );
282
283 // NoText always have a fixed height.
284 if ( Lower() && Lower()->IsNoTextFrame() )
285 {
286 mbFixSize = true;
287 m_bMinHeight = false;
288 }
289}
290
292{
293 // #i97379#
294 // Check, if column are allowed.
295 // Columns are not allowed for fly frames, which represent graphics or embedded objects.
296 const SwFormatContent& rContent = GetFormat()->GetContent();
297 OSL_ENSURE( rContent.GetContentIdx(), "<SwFlyFrame::InsertColumns()> - no content prepared." );
298 SwNodeIndex aFirstContent( *(rContent.GetContentIdx()), 1 );
299 if ( aFirstContent.GetNode().IsNoTextNode() )
300 {
301 return;
302 }
303
304 const SwFormatCol &rCol = GetFormat()->GetCol();
305 if ( rCol.GetNumCols() <= 1 )
306 return;
307
308 // Start off PrtArea to be as large as Frame, so that we can put in the columns
309 // properly. It'll adjust later on.
310 {
312 aPrt.Width( getFrameArea().Width() );
313 aPrt.Height( getFrameArea().Height() );
314 }
315
316 const SwFormatCol aOld; // ChgColumns() also needs an old value passed
317 ChgColumns( aOld, rCol );
318}
319
321{
322 // Accessible objects for fly frames will be destroyed in this destructor.
323 // For frames bound as char or frames that don't have an anchor we have
324 // to do that ourselves. For any other frame the call RemoveFly at the
325 // anchor will do that.
326#if !ENABLE_WASM_STRIP_ACCESSIBILITY
328 {
329 SwRootFrame *pRootFrame = getRootFrame();
330 if( pRootFrame && pRootFrame->IsAnyShellAccessible() )
331 {
332 SwViewShell *pVSh = pRootFrame->GetCurrShell();
333 if( pVSh && pVSh->Imp() )
334 {
335 // Lowers aren't disposed already, so we have to do a recursive
336 // dispose
337 pVSh->Imp()->DisposeAccessibleFrame( this, true );
338 }
339 }
340 }
341#endif
342
343 if( GetFormat() && !GetFormat()->GetDoc()->IsInDtor() )
344 {
345 ClearTmpConsiderWrapInfluence(); // remove this from SwLayouter
346
347 Unchain();
348
349 DeleteCnt();
350
351 if ( GetAnchorFrame() )
352 AnchorFrame()->RemoveFly( this );
353 }
354
355 FinitDrawObj();
356
358
359 SwWrtShell* pWrtSh = dynamic_cast<SwWrtShell*>(getRootFrame()->GetCurrShell());
360 UpdateUnfloatButton(pWrtSh, false);
361}
362
364{
365}
366
368{
370}
371
373{
374 if ( GetPrevLink() )
375 UnchainFrames( GetPrevLink(), this );
376 if ( GetNextLink() )
377 UnchainFrames( this, GetNextLink() );
378}
379
381{
382 SwFrame* pFrame = m_pLower;
383 while ( pFrame )
384 {
385 while ( pFrame->GetDrawObjs() && pFrame->GetDrawObjs()->size() )
386 {
387 SwAnchoredObject *pAnchoredObj = (*pFrame->GetDrawObjs())[0];
388 if ( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() )
389 {
390 SwFrame::DestroyFrame(pFlyFrame);
391 }
392 else if ( dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) != nullptr )
393 {
394 // consider 'virtual' drawing objects
395 SdrObject* pObj = pAnchoredObj->DrawObj();
396 if ( auto pDrawVirtObj = dynamic_cast<SwDrawVirtObj*>( pObj) )
397 {
398 pDrawVirtObj->RemoveFromWriterLayout();
399 pDrawVirtObj->RemoveFromDrawingPage();
400 }
401 else
402 {
403 SwDrawContact* pContact =
404 static_cast<SwDrawContact*>(::GetUserCall( pObj ));
405 if ( pContact )
406 {
407 pContact->DisconnectFromLayout();
408 }
409 }
410 }
411 }
412
413 pFrame->RemoveFromLayout();
414 SwFrame::DestroyFrame(pFrame);
415 pFrame = m_pLower;
416 }
417
419}
420
421void SwFlyFrame::InitDrawObj(SwFrame const& rAnchorFrame)
422{
423 SetDrawObj(*SwFlyDrawContact::CreateNewRef(this, GetFormat(), rAnchorFrame));
424
425 // Set the right Layer
427 SdrLayerID nHeavenId = rIDDMA.GetHeavenId();
428 SdrLayerID nHellId = rIDDMA.GetHellId();
429 GetVirtDrawObj()->SetLayer( GetFormat()->GetOpaque().GetValue()
430 ? nHeavenId
431 : nHellId );
432}
433
435{
436 SwFormatAnchor const& rAnch(rFlyFrame.GetAnchor());
437 if (rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
438 { // arbitrarily pick last node
439 return SwPosition(rFlyFrame.GetDoc()->GetNodes().GetEndOfContent(), SwNodeOffset(-1));
440 }
441 else
442 {
443 SwPosition const*const pPos(rAnch.GetContentAnchor());
444 assert(pPos);
445 if (SwFrameFormat const*const pParent = pPos->GetNode().GetFlyFormat())
446 {
447 return ResolveFlyAnchor(*pParent);
448 }
449 else if (pPos->GetContentNode())
450 {
451 return *pPos;
452 }
453 else
454 {
455 return SwPosition(*pPos->GetNode().GetContentNode(), 0);
456 }
457 }
458}
459
461{
462 if(!GetVirtDrawObj() )
463 return;
464 SwFormat* pFormat = GetFormat();
465 // Deregister from SdrPageViews if the Objects is still selected there.
466 if(!pFormat->GetDoc()->IsInDtor())
467 {
469 if(p1St)
470 {
471 for(SwViewShell& rCurrentShell : p1St->GetRingContainer())
472 { // At the moment the Drawing can do just do an Unmark on everything,
473 // as the Object was already removed
474 if (rCurrentShell.HasDrawView() &&
475 rCurrentShell.Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount())
476 {
477 SwFlyFrame const*const pOldSelFly = ::GetFlyFromMarked(nullptr, &rCurrentShell);
478 if (pOldSelFly == this)
479 {
480 assert(rCurrentShell.Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1);
481 if (SwFEShell *const pFEShell = dynamic_cast<SwFEShell*>(&rCurrentShell))
482 { // tdf#131679 move any cursor out of fly
483 rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
484 if (pOldSelFly)
485 {
486 SwPaM const temp(ResolveFlyAnchor(*pOldSelFly->GetFormat()));
487 pFEShell->SetSelection(temp);
488 // could also call SetCursor() like SwFEShell::SelectObj()
489 // does, but that would access layout a bit much...
490 }
491 }
492 else
493 {
494 rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
495 }
496 }
497 }
498 }
499 }
500 }
501
502 SwVirtFlyDrawObj* pVirtDrawObj = GetVirtDrawObj();
503 // Else calls delete of the ContactObj
504 pVirtDrawObj->SetUserCall(nullptr);
505
506 if ( pVirtDrawObj->getSdrPageFromSdrObject() )
507 pVirtDrawObj->getSdrPageFromSdrObject()->RemoveObject( pVirtDrawObj->GetOrdNum() );
508 ClearDrawObj();
509}
510
512{
513 OSL_ENSURE( pMaster && pFollow, "incomplete chain" );
514 OSL_ENSURE( !pMaster->GetNextLink(), "link can not be changed" );
515 OSL_ENSURE( !pFollow->GetPrevLink(), "link can not be changed" );
516
517 pMaster->m_pNextLink = pFollow;
518 pFollow->m_pPrevLink = pMaster;
519
520 if ( pMaster->ContainsContent() )
521 {
522 // To get a text flow we need to invalidate
523 SwFrame *pInva = pMaster->FindLastLower();
524 SwRectFnSet aRectFnSet(pMaster);
525 const tools::Long nBottom = aRectFnSet.GetPrtBottom(*pMaster);
526 while ( pInva )
527 {
528 if( aRectFnSet.BottomDist( pInva->getFrameArea(), nBottom ) <= 0 )
529 {
530 pInva->InvalidateSize();
531 pInva->Prepare();
532 pInva = pInva->FindPrev();
533 }
534 else
535 pInva = nullptr;
536 }
537 }
538
539 if ( pFollow->ContainsContent() )
540 {
541 // There's only the content from the Masters left; the content from the Follow
542 // does not have any Frames left (should always be exactly one empty TextNode).
543 SwFrame *pFrame = pFollow->ContainsContent();
544 OSL_ENSURE( !pFrame->IsTabFrame() && !pFrame->FindNext(), "follow in chain contains content" );
545 pFrame->Cut();
546 SwFrame::DestroyFrame(pFrame);
547 }
548
549 // invalidate accessible relation set (accessibility wrapper)
550#if !ENABLE_WASM_STRIP_ACCESSIBILITY
551 SwViewShell* pSh = pMaster->getRootFrame()->GetCurrShell();
552 if( pSh )
553 {
554 SwRootFrame* pLayout = pMaster->getRootFrame();
555 if( pLayout && pLayout->IsAnyShellAccessible() )
556 pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow );
557 }
558#endif
559}
560
562{
563 pMaster->m_pNextLink = nullptr;
564 pFollow->m_pPrevLink = nullptr;
565
566 if ( pFollow->ContainsContent() )
567 {
568 // The Master sucks up the content of the Follow
569 SwLayoutFrame *pUpper = pMaster;
570 if ( pUpper->Lower()->IsColumnFrame() )
571 {
572 pUpper = static_cast<SwLayoutFrame*>(pUpper->GetLastLower());
573 pUpper = static_cast<SwLayoutFrame*>(pUpper->Lower()); // The (Column)BodyFrame
574 OSL_ENSURE( pUpper && pUpper->IsColBodyFrame(), "Missing ColumnBody" );
575 }
576 SwFlyFrame *pFoll = pFollow;
577 while ( pFoll )
578 {
579 SwFrame *pTmp = ::SaveContent( pFoll );
580 if ( pTmp )
581 ::RestoreContent( pTmp, pUpper, pMaster->FindLastLower() );
582 pFoll->SetCompletePaint();
583 pFoll->InvalidateSize();
584 pFoll = pFoll->GetNextLink();
585 }
586 }
587
588 // The Follow needs his own content to be served
589 const SwFormatContent &rContent = pFollow->GetFormat()->GetContent();
590 OSL_ENSURE( rContent.GetContentIdx(), ":-( No content prepared." );
592 // Lower() means SwColumnFrame: this one contains another SwBodyFrame
593 ::InsertCnt_( pFollow->Lower() ? const_cast<SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(pFollow->Lower())->Lower()))
594 : static_cast<SwLayoutFrame*>(pFollow),
595 pFollow->GetFormat()->GetDoc(), ++nIndex );
596
597 // invalidate accessible relation set (accessibility wrapper)
598#if !ENABLE_WASM_STRIP_ACCESSIBILITY
599 SwViewShell* pSh = pMaster->getRootFrame()->GetCurrShell();
600 if( pSh )
601 {
602 SwRootFrame* pLayout = pMaster->getRootFrame();
603 if( pLayout && pLayout->IsAnyShellAccessible() )
604 pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow );
605 }
606#endif
607}
608
610{
611 // We look for the Fly that's in the same Area.
612 // Areas can for now only be Head/Footer or Flys.
613
614 if ( !pAnch ) // If an Anchor was passed along, that one counts (ctor!)
615 pAnch = AnchorFrame();
616
617 SwLayoutFrame *pLay;
618 if ( pAnch->IsInFly() )
619 pLay = pAnch->FindFlyFrame();
620 else
621 {
622 // FindFooterOrHeader is not appropriate here, as we may not have a
623 // connection to the Anchor yet.
624 pLay = pAnch->GetUpper();
625 while ( pLay && !(pLay->GetType() & (SwFrameType::Header|SwFrameType::Footer)) )
626 pLay = pLay->GetUpper();
627 }
628
629 SwIterator<SwFlyFrame,SwFormat> aIter( rChain );
630 SwFlyFrame *pFly = aIter.First();
631 if ( pLay )
632 {
633 while ( pFly )
634 {
635 if ( pFly->GetAnchorFrame() )
636 {
637 if ( pFly->GetAnchorFrame()->IsInFly() )
638 {
639 if ( pFly->AnchorFrame()->FindFlyFrame() == pLay )
640 break;
641 }
642 else if ( pLay == pFly->FindFooterOrHeader() )
643 break;
644 }
645 pFly = aIter.Next();
646 }
647 }
648 else if ( pFly )
649 {
650 OSL_ENSURE( !aIter.Next(), "chain with more than one instance" );
651 }
652 return pFly;
653}
654
656{
657 if (!IsFlyAtContentFrame())
658 {
659 return false;
660 }
661
662 return GetFormat()->GetFlySplit().GetValue();
663}
664
666{
667 SwFrame *pRet = ContainsAny();
668 if ( pRet && pRet->IsInTab() )
669 pRet = pRet->FindTabFrame();
670 SwFrame *pNxt = pRet;
671 while ( pNxt && IsAnLower( pNxt ) )
672 { pRet = pNxt;
673 pNxt = pNxt->FindNext();
674 }
675 return pRet;
676}
677
679{
680 bool bRet = false;
681 SwTwips nDiffHeight = getFrameArea().Height();
682 if ( rFrameSize.GetHeightSizeType() == SwFrameSize::Variable )
683 mbFixSize = m_bMinHeight = false;
684 else
685 {
686 if ( rFrameSize.GetHeightSizeType() == SwFrameSize::Fixed )
687 {
688 mbFixSize = true;
689 m_bMinHeight = false;
690 }
691 else if ( rFrameSize.GetHeightSizeType() == SwFrameSize::Minimum )
692 {
693 mbFixSize = false;
694 m_bMinHeight = true;
695 }
696 nDiffHeight -= rFrameSize.GetHeight();
697 }
698 // If the Fly contains columns, we already need to set the Fly
699 // and the Columns to the required value or else we run into problems.
700 if ( Lower() )
701 {
702 if ( Lower()->IsColumnFrame() )
703 {
704 const SwRect aOld( GetObjRectWithSpaces() );
705 const Size aOldSz( getFramePrintArea().SSize() );
706 const SwTwips nDiffWidth = getFrameArea().Width() - rFrameSize.GetWidth();
707
708 {
710 aFrm.Height( aFrm.Height() - nDiffHeight );
711 aFrm.Width ( aFrm.Width() - nDiffWidth );
712 }
713
714 // #i68520#
716
717 {
719 aPrt.Height( aPrt.Height() - nDiffHeight );
720 aPrt.Width ( aPrt.Width() - nDiffWidth );
721 }
722
723 ChgLowersProp( aOldSz );
724 ::Notify( this, FindPageFrame(), aOld );
726 bRet = true;
727 }
728 else if ( Lower()->IsNoTextFrame() )
729 {
730 mbFixSize = true;
731 m_bMinHeight = false;
732 }
733 }
734 return bRet;
735}
736
737void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
738{
739 if (rHint.GetId() == SfxHintId::SwLegacyModify)
740 {
741 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
743 if(pLegacy->m_pNew && pLegacy->m_pOld && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
744 {
745 SfxItemIter aNIter(*static_cast<const SwAttrSetChg*>(pLegacy->m_pNew)->GetChgSet());
746 SfxItemIter aOIter(*static_cast<const SwAttrSetChg*>(pLegacy->m_pOld)->GetChgSet());
747 const SfxPoolItem* pNItem = aNIter.GetCurItem();
748 const SfxPoolItem* pOItem = aOIter.GetCurItem();
749 SwAttrSetChg aOldSet(*static_cast<const SwAttrSetChg*>(pLegacy->m_pOld));
750 SwAttrSetChg aNewSet(*static_cast<const SwAttrSetChg*>(pLegacy->m_pNew));
751 do
752 {
753 UpdateAttr_(pOItem, pNItem, eInvFlags, &aOldSet, &aNewSet);
754 pNItem = aNIter.NextItem();
755 pOItem = aOIter.NextItem();
756 } while(pNItem);
757 if(aOldSet.Count() || aNewSet.Count())
758 SwLayoutFrame::SwClientNotify(rMod, sw::LegacyModifyHint(&aOldSet, &aNewSet));
759 }
760 else
761 UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, eInvFlags);
762
763 if(eInvFlags == SwFlyFrameInvFlags::NONE)
764 return;
765
766 Invalidate_();
768 {
770 // #i68520#
772 }
774 {
776 // #i68520#
778 }
787 SwRootFrame *pRoot;
788 if(eInvFlags & SwFlyFrameInvFlags::InvalidateBrowseWidth && nullptr != (pRoot = getRootFrame()))
789 pRoot->InvalidateBrowseWidth();
790 // #i28701#
792 {
793 // update sorted object lists, the Writer fly frame is registered at.
795 }
796
797 // #i87645# - reset flags for the layout process (only if something has been invalidated)
799 }
800 else if (rHint.GetId() == SfxHintId::SwGetZOrder)
801 {
802 auto pGetZOrdnerHint = static_cast<const sw::GetZOrderHint*>(&rHint);
803 const auto& rFormat(dynamic_cast<const SwFrameFormat&>(rMod));
804 if (rFormat.Which() == RES_FLYFRMFMT && rFormat.getIDocumentLayoutAccess().GetCurrentViewShell()) // #i11176#
805 pGetZOrdnerHint->m_rnZOrder = GetVirtDrawObj()->GetOrdNum();
806 }
807 else if (rHint.GetId() == SfxHintId::SwGetObjectConnected)
808 {
809 auto pConnectedHint = static_cast<const sw::GetObjectConnectedHint*>(&rHint);
810 const auto& rFormat(dynamic_cast<const SwFrameFormat&>(rMod));
811 if (!pConnectedHint->m_risConnected && rFormat.Which() == RES_FLYFRMFMT && (!pConnectedHint->m_pRoot || pConnectedHint->m_pRoot == getRootFrame()))
812 pConnectedHint->m_risConnected = true;
813 }
814}
815
816void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
817 SwFlyFrameInvFlags &rInvFlags,
818 SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
819{
820 bool bClear = true;
821 const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
823 switch( nWhich )
824 {
825 case RES_VERT_ORIENT:
826 case RES_HORI_ORIENT:
827 // #i18732# - consider new option 'follow text flow'
829 {
830 // ATTENTION: Always also change Action in ChgRePos()!
832 }
833 break;
834 // #i28701# - consider new option 'wrap influence on position'
836 {
839 }
840 break;
841 case RES_SURROUND:
842 {
843 //#i28701# - invalidate position on change of
844 // wrapping style.
846 // The background needs to be messaged and invalidated
847 const SwRect aTmp( GetObjRectWithSpaces() );
849
850 // By changing the flow of frame-bound Frames, a vertical alignment
851 // can be activated/deactivated => MakeFlyPos
852 if( RndStdIds::FLY_AT_FLY == GetFormat()->GetAnchor().GetAnchorId() )
854
855 // Delete contour in the Node if necessary
856 if ( Lower() && Lower()->IsNoTextFrame() &&
857 !GetFormat()->GetSurround().IsContour() )
858 {
859 SwNoTextNode *pNd = static_cast<SwNoTextNode*>(static_cast<SwNoTextFrame*>(Lower())->GetNode());
860 if ( pNd->HasContour() )
861 pNd->SetContour( nullptr );
862 }
863 // #i28701# - perform reorder of object lists
864 // at anchor frame and at page frame.
866 }
867 break;
868
869 case RES_PROTECT:
870 if (pNew)
871 {
872 const SvxProtectItem *pP = static_cast<const SvxProtectItem*>(pNew);
875#if !ENABLE_WASM_STRIP_ACCESSIBILITY
876 if( pSh )
877 {
878 SwRootFrame* pLayout = getRootFrame();
879 if( pLayout && pLayout->IsAnyShellAccessible() )
880 pSh->Imp()->InvalidateAccessibleEditableState( true, this );
881 }
882#endif
883 }
884 break;
885 case RES_COL:
886 if (pOld && pNew)
887 {
888 ChgColumns( *static_cast<const SwFormatCol*>(pOld), *static_cast<const SwFormatCol*>(pNew) );
889 const SwFormatFrameSize &rNew = GetFormat()->GetFrameSize();
890 if ( FrameSizeChg( rNew ) )
894 }
895 break;
896
897 case RES_FRM_SIZE:
898 case RES_FMT_CHG:
899 case RES_FLY_SPLIT:
900 {
901 const SwFormatFrameSize &rNew = GetFormat()->GetFrameSize();
902 if ( FrameSizeChg( rNew ) )
909 if (pOld && RES_FMT_CHG == nWhich)
910 {
912 SwRect aOld( getFrameArea() );
913 const SvxULSpaceItem &rUL = static_cast<const SwFormatChg*>(pOld)->pChangedFormat->GetULSpace();
914 aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) ) );
915 aOld.AddHeight(rUL.GetLower() );
916 const SvxLRSpaceItem &rLR = static_cast<const SwFormatChg*>(pOld)->pChangedFormat->GetLRSpace();
917 aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) );
918 aOld.AddWidth(rLR.GetRight() );
919 aNew.Union( aOld );
921
922 // Special case:
923 // When assigning a template we cannot rely on the old column
924 // attribute. As there need to be at least enough for ChgColumns,
925 // we need to create a temporary attribute.
926 SwFormatCol aCol;
927 if ( Lower() && Lower()->IsColumnFrame() )
928 {
929 sal_uInt16 nCol = 0;
930 SwFrame *pTmp = Lower();
931 do
932 { ++nCol;
933 pTmp = pTmp->GetNext();
934 } while ( pTmp );
935 aCol.Init( nCol, 0, 1000 );
936 }
937 ChgColumns( aCol, GetFormat()->GetCol() );
938 }
939
941
942 SwFormatFrameSize *pNewFormatFrameSize = nullptr;
943 SwFormatChg *pOldFormatChg = nullptr;
944 if (nWhich == RES_FRM_SIZE)
945 pNewFormatFrameSize = const_cast<SwFormatFrameSize*>(static_cast<const SwFormatFrameSize*>(pNew));
946 else if (nWhich == RES_FMT_CHG)
947 pOldFormatChg = const_cast<SwFormatChg*>(static_cast<const SwFormatChg*>(pOld));
948
949 if (aURL.GetMap() && (pNewFormatFrameSize || pOldFormatChg))
950 {
951 const SwFormatFrameSize &rOld = pNewFormatFrameSize ?
952 *pNewFormatFrameSize :
953 pOldFormatChg->pChangedFormat->GetFrameSize();
954 //#35091# Can be "times zero", when loading the template
955 if ( rOld.GetWidth() && rOld.GetHeight() )
956 {
957
958 Fraction aScaleX( rOld.GetWidth(), rNew.GetWidth() );
959 Fraction aScaleY( rOld.GetHeight(), rOld.GetHeight() );
960 aURL.GetMap()->Scale( aScaleX, aScaleY );
961 SwFrameFormat *pFormat = GetFormat();
962 pFormat->LockModify();
963 pFormat->SetFormatAttr( aURL );
964 pFormat->UnlockModify();
965 }
966 }
967 const SvxProtectItem &rP = GetFormat()->GetProtect();
970
971 if ( pSh )
974 const SdrLayerID nId = GetFormat()->GetOpaque().GetValue() ?
975 rIDDMA.GetHeavenId() :
976 rIDDMA.GetHellId();
978
979 if ( Lower() )
980 {
981 // Delete contour in the Node if necessary
982 if( Lower()->IsNoTextFrame() &&
983 !GetFormat()->GetSurround().IsContour() )
984 {
985 SwNoTextNode *pNd = static_cast<SwNoTextNode*>(static_cast<SwNoTextFrame*>(Lower())->GetNode());
986 if ( pNd->HasContour() )
987 pNd->SetContour( nullptr );
988 }
989 else if( !Lower()->IsColumnFrame() )
990 {
991 SwFrame* pFrame = GetLastLower();
992 if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() )
994 }
995 }
996
997 // #i28701# - perform reorder of object lists
998 // at anchor frame and at page frame.
1000
1001 break;
1002 }
1003 case RES_UL_SPACE:
1004 case RES_LR_SPACE:
1005 {
1007 if( pSh && pSh->GetViewOptions()->getBrowseMode() )
1009 SwRect aNew( GetObjRectWithSpaces() );
1010 SwRect aOld( getFrameArea() );
1011 if (pNew)
1012 {
1013 if ( RES_UL_SPACE == nWhich )
1014 {
1015 const SvxULSpaceItem &rUL = *static_cast<const SvxULSpaceItem*>(pNew);
1016 aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) ) );
1017 aOld.AddHeight(rUL.GetLower() );
1018 }
1019 else
1020 {
1021 const SvxLRSpaceItem &rLR = *static_cast<const SvxLRSpaceItem*>(pNew);
1022 aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) );
1023 aOld.AddWidth(rLR.GetRight() );
1024 }
1025 }
1026 aNew.Union( aOld );
1028 }
1029 break;
1030
1032 {
1035 }
1036 break;
1037
1038 case RES_BOX:
1039 case RES_SHADOW:
1042 break;
1043
1044 case RES_FRAMEDIR :
1045 SetDerivedVert( false );
1046 SetDerivedR2L( false );
1048 break;
1049
1050 case RES_OPAQUE:
1051 if (pNew)
1052 {
1053 if ( pSh )
1055
1057 const SdrLayerID nId = static_cast<const SvxOpaqueItem*>(pNew)->GetValue() ?
1058 rIDDMA.GetHeavenId() :
1059 rIDDMA.GetHellId();
1061#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1062 if( pSh )
1063 {
1064 SwRootFrame* pLayout = getRootFrame();
1065 if( pLayout && pLayout->IsAnyShellAccessible() )
1066 {
1067 pSh->Imp()->DisposeAccessibleFrame( this );
1068 pSh->Imp()->AddAccessibleFrame( this );
1069 }
1070 }
1071#endif
1072 // #i28701# - perform reorder of object lists
1073 // at anchor frame and at page frame.
1075 }
1076 break;
1077
1078 case RES_URL:
1079 // The interface changes the frame size when interacting with text frames,
1080 // the Map, however, needs to be relative to FrameSize().
1081 if ( (!Lower() || !Lower()->IsNoTextFrame()) && pNew && pOld &&
1082 static_cast<const SwFormatURL*>(pNew)->GetMap() && static_cast<const SwFormatURL*>(pOld)->GetMap() )
1083 {
1084 const SwFormatFrameSize &rSz = GetFormat()->GetFrameSize();
1085 if ( rSz.GetHeight() != getFrameArea().Height() ||
1086 rSz.GetWidth() != getFrameArea().Width() )
1087 {
1089 Fraction aScaleX( getFrameArea().Width(), rSz.GetWidth() );
1090 Fraction aScaleY( getFrameArea().Height(), rSz.GetHeight() );
1091 aURL.GetMap()->Scale( aScaleX, aScaleY );
1092 SwFrameFormat *pFormat = GetFormat();
1093 pFormat->LockModify();
1094 pFormat->SetFormatAttr( aURL );
1095 pFormat->UnlockModify();
1096 }
1097 }
1098 // No invalidation necessary
1099 break;
1100
1101 case RES_CHAIN:
1102 if (pNew)
1103 {
1104 const SwFormatChain *pChain = static_cast<const SwFormatChain*>(pNew);
1105 if ( pChain->GetNext() )
1106 {
1107 SwFlyFrame *pFollow = FindChainNeighbour( *pChain->GetNext() );
1108 if ( GetNextLink() && pFollow != GetNextLink() )
1110 if ( pFollow )
1111 {
1112 if ( pFollow->GetPrevLink() &&
1113 pFollow->GetPrevLink() != this )
1115 pFollow );
1116 if ( !GetNextLink() )
1117 SwFlyFrame::ChainFrames( this, pFollow );
1118 }
1119 }
1120 else if ( GetNextLink() )
1122 if ( pChain->GetPrev() )
1123 {
1124 SwFlyFrame *pMaster = FindChainNeighbour( *pChain->GetPrev() );
1125 if ( GetPrevLink() && pMaster != GetPrevLink() )
1127 if ( pMaster )
1128 {
1129 if ( pMaster->GetNextLink() &&
1130 pMaster->GetNextLink() != this )
1132 pMaster->GetNextLink() );
1133 if ( !GetPrevLink() )
1134 SwFlyFrame::ChainFrames( pMaster, this );
1135 }
1136 }
1137 else if ( GetPrevLink() )
1139 }
1140 [[fallthrough]];
1141 default:
1142 bClear = false;
1143 }
1144 if ( !bClear )
1145 return;
1146
1147 if ( pOldSet || pNewSet )
1148 {
1149 if ( pOldSet )
1150 pOldSet->ClearItem( nWhich );
1151 if ( pNewSet )
1152 pNewSet->ClearItem( nWhich );
1153 }
1154 else
1155 {
1156 SwModify aMod;
1158 }
1159}
1160
1163{
1164 if( RES_AUTOFMT_DOCNODE == rInfo.Which() )
1165 return false; // There's a FlyFrame, so use it
1166 return true; // Continue searching
1167}
1168
1170{
1171 InvalidatePage( pPage );
1172 m_bNotifyBack = m_bInvalid = true;
1173
1174 SwFlyFrame *pFrame;
1175 if ( GetAnchorFrame() && nullptr != (pFrame = AnchorFrame()->FindFlyFrame()) )
1176 {
1177 // Very bad case: If the Fly is bound within another Fly which
1178 // contains columns, the Format should be from that one.
1179 if ( !pFrame->IsLocked() && !pFrame->IsColLocked() &&
1180 pFrame->Lower() && pFrame->Lower()->IsColumnFrame() )
1181 pFrame->InvalidateSize();
1182 }
1183
1184 // #i85216#
1185 // if vertical position is oriented at a layout frame inside a ghost section,
1186 // assure that the position is invalidated and that the information about
1187 // the vertical position oriented frame is cleared
1189 {
1190 const SwSectionFrame* pSectFrame( GetVertPosOrientFrame()->FindSctFrame() );
1191 if ( pSectFrame && pSectFrame->GetSection() == nullptr )
1192 {
1193 InvalidatePos();
1195 }
1196 }
1197}
1198
1203void SwFlyFrame::ChgRelPos( const Point &rNewPos )
1204{
1205 if ( GetCurrRelPos() == rNewPos )
1206 return;
1207
1208 SwFrameFormat *pFormat = GetFormat();
1209 const bool bVert = GetAnchorFrame()->IsVertical();
1210 const SwTwips nNewY = bVert ? rNewPos.X() : rNewPos.Y();
1211 SwTwips nTmpY = nNewY == LONG_MAX ? 0 : nNewY;
1212 if( bVert )
1213 nTmpY = -nTmpY;
1215
1216 SwFormatVertOrient aVert( pFormat->GetVertOrient() );
1217 const SwTextFrame *pAutoFrame = nullptr;
1218 // #i34948# - handle also at-page and at-fly anchored
1219 // Writer fly frames
1220 const RndStdIds eAnchorType = GetFrameFormat().GetAnchor().GetAnchorId();
1221 if ( eAnchorType == RndStdIds::FLY_AT_PAGE )
1222 {
1224 aVert.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
1225 }
1226 else if ( eAnchorType == RndStdIds::FLY_AT_FLY )
1227 {
1229 aVert.SetRelationOrient( text::RelOrientation::FRAME );
1230 }
1232 {
1233 if( text::RelOrientation::CHAR == aVert.GetRelationOrient() && IsAutoPos() )
1234 {
1235 if( LONG_MAX != nNewY )
1236 {
1238 assert(GetAnchorFrame()->IsTextFrame());
1239 pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
1240 TextFrameIndex const nOfs(pAutoFrame->MapModelToViewPos(
1241 *pFormat->GetAnchor().GetContentAnchor()));
1242 while( pAutoFrame->GetFollow() &&
1243 pAutoFrame->GetFollow()->GetOffset() <= nOfs )
1244 {
1245 if( pAutoFrame == GetAnchorFrame() )
1246 nTmpY += pAutoFrame->GetRelPos().Y();
1247 nTmpY -= pAutoFrame->GetUpper()->getFramePrintArea().Height();
1248 pAutoFrame = pAutoFrame->GetFollow();
1249 }
1250 nTmpY = static_cast<SwFlyAtContentFrame*>(this)->GetRelCharY(pAutoFrame)-nTmpY;
1251 }
1252 else
1253 aVert.SetVertOrient( text::VertOrientation::CHAR_BOTTOM );
1254 }
1255 else
1256 {
1258 aVert.SetRelationOrient( text::RelOrientation::FRAME );
1259 }
1260 }
1261 aVert.SetPos( nTmpY );
1262 aSet.Put( aVert );
1263
1264 // For Flys in the Cnt, the horizontal orientation is of no interest,
1265 // as it's always 0
1266 if ( !IsFlyInContentFrame() )
1267 {
1268 const SwTwips nNewX = bVert ? rNewPos.Y() : rNewPos.X();
1269 SwTwips nTmpX = nNewX == LONG_MAX ? 0 : nNewX;
1270 SwFormatHoriOrient aHori( pFormat->GetHoriOrient() );
1271 // #i34948# - handle also at-page and at-fly anchored
1272 // Writer fly frames
1273 if ( eAnchorType == RndStdIds::FLY_AT_PAGE )
1274 {
1276 aHori.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
1277 aHori.SetPosToggle( false );
1278 }
1279 else if ( eAnchorType == RndStdIds::FLY_AT_FLY )
1280 {
1282 aHori.SetRelationOrient( text::RelOrientation::FRAME );
1283 aHori.SetPosToggle( false );
1284 }
1286 {
1288 if( text::RelOrientation::CHAR == aHori.GetRelationOrient() && IsAutoPos() )
1289 {
1290 if( LONG_MAX != nNewX )
1291 {
1292 if( !pAutoFrame )
1293 {
1294 assert(GetAnchorFrame()->IsTextFrame());
1295 pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
1296 TextFrameIndex const nOfs(pAutoFrame->MapModelToViewPos(
1297 *pFormat->GetAnchor().GetContentAnchor()));
1298 while( pAutoFrame->GetFollow() &&
1299 pAutoFrame->GetFollow()->GetOffset() <= nOfs )
1300 pAutoFrame = pAutoFrame->GetFollow();
1301 }
1302 nTmpX -= static_cast<SwFlyAtContentFrame*>(this)->GetRelCharX(pAutoFrame);
1303 }
1304 }
1305 else
1306 aHori.SetRelationOrient( text::RelOrientation::FRAME );
1307 aHori.SetPosToggle( false );
1308 }
1309 aHori.SetPos( nTmpX );
1310 aSet.Put( aHori );
1311 }
1312 SetCurrRelPos( rNewPos );
1313 pFormat->GetDoc()->SetAttr( aSet, *pFormat );
1314
1315}
1316
1321void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs *pAttrs )
1322{
1323 OSL_ENSURE( pAttrs, "FlyFrame::Format, pAttrs is 0." );
1324
1325 ColLock();
1326
1327 if ( !isFrameAreaSizeValid() )
1328 {
1329 if ( getFrameArea().Top() == FAR_AWAY && getFrameArea().Left() == FAR_AWAY )
1330 {
1331 // Remove safety switch (see SwFrame::CTor)
1332 {
1334 aFrm.Pos().setX(0);
1335 aFrm.Pos().setY(0);
1336 }
1337
1338 // #i68520#
1340 }
1341
1342 // Check column width and set it if needed
1343 if ( Lower() && Lower()->IsColumnFrame() )
1344 AdjustColumns( nullptr, false );
1345
1347
1348 const SwTwips nUL = pAttrs->CalcTopLine() + pAttrs->CalcBottomLine();
1349 const SwTwips nLR = pAttrs->CalcLeftLine() + pAttrs->CalcRightLine();
1350 const SwFormatFrameSize &rFrameSz = GetFormat()->GetFrameSize();
1351 Size aRelSize( CalcRel( rFrameSz ) );
1352
1353 OSL_ENSURE( pAttrs->GetSize().Height() != 0 || rFrameSz.GetHeightPercent(), "FrameAttr height is 0." );
1354 OSL_ENSURE( pAttrs->GetSize().Width() != 0 || rFrameSz.GetWidthPercent(), "FrameAttr width is 0." );
1355
1356 SwRectFnSet aRectFnSet(this);
1357 if( !HasFixSize() )
1358 {
1359 tools::Long nMinHeight = 0;
1360 if( IsMinHeight() )
1361 nMinHeight = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height();
1362
1363 SwTwips nRemaining = CalcContentHeight(pAttrs, nMinHeight, nUL);
1364 if( IsMinHeight() && (nRemaining + nUL) < nMinHeight )
1365 nRemaining = nMinHeight - nUL;
1366 // Because the Grow/Shrink of the Flys does not directly
1367 // set the size - only indirectly by triggering a Format()
1368 // via Invalidate() - the sizes need to be set here.
1369 // Notification is running along already.
1370 // As we already got a lot of zeros per attribute, we block them
1371 // from now on.
1372
1373 if ( nRemaining < MINFLY )
1374 nRemaining = MINFLY;
1375
1376 const SwFrame* pAnchor = GetAnchorFrame();
1377 if (SwFrame* pAnchorChar = FindAnchorCharFrame())
1378 {
1379 // If we find a follow of the anchor that is effectively the anchor of this fly,
1380 // then use that as the anchor for sizing purposes.
1381 pAnchor = pAnchorChar;
1382 }
1383 if (pAnchor && IsFlySplitAllowed())
1384 {
1385 // If the fly is allowed to be split, then limit its size to the upper of the
1386 // anchor.
1387 SwTwips nDeadline = GetFlyAnchorBottom(this, *pAnchor);
1388 SwTwips nTop = aRectFnSet.GetTop(getFrameArea());
1389 SwTwips nBottom = aRectFnSet.GetTop(getFrameArea()) + nRemaining;
1390 if (nBottom > nDeadline)
1391 {
1392 nRemaining = nDeadline - nTop;
1393 }
1394 }
1395
1396 {
1398 aRectFnSet.SetHeight( aPrt, nRemaining );
1399 }
1400
1401 nRemaining -= aRectFnSet.GetHeight(getFrameArea());
1402
1403 {
1405 aRectFnSet.AddBottom( aFrm, nRemaining + nUL );
1406 }
1407
1408 // #i68520#
1409 if ( nRemaining + nUL != 0 )
1410 {
1412 }
1413
1415
1417 {
1418 // This fly is a textbox of a draw shape.
1419 SdrObject* pShape = pShapeFormat->FindSdrObject();
1420 if (SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>( pShape) )
1421 {
1422 // The shape is a customshape: then inform it about the calculated fly size.
1423 Size aSize(getFrameArea().Width(), getFrameArea().Height());
1424 pCustomShape->SuggestTextFrameSize(aSize);
1425 // Do the calculations normally done after touching editeng text of the shape.
1426 pCustomShape->NbcSetOutlinerParaObjectForText(std::nullopt, nullptr);
1427 }
1428 }
1429 }
1430 else
1431 {
1432 // Fixed Frames do not Format itself
1434
1435 // Flys set their size using the attr
1436 SwTwips nNewSize = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height();
1437 nNewSize -= nUL;
1438 if( nNewSize < MINFLY )
1439 nNewSize = MINFLY;
1440
1441 {
1443 aRectFnSet.SetHeight( aPrt, nNewSize );
1444 }
1445
1446 nNewSize += nUL - aRectFnSet.GetHeight(getFrameArea());
1447
1448 {
1450 aRectFnSet.AddBottom( aFrm, nNewSize );
1451 }
1452
1453 // #i68520#
1454 if ( nNewSize != 0 )
1455 {
1457 }
1458 }
1459
1460 if ( !m_bFormatHeightOnly )
1461 {
1462 OSL_ENSURE( aRelSize == CalcRel( rFrameSz ), "SwFlyFrame::Format CalcRel problem" );
1463 SwTwips nNewSize = aRectFnSet.IsVert() ? aRelSize.Height() : aRelSize.Width();
1464
1465 if ( rFrameSz.GetWidthSizeType() != SwFrameSize::Fixed )
1466 {
1467 // #i9046# Autowidth for fly frames
1468 const SwTwips nAutoWidth = lcl_CalcAutoWidth( *this );
1469 if ( nAutoWidth )
1470 {
1471 if( SwFrameSize::Minimum == rFrameSz.GetWidthSizeType() )
1472 nNewSize = std::max( nNewSize - nLR, nAutoWidth );
1473 else
1474 nNewSize = nAutoWidth;
1475 }
1476 }
1477 else
1478 nNewSize -= nLR;
1479
1480 if( nNewSize < MINFLY )
1481 nNewSize = MINFLY;
1482
1483 {
1485 aRectFnSet.SetWidth( aPrt, nNewSize );
1486 }
1487
1488 nNewSize += nLR - aRectFnSet.GetWidth(getFrameArea());
1489
1490 {
1492 aRectFnSet.AddRight( aFrm, nNewSize );
1493 }
1494
1495 // #i68520#
1496 if ( nNewSize != 0 )
1497 {
1499 }
1500 }
1501 }
1502 ColUnlock();
1503}
1504
1505// #i11760# - change parameter <bNoColl>: type <bool>;
1506// add new parameter <bNoCalcFollow> with
1507// new parameter <bNoCalcFollow> was used by method
1508// <FormatWidthCols(..)> to avoid follow formatting
1509// for text frames. But, unformatted follows causes
1510// problems in method <SwContentFrame::WouldFit_(..)>,
1511// which assumes that the follows are formatted.
1512// Thus, <bNoCalcFollow> no longer used by <FormatWidthCols(..)>.
1513void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
1514{
1515 vcl::RenderContext* pRenderContext = pLay->getRootFrame()->GetCurrShell()->GetOut();
1516 SwSectionFrame* pSect;
1517 bool bCollect = false;
1518 if( pLay->IsSctFrame() )
1519 {
1520 pSect = static_cast<SwSectionFrame*>(pLay);
1521 if( pSect->IsEndnAtEnd() && !bNoColl )
1522 {
1523 bCollect = true;
1524 SwLayouter::CollectEndnotes( pLay->GetFormat()->GetDoc(), pSect );
1525 }
1526 pSect->CalcFootnoteContent();
1527 }
1528 else
1529 pSect = nullptr;
1530 SwFrame *pFrame = pLay->ContainsAny();
1531 if ( !pFrame )
1532 {
1533 if( pSect )
1534 {
1535 if( pSect->HasFollow() )
1536 pFrame = pSect->GetFollow()->ContainsAny();
1537 if( !pFrame )
1538 {
1539 if( pSect->IsEndnAtEnd() )
1540 {
1541 if( bCollect )
1543 InsertEndnotes( pSect );
1544 bool bLock = pSect->IsFootnoteLock();
1545 pSect->SetFootnoteLock( true );
1546 pSect->CalcFootnoteContent();
1547 pSect->CalcFootnoteContent();
1548 pSect->SetFootnoteLock( bLock );
1549 }
1550 return;
1551 }
1552 pFrame->InvalidatePos_();
1553 }
1554 else
1555 return;
1556 }
1557 pFrame->InvalidatePage();
1558
1559 do
1560 {
1561 // local variables to avoid loops caused by anchored object positioning
1562 SwAnchoredObject* pAgainObj1 = nullptr;
1563 SwAnchoredObject* pAgainObj2 = nullptr;
1564
1565 // FME 2007-08-30 #i81146# new loop control
1566 int nLoopControlRuns = 0;
1567 // tdf#152106 loop control for multi-column sections
1568 int nLoopControlRunsInMultiCol = 0;
1569 const int nLoopControlMax = 20;
1570 const SwFrame* pLoopControlCond = nullptr;
1571
1572 SwFrame* pLast;
1573 do
1574 {
1575 pLast = pFrame;
1576 bool const wasFrameLowerOfLay(pLay->IsAnLower(pFrame));
1577 if( pFrame->IsVertical() ?
1578 ( pFrame->GetUpper()->getFramePrintArea().Height() != pFrame->getFrameArea().Height() )
1579 : ( pFrame->GetUpper()->getFramePrintArea().Width() != pFrame->getFrameArea().Width() ) )
1580 {
1582 pFrame->InvalidateSize_();
1583 }
1584
1585 if ( pFrame->IsTabFrame() )
1586 {
1587 static_cast<SwTabFrame*>(pFrame)->m_bCalcLowers = true;
1588 // #i18103# - lock move backward of follow table,
1589 // if no section content is formatted or follow table belongs
1590 // to the section, which content is formatted.
1591 if ( static_cast<SwTabFrame*>(pFrame)->IsFollow() &&
1592 ( !pSect || pSect == pFrame->FindSctFrame() ) )
1593 {
1594 static_cast<SwTabFrame*>(pFrame)->m_bLockBackMove = true;
1595 }
1596 }
1597
1598 {
1599 SwFrameDeleteGuard aDeletePageGuard(pSect ? pSect->FindPageFrame() : nullptr);
1600 SwFrameDeleteGuard aDeleteGuard(pSect);
1601 pFrame->Calc(pRenderContext);
1602 }
1603
1604 // #i11760# - reset control flag for follow format.
1605 if ( pFrame->IsTextFrame() )
1606 {
1607 static_cast<SwTextFrame*>(pFrame)->AllowFollowFormat();
1608 }
1609
1610 // The keep-attribute can cause the position
1611 // of the prev to be invalid:
1612 // Do not consider invalid previous frame
1613 // due to its keep-attribute, if current frame is a follow or is locked.
1614 // #i44049# - do not consider invalid previous
1615 // frame due to its keep-attribute, if it can't move forward.
1616 // #i57765# - do not consider invalid previous
1617 // frame, if current frame has a column/page break before attribute.
1618 SwFrame* pTmpPrev = pFrame->FindPrev();
1619 SwFlowFrame* pTmpPrevFlowFrame = pTmpPrev && pTmpPrev->IsFlowFrame() ? SwFlowFrame::CastFlowFrame(pTmpPrev) : nullptr;
1620 SwFlowFrame* pTmpFlowFrame = pFrame->IsFlowFrame() ? SwFlowFrame::CastFlowFrame(pFrame) : nullptr;
1621
1622 bool bPrevInvalid = pTmpPrevFlowFrame && pTmpFlowFrame &&
1623 !pTmpFlowFrame->IsFollow() &&
1624 !StackHack::IsLocked() && // #i76382#
1625 !pTmpFlowFrame->IsJoinLocked() &&
1626 !pTmpPrev->isFrameAreaPositionValid() &&
1627 pLay->IsAnLower( pTmpPrev ) &&
1628 pTmpPrevFlowFrame->IsKeep(pTmpPrev->GetAttrSet()->GetKeep(), pTmpPrev->GetBreakItem()) &&
1629 pTmpPrevFlowFrame->IsKeepFwdMoveAllowed();
1630
1631 // format floating screen objects anchored to the frame.
1632 if ( !bPrevInvalid && pFrame->GetDrawObjs() && pLay->IsAnLower( pFrame ) )
1633 {
1634 bool bAgain = false;
1635 bool bRestartLayoutProcess = false;
1636 size_t nCnt = pFrame->GetDrawObjs()->size();
1637 size_t i = 0;
1638 while ( i < nCnt )
1639 {
1640 // pFrame can move to a different page in FormatObj()
1641 SwPageFrame *const pPageFrame = pFrame->FindPageFrame();
1642
1643 // #i28701#
1644 SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[i];
1645 assert(pAnchoredObj);
1646
1647 // determine if anchored object has to be
1648 // formatted and, in case, format it
1649 if ( !pAnchoredObj->PositionLocked() && pAnchoredObj->IsFormatPossible() )
1650 {
1651 // #i43737# - no invalidation of
1652 // anchored object needed - causes loops for as-character
1653 // anchored objects.
1654 //pAnchoredObj->InvalidateObjPos();
1655 SwRect aRect( pAnchoredObj->GetObjRect() );
1656 if ( !SwObjectFormatter::FormatObj( *pAnchoredObj, pFrame, pPageFrame ) )
1657 {
1658 bRestartLayoutProcess = true;
1659 break;
1660 }
1661 // #i3317# - restart layout process,
1662 // if the position of the anchored object is locked now.
1663 if ( pAnchoredObj->PositionLocked() )
1664 {
1665 bRestartLayoutProcess = true;
1666 break;
1667 }
1668
1669 if ( aRect != pAnchoredObj->GetObjRect() )
1670 {
1671 bAgain = true;
1672 if ( pAgainObj2 == pAnchoredObj )
1673 {
1674 OSL_FAIL( "::CalcContent(..) - loop detected, perform attribute changes to avoid the loop" );
1675 // Prevent oscillation
1676 SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat();
1677 SwFormatSurround aAttr( rFormat.GetSurround() );
1678 if( css::text::WrapTextMode_THROUGH != aAttr.GetSurround() )
1679 {
1680 // When on auto position, we can only set it to
1681 // flow through
1682 if ((rFormat.GetAnchor().GetAnchorId() ==
1683 RndStdIds::FLY_AT_CHAR) &&
1684 (css::text::WrapTextMode_PARALLEL ==
1685 aAttr.GetSurround()))
1686 {
1687 aAttr.SetSurround( css::text::WrapTextMode_THROUGH );
1688 }
1689 else
1690 {
1691 aAttr.SetSurround( css::text::WrapTextMode_PARALLEL );
1692 }
1693 rFormat.LockModify();
1694 rFormat.SetFormatAttr( aAttr );
1695 rFormat.UnlockModify();
1696 }
1697 }
1698 else
1699 {
1700 if ( pAgainObj1 == pAnchoredObj )
1701 pAgainObj2 = pAnchoredObj;
1702 pAgainObj1 = pAnchoredObj;
1703 }
1704 }
1705
1706 if ( !pFrame->GetDrawObjs() )
1707 break;
1708 if ( pFrame->GetDrawObjs()->size() < nCnt )
1709 {
1710 --nCnt;
1711 // Do not increment index, in this case
1712 continue;
1713 }
1714 }
1715 ++i;
1716 }
1717
1718 // #i28701# - restart layout process, if
1719 // requested by floating screen object formatting
1720 if (bRestartLayoutProcess
1721 // tdf#152106 loop control in multi-column sections to avoid of freezing
1722 && nLoopControlRunsInMultiCol < nLoopControlMax
1723 // tdf#142080 if it was already on next page, and still is,
1724 // ignore restart, as restart could cause infinite loop
1725 && (wasFrameLowerOfLay || pLay->IsAnLower(pFrame)))
1726 {
1727 bool bIsMultiColumn = pSect && pSect->GetSection() && pSect->Lower() &&
1728 pSect->Lower()->IsColumnFrame() && pSect->Lower()->GetNext();
1729 if ( bIsMultiColumn )
1730 ++nLoopControlRunsInMultiCol;
1731 pFrame = pLay->ContainsAny();
1732 pAgainObj1 = nullptr;
1733 pAgainObj2 = nullptr;
1734 continue;
1735 }
1736
1737 // #i28701# - format anchor frame after its objects
1738 // are formatted, if the wrapping style influence has to be considered.
1740 {
1741 pFrame->Calc(pRenderContext);
1742 }
1743
1744 if ( bAgain )
1745 {
1746 pFrame = pLay->ContainsContent();
1747 if ( pFrame && pFrame->IsInTab() )
1748 pFrame = pFrame->FindTabFrame();
1749 if( pFrame && pFrame->IsInSct() )
1750 {
1751 SwSectionFrame* pTmp = pFrame->FindSctFrame();
1752 if( pTmp != pLay && pLay->IsAnLower( pTmp ) )
1753 pFrame = pTmp;
1754 }
1755
1756 if ( pFrame == pLoopControlCond )
1757 ++nLoopControlRuns;
1758 else
1759 {
1760 nLoopControlRuns = 0;
1761 pLoopControlCond = pFrame;
1762 }
1763
1764 if ( nLoopControlRuns < nLoopControlMax )
1765 continue;
1766
1767 OSL_FAIL( "LoopControl in CalcContent" );
1768 }
1769 }
1770 if ( pFrame->IsTabFrame() )
1771 {
1772 if ( static_cast<SwTabFrame*>(pFrame)->IsFollow() )
1773 static_cast<SwTabFrame*>(pFrame)->m_bLockBackMove = false;
1774 }
1775
1776 pFrame = bPrevInvalid ? pTmpPrev : pFrame->FindNext();
1777 if( !bPrevInvalid && pFrame && pFrame->IsSctFrame() && pSect )
1778 {
1779 // Empty SectionFrames could be present here
1780 while( pFrame && pFrame->IsSctFrame() && !static_cast<SwSectionFrame*>(pFrame)->GetSection() )
1781 pFrame = pFrame->FindNext();
1782
1783 // If FindNext returns the Follow of the original Area, we want to
1784 // continue with this content as long as it flows back.
1785 if( pFrame && pFrame->IsSctFrame() && ( pFrame == pSect->GetFollow() ||
1786 static_cast<SwSectionFrame*>(pFrame)->IsAnFollow( pSect ) ) )
1787 {
1788 pFrame = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1789 if( pFrame )
1790 pFrame->InvalidatePos_();
1791 }
1792 }
1793 // Stay in the pLay.
1794 // Except for SectionFrames with Follow: the first ContentFrame of the
1795 // Follow will be formatted, so that it gets a chance to move back
1796 // into the pLay. Continue as long as these Frames land in pLay.
1797 } while ( pFrame &&
1798 ( pLay->IsAnLower( pFrame ) ||
1799 ( pSect &&
1800 ( ( pSect->HasFollow() &&
1801 ( pLay->IsAnLower( pLast ) ||
1802 ( pLast->IsInSct() &&
1803 pLast->FindSctFrame()->IsAnFollow(pSect) ) ) &&
1804 pSect->GetFollow()->IsAnLower( pFrame ) ) ||
1805 ( pFrame->IsInSct() &&
1806 pFrame->FindSctFrame()->IsAnFollow( pSect ) ) ) ) ) );
1807 if( pSect )
1808 {
1809 if( bCollect )
1810 {
1812 pSect->CalcFootnoteContent();
1813 }
1814 if( pSect->HasFollow() )
1815 {
1816 SwSectionFrame* pNxt = pSect->GetFollow();
1817 while( pNxt && !pNxt->ContainsContent() )
1818 pNxt = pNxt->GetFollow();
1819 if( pNxt )
1820 pNxt->CalcFootnoteContent();
1821 }
1822 if( bCollect )
1823 {
1824 pFrame = pLay->ContainsAny();
1825 bCollect = false;
1826 if( pFrame )
1827 continue;
1828 }
1829 }
1830 break;
1831 }
1832 while( true );
1833}
1834
1836{
1838 return;
1839
1840 vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
1842
1843 // use new class to position object
1844 GetAnchorFrame()->Calc(pRenderContext);
1846 aObjPositioning( *GetVirtDrawObj() );
1847 aObjPositioning.CalcPosition();
1848
1849 // #i58280#
1850 // update relative position
1851 SetCurrRelPos( aObjPositioning.GetRelPos() );
1852
1853 {
1854 SwRectFnSet aRectFnSet(GetAnchorFrame());
1856 aFrm.Pos( aObjPositioning.GetRelPos() );
1857 aFrm.Pos() += aRectFnSet.GetPos(GetAnchorFrame()->getFrameArea());
1858 }
1859
1860 // #i69335#
1862}
1863
1865{
1866 if ( !isFramePrintAreaValid() )
1867 {
1869
1870 // consider vertical layout
1871 SwRectFnSet aRectFnSet(this);
1872 aRectFnSet.SetXMargins( *this, rAttrs.CalcLeftLine(),
1873 rAttrs.CalcRightLine() );
1874 aRectFnSet.SetYMargins( *this, rAttrs.CalcTopLine(),
1875 rAttrs.CalcBottomLine() );
1876 }
1877}
1878
1880{
1881 if ( m_bValidContentPos )
1882 return;
1883
1884 m_bValidContentPos = true;
1885
1886 const SwTwips nUL = rAttrs.CalcTopLine() + rAttrs.CalcBottomLine();
1887 Size aRelSize( CalcRel( GetFormat()->GetFrameSize() ) );
1888
1889 SwRectFnSet aRectFnSet(this);
1890 tools::Long nMinHeight = 0;
1891 if( IsMinHeight() )
1892 nMinHeight = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height();
1893
1894 Point aNewContentPos = getFramePrintArea().Pos();
1895 const SdrTextVertAdjust nAdjust = GetFormat()->GetTextVertAdjust().GetValue();
1896
1898 {
1899 const SwTwips nContentHeight = CalcContentHeight(&rAttrs, nMinHeight, nUL);
1900 SwTwips nDiff = 0;
1901
1902 if( nContentHeight != 0)
1903 nDiff = aRectFnSet.GetHeight(getFramePrintArea()) - nContentHeight;
1904
1905 if( nDiff > 0 )
1906 {
1908 {
1909 if( aRectFnSet.IsVertL2R() )
1910 aNewContentPos.setX(aNewContentPos.getX() + nDiff/2);
1911 else if( aRectFnSet.IsVert() )
1912 aNewContentPos.setX(aNewContentPos.getX() - nDiff/2);
1913 else
1914 aNewContentPos.setY(aNewContentPos.getY() + nDiff/2);
1915 }
1916 else if( nAdjust == SDRTEXTVERTADJUST_BOTTOM )
1917 {
1918 if( aRectFnSet.IsVertL2R() )
1919 aNewContentPos.setX(aNewContentPos.getX() + nDiff);
1920 else if( aRectFnSet.IsVert() )
1921 aNewContentPos.setX(aNewContentPos.getX() - nDiff);
1922 else
1923 aNewContentPos.setY(aNewContentPos.getY() + nDiff);
1924 }
1925 }
1926 }
1927 if( aNewContentPos != ContentPos() )
1928 {
1929 ContentPos() = aNewContentPos;
1930 for( SwFrame *pFrame = Lower(); pFrame; pFrame = pFrame->GetNext())
1931 {
1932 pFrame->InvalidatePos();
1933 }
1934 }
1935
1936}
1937
1939{
1940 m_bValidContentPos = false;
1941 Invalidate_();
1942}
1943
1945{
1946 SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >(pShell);
1947 if (pWrtSh == nullptr)
1948 return;
1949
1951}
1952
1954{
1955 if (pWrtSh == nullptr)
1956 return false;
1957
1958 // In read only mode we don't allow unfloat operation
1959 if (pWrtSh->GetViewOptions()->IsReadonly())
1960 return false;
1961
1962 const SdrObject *pObj = GetFrameFormat().FindRealSdrObject();
1963 if (pObj == nullptr)
1964 return false;
1965
1966 // SwFlyFrame itself can mean images, ole objects, etc, but we interested in actual text frames
1968 return false;
1969
1970 // We show the button only for the selected text frame
1971 SwDrawView *pView = pWrtSh->Imp()->GetDrawView();
1972 if (pView == nullptr)
1973 return false;
1974
1975 // Fly frame can be selected only alone
1976 if (pView->GetMarkedObjectList().GetMarkCount() != 1)
1977 return false;
1978
1979 if(!pView->IsObjMarked(pObj))
1980 return false;
1981
1982 // A frame is a floating table if there is only one table (and maybe some whitespaces) inside it
1983 int nTableCount = 0;
1984 const SwFrame* pLower = GetLower();
1985 const SwTabFrame* pTable = nullptr;
1986 while (pLower)
1987 {
1988 if (pLower->IsTabFrame())
1989 {
1990 pTable = static_cast<const SwTabFrame*>(pLower);
1991 ++nTableCount;
1992 if (nTableCount > 1 || pTable == nullptr)
1993 return false;
1994 }
1995
1996 if (pLower->IsTextFrame())
1997 {
1998 const SwTextFrame* pTextFrame = static_cast<const SwTextFrame*>(pLower);
1999 if (!pTextFrame->GetText().trim().isEmpty())
2000 return false;
2001 }
2002 pLower = pLower->GetNext();
2003 }
2004
2005 if (nTableCount != 1 || pTable == nullptr)
2006 return false;
2007
2008 // Show the unfold button only for multipage tables
2009 const SwBodyFrame *pBody = GetAnchorFrame()->FindBodyFrame();
2010 if (pBody == nullptr)
2011 return false;
2012
2013 tools::Long nBodyHeight = pBody->getFrameArea().Height();
2014 tools::Long nTableHeight = pTable->getFrameArea().Height();
2015 tools::Long nFrameOffset = std::abs(GetAnchorFrame()->getFrameArea().Top() - pBody->getFrameArea().Top());
2016
2017 return nBodyHeight < nTableHeight + nFrameOffset;
2018}
2019
2021{
2022 SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
2025 if (pControl && pControl->GetWindow())
2026 {
2027 pControl->GetWindow()->MouseButtonDown(MouseEvent());
2028 }
2029}
2030
2031void SwFlyFrame::UpdateUnfloatButton(SwWrtShell* pWrtSh, bool bShow) const
2032{
2033 if (pWrtSh == nullptr)
2034 return;
2035
2036 SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
2038 Point aTopRightPixel = rEditWin.LogicToPixel( getFrameArea().TopRight() );
2039 rMngr.SetUnfloatTableButton(this, bShow, aTopRightPixel);
2040}
2041
2043{
2044 SwRectFnSet aRectFnSet(this);
2045 if ( Lower() && !IsColLocked() && !HasFixSize() )
2046 {
2047 SwTwips nSize = aRectFnSet.GetHeight(getFrameArea());
2048 if( nSize > 0 && nDist > ( LONG_MAX - nSize ) )
2049 nDist = LONG_MAX - nSize;
2050
2051 if ( nDist <= 0 )
2052 return 0;
2053
2054 if ( Lower()->IsColumnFrame() )
2055 { // If it's a Column Frame, the Format takes control of the
2056 // resizing (due to the adjustment).
2057 if ( !bTst )
2058 {
2059 // #i28701# - unlock position of Writer fly frame
2063 }
2064 return 0;
2065 }
2066
2067 if ( !bTst )
2068 {
2069 const SwRect aOld( GetObjRectWithSpaces() );
2071 const bool bOldLock = m_bLocked;
2072 Unlock();
2073 if ( IsFlyFreeFrame() )
2074 {
2075 // #i37068# - no format of position here
2076 // and prevent move in method <CheckClip(..)>.
2077 // This is needed to prevent layout loop caused by nested
2078 // Writer fly frames - inner Writer fly frames format its
2079 // anchor, which grows/shrinks the outer Writer fly frame.
2080 // Note: position will be invalidated below.
2082
2083 // #i55416#
2084 // Suppress format of width for autowidth frame, because the
2085 // format of the width would call <SwTextFrame::CalcFitToContent()>
2086 // for the lower frame, which initiated this grow.
2087 const bool bOldFormatHeightOnly = m_bFormatHeightOnly;
2088 const SwFormatFrameSize& rFrameSz = GetFormat()->GetFrameSize();
2089 if ( rFrameSz.GetWidthSizeType() != SwFrameSize::Fixed )
2090 {
2091 m_bFormatHeightOnly = true;
2092 }
2094 if (pSh)
2095 {
2096 static_cast<SwFlyFreeFrame*>(this)->SetNoMoveOnCheckClip( true );
2097 static_cast<SwFlyFreeFrame*>(this)->SwFlyFreeFrame::MakeAll(pSh->GetOut());
2098 static_cast<SwFlyFreeFrame*>(this)->SetNoMoveOnCheckClip( false );
2099 }
2100 // #i55416#
2101 if ( rFrameSz.GetWidthSizeType() != SwFrameSize::Fixed )
2102 {
2103 m_bFormatHeightOnly = bOldFormatHeightOnly;
2104 }
2105 }
2106 else
2107 MakeAll(getRootFrame()->GetCurrShell()->GetOut());
2109 InvalidatePos();
2110 if ( bOldLock )
2111 Lock();
2113 if (IsFlySplitAllowed() && aNew.Height() - aOld.Height() < nDist)
2114 {
2115 // We are allowed to split and the actual growth is less than the requested growth.
2116 const SwFrame* pAnchor = GetAnchorFrame();
2117 if (SwFrame* pAnchorChar = FindAnchorCharFrame())
2118 {
2119 pAnchor = pAnchorChar;
2120 }
2121 if (pAnchor)
2122 {
2123 SwTwips nDeadline = GetFlyAnchorBottom(this, *pAnchor);
2124 SwTwips nTop = aRectFnSet.GetTop(getFrameArea());
2125 SwTwips nBottom = nTop + aRectFnSet.GetHeight(getFrameArea());
2126 SwTwips nMaxGrow = nDeadline - nBottom;
2127 if (nDist > nMaxGrow)
2128 {
2129 // The requested growth is more than what we can provide, limit it.
2130 nDist = nMaxGrow;
2131 }
2132 // Grow & invalidate the size.
2133 SwTwips nRemaining = nDist - (aNew.Height() - aOld.Height());
2134 {
2136 aRectFnSet.AddBottom(aFrm, nRemaining);
2137 }
2139 {
2140 // Margins are unchanged, so increase the print height similar to the frame
2141 // height.
2143 aRectFnSet.AddBottom(aPrt, nRemaining );
2144 }
2145 aNew = GetObjRectWithSpaces();
2146 }
2147 }
2148 if ( aOld != aNew )
2149 ::Notify( this, FindPageFrame(), aOld );
2150 return aRectFnSet.GetHeight(aNew)-aRectFnSet.GetHeight(aOld);
2151 }
2152 else
2153 {
2154 // We're in test mode. Don't promise infinite growth for split flys, rather limit the
2155 // max size to the bottom of the upper.
2156 const SwFrame* pAnchor = GetAnchorFrame();
2157 if (SwFrame* pAnchorChar = FindAnchorCharFrame())
2158 {
2159 pAnchor = pAnchorChar;
2160 }
2161 if (pAnchor && IsFlySplitAllowed())
2162 {
2163 SwTwips nDeadline = GetFlyAnchorBottom(this, *pAnchor);
2164 SwTwips nTop = aRectFnSet.GetTop(getFrameArea());
2165 SwTwips nBottom = nTop + aRectFnSet.GetHeight(getFrameArea());
2166 // Calculate max grow and compare to the requested growth, adding to nDist may
2167 // overflow when it's LONG_MAX.
2168 SwTwips nMaxGrow = nDeadline - nBottom;
2169 if (nDist > nMaxGrow)
2170 {
2171 nDist = nMaxGrow;
2172 }
2173 }
2174 }
2175 return nDist;
2176 }
2177 return 0;
2178}
2179
2181{
2182 if( Lower() && !IsColLocked() && !HasFixSize() )
2183 {
2184 SwRectFnSet aRectFnSet(this);
2185 SwTwips nHeight = aRectFnSet.GetHeight(getFrameArea());
2186 if ( nDist > nHeight )
2187 nDist = nHeight;
2188
2189 SwTwips nVal = nDist;
2190 if ( IsMinHeight() )
2191 {
2192 const SwFormatFrameSize& rFormatSize = GetFormat()->GetFrameSize();
2193 SwTwips nFormatHeight = aRectFnSet.IsVert() ? rFormatSize.GetWidth() : rFormatSize.GetHeight();
2194
2195 nVal = std::min( nDist, nHeight - nFormatHeight );
2196 }
2197
2198 if ( nVal <= 0 )
2199 return 0;
2200
2201 if ( Lower()->IsColumnFrame() )
2202 { // If it's a Column Frame, the Format takes control of the
2203 // resizing (due to the adjustment).
2204 if ( !bTst )
2205 {
2206 SwRect aOld( GetObjRectWithSpaces() );
2207
2208 {
2210 aRectFnSet.SetHeight( aFrm, nHeight - nVal );
2211 }
2212
2213 // #i68520#
2214 if ( nHeight - nVal != 0 )
2215 {
2217 }
2218
2219 nHeight = aRectFnSet.GetHeight(getFramePrintArea());
2220
2221 {
2223 aRectFnSet.SetHeight( aPrt, nHeight - nVal );
2224 }
2225
2228 ::Notify( this, FindPageFrame(), aOld );
2229 NotifyDrawObj();
2230 if ( GetAnchorFrame()->IsInFly() )
2231 AnchorFrame()->FindFlyFrame()->Shrink( nDist, bTst );
2232 }
2233 return 0;
2234 }
2235
2236 if ( !bTst )
2237 {
2238 const SwRect aOld( GetObjRectWithSpaces() );
2240 const bool bOldLocked = m_bLocked;
2241 Unlock();
2242 if ( IsFlyFreeFrame() )
2243 {
2244 // #i37068# - no format of position here
2245 // and prevent move in method <CheckClip(..)>.
2246 // This is needed to prevent layout loop caused by nested
2247 // Writer fly frames - inner Writer fly frames format its
2248 // anchor, which grows/shrinks the outer Writer fly frame.
2249 // Note: position will be invalidated below.
2251
2252 // #i55416#
2253 // Suppress format of width for autowidth frame, because the
2254 // format of the width would call <SwTextFrame::CalcFitToContent()>
2255 // for the lower frame, which initiated this shrink.
2256 const bool bOldFormatHeightOnly = m_bFormatHeightOnly;
2257 const SwFormatFrameSize& rFrameSz = GetFormat()->GetFrameSize();
2258 if ( rFrameSz.GetWidthSizeType() != SwFrameSize::Fixed )
2259 {
2260 m_bFormatHeightOnly = true;
2261 }
2262 static_cast<SwFlyFreeFrame*>(this)->SetNoMoveOnCheckClip( true );
2264 static_cast<SwFlyFreeFrame*>(this)->SetNoMoveOnCheckClip( false );
2265 // #i55416#
2266 if ( rFrameSz.GetWidthSizeType() != SwFrameSize::Fixed )
2267 {
2268 m_bFormatHeightOnly = bOldFormatHeightOnly;
2269 }
2270 }
2271 else
2272 MakeAll(getRootFrame()->GetCurrShell()->GetOut());
2274 InvalidatePos();
2275 if ( bOldLocked )
2276 Lock();
2277 const SwRect aNew( GetObjRectWithSpaces() );
2278 if ( aOld != aNew )
2279 {
2280 ::Notify( this, FindPageFrame(), aOld );
2281 if ( GetAnchorFrame()->IsInFly() )
2282 AnchorFrame()->FindFlyFrame()->Shrink( nDist, bTst );
2283 }
2284 return aRectFnSet.GetHeight(aOld) -
2285 aRectFnSet.GetHeight(aNew);
2286 }
2287 return nVal;
2288 }
2289 return 0;
2290}
2291
2293{
2294 // #i53298#
2295 // If the fly frame anchored at-paragraph or at-character contains an OLE
2296 // object, assure that the new size fits into the current clipping area
2297 // of the fly frame
2298 Size aAdjustedNewSize( aNewSize );
2299 {
2300 if ( dynamic_cast<SwFlyAtContentFrame*>(this) &&
2301 Lower() && dynamic_cast<SwNoTextFrame*>(Lower()) &&
2302 static_cast<SwNoTextFrame*>(Lower())->GetNode()->GetOLENode() )
2303 {
2304 SwRect aClipRect;
2305 ::CalcClipRect( GetVirtDrawObj(), aClipRect, false );
2306 if ( aAdjustedNewSize.Width() > aClipRect.Width() )
2307 {
2308 aAdjustedNewSize.setWidth( aClipRect.Width() );
2309 }
2310 if ( aAdjustedNewSize.Height() > aClipRect.Height() )
2311 {
2312 aAdjustedNewSize.setWidth( aClipRect.Height() );
2313 }
2314 }
2315 }
2316
2317 if ( aAdjustedNewSize != getFrameArea().SSize() )
2318 {
2319 SwFrameFormat *pFormat = GetFormat();
2320 SwFormatFrameSize aSz( pFormat->GetFrameSize() );
2321 aSz.SetWidth( aAdjustedNewSize.Width() );
2322 aSz.SetHeight( aAdjustedNewSize.Height() );
2323 // go via the Doc for UNDO
2324 pFormat->GetDoc()->SetAttr( aSz, *pFormat );
2325 return aSz.GetSize();
2326 }
2327 else
2328 return getFrameArea().SSize();
2329}
2330
2331bool SwFlyFrame::IsLowerOf( const SwLayoutFrame* pUpperFrame ) const
2332{
2333 OSL_ENSURE( GetAnchorFrame(), "8-( Fly is lost in Space." );
2334 const SwFrame* pFrame = GetAnchorFrame();
2335 do
2336 {
2337 if ( pFrame == pUpperFrame )
2338 return true;
2339 pFrame = pFrame->IsFlyFrame()
2340 ? static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame()
2341 : pFrame->GetUpper();
2342 } while ( pFrame );
2343 return false;
2344}
2345
2347{
2348}
2349
2351{
2352 if (!m_pDrawObjs)
2353 {
2354 m_pDrawObjs.reset(new SwSortedObjs());
2355 }
2356 m_pDrawObjs->Insert( *pNew );
2357 pNew->ChgAnchorFrame( this );
2358
2359 // Register at the page
2360 // If there's none present, register via SwPageFrame::PreparePage
2361 SwPageFrame* pPage = FindPageFrame();
2362 if ( pPage != nullptr )
2363 {
2364 pPage->AppendFlyToPage( pNew );
2365 }
2366}
2367
2369{
2370 // Deregister from the page
2371 // Could already have happened, if the page was already destructed
2372 SwPageFrame *pPage = pToRemove->FindPageFrame();
2373 if ( pPage && pPage->GetSortedObjs() )
2374 {
2375 pPage->RemoveFlyFromPage( pToRemove );
2376 }
2377 // #i73201#
2378#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2379 else
2380 {
2381 if ( pToRemove->IsAccessibleFrame() &&
2382 pToRemove->GetFormat() &&
2383 !pToRemove->IsFlyInContentFrame() )
2384 {
2385 SwRootFrame *pRootFrame = getRootFrame();
2386 if( pRootFrame && pRootFrame->IsAnyShellAccessible() )
2387 {
2388 SwViewShell *pVSh = pRootFrame->GetCurrShell();
2389 if( pVSh && pVSh->Imp() )
2390 {
2391 pVSh->Imp()->DisposeAccessibleFrame( pToRemove );
2392 }
2393 }
2394 }
2395 }
2396#endif
2397
2398 m_pDrawObjs->Remove(*pToRemove);
2399 if (!m_pDrawObjs->size())
2400 {
2401 m_pDrawObjs.reset();
2402 }
2403
2404 pToRemove->ChgAnchorFrame( nullptr );
2405
2406 if ( !pToRemove->IsFlyInContentFrame() && GetUpper() && IsInTab() )//MA_FLY_HEIGHT
2408}
2409
2411{
2412 assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
2413
2414 if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rNewObj) == nullptr )
2415 {
2416 OSL_FAIL( "SwFrame::AppendDrawObj(..) - anchored object of unexpected type -> object not appended" );
2417 return;
2418 }
2419
2420 if ( dynamic_cast<const SwDrawVirtObj*>(_rNewObj.GetDrawObj()) == nullptr &&
2421 _rNewObj.GetAnchorFrame() && _rNewObj.GetAnchorFrame() != this )
2422 {
2423 assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
2424 // perform disconnect from layout, if 'master' drawing object is appended
2425 // to a new frame.
2426 static_cast<SwDrawContact*>(::GetUserCall( _rNewObj.GetDrawObj() ))->
2427 DisconnectFromLayout( false );
2428 assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
2429 }
2430
2431 if ( _rNewObj.GetAnchorFrame() != this )
2432 {
2433 if (!m_pDrawObjs)
2434 {
2435 m_pDrawObjs.reset(new SwSortedObjs());
2436 }
2437 m_pDrawObjs->Insert(_rNewObj);
2438 _rNewObj.ChgAnchorFrame( this );
2439 }
2440
2441 // #i113730#
2442 // Assure the control objects and group objects containing controls are on the control layer
2443 if ( ::CheckControlLayer( _rNewObj.DrawObj() ) )
2444 {
2446 const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer());
2447 const SdrLayerID aControlLayerID(rIDDMA.GetControlsId());
2448 const SdrLayerID aInvisibleControlLayerID(rIDDMA.GetInvisibleControlsId());
2449
2450 if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID)
2451 {
2452 if ( aCurrentLayer == rIDDMA.GetInvisibleHellId() ||
2453 aCurrentLayer == rIDDMA.GetInvisibleHeavenId() )
2454 {
2455 _rNewObj.DrawObj()->SetLayer(aInvisibleControlLayerID);
2456 }
2457 else
2458 {
2459 _rNewObj.DrawObj()->SetLayer(aControlLayerID);
2460 }
2461 //The layer is part of the key used to sort the obj, so update
2462 //its position if the layer changed.
2463 m_pDrawObjs->Update(_rNewObj);
2464 }
2465 }
2466
2467 // no direct positioning needed, but invalidate the drawing object position
2468 _rNewObj.InvalidateObjPos();
2469
2470 // register at page frame
2471 SwPageFrame* pPage = FindPageFrame();
2472 if ( pPage )
2473 {
2474 pPage->AppendDrawObjToPage( _rNewObj );
2475 }
2476
2477 // Notify accessible layout.
2478#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2480 if( pSh )
2481 {
2482 SwRootFrame* pLayout = getRootFrame();
2483 if( pLayout && pLayout->IsAnyShellAccessible() )
2484 {
2485 pSh->Imp()->AddAccessibleObj( _rNewObj.GetDrawObj() );
2486 }
2487 }
2488#endif
2489
2490 assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
2491}
2492
2494{
2495 // Notify accessible layout.
2496#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2498 if( pSh )
2499 {
2500 SwRootFrame* pLayout = getRootFrame();
2501 if (pLayout && pLayout->IsAnyShellAccessible())
2502 pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false);
2503 }
2504#endif
2505
2506 // deregister from page frame
2507 SwPageFrame* pPage = _rToRemoveObj.GetPageFrame();
2508 if ( pPage && pPage->GetSortedObjs() )
2509 pPage->RemoveDrawObjFromPage( _rToRemoveObj );
2510
2511 m_pDrawObjs->Remove(_rToRemoveObj);
2512 if (!m_pDrawObjs->size())
2513 {
2514 m_pDrawObjs.reset();
2515 }
2516 _rToRemoveObj.ChgAnchorFrame( nullptr );
2517
2518 assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
2519}
2520
2521void SwFrame::InvalidateObjs( const bool _bNoInvaOfAsCharAnchoredObjs )
2522{
2523 if ( !GetDrawObjs() )
2524 return;
2525
2526 // #i26945# - determine page the frame is on,
2527 // in order to check, if anchored object is registered at the same
2528 // page.
2529 const SwPageFrame* pPageFrame = FindPageFrame();
2530 // #i28701# - re-factoring
2531 for (SwAnchoredObject* pAnchoredObj : *GetDrawObjs())
2532 {
2533 if ( _bNoInvaOfAsCharAnchoredObjs &&
2534 (pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
2535 == RndStdIds::FLY_AS_CHAR) )
2536 {
2537 continue;
2538 }
2539 // #i26945# - no invalidation, if anchored object
2540 // isn't registered at the same page and instead is registered at
2541 // the page, where its anchor character text frame is on.
2542 if ( pAnchoredObj->GetPageFrame() &&
2543 pAnchoredObj->GetPageFrame() != pPageFrame )
2544 {
2545 SwTextFrame* pAnchorCharFrame = pAnchoredObj->FindAnchorCharFrame();
2546 if ( pAnchorCharFrame &&
2547 pAnchoredObj->GetPageFrame() == pAnchorCharFrame->FindPageFrame() )
2548 {
2549 continue;
2550 }
2551 // #115759# - unlock its position, if anchored
2552 // object isn't registered at the page, where its anchor
2553 // character text frame is on, respectively if it has no
2554 // anchor character text frame.
2555 else
2556 {
2557 pAnchoredObj->UnlockPosition();
2558 }
2559 }
2560 // #i51474# - reset flag, that anchored object
2561 // has cleared environment, and unlock its position, if the anchored
2562 // object is registered at the same page as the anchor frame is on.
2563 if ( pAnchoredObj->ClearedEnvironment() &&
2564 pAnchoredObj->GetPageFrame() &&
2565 pAnchoredObj->GetPageFrame() == pPageFrame )
2566 {
2567 pAnchoredObj->UnlockPosition();
2568 pAnchoredObj->SetClearedEnvironment( false );
2569 }
2570 // distinguish between writer fly frames and drawing objects
2571 if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
2572 {
2573 pFly->Invalidate_();
2574 pFly->InvalidatePos_();
2575 }
2576 else
2577 {
2578 pAnchoredObj->InvalidateObjPos();
2579 }
2580 } // end of loop on objects, which are connected to the frame
2581}
2582
2583// #i26945# - correct check, if anchored object is a lower
2584// of the layout frame. E.g., anchor character text frame can be a follow text
2585// frame.
2586// #i44016# - add parameter <_bUnlockPosOfObjs> to
2587// force an unlockposition call for the lower objects.
2588void SwLayoutFrame::NotifyLowerObjs( const bool _bUnlockPosOfObjs )
2589{
2590 // invalidate lower floating screen objects
2591 SwPageFrame* pPageFrame = FindPageFrame();
2592 if ( !(pPageFrame && pPageFrame->GetSortedObjs()) )
2593 return;
2594
2595 SwSortedObjs& rObjs = *(pPageFrame->GetSortedObjs());
2596 for (SwAnchoredObject* pObj : rObjs)
2597 {
2598 // #i26945# - check if anchored object is a lower
2599 // of the layout frame is changed to check, if its anchor frame
2600 // is a lower of the layout frame.
2601 // Determine the anchor frame - usually it's the anchor frame,
2602 // for at-character/as-character anchored objects the anchor character
2603 // text frame is taken.
2604 const SwFrame* pAnchorFrame = pObj->GetAnchorFrameContainingAnchPos();
2605 if ( auto pFly = pObj->DynCastFlyFrame() )
2606 {
2607 if ( pFly->getFrameArea().Left() == FAR_AWAY )
2608 continue;
2609
2610 if ( pFly->IsAnLower( this ) )
2611 continue;
2612
2613 // #i26945# - use <pAnchorFrame> to check, if
2614 // fly frame is lower of layout frame resp. if fly frame is
2615 // at a different page registered as its anchor frame is on.
2616 const bool bLow = IsAnLower( pAnchorFrame );
2617 if ( bLow || pAnchorFrame->FindPageFrame() != pPageFrame )
2618 {
2619 pFly->Invalidate_( pPageFrame );
2620 if ( !bLow || pFly->IsFlyAtContentFrame() )
2621 {
2622 // #i44016#
2623 if ( _bUnlockPosOfObjs )
2624 {
2625 pFly->UnlockPosition();
2626 }
2627 pFly->InvalidatePos_();
2628 }
2629 else
2630 pFly->InvalidatePrt_();
2631 }
2632 }
2633 else
2634 {
2635 assert( dynamic_cast<const SwAnchoredDrawObject*>( pObj) &&
2636 "<SwLayoutFrame::NotifyFlys() - anchored object of unexpected type" );
2637 // #i26945# - use <pAnchorFrame> to check, if
2638 // fly frame is lower of layout frame resp. if fly frame is
2639 // at a different page registered as its anchor frame is on.
2640 if ( IsAnLower( pAnchorFrame ) ||
2641 pAnchorFrame->FindPageFrame() != pPageFrame )
2642 {
2643 // #i44016#
2644 if ( _bUnlockPosOfObjs )
2645 {
2646 pObj->UnlockPosition();
2647 }
2648 pObj->InvalidateObjPos();
2649 }
2650 }
2651 }
2652}
2653
2655{
2657 pObj->SetRect();
2659 pObj->SetChanged();
2660 pObj->BroadcastObjectChange();
2661
2662 if ( GetFormat()->GetSurround().IsContour() )
2663 {
2664 ClrContourCache( pObj );
2665 }
2666 else if(IsFlyFreeFrame() && static_cast< const SwFlyFreeFrame* >(this)->supportsAutoContour())
2667 {
2668 // RotateFlyFrame3: Also need to clear when changes happen
2669 // Caution: isTransformableSwFrame is already reset when resetting rotation, so
2670 // *additionally* reset in SwFlyFreeFrame::MakeAll when no more rotation
2671 ClrContourCache( pObj );
2672 }
2673}
2674
2676{
2677 Size aRet( rSz.GetSize() );
2678
2679 const SwFrame *pRel = IsFlyLayFrame() ? GetAnchorFrame() : GetAnchorFrame()->GetUpper();
2680 if( pRel ) // LAYER_IMPL
2681 {
2682 tools::Long nRelWidth = LONG_MAX, nRelHeight = LONG_MAX;
2683 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
2684 if ( ( pRel->IsBodyFrame() || pRel->IsPageFrame() ) &&
2685 pSh && pSh->GetViewOptions()->getBrowseMode() &&
2686 pSh->VisArea().HasArea() )
2687 {
2688 nRelWidth = pSh->GetBrowseWidth();
2689 nRelHeight = pSh->VisArea().Height();
2690 Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
2691 nRelWidth = std::min( nRelWidth, pRel->getFramePrintArea().Width() );
2692 nRelHeight -= 2*aBorder.Height();
2693 nRelHeight = std::min( nRelHeight, pRel->getFramePrintArea().Height() );
2694 }
2695
2696 // At the moment only the "== PAGE_FRAME" and "!= PAGE_FRAME" cases are handled.
2697 // When size is a relative to page size, ignore size of SwBodyFrame.
2698 if (rSz.GetWidthPercentRelation() != text::RelOrientation::PAGE_FRAME)
2699 nRelWidth = std::min( nRelWidth, pRel->getFramePrintArea().Width() );
2700 else if ( pRel->IsPageFrame() )
2701 nRelWidth = std::min( nRelWidth, pRel->getFrameArea().Width() );
2702
2703 if (rSz.GetHeightPercentRelation() != text::RelOrientation::PAGE_FRAME)
2704 nRelHeight = std::min( nRelHeight, pRel->getFramePrintArea().Height() );
2705 else if ( pRel->IsPageFrame() )
2706 nRelHeight = std::min( nRelHeight, pRel->getFrameArea().Height() );
2707
2708 if( !pRel->IsPageFrame() )
2709 {
2710 const SwPageFrame* pPage = FindPageFrame();
2711 if( pPage )
2712 {
2713 if (rSz.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME)
2714 // Ignore margins of pPage.
2715 nRelWidth = std::min( nRelWidth, pPage->getFrameArea().Width() );
2716 else
2717 nRelWidth = std::min( nRelWidth, pPage->getFramePrintArea().Width() );
2718 if (rSz.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME)
2719 // Ignore margins of pPage.
2720 nRelHeight = std::min( nRelHeight, pPage->getFrameArea().Height() );
2721 else
2722 nRelHeight = std::min( nRelHeight, pPage->getFramePrintArea().Height() );
2723 }
2724 }
2725
2727 aRet.setWidth( nRelWidth * rSz.GetWidthPercent() / 100 );
2729 aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
2730
2732 {
2733 aRet.setWidth( aRet.Width() * ( aRet.Height()) );
2734 aRet.setWidth( aRet.Width() / ( rSz.GetHeight()) );
2735 }
2736 else if ( rSz.GetHeightPercent() == SwFormatFrameSize::SYNCED )
2737 {
2738 aRet.setHeight( aRet.Height() * ( aRet.Width()) );
2739 aRet.setHeight( aRet.Height() / ( rSz.GetWidth()) );
2740 }
2741 }
2742 return aRet;
2743}
2744
2746{
2747 SwTwips nRet = 0;
2748 SwTwips nMin = 0;
2749 const SwFrame* pFrame = rFrame.Lower();
2750
2751 // No autowidth defined for columned frames
2752 if ( !pFrame || pFrame->IsColumnFrame() )
2753 return nRet;
2754
2755 int nParagraphCount = 0;
2756 while ( pFrame )
2757 {
2758 nParagraphCount++;
2759 if ( pFrame->IsSctFrame() )
2760 {
2761 nMin = lcl_CalcAutoWidth( *static_cast<const SwSectionFrame*>(pFrame) );
2762 }
2763 if ( pFrame->IsTextFrame() )
2764 {
2765 nMin = const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pFrame))->CalcFitToContent();
2766 auto const& rParaSet(static_cast<const SwTextFrame*>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet());
2767 SvxFirstLineIndentItem const& rFirstLine(rParaSet.GetFirstLineIndent());
2768 SvxTextLeftMarginItem const& rLeftMargin(rParaSet.GetTextLeftMargin());
2769 SvxRightMarginItem const& rRightMargin(rParaSet.GetRightMargin());
2770 if (!static_cast<const SwTextFrame*>(pFrame)->IsLocked())
2771 {
2772 nMin += rRightMargin.GetRight() + rLeftMargin.GetTextLeft()
2773 + rFirstLine.GetTextFirstLineOffset();
2774 }
2775 }
2776 else if ( pFrame->IsTabFrame() )
2777 {
2778 const SwFormatFrameSize& rTableFormatSz = static_cast<const SwTabFrame*>(pFrame)->GetTable()->GetFrameFormat()->GetFrameSize();
2779 if ( USHRT_MAX == rTableFormatSz.GetSize().Width() ||
2780 text::HoriOrientation::NONE == static_cast<const SwTabFrame*>(pFrame)->GetFormat()->GetHoriOrient().GetHoriOrient() )
2781 {
2782 const SwPageFrame* pPage = rFrame.FindPageFrame();
2783 // auto width table
2784 nMin = pFrame->GetUpper()->IsVertical() ?
2785 pPage->getFramePrintArea().Height() :
2786 pPage->getFramePrintArea().Width();
2787 }
2788 else
2789 {
2790 nMin = rTableFormatSz.GetSize().Width();
2791 }
2792 }
2793
2794 if ( nMin > nRet )
2795 nRet = nMin;
2796
2797 pFrame = pFrame->GetNext();
2798 }
2799
2800 // tdf#124423 In Microsoft compatibility mode: widen the frame to max (PrintArea of the frame it anchored to) if it contains at least 2 paragraphs,
2801 // or 1 paragraph wider than its parent area.
2803 {
2804 const SwFrame* pFrameRect = rFrame.IsFlyFrame() ? static_cast<const SwFlyFrame*>(&rFrame)->GetAnchorFrame() : rFrame.Lower()->FindPageFrame();
2805 SwTwips nParentWidth = rFrame.IsVertical() ? pFrameRect->getFramePrintArea().Height() : pFrameRect->getFramePrintArea().Width();
2806 if (nParagraphCount > 1 || nRet > nParentWidth)
2807 {
2808 return nParentWidth;
2809 }
2810 }
2811
2812 return nRet;
2813}
2814
2818 const bool _bForPaint ) const
2819{
2820 vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
2821 bool bRet = false;
2822 const bool bIsCandidate(Lower() && Lower()->IsNoTextFrame());
2823
2824 if(bIsCandidate)
2825 {
2826 if(GetFormat()->GetSurround().IsContour())
2827 {
2828 SwNoTextNode *pNd = const_cast<SwNoTextNode*>(static_cast<const SwNoTextNode*>(static_cast<const SwNoTextFrame*>(Lower())->GetNode()));
2829 // #i13147# - determine <GraphicObject> instead of <Graphic>
2830 // in order to avoid load of graphic, if <SwNoTextNode> contains a graphic
2831 // node and method is called for paint.
2832 std::unique_ptr<GraphicObject> xTmpGrfObj;
2833 const GraphicObject* pGrfObj = nullptr;
2834 const SwGrfNode* pGrfNd = pNd->GetGrfNode();
2835 if ( pGrfNd && _bForPaint )
2836 {
2837 pGrfObj = &(pGrfNd->GetGrfObj());
2838 }
2839 else
2840 {
2841 xTmpGrfObj.reset(new GraphicObject(pNd->GetGraphic()));
2842 pGrfObj = xTmpGrfObj.get();
2843 }
2844 assert(pGrfObj && "SwFlyFrame::GetContour() - No Graphic/GraphicObject found at <SwNoTextNode>.");
2845 if (pGrfObj->GetType() != GraphicType::NONE)
2846 {
2847 if( !pNd->HasContour() )
2848 {
2849 //#i13147# - no <CreateContour> for a graphic
2850 // during paint. Thus, return (value of <bRet> should be <false>).
2851 if ( pGrfNd && _bForPaint )
2852 {
2853 OSL_FAIL( "SwFlyFrame::GetContour() - No Contour found at <SwNoTextNode> during paint." );
2854 return bRet;
2855 }
2856 pNd->CreateContour();
2857 }
2858 pNd->GetContour( rContour );
2859 // The Node holds the Polygon matching the original size of the graphic
2860 // We need to include the scaling here
2861 SwRect aClip;
2862 SwRect aOrig;
2863 Lower()->Calc(pRenderContext);
2864 static_cast<const SwNoTextFrame*>(Lower())->GetGrfArea( aClip, &aOrig );
2865 // #i13147# - copy method code <SvxContourDlg::ScaleContour(..)>
2866 // in order to avoid that graphic has to be loaded for contour scale.
2867 //SvxContourDlg::ScaleContour( rContour, aGrf, MapUnit::MapTwip, aOrig.SSize() );
2868 {
2870 const MapMode aDispMap( MapUnit::MapTwip );
2871 const MapMode aGrfMap( pGrfObj->GetPrefMapMode() );
2872 const Size aGrfSize( pGrfObj->GetPrefSize() );
2873 Size aOrgSize;
2874 Point aNewPoint;
2875 bool bPixelMap = aGrfMap.GetMapUnit() == MapUnit::MapPixel;
2876
2877 if ( bPixelMap )
2878 aOrgSize = pOutDev->PixelToLogic( aGrfSize, aDispMap );
2879 else
2880 aOrgSize = OutputDevice::LogicToLogic( aGrfSize, aGrfMap, aDispMap );
2881
2882 if ( aOrgSize.Width() && aOrgSize.Height() )
2883 {
2884 double fScaleX = static_cast<double>(aOrig.Width()) / aOrgSize.Width();
2885 double fScaleY = static_cast<double>(aOrig.Height()) / aOrgSize.Height();
2886
2887 for ( sal_uInt16 j = 0, nPolyCount = rContour.Count(); j < nPolyCount; j++ )
2888 {
2889 tools::Polygon& rPoly = rContour[ j ];
2890
2891 for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
2892 {
2893 if ( bPixelMap )
2894 aNewPoint = pOutDev->PixelToLogic( rPoly[ i ], aDispMap );
2895 else
2896 aNewPoint = OutputDevice::LogicToLogic( rPoly[ i ], aGrfMap, aDispMap );
2897
2898 rPoly[ i ] = Point( FRound( aNewPoint.getX() * fScaleX ), FRound( aNewPoint.getY() * fScaleY ) );
2899 }
2900 }
2901 }
2902 }
2903 // destroy created <GraphicObject>.
2904 xTmpGrfObj.reset();
2905 rContour.Move( aOrig.Left(), aOrig.Top() );
2906 if( !aClip.Width() )
2907 aClip.Width( 1 );
2908 if( !aClip.Height() )
2909 aClip.Height( 1 );
2910 rContour.Clip( aClip.SVRect() );
2911 rContour.Optimize(PolyOptimizeFlags::CLOSE);
2912 bRet = true;
2913 }
2914 }
2915 else if (IsFlyFreeFrame())
2916 {
2917 const SwFlyFreeFrame* pSwFlyFreeFrame(static_cast< const SwFlyFreeFrame* >(this));
2918
2919 if(nullptr != pSwFlyFreeFrame &&
2920 pSwFlyFreeFrame->supportsAutoContour() &&
2921 // isTransformableSwFrame already used in supportsAutoContour(), but
2922 // better check twice when it may get changed there...
2923 pSwFlyFreeFrame->isTransformableSwFrame())
2924 {
2925 // RotateFlyFrame: use untransformed SwFrame to allow text floating around.
2926 // Will be transformed below
2927 const TransformableSwFrame* pTransformableSwFrame(pSwFlyFreeFrame->getTransformableSwFrame());
2928 const SwRect aFrameArea(pTransformableSwFrame->getUntransformedFrameArea());
2929 rContour = tools::PolyPolygon(tools::Polygon(aFrameArea.SVRect()));
2930 bRet = (0 != rContour.Count());
2931 }
2932 }
2933
2934 if(bRet && 0 != rContour.Count())
2935 {
2936 if (IsFlyFreeFrame() &&
2937 static_cast< const SwFlyFreeFrame* >(this)->isTransformableSwFrame())
2938 {
2939 // Need to adapt contour to transformation
2940 basegfx::B2DVector aScale, aTranslate;
2941 double fRotate, fShearX;
2942 getFrameAreaTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
2943
2944 if(!basegfx::fTools::equalZero(fRotate))
2945 {
2946 basegfx::B2DPolyPolygon aSource(rContour.getB2DPolyPolygon());
2948 const basegfx::B2DHomMatrix aRotateAroundCenter(
2950 aCenter.getX(),
2951 aCenter.getY(),
2952 fRotate));
2953 aSource.transform(aRotateAroundCenter);
2954 rContour = tools::PolyPolygon(aSource);
2955 }
2956 }
2957 }
2958 }
2959
2960 return bRet;
2961}
2962
2963
2965{
2966 return static_cast<const SwVirtFlyDrawObj*>(GetDrawObj());
2967}
2969{
2970 return static_cast<SwVirtFlyDrawObj*>(DrawObj());
2971}
2972
2973// implementation of pure virtual method declared in
2974// base class <SwAnchoredObject>
2975
2977{
2978 InvalidatePos();
2979 // #i68520#
2981}
2982
2984{
2985 OSL_ENSURE( GetFormat(),
2986 "<SwFlyFrame::GetFrameFormat()> - missing frame format -> crash." );
2987 return *GetFormat();
2988}
2990{
2991 OSL_ENSURE( GetFormat(),
2992 "<SwFlyFrame::GetFrameFormat()> - missing frame format -> crash." );
2993 return *GetFormat();
2994}
2995
2997{
2998 return getFrameArea();
2999}
3000
3001// #i70122#
3002// for Writer fly frames the bounding rectangle equals the object rectangles
3004{
3005 return GetObjRect();
3006}
3007
3008// #i68520#
3010{
3011 const bool bChanged( getFrameArea().Pos().getY() != _nTop );
3013 aFrm.Pos().setY(_nTop);
3014
3015 return bChanged;
3016}
3018{
3019 const bool bChanged( getFrameArea().Pos().getX() != _nLeft );
3021 aFrm.Pos().setX(_nLeft);
3022
3023 return bChanged;
3024}
3025
3032{
3033 // default behaviour is to do nothing.
3034}
3035
3037{
3038 // default behaviour is to do nothing.
3039}
3040
3046{
3048 !IsLocked() && !IsColLocked();
3049}
3050
3051void SwFlyFrame::GetAnchoredObjects( std::vector<SwAnchoredObject*>& aVector, const SwFormat& rFormat )
3052{
3053 SwIterator<SwFlyFrame,SwFormat> aIter( rFormat );
3054 for( SwFlyFrame* pFlyFrame = aIter.First(); pFlyFrame; pFlyFrame = aIter.Next() )
3055 aVector.push_back( pFlyFrame );
3056}
3057
3059{
3060 return static_cast< const SwFlyFrameFormat * >( GetDep() );
3061}
3062
3064{
3065 return static_cast< SwFlyFrameFormat * >( GetDep() );
3066}
3067
3068void SwFlyFrame::Calc(vcl::RenderContext* pRenderContext) const
3069{
3070 if ( !m_bValidContentPos )
3071 const_cast<SwFlyFrame*>(this)->PrepareMake(pRenderContext);
3072 else
3073 SwLayoutFrame::Calc(pRenderContext);
3074}
3075
3076SwTwips SwFlyFrame::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips nMinHeight, const SwTwips nUL)
3077{
3078 SwRectFnSet aRectFnSet(this);
3079 SwTwips nHeight = 0;
3080 if ( Lower() )
3081 {
3082 if ( Lower()->IsColumnFrame() )
3083 {
3084 FormatWidthCols( *pAttrs, nUL, nMinHeight );
3085 nHeight = aRectFnSet.GetHeight(Lower()->getFrameArea());
3086 }
3087 else
3088 {
3089 SwFrame *pFrame = Lower();
3090 while ( pFrame )
3091 {
3092 nHeight += aRectFnSet.GetHeight(pFrame->getFrameArea());
3093 if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() )
3094 // This TextFrame would like to be a bit larger
3095 nHeight += static_cast<SwTextFrame*>(pFrame)->GetParHeight()
3096 - aRectFnSet.GetHeight(pFrame->getFramePrintArea());
3097 else if( pFrame->IsSctFrame() && static_cast<SwSectionFrame*>(pFrame)->IsUndersized() )
3098 nHeight += static_cast<SwSectionFrame*>(pFrame)->Undersize();
3099 pFrame = pFrame->GetNext();
3100 }
3101 }
3102 if ( GetDrawObjs() )
3103 {
3104 const size_t nCnt = GetDrawObjs()->size();
3105 SwTwips nTop = aRectFnSet.GetTop(getFrameArea());
3106 SwTwips nBorder = aRectFnSet.GetHeight(getFrameArea()) -
3107 aRectFnSet.GetHeight(getFramePrintArea());
3108 for ( size_t i = 0; i < nCnt; ++i )
3109 {
3110 SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i];
3111 if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
3112 {
3113 // consider only Writer fly frames, which follow the text flow.
3114 if ( pFly->IsFlyLayFrame() &&
3115 pFly->getFrameArea().Top() != FAR_AWAY &&
3116 pFly->GetFormat()->GetFollowTextFlow().GetValue() )
3117 {
3118 SwTwips nDist = -aRectFnSet.BottomDist( pFly->getFrameArea(), nTop );
3119 if( nDist > nBorder + nHeight )
3120 nHeight = nDist - nBorder;
3121 }
3122 }
3123 }
3124 }
3125 }
3126 return nHeight;
3127}
3128
3130{
3131 switch(rItem.Which())
3132 {
3133 case RES_ATTRSET_CHG:
3134 return rItem.StaticWhichCast(RES_ATTRSET_CHG).GetChgSet()->GetItem(RES_ANCHOR, false);
3135 case RES_ANCHOR:
3136 return static_cast<const SwFormatAnchor*>(&rItem);
3137 default:
3138 return nullptr;
3139 }
3140}
3141
3143{
3144 return this;
3145}
3146
3148{
3149 return this;
3150}
3151
3152/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< SwFrameControl > SwFrameControlPtr
@ CONSIDER_WRAP_ON_OBJECT_POSITION
static OutputDevice * GetDefaultDevice()
Size GetPrefSize() const
MapMode GetPrefMapMode() const
GraphicType GetType() const
virtual SdrLayerID GetInvisibleControlsId() const =0
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetInvisibleHellId() const =0
virtual SdrLayerID GetHeavenId() const =0
virtual SdrLayerID GetControlsId() const =0
virtual SdrLayerID GetInvisibleHeavenId() const =0
virtual SwLayouter * GetLayouter()=0
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
size_t GetMarkCount() const
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
void BroadcastObjectChange() const
void SetUserCall(SdrObjUserCall *pUser)
sal_uInt32 GetOrdNum() const
void SetResizeProtect(bool bProt)
void SetMoveProtect(bool bProt)
virtual void SetChanged()
SdrPage * getSdrPageFromSdrObject() const
virtual SdrLayerID GetLayer() const
virtual void SetLayer(SdrLayerID nLayer)
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
bool GetValue() const
SfxHintId GetId() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
T & StaticWhichCast(TypedWhichId< T > nId)
sal_uInt16 Which() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static bool IsLocked()
Definition: frmtool.hxx:480
short GetTextFirstLineOffset() const
tools::Long GetRight() const
tools::Long GetLeft() const
bool IsPosProtected() const
bool IsSizeProtected() const
tools::Long GetRight() const
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetHeight(tools::Long n)
const Size & GetSize() const
void SetWidth(tools::Long n)
tools::Long GetTextLeft() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
class for the positioning of drawing objects
wrapper class for the positioning of Writer fly frames and drawing objects
void ClearTmpConsiderWrapInfluence()
const SwFrame * GetAnchorFrame() const
bool PositionLocked() const
SwTwips GetRelCharY(const SwFrame *pFrame) const
void ChgAnchorFrame(SwFrame *_pNewAnchorFrame)
SwTextFrame * FindAnchorCharFrame()
get frame, which contains the anchor character, if the object is anchored at-character or as-characte...
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint)=0
method to trigger notification of 'background'
SwFrame * AnchorFrame()
void ResetLayoutProcessBools()
const SwLayoutFrame * GetVertPosOrientFrame() const
void SetCurrRelPos(Point _aRelPos)
void SetDrawObj(SdrObject &_rDrawObj)
virtual SwFrameFormat & GetFrameFormat()=0
SwTwips GetRelCharX(const SwFrame *pFrame) const
SwPageFrame * GetPageFrame()
void ClearVertPosOrientFrame()
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
virtual void InvalidateObjPos()=0
method to invalidate position of the anchored object
virtual const SwFlyFrame * DynCastFlyFrame() const
void InvalidateObjRectWithSpaces() const
const SdrObject * GetDrawObj() const
virtual SwRect GetObjRect() const =0
SdrObject * DrawObj()
virtual bool IsFormatPossible() const
method to determine, if a format on the anchored object is possible
void UpdateObjInSortedList()
method to update anchored object in the <SwSortedObjs> lists
const Point & GetCurrRelPos() const
sal_uInt16 Count() const
Definition: hints.hxx:349
void ClearItem(sal_uInt16 nWhichL)
Definition: hints.cxx:122
const SwAttrSet * GetChgSet() const
What has changed.
Definition: hints.hxx:343
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:68
Container of body content (i.e.
Definition: bodyfrm.hxx:29
sal_uInt16 CalcRightLine() const
Definition: frmtool.hxx:530
const Size & GetSize() const
Definition: frmtool.hxx:414
sal_uInt16 CalcTopLine() const
Definition: frmtool.hxx:512
sal_uInt16 CalcLeftLine() const
Definition: frmtool.hxx:524
sal_uInt16 CalcBottomLine() const
Definition: frmtool.hxx:518
bool IsInDtor() const
Definition: doc.hxx:415
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
Definition: docfmt.cxx:452
SwNodes & GetNodes()
Definition: doc.hxx:420
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:413
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1331
ContactObject for connection of formats as representatives of draw objects in SwClient and the object...
Definition: dcontact.hxx:305
void DisconnectFromLayout(bool _bMoveMasterToInvisibleLayer=true)
Definition: dcontact.cxx:1675
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object.
Definition: dcontact.hxx:212
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
SwFrameControlsManager & GetFrameControlsManager()
Definition: edtwin.cxx:6834
static ObjCntType GetObjCntType(const SdrObject &rObj)
Definition: fefly1.cxx:1667
static SwVirtFlyDrawObj * CreateNewRef(SwFlyFrame *pFly, SwFlyFrameFormat *pFormat, SwFrame const &rAnchorFrame)
Definition: dcontact.cxx:527
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2964
SwFlyFrame * GetPrevLink() const
Definition: flyfrm.hxx:194
virtual void DestroyImpl() override
Definition: fly.cxx:320
void DeleteCnt()
Definition: fly.cxx:380
SwTwips Shrink_(SwTwips, bool bTst)
Definition: fly.cxx:2180
void MakeContentPos(const SwBorderAttrs &rAttrs)
Definition: fly.cxx:1879
virtual bool IsFormatPossible() const override
method to determine if a format on the Writer fly frame is possible
Definition: fly.cxx:3045
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:3058
bool IsFlyAtContentFrame() const
Definition: flyfrm.hxx:221
static const SwFormatAnchor * GetAnchorFromPoolItem(const SfxPoolItem &rItem)
Definition: fly.cxx:3129
bool IsFlySplitAllowed() const
Is this fly allowed to split across pages? (Disabled by default.)
Definition: fly.cxx:655
virtual bool SetObjLeft_(const SwTwips _nLeft) override
Definition: fly.cxx:3017
SwFlyFrame * FindChainNeighbour(SwFrameFormat const &rFormat, SwFrame *pAnch=nullptr)
Definition: fly.cxx:609
void SetNotifyBack()
Definition: flyfrm.hxx:228
virtual void InvalidateObjPos() override
method to invalidate position of the anchored object
Definition: fly.cxx:2976
bool IsLowerOf(const SwLayoutFrame *pUpper) const
Definition: fly.cxx:2331
SwFlyFrame * m_pPrevLink
Definition: flyfrm.hxx:95
void ActiveUnfloatButton(SwWrtShell *pWrtSh)
Definition: fly.cxx:2020
virtual const SwFlyFrame * DynCastFlyFrame() const override
Definition: fly.cxx:3142
void InsertColumns()
Definition: fly.cxx:291
bool m_bNotifyBack
Definition: flyfrm.hxx:108
void SelectionHasChanged(SwFEShell *pShell)
Definition: fly.cxx:1944
Size CalcRel(const SwFormatFrameSize &rSz) const
Definition: fly.cxx:2675
virtual SwFrameFormat & GetFrameFormat() override
Definition: fly.cxx:2983
void Invalidate_(SwPageFrame const *pPage=nullptr)
Definition: fly.cxx:1169
bool m_bLocked
Definition: flyfrm.hxx:105
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
Definition: fly.cxx:737
virtual SwRect GetObjBoundRect() const override
Definition: fly.cxx:3003
bool IsMinHeight() const
Definition: flyfrm.hxx:215
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
Definition: fly.cxx:1835
void UpdateAttr_(const SfxPoolItem *, const SfxPoolItem *, SwFlyFrameInvFlags &, SwAttrSetChg *pa=nullptr, SwAttrSetChg *pb=nullptr)
Definition: fly.cxx:816
void InsertCnt()
Definition: fly.cxx:271
SwTwips Grow_(SwTwips, bool bTst)
Definition: fly.cxx:2042
void NotifyDrawObj()
Definition: fly.cxx:2654
SwFlyFrame * GetNextLink() const
Definition: flyfrm.hxx:195
bool GetContour(tools::PolyPolygon &rContour, const bool _bForPaint=false) const
#i13147# - If called for paint and the <SwNoTextFrame> contains a graphic, load of intrinsic graphic ...
Definition: fly.cxx:2817
bool m_bWidthClipped
Definition: flyfrm.hxx:123
bool IsLocked() const
Definition: flyfrm.hxx:216
void Lock()
Definition: flyfrm.hxx:145
static void ChainFrames(SwFlyFrame *pMaster, SwFlyFrame *pFollow)
Definition: fly.cxx:511
bool IsFlyInContentFrame() const
Definition: flyfrm.hxx:218
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the Frame; Frame and PrtArea.
Definition: fly.cxx:1321
bool IsFlyLayFrame() const
Definition: flyfrm.hxx:220
SwTwips CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips nMinHeight, const SwTwips nUL)
Definition: fly.cxx:3076
virtual Size ChgSize(const Size &aNewSize) override
Definition: fly.cxx:2292
void MakePrtArea(const SwBorderAttrs &rAttrs)
Definition: fly.cxx:1864
void Chain(SwFrame *_pAnchor)
Definition: fly.cxx:240
virtual bool SetObjTop_(const SwTwips _nTop) override
Definition: fly.cxx:3009
bool m_bFormatHeightOnly
Definition: flyfrm.hxx:126
friend void Notify(SwFlyFrame *, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldPrt)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:3265
bool m_bMinHeight
Definition: flyfrm.hxx:119
virtual void RegisterAtPage(SwPageFrame &) override
Definition: fly.cxx:3036
void InitDrawObj(SwFrame const &)
Definition: fly.cxx:421
virtual void RegisterAtCorrectPage() override
method to assure that anchored object is registered at the correct page frame
Definition: fly.cxx:3031
bool IsShowUnfloatButton(SwWrtShell *pWrtSh) const
Definition: fly.cxx:1953
SwFrame * FindLastLower()
Definition: fly.cxx:665
void UpdateUnfloatButton(SwWrtShell *pWrtSh, bool bShow) const
Definition: fly.cxx:2031
void Unlock()
Definition: flyfrm.hxx:146
virtual const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() override
Definition: fly.cxx:367
virtual bool GetInfo(SfxPoolItem &) const override
Gets information from the Modify.
Definition: fly.cxx:1162
bool FrameSizeChg(const SwFormatFrameSize &)
Definition: fly.cxx:678
const Point & ContentPos() const
Definition: flyfrm.hxx:296
virtual void Calc(vcl::RenderContext *pRenderContext) const override
Definition: fly.cxx:3068
bool m_bValidContentPos
Definition: flyfrm.hxx:139
virtual void Cut() override
Definition: fly.cxx:2346
SwFlyFrame * m_pNextLink
Definition: flyfrm.hxx:95
static void UnchainFrames(SwFlyFrame *pMaster, SwFlyFrame *pFollow)
Definition: fly.cxx:561
bool IsFlyFreeFrame() const
Definition: flyfrm.hxx:219
bool m_bHeightClipped
Definition: flyfrm.hxx:122
SwFlyFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor, bool bFollow=false)
Definition: fly.cxx:139
virtual ~SwFlyFrame() override
Definition: fly.cxx:363
static void GetAnchoredObjects(std::vector< SwAnchoredObject * > &, const SwFormat &rFormat)
Definition: fly.cxx:3051
void Unchain()
Definition: fly.cxx:372
bool IsAutoPos() const
Definition: flyfrm.hxx:217
bool m_bInvalid
Definition: flyfrm.hxx:115
virtual SwRect GetObjRect() const override
Definition: fly.cxx:2996
void FinitDrawObj()
Definition: fly.cxx:460
void ChgRelPos(const Point &rAbsPos)
Change the relative position.
Definition: fly.cxx:1203
void InvalidateContentPos()
Definition: fly.cxx:1938
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: flylay.cxx:113
bool isTransformableSwFrame() const
Definition: flyfrms.hxx:134
bool supportsAutoContour() const
Definition: flylay.cxx:302
TransformableSwFrame * getTransformableSwFrame()
Definition: flyfrms.hxx:135
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:48
FlyAnchors.
Definition: fmtanchr.hxx:37
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:32
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
SwFormat * pChangedFormat
Definition: hints.hxx:75
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:969
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
sal_Int16 GetWidthPercentRelation() const
Definition: fmtfsize.hxx:92
sal_Int16 GetHeightPercentRelation() const
Definition: fmtfsize.hxx:89
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:100
void SetPosToggle(bool bNew)
Definition: fmtornt.hxx:103
void SetHoriOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:96
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
void SetRelationOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:97
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:95
void SetSurround(css::text::WrapTextMode eNew)
Definition: fmtsrnd.hxx:55
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
void SetVertOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:59
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:63
void SetRelationOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:60
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:57
Base class for various Writer styles.
Definition: format.hxx:47
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
const SvxOpaqueItem & GetOpaque(bool=true) const
Definition: frmatr.hxx:104
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:712
const SwFormatFlySplit & GetFlySplit(bool=true) const
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:113
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:106
const SwFormatFollowTextFlow & GetFollowTextFlow(bool=true) const
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:115
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SdrTextVertAdjustItem & GetTextVertAdjust(bool=true) const
Definition: frmatr.hxx:120
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:711
const SwRect & getFrameArea() const
Definition: frame.hxx:179
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
Definition: wsfrm.cxx:127
bool isFrameAreaPositionValid() const
Definition: frame.hxx:166
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
void setFramePrintAreaValid(bool bNew)
Definition: wsfrm.cxx:102
void setFrameAreaPositionValid(bool bNew)
Definition: wsfrm.cxx:86
bool isFramePrintAreaValid() const
Definition: frame.hxx:168
bool isFrameAreaSizeValid() const
Definition: frame.hxx:167
void setFrameAreaSizeValid(bool bNew)
Definition: wsfrm.cxx:94
A container for the Header/Footer, PageBreak, and Outline Content Visibility controls.
void SetUnfloatTableButton(const SwFlyFrame *pFlyFrame, bool bShow, Point aTopRightPixel=Point())
SwFrameControlPtr GetControl(FrameControlType eType, const SwFrame *pFrame)
Style of a layout element.
Definition: frmfmt.hxx:62
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2795
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool mbFixSize
Definition: frame.hxx:428
virtual void Cut()=0
const SwBodyFrame * FindBodyFrame() const
Definition: frame.hxx:1126
bool mbDerivedVert
Definition: frame.hxx:421
bool mbDerivedR2L
Definition: frame.hxx:418
std::unique_ptr< SwSortedObjs > m_pDrawObjs
Definition: frame.hxx:413
void RemoveFly(SwFlyFrame *pToRemove)
Definition: fly.cxx:2368
bool IsTextFrame() const
Definition: frame.hxx:1240
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
Definition: wsfrm.cxx:608
void SetDerivedR2L(bool bNew)
Definition: frame.hxx:636
bool IsInDtor() const
Definition: frame.hxx:898
void CheckDirChange()
checks the layout direction and invalidates the lower frames recursively, if necessary.
Definition: ssfrm.cxx:195
SwTwips Shrink(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1559
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1117
bool IsAccessibleFrame() const
Definition: frame.hxx:1256
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1121
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1105
SwFrame * FindNext()
Definition: frame.hxx:1147
SwFrame * GetNext()
Definition: frame.hxx:682
bool HasFixSize() const
Definition: frame.hxx:676
bool IsPageFrame() const
Definition: frame.hxx:1184
bool IsColLocked() const
Definition: frame.hxx:892
bool IsColumnFrame() const
Definition: frame.hxx:1188
SwFrameType mnFrameType
Definition: frame.hxx:414
void PrepareMake(vcl::RenderContext *pRenderContext)
Prepares the Frame for "formatting" (MakeAll()).
Definition: calcmove.cxx:246
bool IsTabFrame() const
Definition: frame.hxx:1224
void ColUnlock()
Definition: frame.hxx:449
void InvalidatePos_()
Definition: frame.hxx:793
SwFrameType GetType() const
Definition: frame.hxx:521
bool mbInvalidVert
Definition: frame.hxx:420
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1799
void InvalidateObjs(const bool _bNoInvaOfAsCharAnchoredObjs=true)
Definition: fly.cxx:2521
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:568
bool IsInTab() const
Definition: frame.hxx:961
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:482
SwFrame * FindPrev()
Definition: frame.hxx:1161
bool mbVertical
Definition: frame.hxx:422
SwFrame * GetLower()
Definition: findfrm.cxx:196
bool IsInFly() const
Definition: frame.hxx:967
void AppendFly(SwFlyFrame *pNew)
Definition: fly.cxx:2350
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
Definition: findfrm.cxx:762
void RemoveFromLayout()
Definition: wsfrm.cxx:1018
bool IsFlowFrame() const
Definition: frame.hxx:1248
void ColLock()
Definition: frame.hxx:448
bool mbRightToLeft
Definition: frame.hxx:419
void InvalidatePos()
Definition: frame.hxx:1049
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
bool IsVertical() const
Definition: frame.hxx:979
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
Definition: wsfrm.cxx:618
tools::Long GetPrtBottom() const
Definition: ssfrm.cxx:54
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
bool IsNoTextFrame() const
Definition: frame.hxx:1244
Point GetRelPos() const
Definition: trvlfrm.cxx:1807
void SetCompletePaint() const
Definition: frame.hxx:1000
virtual const SvxFormatBreakItem & GetBreakItem() const
Definition: findfrm.cxx:742
void RemoveDrawObj(SwAnchoredObject &_rToRemoveObj)
Definition: fly.cxx:2493
bool IsFlyFrame() const
Definition: frame.hxx:1216
bool mbInvalidR2L
Definition: frame.hxx:417
void InvalidatePrt_()
Definition: frame.hxx:785
void InvalidateSize_()
Definition: frame.hxx:777
bool IsSctFrame() const
Definition: frame.hxx:1220
void InvalidateSize()
Definition: frame.hxx:1035
bool mbVertLRBT
Definition: frame.hxx:425
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
sw::BroadcastingModify * GetDep()
use these so we can grep for SwFrame's GetRegisteredIn accesses beware that SwTextFrame may return sw...
Definition: frame.hxx:478
void AppendDrawObj(SwAnchoredObject &_rNewObj)
Definition: fly.cxx:2410
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:633
bool mbVertLR
Definition: frame.hxx:424
virtual const IDocumentDrawModelAccess & getIDocumentDrawModelAccess()
Definition: wsfrm.cxx:328
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:390
void SetDerivedVert(bool bNew)
Definition: frame.hxx:633
bool IsLayoutFrame() const
Definition: frame.hxx:1176
bool IsBodyFrame() const
Definition: frame.hxx:1212
bool IsColBodyFrame() const
These SwFrame inlines are here, so that frame.hxx does not need to include layfrm....
Definition: layfrm.hxx:210
bool IsInSct() const
Definition: frame.hxx:973
const GraphicObject & GetGrfObj(bool bWait=false) const
Definition: ndgrf.cxx:379
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
void ChgLowersProp(const Size &rOldSize)
Change size of lowers proportionally.
Definition: wsfrm.cxx:3051
void AdjustColumns(const SwFormatCol *pCol, bool bAdjustAttributes)
Definition: colfrm.cxx:313
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:233
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: calcmove.cxx:944
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:401
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method <ContainsAny()> doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:131
virtual void DestroyImpl() override
Definition: ssfrm.cxx:487
friend void RestoreContent(SwFrame *, SwLayoutFrame *, SwFrame *pSibling)
Definition: frmtool.cxx:3043
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1917
void NotifyLowerObjs(const bool _bUnlockPosOfObjs=false)
force an unlockposition call for the lower objects.
Definition: fly.cxx:2588
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:72
SwFrame * m_pLower
Definition: layfrm.hxx:53
friend SwFrame * SaveContent(SwLayoutFrame *, SwFrame *)
Definition: frmtool.cxx:2881
void ChgColumns(const SwFormatCol &rOld, const SwFormatCol &rNew, const bool bChgFootnote=false)
add or remove columns from a layoutframe.
Definition: colfrm.cxx:203
const SwFrame * Lower() const
Definition: layfrm.hxx:101
void FormatWidthCols(const SwBorderAttrs &, const SwTwips nBorder, const SwTwips nMinHeight)
Called by Format for Frames and Areas with columns.
Definition: wsfrm.cxx:3715
void InsertEndnotes(SwSectionFrame const *pSect)
Definition: layouter.cxx:230
static void CollectEndnotes(SwDoc *pDoc, SwSectionFrame *pSect)
Definition: layouter.cxx:267
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:30
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
Definition: ndnotxt.cxx:85
void GetContour(tools::PolyPolygon &rPoly) const
Definition: ndnotxt.cxx:164
const tools::PolyPolygon * HasContour() const
Definition: ndnotxt.cxx:105
Graphic GetGraphic() const
Definition: ndnotxt.cxx:229
void CreateContour()
Definition: ndnotxt.cxx:96
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:739
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:154
bool IsNoTextNode() const
Definition: node.hxx:699
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
static bool FormatObj(SwAnchoredObject &_rAnchoredObj, SwFrame *_pAnchorFrame=nullptr, const SwPageFrame *_pPageFrame=nullptr)
method to format a given floating screen object
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
A page of the document layout.
Definition: pagefrm.hxx:59
void AppendFlyToPage(SwFlyFrame *pNew)
Definition: flylay.cxx:801
void RemoveFlyFromPage(SwFlyFrame *pToRemove)
Definition: flylay.cxx:913
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:133
void RemoveDrawObjFromPage(SwAnchoredObject &_rToRemoveObj)
Definition: flylay.cxx:1129
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
Definition: flylay.cxx:1080
bool IsVert() const
Definition: frame.hxx:1372
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1387
void SetWidth(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1395
tools::Long GetWidth(const SwRect &rRect) const
Definition: frame.hxx:1386
void SetYMargins(SwFrame &rFrame, tools::Long nTop, tools::Long nBottom) const
Definition: frame.hxx:1413
void SetHeight(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1396
tools::Long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1382
bool IsVertL2R() const
Definition: frame.hxx:1373
Point GetPos(const SwRect &rRect) const
Definition: frame.hxx:1388
void SetXMargins(SwFrame &rFrame, tools::Long nLeft, tools::Long nRight) const
Definition: frame.hxx:1412
void AddBottom(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1399
void AddRight(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1401
tools::Long BottomDist(const SwRect &rRect, tools::Long nPos) const
Definition: frame.hxx:1419
tools::Long GetPrtBottom(const SwFrame &rFrame) const
Definition: frame.hxx:1415
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
bool HasArea() const
Definition: swrect.hxx:300
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:35
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void SSize(const Size &rNew)
Definition: swrect.hxx:180
void AddHeight(const tools::Long nAdd)
Definition: swrect.cxx:124
void AddWidth(const tools::Long nAdd)
Definition: swrect.cxx:123
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void Width(tools::Long nNew)
Definition: swrect.hxx:189
The root element of a Writer document layout.
Definition: rootfrm.hxx:83
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:210
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:393
void InvalidateBrowseWidth()
Definition: rootfrm.hxx:442
SwSection * GetSection()
Definition: sectfrm.hxx:97
bool IsEndnAtEnd() const
Definition: sectfrm.hxx:161
void CalcFootnoteContent()
Definition: sectfrm.cxx:2837
void SetFootnoteLock(bool bNew)
Definition: sectfrm.hxx:169
SwTwips Undersize()
Returns the size delta that the section would like to be greater if it has undersized TextFrames in i...
Definition: sectfrm.cxx:2830
bool IsFootnoteLock() const
Definition: sectfrm.hxx:170
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:173
class for collecting anchored objects
Definition: sortedobjs.hxx:49
size_t size() const
Definition: sortedobjs.cxx:43
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:49
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:166
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:869
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:448
SwTwips CalcFitToContent()
Simulates a formatting as if there were not right margin or Flys or other obstacles and returns the w...
Definition: txtfrm.cxx:3446
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
Definition: txtfrm.cxx:1267
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1293
bool IsReadonly() const
Definition: viewopt.hxx:629
bool getBrowseMode() const
Definition: viewopt.hxx:638
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
Definition: viewimp.hxx:287
void InvalidateAccessibleEditableState(bool bAllShells, const SwFrame *pFrame=nullptr)
Invalidate editable state for all accessible frames.
Definition: viewimp.cxx:418
void AddAccessibleObj(const SdrObject *pObj)
Definition: viewimp.hxx:310
void AddAccessibleFrame(const SwFrame *pFrame)
Add a frame in the accessible view.
Definition: viewimp.hxx:304
void InvalidateAccessibleRelationSet(const SwFlyFrame *pMaster, const SwFlyFrame *pFollow)
Invalidate frame's relation set (for chained frames)
Definition: viewimp.cxx:435
void DisposeAccessibleObj(const SdrObject *pObj, bool bCanSkipInvisible)
Definition: viewimp.hxx:293
SwDrawView * GetDrawView()
Definition: viewimp.hxx:164
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:347
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:434
SwViewShellImp * Imp()
Definition: viewsh.hxx:190
const SwRect & VisArea() const
Definition: viewsh.cxx:630
sal_Int32 GetBrowseWidth() const
Definition: viewsh.cxx:2088
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:556
const Size & GetBrowseBorder() const
Definition: viewsh.cxx:2083
SwEditWin & GetEditWin()
Definition: view.hxx:424
void SetRect() const
Definition: dflyobj.cxx:566
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
const SwView & GetView() const
Definition: wrtsh.hxx:443
RotateFlyFrame3: Helper class when you want to make your SwFrame derivate transformable.
Definition: frame.hxx:236
SwRect getUntransformedFrameArea() const
Definition: wsfrm.cxx:167
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void transform(const basegfx::B2DHomMatrix &rMatrix)
TYPE getX() const
TYPE getY() const
const Point & GetRelPos() const
calculated relative position for object
virtual void CalcPosition() override
calculate position for object
ring_container GetRingContainer()
Definition: ring.hxx:240
sal_uInt16 Count() const
::basegfx::B2DPolyPolygon getB2DPolyPolygon() const
void Clip(const tools::Rectangle &rRect)
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void Optimize(PolyOptimizeFlags nOptimizeFlags)
sal_uInt16 GetSize() const
Point LogicToPixel(const Point &rLogicPt) const
int nCount
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:172
bool CheckControlLayer(const SdrObject *pObj)
Definition: dcontact.cxx:683
URL aURL
virtual OUString GetURL() const override
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
@ OBJCNT_FLY
Definition: fesh.hxx:124
SwFlyFrame * GetFlyFromMarked(const SdrMarkList *pLst, SwViewShell *pSh)
Definition: feshview.cxx:139
void CalcContent(SwLayoutFrame *pLay, bool bNoColl)
Definition: fly.cxx:1513
static SwTwips lcl_CalcAutoWidth(const SwLayoutFrame &rFrame)
Definition: fly.cxx:2745
static SwPosition ResolveFlyAnchor(SwFrameFormat const &rFlyFrame)
Definition: fly.cxx:434
bool CalcClipRect(const SdrObject *pSdrObj, SwRect &rRect, bool bMove=true)
calculate rectangle in that the object can be moved or rather be resized
Definition: flylay.cxx:1195
SwFlyFrameInvFlags
Definition: flyfrm.hxx:57
@ Fixed
Frame cannot be moved in Var-direction.
@ Variable
Frame is variable in Var-direction.
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
SvxFrameDirection
#define FAR_AWAY
Definition: frmtool.hxx:53
void InsertCnt_(SwLayoutFrame *pLay, SwDoc *pDoc, SwNodeOffset nIndex, bool bPages=false, SwNodeOffset nEndIndex=SwNodeOffset(0), SwFrame *pPrv=nullptr, sw::FrameMode eMode=sw::FrameMode::New)
Definition: frmtool.cxx:1490
tools::Long FRound(double fVal)
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SwFormatURL > RES_URL(117)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatCol > RES_COL(115)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(105)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwFormatWrapInfluenceOnObjPos > RES_WRAP_INFLUENCE_ON_OBJPOS(132)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(106)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SdrTextVertAdjustItem > RES_TEXT_VERT_ADJUST(137)
constexpr TypedWhichId< SwFormatChain > RES_CHAIN(120)
constexpr TypedWhichId< SwFormatFlySplit > RES_FLY_SPLIT(129)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(107)
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(130)
constexpr TypedWhichId< SwAutoFormatGetDocNode > RES_AUTOFMT_DOCNODE(176)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
sal_Int32 nIndex
sal_Int16 nAdjust
const long LONG_MAX
tools::Long const nBorder
bool equalZero(const T &rfVal)
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
int i
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
sal_Int16 nId
const char GetValue[]
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:1020
SdrTextVertAdjust
SDRTEXTVERTADJUST_BOTTOM
SDRTEXTVERTADJUST_CENTER
SDRTEXTVERTADJUST_TOP
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
const SwContentNode * GetContentNode() const
Definition: pam.hxx:83
RndStdIds
tools::Long SwTwips
Definition: swtypes.hxx:51
@ FlyFrameAttributesChanged
@ AdjustSizeWithoutFormatting
#define MINFLY
Definition: swtypes.hxx:61
Left
void ClrContourCache(const SdrObject *pObj)
Definition: txtfly.cxx:137