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