LibreOffice Module sw (master)  1
itrform2.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 <hintids.hxx>
21 
22 #include <memory>
23 #include <com/sun/star/i18n/ScriptType.hpp>
24 #include <editeng/lspcitem.hxx>
25 #include <txtflcnt.hxx>
26 #include <txtftn.hxx>
27 #include <flyfrms.hxx>
28 #include <fmtflcnt.hxx>
29 #include <fmtftn.hxx>
30 #include <ftninfo.hxx>
31 #include <charfmt.hxx>
33 #include <layfrm.hxx>
34 #include <viewsh.hxx>
35 #include <viewopt.hxx>
36 #include <paratr.hxx>
37 #include "itrform2.hxx"
38 #include "porrst.hxx"
39 #include "portab.hxx"
40 #include "porfly.hxx"
41 #include "portox.hxx"
42 #include "porref.hxx"
43 #include "porfld.hxx"
44 #include "porftn.hxx"
45 #include "porhyph.hxx"
46 #include "pordrop.hxx"
47 #include "redlnitr.hxx"
48 #include <pagefrm.hxx>
49 #include <tgrditem.hxx>
50 #include <doc.hxx>
51 #include "pormulti.hxx"
52 #include <unotools/charclass.hxx>
53 #include <xmloff/odffields.hxx>
55 #include <IMark.hxx>
56 #include <IDocumentMarkAccess.hxx>
57 
58 #include <vector>
59 
60 using namespace ::com::sun::star;
61 
62 namespace {
64  long lcl_CalcOptRepaint( SwTextFormatter &rThis,
65  SwLineLayout const &rCurr,
66  TextFrameIndex nOldLineEnd,
67  const std::vector<long> &rFlyStarts );
69  bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex &rPos);
70 
71  // Check whether the two font has the same border
72  bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond);
73 }
74 
75 static void ClearFly( SwTextFormatInfo &rInf )
76 {
77  delete rInf.GetFly();
78  rInf.SetFly(nullptr);
79 }
80 
82 {
83  CtorInitTextPainter( pNewFrame, pNewInf );
84  m_pInf = pNewInf;
86  m_pMulti = nullptr;
87 
88  m_bOnceMore = false;
89  m_bFlyInContentBase = false;
90  m_bTruncLines = false;
95  m_pByEndIter.reset();
96  m_pFirstOfBorderMerge = nullptr;
97 
98  if (m_nStart > TextFrameIndex(GetInfo().GetText().getLength()))
99  {
100  OSL_ENSURE( false, "+SwTextFormatter::CTOR: bad offset" );
101  m_nStart = TextFrameIndex(GetInfo().GetText().getLength());
102  }
103 
104 }
105 
107 {
108  // Extremely unlikely, but still possible
109  // e.g.: field splits up, widows start to matter
110  if( GetInfo().GetRest() )
111  {
112  delete GetInfo().GetRest();
113  GetInfo().SetRest(nullptr);
114  }
115 }
116 
118 {
119  // Insert BEHIND the current element
120  if ( m_pCurr )
121  {
122  pLay->SetNext( m_pCurr->GetNext() );
123  m_pCurr->SetNext( pLay );
124  }
125  else
126  m_pCurr = pLay;
127 }
128 
130 {
131  // We want the rest height relative to the page.
132  // If we're in a table, then pFrame->GetUpper() is not the page.
133 
134  // GetFrameRstHeight() is being called with Footnote.
135  // Wrong: const SwFrame *pUpper = pFrame->GetUpper();
136  const SwFrame *pPage = m_pFrame->FindPageFrame();
137  const SwTwips nHeight = pPage->getFrameArea().Top()
138  + pPage->getFramePrintArea().Top()
139  + pPage->getFramePrintArea().Height() - Y();
140  if( 0 > nHeight )
141  return m_pCurr->Height();
142  else
143  return sal_uInt16( nHeight );
144 }
145 
147 {
148  // Save values and initialize rInf
149  SwLinePortion *pUnderflow = rInf.GetUnderflow();
150  if( !pUnderflow )
151  return nullptr;
152 
153  // We format backwards, i.e. attribute changes can happen the next
154  // line again.
155  // Can be seen in 8081.sdw, if you enter text in the first line
156 
157  TextFrameIndex const nSoftHyphPos = rInf.GetSoftHyphPos();
158  TextFrameIndex const nUnderScorePos = rInf.GetUnderScorePos();
159 
160  // Save flys and set to 0, or else segmentation fault
161  // Not ClearFly(rInf) !
162  SwFlyPortion *pFly = rInf.GetFly();
163  rInf.SetFly( nullptr );
164 
165  FeedInf( rInf );
166  rInf.SetLast( m_pCurr );
167  // pUnderflow does not need to be deleted, because it will drown in the following
168  // Truncate()
169  rInf.SetUnderflow(nullptr);
170  rInf.SetSoftHyphPos( nSoftHyphPos );
171  rInf.SetUnderScorePos( nUnderScorePos );
172  rInf.SetPaintOfst( GetLeftMargin() );
173 
174  // We look for the portion with the under-flow position
176  if( pPor != pUnderflow )
177  {
178  // pPrev will be the last portion before pUnderflow,
179  // which still has a real width.
180  // Exception: SoftHyphPortion must not be forgotten, of course!
181  // Although they don't have a width.
182  SwLinePortion *pTmpPrev = pPor;
183  while( pPor && pPor != pUnderflow )
184  {
185  if( !pPor->IsKernPortion() &&
186  ( pPor->Width() || pPor->IsSoftHyphPortion() ) )
187  {
188  while( pTmpPrev != pPor )
189  {
190  pTmpPrev->Move( rInf );
191  rInf.SetLast( pTmpPrev );
192  pTmpPrev = pTmpPrev->GetNextPortion();
193  OSL_ENSURE( pTmpPrev, "Underflow: losing control!" );
194  };
195  }
196  pPor = pPor->GetNextPortion();
197  }
198  pPor = pTmpPrev;
199  if( pPor && // Skip flys and initials when underflow.
200  ( pPor->IsFlyPortion() || pPor->IsDropPortion() ||
201  pPor->IsFlyCntPortion() ) )
202  {
203  pPor->Move( rInf );
204  rInf.SetLast( pPor );
205  rInf.SetStopUnderflow( true );
206  pPor = pUnderflow;
207  }
208  }
209 
210  // What? The under-flow portion is not in the portion chain?
211  OSL_ENSURE( pPor, "SwTextFormatter::Underflow: overflow but underflow" );
212 
213  // Snapshot
214  if ( pPor==rInf.GetLast() )
215  {
216  // We end up here, if the portion triggering the under-flow
217  // spans over the whole line. E.g. if a word spans across
218  // multiple lines and flows into a fly in the second line.
219  rInf.SetFly( pFly );
220  pPor->Truncate();
221  return pPor; // Is that enough?
222  }
223  // End the snapshot
224 
225  // X + Width == 0 with SoftHyph > Line?!
226  if( !pPor || !(rInf.X() + pPor->Width()) )
227  {
228  delete pFly;
229  return nullptr;
230  }
231 
232  // Preparing for Format()
233  // We need to chip off the chain behind pLast, because we Insert after the Format()
234  SeekAndChg( rInf );
235 
236  // line width is adjusted, so that pPor does not fit to current
237  // line anymore
238  rInf.Width( static_cast<sal_uInt16>(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) );
239  rInf.SetLen( pPor->GetLen() );
240  rInf.SetFull( false );
241  if( pFly )
242  {
243  // We need to recalculate the FlyPortion due to the following reason:
244  // If the base line is lowered by a big font in the middle of the line,
245  // causing overlapping with a fly, the FlyPortion has a wrong size/fixed
246  // size.
247  rInf.SetFly( pFly );
248  CalcFlyWidth( rInf );
249  }
250  rInf.GetLast()->SetNextPortion(nullptr);
251 
252  // The SwLineLayout is an exception to this, which splits at the first
253  // portion change.
254  // Here only the other way around:
255  if( rInf.GetLast() == m_pCurr )
256  {
257  if( pPor->InTextGrp() && !pPor->InExpGrp() )
258  {
259  const PortionType nOldWhich = m_pCurr->GetWhichPor();
260  *static_cast<SwLinePortion*>(m_pCurr) = *pPor;
262  m_pCurr->SetWhichPor( nOldWhich );
263  pPor->SetNextPortion( nullptr );
264  delete pPor;
265  pPor = m_pCurr;
266  }
267  }
268 
269  // Make sure that m_pFirstOfBorderMerge does not point to a portion which
270  // will be deleted by Truncate() below.
271  SwLinePortion* pNext = pPor->GetNextPortion();
272  while (pNext)
273  {
274  if (pNext == m_pFirstOfBorderMerge)
275  {
276  m_pFirstOfBorderMerge = nullptr;
277  break;
278  }
279  pNext = pNext->GetNextPortion();
280  }
281  pPor->Truncate();
282  SwLinePortion *const pRest( rInf.GetRest() );
283  if (pRest && pRest->InFieldGrp() &&
284  static_cast<SwFieldPortion*>(pRest)->IsNoLength())
285  {
286  // HACK: decrement again, so we pick up the suffix in next line!
287  m_pByEndIter->PrevAttr();
288  }
289  delete pRest;
290  rInf.SetRest(nullptr);
291  return pPor;
292 }
293 
295  SwLinePortion *pPor )
296 {
297  SwLinePortion *pLast = nullptr;
298  // The new portion is inserted, but everything's different for
299  // LineLayout...
300  if( pPor == m_pCurr )
301  {
302  if ( m_pCurr->GetNextPortion() )
303  {
304  pLast = pPor;
305  pPor = m_pCurr->GetNextPortion();
306  }
307 
308  // i#112181 - Prevent footnote anchor being wrapped to next line
309  // without preceding word
311  }
312  else
313  {
314  pLast = rInf.GetLast();
315  if( pLast->GetNextPortion() )
316  {
317  while( pLast->GetNextPortion() )
318  pLast = pLast->GetNextPortion();
319  rInf.SetLast( pLast );
320  }
321  pLast->Insert( pPor );
322 
324 
325  // Adjust maxima
326  if( m_pCurr->Height() < pPor->Height() )
327  m_pCurr->Height( pPor->Height(), pPor->IsTextPortion() );
328  if( m_pCurr->GetAscent() < pPor->GetAscent() )
329  m_pCurr->SetAscent( pPor->GetAscent() );
330 
332  {
333  // For DOCX with compat=14 the only shape in line defines height of the line in spite of used font
334  if (pLast->IsFlyCntPortion() && pPor->IsTextPortion() && pPor->GetLen() == TextFrameIndex(0))
335  {
336  m_pCurr->SetAscent(pLast->GetAscent());
337  m_pCurr->Height(pLast->Height());
338  }
339  }
340  }
341 
342  // Sometimes chains are constructed (e.g. by hyphenate)
343  rInf.SetLast( pPor );
344  while( pPor )
345  {
346  if (!pPor->IsDropPortion())
347  MergeCharacterBorder(*pPor, pLast, rInf);
348 
349  pPor->Move( rInf );
350  rInf.SetLast( pPor );
351  pLast = pPor;
352  pPor = pPor->GetNextPortion();
353  }
354 }
355 
357 {
358  OSL_ENSURE( rInf.GetText().getLength() < COMPLETE_STRING,
359  "SwTextFormatter::BuildPortions: bad text length in info" );
360 
361  rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
362 
363  // First NewTextPortion() decides whether pCurr ends up in pPor.
364  // We need to make sure that the font is being set in any case.
365  // This is done automatically in CalcAscent.
366  rInf.SetLast( m_pCurr );
367  rInf.ForcedLeftMargin( 0 );
368 
369  OSL_ENSURE( m_pCurr->FindLastPortion() == m_pCurr, "pLast supposed to equal pCurr" );
370 
371  if( !m_pCurr->GetAscent() && !m_pCurr->Height() )
372  CalcAscent( rInf, m_pCurr );
373 
374  SeekAndChg( rInf );
375 
376  // Width() is shortened in CalcFlyWidth if we have a FlyPortion
377  OSL_ENSURE( !rInf.X() || m_pMulti, "SwTextFormatter::BuildPortion X=0?" );
378  CalcFlyWidth( rInf );
379  SwFlyPortion *pFly = rInf.GetFly();
380  if( pFly )
381  {
382  if ( 0 < pFly->GetFix() )
383  ClearFly( rInf );
384  else
385  rInf.SetFull(true);
386  }
387 
388  SwLinePortion *pPor = NewPortion( rInf );
389 
390  // Asian grid stuff
391  SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
392  const bool bHasGrid = pGrid && rInf.SnapToGrid() &&
393  GRID_LINES_CHARS == pGrid->GetGridType();
394 
395 
396  const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
397  const sal_uInt16 nGridWidth = bHasGrid ? GetGridWidth(*pGrid, rDoc) : 0;
398 
399  // used for grid mode only:
400  // the pointer is stored, because after formatting of non-asian text,
401  // the width of the kerning portion has to be adjusted
402  // Inserting a SwKernPortion before a SwTabPortion isn't necessary
403  // and will break the SwTabPortion.
404  SwKernPortion* pGridKernPortion = nullptr;
405 
406  bool bFull = false;
407  SwTwips nUnderLineStart = 0;
408  rInf.Y( Y() );
409 
410  while( pPor && !rInf.IsStop() )
411  {
412  OSL_ENSURE(rInf.GetLen() < TextFrameIndex(COMPLETE_STRING) &&
413  rInf.GetIdx() <= TextFrameIndex(rInf.GetText().getLength()),
414  "SwTextFormatter::BuildPortions: bad length in info" );
415 
416  // We have to check the script for fields in order to set the
417  // correct nActual value for the font.
418  if( pPor->InFieldGrp() )
419  static_cast<SwFieldPortion*>(pPor)->CheckScript( rInf );
420 
421  if( ! bHasGrid && rInf.HasScriptSpace() &&
422  rInf.GetLast() && rInf.GetLast()->InTextGrp() &&
423  rInf.GetLast()->Width() && !rInf.GetLast()->InNumberGrp() )
424  {
425  SwFontScript nNxtActual = rInf.GetFont()->GetActual();
426  SwFontScript nLstActual = nNxtActual;
427  sal_uInt16 nLstHeight = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight());
428  bool bAllowBehind = false;
429  const CharClass& rCC = GetAppCharClass();
430 
431  // are there any punctuation characters on both sides
432  // of the kerning portion?
433  if ( pPor->InFieldGrp() )
434  {
435  OUString aAltText;
436  if ( static_cast<SwFieldPortion*>(pPor)->GetExpText( rInf, aAltText ) &&
437  !aAltText.isEmpty() )
438  {
439  bAllowBehind = rCC.isLetterNumeric( aAltText, 0 );
440 
441  const SwFont* pTmpFnt = static_cast<SwFieldPortion*>(pPor)->GetFont();
442  if ( pTmpFnt )
443  nNxtActual = pTmpFnt->GetActual();
444  }
445  }
446  else
447  {
448  const OUString& rText = rInf.GetText();
449  sal_Int32 nIdx = sal_Int32(rInf.GetIdx());
450  bAllowBehind = nIdx < rText.getLength() && rCC.isLetterNumeric(rText, nIdx);
451  }
452 
453  const SwLinePortion* pLast = rInf.GetLast();
454  if ( bAllowBehind && pLast )
455  {
456  bool bAllowBefore = false;
457 
458  if ( pLast->InFieldGrp() )
459  {
460  OUString aAltText;
461  if ( static_cast<const SwFieldPortion*>(pLast)->GetExpText( rInf, aAltText ) &&
462  !aAltText.isEmpty() )
463  {
464  bAllowBefore = rCC.isLetterNumeric( aAltText, aAltText.getLength() - 1 );
465 
466  const SwFont* pTmpFnt = static_cast<const SwFieldPortion*>(pLast)->GetFont();
467  if ( pTmpFnt )
468  {
469  nLstActual = pTmpFnt->GetActual();
470  nLstHeight = static_cast<sal_uInt16>(pTmpFnt->GetHeight());
471  }
472  }
473  }
474  else if ( rInf.GetIdx() )
475  {
476  bAllowBefore = rCC.isLetterNumeric(rInf.GetText(), sal_Int32(rInf.GetIdx()) - 1);
477  // Note: ScriptType returns values in [1,4]
478  if ( bAllowBefore )
479  nLstActual = SwFontScript(m_pScriptInfo->ScriptType(rInf.GetIdx() - TextFrameIndex(1)) - 1);
480  }
481 
482  nLstHeight /= 5;
483  // does the kerning portion still fit into the line?
484  if( bAllowBefore && ( nLstActual != nNxtActual ) &&
485  nLstHeight && rInf.X() + nLstHeight <= rInf.Width() &&
486  ! pPor->InTabGrp() )
487  {
488  SwKernPortion* pKrn =
489  new SwKernPortion( *rInf.GetLast(), nLstHeight,
490  pLast->InFieldGrp() && pPor->InFieldGrp() );
491  rInf.GetLast()->SetNextPortion( nullptr );
492  InsertPortion( rInf, pKrn );
493  }
494  }
495  }
496  else if ( bHasGrid && pGrid->IsSnapToChars() && ! pGridKernPortion && ! m_pMulti && ! pPor->InTabGrp() )
497  {
498  // insert a grid kerning portion
499  pGridKernPortion = pPor->IsKernPortion() ?
500  static_cast<SwKernPortion*>(pPor) :
501  new SwKernPortion( *m_pCurr );
502 
503  // if we have a new GridKernPortion, we initially calculate
504  // its size so that its ends on the grid
505  const SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
506  const SwLayoutFrame* pBody = pPageFrame->FindBodyCont();
507  SwRectFnSet aRectFnSet(pPageFrame);
508 
509  const long nGridOrigin = pBody ?
510  aRectFnSet.GetPrtLeft(*pBody) :
511  aRectFnSet.GetPrtLeft(*pPageFrame);
512 
513  SwTwips nStartX = rInf.X() + GetLeftMargin();
514  if ( aRectFnSet.IsVert() )
515  {
516  Point aPoint( nStartX, 0 );
518  nStartX = aPoint.Y();
519  }
520 
521  const SwTwips nOfst = nStartX - nGridOrigin;
522  if ( nOfst )
523  {
524  const sal_uLong i = ( nOfst > 0 ) ?
525  ( ( nOfst - 1 ) / nGridWidth + 1 ) :
526  0;
527  const SwTwips nKernWidth = i * nGridWidth - nOfst;
528  const SwTwips nRestWidth = rInf.Width() - rInf.X();
529 
530  if ( nKernWidth <= nRestWidth )
531  pGridKernPortion->Width( static_cast<sal_uInt16>(nKernWidth) );
532  }
533 
534  if ( pGridKernPortion != pPor )
535  InsertPortion( rInf, pGridKernPortion );
536  }
537 
538  if( pPor->IsDropPortion() )
539  MergeCharacterBorder(*static_cast<SwDropPortion*>(pPor));
540 
541  // the multi-portion has its own format function
542  if( pPor->IsMultiPortion() && ( !m_pMulti || m_pMulti->IsBidi() ) )
543  bFull = BuildMultiPortion( rInf, *static_cast<SwMultiPortion*>(pPor) );
544  else
545  bFull = pPor->Format( rInf );
546 
547  if( rInf.IsRuby() && !rInf.GetRest() )
548  bFull = true;
549 
550  // if we are underlined, we store the beginning of this underlined
551  // segment for repaint optimization
552  if ( LINESTYLE_NONE != m_pFont->GetUnderline() && ! nUnderLineStart )
553  nUnderLineStart = GetLeftMargin() + rInf.X();
554 
555  if ( pPor->IsFlyPortion() )
556  m_pCurr->SetFly( true );
557  // some special cases, where we have to take care for the repaint
558  // offset:
559  // 1. Underlined portions due to special underline feature
560  // 2. Right Tab
561  // 3. BidiPortions
562  // 4. other Multiportions
563  // 5. DropCaps
564  // 6. Grid Mode
565  else if ( ( ! rInf.GetPaintOfst() || nUnderLineStart < rInf.GetPaintOfst() ) &&
566  // 1. Underlined portions
567  nUnderLineStart &&
568  // reformat is at end of an underlined portion and next portion
569  // is not underlined
570  ( ( rInf.GetReformatStart() == rInf.GetIdx() &&
572  ) ||
573  // reformat is inside portion and portion is underlined
574  ( rInf.GetReformatStart() >= rInf.GetIdx() &&
575  rInf.GetReformatStart() <= rInf.GetIdx() + pPor->GetLen() &&
577  rInf.SetPaintOfst( nUnderLineStart );
578  else if ( ! rInf.GetPaintOfst() &&
579  // 2. Right Tab
580  ( ( pPor->InTabGrp() && !pPor->IsTabLeftPortion() ) ||
581  // 3. BidiPortions
582  ( pPor->IsMultiPortion() && static_cast<SwMultiPortion*>(pPor)->IsBidi() ) ||
583  // 4. Multi Portion and 5. Drop Caps
584  ( ( pPor->IsDropPortion() || pPor->IsMultiPortion() ) &&
585  rInf.GetReformatStart() >= rInf.GetIdx() &&
586  rInf.GetReformatStart() <= rInf.GetIdx() + pPor->GetLen() )
587  // 6. Grid Mode
588  || ( bHasGrid && SwFontScript::CJK != m_pFont->GetActual() )
589  )
590  )
591  // we store the beginning of the critical portion as our
592  // paint offset
593  rInf.SetPaintOfst( GetLeftMargin() + rInf.X() );
594 
595  // under one of these conditions we are allowed to delete the
596  // start of the underline portion
597  if ( IsUnderlineBreak( *pPor, *m_pFont ) )
598  nUnderLineStart = 0;
599 
600  if( pPor->IsFlyCntPortion() || ( pPor->IsMultiPortion() &&
601  static_cast<SwMultiPortion*>(pPor)->HasFlyInContent() ) )
602  SetFlyInCntBase();
603  // bUnderflow needs to be reset or we wrap again at the next softhyphen
604  if ( !bFull )
605  {
606  rInf.ClrUnderflow();
607  if( ! bHasGrid && rInf.HasScriptSpace() && pPor->InTextGrp() &&
608  pPor->GetLen() && !pPor->InFieldGrp() )
609  {
610  // The distance between two different scripts is set
611  // to 20% of the fontheight.
612  TextFrameIndex const nTmp = rInf.GetIdx() + pPor->GetLen();
613  if (nTmp == m_pScriptInfo->NextScriptChg(nTmp - TextFrameIndex(1)) &&
614  nTmp != TextFrameIndex(rInf.GetText().getLength()) &&
615  (m_pScriptInfo->ScriptType(nTmp - TextFrameIndex(1)) == css::i18n::ScriptType::ASIAN ||
616  m_pScriptInfo->ScriptType(nTmp) == css::i18n::ScriptType::ASIAN) )
617  {
618  const sal_uInt16 nDist = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight()/5);
619 
620  if( nDist )
621  {
622  // we do not want a kerning portion if any end
623  // would be a punctuation character
624  const CharClass& rCC = GetAppCharClass();
625  if (rCC.isLetterNumeric(rInf.GetText(), sal_Int32(nTmp) - 1)
626  && rCC.isLetterNumeric(rInf.GetText(), sal_Int32(nTmp)))
627  {
628  // does the kerning portion still fit into the line?
629  if ( rInf.X() + pPor->Width() + nDist <= rInf.Width() )
630  new SwKernPortion( *pPor, nDist );
631  else
632  bFull = true;
633  }
634  }
635  }
636  }
637  }
638 
639  if ( bHasGrid && pGrid->IsSnapToChars() && pPor != pGridKernPortion && ! m_pMulti && ! pPor->InTabGrp() )
640  {
641  TextFrameIndex const nTmp = rInf.GetIdx() + pPor->GetLen();
642  const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width();
643 
644  const SwFontScript nCurrScript = m_pFont->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() );
645  const SwFontScript nNextScript =
646  nTmp >= TextFrameIndex(rInf.GetText().getLength())
648  : m_pScriptInfo->WhichFont(nTmp);
649 
650  // snap non-asian text to grid if next portion is ASIAN or
651  // there are no more portions in this line
652  // be careful when handling an underflow event: the gridkernportion
653  // could have been deleted
654  if ( nRestWidth > 0 && SwFontScript::CJK != nCurrScript &&
655  ! rInf.IsUnderflow() && ( bFull || SwFontScript::CJK == nNextScript ) )
656  {
657  OSL_ENSURE( pGridKernPortion, "No GridKernPortion available" );
658 
659  // calculate size
660  SwLinePortion* pTmpPor = pGridKernPortion->GetNextPortion();
661  sal_uInt16 nSumWidth = pPor->Width();
662  while ( pTmpPor )
663  {
664  nSumWidth = nSumWidth + pTmpPor->Width();
665  pTmpPor = pTmpPor->GetNextPortion();
666  }
667 
668  const SwTwips i = nSumWidth ?
669  ( nSumWidth - 1 ) / nGridWidth + 1 :
670  0;
671  const SwTwips nTmpWidth = i * nGridWidth;
672  const SwTwips nKernWidth = std::min(nTmpWidth - nSumWidth, nRestWidth);
673  const sal_uInt16 nKernWidth_1 = static_cast<sal_uInt16>(nKernWidth / 2);
674 
675  OSL_ENSURE( nKernWidth <= nRestWidth,
676  "Not enough space left for adjusting non-asian text in grid mode" );
677 
678  pGridKernPortion->Width( pGridKernPortion->Width() + nKernWidth_1 );
679  rInf.X( rInf.X() + nKernWidth_1 );
680 
681  if ( ! bFull )
682  new SwKernPortion( *pPor, static_cast<short>(nKernWidth - nKernWidth_1),
683  false, true );
684 
685  pGridKernPortion = nullptr;
686  }
687  else if ( pPor->IsMultiPortion() || pPor->InFixMargGrp() ||
688  pPor->IsFlyCntPortion() || pPor->InNumberGrp() ||
689  pPor->InFieldGrp() || nCurrScript != nNextScript )
690  // next portion should snap to grid
691  pGridKernPortion = nullptr;
692  }
693 
694  rInf.SetFull( bFull );
695 
696  // Restportions from fields with multiple lines don't yet have the right ascent
697  if ( !pPor->GetLen() && !pPor->IsFlyPortion()
698  && !pPor->IsGrfNumPortion() && ! pPor->InNumberGrp()
699  && !pPor->IsMultiPortion() )
700  CalcAscent( rInf, pPor );
701 
702  InsertPortion( rInf, pPor );
703  if (pPor->IsMultiPortion() && (!m_pMulti || m_pMulti->IsBidi()))
704  {
705  (void) rInf.CheckCurrentPosBookmark(); // bookmark was already created inside MultiPortion!
706  }
707  pPor = NewPortion( rInf );
708  }
709 
710  if( !rInf.IsStop() )
711  {
712  // The last right centered, decimal tab
713  SwTabPortion *pLastTab = rInf.GetLastTab();
714  if( pLastTab )
715  pLastTab->FormatEOL( rInf );
716  else if( rInf.GetLast() && rInf.LastKernPortion() )
717  rInf.GetLast()->FormatEOL( rInf );
718  }
720  && static_cast<SwNumberPortion*>(m_pCurr->GetNextPortion())->IsHide() )
721  rInf.SetNumDone( false );
722 
723  // Delete fly in any case
724  ClearFly( rInf );
725 
726  // Reinit the tab overflow flag after the line
727  rInf.SetTabOverflow( false );
728 }
729 
731 {
732  if( SvxAdjust::Left != GetAdjust() && !m_pMulti)
733  {
734  pCurrent->SetFormatAdj(true);
735  if( IsFlyInCntBase() )
736  {
737  CalcAdjLine( pCurrent );
738  // For e.g. centered fly we need to switch the RefPoint
739  // That's why bAlways = true
740  UpdatePos( pCurrent, GetTopLeft(), GetStart(), true );
741  }
742  }
743 }
744 
746 {
747  bool bCalc = false;
748  if ( pPor->InFieldGrp() && static_cast<SwFieldPortion*>(pPor)->GetFont() )
749  {
750  // Numbering + InterNetFields can keep an own font, then their size is
751  // independent from hard attribute values
752  SwFont* pFieldFnt = static_cast<SwFieldPortion*>(pPor)->m_pFont.get();
753  SwFontSave aSave( rInf, pFieldFnt );
754  pPor->Height( rInf.GetTextHeight() );
755  pPor->SetAscent( rInf.GetAscent() );
756  bCalc = true;
757  }
758  // i#89179
759  // tab portion representing the list tab of a list label gets the
760  // same height and ascent as the corresponding number portion
761  else if ( pPor->InTabGrp() && pPor->GetLen() == TextFrameIndex(0) &&
762  rInf.GetLast() && rInf.GetLast()->InNumberGrp() &&
763  static_cast<const SwNumberPortion*>(rInf.GetLast())->HasFont() )
764  {
765  const SwLinePortion* pLast = rInf.GetLast();
766  pPor->Height( pLast->Height() );
767  pPor->SetAscent( pLast->GetAscent() );
768  }
769  else if (pPor->GetWhichPor() == PortionType::Bookmark
770  && rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
771  {
772  // bookmark at end of paragraph: *don't* advance iterator, use the
773  // current font instead; it's possible that there's a font size on the
774  // paragraph and it's overridden on the last line of the paragraph and
775  // we don't want to apply it via SwBookmarkPortion and grow the line
776  // height (example: n758883.docx)
777  SwLinePortion const*const pLast = rInf.GetLast();
778  assert(pLast);
779  pPor->Height( pLast->Height(), false );
780  pPor->SetAscent( pLast->GetAscent() );
781  }
782  else
783  {
784  const SwLinePortion *pLast = rInf.GetLast();
785  bool bChg = false;
786 
787  // In empty lines the attributes are switched on via SeekStart
788  const bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
789  if ( pPor->IsQuoVadisPortion() )
790  bChg = SeekStartAndChg( rInf, true );
791  else
792  {
793  if( bFirstPor )
794  {
795  if( !rInf.GetText().isEmpty() )
796  {
797  if ( pPor->GetLen() || !rInf.GetIdx()
798  || ( m_pCurr != pLast && !pLast->IsFlyPortion() )
799  || !m_pCurr->IsRest() ) // instead of !rInf.GetRest()
800  bChg = SeekAndChg( rInf );
801  else
802  bChg = SeekAndChgBefore( rInf );
803  }
804  else if ( m_pMulti )
805  // do not open attributes starting at 0 in empty multi
806  // portions (rotated numbering followed by a footnote
807  // can cause trouble, because the footnote attribute
808  // starts at 0, but if we open it, the attribute handler
809  // cannot handle it.
810  bChg = false;
811  else
812  bChg = SeekStartAndChg( rInf );
813  }
814  else
815  bChg = SeekAndChg( rInf );
816  }
817  if( bChg || bFirstPor || !pPor->GetAscent()
818  || !rInf.GetLast()->InTextGrp() )
819  {
820  pPor->SetAscent( rInf.GetAscent() );
821  pPor->Height( rInf.GetTextHeight() );
822  bCalc = true;
823  }
824  else
825  {
826  pPor->Height( pLast->Height() );
827  pPor->SetAscent( pLast->GetAscent() );
828  }
829  }
830 
831  if( pPor->InTextGrp() && bCalc )
832  {
833  pPor->SetAscent(pPor->GetAscent() +
834  rInf.GetFont()->GetTopBorderSpace());
835  pPor->Height(pPor->Height() +
836  rInf.GetFont()->GetTopBorderSpace() +
837  rInf.GetFont()->GetBottomBorderSpace() );
838  }
839 }
840 
841 namespace {
842 
843 class SwMetaPortion : public SwTextPortion
844 {
845 public:
846  SwMetaPortion() { SetWhichPor( PortionType::Meta ); }
847  virtual void Paint( const SwTextPaintInfo &rInf ) const override;
848 };
849 
850 }
851 
852 void SwMetaPortion::Paint( const SwTextPaintInfo &rInf ) const
853 {
854  if ( Width() )
855  {
856  rInf.DrawViewOpt( *this, PortionType::Meta );
857  SwTextPortion::Paint( rInf );
858  }
859 }
860 
861 namespace sw::mark {
863  {
864  const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters();
865  sal_Int32 nCurrentIdx = 0;
866  const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(OUString(ODF_FORMDROPDOWN_RESULT));
867  if(pResult != pParameters->end())
868  pResult->second >>= nCurrentIdx;
869 
870  const IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(OUString(ODF_FORMDROPDOWN_LISTENTRY));
871  if (pListEntries != pParameters->end())
872  {
873  uno::Sequence< OUString > vListEntries;
874  pListEntries->second >>= vListEntries;
875  if (nCurrentIdx < vListEntries.getLength())
876  return vListEntries[nCurrentIdx];
877  }
878 
879  static const sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
880  return OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH);
881  }
882 }
883 
885 {
886  SwTextPortion *pPor = nullptr;
887  if( GetFnt()->IsTox() )
888  {
889  pPor = new SwToxPortion;
890  }
891  else if ( GetFnt()->IsInputField() )
892  {
893  pPor = new SwTextInputFieldPortion();
894  }
895  else
896  {
897  if( GetFnt()->IsRef() )
898  pPor = new SwRefPortion;
899  else if (GetFnt()->IsMeta())
900  {
901  pPor = new SwMetaPortion;
902  }
903  else
904  {
905  // Only at the End!
906  // If pCurr does not have a width, it can however already have content.
907  // E.g. for non-displayable characters
908 
909  auto const ch(rInf.GetText()[sal_Int32(rInf.GetIdx())]);
910  SwTextFrame const*const pFrame(rInf.GetTextFrame());
911  SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
912  sw::mark::IFieldmark *pBM = pFrame->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
913  if(pBM != nullptr && pBM->GetFieldname( ) == ODF_FORMDATE)
914  {
915  if (ch == CH_TXT_ATR_FIELDSTART)
916  pPor = new SwFieldFormDatePortion(pBM, true);
917  else if (ch == CH_TXT_ATR_FIELDSEP)
918  pPor = new SwFieldMarkPortion(); // it's added in DateFieldmark?
919  else if (ch == CH_TXT_ATR_FIELDEND)
920  pPor = new SwFieldFormDatePortion(pBM, false);
921  }
922  else if (ch == CH_TXT_ATR_FIELDSTART)
923  pPor = new SwFieldMarkPortion();
924  else if (ch == CH_TXT_ATR_FIELDSEP)
925  pPor = new SwFieldMarkPortion();
926  else if (ch == CH_TXT_ATR_FIELDEND)
927  pPor = new SwFieldMarkPortion();
928  else if (ch == CH_TXT_ATR_FORMELEMENT)
929  {
930  OSL_ENSURE(pBM != nullptr, "Where is my form field bookmark???");
931  if (pBM != nullptr)
932  {
933  if (pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
934  {
935  pPor = new SwFieldFormCheckboxPortion();
936  }
937  else if (pBM->GetFieldname( ) == ODF_FORMDROPDOWN)
938  {
940  }
941  /* we need to check for ODF_FORMTEXT for scenario having FormFields inside FORMTEXT.
942  * Otherwise file will crash on open.
943  */
944  else if (pBM->GetFieldname( ) == ODF_FORMTEXT)
945  {
946  pPor = new SwFieldMarkPortion();
947  }
948  }
949  }
950  if( !pPor )
951  {
952  if( !rInf.X() && !m_pCurr->GetNextPortion() && !m_pCurr->GetLen() )
953  pPor = m_pCurr;
954  else
955  pPor = new SwTextPortion;
956  }
957  }
958  }
959  return pPor;
960 }
961 
962 // We calculate the length, the following portion limits are defined:
963 // 1) Tabs
964 // 2) Linebreaks
965 // 3) CH_TXTATR_BREAKWORD / CH_TXTATR_INWORD
966 // 4) next attribute change
967 
969 {
970  // If we're at the line's beginning, we take pCurr
971  // If pCurr is not derived from SwTextPortion, we need to duplicate
972  Seek( rInf.GetIdx() );
973  SwTextPortion *pPor = WhichTextPor( rInf );
974 
975  // until next attribute change:
976  const TextFrameIndex nNextAttr = GetNextAttr();
977  TextFrameIndex nNextChg = std::min(nNextAttr, TextFrameIndex(rInf.GetText().getLength()));
978 
979  // end of script type:
980  const TextFrameIndex nNextScript = m_pScriptInfo->NextScriptChg(rInf.GetIdx());
981  nNextChg = std::min( nNextChg, nNextScript );
982 
983  // end of direction:
984  const TextFrameIndex nNextDir = m_pScriptInfo->NextDirChg(rInf.GetIdx());
985  nNextChg = std::min( nNextChg, nNextDir );
986 
987  // hidden change (potentially via bookmark):
988  const TextFrameIndex nNextHidden = m_pScriptInfo->NextHiddenChg(rInf.GetIdx());
989  nNextChg = std::min( nNextChg, nNextHidden );
990 
991  // bookmarks
992  const TextFrameIndex nNextBookmark = m_pScriptInfo->NextBookmark(rInf.GetIdx());
993  nNextChg = std::min(nNextChg, nNextBookmark);
994 
995  // Turbo boost:
996  // We assume that font characters are not larger than twice
997  // as wide as height.
998  // Very crazy: we need to take the ascent into account.
999 
1000  // Mind the trap! GetSize() contains the wished-for height, the real height
1001  // is only known in CalcAscent!
1002 
1003  // The ratio is even crazier: a blank in Times New Roman has an ascent of
1004  // 182, a height of 200 and a width of 53!
1005  // It follows that a line with a lot of blanks is processed incorrectly.
1006  // Therefore we increase from factor 2 to 8 (due to negative kerning).
1007 
1008  pPor->SetLen(TextFrameIndex(1));
1009  CalcAscent( rInf, pPor );
1010 
1011  const SwFont* pTmpFnt = rInf.GetFont();
1012  sal_Int32 nExpect = std::min( sal_Int32( pTmpFnt->GetHeight() ),
1013  sal_Int32( pPor->GetAscent() ) ) / 8;
1014  if ( !nExpect )
1015  nExpect = 1;
1016  nExpect = sal_Int32(rInf.GetIdx()) + (rInf.GetLineWidth() / nExpect);
1017  if (TextFrameIndex(nExpect) > rInf.GetIdx() && nNextChg > TextFrameIndex(nExpect))
1018  nNextChg = TextFrameIndex(std::min(nExpect, rInf.GetText().getLength()));
1019 
1020  // we keep an invariant during method calls:
1021  // there are no portion ending characters like hard spaces
1022  // or tabs in [ nLeftScanIdx, nRightScanIdx ]
1023  if ( m_nLeftScanIdx <= rInf.GetIdx() && rInf.GetIdx() <= m_nRightScanIdx )
1024  {
1025  if ( nNextChg > m_nRightScanIdx )
1026  nNextChg = m_nRightScanIdx =
1027  rInf.ScanPortionEnd( m_nRightScanIdx, nNextChg );
1028  }
1029  else
1030  {
1031  m_nLeftScanIdx = rInf.GetIdx();
1032  nNextChg = m_nRightScanIdx =
1033  rInf.ScanPortionEnd( rInf.GetIdx(), nNextChg );
1034  }
1035 
1036  pPor->SetLen( nNextChg - rInf.GetIdx() );
1037  rInf.SetLen( pPor->GetLen() );
1038  return pPor;
1039 }
1040 
1041 // first portions have no length
1043 {
1044  SwLinePortion *pPor = nullptr;
1045 
1046  if( rInf.GetRest() )
1047  {
1048  // Tabs and fields
1049  if( '\0' != rInf.GetHookChar() )
1050  return nullptr;
1051 
1052  pPor = rInf.GetRest();
1053  if( pPor->IsErgoSumPortion() )
1054  rInf.SetErgoDone(true);
1055  else
1056  if( pPor->IsFootnoteNumPortion() )
1057  rInf.SetFootnoteDone(true);
1058  else
1059  if( pPor->InNumberGrp() )
1060  rInf.SetNumDone(true);
1061 
1062  rInf.SetRest(nullptr);
1063  m_pCurr->SetRest( true );
1064  return pPor;
1065  }
1066 
1067  // We can stand in the follow, it's crucial that
1068  // pFrame->GetOffset() == 0!
1069  if( rInf.GetIdx() )
1070  {
1071  // We now too can elongate FootnotePortions and ErgoSumPortions
1072 
1073  // 1. The ErgoSumTexts
1074  if( !rInf.IsErgoDone() )
1075  {
1076  if( m_pFrame->IsInFootnote() && !m_pFrame->GetIndPrev() )
1077  pPor = NewErgoSumPortion( rInf );
1078  rInf.SetErgoDone( true );
1079  }
1080 
1081  // 2. Arrow portions
1082  if( !pPor && !rInf.IsArrowDone() )
1083  {
1084  if( m_pFrame->GetOffset() && !m_pFrame->IsFollow() &&
1085  rInf.GetIdx() == m_pFrame->GetOffset() )
1086  pPor = new SwArrowPortion( *m_pCurr );
1087  rInf.SetArrowDone( true );
1088  }
1089 
1090  // 3. Kerning portions at beginning of line in grid mode
1091  if ( ! pPor && ! m_pCurr->GetNextPortion() )
1092  {
1093  SwTextGridItem const*const pGrid(
1094  GetGridItem(GetTextFrame()->FindPageFrame()));
1095  if ( pGrid )
1096  pPor = new SwKernPortion( *m_pCurr );
1097  }
1098 
1099  // 4. The line rests (multiline fields)
1100  if( !pPor )
1101  {
1102  pPor = rInf.GetRest();
1103  // Only for pPor of course
1104  if( pPor )
1105  {
1106  m_pCurr->SetRest( true );
1107  rInf.SetRest(nullptr);
1108  }
1109  }
1110  }
1111  else
1112  {
1113  // 5. The foot note count
1114  if( !rInf.IsFootnoteDone() )
1115  {
1116  OSL_ENSURE( ( ! rInf.IsMulti() && ! m_pMulti ) || m_pMulti->HasRotation(),
1117  "Rotated number portion trouble" );
1118 
1119  const bool bFootnoteNum = m_pFrame->IsFootnoteNumFrame();
1120  rInf.GetParaPortion()->SetFootnoteNum( bFootnoteNum );
1121  if( bFootnoteNum )
1122  pPor = NewFootnoteNumPortion( rInf );
1123  rInf.SetFootnoteDone( true );
1124  }
1125 
1126  // 6. The ErgoSumTexts of course also exist in the TextMaster,
1127  // it's crucial whether the SwFootnoteFrame is aFollow
1128  if( !rInf.IsErgoDone() && !pPor && ! rInf.IsMulti() )
1129  {
1130  if( m_pFrame->IsInFootnote() && !m_pFrame->GetIndPrev() )
1131  pPor = NewErgoSumPortion( rInf );
1132  rInf.SetErgoDone( true );
1133  }
1134 
1135  // 7. The numbering
1136  if( !rInf.IsNumDone() && !pPor )
1137  {
1138  OSL_ENSURE( ( ! rInf.IsMulti() && ! m_pMulti ) || m_pMulti->HasRotation(),
1139  "Rotated number portion trouble" );
1140 
1141  // If we're in the follow, then of course not
1143  pPor = NewNumberPortion( rInf );
1144  rInf.SetNumDone( true );
1145  }
1146  // 8. The DropCaps
1147  if( !pPor && GetDropFormat() && ! rInf.IsMulti() )
1148  pPor = NewDropPortion( rInf );
1149 
1150  // 9. Kerning portions at beginning of line in grid mode
1151  if ( !pPor && !m_pCurr->GetNextPortion() )
1152  {
1153  SwTextGridItem const*const pGrid(
1154  GetGridItem(GetTextFrame()->FindPageFrame()));
1155  if ( pGrid )
1156  pPor = new SwKernPortion( *m_pCurr );
1157  }
1158  }
1159 
1160  // 10. Decimal tab portion at the beginning of each line in table cells
1161  if ( !pPor && !m_pCurr->GetNextPortion() &&
1162  GetTextFrame()->IsInTab() &&
1164  {
1165  pPor = NewTabPortion( rInf, true );
1166  }
1167 
1168  // 11. suffix of meta-field
1169  if (!pPor)
1170  {
1171  pPor = TryNewNoLengthPortion(rInf);
1172  }
1173 
1174  // 12. bookmarks
1175  // check this *last* so that BuildMultiPortion() can find it!
1176  if (!pPor && rInf.CheckCurrentPosBookmark())
1177  {
1178  auto const bookmark(m_pScriptInfo->GetBookmark(rInf.GetIdx()));
1179  if (static_cast<bool>(bookmark))
1180  {
1181  sal_Unicode mark;
1184  {
1185  //mark = u'\u2336'; // not in OpenSymbol :(
1186  mark = '|';
1187  // hmm ... paint U+2345 over U+2346 should be same width?
1188  // and U+237F // or U+2E20/U+2E21
1189  }
1190  else if (bookmark & SwScriptInfo::MarkKind::Start)
1191  {
1192  mark = '[';
1193  }
1194  else if (bookmark & SwScriptInfo::MarkKind::End)
1195  {
1196  mark = ']';
1197  }
1198  else
1199  {
1201  mark = '|';
1202  }
1203  pPor = new SwBookmarkPortion(mark);
1204  }
1205  }
1206 
1207  return pPor;
1208 }
1209 
1210 static bool lcl_OldFieldRest( const SwLineLayout* pCurr )
1211 {
1212  if( !pCurr->GetNext() )
1213  return false;
1214  const SwLinePortion *pPor = pCurr->GetNext()->GetNextPortion();
1215  bool bRet = false;
1216  while( pPor && !bRet )
1217  {
1218  bRet = (pPor->InFieldGrp() && static_cast<const SwFieldPortion*>(pPor)->IsFollow()) ||
1219  (pPor->IsMultiPortion() && static_cast<const SwMultiPortion*>(pPor)->IsFollowField());
1220  if( !pPor->GetLen() )
1221  break;
1222  pPor = pPor->GetNextPortion();
1223  }
1224  return bRet;
1225 }
1226 
1227 /* NewPortion sets rInf.nLen
1228  * A SwTextPortion is limited by a tab, break, txtatr or attr change
1229  * We can have three cases:
1230  * 1) The line is full and the wrap was not emulated
1231  * -> return 0;
1232  * 2) The line is full and a wrap was emulated
1233  * -> Reset width and return new FlyPortion
1234  * 3) We need to construct a new portion
1235  * -> CalcFlyWidth emulates the width and return portion, if needed
1236  */
1237 
1239 {
1240  // Underflow takes precedence
1241  rInf.SetStopUnderflow( false );
1242  if( rInf.GetUnderflow() )
1243  {
1244  OSL_ENSURE( rInf.IsFull(), "SwTextFormatter::NewPortion: underflow but not full" );
1245  return Underflow( rInf );
1246  }
1247 
1248  // If the line is full, flys and Underflow portions could be waiting ...
1249  if( rInf.IsFull() )
1250  {
1251  // LineBreaks and Flys (bug05.sdw)
1252  // IsDummy()
1253  if( rInf.IsNewLine() && (!rInf.GetFly() || !m_pCurr->IsDummy()) )
1254  return nullptr;
1255 
1256  // When the text bumps into the Fly, or when the Fly comes first because
1257  // it juts out over the left edge, GetFly() is returned.
1258  // When IsFull() and no GetFly() is available, naturally zero is returned.
1259  if( rInf.GetFly() )
1260  {
1261  if( rInf.GetLast()->IsBreakPortion() )
1262  {
1263  delete rInf.GetFly();
1264  rInf.SetFly( nullptr );
1265  }
1266 
1267  return rInf.GetFly();
1268  }
1269 
1270  // A nasty special case: A frame without wrap overlaps the Footnote area.
1271  // We must declare the Footnote portion as rest of line, so that
1272  // SwTextFrame::Format doesn't abort (the text mass already was formatted).
1273  if( rInf.GetRest() )
1274  rInf.SetNewLine( true );
1275  else
1276  {
1277  // When the next line begins with a rest of a field, but now no
1278  // rest remains, the line must definitely be formatted anew!
1279  if( lcl_OldFieldRest( GetCurr() ) )
1280  rInf.SetNewLine( true );
1281  else
1282  {
1283  SwLinePortion *pFirst = WhichFirstPortion( rInf );
1284  if( pFirst )
1285  {
1286  rInf.SetNewLine( true );
1287  if( pFirst->InNumberGrp() )
1288  rInf.SetNumDone( false) ;
1289  delete pFirst;
1290  }
1291  }
1292  }
1293 
1294  return nullptr;
1295  }
1296 
1297  SwLinePortion *pPor = WhichFirstPortion( rInf );
1298 
1299  // Check for Hidden Portion:
1300  if ( !pPor )
1301  {
1302  TextFrameIndex nEnd = rInf.GetIdx();
1303  if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) )
1304  pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() );
1305  }
1306 
1307  if( !pPor )
1308  {
1309  if( ( !m_pMulti || m_pMulti->IsBidi() ) &&
1310  // i#42734
1311  // No multi portion if there is a hook character waiting:
1312  ( !rInf.GetRest() || '\0' == rInf.GetHookChar() ) )
1313  {
1314  // We open a multiportion part, if we enter a multi-line part
1315  // of the paragraph.
1316  TextFrameIndex nEnd = rInf.GetIdx();
1317  std::unique_ptr<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, m_pMulti );
1318  if( pCreate )
1319  {
1320  SwMultiPortion* pTmp = nullptr;
1321 
1322  if ( SwMultiCreatorId::Bidi == pCreate->nId )
1323  pTmp = new SwBidiPortion( nEnd, pCreate->nLevel );
1324  else if ( SwMultiCreatorId::Ruby == pCreate->nId )
1325  {
1326  pTmp = new SwRubyPortion( *pCreate, *rInf.GetFont(),
1328  nEnd, TextFrameIndex(0), rInf );
1329  }
1330  else if( SwMultiCreatorId::Rotate == pCreate->nId )
1331  {
1332  pTmp = new SwRotatedPortion( *pCreate, nEnd,
1333  GetTextFrame()->IsRightToLeft() );
1335  }
1336  else
1337  pTmp = new SwDoubleLinePortion( *pCreate, nEnd );
1338 
1339  pCreate.reset();
1340  CalcFlyWidth( rInf );
1341 
1342  return pTmp;
1343  }
1344  }
1345  // Tabs and Fields
1346  sal_Unicode cChar = rInf.GetHookChar();
1347 
1348  if( cChar )
1349  {
1350  /* We fetch cChar again to be sure that the tab is pending now and
1351  * didn't move to the next line (as happens behind frames).
1352  * However, when a FieldPortion is in the rest, we must naturally fetch
1353  * the cChar from the field content, e.g. DecimalTabs and fields (22615)
1354  */
1355  if( !rInf.GetRest() || !rInf.GetRest()->InFieldGrp() )
1356  cChar = rInf.GetChar( rInf.GetIdx() );
1357  rInf.ClearHookChar();
1358  }
1359  else
1360  {
1361  if (rInf.GetIdx() >= TextFrameIndex(rInf.GetText().getLength()))
1362  {
1363  rInf.SetFull(true);
1364  CalcFlyWidth( rInf );
1365  return pPor;
1366  }
1367  cChar = rInf.GetChar( rInf.GetIdx() );
1368  }
1369 
1370  switch( cChar )
1371  {
1372  case CH_TAB:
1373  pPor = NewTabPortion( rInf, false ); break;
1374 
1375  case CH_BREAK:
1376  pPor = new SwBreakPortion( *rInf.GetLast() ); break;
1377 
1378  case CHAR_SOFTHYPHEN: // soft hyphen
1379  pPor = new SwSoftHyphPortion; break;
1380 
1381  case CHAR_HARDBLANK: // no-break space
1382  // Please check tdf#115067 if you want to edit the char
1383  pPor = new SwBlankPortion( cChar ); break;
1384 
1385  case CHAR_HARDHYPHEN: // non-breaking hyphen
1386  pPor = new SwBlankPortion( '-' ); break;
1387 
1388  case CHAR_ZWSP: // zero width space
1389  case CHAR_ZWNBSP : // word joiner
1390  pPor = new SwControlCharPortion( cChar ); break;
1391 
1392  case CH_TXTATR_BREAKWORD:
1393  case CH_TXTATR_INWORD:
1394  if( rInf.HasHint( rInf.GetIdx() ) )
1395  {
1396  pPor = NewExtraPortion( rInf );
1397  break;
1398  }
1399  [[fallthrough]];
1400  default :
1401  {
1402  SwTabPortion* pLastTabPortion = rInf.GetLastTab();
1403  if ( pLastTabPortion && cChar == rInf.GetTabDecimal() )
1404  {
1405  // Abandon dec. tab position if line is full
1406  // We have a decimal tab portion in the line and the next character has to be
1407  // aligned at the tab stop position. We store the width from the beginning of
1408  // the tab stop portion up to the portion containing the decimal separator:
1409  if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT) /*rInf.GetVsh()->IsTabCompat();*/ &&
1410  PortionType::TabDecimal == pLastTabPortion->GetWhichPor() )
1411  {
1412  OSL_ENSURE( rInf.X() >= pLastTabPortion->GetFix(), "Decimal tab stop position cannot be calculated" );
1413  const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = static_cast<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() );
1414  static_cast<SwTabDecimalPortion*>(pLastTabPortion)->SetWidthOfPortionsUpToDecimalPosition( nWidthOfPortionsUpToDecimalPosition );
1415  rInf.SetTabDecimal( 0 );
1416  }
1417  else
1418  rInf.SetFull( rInf.GetLastTab()->Format( rInf ) );
1419  }
1420 
1421  if( rInf.GetRest() )
1422  {
1423  if( rInf.IsFull() )
1424  {
1425  rInf.SetNewLine(true);
1426  return nullptr;
1427  }
1428  pPor = rInf.GetRest();
1429  rInf.SetRest(nullptr);
1430  }
1431  else
1432  {
1433  if( rInf.IsFull() )
1434  return nullptr;
1435  pPor = NewTextPortion( rInf );
1436  }
1437  break;
1438  }
1439  }
1440 
1441  // if a portion is created despite there being a pending RestPortion,
1442  // then it is a field which has been split (e.g. because it contains a Tab)
1443  if( pPor && rInf.GetRest() )
1444  pPor->SetLen(TextFrameIndex(0));
1445 
1446  // robust:
1447  if( !pPor || rInf.IsStop() )
1448  {
1449  delete pPor;
1450  return nullptr;
1451  }
1452  }
1453 
1454  assert(pPor && "can only reach here with pPor existing");
1455 
1456  // Special portions containing numbers (footnote anchor, footnote number,
1457  // numbering) can be contained in a rotated portion, if the user
1458  // choose a rotated character attribute.
1459  if (!m_pMulti)
1460  {
1461  if ( pPor->IsFootnotePortion() )
1462  {
1463  const SwTextFootnote* pTextFootnote = static_cast<SwFootnotePortion*>(pPor)->GetTextFootnote();
1464 
1465  if ( pTextFootnote )
1466  {
1467  SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(pTextFootnote->GetFootnote());
1468  const SwDoc *const pDoc = &rInf.GetTextFrame()->GetDoc();
1469  const SwEndNoteInfo* pInfo;
1470  if( rFootnote.IsEndNote() )
1471  pInfo = &pDoc->GetEndNoteInfo();
1472  else
1473  pInfo = &pDoc->GetFootnoteInfo();
1474  const SwAttrSet& rSet = pInfo->GetAnchorCharFormat(const_cast<SwDoc&>(*pDoc))->GetAttrSet();
1475 
1476  const SfxPoolItem* pItem;
1477  sal_uInt16 nDir = 0;
1478  if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_ROTATE,
1479  true, &pItem ))
1480  nDir = static_cast<const SvxCharRotateItem*>(pItem)->GetValue();
1481 
1482  if ( 0 != nDir )
1483  {
1484  delete pPor;
1485  pPor = new SwRotatedPortion(rInf.GetIdx() + TextFrameIndex(1),
1486  900 == nDir
1487  ? DIR_BOTTOM2TOP
1488  : DIR_TOP2BOTTOM );
1489  }
1490  }
1491  }
1492  else if ( pPor->InNumberGrp() )
1493  {
1494  const SwFont* pNumFnt = static_cast<SwFieldPortion*>(pPor)->GetFont();
1495 
1496  if ( pNumFnt )
1497  {
1498  sal_uInt16 nDir = pNumFnt->GetOrientation( rInf.GetTextFrame()->IsVertical() );
1499  if ( 0 != nDir )
1500  {
1501  delete pPor;
1502  pPor = new SwRotatedPortion(TextFrameIndex(0), 900 == nDir
1503  ? DIR_BOTTOM2TOP
1504  : DIR_TOP2BOTTOM );
1505 
1506  rInf.SetNumDone( false );
1507  rInf.SetFootnoteDone( false );
1508  }
1509  }
1510  }
1511  }
1512 
1513  // The font is set in output device,
1514  // the ascent and the height will be calculated.
1515  if( !pPor->GetAscent() && !pPor->Height() )
1516  CalcAscent( rInf, pPor );
1517  rInf.SetLen( pPor->GetLen() );
1518 
1519  // In CalcFlyWidth Width() will be shortened if a FlyPortion is present.
1520  CalcFlyWidth( rInf );
1521 
1522  // One must not forget that pCurr as GetLast() must provide reasonable values:
1523  if( !m_pCurr->Height() )
1524  {
1525  OSL_ENSURE( m_pCurr->Height(), "SwTextFormatter::NewPortion: limbo dance" );
1526  m_pCurr->Height( pPor->Height(), false );
1527  m_pCurr->SetAscent( pPor->GetAscent() );
1528  }
1529 
1530  OSL_ENSURE(pPor->Height(), "SwTextFormatter::NewPortion: something went wrong");
1531  if( pPor->IsPostItsPortion() && rInf.X() >= rInf.Width() && rInf.GetFly() )
1532  {
1533  delete pPor;
1534  pPor = rInf.GetFly();
1535  }
1536  return pPor;
1537 }
1538 
1540 {
1541  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
1542  "SwTextFormatter::FormatLine( nStartPos ) with unswapped frame" );
1543 
1544  // For the formatting routines, we set pOut to the reference device.
1545  SwHookOut aHook( GetInfo() );
1546  if (GetInfo().GetLen() < TextFrameIndex(GetInfo().GetText().getLength()))
1547  GetInfo().SetLen(TextFrameIndex(GetInfo().GetText().getLength()));
1548 
1549  bool bBuild = true;
1550  SetFlyInCntBase( false );
1551  GetInfo().SetLineHeight( 0 );
1552  GetInfo().SetLineNetHeight( 0 );
1553 
1554  // Recycling must be suppressed by changed line height and also
1555  // by changed ascent (lowering of baseline).
1556  const sal_uInt16 nOldHeight = m_pCurr->Height();
1557  const sal_uInt16 nOldAscent = m_pCurr->GetAscent();
1558 
1559  m_pCurr->SetEndHyph( false );
1560  m_pCurr->SetMidHyph( false );
1561 
1562  // fly positioning can make it necessary format a line several times
1563  // for this, we have to keep a copy of our rest portion
1564  SwLinePortion* pField = GetInfo().GetRest();
1565  std::unique_ptr<SwFieldPortion> xSaveField;
1566 
1567  if ( pField && pField->InFieldGrp() && !pField->IsFootnotePortion() )
1568  xSaveField.reset(new SwFieldPortion( *static_cast<SwFieldPortion*>(pField) ));
1569 
1570  // for an optimal repaint rectangle, we want to compare fly portions
1571  // before and after the BuildPortions call
1572  const bool bOptimizeRepaint = AllowRepaintOpt();
1573  TextFrameIndex const nOldLineEnd = nStartPos + m_pCurr->GetLen();
1574  std::vector<long> flyStarts;
1575 
1576  // these are the conditions for a fly position comparison
1577  if ( bOptimizeRepaint && m_pCurr->IsFly() )
1578  {
1580  long nPOfst = 0;
1581  while ( pPor )
1582  {
1583  if ( pPor->IsFlyPortion() )
1584  // insert start value of fly portion
1585  flyStarts.push_back( nPOfst );
1586 
1587  nPOfst += pPor->Width();
1588  pPor = pPor->GetNextPortion();
1589  }
1590  }
1591 
1592  // Here soon the underflow check follows.
1593  while( bBuild )
1594  {
1595  GetInfo().SetFootnoteInside( false );
1597 
1598  // These values must not be reset by FormatReset();
1599  const bool bOldNumDone = GetInfo().IsNumDone();
1600  const bool bOldArrowDone = GetInfo().IsArrowDone();
1601  const bool bOldErgoDone = GetInfo().IsErgoDone();
1602 
1603  // besides other things, this sets the repaint offset to 0
1604  FormatReset( GetInfo() );
1605 
1606  GetInfo().SetNumDone( bOldNumDone );
1607  GetInfo().SetArrowDone( bOldArrowDone );
1608  GetInfo().SetErgoDone( bOldErgoDone );
1609 
1610  // build new portions for this line
1611  BuildPortions( GetInfo() );
1612 
1613  if( GetInfo().IsStop() )
1614  {
1616  m_pCurr->Height( GetFrameRstHeight() + 1, false );
1618  m_pCurr->Width(0);
1619  m_pCurr->Truncate();
1620  return nStartPos;
1621  }
1622  else if( GetInfo().IsDropInit() )
1623  {
1624  DropInit();
1625  GetInfo().SetDropInit( false );
1626  }
1627 
1628  m_pCurr->CalcLine( *this, GetInfo() );
1630 
1631  //i#120864 For Special case that at the first calculation couldn't get
1632  //correct height. And need to recalculate for the right height.
1633  SwLinePortion* pPorTmp = m_pCurr->GetNextPortion();
1634  if ( IsFlyInCntBase() && (!IsQuick() || (pPorTmp && pPorTmp->IsFlyCntPortion() && !pPorTmp->GetNextPortion() &&
1635  m_pCurr->Height() > pPorTmp->Height())))
1636  {
1637  sal_uInt16 nTmpAscent, nTmpHeight;
1638  CalcAscentAndHeight( nTmpAscent, nTmpHeight );
1639  AlignFlyInCntBase( Y() + long( nTmpAscent ) );
1640  m_pCurr->CalcLine( *this, GetInfo() );
1641  CalcRealHeight();
1642  }
1643 
1644  // bBuild decides if another lap of honor is done
1645  if ( m_pCurr->GetRealHeight() <= GetInfo().GetLineHeight() )
1646  {
1648  bBuild = false;
1649  }
1650  else
1651  {
1652  bBuild = ( GetInfo().GetTextFly().IsOn() && ChkFlyUnderflow(GetInfo()) )
1654  if( bBuild )
1655  {
1656  GetInfo().SetNumDone( bOldNumDone );
1658 
1659  // delete old rest
1660  if ( GetInfo().GetRest() )
1661  {
1662  delete GetInfo().GetRest();
1663  GetInfo().SetRest( nullptr );
1664  }
1665 
1666  // set original rest portion
1667  if ( xSaveField )
1668  GetInfo().SetRest( new SwFieldPortion( *xSaveField ) );
1669 
1671  m_pCurr->Width(0);
1672  m_pCurr->Truncate();
1673  }
1674  }
1675  }
1676 
1677  // In case of compat mode, it's possible that a tab portion is wider after
1678  // formatting than before. If this is the case, we also have to make sure
1679  // the SwLineLayout is wider as well.
1680  if (GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN))
1681  {
1682  sal_uInt16 nSum = 0;
1684 
1685  while (pPor)
1686  {
1687  nSum += pPor->Width();
1688  pPor = pPor->GetNextPortion();
1689  }
1690 
1691  if (nSum > m_pCurr->Width())
1692  m_pCurr->Width(nSum);
1693  }
1694 
1695  // calculate optimal repaint rectangle
1696  if ( bOptimizeRepaint )
1697  {
1698  GetInfo().SetPaintOfst( ::lcl_CalcOptRepaint( *this, *m_pCurr, nOldLineEnd, flyStarts ) );
1699  flyStarts.clear();
1700  }
1701  else
1702  // Special case: we do not allow an optimization of the repaint
1703  // area, but during formatting the repaint offset is set to indicate
1704  // a maximum value for the offset. This value has to be reset:
1705  GetInfo().SetPaintOfst( 0 );
1706 
1707  // This corrects the start of the reformat range if something has
1708  // moved to the next line. Otherwise IsFirstReformat in AllowRepaintOpt
1709  // will give us a wrong result if we have to reformat another line
1710  GetInfo().GetParaPortion()->GetReformat().LeftMove( GetInfo().GetIdx() );
1711 
1712  // delete master copy of rest portion
1713  xSaveField.reset();
1714 
1715  TextFrameIndex const nNewStart = nStartPos + m_pCurr->GetLen();
1716 
1717  // adjust text if kana compression is enabled
1718  if ( GetInfo().CompressLine() )
1719  {
1720  SwTwips nRepaintOfst = CalcKanaAdj( m_pCurr );
1721 
1722  // adjust repaint offset
1723  if ( nRepaintOfst < GetInfo().GetPaintOfst() )
1724  GetInfo().SetPaintOfst( nRepaintOfst );
1725  }
1726 
1728 
1729  if( nOldHeight != m_pCurr->Height() || nOldAscent != m_pCurr->GetAscent() )
1730  {
1731  SetFlyInCntBase();
1732  GetInfo().SetPaintOfst( 0 ); // changed line height => no recycling
1733  // all following line must be painted and when Flys are around,
1734  // also formatted
1735  GetInfo().SetShift( true );
1736  }
1737 
1738  if ( IsFlyInCntBase() && !IsQuick() )
1740 
1741  return nNewStart;
1742 }
1743 
1745 {
1746  do
1747  {
1748  CalcRealHeight();
1749  } while (Next());
1750 }
1751 
1752 void SwTextFormatter::CalcRealHeight( bool bNewLine )
1753 {
1754  sal_uInt16 nLineHeight = m_pCurr->Height();
1755  m_pCurr->SetClipping( false );
1756 
1757  SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
1758  if ( pGrid && GetInfo().SnapToGrid() )
1759  {
1760  const sal_uInt16 nGridWidth = pGrid->GetBaseHeight();
1761  const sal_uInt16 nRubyHeight = pGrid->GetRubyHeight();
1762  const bool bRubyTop = ! pGrid->GetRubyTextBelow();
1763 
1764  nLineHeight = nGridWidth + nRubyHeight;
1765  const sal_uInt16 nAmpRatio = (m_pCurr->Height() + nLineHeight - 1)/nLineHeight;
1766  nLineHeight *= nAmpRatio;
1767 
1768  const sal_uInt16 nAsc = m_pCurr->GetAscent() +
1769  ( bRubyTop ?
1770  ( nLineHeight - m_pCurr->Height() + nRubyHeight ) / 2 :
1771  ( nLineHeight - m_pCurr->Height() - nRubyHeight ) / 2 );
1772 
1773  m_pCurr->Height( nLineHeight, false );
1774  m_pCurr->SetAscent( nAsc );
1776 
1777  // we ignore any line spacing options except from ...
1778  const SvxLineSpacingItem* pSpace = m_aLineInf.GetLineSpacing();
1779  if ( ! IsParaLine() && pSpace &&
1780  SvxInterLineSpaceRule::Prop == pSpace->GetInterLineSpaceRule() )
1781  {
1782  sal_uLong nTmp = pSpace->GetPropLineSpace();
1783 
1784  if( nTmp < 100 )
1785  nTmp = 100;
1786 
1787  nTmp *= nLineHeight;
1788  nLineHeight = static_cast<sal_uInt16>(nTmp / 100);
1789  }
1790 
1791  m_pCurr->SetRealHeight( nLineHeight );
1792  return;
1793  }
1794 
1795  // The dummy flag is set on lines that only contain flyportions, these shouldn't
1796  // consider register-true and so on. Unfortunately an empty line can be at
1797  // the end of a paragraph (empty paragraphs or behind a Shift-Return),
1798  // which should consider the register.
1799  if (!m_pCurr->IsDummy() || (!m_pCurr->GetNext()
1800  && GetStart() >= TextFrameIndex(GetTextFrame()->GetText().getLength())
1801  && !bNewLine))
1802  {
1803  const SvxLineSpacingItem *pSpace = m_aLineInf.GetLineSpacing();
1804  if( pSpace )
1805  {
1806  switch( pSpace->GetLineSpaceRule() )
1807  {
1808  case SvxLineSpaceRule::Auto:
1809  // shrink first line of paragraph too on spacing < 100%
1810  if (IsParaLine() &&
1811  pSpace->GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop
1813  {
1814  long nTmp = pSpace->GetPropLineSpace();
1815  // Word will render < 50% too but it's just not readable
1816  if( nTmp < 50 )
1817  nTmp = nTmp ? 50 : 100;
1818  if (nTmp<100) { // code adapted from fixed line height
1819  nTmp *= nLineHeight;
1820  nTmp /= 100;
1821  if( !nTmp )
1822  ++nTmp;
1823  nLineHeight = static_cast<sal_uInt16>(nTmp);
1824  sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80%
1825 #if 0
1826  // could do clipping here (like Word does)
1827  // but at 0.5 its unreadable either way...
1828  if( nAsc < pCurr->GetAscent() ||
1829  nLineHeight - nAsc < pCurr->Height() -
1830  pCurr->GetAscent() )
1831  pCurr->SetClipping( true );
1832 #endif
1833  m_pCurr->SetAscent( nAsc );
1834  m_pCurr->Height( nLineHeight, false );
1836  }
1837  }
1838  break;
1839  case SvxLineSpaceRule::Min:
1840  {
1841  if( nLineHeight < pSpace->GetLineHeight() )
1842  nLineHeight = pSpace->GetLineHeight();
1843  break;
1844  }
1845  case SvxLineSpaceRule::Fix:
1846  {
1847  nLineHeight = pSpace->GetLineHeight();
1848  const sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80%
1849  if( nAsc < m_pCurr->GetAscent() ||
1850  nLineHeight - nAsc < m_pCurr->Height() - m_pCurr->GetAscent() )
1851  m_pCurr->SetClipping( true );
1852  m_pCurr->Height( nLineHeight, false );
1853  m_pCurr->SetAscent( nAsc );
1855  }
1856  break;
1857  default: OSL_FAIL( ": unknown LineSpaceRule" );
1858  }
1859  // Note: for the _first_ line the line spacing of the previous
1860  // paragraph is applied in SwFlowFrame::CalcUpperSpace()
1861  if( !IsParaLine() )
1862  switch( pSpace->GetInterLineSpaceRule() )
1863  {
1864  case SvxInterLineSpaceRule::Off:
1865  break;
1866  case SvxInterLineSpaceRule::Prop:
1867  {
1868  long nTmp = pSpace->GetPropLineSpace();
1869  // 50% is the minimum, if 0% we switch to the
1870  // default value 100% ...
1871  if( nTmp < 50 )
1872  nTmp = nTmp ? 50 : 100;
1873 
1874  // extend line height by (nPropLineSpace - 100) percent of the font height
1875  nTmp -= 100;
1876  nTmp *= m_pCurr->GetTextHeight();
1877  nTmp /= 100;
1878  nTmp += nLineHeight;
1879  if (nTmp < 1)
1880  nTmp = 1;
1881  nLineHeight = static_cast<sal_uInt16>(nTmp);
1882  break;
1883  }
1884  case SvxInterLineSpaceRule::Fix:
1885  {
1886  nLineHeight = nLineHeight + pSpace->GetInterLineSpace();
1887  break;
1888  }
1889  default: OSL_FAIL( ": unknown InterLineSpaceRule" );
1890  }
1891  }
1892 
1893  if( IsRegisterOn() )
1894  {
1895  SwTwips nTmpY = Y() + m_pCurr->GetAscent() + nLineHeight - m_pCurr->Height();
1896  SwRectFnSet aRectFnSet(m_pFrame);
1897  if ( aRectFnSet.IsVert() )
1898  nTmpY = m_pFrame->SwitchHorizontalToVertical( nTmpY );
1899  nTmpY = aRectFnSet.YDiff( nTmpY, RegStart() );
1900  const sal_uInt16 nDiff = sal_uInt16( nTmpY % RegDiff() );
1901  if( nDiff )
1902  nLineHeight += RegDiff() - nDiff;
1903  }
1904  }
1905  m_pCurr->SetRealHeight( nLineHeight );
1906 }
1907 
1909 {
1910  // delete Fly in any case!
1911  ClearFly( rInf );
1912  rInf.Init();
1913 
1914  rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
1915  rInf.SetRoot( m_pCurr );
1916  rInf.SetLineStart( m_nStart );
1917  rInf.SetIdx( m_nStart );
1918  rInf.Left( Left() );
1919  rInf.Right( Right() );
1920  rInf.First( FirstLeft() );
1921  rInf.LeftMargin(GetLeftMargin());
1922 
1923  rInf.RealWidth( sal_uInt16(rInf.Right() - GetLeftMargin()) );
1924  rInf.Width( rInf.RealWidth() );
1925  if( const_cast<SwTextFormatter*>(this)->GetRedln() )
1926  {
1927  const_cast<SwTextFormatter*>(this)->GetRedln()->Clear( const_cast<SwTextFormatter*>(this)->GetFnt() );
1928  const_cast<SwTextFormatter*>(this)->GetRedln()->Reset();
1929  }
1930 }
1931 
1933 {
1934  m_pFirstOfBorderMerge = nullptr;
1935  m_pCurr->Truncate();
1936  m_pCurr->Init();
1937 
1938  // delete pSpaceAdd and pKanaComp
1941  m_pCurr->ResetFlags();
1942  FeedInf( rInf );
1943 }
1944 
1946 {
1947  if( m_pDropFormat )
1948  {
1949  const sal_uInt16 nOldDrop = GetDropHeight();
1951  m_bOnceMore = nOldDrop != GetDropHeight();
1952  }
1953  else
1954  m_bOnceMore = false;
1955  return m_bOnceMore;
1956 }
1957 
1959 {
1960  SwTwips nRet = Y() + GetLineHeight();
1961  SwTwips nMin = GetInfo().GetTextFly().GetMinBottom();
1962  if( nMin && ++nMin > nRet )
1963  {
1966  if( nRet + nDist < nMin )
1967  {
1968  const bool bRepaint = HasTruncLines() &&
1969  GetInfo().GetParaPortion()->GetRepaint().Bottom() == nRet-1;
1970  nRet = nMin - nDist;
1971  if( bRepaint )
1972  {
1973  const_cast<SwRepaint&>(GetInfo().GetParaPortion()
1974  ->GetRepaint()).Bottom( nRet-1 );
1975  const_cast<SwTextFormatInfo&>(GetInfo()).SetPaintOfst( 0 );
1976  }
1977  }
1978  }
1979  return nRet;
1980 }
1981 
1982 // FME/OD: This routine does a limited text formatting.
1984 {
1985  FormatReset( GetInfo() );
1986  BuildPortions( GetInfo() );
1987  m_pCurr->CalcLine( *this, GetInfo() );
1988  return m_pCurr->Width();
1989 }
1990 
1991 // determines if the calculation of a repaint offset is allowed
1992 // otherwise each line is painted from 0 (this is a copy of the beginning
1993 // of the former SwTextFormatter::Recycle() function
1995 {
1996  // reformat position in front of current line? Only in this case
1997  // we want to set the repaint offset
1998  bool bOptimizeRepaint = m_nStart < GetInfo().GetReformatStart() &&
1999  m_pCurr->GetLen();
2000 
2001  // a special case is the last line of a block adjusted paragraph:
2002  if ( bOptimizeRepaint )
2003  {
2004  switch( GetAdjust() )
2005  {
2006  case SvxAdjust::Block:
2007  {
2008  if( IsLastBlock() || IsLastCenter() )
2009  bOptimizeRepaint = false;
2010  else
2011  {
2012  // ????: blank in the last master line (blocksat.sdw)
2013  bOptimizeRepaint = nullptr == m_pCurr->GetNext() && !m_pFrame->GetFollow();
2014  if ( bOptimizeRepaint )
2015  {
2017  while ( pPos && !pPos->IsFlyPortion() )
2018  pPos = pPos->GetNextPortion();
2019  bOptimizeRepaint = !pPos;
2020  }
2021  }
2022  break;
2023  }
2024  case SvxAdjust::Center:
2025  case SvxAdjust::Right:
2026  bOptimizeRepaint = false;
2027  break;
2028  default: ;
2029  }
2030  }
2031 
2032  // Again another special case: invisible SoftHyphs
2033  const TextFrameIndex nReformat = GetInfo().GetReformatStart();
2034  if (bOptimizeRepaint && TextFrameIndex(COMPLETE_STRING) != nReformat)
2035  {
2036  const sal_Unicode cCh = nReformat >= TextFrameIndex(GetInfo().GetText().getLength())
2037  ? 0
2038  : GetInfo().GetText()[ sal_Int32(nReformat) ];
2039  bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
2040  || ! GetInfo().HasHint( nReformat );
2041  }
2042 
2043  return bOptimizeRepaint;
2044 }
2045 
2047 {
2048  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2049  "SwTextFormatter::CalcUnclipped with unswapped frame" );
2050 
2051  long nFlyAsc, nFlyDesc;
2052  m_pCurr->MaxAscentDescent( rTop, rBottom, nFlyAsc, nFlyDesc );
2053  rTop = Y() + GetCurr()->GetAscent();
2054  rBottom = rTop + nFlyDesc;
2055  rTop -= nFlyAsc;
2056 }
2057 
2058 void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
2059  TextFrameIndex const nStartIdx, bool bAlways) const
2060 {
2061  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2062  "SwTextFormatter::UpdatePos with unswapped frame" );
2063 
2064  if( GetInfo().IsTest() )
2065  return;
2066  SwLinePortion *pFirst = pCurrent->GetFirstPortion();
2067  SwLinePortion *pPos = pFirst;
2068  SwTextPaintInfo aTmpInf( GetInfo() );
2069  aTmpInf.SetpSpaceAdd( pCurrent->GetpLLSpaceAdd() );
2070  aTmpInf.ResetSpaceIdx();
2071  aTmpInf.SetKanaComp( pCurrent->GetpKanaComp() );
2072  aTmpInf.ResetKanaIdx();
2073 
2074  // The frame's size
2075  aTmpInf.SetIdx( nStartIdx );
2076  aTmpInf.SetPos( aStart );
2077 
2078  long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2079  pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2080 
2081  const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
2082  sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
2084  if( GetMulti() )
2085  {
2086  aTmpInf.SetDirection( GetMulti()->GetDirection() );
2087  if( GetMulti()->HasRotation() )
2088  {
2089  nFlags |= AsCharFlags::Rotate;
2090  if( GetMulti()->IsRevers() )
2091  {
2092  nFlags |= AsCharFlags::Reverse;
2093  aTmpInf.X( aTmpInf.X() - nAscent );
2094  }
2095  else
2096  aTmpInf.X( aTmpInf.X() + nAscent );
2097  }
2098  else
2099  {
2100  if ( GetMulti()->IsBidi() )
2101  nFlags |= AsCharFlags::Bidi;
2102  aTmpInf.Y( aTmpInf.Y() + nAscent );
2103  }
2104  }
2105  else
2106  aTmpInf.Y( aTmpInf.Y() + nAscent );
2107 
2108  while( pPos )
2109  {
2110  // We only know one case where changing the position (caused by the
2111  // adjustment) could be relevant for a portion: We need to SetRefPoint
2112  // for FlyCntPortions.
2113  if( ( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
2114  && ( bAlways || !IsQuick() ) )
2115  {
2116  pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, pPos );
2117 
2118  if( pPos->IsGrfNumPortion() )
2119  {
2120  if( !nFlyAsc && !nFlyDesc )
2121  {
2122  nTmpAscent = nAscent;
2123  nFlyAsc = nAscent;
2124  nTmpDescent = nTmpHeight - nAscent;
2125  nFlyDesc = nTmpDescent;
2126  }
2127  static_cast<SwGrfNumPortion*>(pPos)->SetBase( nTmpAscent, nTmpDescent,
2128  nFlyAsc, nFlyDesc );
2129  }
2130  else
2131  {
2132  Point aBase( aTmpInf.GetPos() );
2133  if ( GetInfo().GetTextFrame()->IsVertical() )
2135 
2136  static_cast<SwFlyCntPortion*>(pPos)->SetBase( *aTmpInf.GetTextFrame(),
2137  aBase, nTmpAscent, nTmpDescent, nFlyAsc,
2138  nFlyDesc, nFlags );
2139  }
2140  }
2141  if( pPos->IsMultiPortion() && static_cast<SwMultiPortion*>(pPos)->HasFlyInContent() )
2142  {
2143  OSL_ENSURE( !GetMulti(), "Too much multi" );
2144  const_cast<SwTextFormatter*>(this)->m_pMulti = static_cast<SwMultiPortion*>(pPos);
2145  SwLineLayout *pLay = &GetMulti()->GetRoot();
2146  Point aSt( aTmpInf.X(), aStart.Y() );
2147 
2148  if ( GetMulti()->HasBrackets() )
2149  {
2150  OSL_ENSURE( GetMulti()->IsDouble(), "Brackets only for doubles");
2151  aSt.AdjustX(static_cast<SwDoubleLinePortion*>(GetMulti())->PreWidth() );
2152  }
2153  else if( GetMulti()->HasRotation() )
2154  {
2155  aSt.AdjustY(pCurrent->GetAscent() - GetMulti()->GetAscent() );
2156  if( GetMulti()->IsRevers() )
2157  aSt.AdjustX(GetMulti()->Width() );
2158  else
2159  aSt.AdjustY(GetMulti()->Height() );
2160  }
2161  else if ( GetMulti()->IsBidi() )
2162  // jump to end of the bidi portion
2163  aSt.AdjustX(pLay->Width() );
2164 
2165  TextFrameIndex nStIdx = aTmpInf.GetIdx();
2166  do
2167  {
2168  UpdatePos( pLay, aSt, nStIdx, bAlways );
2169  nStIdx = nStIdx + pLay->GetLen();
2170  aSt.AdjustY(pLay->Height() );
2171  pLay = pLay->GetNext();
2172  } while ( pLay );
2173  const_cast<SwTextFormatter*>(this)->m_pMulti = nullptr;
2174  }
2175  pPos->Move( aTmpInf );
2176  pPos = pPos->GetNextPortion();
2177  }
2178 }
2179 
2180 void SwTextFormatter::AlignFlyInCntBase( long nBaseLine ) const
2181 {
2182  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2183  "SwTextFormatter::AlignFlyInCntBase with unswapped frame" );
2184 
2185  if( GetInfo().IsTest() )
2186  return;
2187  SwLinePortion *pFirst = m_pCurr->GetFirstPortion();
2188  SwLinePortion *pPos = pFirst;
2189  AsCharFlags nFlags = AsCharFlags::None;
2190  if( GetMulti() && GetMulti()->HasRotation() )
2191  {
2192  nFlags |= AsCharFlags::Rotate;
2193  if( GetMulti()->IsRevers() )
2194  nFlags |= AsCharFlags::Reverse;
2195  }
2196 
2197  long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2198 
2199  while( pPos )
2200  {
2201  if( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
2202  {
2203  m_pCurr->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, pPos );
2204 
2205  if( pPos->IsGrfNumPortion() )
2206  static_cast<SwGrfNumPortion*>(pPos)->SetBase( nTmpAscent, nTmpDescent,
2207  nFlyAsc, nFlyDesc );
2208  else
2209  {
2210  Point aBase;
2211  if ( GetInfo().GetTextFrame()->IsVertical() )
2212  {
2213  nBaseLine = GetInfo().GetTextFrame()->SwitchHorizontalToVertical( nBaseLine );
2214  aBase = Point( nBaseLine, static_cast<SwFlyCntPortion*>(pPos)->GetRefPoint().Y() );
2215  }
2216  else
2217  aBase = Point( static_cast<SwFlyCntPortion*>(pPos)->GetRefPoint().X(), nBaseLine );
2218 
2219  static_cast<SwFlyCntPortion*>(pPos)->SetBase( *GetInfo().GetTextFrame(), aBase, nTmpAscent, nTmpDescent,
2220  nFlyAsc, nFlyDesc, nFlags );
2221  }
2222  }
2223  pPos = pPos->GetNextPortion();
2224  }
2225 }
2226 
2228 {
2229  OSL_ENSURE( rInf.GetTextFly().IsOn(), "SwTextFormatter::ChkFlyUnderflow: why?" );
2230  if( GetCurr() )
2231  {
2232  // First we check, whether a fly overlaps with the line.
2233  // = GetLineHeight()
2234  const sal_uInt16 nHeight = GetCurr()->GetRealHeight();
2235  SwRect aLine( GetLeftMargin(), Y(), rInf.RealWidth(), nHeight );
2236 
2237  SwRect aLineVert( aLine );
2238  if ( m_pFrame->IsVertical() )
2239  m_pFrame->SwitchHorizontalToVertical( aLineVert );
2240  SwRect aInter( rInf.GetTextFly().GetFrame( aLineVert ) );
2241  if ( m_pFrame->IsVertical() )
2243 
2244  if( !aInter.HasArea() )
2245  return false;
2246 
2247  // We now check every portion that could have lowered for overlapping
2248  // with the fly.
2249  const SwLinePortion *pPos = GetCurr()->GetFirstPortion();
2250  aLine.Pos().setY( Y() + GetCurr()->GetRealHeight() - GetCurr()->Height() );
2251  aLine.Height( GetCurr()->Height() );
2252 
2253  while( pPos )
2254  {
2255  aLine.Width( pPos->Width() );
2256 
2257  aLineVert = aLine;
2258  if ( m_pFrame->IsVertical() )
2259  m_pFrame->SwitchHorizontalToVertical( aLineVert );
2260  aInter = rInf.GetTextFly().GetFrame( aLineVert );
2261  if ( m_pFrame->IsVertical() )
2263 
2264  // New flys from below?
2265  if( !pPos->IsFlyPortion() )
2266  {
2267  if( aInter.IsOver( aLine ) )
2268  {
2269  aInter.Intersection_( aLine );
2270  if( aInter.HasArea() )
2271  {
2272  // To be evaluated during reformat of this line:
2273  // RealHeight including spacing
2274  rInf.SetLineHeight( nHeight );
2275  // Height without extra spacing
2276  rInf.SetLineNetHeight( m_pCurr->Height() );
2277  return true;
2278  }
2279  }
2280  }
2281  else
2282  {
2283  // The fly portion is not intersected by a fly anymore
2284  if ( ! aInter.IsOver( aLine ) )
2285  {
2286  rInf.SetLineHeight( nHeight );
2287  rInf.SetLineNetHeight( m_pCurr->Height() );
2288  return true;
2289  }
2290  else
2291  {
2292  aInter.Intersection_( aLine );
2293 
2294  // No area means a fly has become invalid because of
2295  // lowering the line => reformat the line
2296  // we also have to reformat the line, if the fly size
2297  // differs from the intersection interval's size.
2298  if( ! aInter.HasArea() ||
2299  static_cast<const SwFlyPortion*>(pPos)->GetFixWidth() != aInter.Width() )
2300  {
2301  rInf.SetLineHeight( nHeight );
2302  rInf.SetLineNetHeight( m_pCurr->Height() );
2303  return true;
2304  }
2305  }
2306  }
2307 
2308  aLine.Left( aLine.Left() + pPos->Width() );
2309  pPos = pPos->GetNextPortion();
2310  }
2311  }
2312  return false;
2313 }
2314 
2316 {
2317  if( GetMulti() || rInf.GetFly() )
2318  return;
2319 
2320  SwTextFly& rTextFly = rInf.GetTextFly();
2321  if( !rTextFly.IsOn() || rInf.IsIgnoreFly() )
2322  return;
2323 
2324  const SwLinePortion *pLast = rInf.GetLast();
2325 
2326  long nAscent;
2327  long nTop = Y();
2328  long nHeight;
2329 
2330  if( rInf.GetLineHeight() )
2331  {
2332  // Real line height has already been calculated, we only have to
2333  // search for intersections in the lower part of the strip
2334  nAscent = m_pCurr->GetAscent();
2335  nHeight = rInf.GetLineNetHeight();
2336  nTop += rInf.GetLineHeight() - nHeight;
2337  }
2338  else
2339  {
2340  // We make a first guess for the lines real height
2341  if ( ! m_pCurr->GetRealHeight() )
2342  CalcRealHeight();
2343 
2344  nAscent = pLast->GetAscent();
2345  nHeight = pLast->Height();
2346 
2347  if ( m_pCurr->GetRealHeight() > nHeight )
2348  nTop += m_pCurr->GetRealHeight() - nHeight;
2349  else
2350  // Important for fixed space between lines
2351  nHeight = m_pCurr->GetRealHeight();
2352  }
2353 
2354  const long nLeftMar = GetLeftMargin();
2355  const long nLeftMin = (rInf.X() || GetDropLeft()) ? nLeftMar : GetLeftMin();
2356 
2357  SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X()
2358  + nLeftMar - nLeftMin , nHeight );
2359 
2360  // tdf#116486: consider also the upper margin from getFramePrintArea because intersections
2361  // with this additional space should lead to repositioning of paragraphs
2362  // For compatibility we grab a related compat flag:
2364  && IsFirstTextLine())
2365  {
2366  const long nUpper = m_pFrame->getFramePrintArea().Top();
2367  // Increase the rectangle
2368  if( nUpper > 0 && nTop >= nUpper )
2369  aLine.SubTop( nUpper );
2370  }
2371  SwRect aLineVert( aLine );
2372  if ( m_pFrame->IsRightToLeft() )
2373  m_pFrame->SwitchLTRtoRTL( aLineVert );
2374 
2375  if ( m_pFrame->IsVertical() )
2376  m_pFrame->SwitchHorizontalToVertical( aLineVert );
2377 
2378  // GetFrame(...) determines and returns the intersection rectangle
2379  SwRect aInter( rTextFly.GetFrame( aLineVert ) );
2380 
2381  if ( m_pFrame->IsRightToLeft() )
2382  m_pFrame->SwitchRTLtoLTR( aInter );
2383 
2384  if ( m_pFrame->IsVertical() )
2386 
2387  if (!aInter.IsEmpty() && aInter.Bottom() < nTop)
2388  {
2389  // Intersects with the frame area (with upper margin), but not with the print area (without
2390  // upper margin). Don't reserve space for the fly portion in this case, text is allowed to
2391  // flow there.
2392  aInter.Height(0);
2393  }
2394 
2395  if( !aInter.IsOver( aLine ) )
2396  return;
2397 
2398  aLine.Left( rInf.X() + nLeftMar );
2399  bool bForced = false;
2400  if( aInter.Left() <= nLeftMin )
2401  {
2402  SwTwips nFrameLeft = GetTextFrame()->getFrameArea().Left();
2403  if( GetTextFrame()->getFramePrintArea().Left() < 0 )
2404  nFrameLeft += GetTextFrame()->getFramePrintArea().Left();
2405  if( aInter.Left() < nFrameLeft )
2406  aInter.Left( nFrameLeft );
2407 
2408  long nAddMar = 0;
2409  if ( m_pFrame->IsRightToLeft() )
2410  {
2411  nAddMar = m_pFrame->getFrameArea().Right() - Right();
2412  if ( nAddMar < 0 )
2413  nAddMar = 0;
2414  }
2415  else
2416  nAddMar = nLeftMar - nFrameLeft;
2417 
2418  aInter.Width( aInter.Width() + nAddMar );
2419  // For a negative first line indent, we set this flag to show
2420  // that the indentation/margin has been moved.
2421  // This needs to be respected by the DefaultTab at the zero position.
2422  if( IsFirstTextLine() && HasNegFirst() )
2423  bForced = true;
2424  }
2425  aInter.Intersection( aLine );
2426  if( !aInter.HasArea() )
2427  return;
2428 
2429  const bool bFullLine = aLine.Left() == aInter.Left() &&
2430  aLine.Right() == aInter.Right();
2431 
2432  // Although no text is left, we need to format another line,
2433  // because also empty lines need to avoid a Fly with no wrapping.
2434  if (bFullLine && rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
2435  {
2436  rInf.SetNewLine( true );
2437  // We know that for dummies, it holds ascent == height
2438  m_pCurr->SetDummy(true);
2439  }
2440 
2441  // aInter becomes frame-local
2442  aInter.Pos().AdjustX( -nLeftMar );
2443  SwFlyPortion *pFly = new SwFlyPortion( aInter );
2444  if( bForced )
2445  {
2447  rInf.ForcedLeftMargin( static_cast<sal_uInt16>(aInter.Width()) );
2448  }
2449 
2450  if( bFullLine )
2451  {
2452  // In order to properly flow around Flys with different
2453  // wrapping attributes, we need to increase by units of line height.
2454  // The last avoiding line should be adjusted in height, so that
2455  // we don't get a frame spacing effect.
2456  // It is important that ascent == height, because the FlyPortion
2457  // values are transferred to pCurr in CalcLine and IsDummy() relies
2458  // on this behaviour.
2459  // To my knowledge we only have two places where DummyLines can be
2460  // created: here and in MakeFlyDummies.
2461  // IsDummy() is evaluated in IsFirstTextLine(), when moving lines
2462  // and in relation with DropCaps.
2463  pFly->Height( sal_uInt16(aInter.Height()) );
2464 
2465  // nNextTop now contains the margin's bottom edge, which we avoid
2466  // or the next margin's top edge, which we need to respect.
2467  // That means we can comfortably grow up to this value; that's how
2468  // we save a few empty lines.
2469  long nNextTop = rTextFly.GetNextTop();
2470  if ( m_pFrame->IsVertical() )
2471  nNextTop = m_pFrame->SwitchVerticalToHorizontal( nNextTop );
2472  if( nNextTop > aInter.Bottom() )
2473  {
2474  SwTwips nH = nNextTop - aInter.Top();
2475  if( nH < SAL_MAX_UINT16 )
2476  pFly->Height( sal_uInt16( nH ) );
2477  }
2478  if( nAscent < pFly->Height() )
2479  pFly->SetAscent( sal_uInt16(nAscent) );
2480  else
2481  pFly->SetAscent( pFly->Height() );
2482  }
2483  else
2484  {
2485  if (rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
2486  {
2487  // Don't use nHeight, or we have a huge descent
2488  pFly->Height( pLast->Height() );
2489  pFly->SetAscent( pLast->GetAscent() );
2490  }
2491  else
2492  {
2493  pFly->Height( sal_uInt16(aInter.Height()) );
2494  if( nAscent < pFly->Height() )
2495  pFly->SetAscent( sal_uInt16(nAscent) );
2496  else
2497  pFly->SetAscent( pFly->Height() );
2498  }
2499  }
2500 
2501  rInf.SetFly( pFly );
2502 
2503  if( pFly->GetFix() < rInf.Width() )
2504  rInf.Width( pFly->GetFix() );
2505 
2506  SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
2507  if ( !pGrid )
2508  return;
2509 
2510  const SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
2511  const SwLayoutFrame* pBody = pPageFrame->FindBodyCont();
2512 
2513  SwRectFnSet aRectFnSet(pPageFrame);
2514 
2515  const long nGridOrigin = pBody ?
2516  aRectFnSet.GetPrtLeft(*pBody) :
2517  aRectFnSet.GetPrtLeft(*pPageFrame);
2518 
2519  const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
2520  const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, rDoc);
2521 
2522  SwTwips nStartX = GetLeftMargin();
2523  if ( aRectFnSet.IsVert() )
2524  {
2525  Point aPoint( nStartX, 0 );
2527  nStartX = aPoint.Y();
2528  }
2529 
2530  const SwTwips nOfst = nStartX - nGridOrigin;
2531  const SwTwips nTmpWidth = rInf.Width() + nOfst;
2532 
2533  const sal_uLong i = nTmpWidth / nGridWidth + 1;
2534 
2535  const long nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
2536  if ( nNewWidth > 0 )
2537  rInf.Width( static_cast<sal_uInt16>(nNewWidth) );
2538  else
2539  rInf.Width( 0 );
2540 
2541 
2542 }
2543 
2545  SwTextAttr *pHint ) const
2546 {
2547  const SwFrame *pFrame = m_pFrame;
2548 
2549  SwFlyInContentFrame *pFly;
2550  SwFrameFormat* pFrameFormat = static_cast<SwTextFlyCnt*>(pHint)->GetFlyCnt().GetFrameFormat();
2551  if( RES_FLYFRMFMT == pFrameFormat->Which() )
2552  pFly = static_cast<SwTextFlyCnt*>(pHint)->GetFlyFrame(pFrame);
2553  else
2554  pFly = nullptr;
2555  // aBase is the document-global position, from which the new extra portion is placed
2556  // aBase.X() = Offset in the line after the current position
2557  // aBase.Y() = LineIter.Y() + Ascent of the current position
2558 
2559  long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2560  // i#11859 - use new method <SwLineLayout::MaxAscentDescent(..)>
2561  // to change line spacing behaviour at paragraph - Compatibility to MS Word
2562  //SwLinePortion *pPos = pCurr->GetFirstPortion();
2563  //lcl_MaxAscDescent( pPos, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2564  m_pCurr->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2565 
2566  // If the ascent of the frame is larger than the ascent of the current position,
2567  // we use this one when calculating the base, or the frame would be positioned
2568  // too much to the top, sliding down after all causing a repaint in an area
2569  // he actually never was in.
2570  sal_uInt16 nAscent = 0;
2571 
2572  const bool bTextFrameVertical = GetInfo().GetTextFrame()->IsVertical();
2573 
2574  const bool bUseFlyAscent = pFly && pFly->isFrameAreaPositionValid() &&
2575  0 != ( bTextFrameVertical ?
2576  pFly->GetRefPoint().X() :
2577  pFly->GetRefPoint().Y() );
2578 
2579  if ( bUseFlyAscent )
2580  nAscent = static_cast<sal_uInt16>( std::abs( int( bTextFrameVertical ?
2581  pFly->GetRelPos().X() :
2582  pFly->GetRelPos().Y() ) ) );
2583 
2584  // Check if be prefer to use the ascent of the last portion:
2585  if ( IsQuick() ||
2586  !bUseFlyAscent ||
2587  nAscent < rInf.GetLast()->GetAscent() )
2588  {
2589  nAscent = rInf.GetLast()->GetAscent();
2590  }
2591  else if( nAscent > nFlyAsc )
2592  nFlyAsc = nAscent;
2593 
2594  Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent );
2596  if( GetMulti() && GetMulti()->HasRotation() )
2597  {
2598  nMode |= AsCharFlags::Rotate;
2599  if( GetMulti()->IsRevers() )
2600  nMode |= AsCharFlags::Reverse;
2601  }
2602 
2603  Point aTmpBase( aBase );
2604  if ( GetInfo().GetTextFrame()->IsVertical() )
2606 
2607  SwFlyCntPortion* pRet(nullptr);
2608  if( pFly )
2609  {
2610  pRet = sw::FlyContentPortion::Create(*GetInfo().GetTextFrame(), pFly, aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode);
2611  // We need to make sure that our font is set again in the OutputDevice
2612  // It could be that the FlyInCnt was added anew and GetFlyFrame() would
2613  // in turn cause, that it'd be created anew again.
2614  // This one's frames get formatted right away, which change the font.
2615  rInf.SelectFont();
2616  if( pRet->GetAscent() > nAscent )
2617  {
2618  aBase.setY( Y() + pRet->GetAscent() );
2619  nMode |= AsCharFlags::UlSpace;
2620  if( !rInf.IsTest() )
2621  {
2622  aTmpBase = aBase;
2623  if ( GetInfo().GetTextFrame()->IsVertical() )
2625 
2626  pRet->SetBase( *rInf.GetTextFrame(), aTmpBase, nTmpAscent,
2627  nTmpDescent, nFlyAsc, nFlyDesc, nMode );
2628  }
2629  }
2630  }
2631  else
2632  {
2633  pRet = sw::DrawFlyCntPortion::Create(*rInf.GetTextFrame(), *pFrameFormat, aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode);
2634  }
2635  return pRet;
2636 }
2637 
2638 /* Drop portion is a special case, because it has parts which aren't portions
2639  but we have handle them just like portions */
2641 {
2642  if( rPortion.GetLines() <= 1 )
2643  return;
2644 
2645  SwDropPortionPart* pCurrPart = rPortion.GetPart();
2646  while( pCurrPart )
2647  {
2648  if( pCurrPart->GetFollow() &&
2649  ::lcl_HasSameBorder(pCurrPart->GetFont(), pCurrPart->GetFollow()->GetFont()) )
2650  {
2651  pCurrPart->SetJoinBorderWithNext(true);
2652  pCurrPart->GetFollow()->SetJoinBorderWithPrev(true);
2653  }
2654  pCurrPart = pCurrPart->GetFollow();
2655  }
2656 }
2657 
2659 {
2660  const SwFont aCurFont = *rInf.GetFont();
2661  if( !aCurFont.HasBorder() )
2662  return;
2663 
2664  if (pPrev && pPrev->GetJoinBorderWithNext() )
2665  {
2666  // In some case border merge is called twice to the portion
2667  if( !rPortion.GetJoinBorderWithPrev() )
2668  {
2669  rPortion.SetJoinBorderWithPrev(true);
2670  if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetLeftBorderSpace() )
2671  rPortion.Width(rPortion.Width() - aCurFont.GetLeftBorderSpace());
2672  }
2673  }
2674  else
2675  {
2676  rPortion.SetJoinBorderWithPrev(false);
2677  m_pFirstOfBorderMerge = &rPortion;
2678  }
2679 
2680  // Get next portion's font
2681  bool bSeek = false;
2682  if (!rInf.IsFull() && // Not the last portion of the line (in case of line break)
2683  rInf.GetIdx() + rPortion.GetLen() != TextFrameIndex(rInf.GetText().getLength())) // Not the last portion of the paragraph
2684  {
2685  bSeek = Seek(rInf.GetIdx() + rPortion.GetLen());
2686  }
2687  // Don't join the next portion if SwKernPortion sits between two different boxes.
2688  bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev();
2689  // If next portion has the same border then merge
2690  if( bSeek && GetFnt()->HasBorder() && ::lcl_HasSameBorder(aCurFont, *GetFnt()) && !bDisconnect )
2691  {
2692  // In some case border merge is called twice to the portion
2693  if( !rPortion.GetJoinBorderWithNext() )
2694  {
2695  rPortion.SetJoinBorderWithNext(true);
2696  if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetRightBorderSpace() )
2697  rPortion.Width(rPortion.Width() - aCurFont.GetRightBorderSpace());
2698  }
2699  }
2700  // If this is the last portion of the merge group then make the real height merge
2701  else
2702  {
2703  rPortion.SetJoinBorderWithNext(false);
2704  if( m_pFirstOfBorderMerge != &rPortion )
2705  {
2706  // Calculate maximum height and ascent
2708  sal_uInt16 nMaxAscent = 0;
2709  sal_uInt16 nMaxHeight = 0;
2710  bool bReachCurrent = false;
2711  while( pActPor )
2712  {
2713  if( nMaxHeight < pActPor->Height() )
2714  nMaxHeight = pActPor->Height();
2715  if( nMaxAscent < pActPor->GetAscent() )
2716  nMaxAscent = pActPor->GetAscent();
2717 
2718  pActPor = pActPor->GetNextPortion();
2719  if( !pActPor && !bReachCurrent )
2720  {
2721  pActPor = &rPortion;
2722  bReachCurrent = true;
2723  }
2724  }
2725 
2726  // Change all portion's height and ascent
2727  pActPor = m_pFirstOfBorderMerge;
2728  bReachCurrent = false;
2729  while( pActPor )
2730  {
2731  if( nMaxHeight > pActPor->Height() )
2732  pActPor->Height(nMaxHeight);
2733  if( nMaxAscent > pActPor->GetAscent() )
2734  pActPor->SetAscent(nMaxAscent);
2735 
2736  pActPor = pActPor->GetNextPortion();
2737  if( !pActPor && !bReachCurrent )
2738  {
2739  pActPor = &rPortion;
2740  bReachCurrent = true;
2741  }
2742  }
2743  m_pFirstOfBorderMerge = nullptr;
2744  }
2745  }
2746  Seek(rInf.GetIdx());
2747 }
2748 
2749 namespace {
2750  // calculates and sets optimal repaint offset for the current line
2751  long lcl_CalcOptRepaint( SwTextFormatter &rThis,
2752  SwLineLayout const &rCurr,
2753  TextFrameIndex const nOldLineEnd,
2754  const std::vector<long> &rFlyStarts )
2755  {
2756  SwTextFormatInfo& txtFormatInfo = rThis.GetInfo();
2757  if ( txtFormatInfo.GetIdx() < txtFormatInfo.GetReformatStart() )
2758  // the reformat position is behind our new line, that means
2759  // something of our text has moved to the next line
2760  return 0;
2761 
2762  TextFrameIndex nReformat = std::min(txtFormatInfo.GetReformatStart(), nOldLineEnd);
2763 
2764  // in case we do not have any fly in our line, our repaint position
2765  // is the changed position - 1
2766  if ( rFlyStarts.empty() && ! rCurr.IsFly() )
2767  {
2768  // this is the maximum repaint offset determined during formatting
2769  // for example: the beginning of the first right tab stop
2770  // if this value is 0, this means that we do not have an upper
2771  // limit for the repaint offset
2772  const long nFormatRepaint = txtFormatInfo.GetPaintOfst();
2773 
2774  if (nReformat < txtFormatInfo.GetLineStart() + TextFrameIndex(3))
2775  return 0;
2776 
2777  // step back two positions for smoother repaint
2778  nReformat -= TextFrameIndex(2);
2779 
2780  // i#28795, i#34607, i#38388
2781  // step back more characters, this is required by complex scripts
2782  // e.g., for Khmer (thank you, Javier!)
2783  static const TextFrameIndex nMaxContext(10);
2784  if (nReformat > txtFormatInfo.GetLineStart() + nMaxContext)
2785  nReformat = nReformat - nMaxContext;
2786  else
2787  {
2788  nReformat = txtFormatInfo.GetLineStart();
2789  //reset the margin flag - prevent loops
2791  }
2792 
2793  // Weird situation: Our line used to end with a hole portion
2794  // and we delete some characters at the end of our line. We have
2795  // to take care for repainting the blanks which are not anymore
2796  // covered by the hole portion
2797  while ( nReformat > txtFormatInfo.GetLineStart() &&
2798  CH_BLANK == txtFormatInfo.GetChar( nReformat ) )
2799  --nReformat;
2800 
2801  OSL_ENSURE( nReformat < txtFormatInfo.GetIdx(), "Reformat too small for me!" );
2802  SwRect aRect;
2803 
2804  // Note: GetChareRect is not const. It definitely changes the
2805  // bMulti flag. We have to save and restore the old value.
2806  bool bOldMulti = txtFormatInfo.IsMulti();
2807  rThis.GetCharRect( &aRect, nReformat );
2808  txtFormatInfo.SetMulti( bOldMulti );
2809 
2810  return nFormatRepaint ? std::min( aRect.Left(), nFormatRepaint ) :
2811  aRect.Left();
2812  }
2813  else
2814  {
2815  // nReformat may be wrong, if something around flys has changed:
2816  // we compare the former and the new fly positions in this line
2817  // if anything has changed, we carefully have to adjust the right
2818  // repaint position
2819  long nPOfst = 0;
2820  size_t nCnt = 0;
2821  long nX = 0;
2822  TextFrameIndex nIdx = rThis.GetInfo().GetLineStart();
2823  SwLinePortion* pPor = rCurr.GetFirstPortion();
2824 
2825  while ( pPor )
2826  {
2827  if ( pPor->IsFlyPortion() )
2828  {
2829  // compare start of fly with former start of fly
2830  if (nCnt < rFlyStarts.size() &&
2831  nX == rFlyStarts[ nCnt ] &&
2832  nIdx < nReformat
2833  )
2834  // found fix position, nothing has changed left from nX
2835  nPOfst = nX + pPor->Width();
2836  else
2837  break;
2838 
2839  nCnt++;
2840  }
2841  nX = nX + pPor->Width();
2842  nIdx = nIdx + pPor->GetLen();
2843  pPor = pPor->GetNextPortion();
2844  }
2845 
2846  return nPOfst + rThis.GetLeftMargin();
2847  }
2848  }
2849 
2850  // Determine if we need to build hidden portions
2851  bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex & rPos)
2852  {
2853  // Only if hidden text should not be shown:
2854  // if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
2855  const bool bShowInDocView = rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar();
2856  const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( true ) && rInf.GetOpt().IsPrinting();
2857  if (bShowInDocView || bShowForPrinting)
2858  return false;
2859 
2860  const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
2861  TextFrameIndex nHiddenStart;
2862  TextFrameIndex nHiddenEnd;
2863  rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
2864  if ( nHiddenEnd )
2865  {
2866  rPos = nHiddenEnd;
2867  return true;
2868  }
2869 
2870  return false;
2871  }
2872 
2873  bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond)
2874  {
2875  return
2876  rFirst.GetTopBorder() == rSecond.GetTopBorder() &&
2877  rFirst.GetBottomBorder() == rSecond.GetBottomBorder() &&
2878  rFirst.GetLeftBorder() == rSecond.GetLeftBorder() &&
2879  rFirst.GetRightBorder() == rSecond.GetRightBorder() &&
2880  rFirst.GetTopBorderDist() == rSecond.GetTopBorderDist() &&
2881  rFirst.GetBottomBorderDist() == rSecond.GetBottomBorderDist() &&
2882  rFirst.GetLeftBorderDist() == rSecond.GetLeftBorderDist() &&
2883  rFirst.GetRightBorderDist() == rSecond.GetRightBorderDist() &&
2884  rFirst.GetOrientation() == rSecond.GetOrientation() &&
2885  rFirst.GetShadowColor() == rSecond.GetShadowColor() &&
2886  rFirst.GetShadowWidth() == rSecond.GetShadowWidth() &&
2887  rFirst.GetShadowLocation() == rSecond.GetShadowLocation();
2888  }
2889 
2890 } //end unnamed namespace
2891 
2892 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetHasRotatedPortions(bool bHasRotatedPortions)
Definition: txtftn.cxx:86
virtual bool Format(SwTextFormatInfo &rInf)
Definition: porlin.cxx:237
void SetLineNetHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:603
bool IsParaLine() const
Definition: itrtxt.hxx:125
SwScriptInfo * m_pScriptInfo
Definition: itratr.hxx:40
std::deque< sal_uInt16 > * GetpKanaComp() const
Definition: porlay.hxx:191
Base class of the Writer layout elements.
Definition: frame.hxx:297
void Move(SwTextPaintInfo &rInf)
Definition: porlin.cxx:268
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
bool LastKernPortion()
Definition: inftxt.cxx:1727
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:151
bool IsArrowDone() const
Definition: inftxt.hxx:637
SwTwips GetMinBottom() const
Definition: txtfly.hxx:336
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
Definition: docftn.cxx:183
const SwFormatDrop * m_pDropFormat
Definition: itrform2.hxx:35
void SetRest(const bool bNew)
Definition: porlay.hxx:123
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout...
Definition: txtfrm.cxx:578
bool IsRegisterOn() const
Definition: itrtxt.hxx:94
sal_uInt16 GetLeftBorderSpace() const
Definition: swfont.hxx:900
sal_uInt16 GetShadowWidth() const
Definition: swfont.hxx:375
SwFontScript WhichFont(TextFrameIndex nIdx) const
Definition: porlay.cxx:730
void FormatReset(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:1932
const std::optional< editeng::SvxBorderLine > & GetBottomBorder() const
Definition: swfont.hxx:337
SwViewShell * GetVsh()
Definition: inftxt.hxx:228
bool IsFollow() const
Definition: flowfrm.hxx:166
std::map< OUString, css::uno::Any > parameter_map_t
Definition: IMark.hxx:94
void SetArrowDone(const bool bNew)
Definition: inftxt.hxx:638
void SetFormatAdj(const bool bNew)
Definition: porlay.hxx:115
sal_uInt16 GetPropLineSpace() const
bool IsGrfNumPortion() const
Definition: porlin.hxx:111
Marks a position in the document model.
Definition: pam.hxx:35
TextFrameIndex NextScriptChg(TextFrameIndex nPos) const
Definition: porlay.cxx:1623
static FlyContentPortion * Create(const SwTextFrame &rFrame, SwFlyInContentFrame *pFly, const Point &rBase, long nAscent, long nDescent, long nFlyAsc, long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:271
sal_uInt16 GetLines() const
Definition: pordrop.hxx:88
bool IsUnderflow() const
Definition: inftxt.hxx:589
void SetFly(const bool bNew)
Definition: porlay.hxx:121
SwFlyCntPortion * NewFlyCntPortion(SwTextFormatInfo &rInf, SwTextAttr *pHt) const
Sets a new portion for an object anchored as character.
Definition: itrform2.cxx:2544
bool IsRest() const
Definition: porlay.hxx:124
sal_uInt16 Height() const
Definition: possiz.hxx:50
SwTwips GetPaintOfst() const
Definition: inftxt.hxx:737
SwFont * GetFont()
Definition: inftxt.hxx:238
SwLineLayout * GetNext()
Definition: porlay.hxx:148
bool IsSwapped() const
Definition: txtfrm.hxx:526
bool SeekStartAndChg(SwTextSizeInfo &rInf, const bool bPara=false)
Definition: itrtxt.hxx:323
bool InNumberGrp() const
Definition: porlin.hxx:102
const SwFormatDrop * GetDropFormat() const
Definition: itrform2.hxx:196
bool IsUnderlineBreak(const SwLinePortion &rPor, const SwFont &rFnt)
Definition: itrpaint.cxx:46
void InsertPortion(SwTextFormatInfo &rInf, SwLinePortion *pPor)
Definition: itrform2.cxx:294
TextFrameIndex GetStart() const
Definition: itrtxt.hxx:88
bool IsPrinting() const
Definition: viewopt.hxx:405
bool IsNewLine() const
Definition: itrform2.hxx:177
void SetPos(const Point &rNew)
Definition: inftxt.hxx:436
void SetFootnoteInside(const bool bNew)
Definition: inftxt.hxx:207
TextFrameIndex NextHiddenChg(TextFrameIndex nPos) const
Definition: porlay.cxx:1676
bool IsTextPortion() const
Definition: porlin.hxx:130
bool IsInFootnote() const
Definition: frame.hxx:927
sal_uInt16 GetTopBorderDist() const
Definition: swfont.hxx:356
bool GetJoinBorderWithPrev() const
Definition: porlin.hxx:168
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:471
sal_uInt16 GetRightBorderSpace() const
Definition: swfont.hxx:885
bool IsRuby() const
Definition: inftxt.hxx:214
static void MergeCharacterBorder(SwDropPortion const &rPortion)
Merge border of the drop portion with modifying the font of the portions' part.
Definition: itrform2.cxx:2640
sal_Unicode GetTabDecimal() const
Definition: inftxt.hxx:623
void CtorInitTextPainter(SwTextFrame *pFrame, SwTextPaintInfo *pInf)
Definition: itrpaint.cxx:63
sal_uInt8 GetLines() const
Definition: paratr.hxx:86
sal_uIntPtr sal_uLong
void SetFootnoteNum(const bool bNew)
Definition: porlay.hxx:304
const SwRect & getFramePrintArea() const
Definition: frame.hxx:178
bool IsStop() const
Definition: itrform2.hxx:174
bool IsFirstTextLine() const
Definition: itrtxt.hxx:120
SwTabPortion * NewTabPortion(SwTextFormatInfo &rInf, bool bAuto) const
Definition: txttab.cxx:62
The purpose of this class is to be the universal interface between formatting/text output and the pos...
Definition: txtfly.hxx:119
void SetLast(SwLinePortion *pNewLast)
Definition: inftxt.hxx:568
SwTabPortion * GetLastTab()
Definition: inftxt.hxx:621
TextFrameIndex GetUnderScorePos() const
Definition: inftxt.hxx:647
SwTwips Left() const
Definition: inftxt.hxx:548
TextFrameIndex ScanPortionEnd(TextFrameIndex nStart, TextFrameIndex nEnd)
Definition: inftxt.cxx:1634
Definition: doc.hxx:184
#define ODF_FORMCHECKBOX
void CalcLine(SwTextFormatter &rLine, SwTextFormatInfo &rInf)
Definition: porlay.cxx:332
sal_uInt16 GetDropHeight() const
Definition: itrtxt.hxx:205
const SwLineLayout & GetRoot() const
Definition: pormulti.hxx:121
bool IsNumDone() const
Definition: inftxt.hxx:635
sal_uInt16 GetTextHeight() const
Definition: inftxt.hxx:719
void Height(long nNew)
Definition: swrect.hxx:191
bool IsErgoDone() const
Definition: inftxt.hxx:633
sal_uInt16 GetLineNetHeight() const
Definition: inftxt.hxx:602
#define CHAR_HARDBLANK
Definition: swtypes.hxx:164
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:75
bool GetRubyTextBelow() const
Definition: tgrditem.hxx:85
TextFrameIndex GetNextAttr() const
Definition: itratr.cxx:728
#define DIR_TOP2BOTTOM
Definition: inftxt.hxx:57
SwFont * m_pFont
Definition: itratr.hxx:39
bool SeekAndChg(SwTextSizeInfo &rInf)
Definition: itrtxt.hxx:310
long SwTwips
Definition: swtypes.hxx:49
void LeftMargin(const SwTwips nNew)
Definition: inftxt.hxx:554
bool HasBorder() const
Check whether font has any border on any side.
Definition: swfont.hxx:915
SwDropPortionPart * GetPart() const
Definition: pordrop.hxx:94
void SetFlyInCntBase(bool bNew=true)
Definition: itrform2.hxx:211
bool IsVert() const
Definition: frame.hxx:1345
static void SetRightMargin(const bool bNew)
Definition: itrtxt.hxx:294
const SwLineLayout * Next()
Definition: itrtxt.cxx:107
sal_uInt16 RealWidth() const
Definition: inftxt.hxx:555
SwLineInfo m_aLineInf
Definition: itrtxt.hxx:33
SwTwips FirstLeft() const
Definition: itrtxt.hxx:182
bool IsEndNote() const
Definition: fmtftn.hxx:74
SwTwips CalcKanaAdj(SwLineLayout *pCurr)
Definition: itradj.cxx:412
void SetKanaComp(std::deque< sal_uInt16 > *pNew)
Definition: inftxt.hxx:329
sal_uInt16 GetFix() const
Definition: porglue.hxx:56
void SetJoinBorderWithPrev(const bool bJoinPrev)
Definition: porlin.hxx:170
void MaxAscentDescent(SwTwips &_orAscent, SwTwips &_orDescent, SwTwips &_orObjAscent, SwTwips &_orObjDescent, const SwLinePortion *_pDontConsiderPortion=nullptr, const bool _bNoFlyCntPorAndLinePor=false) const
determine ascent and descent for positioning of as-character anchored object
Definition: porlay.cxx:611
void SetMulti(const bool bNew)
Definition: inftxt.hxx:211
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool InFieldGrp() const
Definition: porlin.hxx:104
bool HasHint(TextFrameIndex nPos) const
Definition: inftxt.cxx:474
SwTwips Y() const
Definition: itrtxt.hxx:90
sal_uInt16 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
Definition: swfont.cxx:433
OUString ExpandFieldmark(IFieldmark *pBM)
Definition: itrform2.cxx:862
#define CH_TXT_ATR_FORMELEMENT
Definition: hintids.hxx:177
SwTwips RegStart() const
Definition: itrtxt.hxx:92
bool IsMulti() const
Definition: inftxt.hxx:210
sal_uInt16 ForcedLeftMargin() const
Definition: inftxt.hxx:557
#define ODF_FORMDROPDOWN_RESULT
bool IsFull() const
Definition: inftxt.hxx:569
const SvxLineSpacingItem * GetLineSpacing() const
Definition: inftxt.hxx:86
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: portxt.cxx:524
bool Seek(TextFrameIndex nPos)
Enables the attributes used at char pos nPos in the logical font.
Definition: itratr.cxx:301
SvxLineSpaceRule GetLineSpaceRule() const
std::vector< long > * GetpLLSpaceAdd() const
Definition: porlay.hxx:186
bool IsLastBlock() const
Definition: itrtxt.hxx:188
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:166
long GetLen(const Point &rPnt)
SwTextFormatInfo & GetInfo()
Definition: itrform2.hxx:213
void CalcUnclipped(SwTwips &rTop, SwTwips &rBottom)
Definition: itrform2.cxx:2046
long YDiff(long n1, long n2) const
Definition: frame.hxx:1401
sal_uInt16 RegDiff() const
Definition: itrtxt.hxx:93
void SetFull(const bool bNew)
Definition: inftxt.hxx:570
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:170
SwRect GetFrame(const SwRect &rPortion) const
Definition: txtfly.hxx:356
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
sal_uInt16 sal_Unicode
Point const & GetRelPos() const
Definition: flyincnt.cxx:193
#define CH_TXTATR_INWORD
Definition: hintids.hxx:171
SwExpandPortion * TryNewNoLengthPortion(SwTextFormatInfo const &rInfo)
Try to create a new portion with zero length, for an end of a hint (where there is no CH_TXTATR)...
Definition: txtfld.cxx:319
sal_uInt16 GetLineHeight() const
void Top(const long nTop)
Definition: swrect.hxx:204
void CalcAdjLine(SwLineLayout *pCurr)
Definition: itradj.cxx:670
bool BuildMultiPortion(SwTextFormatInfo &rInf, SwMultiPortion &rMulti)
Definition: pormulti.cxx:1885
LINESTYLE_NONE
bool IsBreakPortion() const
Definition: porlin.hxx:114
const SwRect & getFrameArea() const
Definition: frame.hxx:177
#define SAL_MAX_UINT16
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_Unicode GetChar(TextFrameIndex const nPos) const
Definition: inftxt.hxx:247
#define X
virtual ~SwTextFormatter() override
Definition: itrform2.cxx:106
sal_uInt16 GetRightBorderDist() const
Definition: swfont.hxx:358
bool IsInTab() const
Definition: frame.hxx:933
bool HasRotation() const
Definition: pormulti.hxx:147
void SetRoot(SwLineLayout *pNew)
Definition: inftxt.hxx:566
SwTwips Right() const
Definition: itrtxt.hxx:181
void SetClipping(const bool bNew)
Definition: porlay.hxx:142
#define DIR_BOTTOM2TOP
Definition: inftxt.hxx:55
void ResetFlags()
Definition: porlay.cxx:662
virtual parameter_map_t * GetParameters()=0
const Point & GetRefPoint() const
Definition: flyfrms.hxx:218
void Right(const long nRight)
Definition: swrect.hxx:200
bool IsNewLine() const
Definition: inftxt.hxx:584
void CalcRealHeight(bool bNewLine=false)
Definition: itrform2.cxx:1752
bool AllowRepaintOpt() const
Definition: itrform2.cxx:1994
sal_uInt8 m_nContentEndHyph
Definition: itrform2.hxx:37
TextFrameIndex GetLineStart() const
Definition: inftxt.hxx:596
void CalcFlyWidth(SwTextFormatInfo &rInf)
Calculation of the emulated right side.
Definition: itrform2.cxx:2315
This portion represents an as-character anchored fly (shape, frame, etc.)
Definition: porfly.hxx:44
SwFontScript GetActual() const
Definition: swfont.hxx:182
void SetPaintOfst(const SwTwips nNew)
Definition: inftxt.hxx:742
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:846
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:429
void SetNumDone(const bool bNew)
Definition: inftxt.hxx:636
bool InFixMargGrp() const
Definition: porlin.hxx:108
bool IsIgnoreFly() const
Definition: inftxt.hxx:576
const std::optional< editeng::SvxBorderLine > & GetRightBorder() const
Definition: swfont.hxx:338
bool IsBidi() const
Definition: pormulti.hxx:133
MarkKind GetBookmark(TextFrameIndex nPos) const
Definition: porlay.cxx:1700
This portion represents a part of the paragraph string.
Definition: portxt.hxx:27
SwTwips Y() const
Definition: inftxt.hxx:387
bool IsSoftHyphPortion() const
Definition: porlin.hxx:127
SwTwips First() const
Definition: inftxt.hxx:552
static bool lcl_OldFieldRest(const SwLineLayout *pCurr)
Definition: itrform2.cxx:1210
std::unique_ptr< SwMultiCreator > GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const *pM) const
Definition: pormulti.cxx:907
TextFrameIndex NextDirChg(const TextFrameIndex nPos, const sal_uInt8 *pLevel=nullptr) const
Definition: porlay.cxx:1649
void CalcAscentAndHeight(sal_uInt16 &rAscent, sal_uInt16 &rHeight) const
Definition: itrtxt.cxx:63
void SetEndHyph(const bool bNew)
Definition: porlay.hxx:117
bool HasScriptSpace() const
Definition: inftxt.hxx:218
void SetRealHeight(sal_uInt16 nNew)
Definition: porlay.hxx:157
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:245
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1293
void UpdatePos(SwLineLayout *pCurr, Point aStart, TextFrameIndex nStartIdx, bool bAlways=false) const
The position of the portions changes with the adjustment.
Definition: itrform2.cxx:2058
bool IsFootnoteNumPortion() const
Definition: porlin.hxx:119
virtual void Height(const sal_uInt16 nNew, const bool bText=true) override
Definition: porlay.cxx:196
bool m_bFlyInContentBase
Definition: itrform2.hxx:42
TextFrameIndex m_nRightScanIdx
Definition: itrform2.hxx:40
Style of a layout element.
Definition: frmfmt.hxx:57
SwTextInfo * m_pInf
Definition: itrtxt.hxx:35
SwTwips CalcFitToContent_()
Definition: itrform2.cxx:1983
void Bottom()
Definition: itrtxt.cxx:185
bool IsDummy() const
Definition: porlay.hxx:140
void SetBase(const SwTextFrame &rFrame, const Point &rBase, long nLnAscent, long nLnDescent, long nFlyAscent, long nFlyDescent, AsCharFlags nFlags)
After setting the RefPoints, the ascent needs to be recalculated because it is dependent on RelPos...
Definition: porfly.cxx:318
SwFrame * GetIndPrev() const
Definition: frame.hxx:704
bool m_bTruncLines
Definition: itrform2.hxx:43
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SwTwips Left() const
Definition: itrtxt.hxx:333
int i
SwLinePortion * NewPortion(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:1238
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:78
void Reset()
Definition: redlnitr.hxx:113
SwMultiPortion * m_pMulti
Definition: itrform2.hxx:36
sal_uInt16 GetTextHeight() const
Definition: porlay.hxx:160
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
Definition: inftxt.cxx:1755
SwTextFly & GetTextFly()
Definition: inftxt.hxx:390
const sal_Unicode CH_TAB
Definition: swfont.hxx:44
SwPageFrame * FindPageFrame()
Definition: frame.hxx:660
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:128
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:94
SwCharRange & GetReformat()
Definition: porlay.hxx:273
void SetUnderflow(SwLinePortion *pNew)
Definition: inftxt.hxx:607
bool IsFlyPortion() const
Definition: porlin.hxx:125
void RecalcRealHeight()
Definition: itrform2.cxx:1744
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2545
SwNumberPortion * NewNumberPortion(SwTextFormatInfo &rInf) const
Definition: txtfld.cxx:562
sal_uInt16 GetBottomBorderDist() const
Definition: swfont.hxx:357
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:679
void CtorInitTextFormatter(SwTextFrame *pFrame, SwTextFormatInfo *pInf)
Definition: itrform2.cxx:81
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
void SelectFont()
Definition: inftxt.cxx:364
bool IsKernPortion() const
Definition: porlin.hxx:132
long GetHeight() const
Definition: swfont.hxx:280
void FinishKanaComp()
Definition: porlay.hxx:190
SwLinePortion * NewExtraPortion(SwTextFormatInfo &rInf)
Definition: txtfld.cxx:358
sal_uInt16 GetTopBorderSpace() const
Definition: swfont.hxx:855
std::unique_ptr< sw::MergedAttrIterByEnd > m_pByEndIter
Definition: itrform2.hxx:45
void BuildPortions(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:356
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:179
bool HasTruncLines() const
Definition: itrform2.hxx:204
void ResetSpaceIdx()
Definition: inftxt.hxx:443
SwTwips GetLeftMargin() const
Definition: itrtxt.hxx:328
sal_uInt16 Width() const
Definition: inftxt.hxx:534
void FinishSpaceAdd()
Definition: porlay.hxx:175
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2808
const SwFormatDrop * GetDropFormat() const
Definition: inftxt.cxx:1512
void SetJoinBorderWithNext(const bool bJoinNext)
Definition: porlin.hxx:171
PortionType
Definition: txttypes.hxx:23
SvxInterLineSpaceRule GetInterLineSpaceRule() const
void ResetMaxWidthDiff()
Definition: inftxt.hxx:314
void SetUnderScorePos(TextFrameIndex const nNew)
Definition: inftxt.hxx:648
SwFont * GetFnt()
Definition: itratr.hxx:103
bool IsTabLeftPortion() const
Definition: porlin.hxx:117
#define CHAR_ZWSP
Definition: swtypes.hxx:169
const std::optional< editeng::SvxBorderLine > & GetLeftBorder() const
Definition: swfont.hxx:339
sal_uInt16 GetLineHeight() const
Definition: itrtxt.hxx:116
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:278
bool CheckFootnotePortion(SwLineLayout const *pCurr)
Definition: inftxt.hxx:655
bool IsDropPortion() const
Definition: porlin.hxx:121
void SetTabDecimal(const sal_Unicode cNew)
Definition: inftxt.hxx:624
void ClrUnderflow()
Definition: inftxt.hxx:590
bool isFrameAreaPositionValid() const
Definition: frame.hxx:164
bool IsQuick() const
Definition: itrform2.hxx:180
bool ChkFlyUnderflow(SwTextFormatInfo &rInf) const
This is called after the real height of the line has been calculated Therefore it is possible...
Definition: itrform2.cxx:2227
void SetTabOverflow(bool bOverflow)
Definition: inftxt.hxx:668
sal_Unicode GetHookChar() const
Definition: inftxt.hxx:628
const sal_uInt8 & CntMidHyph() const
Definition: itrform2.hxx:220
bool SnapToGrid() const
Definition: inftxt.hxx:222
TextFrameIndex GetLen() const
Definition: porlin.hxx:74
void SetFly(SwFlyPortion *pNew)
Definition: inftxt.hxx:616
A page of the document layout.
Definition: pagefrm.hxx:41
bool InTabGrp() const
Definition: porlin.hxx:100
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:200
#define ODF_FORMFIELD_DEFAULT_LENGTH
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:291
void LeftMove(TextFrameIndex const nNew)
Definition: porlay.hxx:47
Point GetTopLeft() const
Definition: itrtxt.hxx:186
SwErgoSumPortion * NewErgoSumPortion(SwTextFormatInfo const &rInf) const
Definition: txtftn.cxx:1001
const OUString & GetText() const
Definition: inftxt.hxx:246
bool IsStop() const
Definition: inftxt.hxx:580
short GetInterLineSpace() const
const SwLinePortion * GetUnderflow() const
Definition: inftxt.hxx:605
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:42
void ClearHookChar()
Definition: inftxt.hxx:626
void Truncate()
Definition: porlin.hxx:196
bool HasBrackets() const
Definition: pormulti.hxx:249
const Point & GetPos() const
Definition: inftxt.hxx:435
bool IsMultiPortion() const
Definition: porlin.hxx:134
long GetPrtLeft(const SwFrame &rFrame) const
Definition: frame.hxx:1389
FontLineStyle GetUnderline() const
Definition: swfont.hxx:268
bool HasNegFirst() const
Definition: itrtxt.hxx:194
SwTwips X() const
Definition: inftxt.hxx:385
sal_uInt16 GetLeftBorderDist() const
Definition: swfont.hxx:359
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:681
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
SwTextFrame * m_pFrame
Definition: itrtxt.hxx:34
Base class for anything that can be part of a line in the Writer layout.
Definition: porlin.hxx:50
void SetForcedLeftMargin()
Definition: porlay.hxx:131
bool IsFootnoteNumFrame() const
Am I a FootnoteFrame, with a number at the start of the paragraph?
Definition: txtfrm.hxx:613
void CalcAscent(SwTextFormatInfo &rInf, SwLinePortion *pPor)
Definition: itrform2.cxx:745
TextFrameIndex GetReformatStart() const
Definition: inftxt.hxx:770
SwTwips Right() const
Definition: inftxt.hxx:550
void Left(const long nLeft)
Definition: swrect.hxx:195
void SetSoftHyphPos(TextFrameIndex const nNew)
Definition: inftxt.hxx:610
bool SeekAndChgBefore(SwTextSizeInfo &rInf)
Definition: itrtxt.hxx:315
void Bottom(const long nBottom)
Definition: swrect.hxx:209
#define CHAR_HARDHYPHEN
Definition: swtypes.hxx:165
TextFrameIndex m_nStart
Definition: itrtxt.hxx:41
TextFrameIndex FormatLine(TextFrameIndex nStart)
Definition: itrform2.cxx:1539
sal_Int16 ScriptType(const TextFrameIndex nPos) const
Definition: porlay.cxx:1636
void SwitchRTLtoLTR(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from RTL to LTR layout.
Definition: txtfrm.hxx:726
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txttab.cxx:300
SwTwips CalcBottomLine() const
Definition: itrform2.cxx:1958
SwTextPortion * WhichTextPor(SwTextFormatInfo &rInf) const
Definition: itrform2.cxx:884
SwMultiPortion * GetMulti() const
Definition: itrform2.hxx:199
bool IsRevers() const
Definition: pormulti.hxx:148
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:281
bool InExpGrp() const
Definition: porlin.hxx:107
void SetFixLineHeight()
Definition: porlay.hxx:301
sal_uInt16 GetDropLeft() const
Definition: itrtxt.hxx:204
void CalcAdjustLine(SwLineLayout *pCurr)
Definition: itrform2.cxx:730
void CalcDropHeight(const sal_uInt16 nLines)
Definition: txtdrop.cxx:483
void SetNext(SwLineLayout *pNew)
Definition: porlay.hxx:150
PortionType GetWhichPor() const
Definition: porlin.hxx:95
SvxShadowLocation GetShadowLocation() const
Definition: swfont.hxx:376
SwRepaint & GetRepaint()
Definition: porlay.hxx:271
bool IsFootnotePortion() const
Definition: porlin.hxx:120
void SetFootnoteDone(const bool bNew)
Definition: inftxt.hxx:632
vcl::Window * GetWin() const
Definition: viewsh.hxx:337
SwLinePortion * GetRest()
Definition: inftxt.hxx:582
void SetDummy(const bool bNew)
Definition: porlay.hxx:139
SwLinePortion * FindLastPortion()
Definition: porlin.cxx:178
#define ODF_FORMDROPDOWN_LISTENTRY
bool IsErgoSumPortion() const
Definition: porlin.hxx:115
void ChkNoHyph(const sal_uInt8 bEnd, const sal_uInt8 bMid)
Definition: inftxt.hxx:573
void SetStopUnderflow(const bool bNew)
Definition: inftxt.hxx:205
#define ODF_FORMTEXT
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
SvxAdjust GetAdjust() const
Definition: itrtxt.hxx:190
bool IsLastCenter() const
Definition: itrtxt.hxx:189
bool IsFly() const
Definition: porlay.hxx:122
long GetNextTop() const
Definition: txtfly.hxx:346
TextFrameIndex NextBookmark(TextFrameIndex nPos) const
Definition: porlay.cxx:1688
const sal_uInt8 & CntEndHyph() const
Definition: itrform2.hxx:219
bool IsRightToLeft() const
Definition: frame.hxx:965
TextFrameIndex GetLen() const
Definition: inftxt.hxx:280
SwLinePortion * Underflow(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:146
sal_uInt16 GetBottomBorderSpace() const
Definition: swfont.hxx:870
void SetErgoDone(const bool bNew)
Definition: inftxt.hxx:634
void SetDirection(const sal_uInt8 nNew)
Definition: inftxt.hxx:225
void SetShift(const bool bNew)
Definition: inftxt.hxx:587
sal_uInt8 m_nContentMidHyph
Definition: itrform2.hxx:38
void SetLineStart(TextFrameIndex const nNew)
Definition: inftxt.hxx:597
bool InTextGrp() const
Definition: porlin.hxx:98
sal_uInt16 Width() const
Definition: possiz.hxx:52
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:277
SwFontScript
Definition: swfont.hxx:122
double getLength(const B2DPolygon &rCandidate)
void GetCharRect(SwRect *, TextFrameIndex, SwCursorMoveState *=nullptr, const long nMax=0)
Definition: itrcrsr.cxx:1178
SwLinePortion * GetLast()
Definition: inftxt.hxx:567
sal_uInt16 GetGridWidth(SwTextGridItem const &, SwDoc const &)
Definition: pagechg.cxx:2559
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
SwNumberPortion * NewFootnoteNumPortion(SwTextFormatInfo const &rInf) const
The portion for the Footnote Numbering in the Footnote Area.
Definition: txtftn.cxx:920
bool CheckCurrentPosBookmark()
Definition: inftxt.cxx:1978
const Color & GetShadowColor() const
Definition: swfont.hxx:374
SwTextPortion * NewTextPortion(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:968
#define CH_TXT_ATR_FIELDEND
Definition: hintids.hxx:181
#define CHAR_ZWNBSP
Definition: swtypes.hxx:170
void SetNextPortion(SwLinePortion *pNew)
Definition: porlin.hxx:76
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
bool IsSnapToChars() const
Definition: tgrditem.hxx:100
static DrawFlyCntPortion * Create(const SwTextFrame &rFrame, SwFrameFormat const &rFormat, const Point &rBase, long nAsc, long nDescent, long nFlyAsc, long nFlyDesc, AsCharFlags nFlags)
Definition: porfly.cxx:278
void SetJoinBorderWithNext(const bool bJoinNext)
Definition: pordrop.hxx:58
void FeedInf(SwTextFormatInfo &rInf) const
Definition: itrform2.cxx:1908
static bool GetBoundsOfHiddenRange(const SwTextNode &rNode, sal_Int32 nPos, sal_Int32 &rnStartPos, sal_Int32 &rnEndPos, std::vector< sal_Int32 > *pList=nullptr)
Hidden text range information - static and non-version.
Definition: porlay.cxx:1772
const std::optional< editeng::SvxBorderLine > & GetTopBorder() const
Definition: swfont.hxx:336
sal_uInt16 GetRealHeight() const
Definition: porlay.hxx:158
#define ODF_FORMDATE
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
void SetAscent(const sal_uInt16 nNewAsc)
Definition: porlin.hxx:79
for showing bookmark starts and ends; note that in contrast to SwControlCharPortion these do not have...
Definition: porrst.hxx:157
bool IsVertical() const
Definition: frame.hxx:951
SwDropPortionPart * GetFollow() const
Definition: pordrop.hxx:48
virtual OUString GetFieldname() const =0
void SetNewLine(const bool bNew)
Definition: inftxt.hxx:585
void Insert(SwLineLayout *pLine)
Definition: itrform2.cxx:117
void SetOtherThanFootnoteInside(const bool bNew)
Definition: inftxt.hxx:209
void SetLineHeight(const sal_uInt16 nNew)
Definition: inftxt.hxx:601
SwDoc & GetDoc()
Definition: txtfrm.hxx:451
bool IsOtherThanFootnoteInside() const
Definition: inftxt.hxx:208
bool IsOn() const
Definition: txtfly.hxx:313
constexpr TypedWhichId< SvxCharRotateItem > RES_CHRATR_ROTATE(32)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
SwTextGrid GetGridType() const
Definition: tgrditem.hxx:81
bool IsTest() const
Definition: inftxt.hxx:594
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:303
SwTextFrame * GetTextFrame()
Definition: itrtxt.hxx:134
bool IsFlyInCntBase() const
Definition: itrform2.hxx:210
void ResetKanaIdx()
Definition: inftxt.hxx:326
SwLineLayout * m_pCurr
Definition: itrtxt.hxx:36
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
static void ClearFly(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:75
void SetJoinBorderWithPrev(const bool bJoinPrev)
Definition: pordrop.hxx:57
virtual void FormatEOL(SwTextFormatInfo &rInf)
Definition: porlin.cxx:265
SwLinePortion * m_pFirstOfBorderMerge
Definition: itrform2.hxx:46
TextFrameIndex m_nLeftScanIdx
Definition: itrform2.hxx:39
bool IsQuoVadisPortion() const
Definition: porlin.hxx:116
sal_uInt16 GetBaseHeight() const
Definition: tgrditem.hxx:75
SwFlyPortion * GetFly()
Definition: inftxt.hxx:615
void SetMidHyph(const bool bNew)
Definition: porlay.hxx:119
void DropInit()
Definition: itrcrsr.cxx:358
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:169
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:72
sal_uInt16 GetLineHeight() const
Definition: inftxt.hxx:600
#define CH_TXT_ATR_FIELDSEP
Definition: hintids.hxx:180
void SetIdx(const TextFrameIndex nNew)
Definition: inftxt.hxx:279
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 AlignFlyInCntBase(long nBaseLine) const
Set all anchored as character objects to the passed BaseLine (in Y direction).
Definition: itrform2.cxx:2180
void SetRest(SwLinePortion *pNewRest)
Definition: inftxt.hxx:583
CharClass & GetAppCharClass()
Definition: init.cxx:708
sal_uInt16 GetFrameRstHeight() const
Definition: itrform2.cxx:129
void SetDropInit(const bool bNew)
Definition: inftxt.hxx:592
virtual void FormatEOL(SwTextFormatInfo &rInf) override
Definition: txttab.cxx:310
bool IsFlyCntPortion() const
Definition: porlin.hxx:112
sal_uInt16 GetRubyHeight() const
Definition: tgrditem.hxx:78
void Clear(SwFont *pFnt)
Definition: redlnitr.hxx:110
sal_uInt16 & GetAscent()
Definition: porlin.hxx:77
void SetpSpaceAdd(std::vector< long > *pNew)
Definition: inftxt.hxx:451
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:624
virtual SwLinePortion * Insert(SwLinePortion *pPortion)
Definition: porlin.cxx:168
SwRedlineItr * GetRedln()
Definition: itratr.hxx:81
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
TextFrameIndex GetSoftHyphPos() const
Definition: inftxt.hxx:609
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich) const
Definition: inftxt.cxx:1315
bool IsFootnoteDone() const
Definition: inftxt.hxx:631
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:626
SwLinePortion * WhichFirstPortion(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:1042
bool IsPostItsPortion() const
Definition: porlin.hxx:128
SwDropPortion * NewDropPortion(SwTextFormatInfo &rInf)
Definition: txtdrop.cxx:560
bool CalcOnceMore()
Definition: itrform2.cxx:1945
#define ODF_FORMDROPDOWN
sal_uInt16 GetAscent() const
Definition: inftxt.hxx:713
SwFont & GetFont() const
Definition: pordrop.hxx:50
SwTwips GetLeftMin() const
Definition: itrtxt.hxx:193
void Init(SwLinePortion *pNextPortion=nullptr)
Definition: porlay.cxx:2418
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo