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