LibreOffice Module sw (master)  1
frmform.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 <sal/config.h>
21 #include <sal/log.hxx>
22 
23 #include <bodyfrm.hxx>
24 #include <hintids.hxx>
25 #include <editeng/keepitem.hxx>
27 #include <pagefrm.hxx>
28 #include <ndtxt.hxx>
29 #include <dcontact.hxx>
30 #include <dflyobj.hxx>
31 #include <flyfrm.hxx>
32 #include <ftnfrm.hxx>
33 #include <txtftn.hxx>
34 #include <fmtftn.hxx>
35 #include <paratr.hxx>
36 #include <viewopt.hxx>
37 #include <viewsh.hxx>
38 #include <frmatr.hxx>
39 #include <pam.hxx>
40 #include <flyfrms.hxx>
41 #include <fmtanchr.hxx>
42 #include "itrform2.hxx"
43 #include "widorp.hxx"
44 #include "txtcache.hxx"
45 #include "porrst.hxx"
46 #include <blink.hxx>
47 #include "porfld.hxx"
48 #include <sectfrm.hxx>
49 #include "pormulti.hxx"
50 #include <rootfrm.hxx>
51 #include <frmfmt.hxx>
52 #include <sortedobjs.hxx>
53 #include "portab.hxx"
54 #include <editeng/lrspitem.hxx>
55 #include <editeng/tstpitem.hxx>
56 #include <redline.hxx>
57 #include <comphelper/lok.hxx>
58 
59 // Tolerance in formatting and text output
60 #define SLOPPY_TWIPS 5
61 
63 {
64  static sal_uInt16 nLevel;
65 public:
68  static sal_uInt16 GetLevel() { return nLevel; }
69  static bool LastLevel() { return 10 < nLevel; }
70 };
71 sal_uInt16 FormatLevel::nLevel = 0;
72 
73 void ValidateText( SwFrame *pFrame ) // Friend of frame
74 {
75  if ( ( ! pFrame->IsVertical() &&
76  pFrame->getFrameArea().Width() == pFrame->GetUpper()->getFramePrintArea().Width() ) ||
77  ( pFrame->IsVertical() &&
78  pFrame->getFrameArea().Height() == pFrame->GetUpper()->getFramePrintArea().Height() ) )
79  {
80  pFrame->setFrameAreaSizeValid(true);
81  }
82 }
83 
85 {
86  vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
87  // Validate surroundings to avoid oscillation
88  SwSwapIfSwapped swap( this );
89 
90  if ( !IsInFly() && !IsInTab() )
91  { // Only validate 'this' when inside a fly, the rest should actually only be
92  // needed for footnotes, which do not exist in flys.
93  SwSectionFrame* pSct = FindSctFrame();
94  if( pSct )
95  {
96  if( !pSct->IsColLocked() )
97  pSct->ColLock();
98  else
99  pSct = nullptr;
100  }
101 
102  SwFrame *pUp = GetUpper();
103  pUp->Calc(pRenderContext);
104  if( pSct )
105  pSct->ColUnlock();
106  }
107  ValidateText( this );
108 
109  // We at least have to save the MustFit flag!
110  OSL_ENSURE( HasPara(), "ResetPreps(), missing ParaPortion." );
111  if (SwParaPortion *pPara = GetPara())
112  {
113  const bool bMustFit = pPara->IsPrepMustFit();
114  ResetPreps();
115  pPara->SetPrepMustFit( bMustFit );
116  }
117 }
118 
119 // After a RemoveFootnote the BodyFrame and all Frames contained within it, need to be
120 // recalculated, so that the DeadLine is right.
121 // First we search outwards, on the way back we calculate everything.
122 static void ValidateBodyFrame_( SwFrame *pFrame )
123 {
124  vcl::RenderContext* pRenderContext = pFrame ? pFrame->getRootFrame()->GetCurrShell()->GetOut() : nullptr;
125  if( pFrame && !pFrame->IsCellFrame() )
126  {
127  if( !pFrame->IsBodyFrame() && pFrame->GetUpper() )
128  ValidateBodyFrame_( pFrame->GetUpper() );
129  if( !pFrame->IsSctFrame() )
130  pFrame->Calc(pRenderContext);
131  else
132  {
133  const bool bOld = static_cast<SwSectionFrame*>(pFrame)->IsContentLocked();
134  static_cast<SwSectionFrame*>(pFrame)->SetContentLock( true );
135  pFrame->Calc(pRenderContext);
136  if( !bOld )
137  static_cast<SwSectionFrame*>(pFrame)->SetContentLock( false );
138  }
139  }
140 }
141 
143 {
144  SwSwapIfSwapped swap( this );
145 
146  // See comment in ValidateFrame()
147  if ( !IsInFly() && !IsInTab() &&
148  !( IsInSct() && FindSctFrame()->Lower()->IsColumnFrame() ) )
150 }
151 
152 bool SwTextFrame::GetDropRect_( SwRect &rRect ) const
153 {
154  SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
155 
156  OSL_ENSURE( HasPara(), "SwTextFrame::GetDropRect_: try again next year." );
157  SwTextSizeInfo aInf( const_cast<SwTextFrame*>(this) );
158  SwTextMargin aLine( const_cast<SwTextFrame*>(this), &aInf );
159  if( aLine.GetDropLines() )
160  {
161  rRect.Top( aLine.Y() );
162  rRect.Left( aLine.GetLineStart() );
163  rRect.Height( aLine.GetDropHeight() );
164  rRect.Width( aLine.GetDropLeft() );
165 
166  if ( IsRightToLeft() )
167  SwitchLTRtoRTL( rRect );
168 
169  if ( IsVertical() )
171  return true;
172  }
173 
174  return false;
175 }
176 
178 {
179  vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
180  SwSwapIfSwapped swap( this );
181 
182  OSL_ENSURE( HasFollow(), "CalcFollow: missing Follow." );
183 
184  SwTextFrame* pMyFollow = GetFollow();
185 
186  SwParaPortion *pPara = GetPara();
187  const bool bFollowField = pPara && pPara->IsFollowField();
188 
189  if( !pMyFollow->GetOfst() || pMyFollow->GetOfst() != nTextOfst ||
190  bFollowField || pMyFollow->IsFieldFollow() ||
191  ( pMyFollow->IsVertical() && !pMyFollow->getFramePrintArea().Width() ) ||
192  ( ! pMyFollow->IsVertical() && !pMyFollow->getFramePrintArea().Height() ) )
193  {
194 #if OSL_DEBUG_LEVEL > 0
195  const SwFrame *pOldUp = GetUpper();
196 #endif
197 
198  SwRectFnSet aRectFnSet(this);
199  SwTwips nOldBottom = aRectFnSet.GetBottom(GetUpper()->getFrameArea());
200  SwTwips nMyPos = aRectFnSet.GetTop(getFrameArea());
201 
202  const SwPageFrame *pPage = nullptr;
203  bool bOldInvaContent = true;
204  if ( !IsInFly() && GetNext() )
205  {
206  pPage = FindPageFrame();
207  // Minimize (reset if possible) invalidations: see below
208  bOldInvaContent = pPage->IsInvalidContent();
209  }
210 
211  pMyFollow->SetOfst_( nTextOfst );
212  pMyFollow->SetFieldFollow( bFollowField );
213  if( HasFootnote() || pMyFollow->HasFootnote() )
214  {
215  ValidateFrame();
217  if( pPara )
218  {
219  pPara->GetReformat() = SwCharRange();
220  pPara->GetDelta() = 0;
221  }
222  }
223 
224  // The footnote area must not get larger
226 
227  pMyFollow->CalcFootnoteFlag();
228  if ( !pMyFollow->GetNext() && !pMyFollow->HasFootnote() )
229  nOldBottom = aRectFnSet.IsVert() ? 0 : LONG_MAX;
230 
231  // tdf#122892 check flag:
232  // 1. WidowsAndOrphans::FindWidows() determines follow is a widow
233  // 2. SwTextFrame::PrepWidows() calls SetPrepWidows() on master;
234  // if it can spare lines, master truncates one line
235  // 3. SwTextFrame::CalcPreps() on master (below);
236  // unless IsPrepMustFit(), if master hasn't shrunk via 2., it will SetWidow()
237  // 4. loop must exit then, because the follow didn't grow so nothing will ever change
238  while (!IsWidow())
239  {
240  if( !FormatLevel::LastLevel() )
241  {
242  // If the follow is contained within a column section or column
243  // frame, we need to calculate that first. This is because the
244  // FormatWidthCols() does not work if it is called from MakeAll
245  // of the _locked_ follow.
246  SwSectionFrame* pSct = pMyFollow->FindSctFrame();
247  if( pSct && !pSct->IsAnLower( this ) )
248  {
249  if( pSct->GetFollow() )
250  pSct->SimpleFormat();
251  else if( ( pSct->IsVertical() && !pSct->getFrameArea().Width() ) ||
252  ( ! pSct->IsVertical() && !pSct->getFrameArea().Height() ) )
253  break;
254  }
255  // i#11760 - Intrinsic format of follow is controlled.
256  if ( FollowFormatAllowed() )
257  {
258  // i#11760 - No nested format of follows, if
259  // text frame is contained in a column frame.
260  // Thus, forbid intrinsic format of follow.
261  {
262  bool bIsFollowInColumn = false;
263  SwFrame* pFollowUpper = pMyFollow->GetUpper();
264  while ( pFollowUpper )
265  {
266  if ( pFollowUpper->IsColumnFrame() )
267  {
268  bIsFollowInColumn = true;
269  break;
270  }
271  if ( pFollowUpper->IsPageFrame() ||
272  pFollowUpper->IsFlyFrame() )
273  {
274  break;
275  }
276  pFollowUpper = pFollowUpper->GetUpper();
277  }
278  if ( bIsFollowInColumn )
279  {
280  pMyFollow->ForbidFollowFormat();
281  }
282  }
283 
284  pMyFollow->Calc(pRenderContext);
285  // The Follow can tell from its getFrameArea().Height() that something went wrong
286  OSL_ENSURE( !pMyFollow->GetPrev(), "SwTextFrame::CalcFollow: cheesy follow" );
287  if( pMyFollow->GetPrev() )
288  {
289  pMyFollow->Prepare();
290  pMyFollow->Calc(pRenderContext);
291  OSL_ENSURE( !pMyFollow->GetPrev(), "SwTextFrame::CalcFollow: very cheesy follow" );
292  }
293 
294  // i#11760 - Reset control flag for follow format.
295  pMyFollow->AllowFollowFormat();
296  }
297 
298  // Make sure that the Follow gets painted
299  pMyFollow->SetCompletePaint();
300  }
301 
302  pPara = GetPara();
303  // As long as the Follow requests lines due to Orphans, it is
304  // passed these and is formatted again if possible
305  if( pPara && pPara->IsPrepWidows() )
306  CalcPreps();
307  else
308  break;
309  }
310 
311  if( HasFootnote() || pMyFollow->HasFootnote() )
312  {
314  ValidateFrame();
315  if( pPara )
316  {
317  pPara->GetReformat() = SwCharRange();
318  pPara->GetDelta() = 0;
319  }
320  }
321 
322  if ( pPage && !bOldInvaContent )
323  pPage->ValidateContent();
324 
325 #if OSL_DEBUG_LEVEL > 0
326  OSL_ENSURE( pOldUp == GetUpper(), "SwTextFrame::CalcFollow: heavy follow" );
327 #endif
328 
329  const long nRemaining =
330  - aRectFnSet.BottomDist( GetUpper()->getFrameArea(), nOldBottom );
331  if ( nRemaining > 0 && !GetUpper()->IsSctFrame() &&
332  nRemaining != ( aRectFnSet.IsVert() ?
333  nMyPos - getFrameArea().Right() :
334  getFrameArea().Top() - nMyPos ) )
335  {
336  return true;
337  }
338  }
339 
340  return false;
341 }
342 
344 {
346  // Inform LOK clients about change in position of redlines (if any)
348  {
349  SwTextNode const* pTextNode = GetTextNodeFirst();
350  const SwRedlineTable& rTable = pTextNode->getIDocumentRedlineAccess().GetRedlineTable();
351  for (SwRedlineTable::size_type nRedlnPos = 0; nRedlnPos < rTable.size(); ++nRedlnPos)
352  {
353  SwRangeRedline* pRedln = rTable[nRedlnPos];
354  if (pTextNode->GetIndex() == pRedln->GetPoint()->nNode.GetNode().GetIndex())
355  {
357  if (GetMergedPara()
359  && pRedln->GetPoint()->nNode != pRedln->GetMark()->nNode)
360  {
361  pTextNode = pRedln->End()->nNode.GetNode().GetTextNode();
362  }
363  }
364  }
365  }
366 }
367 
368 void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit )
369 {
370  vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
371  if( IsUndersized() )
372  {
373  if( GetOfst() && !IsFollow() ) // A scrolled paragraph (undersized)
374  return;
375  SetUndersized( nChgHght == 0 || bHasToFit );
376  }
377 
378  // AdjustFrame is called with a swapped frame during
379  // formatting but the frame is not swapped during FormatEmpty
380  SwSwapIfSwapped swap( this );
381  SwRectFnSet aRectFnSet(this);
382 
383  // The Frame's size variable is incremented by Grow or decremented by Shrink.
384  // If the size cannot change, nothing should happen!
385  if( nChgHght >= 0)
386  {
387  SwTwips nChgHeight = nChgHght;
388  if( nChgHght && !bHasToFit )
389  {
390  if( IsInFootnote() && !IsInSct() )
391  {
392  SwTwips nReal = Grow( nChgHght, true );
393  if( nReal < nChgHght )
394  {
395  SwTwips nBot = aRectFnSet.YInc( aRectFnSet.GetBottom(getFrameArea()),
396  nChgHght - nReal );
397  SwFrame* pCont = FindFootnoteFrame()->GetUpper();
398 
399  if( aRectFnSet.BottomDist( pCont->getFrameArea(), nBot ) > 0 )
400  {
402  aRectFnSet.AddBottom( aFrm, nChgHght );
403 
405 
406  if( aRectFnSet.IsVert() )
407  {
408  aPrt.SSize().AdjustWidth(nChgHght );
409  }
410  else
411  {
412  aPrt.SSize().AdjustHeight(nChgHght );
413  }
414 
415  return;
416  }
417  }
418  }
419 
420  Grow( nChgHght );
421 
422  if ( IsInFly() )
423  {
424  // If one of the Upper is a Fly, it's very likely that this fly changes its
425  // position by the Grow. Therefore, my position has to be corrected also or
426  // the check further down is not meaningful.
427  // The predecessors need to be calculated, so that the position can be
428  // calculated correctly.
429  if ( GetPrev() )
430  {
431  SwFrame *pPre = GetUpper()->Lower();
432  do
433  { pPre->Calc(pRenderContext);
434  pPre = pPre->GetNext();
435  } while ( pPre && pPre != this );
436  }
437  const Point aOldPos( getFrameArea().Pos() );
438  MakePos();
439  if ( aOldPos != getFrameArea().Pos() )
440  {
441  // i#28701 - No format is performed for the floating screen objects.
442  InvalidateObjs();
443  }
444  }
445  nChgHeight = 0;
446  }
447  // A Grow() is always accepted by the Layout, even if the
448  // FixSize of the surrounding layout frame should not allow it.
449  // We text for this case and correct the values.
450  // The Frame must NOT be shrunk further than its size permits
451  // even in the case of an emergency.
452  SwTwips nRstHeight;
453  if ( IsVertical() )
454  {
455  OSL_ENSURE( ! IsSwapped(),"Swapped frame while calculating nRstHeight" );
456 
457  if ( IsVertLR() )
458  nRstHeight = GetUpper()->getFrameArea().Left()
461  - getFrameArea().Left();
462  else
463  nRstHeight = getFrameArea().Left() + getFrameArea().Width() -
465  }
466  else
467  nRstHeight = GetUpper()->getFrameArea().Top()
470  - getFrameArea().Top();
471 
472  // We can get a bit of space in table cells, because there could be some
473  // left through a vertical alignment to the top.
474  // Assure that first lower in upper is the current one or is valid.
475  if ( IsInTab() &&
476  ( GetUpper()->Lower() == this ||
478  {
479  long nAdd = aRectFnSet.YDiff( aRectFnSet.GetTop(GetUpper()->Lower()->getFrameArea()),
480  aRectFnSet.GetPrtTop(*GetUpper()) );
481  OSL_ENSURE( nAdd >= 0, "Ey" );
482  nRstHeight += nAdd;
483  }
484 
485  // nRstHeight < 0 means that the TextFrame is located completely outside of its Upper.
486  // This can happen, if it's located within a FlyAtContentFrame, which changed sides by a
487  // Grow(). In such a case, it's wrong to execute the following Grow().
488  // In the case of a bug, we end up with an infinite loop.
489  SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
490  SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
491 
492  if( nRstHeight < nFrameHeight )
493  {
494  // It can be that I have the right size, but the Upper is too small and can get me some room
495  if( ( nRstHeight >= 0 || ( IsInFootnote() && IsInSct() ) ) && !bHasToFit )
496  nRstHeight += GetUpper()->Grow( nFrameHeight - nRstHeight );
497  // In column sections we do not want to get too big or else more areas are created by
498  // GetNextSctLeaf. Instead, we shrink and remember bUndersized, so that FormatWidthCols
499  // can calculate the right column size.
500  if ( nRstHeight < nFrameHeight )
501  {
502  if( bHasToFit || !IsMoveable() ||
503  ( IsInSct() && !FindSctFrame()->MoveAllowed(this) ) )
504  {
505  SetUndersized( true );
506  Shrink( std::min( ( nFrameHeight - nRstHeight), nPrtHeight ) );
507  }
508  else
509  SetUndersized( false );
510  }
511  }
512  else if( nChgHeight )
513  {
514  if( nRstHeight - nFrameHeight < nChgHeight )
515  nChgHeight = nRstHeight - nFrameHeight;
516  if( nChgHeight )
517  Grow( nChgHeight );
518  }
519  }
520  else
521  Shrink( -nChgHght );
522 }
523 
524 css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips CurrentPos )
525 {
526  css::uno::Sequence< css::style::TabStop > tabs(1);
527  css::style::TabStop ts;
528 
529  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this );
530  SwTextFormatter aLine( this, &aInf );
531  SwTextCursor TextCursor( this, &aInf );
532  const Point aCharPos( TextCursor.GetTopLeft() );
533 
534  SwTwips nRight = aLine.Right();
535  CurrentPos -= aCharPos.X();
536 
537  // get current tab stop information stored in the Frame
538  const SvxTabStop *pTS = aLine.GetLineInfo().GetTabStop( CurrentPos, nRight );
539 
540  if( !pTS )
541  {
542  return css::uno::Sequence< css::style::TabStop >();
543  }
544 
545  // copy tab stop information into a Sequence, which only contains one element.
546  ts.Position = pTS->GetTabPos();
547  ts.DecimalChar = pTS->GetDecimal();
548  ts.FillChar = pTS->GetFill();
549  switch( pTS->GetAdjustment() )
550  {
551  case SvxTabAdjust::Left : ts.Alignment = css::style::TabAlign_LEFT; break;
552  case SvxTabAdjust::Center : ts.Alignment = css::style::TabAlign_CENTER; break;
553  case SvxTabAdjust::Right : ts.Alignment = css::style::TabAlign_RIGHT; break;
554  case SvxTabAdjust::Decimal: ts.Alignment = css::style::TabAlign_DECIMAL; break;
555  case SvxTabAdjust::Default: ts.Alignment = css::style::TabAlign_DEFAULT; break;
556  default: break; // prevent warning
557  }
558 
559  tabs[0] = ts;
560  return tabs;
561 }
562 
563 // AdjustFollow expects the following situation:
564 // The SwTextIter points to the lower end of the Master, the Offset is set in the Follow.
565 // nOffset holds the Offset in the text string, from which the Master closes
566 // and the Follow starts.
567 // If it's 0, the FollowFrame is deleted.
569  const TextFrameIndex nOffset, const TextFrameIndex nEnd,
570  const sal_uInt8 nMode )
571 {
572  SwFrameSwapper aSwapper( this, false );
573 
574  // We got the rest of the text mass: Delete all Follows
575  // DummyPortions() are a special case.
576  // Special cases are controlled by parameter <nMode>.
577  if( HasFollow() && !(nMode & 1) && nOffset == nEnd )
578  {
579  while( GetFollow() )
580  {
581  if( GetFollow()->IsLocked() )
582  {
583  OSL_FAIL( "+SwTextFrame::JoinFrame: Follow is locked." );
584  return;
585  }
586  if (GetFollow()->IsDeleteForbidden())
587  return;
588  JoinFrame();
589  }
590 
591  return;
592  }
593 
594  // Dancing on the volcano: We'll just format the last line quickly
595  // for the QuoVadis stuff.
596  // The Offset can move of course:
597  const TextFrameIndex nNewOfst = (IsInFootnote() && (!GetIndNext() || HasFollow()))
598  ? rLine.FormatQuoVadis(nOffset) : nOffset;
599 
600  if( !(nMode & 1) )
601  {
602  // We steal text mass from our Follows
603  // It can happen that we have to join some of them
604  while( GetFollow() && GetFollow()->GetFollow() &&
605  nNewOfst >= GetFollow()->GetFollow()->GetOfst() )
606  {
607  JoinFrame();
608  }
609  }
610 
611  // The Offset moved
612  if( GetFollow() )
613  {
614  if ( nMode )
616 
617  if ( CalcFollow( nNewOfst ) ) // CalcFollow only at the end, we do a SetOfst there
618  rLine.SetOnceMore( true );
619  }
620 }
621 
623 {
624  OSL_ENSURE( GetFollow(), "+SwTextFrame::JoinFrame: no follow" );
625  SwTextFrame *pFoll = GetFollow();
626 
627  SwTextFrame *pNxt = pFoll->GetFollow();
628 
629  // All footnotes of the to-be-destroyed Follow are relocated to us
630  TextFrameIndex nStart = pFoll->GetOfst();
631  if ( pFoll->HasFootnote() )
632  {
633  SwFootnoteBossFrame *pFootnoteBoss = nullptr;
634  SwFootnoteBossFrame *pEndBoss = nullptr;
635  SwTextNode const* pNode(nullptr);
636  sw::MergedAttrIter iter(*pFoll);
637  for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
638  {
639  if (RES_TXTATR_FTN == pHt->Which()
640  && nStart <= pFoll->MapModelToView(pNode, pHt->GetStart()))
641  {
642  if (pHt->GetFootnote().IsEndNote())
643  {
644  if (!pEndBoss)
645  pEndBoss = pFoll->FindFootnoteBossFrame();
646  SwFootnoteBossFrame::ChangeFootnoteRef( pFoll, static_cast<const SwTextFootnote*>(pHt), this );
647  }
648  else
649  {
650  if (!pFootnoteBoss)
651  pFootnoteBoss = pFoll->FindFootnoteBossFrame( true );
652  SwFootnoteBossFrame::ChangeFootnoteRef( pFoll, static_cast<const SwTextFootnote*>(pHt), this );
653  }
654  SetFootnote( true );
655  }
656  }
657  }
658 
659 #ifdef DBG_UTIL
660  else if ( pFoll->isFramePrintAreaValid() ||
661  pFoll->isFrameAreaSizeValid() )
662  {
663  pFoll->CalcFootnoteFlag();
664  OSL_ENSURE( !pFoll->HasFootnote(), "Missing FootnoteFlag." );
665  }
666 #endif
667 
668  pFoll->MoveFlyInCnt( this, nStart, TextFrameIndex(COMPLETE_STRING) );
669  pFoll->SetFootnote( false );
670  // i#27138
671  // Notify accessibility paragraphs objects about changed CONTENT_FLOWS_FROM/_TO relation.
672  // Relation CONTENT_FLOWS_FROM for current next paragraph will change
673  // and relation CONTENT_FLOWS_TO for current previous paragraph, which
674  // is <this>, will change.
675  {
676  SwViewShell* pViewShell( pFoll->getRootFrame()->GetCurrShell() );
677  if ( pViewShell && pViewShell->GetLayout() &&
678  pViewShell->GetLayout()->IsAnyShellAccessible() )
679  {
681  dynamic_cast<SwTextFrame*>(pFoll->FindNextCnt( true )),
682  this );
683  }
684  }
685  pFoll->Cut();
686  SetFollow(pNxt);
687  SwFrame::DestroyFrame(pFoll);
688  return pNxt;
689 }
690 
692 {
693  SwSwapIfSwapped swap( this );
694 
695  // The Paste sends a Modify() to me
696  // I lock myself, so that my data does not disappear
697  TextFrameLockGuard aLock( this );
698  SwTextFrame *const pNew = static_cast<SwTextFrame *>(GetTextNodeFirst()->MakeFrame(this));
699 
700  pNew->SetFollow( GetFollow() );
701  SetFollow( pNew );
702 
703  pNew->Paste( GetUpper(), GetNext() );
704  // i#27138
705  // notify accessibility paragraphs objects about changed CONTENT_FLOWS_FROM/_TO relation.
706  // Relation CONTENT_FLOWS_FROM for current next paragraph will change
707  // and relation CONTENT_FLOWS_TO for current previous paragraph, which
708  // is <this>, will change.
709  {
710  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
711  if ( pViewShell && pViewShell->GetLayout() &&
712  pViewShell->GetLayout()->IsAnyShellAccessible() )
713  {
715  dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
716  this );
717  }
718  }
719 
720  // If footnotes end up in pNew bz our actions, we need
721  // to re-register them
722  if ( HasFootnote() )
723  {
724  SwFootnoteBossFrame *pFootnoteBoss = nullptr;
725  SwFootnoteBossFrame *pEndBoss = nullptr;
726  SwTextNode const* pNode(nullptr);
727  sw::MergedAttrIter iter(*this);
728  for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
729  {
730  if (RES_TXTATR_FTN == pHt->Which()
731  && nTextPos <= MapModelToView(pNode, pHt->GetStart()))
732  {
733  if (pHt->GetFootnote().IsEndNote())
734  {
735  if (!pEndBoss)
736  pEndBoss = FindFootnoteBossFrame();
737  SwFootnoteBossFrame::ChangeFootnoteRef( this, static_cast<const SwTextFootnote*>(pHt), pNew );
738  }
739  else
740  {
741  if (!pFootnoteBoss)
742  pFootnoteBoss = FindFootnoteBossFrame( true );
743  SwFootnoteBossFrame::ChangeFootnoteRef( this, static_cast<const SwTextFootnote*>(pHt), pNew );
744  }
745  pNew->SetFootnote( true );
746  }
747  }
748  }
749 
750 #ifdef DBG_UTIL
751  else
752  {
753  CalcFootnoteFlag( nTextPos - TextFrameIndex(1) );
754  OSL_ENSURE( !HasFootnote(), "Missing FootnoteFlag." );
755  }
756 #endif
757 
758  MoveFlyInCnt( pNew, nTextPos, TextFrameIndex(COMPLETE_STRING) );
759 
760  // No SetOfst or CalcFollow, because an AdjustFollow follows immediately anyways
761 
762  pNew->ManipOfst( nTextPos );
763 }
764 
766 {
767  // We do not need to invalidate out Follow.
768  // We are a Follow, get formatted right away and call
769  // SetOfst() from there
770  mnOffset = nNewOfst;
771  SwParaPortion *pPara = GetPara();
772  if( pPara )
773  {
774  SwCharRange &rReformat = pPara->GetReformat();
775  rReformat.Start() = TextFrameIndex(0);
776  rReformat.Len() = TextFrameIndex(GetText().getLength());
777  pPara->GetDelta() = sal_Int32(rReformat.Len());
778  }
779  InvalidateSize();
780 }
781 
783 {
784  OSL_ENSURE( ! IsVertical() || ! IsSwapped(), "SwTextFrame::CalcPreps with swapped frame" );
785  SwRectFnSet aRectFnSet(this);
786 
787  SwParaPortion *pPara = GetPara();
788  if ( !pPara )
789  return false;
790  const bool bPrep = pPara->IsPrep();
791  const bool bPrepWidows = pPara->IsPrepWidows();
792  const bool bPrepAdjust = pPara->IsPrepAdjust();
793  const bool bPrepMustFit = pPara->IsPrepMustFit();
794  ResetPreps();
795 
796  bool bRet = false;
797  if( bPrep && !pPara->GetReformat().Len() )
798  {
799  // PREP_WIDOWS means that the orphans rule got activated in the Follow.
800  // In unfortunate cases we could also have a PrepAdjust!
801  if( bPrepWidows )
802  {
803  if( !GetFollow() )
804  {
805  OSL_ENSURE( GetFollow(), "+SwTextFrame::CalcPreps: no credits" );
806  return false;
807  }
808 
809  // We need to prepare for two cases:
810  // We were able to hand over a few lines to the Follow
811  // -> we need to shrink
812  // or we need to go on the next page
813  // -> we let our Frame become too big
814 
815  SwTwips nChgHeight = GetParHeight();
816  if( nChgHeight >= aRectFnSet.GetHeight(getFramePrintArea()) )
817  {
818  if( bPrepMustFit )
819  {
820  GetFollow()->SetJustWidow( true );
821  GetFollow()->Prepare();
822  }
823  else if ( aRectFnSet.IsVert() )
824  {
825  {
827  aFrm.Width( aFrm.Width() + aFrm.Left() );
828  aFrm.Left( 0 );
829  }
830 
831  {
833  aPrt.Width( aPrt.Width() + getFrameArea().Left() );
834  }
835 
836  SetWidow( true );
837  }
838  else
839  {
840  SwTwips nTmp = TWIPS_MAX/2 - (getFrameArea().Top()+10000);
841  SwTwips nDiff = nTmp - getFrameArea().Height();
842 
843  {
845  aFrm.Height( nTmp );
846  }
847 
848  {
850  aPrt.Height( aPrt.Height() + nDiff );
851  }
852 
853  SetWidow( true );
854  }
855  }
856  else
857  {
858  OSL_ENSURE( nChgHeight < aRectFnSet.GetHeight(getFramePrintArea()),
859  "+SwTextFrame::CalcPrep: want to shrink" );
860 
861  nChgHeight = aRectFnSet.GetHeight(getFramePrintArea()) - nChgHeight;
862 
863  GetFollow()->SetJustWidow( true );
864  GetFollow()->Prepare();
865  Shrink( nChgHeight );
866  SwRect &rRepaint = pPara->GetRepaint();
867 
868  if ( aRectFnSet.IsVert() )
869  {
871  SwitchVerticalToHorizontal( aRepaint );
872  rRepaint.Chg( aRepaint.Pos(), aRepaint.SSize() );
873  }
874  else
875  rRepaint.Chg( getFrameArea().Pos() + getFramePrintArea().Pos(), getFramePrintArea().SSize() );
876 
877  if( 0 >= rRepaint.Width() )
878  rRepaint.Width(1);
879  }
880  bRet = true;
881  }
882  else if ( bPrepAdjust )
883  {
884  if ( HasFootnote() )
885  {
886  if( !CalcPrepFootnoteAdjust() )
887  {
888  if( bPrepMustFit )
889  {
890  SwTextLineAccess aAccess( this );
891  aAccess.GetPara()->SetPrepMustFit(true);
892  }
893  return false;
894  }
895  }
896 
897  {
898  SwSwapIfNotSwapped swap( this );
899 
900  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this );
901  SwTextFormatter aLine( this, &aInf );
902 
903  WidowsAndOrphans aFrameBreak( this );
904  // Whatever the attributes say: we split the paragraph in
905  // MustFit case if necessary
906  if( bPrepMustFit )
907  {
908  aFrameBreak.SetKeep( false );
909  aFrameBreak.ClrOrphLines();
910  }
911  // Before calling FormatAdjust, we need to make sure
912  // that the lines protruding at the bottom get indeed
913  // truncated
914  bool bBreak = aFrameBreak.IsBreakNowWidAndOrp( aLine );
915  bRet = true;
916  while( !bBreak && aLine.Next() )
917  {
918  bBreak = aFrameBreak.IsBreakNowWidAndOrp( aLine );
919  }
920  if( bBreak )
921  {
922  // We run into troubles: when TruncLines is called, the
923  // conditions in IsInside change immediately such that
924  // IsBreakNow can return different results.
925  // For this reason, we tell rFrameBreak that the
926  // end is reached at the location of rLine.
927  // Let's see if it works ...
928  aLine.TruncLines();
929  aFrameBreak.SetRstHeight( aLine );
930  FormatAdjust( aLine, aFrameBreak, TextFrameIndex(aInf.GetText().getLength()), aInf.IsStop() );
931  }
932  else
933  {
934  if( !GetFollow() )
935  {
936  FormatAdjust( aLine, aFrameBreak,
937  TextFrameIndex(aInf.GetText().getLength()), aInf.IsStop() );
938  }
939  else if ( !aFrameBreak.IsKeepAlways() )
940  {
941  // We delete a line before the Master, because the Follow
942  // could hand over a line
943  const SwCharRange aFollowRg(GetFollow()->GetOfst(), TextFrameIndex(1));
944  pPara->GetReformat() += aFollowRg;
945  // We should continue!
946  bRet = false;
947  }
948  }
949  }
950 
951  // A final check, if FormatAdjust() didn't help we need to
952  // truncate
953  if( bPrepMustFit )
954  {
955  const SwTwips nMust = aRectFnSet.GetPrtBottom(*GetUpper());
956  const SwTwips nIs = aRectFnSet.GetBottom(getFrameArea());
957 
958  if( aRectFnSet.IsVert() && nIs < nMust )
959  {
960  Shrink( nMust - nIs );
961 
962  if( getFramePrintArea().Width() < 0 )
963  {
965  aPrt.Width( 0 );
966  }
967 
968  SetUndersized( true );
969  }
970  else if ( ! aRectFnSet.IsVert() && nIs > nMust )
971  {
972  Shrink( nIs - nMust );
973 
974  if( getFramePrintArea().Height() < 0 )
975  {
977  aPrt.Height( 0 );
978  }
979 
980  SetUndersized( true );
981  }
982  }
983  }
984  }
985  pPara->SetPrepMustFit( bPrepMustFit );
986  return bRet;
987 }
988 
989 // We rewire the footnotes and the character bound objects
991 {
992  if( pFrame->GetOfst() < nNew )
993  pFrame->MoveFlyInCnt( this, TextFrameIndex(0), nNew );
994  else if( pFrame->GetOfst() > nNew )
995  MoveFlyInCnt( pFrame, nNew, TextFrameIndex(COMPLETE_STRING) );
996 }
997 
999  WidowsAndOrphans &rFrameBreak,
1000  TextFrameIndex const nStrLen,
1001  const bool bDummy )
1002 {
1003  SwSwapIfNotSwapped swap( this );
1004 
1005  SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
1006 
1007  TextFrameIndex nEnd = rLine.GetStart();
1008 
1009  const bool bHasToFit = pPara->IsPrepMustFit();
1010 
1011  // The StopFlag is set by footnotes which want to go onto the next page
1012  // Call base class method <SwTextFrameBreak::IsBreakNow(..)>
1013  // instead of method <WidowsAndOrphans::IsBreakNow(..)> to get a break,
1014  // even if due to widow rule no enough lines exists.
1015  sal_uInt8 nNew = ( !GetFollow() &&
1016  nEnd < nStrLen &&
1017  ( rLine.IsStop() ||
1018  ( bHasToFit
1019  ? ( rLine.GetLineNr() > 1 &&
1020  !rFrameBreak.IsInside( rLine ) )
1021  : rFrameBreak.IsBreakNow( rLine ) ) ) )
1022  ? 1 : 0;
1023  // i#84870
1024  // no split of text frame, which only contains a as-character anchored object
1025  bool bOnlyContainsAsCharAnchoredObj =
1026  !IsFollow() && nStrLen == TextFrameIndex(1) &&
1027  GetDrawObjs() && GetDrawObjs()->size() == 1 &&
1028  (*GetDrawObjs())[0]->GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR;
1029 
1030  // Still try split text frame if we have columns.
1031  if (FindColFrame())
1032  bOnlyContainsAsCharAnchoredObj = false;
1033 
1034  if ( nNew && bOnlyContainsAsCharAnchoredObj )
1035  {
1036  nNew = 0;
1037  }
1038 
1039  if ( nNew )
1040  {
1041  SplitFrame( nEnd );
1042  }
1043 
1044  const SwFrame *pBodyFrame = FindBodyFrame();
1045 
1046  const long nBodyHeight = pBodyFrame ? ( IsVertical() ?
1047  pBodyFrame->getFrameArea().Width() :
1048  pBodyFrame->getFrameArea().Height() ) : 0;
1049 
1050  // If the current values have been calculated, show that they
1051  // are valid now
1052  pPara->GetReformat() = SwCharRange();
1053  bool bDelta = pPara->GetDelta() != 0;
1054  pPara->GetDelta() = 0;
1055 
1056  if( rLine.IsStop() )
1057  {
1058  rLine.TruncLines( true );
1059  nNew = 1;
1060  }
1061 
1062  // FindBreak truncates the last line
1063  if( !rFrameBreak.FindBreak( this, rLine, bHasToFit ) )
1064  {
1065  // If we're done formatting, we set nEnd to the end.
1066  // AdjustFollow might execute JoinFrame() because of this.
1067  // Else, nEnd is the end of the last line in the Master.
1068  TextFrameIndex nOld = nEnd;
1069  nEnd = rLine.GetEnd();
1070  if( GetFollow() )
1071  {
1072  if( nNew && nOld < nEnd )
1073  RemoveFootnote( nOld, nEnd - nOld );
1074  ChangeOffset( GetFollow(), nEnd );
1075  if( !bDelta )
1076  GetFollow()->ManipOfst( nEnd );
1077  }
1078  }
1079  else
1080  { // If we pass over lines, we must not call Join in Follows, instead we even
1081  // need to create a Follow.
1082  // We also need to do this if the whole mass of text remains in the Master,
1083  // because a hard line break could necessitate another line (without text mass)!
1084  nEnd = rLine.GetEnd();
1085  if( GetFollow() )
1086  {
1087  // Another case for not joining the follow:
1088  // Text frame has no content, but a numbering. Then, do *not* join.
1089  // Example of this case: When an empty, but numbered paragraph
1090  // at the end of page is completely displaced by a fly frame.
1091  // Thus, the text frame introduced a follow by a
1092  // <SwTextFrame::SplitFrame(..)> - see below. The follow then shows
1093  // the numbering and must stay.
1094  if ( GetFollow()->GetOfst() != nEnd ||
1095  GetFollow()->IsFieldFollow() ||
1096  (nStrLen == TextFrameIndex(0) && GetTextNodeForParaProps()->GetNumRule()))
1097  {
1098  nNew |= 3;
1099  }
1100  else if (FindTabFrame() && nEnd > TextFrameIndex(0) &&
1101  rLine.GetInfo().GetChar(nEnd - TextFrameIndex(1)) == CH_BREAK)
1102  {
1103  // We are in a table, the paragraph has a follow and the text
1104  // ends with a hard line break. Don't join the follow just
1105  // because the follow would have no content, we may still need it
1106  // for the paragraph mark.
1107  nNew |= 1;
1108  }
1109  ChangeOffset( GetFollow(), nEnd );
1110  GetFollow()->ManipOfst( nEnd );
1111  }
1112  else
1113  {
1114  // Only split frame, if the frame contains
1115  // content or contains no content, but has a numbering.
1116  // i#84870 - No split, if text frame only contains one
1117  // as-character anchored object.
1118  if ( !bOnlyContainsAsCharAnchoredObj &&
1119  (nStrLen > TextFrameIndex(0) ||
1120  (nStrLen == TextFrameIndex(0) && GetTextNodeForParaProps()->GetNumRule()))
1121  )
1122  {
1123  SplitFrame( nEnd );
1124  nNew |= 3;
1125  }
1126  }
1127  // If the remaining height changed e.g by RemoveFootnote() we need to
1128  // fill up in order to avoid oscillation.
1129  if( bDummy && pBodyFrame &&
1130  nBodyHeight < ( IsVertical() ?
1131  pBodyFrame->getFrameArea().Width() :
1132  pBodyFrame->getFrameArea().Height() ) )
1133  rLine.MakeDummyLine();
1134  }
1135 
1136  // In AdjustFrame() we set ourselves via Grow/Shrink
1137  // In AdjustFollow() we set our FollowFrame
1138 
1139  const SwTwips nDocPrtTop = getFrameArea().Top() + getFramePrintArea().Top();
1140  const SwTwips nOldHeight = getFramePrintArea().SSize().Height();
1141  SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight;
1142 
1143  //#i84870# - no shrink of text frame, if it only contains one as-character anchored object.
1144  if ( nChg < 0 && !bDelta && bOnlyContainsAsCharAnchoredObj )
1145  {
1146  nChg = 0;
1147  }
1148 
1149  // Vertical Formatting:
1150  // The (rotated) repaint rectangle's x coordinate referes to the frame.
1151  // If the frame grows (or shirks) the repaint rectangle cannot simply
1152  // be rotated back after formatting, because we use the upper left point
1153  // of the frame for rotation. This point changes when growing/shrinking.
1154 
1155  if ( IsVertical() && !IsVertLR() && nChg )
1156  {
1157  SwRect &rRepaint = pPara->GetRepaint();
1158  rRepaint.Left( rRepaint.Left() - nChg );
1159  rRepaint.Width( rRepaint.Width() - nChg );
1160  }
1161 
1162  AdjustFrame( nChg, bHasToFit );
1163 
1164  if( HasFollow() || IsInFootnote() )
1165  AdjustFollow_( rLine, nEnd, nStrLen, nNew );
1166 
1167  pPara->SetPrepMustFit( false );
1168 }
1169 
1170 // bPrev is set whether Reformat.Start() was called because of Prev().
1171 // Else, wo don't know whether we can limit the repaint or not.
1172 bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
1173 {
1174  OSL_ENSURE( ! IsVertical() || IsSwapped(),
1175  "SwTextFrame::FormatLine( rLine, bPrev) with unswapped frame" );
1176  SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
1177  const SwLineLayout *pOldCur = rLine.GetCurr();
1178  const TextFrameIndex nOldLen = pOldCur->GetLen();
1179  const sal_uInt16 nOldAscent = pOldCur->GetAscent();
1180  const sal_uInt16 nOldHeight = pOldCur->Height();
1181  const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
1182  const bool bOldHyph = pOldCur->IsEndHyph();
1183  SwTwips nOldTop = 0;
1184  SwTwips nOldBottom = 0;
1185  if( rLine.GetCurr()->IsClipping() )
1186  rLine.CalcUnclipped( nOldTop, nOldBottom );
1187 
1188  TextFrameIndex const nNewStart = rLine.FormatLine( rLine.GetStart() );
1189 
1190  OSL_ENSURE( getFrameArea().Pos().Y() + getFramePrintArea().Pos().Y() == rLine.GetFirstPos(),
1191  "SwTextFrame::FormatLine: frame leaves orbit." );
1192  OSL_ENSURE( rLine.GetCurr()->Height(),
1193  "SwTextFrame::FormatLine: line height is zero" );
1194 
1195  // The current line break object
1196  const SwLineLayout *pNew = rLine.GetCurr();
1197 
1198  bool bUnChg = nOldLen == pNew->GetLen() &&
1199  bOldHyph == pNew->IsEndHyph();
1200  if ( bUnChg && !bPrev )
1201  {
1202  const long nWidthDiff = nOldWidth > pNew->Width()
1203  ? nOldWidth - pNew->Width()
1204  : pNew->Width() - nOldWidth;
1205 
1206  // we only declare a line as unchanged, if its main values have not
1207  // changed and it is not the last line (!paragraph end symbol!)
1208  bUnChg = nOldHeight == pNew->Height() &&
1209  nOldAscent == pNew->GetAscent() &&
1210  nWidthDiff <= SLOPPY_TWIPS &&
1211  pOldCur->GetNext();
1212  }
1213 
1214  // Calculate rRepaint
1215  const SwTwips nBottom = rLine.Y() + rLine.GetLineHeight();
1216  SwRepaint &rRepaint = pPara->GetRepaint();
1217  if( bUnChg && rRepaint.Top() == rLine.Y()
1218  && (bPrev || nNewStart <= pPara->GetReformat().Start())
1219  && (nNewStart < TextFrameIndex(GetText().getLength())))
1220  {
1221  rRepaint.Top( nBottom );
1222  rRepaint.Height( 0 );
1223  }
1224  else
1225  {
1226  if( nOldTop )
1227  {
1228  if( nOldTop < rRepaint.Top() )
1229  rRepaint.Top( nOldTop );
1230  if( !rLine.IsUnclipped() || nOldBottom > rRepaint.Bottom() )
1231  {
1232  rRepaint.Bottom( nOldBottom - 1 );
1233  rLine.SetUnclipped( true );
1234  }
1235  }
1236  if( rLine.GetCurr()->IsClipping() && rLine.IsFlyInCntBase() )
1237  {
1238  SwTwips nTmpTop, nTmpBottom;
1239  rLine.CalcUnclipped( nTmpTop, nTmpBottom );
1240  if( nTmpTop < rRepaint.Top() )
1241  rRepaint.Top( nTmpTop );
1242  if( !rLine.IsUnclipped() || nTmpBottom > rRepaint.Bottom() )
1243  {
1244  rRepaint.Bottom( nTmpBottom - 1 );
1245  rLine.SetUnclipped( true );
1246  }
1247  }
1248  else
1249  {
1250  if( !rLine.IsUnclipped() || nBottom > rRepaint.Bottom() )
1251  {
1252  rRepaint.Bottom( nBottom - 1 );
1253  rLine.SetUnclipped( false );
1254  }
1255  }
1256  SwTwips nRght = std::max( nOldWidth, pNew->Width() +
1257  pNew->GetHangingMargin() );
1259  const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : nullptr;
1260  if( pOpt && (pOpt->IsParagraph() || pOpt->IsLineBreak()) )
1261  nRght += ( std::max( nOldAscent, pNew->GetAscent() ) );
1262  else
1263  nRght += ( std::max( nOldAscent, pNew->GetAscent() ) / 4);
1264  nRght += rLine.GetLeftMargin();
1265  if( rRepaint.GetOfst() || rRepaint.GetRightOfst() < nRght )
1266  rRepaint.SetRightOfst( nRght );
1267 
1268  // Finally we enlarge the repaint rectangle if we found an underscore
1269  // within our line. 40 Twips should be enough
1270  const bool bHasUnderscore =
1271  ( rLine.GetInfo().GetUnderScorePos() < nNewStart );
1272  if ( bHasUnderscore || rLine.GetCurr()->HasUnderscore() )
1273  rRepaint.Bottom( rRepaint.Bottom() + 40 );
1274 
1275  const_cast<SwLineLayout*>(rLine.GetCurr())->SetUnderscore( bHasUnderscore );
1276  }
1277 
1278  // Calculating the good ol' nDelta
1279  pPara->GetDelta() -= sal_Int32(pNew->GetLen()) - sal_Int32(nOldLen);
1280 
1281  // Stop!
1282  if( rLine.IsStop() )
1283  return false;
1284 
1285  // Absolutely another line
1286  if( rLine.IsNewLine() )
1287  return true;
1288 
1289  // Until the String's end?
1290  if (nNewStart >= TextFrameIndex(GetText().getLength()))
1291  return false;
1292 
1293  if( rLine.GetInfo().IsShift() )
1294  return true;
1295 
1296  // Reached the Reformat's end?
1297  const TextFrameIndex nEnd = pPara->GetReformat().Start() +
1298  pPara->GetReformat().Len();
1299 
1300  if( nNewStart <= nEnd )
1301  return true;
1302 
1303  return 0 != pPara->GetDelta();
1304 }
1305 
1307  const bool bAdjust )
1308 {
1309  OSL_ENSURE( ! IsVertical() || IsSwapped(),"SwTextFrame::Format_ with unswapped frame" );
1310 
1311  SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
1312  rLine.SetUnclipped( false );
1313 
1314  const OUString & rString = GetText();
1315  const TextFrameIndex nStrLen(rString.getLength());
1316 
1317  SwCharRange &rReformat = pPara->GetReformat();
1318  SwRepaint &rRepaint = pPara->GetRepaint();
1319  std::unique_ptr<SwRepaint> pFreeze;
1320 
1321  // Due to performance reasons we set rReformat to COMPLETE_STRING in Init()
1322  // In this case we adjust rReformat
1323  if( rReformat.Len() > nStrLen )
1324  rReformat.Len() = nStrLen;
1325 
1326  if( rReformat.Start() + rReformat.Len() > nStrLen )
1327  rReformat.Len() = nStrLen - rReformat.Start();
1328 
1329  SwTwips nOldBottom;
1330  if( GetOfst() && !IsFollow() )
1331  {
1332  rLine.Bottom();
1333  nOldBottom = rLine.Y();
1334  rLine.Top();
1335  }
1336  else
1337  nOldBottom = 0;
1338  rLine.CharToLine( rReformat.Start() );
1339 
1340  // When inserting or removing a Space, words can be moved out of the edited
1341  // line and into the preceding line, hence the preceding line must be
1342  // formatted as well.
1343  // Optimization: If rReformat starts after the first word of the line,
1344  // this line cannot possibly influence the previous one.
1345  // ...Turns out that unfortunately it can: Text size changes + FlyFrames;
1346  // the feedback can affect multiple lines (Frames!)!
1347 
1348  // i#46560
1349  // FME: Yes, consider this case: "(word )" has to go to the next line
1350  // because ")" is a forbidden character at the beginning of a line although
1351  // "(word" would still fit on the previous line. Adding text right in front
1352  // of ")" would not trigger a reformatting of the previous line. Adding 1
1353  // to the result of FindBrk() does not solve the problem in all cases,
1354  // nevertheless it should be sufficient.
1355  bool bPrev = rLine.GetPrev() &&
1356  (FindBrk(rString, rLine.GetStart(), rReformat.Start() + TextFrameIndex(1))
1357  // i#46560
1358  + TextFrameIndex(1)
1359  >= rReformat.Start() ||
1360  rLine.GetCurr()->IsRest() );
1361  if( bPrev )
1362  {
1363  while( rLine.Prev() )
1364  if( rLine.GetCurr()->GetLen() && !rLine.GetCurr()->IsRest() )
1365  {
1366  if( !rLine.GetStart() )
1367  rLine.Top(); // So that NumDone doesn't get confused
1368  break;
1369  }
1370  TextFrameIndex nNew = rLine.GetStart() + rLine.GetLength();
1371  if( nNew )
1372  {
1373  --nNew;
1374  if (CH_BREAK == rString[sal_Int32(nNew)])
1375  {
1376  ++nNew;
1377  rLine.Next();
1378  bPrev = false;
1379  }
1380  }
1381  rReformat.Len() += rReformat.Start() - nNew;
1382  rReformat.Start() = nNew;
1383  }
1384 
1385  rRepaint.SetOfst( 0 );
1386  rRepaint.SetRightOfst( 0 );
1387  rRepaint.Chg( getFrameArea().Pos() + getFramePrintArea().Pos(), getFramePrintArea().SSize() );
1388  if( pPara->IsMargin() )
1389  rRepaint.Width( rRepaint.Width() + pPara->GetHangingMargin() );
1390  rRepaint.Top( rLine.Y() );
1391  if( 0 >= rRepaint.Width() )
1392  rRepaint.Width(1);
1393  WidowsAndOrphans aFrameBreak( this, rInf.IsTest() ? 1 : 0 );
1394 
1395  // rLine is now set to the first line which needs formatting.
1396  // The bFirst flag makes sure that Next() is not called.
1397  // The whole thing looks weird, but we need to make sure that
1398  // rLine stops at the last non-fitting line when calling IsBreakNow.
1399  bool bFirst = true;
1400  bool bFormat = true;
1401 
1402  // The CharToLine() can also get us into the danger zone.
1403  // In that case we need to walk back until rLine is set
1404  // to the non-fitting line. Or else the mass of text is lost,
1405  // because the Ofst was set wrongly in the Follow.
1406 
1407  bool bBreak = ( !pPara->IsPrepMustFit() || rLine.GetLineNr() > 1 )
1408  && aFrameBreak.IsBreakNowWidAndOrp( rLine );
1409  if( bBreak )
1410  {
1411  bool bPrevDone = nullptr != rLine.Prev();
1412  while( bPrevDone && aFrameBreak.IsBreakNowWidAndOrp(rLine) )
1413  bPrevDone = nullptr != rLine.Prev();
1414  if( bPrevDone )
1415  {
1416  aFrameBreak.SetKeep( false );
1417  rLine.Next();
1418  }
1419  rLine.TruncLines();
1420 
1421  // Play it safe
1422  aFrameBreak.IsBreakNowWidAndOrp(rLine);
1423  }
1424 
1425  /* Meaning if the following flags are set:
1426 
1427  Watch(End/Mid)Hyph: we need to format if we have a break at
1428  the line end/Fly, as long as MaxHyph is reached
1429 
1430  Jump(End/Mid)Flag: the next line which has no break (line end/Fly),
1431  needs to be formatted, because we could wrap now. This might have been
1432  forbidden earlier by MaxHyph
1433 
1434  Watch(End/Mid)Hyph: if the last formatted line got a cutoff point, but
1435  didn't have one before
1436 
1437  Jump(End/Mid)Hyph: if a cutoff point disappears
1438  */
1439  bool bJumpEndHyph = false;
1440  bool bWatchEndHyph = false;
1441  bool bJumpMidHyph = false;
1442  bool bWatchMidHyph = false;
1443 
1444  const SwAttrSet& rAttrSet = GetTextNodeForParaProps()->GetSwAttrSet();
1445  rInf.MaxHyph() = rAttrSet.GetHyphenZone().GetMaxHyphens();
1446  bool bMaxHyph = 0 != rInf.MaxHyph();
1447  if ( bMaxHyph )
1448  rLine.InitCntHyph();
1449 
1450  if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() )
1451  {
1452  SwTextFrame *pMaster = FindMaster();
1453  OSL_ENSURE( pMaster, "SwTextFrame::Format: homeless follow" );
1454  const SwLineLayout* pLine=nullptr;
1455  if (pMaster)
1456  {
1457  if (!pMaster->HasPara())
1458  { // master could be locked because it's being formatted upstack
1459  SAL_WARN("sw", "SwTextFrame::Format_: master not formatted!");
1460  }
1461  else
1462  {
1463  SwTextSizeInfo aInf( pMaster );
1464  SwTextIter aMasterLine( pMaster, &aInf );
1465  aMasterLine.Bottom();
1466  pLine = aMasterLine.GetCurr();
1467  assert(aMasterLine.GetEnd() == GetOfst());
1468  }
1469  }
1470  SwLinePortion* pRest = pLine ?
1471  rLine.MakeRestPortion(pLine, GetOfst()) : nullptr;
1472  if( pRest )
1473  rInf.SetRest( pRest );
1474  else
1475  SetFieldFollow( false );
1476  }
1477 
1478  /* Ad cancel criterion:
1479  * In order to recognize, whether a line does not fit onto the page
1480  * anymore, we need to format it. This overflow is removed again in
1481  * e.g. AdjustFollow.
1482  * Another complication: if we are the Master, we need to traverse
1483  * the lines, because it could happen that one line can overflow
1484  * from the Follow to the Master.
1485  */
1486  do
1487  {
1488  if( bFirst )
1489  bFirst = false;
1490  else
1491  {
1492  if ( bMaxHyph )
1493  {
1494  if ( rLine.GetCurr()->IsEndHyph() )
1495  rLine.CntEndHyph()++;
1496  else
1497  rLine.CntEndHyph() = 0;
1498  if ( rLine.GetCurr()->IsMidHyph() )
1499  rLine.CntMidHyph()++;
1500  else
1501  rLine.CntMidHyph() = 0;
1502  }
1503  if( !rLine.Next() )
1504  {
1505  if( !bFormat )
1506  {
1507  SwLinePortion* pRest =
1508  rLine.MakeRestPortion( rLine.GetCurr(), rLine.GetEnd() );
1509  if( pRest )
1510  rInf.SetRest( pRest );
1511  }
1512  rLine.Insert( new SwLineLayout() );
1513  rLine.Next();
1514  bFormat = true;
1515  }
1516  }
1517  if ( !bFormat && bMaxHyph &&
1518  (bWatchEndHyph || bJumpEndHyph || bWatchMidHyph || bJumpMidHyph) )
1519  {
1520  if ( rLine.GetCurr()->IsEndHyph() )
1521  {
1522  if ( bWatchEndHyph )
1523  bFormat = ( rLine.CntEndHyph() == rInf.MaxHyph() );
1524  }
1525  else
1526  {
1527  bFormat = bJumpEndHyph;
1528  bWatchEndHyph = false;
1529  bJumpEndHyph = false;
1530  }
1531  if ( rLine.GetCurr()->IsMidHyph() )
1532  {
1533  if ( bWatchMidHyph && !bFormat )
1534  bFormat = ( rLine.CntEndHyph() == rInf.MaxHyph() );
1535  }
1536  else
1537  {
1538  bFormat |= bJumpMidHyph;
1539  bWatchMidHyph = false;
1540  bJumpMidHyph = false;
1541  }
1542  }
1543  if( bFormat )
1544  {
1545  const bool bOldEndHyph = rLine.GetCurr()->IsEndHyph();
1546  const bool bOldMidHyph = rLine.GetCurr()->IsMidHyph();
1547  bFormat = FormatLine( rLine, bPrev );
1548  // There can only be one bPrev ... (???)
1549  bPrev = false;
1550  if ( bMaxHyph )
1551  {
1552  if ( rLine.GetCurr()->IsEndHyph() != bOldEndHyph )
1553  {
1554  bWatchEndHyph = !bOldEndHyph;
1555  bJumpEndHyph = bOldEndHyph;
1556  }
1557  if ( rLine.GetCurr()->IsMidHyph() != bOldMidHyph )
1558  {
1559  bWatchMidHyph = !bOldMidHyph;
1560  bJumpMidHyph = bOldMidHyph;
1561  }
1562  }
1563  }
1564 
1565  if( !rInf.IsNewLine() )
1566  {
1567  if( !bFormat )
1568  bFormat = nullptr != rInf.GetRest();
1569  if( rInf.IsStop() || rInf.GetIdx() >= nStrLen )
1570  break;
1571  if( !bFormat && ( !bMaxHyph || ( !bWatchEndHyph &&
1572  !bJumpEndHyph && !bWatchMidHyph && !bJumpMidHyph ) ) )
1573  {
1574  if( GetFollow() )
1575  {
1576  while( rLine.Next() )
1577  ; //Nothing
1578  pFreeze.reset(new SwRepaint( rRepaint )); // to minimize painting
1579  }
1580  else
1581  break;
1582  }
1583  }
1584  bBreak = aFrameBreak.IsBreakNowWidAndOrp(rLine);
1585  }while( !bBreak );
1586 
1587  if( pFreeze )
1588  {
1589  rRepaint = *pFreeze;
1590  pFreeze.reset();
1591  }
1592 
1593  if( !rLine.IsStop() )
1594  {
1595  // If we're finished formatting the text and we still
1596  // have other line objects left, these are superfluous
1597  // now because the text has gotten shorter.
1598  if( rLine.GetStart() + rLine.GetLength() >= nStrLen &&
1599  rLine.GetCurr()->GetNext() )
1600  {
1601  rLine.TruncLines();
1602  rLine.SetTruncLines( true );
1603  }
1604  }
1605 
1606  if( !rInf.IsTest() )
1607  {
1608  // FormatAdjust does not pay off at OnceMore
1609  if( bAdjust || !rLine.GetDropFormat() || !rLine.CalcOnceMore() )
1610  {
1611  FormatAdjust( rLine, aFrameBreak, nStrLen, rInf.IsStop() );
1612  }
1613  if( rRepaint.HasArea() )
1614  SetRepaint();
1615  rLine.SetTruncLines( false );
1616  if( nOldBottom ) // We check whether paragraphs that need scrolling can
1617  // be shrunk, so that they don't need scrolling anymore
1618  {
1619  rLine.Bottom();
1620  SwTwips nNewBottom = rLine.Y();
1621  if( nNewBottom < nOldBottom )
1623  }
1624  }
1625 }
1626 
1628 {
1629  OSL_ENSURE( ! IsVertical() || IsSwapped(),
1630  "A frame is not swapped in SwTextFrame::FormatOnceMore" );
1631 
1632  SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
1633  if( !pPara )
1634  return;
1635 
1636  // If necessary the pPara
1637  sal_uInt16 nOld = static_cast<const SwTextMargin&>(rLine).GetDropHeight();
1638  bool bShrink = false;
1639  bool bGrow = false;
1640  bool bGoOn = rLine.IsOnceMore();
1641  sal_uInt8 nGo = 0;
1642  while( bGoOn )
1643  {
1644  ++nGo;
1645  rInf.Init();
1646  rLine.Top();
1647  if( !rLine.GetDropFormat() )
1648  rLine.SetOnceMore( false );
1649  SwCharRange aRange(TextFrameIndex(0), TextFrameIndex(rInf.GetText().getLength()));
1650  pPara->GetReformat() = aRange;
1651  Format_( rLine, rInf );
1652 
1653  bGoOn = rLine.IsOnceMore();
1654  if( bGoOn )
1655  {
1656  const sal_uInt16 nNew = static_cast<const SwTextMargin&>(rLine).GetDropHeight();
1657  if( nOld == nNew )
1658  bGoOn = false;
1659  else
1660  {
1661  if( nOld > nNew )
1662  bShrink = true;
1663  else
1664  bGrow = true;
1665 
1666  if( bShrink == bGrow || 5 < nGo )
1667  bGoOn = false;
1668 
1669  nOld = nNew;
1670  }
1671 
1672  // If something went wrong, we need to reformat again
1673  if( !bGoOn )
1674  {
1675  rInf.CtorInitTextFormatInfo( getRootFrame()->GetCurrShell()->GetOut(), this );
1676  rLine.CtorInitTextFormatter( this, &rInf );
1677  rLine.SetDropLines( 1 );
1678  rLine.CalcDropHeight( 1 );
1679  SwCharRange aTmpRange(TextFrameIndex(0), TextFrameIndex(rInf.GetText().getLength()));
1680  pPara->GetReformat() = aTmpRange;
1681  Format_( rLine, rInf, true );
1682  // We paint everything ...
1683  SetCompletePaint();
1684  }
1685  }
1686  }
1687 }
1688 
1690 {
1691  const bool bIsEmpty = GetText().isEmpty();
1692 
1693  if ( bIsEmpty )
1694  {
1695  // Empty lines do not get tortured for very long:
1696  // pPara is cleared, which is the same as:
1697  // *pPara = SwParaPortion;
1698  const bool bMustFit = pPara->IsPrepMustFit();
1699  pPara->Truncate();
1700  pPara->FormatReset();
1701  if( pBlink && pPara->IsBlinking() )
1702  pBlink->Delete( pPara );
1703 
1704  // delete pSpaceAdd and pKanaComp
1705  pPara->FinishSpaceAdd();
1706  pPara->FinishKanaComp();
1707  pPara->ResetFlags();
1708  pPara->SetPrepMustFit( bMustFit );
1709  }
1710 
1711  OSL_ENSURE( ! IsSwapped(), "A frame is swapped before Format_" );
1712 
1713  if ( IsVertical() )
1715 
1716  SwTextFormatInfo aInf( pRenderContext, this );
1717  SwTextFormatter aLine( this, &aInf );
1718 
1720 
1721  Format_( aLine, aInf );
1722 
1723  if( aLine.IsOnceMore() )
1724  FormatOnceMore( aLine, aInf );
1725 
1726  if ( IsVertical() )
1728 
1729  OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Format_" );
1730 
1731  if( 1 < aLine.GetDropLines() )
1732  {
1733  if( SvxAdjust::Left != aLine.GetAdjust() &&
1734  SvxAdjust::Block != aLine.GetAdjust() )
1735  {
1736  aLine.CalcDropAdjust();
1737  aLine.SetPaintDrop( true );
1738  }
1739 
1740  if( aLine.IsPaintDrop() )
1741  {
1742  aLine.CalcDropRepaint();
1743  aLine.SetPaintDrop( false );
1744  }
1745  }
1746 }
1747 
1748 // We calculate the text frame's size and send a notification.
1749 // Shrink() or Grow() to adjust the frame's size to the changed required space.
1750 void SwTextFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs * )
1751 {
1752  SwRectFnSet aRectFnSet(this);
1753 
1755 
1756  // The range autopilot or the BASIC interface pass us TextFrames with
1757  // a width <= 0 from time to time
1758  if( aRectFnSet.GetWidth(getFramePrintArea()) <= 0 )
1759  {
1760  // If MustFit is set, we shrink to the Upper's bottom edge if needed.
1761  // Else we just take a standard size of 12 Pt. (240 twip).
1762  SwTextLineAccess aAccess( this );
1763  long nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
1764 
1765  if( aAccess.GetPara()->IsPrepMustFit() )
1766  {
1767  const SwTwips nLimit = aRectFnSet.GetPrtBottom(*GetUpper());
1768  const SwTwips nDiff = - aRectFnSet.BottomDist( getFrameArea(), nLimit );
1769  if( nDiff > 0 )
1770  Shrink( nDiff );
1771  }
1772  else if( 240 < nFrameHeight )
1773  {
1774  Shrink( nFrameHeight - 240 );
1775  }
1776  else if( 240 > nFrameHeight )
1777  {
1778  Grow( 240 - nFrameHeight );
1779  }
1780 
1781  nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
1782  const long nTop = aRectFnSet.GetTopMargin(*this);
1783 
1784  if( nTop > nFrameHeight )
1785  {
1786  aRectFnSet.SetYMargins( *this, nFrameHeight, 0 );
1787  }
1788  else if( aRectFnSet.GetHeight(getFramePrintArea()) < 0 )
1789  {
1791  aRectFnSet.SetHeight( aPrt, 0 );
1792  }
1793 
1794  return;
1795  }
1796 
1797  const TextFrameIndex nStrLen(GetText().getLength());
1798  if ( nStrLen || !FormatEmpty() )
1799  {
1800 
1801  SetEmpty( false );
1802  // In order to not get confused by nested Formats
1803  FormatLevel aLevel;
1804  if( 12 == FormatLevel::GetLevel() )
1805  return;
1806 
1807  // We could be possibly not allowed to alter the format information
1808  if( IsLocked() )
1809  return;
1810 
1811  // Attention: Format() could be triggered by GetFormatted()
1812  if( IsHiddenNow() )
1813  {
1814  long nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
1815  if( nPrtHeight )
1816  {
1817  HideHidden();
1818  Shrink( nPrtHeight );
1819  }
1820  else
1821  {
1822  // Assure that objects anchored
1823  // at paragraph resp. at/as character inside paragraph
1824  // are hidden.
1826  }
1827  ChgThisLines();
1828  return;
1829  }
1830 
1831  // We do not want to be interrupted during formatting
1832  TextFrameLockGuard aLock(this);
1833 
1834  // this is to ensure that the similar code in SwTextFrame::Format_
1835  // finds the master formatted in case it's needed
1836  if (IsFollow() && IsFieldFollow())
1837  {
1838  SwTextFrame *pMaster = FindMaster();
1839  assert(pMaster);
1840  if (!pMaster->HasPara())
1841  {
1842  pMaster->GetFormatted();
1843  }
1844  if (!pMaster->HasPara())
1845  { // master could be locked because it's being formatted upstack
1846  SAL_WARN("sw", "SwTextFrame::Format: failed to format master!");
1847  }
1848  else
1849  {
1850  SwTextSizeInfo aInf( pMaster );
1851  SwTextIter aMasterLine( pMaster, &aInf );
1852  aMasterLine.Bottom();
1853  SetOfst(aMasterLine.GetEnd());
1854  }
1855  }
1856 
1857  SwTextLineAccess aAccess( this );
1858  const bool bNew = !aAccess.IsAvailable();
1859  const bool bSetOfst =
1861 
1862  if( CalcPreps() )
1863  ; // nothing
1864  // We return if already formatted, but if the TextFrame was just created
1865  // and does not have any format information
1866  else if( !bNew && !aAccess.GetPara()->GetReformat().Len() )
1867  {
1869  {
1870  aAccess.GetPara()->SetPrepAdjust();
1871  aAccess.GetPara()->SetPrep();
1872  CalcPreps();
1873  }
1874  SetWidow( false );
1875  }
1876  else if( bSetOfst && IsFollow() )
1877  {
1878  SwTextFrame *pMaster = FindMaster();
1879  OSL_ENSURE( pMaster, "SwTextFrame::Format: homeless follow" );
1880  if( pMaster )
1881  pMaster->Prepare( PREP_FOLLOW_FOLLOWS );
1882  SwTwips nMaxY = aRectFnSet.GetPrtBottom(*GetUpper());
1883 
1884  if( aRectFnSet.OverStep( getFrameArea(), nMaxY ) )
1885  {
1886  aRectFnSet.SetLimit( *this, nMaxY );
1887  }
1888  else if( aRectFnSet.BottomDist( getFrameArea(), nMaxY ) < 0 )
1889  {
1891  aRectFnSet.AddBottom( aFrm, -aRectFnSet.GetHeight(aFrm) );
1892  }
1893  }
1894  else
1895  {
1896  // bSetOfst here means that we have the "red arrow situation"
1897  if ( bSetOfst )
1899 
1900  const bool bOrphan = IsWidow();
1901  const SwFootnoteBossFrame* pFootnoteBoss = HasFootnote() ? FindFootnoteBossFrame() : nullptr;
1902  SwTwips nFootnoteHeight = 0;
1903  if( pFootnoteBoss )
1904  {
1905  const SwFootnoteContFrame* pCont = pFootnoteBoss->FindFootnoteCont();
1906  nFootnoteHeight = pCont ? aRectFnSet.GetHeight(pCont->getFrameArea()) : 0;
1907  }
1908  do
1909  {
1910  Format_( pRenderContext, aAccess.GetPara() );
1911  if( pFootnoteBoss && nFootnoteHeight )
1912  {
1913  const SwFootnoteContFrame* pCont = pFootnoteBoss->FindFootnoteCont();
1914  SwTwips nNewHeight = pCont ? aRectFnSet.GetHeight(pCont->getFrameArea()) : 0;
1915  // If we lost some footnotes, we may have more space
1916  // for our main text, so we have to format again ...
1917  if( nNewHeight < nFootnoteHeight )
1918  nFootnoteHeight = nNewHeight;
1919  else
1920  break;
1921  }
1922  else
1923  break;
1924  } while ( pFootnoteBoss );
1925  if( bOrphan )
1926  {
1927  ValidateFrame();
1928  SetWidow( false );
1929  }
1930  }
1931  if( IsEmptyMaster() )
1932  {
1933  SwFrame* pPre = GetPrev();
1934  if( pPre &&
1935  // i#10826 It's the first, it cannot keep!
1936  pPre->GetIndPrev() &&
1937  pPre->GetAttrSet()->GetKeep().GetValue() )
1938  {
1939  pPre->InvalidatePos();
1940  }
1941  }
1942  }
1943 
1944  ChgThisLines();
1945 
1946  // the PrepMustFit should not survive a Format operation
1947  SwParaPortion *pPara = GetPara();
1948  if ( pPara )
1949  pPara->SetPrepMustFit( false );
1950 
1952  CalcHeightOfLastLine(); // i#11860 - Adjust spacing implementation for
1953  // object positioning - Compatibility to MS Word
1954 }
1955 
1956 // bForceQuickFormat is set if GetFormatted() has been called during the
1957 // painting process. Actually I cannot imagine a situation which requires
1958 // a full formatting of the paragraph during painting, on the other hand
1959 // a full formatting can cause the invalidation of other layout frames,
1960 // e.g., if there are footnotes in this paragraph, and invalid layout
1961 // frames will not calculated during the painting. So I actually want to
1962 // avoid a formatting during painting, but since I'm a coward, I'll only
1963 // force the quick formatting in the situation of issue i29062.
1964 bool SwTextFrame::FormatQuick( bool bForceQuickFormat )
1965 {
1966  OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
1967  "SwTextFrame::FormatQuick with swapped frame" );
1968 
1969  if( IsEmpty() && FormatEmpty() )
1970  return true;
1971 
1972  // We're very picky:
1973  if( HasPara() || IsWidow() || IsLocked()
1974  || !isFrameAreaSizeValid() ||
1976  return false;
1977 
1978  SwTextLineAccess aAccess( this );
1979  SwParaPortion *pPara = aAccess.GetPara();
1980  if( !pPara )
1981  return false;
1982 
1983  SwFrameSwapper aSwapper( this, true );
1984 
1985  TextFrameLockGuard aLock(this);
1986  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this, false, true );
1987  if( 0 != aInf.MaxHyph() ) // Respect MaxHyphen!
1988  return false;
1989 
1990  SwTextFormatter aLine( this, &aInf );
1991 
1992  // DropCaps are too complicated ...
1993  if( aLine.GetDropFormat() )
1994  return false;
1995 
1996  TextFrameIndex nStart = GetOfst();
1997  const TextFrameIndex nEnd = GetFollow()
1998  ? GetFollow()->GetOfst()
1999  : TextFrameIndex(aInf.GetText().getLength());
2000 
2001  int nLoopProtection = 0;
2002  do
2003  {
2004  TextFrameIndex nNewStart = aLine.FormatLine(nStart);
2005  if (nNewStart == nStart)
2006  ++nLoopProtection;
2007  else
2008  nLoopProtection = 0;
2009  nStart = nNewStart;
2010  const bool bWillEndlessInsert = nLoopProtection > 250;
2011  SAL_WARN_IF(bWillEndlessInsert, "sw", "loop detection triggered");
2012  if ((!bWillEndlessInsert) // Check for special case: line is invisible,
2013  // like in too thin table cell: tdf#66141
2014  && (aInf.IsNewLine() || (!aInf.IsStop() && nStart < nEnd)))
2015  aLine.Insert( new SwLineLayout() );
2016  } while( aLine.Next() );
2017 
2018  // Last exit: the heights need to match
2019  Point aTopLeft( getFrameArea().Pos() );
2020  aTopLeft += getFramePrintArea().Pos();
2021  const SwTwips nNewHeight = aLine.Y() + aLine.GetLineHeight();
2022  const SwTwips nOldHeight = aTopLeft.Y() + getFramePrintArea().Height();
2023 
2024  if( !bForceQuickFormat && nNewHeight != nOldHeight && !IsUndersized() )
2025  {
2026  // Attention: This situation can occur due to FormatLevel==12. Don't panic!
2027  TextFrameIndex const nStrt = GetOfst();
2028  InvalidateRange_( SwCharRange( nStrt, nEnd - nStrt) );
2029  return false;
2030  }
2031 
2032  if (m_pFollow && nStart != static_cast<SwTextFrame*>(m_pFollow)->GetOfst())
2033  return false; // can be caused by e.g. Orphans
2034 
2035  // We made it!
2036 
2037  // Set repaint
2038  pPara->GetRepaint().Pos( aTopLeft );
2039  pPara->GetRepaint().SSize( getFramePrintArea().SSize() );
2040 
2041  // Delete reformat
2042  pPara->GetReformat() = SwCharRange();
2043  pPara->GetDelta() = 0;
2044 
2045  return true;
2046 }
2047 
2048 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void HideHidden()
Removes Textfrm's attachments, when it's hidden.
Definition: txtfrm.cxx:1428
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:206
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:341
bool GetValue() const
sal_uInt16 GetParHeight() const
Returns the sum of line height in pLine.
Definition: txtfrm.cxx:3308
void CalcAdditionalFirstLineOffset()
Simulate format for a list item paragraph, whose list level attributes are in LABEL_ALIGNMENT mode...
Definition: txtfrm.cxx:3447
Base class of the Writer layout elements.
Definition: frame.hxx:295
sal_uInt8 & GetMaxHyphens()
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
bool FindBreak(SwTextFrame *pFrame, SwTextMargin &rLine, bool bHasToFit)
The Find*-Methods do not only search, but adjust the SwTextMargin to the line where the paragraph sho...
Definition: widorp.cxx:303
TextFrameIndex FormatQuoVadis(TextFrameIndex nStart)
Definition: txtftn.cxx:993
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout...
Definition: txtfrm.cxx:583
long BottomDist(const SwRect &rRect, long nPos) const
Definition: frame.hxx:1375
const SvxHyphenZoneItem & GetHyphenZone(bool=true) const
Definition: paratr.hxx:192
sal_uLong GetIndex() const
Definition: node.hxx:282
void AllowFollowFormat()
Definition: txtfrm.hxx:735
bool IsFollow() const
Definition: flowfrm.hxx:166
void SetRstHeight(const SwTextMargin &rLine)
Definition: widorp.cxx:206
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:543
void Right(const SwTwips nNew)
Definition: itrtxt.hxx:158
void CalcDropRepaint()
Definition: itradj.cxx:813
bool IsPrepAdjust() const
Definition: porlay.hxx:293
sal_uInt16 GetLineNr() const
Definition: itrtxt.hxx:88
bool IsClipping() const
Definition: porlay.hxx:140
void SetPrepAdjust()
Definition: porlay.hxx:292
bool IsInFly() const
Definition: frame.hxx:937
bool FollowFormatAllowed() const
Definition: txtfrm.hxx:730
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1455
long YInc(long n1, long n2) const
Definition: frame.hxx:1386
bool IsInSct() const
Definition: frame.hxx:943
bool IsRest() const
Definition: porlay.hxx:121
sal_uInt16 Height() const
Definition: possiz.hxx:44
void MakeDummyLine()
This function creates a Line that reaches to the other Page Margin.
Definition: txtftn.cxx:1197
void ChangeOffset(SwTextFrame *pFrame, TextFrameIndex nNew)
Definition: frmform.cxx:990
SwLineLayout * GetNext()
Definition: porlay.hxx:145
bool OverStep(const SwRect &rRect, long nPos) const
Definition: frame.hxx:1379
SwTwips GetOfst() const
Definition: porlay.hxx:72
bool IsSwapped() const
Definition: txtfrm.hxx:524
~FormatLevel()
Definition: frmform.cxx:67
long & GetDelta()
Definition: porlay.hxx:270
const SwFormatDrop * GetDropFormat() const
Definition: itrform2.hxx:199
void ColLock()
Definition: sectfrm.hxx:86
bool IsColLocked() const
Definition: frame.hxx:862
bool HasPara() const
Definition: txtfrm.hxx:806
void CalcBaseOfstForFly()
Definition: txtfrm.cxx:3940
TextFrameIndex GetStart() const
Definition: itrtxt.hxx:89
bool IsNewLine() const
Definition: itrform2.hxx:180
void ClrOrphLines()
Definition: widorp.hxx:63
SwNodeIndex nNode
Definition: pam.hxx:37
void SetCompletePaint() const
Definition: frame.hxx:970
SwParaPortion * GetPara()
Definition: txtcache.cxx:42
bool IsInFootnote() const
Definition: frame.hxx:925
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:476
void InvalidateRange_(const SwCharRange &, const long=0)
Definition: txtfrm.cxx:1678
void ValidateText(SwFrame *pFrame)
Definition: frmform.cxx:73
SwTwips GetHangingMargin() const
Definition: porlay.hxx:160
const SwRect & getFramePrintArea() const
Definition: frame.hxx:176
bool IsStop() const
Definition: itrform2.hxx:177
TextFrameIndex mnOffset
Definition: txtfrm.hxx:189
const SwPosition * GetMark() const
Definition: pam.hxx:209
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:438
bool IsEmptyMaster() const
If there's a Follow and we don't contain text ourselves.
Definition: txtfrm.hxx:434
TextFrameIndex GetUnderScorePos() const
Definition: inftxt.hxx:651
void ValidateContent() const
Definition: pagefrm.hxx:399
sal_uInt16 GetDropHeight() const
Definition: itrtxt.hxx:206
bool HasFollow() const
Definition: flowfrm.hxx:165
void MoveFlyInCnt(SwTextFrame *pNew, TextFrameIndex nStart, TextFrameIndex nEnd)
Rewires FlyInContentFrame, if nEnd > Index >= nStart.
Definition: porfly.cxx:152
SwParaPortion * GetPara()
Definition: txtcache.cxx:82
void Height(long nNew)
Definition: swrect.hxx:189
void InvalidatePos()
Definition: frame.hxx:1019
long GetBottom(const SwRect &rRect) const
Definition: frame.hxx:1339
TextFrameIndex GetOfst() const
Definition: txtfrm.hxx:426
const SwBodyFrame * FindBodyFrame() const
Definition: frame.hxx:1096
SwNode & GetNode() const
Definition: ndindex.hxx:118
#define TWIPS_MAX
Definition: swtypes.hxx:53
long SwTwips
Definition: swtypes.hxx:49
void CharToLine(TextFrameIndex)
Definition: itrtxt.cxx:193
static void ChangeFootnoteRef(const SwContentFrame *pOld, const SwTextFootnote *, SwContentFrame *pNew)
Definition: ftnfrm.cxx:1699
void Format_(vcl::RenderContext *pRenderContext, SwParaPortion *pPara)
Definition: frmform.cxx:1689
void CalcDropAdjust()
Definition: itradj.cxx:730
bool IsVert() const
Definition: frame.hxx:1328
bool GetDropRect_(SwRect &rRect) const
Definition: frmform.cxx:152
const SwLineLayout * Next()
Definition: itrtxt.cxx:108
bool FormatLine(SwTextFormatter &rLine, const bool bPrev)
Definition: frmform.cxx:1172
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:382
void HideAndShowObjects()
Hides respectively shows objects, which are anchored at paragraph, at/as a character of the paragraph...
Definition: txtfrm.cxx:1534
void Pos(const Point &rNew)
Definition: swrect.hxx:167
bool IsPrep() const
Definition: porlay.hxx:287
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1787
bool IsKeepAlways() const
Definition: widorp.hxx:38
bool IsCellFrame() const
Definition: frame.hxx:1202
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1278
long GetPrtTop(const SwFrame &rFrame) const
Definition: frame.hxx:1370
SwTwips Y() const
Definition: itrtxt.hxx:91
bool IsEndHyph() const
Definition: porlay.hxx:115
sal_uInt8 & MaxHyph()
Definition: inftxt.hxx:566
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:231
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:167
TextFrameIndex & Start()
Definition: porlay.hxx:47
SwTextAttr const * NextAttr(SwTextNode const **ppNode=nullptr)
Definition: txtfrm.cxx:97
void SetJustWidow(const bool bNew)
Definition: txtfrm.hxx:236
void CalcFootnoteFlag(TextFrameIndex nStop=TextFrameIndex(COMPLETE_STRING))
Does the Frame have a local footnote (in this Frame or Follow)?
Definition: txtftn.cxx:86
bool IsBreakNowWidAndOrp(SwTextMargin &rLine)
Definition: widorp.hxx:69
bool FormatQuick(bool bForceQuickFormat)
Definition: frmform.cxx:1964
size_type size() const
Definition: docary.hxx:370
void InitCntHyph()
Definition: itrform2.hxx:221
SwTextFormatInfo & GetInfo()
Definition: itrform2.hxx:216
bool IsHiddenNow() const
Hidden.
Definition: txtfrm.cxx:1345
void CalcUnclipped(SwTwips &rTop, SwTwips &rBottom)
Definition: itrform2.cxx:1975
long YDiff(long n1, long n2) const
Definition: frame.hxx:1384
void ValidateBodyFrame()
Definition: frmform.cxx:142
const SwRegisterItem & GetRegister(bool=true) const
Definition: paratr.hxx:184
void InvalidateObjs(const bool _bNoInvaOfAsCharAnchoredObjs=true)
Definition: fly.cxx:2297
bool IsFlyFrame() const
Definition: frame.hxx:1186
long GetPrtBottom(const SwFrame &rFrame) const
Definition: frame.hxx:1371
void Top(const long nTop)
Definition: swrect.hxx:202
bool IsMoveable(const SwLayoutFrame *_pLayoutFrame=nullptr) const
determine, if frame is moveable in given environment
Definition: findfrm.cxx:1359
const SwRect & getFrameArea() const
Definition: frame.hxx:175
SwFootnoteContFrame * FindFootnoteCont()
Definition: ftnfrm.cxx:964
SwFlowFrame * m_pFollow
Definition: flowfrm.hxx:117
sal_Unicode GetChar(TextFrameIndex const nPos) const
Definition: inftxt.hxx:254
bool IsInTab() const
Definition: frame.hxx:931
sal_Int32 & GetTabPos()
bool IsPaintDrop() const
Definition: itrpaint.hxx:56
void FormatReset()
Definition: porlay.hxx:315
sal_Unicode & GetDecimal()
void ResetFlags()
Definition: porlay.cxx:657
void CtorInitTextFormatInfo(OutputDevice *pRenderContext, SwTextFrame *pFrame, const bool bInterHyph=false, const bool bQuick=false, const bool bTst=false)
Definition: inftxt.cxx:1391
bool IsSctFrame() const
Definition: frame.hxx:1190
void Right(const long nRight)
Definition: swrect.hxx:198
bool IsNewLine() const
Definition: inftxt.hxx:590
const RedlineType_t REDLINE_DELETE
void SetRepaint() const
Definition: txtfrm.hxx:858
void SetOfst(const SwTwips nNew)
Definition: porlay.hxx:73
void SetOfst_(TextFrameIndex nNewOfst)
Definition: frmform.cxx:765
virtual bool Prepare(const PrepareHint ePrep=PREP_CLEAR, const void *pVoid=nullptr, bool bNotify=true) override
SwContentFrame: the shortcut for the Frames If the void* casts wrongly, it's its own fault! The void*...
Definition: txtfrm.cxx:2706
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:56
void SetTruncLines(bool bNew)
Definition: itrform2.hxx:208
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:842
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
SvxTabAdjust & GetAdjustment()
bool IsInvalidContent() const
Definition: pagefrm.hxx:220
void SetUndersized(const bool bNew)
Definition: flowfrm.hxx:157
bool CalcFollow(TextFrameIndex nTextOfst)
Definition: frmform.cxx:177
bool IsFollowField() const
Definition: porlay.hxx:295
bool IsColumnFrame() const
Definition: frame.hxx:1158
void SetHeight(SwRect &rRect, long nNew) const
Definition: frame.hxx:1352
bool IsBlinking() const
Definition: porlay.hxx:123
bool IsEmpty() const
Definition: txtfrm.hxx:509
void ResetPreps()
Definition: txtfrm.cxx:1336
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1083
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:445
void SetDropLines(const sal_uInt16 nNew)
Definition: itrtxt.hxx:204
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1288
RedlineType_t GetType(sal_uInt16 nPos=0) const
Definition: redline.hxx:225
bool IsWidow() const
Definition: txtfrm.hxx:507
void Bottom()
Definition: itrtxt.cxx:185
SwTwips GetFirstPos() const
Definition: itrtxt.hxx:130
bool IsShift() const
Definition: inftxt.hxx:592
SwFrame * GetIndPrev() const
Definition: frame.hxx:702
void AdjustFollow_(SwTextFormatter &rLine, TextFrameIndex nOffset, TextFrameIndex nStrEnd, const sal_uInt8 nMode)
Definition: frmform.cxx:568
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: node.cxx:2041
SwTwips GetLineStart() const
Definition: itrcrsr.cxx:370
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:80
const SwPosition * GetPoint() const
Definition: pam.hxx:207
static sal_uInt16 GetLevel()
Definition: frmform.cxx:68
bool IsInside(SwTextMargin const &rLine) const
BP 18.6.93: Widows.
Definition: widorp.cxx:104
void Top()
Definition: itrtxt.hxx:100
const SwLineInfo & GetLineInfo() const
Definition: itrtxt.hxx:129
SwFrame * GetIndNext()
Definition: frame.hxx:705
void SplitFrame(TextFrameIndex nTextPos)
Methods to manage the FollowFrame.
Definition: frmform.cxx:691
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:160
#define RES_TXTATR_FTN
Definition: hintids.hxx:152
size_t size() const
Definition: sortedobjs.cxx:42
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:135
virtual bool IsDeleteForbidden() const
Definition: frame.hxx:863
Helper class which can be used instead of the macros if a function has too many returns.
Definition: txtfrm.hxx:917
SwCharRange & GetReformat()
Definition: porlay.hxx:268
static bool LastLevel()
Definition: frmform.cxx:69
const SwFrame * Lower() const
Definition: layfrm.hxx:100
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:190
void ManipOfst(TextFrameIndex const nNewOfst)
Definition: txtfrm.hxx:429
vector_type::size_type size_type
Definition: docary.hxx:331
void CtorInitTextFormatter(SwTextFrame *pFrame, SwTextFormatInfo *pInf)
Definition: itrform2.cxx:86
void FinishKanaComp()
Definition: porlay.hxx:185
void SetFollow(SwFlowFrame *const pFollow)
Definition: flowfrm.cxx:88
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:228
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
bool HasArea() const
Definition: swrect.hxx:290
bool isFramePrintAreaValid() const
Definition: frame.hxx:164
bool IsPrepWidows() const
Definition: porlay.hxx:289
SwTwips GetLeftMargin() const
Definition: itrtxt.hxx:329
bool IsUndersized() const
Definition: flowfrm.hxx:158
void FinishSpaceAdd()
Definition: porlay.hxx:170
long GetTopMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1364
const SwLineLayout * GetPrev()
Definition: itrtxt.cxx:83
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
Definition: findfrm.cxx:435
SwFrame * GetPrev()
Definition: frame.hxx:655
SwTextFrame * GetFormatted(bool bForceQuickFormat=false)
In case the SwLineLayout was cleared out of the s_pTextCache, recreate it.
Definition: txtfrm.cxx:3348
sal_uInt16 GetLineHeight() const
Definition: itrtxt.hxx:117
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:285
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:234
css::uno::Sequence< css::style::TabStop > GetTabStopInfo(SwTwips CurrentPos) override
Definition: frmform.cxx:524
const SvxTabStop * GetTabStop(const SwTwips nSearchPos, const SwTwips nRight) const
#i24363# tab stops relative to indent
Definition: txttab.cxx:46
void TruncLines(bool bNoteFollow=false)
Definition: itrtxt.cxx:323
void SetYMargins(SwFrame &rFrame, long nTop, long nBottom) const
Definition: frame.hxx:1369
void SSize(const Size &rNew)
Definition: swrect.hxx:176
bool IsLocked() const
Definition: txtfrm.hxx:505
const sal_uInt8 & CntMidHyph() const
Definition: itrform2.hxx:223
bool isFrameAreaSizeValid() const
Definition: frame.hxx:163
void AddBottom(SwRect &rRect, long nNew) const
Definition: frame.hxx:1355
bool IsUnclipped() const
Definition: itrform2.hxx:210
TextFrameIndex GetLen() const
Definition: porlin.hxx:76
void CalcHeightOfLastLine(const bool _bUseFont=false)
method to determine height of last line, needed for proportional line spacing
Definition: txtfrm.cxx:3533
A page of the document layout.
Definition: pagefrm.hxx:40
#define SLOPPY_TWIPS
Definition: frmform.cxx:60
SwTwips GetRightOfst() const
Definition: porlay.hxx:74
Point GetTopLeft() const
Definition: itrtxt.hxx:187
bool IsMargin() const
Definition: porlay.hxx:302
const long LONG_MAX
#define Y
const OUString & GetText() const
Definition: inftxt.hxx:253
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
Definition: frmform.cxx:1750
bool IsStop() const
Definition: inftxt.hxx:586
SwTwips Shrink(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1500
void InvalidateSize()
Definition: frame.hxx:1005
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1091
void ValidateFrame()
Definition: frmform.cxx:84
SwFrame * FindColFrame()
Definition: findfrm.cxx:529
void SetUnclipped(bool bNew)
Definition: itrform2.hxx:211
void Truncate()
Definition: porlin.hxx:198
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2427
static void ValidateBodyFrame_(SwFrame *pFrame)
Definition: frmform.cxx:122
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:686
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:52
long GetWidth(const SwRect &rRect) const
Definition: frame.hxx:1342
const SwLineLayout * Prev()
Definition: itrtxt.cxx:90
bool IsPrepMustFit() const
Definition: porlay.hxx:291
void Left(const long nLeft)
Definition: swrect.hxx:193
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void Bottom(const long nBottom)
Definition: swrect.hxx:207
void SetOfst(TextFrameIndex nNewOfst)
Definition: txtfrm.hxx:852
void FormatAdjust(SwTextFormatter &rLine, WidowsAndOrphans &rFrameBreak, TextFrameIndex nStrLen, const bool bDummy)
Definition: frmform.cxx:998
bool CalcPreps()
Definition: frmform.cxx:782
bool IsBreakNow(SwTextMargin &rLine)
Definition: widorp.cxx:168
TextFrameIndex FormatLine(TextFrameIndex nStart)
Definition: itrform2.cxx:1470
bool IsVertLR() const
Definition: frame.hxx:955
SwTwips CalcBottomLine() const
Definition: itrform2.cxx:1887
bool IsMidHyph() const
Definition: porlay.hxx:117
sal_uInt16 GetDropLeft() const
Definition: itrtxt.hxx:205
sal_Unicode & GetFill()
void CalcDropHeight(const sal_uInt16 nLines)
Definition: txtdrop.cxx:483
void SimpleFormat()
Definition: sectfrm.cxx:1160
TextFrameIndex GetLength() const
Definition: itrtxt.hxx:87
#define SAL_WARN_IF(condition, area, stream)
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:677
void ColUnlock()
Definition: sectfrm.hxx:87
unsigned char sal_uInt8
SwRepaint & GetRepaint()
Definition: porlay.hxx:266
void Width(long nNew)
Definition: swrect.hxx:185
void SetFootnote(const bool bNew)
Will be moved soon.
Definition: txtfrm.hxx:588
SwLinePortion * GetRest()
Definition: inftxt.hxx:588
void SetLimit(SwFrame &rFrame, long nNew) const
Definition: frame.hxx:1378
void ForbidFollowFormat()
Definition: txtfrm.hxx:740
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
Definition: txtfrm.cxx:1239
void SetFieldFollow(const bool bNew)
Definition: txtfrm.hxx:238
void SetOnceMore(bool bNew)
Definition: itrform2.hxx:205
void AdjustFrame(const SwTwips nChgHeight, bool bHasToFit=false)
Definition: frmform.cxx:368
static sal_uInt16 nLevel
Definition: frmform.cxx:64
void SwapWidthAndHeight()
Swaps width and height of the text frame.
Definition: txtfrm.cxx:423
void SetRightOfst(const SwTwips nNew)
Definition: porlay.hxx:75
SvxAdjust GetAdjust() const
Definition: itrtxt.hxx:191
bool CalcPrepFootnoteAdjust()
Definition: txtftn.cxx:121
const SwPosition * End() const
Definition: pam.hxx:217
const sal_uInt8 & CntEndHyph() const
Definition: itrform2.hxx:222
virtual void MakePos() override
Definition: frmform.cxx:343
bool IsRightToLeft() const
Definition: frame.hxx:963
void SetKeep(const bool bNew)
Definition: widorp.hxx:40
void setFrameAreaSizeValid(bool bNew)
Definition: wsfrm.cxx:88
static TextFrameIndex FindBrk(const OUString &rText, TextFrameIndex nStart, TextFrameIndex nEnd)
Returns the first possible break point in the current line.
Definition: txtfrm.cxx:1618
bool FormatEmpty()
Definition: porrst.cxx:280
bool IsPageFrame() const
Definition: frame.hxx:1154
sal_uInt16 Width() const
Definition: possiz.hxx:46
void SetPaintDrop(const bool bNew)
Definition: itrpaint.hxx:55
double getLength(const B2DPolygon &rCandidate)
void SetPrep()
Definition: porlay.hxx:286
void FormatOnceMore(SwTextFormatter &rLine, SwTextFormatInfo &rInf)
Definition: frmform.cxx:1627
long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1343
void SetWidow(const bool bNew)
Definition: txtfrm.hxx:235
virtual void Cut() override
Definition: wsfrm.cxx:1109
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
void SetPrepMustFit(const bool bNew)
Definition: porlay.hxx:290
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:84
SwLinePortion * MakeRestPortion(const SwLineLayout *pLine, TextFrameIndex nPos)
Definition: pormulti.cxx:2352
bool IsVertical() const
Definition: frame.hxx:949
virtual SwContentFrame * MakeFrame(SwFrame *) override
Virtual methods from ContentNode.
Definition: ndtxt.cxx:278
long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1338
void Insert(SwLineLayout *pLine)
Definition: itrform2.cxx:122
#define SAL_WARN(area, stream)
bool IsTest() const
Definition: inftxt.hxx:600
bool IsFlyInCntBase() const
Definition: itrform2.hxx:213
virtual void MakePos()
Definition: calcmove.cxx:473
TextFrameIndex GetEnd() const
Definition: itrtxt.hxx:90
virtual const SwRedlineTable & GetRedlineTable() const =0
bool IsOnceMore() const
Definition: itrform2.hxx:204
sal_uInt16 GetDropLines() const
Definition: itrtxt.hxx:203
void MaybeNotifyRedlinePositionModification(long nTop)
Definition: docredln.cxx:1099
friend void ValidateText(SwFrame *pFrame)
Definition: frmform.cxx:73
bool IsFieldFollow() const
Definition: txtfrm.hxx:512
bool IsBodyFrame() const
Definition: frame.hxx:1182
void SetEmpty(const bool bNew)
Definition: txtfrm.hxx:237
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
void Chg(const Point &rNP, const Size &rNS)
Definition: swrect.hxx:162
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
void SetRest(SwLinePortion *pNewRest)
Definition: inftxt.hxx:589
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:75
void RemoveFootnote(TextFrameIndex nStart, TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING))
Footnote.
Definition: txtftn.cxx:389
TextFrameIndex & Len()
Definition: porlay.hxx:51
SwContentFrame * JoinFrame()
Definition: frmform.cxx:622
sal_uInt16 & GetAscent()
Definition: porlin.hxx:79
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
SwRootFrame * getRootFrame()
Definition: frame.hxx:657
bool HasUnderscore() const
Definition: porlay.hxx:133
long Y() const
bool IsAvailable() const
Definition: txtcache.cxx:62
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
bool CalcOnceMore()
Definition: itrform2.cxx:1874
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: wsfrm.cxx:1007
void ChgThisLines()
Definition: txtfrm.cxx:3749
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1075
SwFrame * GetNext()
Definition: frame.hxx:654
bool HasFootnote() const
Definition: txtfrm.hxx:510