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