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