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