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