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