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