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() );
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() );
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() );
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 );
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 );
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 );
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 );
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  nTmp *= nLineHeight;
1875  nTmp /= 100;
1876  if( !nTmp )
1877  ++nTmp;
1878  nLineHeight = static_cast<sal_uInt16>(nTmp);
1879  break;
1880  }
1881  case SvxInterLineSpaceRule::Fix:
1882  {
1883  nLineHeight = nLineHeight + pSpace->GetInterLineSpace();
1884  break;
1885  }
1886  default: OSL_FAIL( ": unknown InterLineSpaceRule" );
1887  }
1888  }
1889 
1890  if( IsRegisterOn() )
1891  {
1892  SwTwips nTmpY = Y() + m_pCurr->GetAscent() + nLineHeight - m_pCurr->Height();
1893  SwRectFnSet aRectFnSet(m_pFrame);
1894  if ( aRectFnSet.IsVert() )
1895  nTmpY = m_pFrame->SwitchHorizontalToVertical( nTmpY );
1896  nTmpY = aRectFnSet.YDiff( nTmpY, RegStart() );
1897  const sal_uInt16 nDiff = sal_uInt16( nTmpY % RegDiff() );
1898  if( nDiff )
1899  nLineHeight += RegDiff() - nDiff;
1900  }
1901  }
1902  m_pCurr->SetRealHeight( nLineHeight );
1903 }
1904 
1906 {
1907  // delete Fly in any case!
1908  ClearFly( rInf );
1909  rInf.Init();
1910 
1911  rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
1912  rInf.SetRoot( m_pCurr );
1913  rInf.SetLineStart( m_nStart );
1914  rInf.SetIdx( m_nStart );
1915  rInf.Left( Left() );
1916  rInf.Right( Right() );
1917  rInf.First( FirstLeft() );
1918  rInf.LeftMargin(GetLeftMargin());
1919 
1920  rInf.RealWidth( sal_uInt16(rInf.Right() - GetLeftMargin()) );
1921  rInf.Width( rInf.RealWidth() );
1922  if( const_cast<SwTextFormatter*>(this)->GetRedln() )
1923  {
1924  const_cast<SwTextFormatter*>(this)->GetRedln()->Clear( const_cast<SwTextFormatter*>(this)->GetFnt() );
1925  const_cast<SwTextFormatter*>(this)->GetRedln()->Reset();
1926  }
1927 }
1928 
1930 {
1931  m_pFirstOfBorderMerge = nullptr;
1932  m_pCurr->Truncate();
1933  m_pCurr->Init();
1934 
1935  // delete pSpaceAdd and pKanaComp
1938  m_pCurr->ResetFlags();
1939  FeedInf( rInf );
1940 }
1941 
1943 {
1944  if( m_pDropFormat )
1945  {
1946  const sal_uInt16 nOldDrop = GetDropHeight();
1948  m_bOnceMore = nOldDrop != GetDropHeight();
1949  }
1950  else
1951  m_bOnceMore = false;
1952  return m_bOnceMore;
1953 }
1954 
1956 {
1957  SwTwips nRet = Y() + GetLineHeight();
1958  SwTwips nMin = GetInfo().GetTextFly().GetMinBottom();
1959  if( nMin && ++nMin > nRet )
1960  {
1963  if( nRet + nDist < nMin )
1964  {
1965  const bool bRepaint = HasTruncLines() &&
1966  GetInfo().GetParaPortion()->GetRepaint().Bottom() == nRet-1;
1967  nRet = nMin - nDist;
1968  if( bRepaint )
1969  {
1970  const_cast<SwRepaint&>(GetInfo().GetParaPortion()
1971  ->GetRepaint()).Bottom( nRet-1 );
1972  const_cast<SwTextFormatInfo&>(GetInfo()).SetPaintOfst( 0 );
1973  }
1974  }
1975  }
1976  return nRet;
1977 }
1978 
1979 // FME/OD: This routine does a limited text formatting.
1981 {
1982  FormatReset( GetInfo() );
1983  BuildPortions( GetInfo() );
1984  m_pCurr->CalcLine( *this, GetInfo() );
1985  return m_pCurr->Width();
1986 }
1987 
1988 // determines if the calculation of a repaint offset is allowed
1989 // otherwise each line is painted from 0 (this is a copy of the beginning
1990 // of the former SwTextFormatter::Recycle() function
1992 {
1993  // reformat position in front of current line? Only in this case
1994  // we want to set the repaint offset
1995  bool bOptimizeRepaint = m_nStart < GetInfo().GetReformatStart() &&
1996  m_pCurr->GetLen();
1997 
1998  // a special case is the last line of a block adjusted paragraph:
1999  if ( bOptimizeRepaint )
2000  {
2001  switch( GetAdjust() )
2002  {
2003  case SvxAdjust::Block:
2004  {
2005  if( IsLastBlock() || IsLastCenter() )
2006  bOptimizeRepaint = false;
2007  else
2008  {
2009  // ????: blank in the last master line (blocksat.sdw)
2010  bOptimizeRepaint = nullptr == m_pCurr->GetNext() && !m_pFrame->GetFollow();
2011  if ( bOptimizeRepaint )
2012  {
2014  while ( pPos && !pPos->IsFlyPortion() )
2015  pPos = pPos->GetNextPortion();
2016  bOptimizeRepaint = !pPos;
2017  }
2018  }
2019  break;
2020  }
2021  case SvxAdjust::Center:
2022  case SvxAdjust::Right:
2023  bOptimizeRepaint = false;
2024  break;
2025  default: ;
2026  }
2027  }
2028 
2029  // Again another special case: invisible SoftHyphs
2030  const TextFrameIndex nReformat = GetInfo().GetReformatStart();
2031  if (bOptimizeRepaint && TextFrameIndex(COMPLETE_STRING) != nReformat)
2032  {
2033  const sal_Unicode cCh = nReformat >= TextFrameIndex(GetInfo().GetText().getLength())
2034  ? 0
2035  : GetInfo().GetText()[ sal_Int32(nReformat) ];
2036  bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
2037  || ! GetInfo().HasHint( nReformat );
2038  }
2039 
2040  return bOptimizeRepaint;
2041 }
2042 
2044 {
2045  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2046  "SwTextFormatter::CalcUnclipped with unswapped frame" );
2047 
2048  long nFlyAsc, nFlyDesc;
2049  m_pCurr->MaxAscentDescent( rTop, rBottom, nFlyAsc, nFlyDesc );
2050  rTop = Y() + GetCurr()->GetAscent();
2051  rBottom = rTop + nFlyDesc;
2052  rTop -= nFlyAsc;
2053 }
2054 
2055 void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
2056  TextFrameIndex const nStartIdx, bool bAlways) const
2057 {
2058  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2059  "SwTextFormatter::UpdatePos with unswapped frame" );
2060 
2061  if( GetInfo().IsTest() )
2062  return;
2063  SwLinePortion *pFirst = pCurrent->GetFirstPortion();
2064  SwLinePortion *pPos = pFirst;
2065  SwTextPaintInfo aTmpInf( GetInfo() );
2066  aTmpInf.SetpSpaceAdd( pCurrent->GetpLLSpaceAdd() );
2067  aTmpInf.ResetSpaceIdx();
2068  aTmpInf.SetKanaComp( pCurrent->GetpKanaComp() );
2069  aTmpInf.ResetKanaIdx();
2070 
2071  // The frame's size
2072  aTmpInf.SetIdx( nStartIdx );
2073  aTmpInf.SetPos( aStart );
2074 
2075  long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2076  pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2077 
2078  const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
2079  sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
2081  if( GetMulti() )
2082  {
2083  aTmpInf.SetDirection( GetMulti()->GetDirection() );
2084  if( GetMulti()->HasRotation() )
2085  {
2086  nFlags |= AsCharFlags::Rotate;
2087  if( GetMulti()->IsRevers() )
2088  {
2089  nFlags |= AsCharFlags::Reverse;
2090  aTmpInf.X( aTmpInf.X() - nAscent );
2091  }
2092  else
2093  aTmpInf.X( aTmpInf.X() + nAscent );
2094  }
2095  else
2096  {
2097  if ( GetMulti()->IsBidi() )
2098  nFlags |= AsCharFlags::Bidi;
2099  aTmpInf.Y( aTmpInf.Y() + nAscent );
2100  }
2101  }
2102  else
2103  aTmpInf.Y( aTmpInf.Y() + nAscent );
2104 
2105  while( pPos )
2106  {
2107  // We only know one case where changing the position (caused by the
2108  // adjustment) could be relevant for a portion: We need to SetRefPoint
2109  // for FlyCntPortions.
2110  if( ( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
2111  && ( bAlways || !IsQuick() ) )
2112  {
2113  pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, pPos );
2114 
2115  if( pPos->IsGrfNumPortion() )
2116  {
2117  if( !nFlyAsc && !nFlyDesc )
2118  {
2119  nTmpAscent = nAscent;
2120  nFlyAsc = nAscent;
2121  nTmpDescent = nTmpHeight - nAscent;
2122  nFlyDesc = nTmpDescent;
2123  }
2124  static_cast<SwGrfNumPortion*>(pPos)->SetBase( nTmpAscent, nTmpDescent,
2125  nFlyAsc, nFlyDesc );
2126  }
2127  else
2128  {
2129  Point aBase( aTmpInf.GetPos() );
2130  if ( GetInfo().GetTextFrame()->IsVertical() )
2132 
2133  static_cast<SwFlyCntPortion*>(pPos)->SetBase( *aTmpInf.GetTextFrame(),
2134  aBase, nTmpAscent, nTmpDescent, nFlyAsc,
2135  nFlyDesc, nFlags );
2136  }
2137  }
2138  if( pPos->IsMultiPortion() && static_cast<SwMultiPortion*>(pPos)->HasFlyInContent() )
2139  {
2140  OSL_ENSURE( !GetMulti(), "Too much multi" );
2141  const_cast<SwTextFormatter*>(this)->m_pMulti = static_cast<SwMultiPortion*>(pPos);
2142  SwLineLayout *pLay = &GetMulti()->GetRoot();
2143  Point aSt( aTmpInf.X(), aStart.Y() );
2144 
2145  if ( GetMulti()->HasBrackets() )
2146  {
2147  OSL_ENSURE( GetMulti()->IsDouble(), "Brackets only for doubles");
2148  aSt.AdjustX(static_cast<SwDoubleLinePortion*>(GetMulti())->PreWidth() );
2149  }
2150  else if( GetMulti()->HasRotation() )
2151  {
2152  aSt.AdjustY(pCurrent->GetAscent() - GetMulti()->GetAscent() );
2153  if( GetMulti()->IsRevers() )
2154  aSt.AdjustX(GetMulti()->Width() );
2155  else
2156  aSt.AdjustY(GetMulti()->Height() );
2157  }
2158  else if ( GetMulti()->IsBidi() )
2159  // jump to end of the bidi portion
2160  aSt.AdjustX(pLay->Width() );
2161 
2162  TextFrameIndex nStIdx = aTmpInf.GetIdx();
2163  do
2164  {
2165  UpdatePos( pLay, aSt, nStIdx, bAlways );
2166  nStIdx = nStIdx + pLay->GetLen();
2167  aSt.AdjustY(pLay->Height() );
2168  pLay = pLay->GetNext();
2169  } while ( pLay );
2170  const_cast<SwTextFormatter*>(this)->m_pMulti = nullptr;
2171  }
2172  pPos->Move( aTmpInf );
2173  pPos = pPos->GetNextPortion();
2174  }
2175 }
2176 
2177 void SwTextFormatter::AlignFlyInCntBase( long nBaseLine ) const
2178 {
2179  OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(),
2180  "SwTextFormatter::AlignFlyInCntBase with unswapped frame" );
2181 
2182  if( GetInfo().IsTest() )
2183  return;
2184  SwLinePortion *pFirst = m_pCurr->GetFirstPortion();
2185  SwLinePortion *pPos = pFirst;
2186  AsCharFlags nFlags = AsCharFlags::None;
2187  if( GetMulti() && GetMulti()->HasRotation() )
2188  {
2189  nFlags |= AsCharFlags::Rotate;
2190  if( GetMulti()->IsRevers() )
2191  nFlags |= AsCharFlags::Reverse;
2192  }
2193 
2194  long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2195 
2196  while( pPos )
2197  {
2198  if( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
2199  {
2200  m_pCurr->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, pPos );
2201 
2202  if( pPos->IsGrfNumPortion() )
2203  static_cast<SwGrfNumPortion*>(pPos)->SetBase( nTmpAscent, nTmpDescent,
2204  nFlyAsc, nFlyDesc );
2205  else
2206  {
2207  Point aBase;
2208  if ( GetInfo().GetTextFrame()->IsVertical() )
2209  {
2210  nBaseLine = GetInfo().GetTextFrame()->SwitchHorizontalToVertical( nBaseLine );
2211  aBase = Point( nBaseLine, static_cast<SwFlyCntPortion*>(pPos)->GetRefPoint().Y() );
2212  }
2213  else
2214  aBase = Point( static_cast<SwFlyCntPortion*>(pPos)->GetRefPoint().X(), nBaseLine );
2215 
2216  static_cast<SwFlyCntPortion*>(pPos)->SetBase( *GetInfo().GetTextFrame(), aBase, nTmpAscent, nTmpDescent,
2217  nFlyAsc, nFlyDesc, nFlags );
2218  }
2219  }
2220  pPos = pPos->GetNextPortion();
2221  }
2222 }
2223 
2225 {
2226  OSL_ENSURE( rInf.GetTextFly().IsOn(), "SwTextFormatter::ChkFlyUnderflow: why?" );
2227  if( GetCurr() )
2228  {
2229  // First we check, whether a fly overlaps with the line.
2230  // = GetLineHeight()
2231  const sal_uInt16 nHeight = GetCurr()->GetRealHeight();
2232  SwRect aLine( GetLeftMargin(), Y(), rInf.RealWidth(), nHeight );
2233 
2234  SwRect aLineVert( aLine );
2235  if ( m_pFrame->IsVertical() )
2236  m_pFrame->SwitchHorizontalToVertical( aLineVert );
2237  SwRect aInter( rInf.GetTextFly().GetFrame( aLineVert ) );
2238  if ( m_pFrame->IsVertical() )
2240 
2241  if( !aInter.HasArea() )
2242  return false;
2243 
2244  // We now check every portion that could have lowered for overlapping
2245  // with the fly.
2246  const SwLinePortion *pPos = GetCurr()->GetFirstPortion();
2247  aLine.Pos().setY( Y() + GetCurr()->GetRealHeight() - GetCurr()->Height() );
2248  aLine.Height( GetCurr()->Height() );
2249 
2250  while( pPos )
2251  {
2252  aLine.Width( pPos->Width() );
2253 
2254  aLineVert = aLine;
2255  if ( m_pFrame->IsVertical() )
2256  m_pFrame->SwitchHorizontalToVertical( aLineVert );
2257  aInter = rInf.GetTextFly().GetFrame( aLineVert );
2258  if ( m_pFrame->IsVertical() )
2260 
2261  // New flys from below?
2262  if( !pPos->IsFlyPortion() )
2263  {
2264  if( aInter.IsOver( aLine ) )
2265  {
2266  aInter.Intersection_( aLine );
2267  if( aInter.HasArea() )
2268  {
2269  // To be evaluated during reformat of this line:
2270  // RealHeight including spacing
2271  rInf.SetLineHeight( nHeight );
2272  // Height without extra spacing
2273  rInf.SetLineNetHeight( m_pCurr->Height() );
2274  return true;
2275  }
2276  }
2277  }
2278  else
2279  {
2280  // The fly portion is not intersected by a fly anymore
2281  if ( ! aInter.IsOver( aLine ) )
2282  {
2283  rInf.SetLineHeight( nHeight );
2284  rInf.SetLineNetHeight( m_pCurr->Height() );
2285  return true;
2286  }
2287  else
2288  {
2289  aInter.Intersection_( aLine );
2290 
2291  // No area means a fly has become invalid because of
2292  // lowering the line => reformat the line
2293  // we also have to reformat the line, if the fly size
2294  // differs from the intersection interval's size.
2295  if( ! aInter.HasArea() ||
2296  static_cast<const SwFlyPortion*>(pPos)->GetFixWidth() != aInter.Width() )
2297  {
2298  rInf.SetLineHeight( nHeight );
2299  rInf.SetLineNetHeight( m_pCurr->Height() );
2300  return true;
2301  }
2302  }
2303  }
2304 
2305  aLine.Left( aLine.Left() + pPos->Width() );
2306  pPos = pPos->GetNextPortion();
2307  }
2308  }
2309  return false;
2310 }
2311 
2313 {
2314  if( GetMulti() || rInf.GetFly() )
2315  return;
2316 
2317  SwTextFly& rTextFly = rInf.GetTextFly();
2318  if( !rTextFly.IsOn() || rInf.IsIgnoreFly() )
2319  return;
2320 
2321  const SwLinePortion *pLast = rInf.GetLast();
2322 
2323  long nAscent;
2324  long nTop = Y();
2325  long nHeight;
2326 
2327  if( rInf.GetLineHeight() )
2328  {
2329  // Real line height has already been calculated, we only have to
2330  // search for intersections in the lower part of the strip
2331  nAscent = m_pCurr->GetAscent();
2332  nHeight = rInf.GetLineNetHeight();
2333  nTop += rInf.GetLineHeight() - nHeight;
2334  }
2335  else
2336  {
2337  // We make a first guess for the lines real height
2338  if ( ! m_pCurr->GetRealHeight() )
2339  CalcRealHeight();
2340 
2341  nAscent = pLast->GetAscent();
2342  nHeight = pLast->Height();
2343 
2344  if ( m_pCurr->GetRealHeight() > nHeight )
2345  nTop += m_pCurr->GetRealHeight() - nHeight;
2346  else
2347  // Important for fixed space between lines
2348  nHeight = m_pCurr->GetRealHeight();
2349  }
2350 
2351  const long nLeftMar = GetLeftMargin();
2352  const long nLeftMin = (rInf.X() || GetDropLeft()) ? nLeftMar : GetLeftMin();
2353 
2354  SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X()
2355  + nLeftMar - nLeftMin , nHeight );
2356 
2357  // tdf#116486: consider also the upper margin from getFramePrintArea because intersections
2358  // with this additional space should lead to repositioning of paragraphs
2359  // For compatibility we grab a related compat flag:
2361  {
2362  const long nUpper = m_pFrame->getFramePrintArea().Top();
2363  // Increase the rectangle
2364  if( nUpper > 0 && nTop >= nUpper )
2365  aLine.SubTop( nUpper );
2366  }
2367  SwRect aLineVert( aLine );
2368  if ( m_pFrame->IsRightToLeft() )
2369  m_pFrame->SwitchLTRtoRTL( aLineVert );
2370 
2371  if ( m_pFrame->IsVertical() )
2372  m_pFrame->SwitchHorizontalToVertical( aLineVert );
2373 
2374  // GetFrame(...) determines and returns the intersection rectangle
2375  SwRect aInter( rTextFly.GetFrame( aLineVert ) );
2376 
2377  if ( m_pFrame->IsRightToLeft() )
2378  m_pFrame->SwitchRTLtoLTR( aInter );
2379 
2380  if ( m_pFrame->IsVertical() )
2382 
2383  if (!aInter.IsEmpty() && aInter.Bottom() < nTop)
2384  {
2385  // Intersects with the frame area (with upper margin), but not with the print area (without
2386  // upper margin). Don't reserve space for the fly portion in this case, text is allowed to
2387  // flow there.
2388  aInter.Height(0);
2389  }
2390 
2391  if( !aInter.IsOver( aLine ) )
2392  return;
2393 
2394  aLine.Left( rInf.X() + nLeftMar );
2395  bool bForced = false;
2396  if( aInter.Left() <= nLeftMin )
2397  {
2398  SwTwips nFrameLeft = GetTextFrame()->getFrameArea().Left();
2399  if( GetTextFrame()->getFramePrintArea().Left() < 0 )
2400  nFrameLeft += GetTextFrame()->getFramePrintArea().Left();
2401  if( aInter.Left() < nFrameLeft )
2402  aInter.Left( nFrameLeft );
2403 
2404  long nAddMar = 0;
2405  if ( m_pFrame->IsRightToLeft() )
2406  {
2407  nAddMar = m_pFrame->getFrameArea().Right() - Right();
2408  if ( nAddMar < 0 )
2409  nAddMar = 0;
2410  }
2411  else
2412  nAddMar = nLeftMar - nFrameLeft;
2413 
2414  aInter.Width( aInter.Width() + nAddMar );
2415  // For a negative first line indent, we set this flag to show
2416  // that the indentation/margin has been moved.
2417  // This needs to be respected by the DefaultTab at the zero position.
2418  if( IsFirstTextLine() && HasNegFirst() )
2419  bForced = true;
2420  }
2421  aInter.Intersection( aLine );
2422  if( !aInter.HasArea() )
2423  return;
2424 
2425  const bool bFullLine = aLine.Left() == aInter.Left() &&
2426  aLine.Right() == aInter.Right();
2427 
2428  // Although no text is left, we need to format another line,
2429  // because also empty lines need to avoid a Fly with no wrapping.
2430  if (bFullLine && rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
2431  {
2432  rInf.SetNewLine( true );
2433  // We know that for dummies, it holds ascent == height
2434  m_pCurr->SetDummy(true);
2435  }
2436 
2437  // aInter becomes frame-local
2438  aInter.Pos().AdjustX( -nLeftMar );
2439  SwFlyPortion *pFly = new SwFlyPortion( aInter );
2440  if( bForced )
2441  {
2443  rInf.ForcedLeftMargin( static_cast<sal_uInt16>(aInter.Width()) );
2444  }
2445 
2446  if( bFullLine )
2447  {
2448  // In order to properly flow around Flys with different
2449  // wrapping attributes, we need to increase by units of line height.
2450  // The last avoiding line should be adjusted in height, so that
2451  // we don't get a frame spacing effect.
2452  // It is important that ascent == height, because the FlyPortion
2453  // values are transferred to pCurr in CalcLine and IsDummy() relies
2454  // on this behaviour.
2455  // To my knowledge we only have two places where DummyLines can be
2456  // created: here and in MakeFlyDummies.
2457  // IsDummy() is evaluated in IsFirstTextLine(), when moving lines
2458  // and in relation with DropCaps.
2459  pFly->Height( sal_uInt16(aInter.Height()) );
2460 
2461  // nNextTop now contains the margin's bottom edge, which we avoid
2462  // or the next margin's top edge, which we need to respect.
2463  // That means we can comfortably grow up to this value; that's how
2464  // we save a few empty lines.
2465  long nNextTop = rTextFly.GetNextTop();
2466  if ( m_pFrame->IsVertical() )
2467  nNextTop = m_pFrame->SwitchVerticalToHorizontal( nNextTop );
2468  if( nNextTop > aInter.Bottom() )
2469  {
2470  SwTwips nH = nNextTop - aInter.Top();
2471  if( nH < SAL_MAX_UINT16 )
2472  pFly->Height( sal_uInt16( nH ) );
2473  }
2474  if( nAscent < pFly->Height() )
2475  pFly->SetAscent( sal_uInt16(nAscent) );
2476  else
2477  pFly->SetAscent( pFly->Height() );
2478  }
2479  else
2480  {
2481  if (rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
2482  {
2483  // Don't use nHeight, or we have a huge descent
2484  pFly->Height( pLast->Height() );
2485  pFly->SetAscent( pLast->GetAscent() );
2486  }
2487  else
2488  {
2489  pFly->Height( sal_uInt16(aInter.Height()) );
2490  if( nAscent < pFly->Height() )
2491  pFly->SetAscent( sal_uInt16(nAscent) );
2492  else
2493  pFly->SetAscent( pFly->Height() );
2494  }
2495  }
2496 
2497  rInf.SetFly( pFly );
2498 
2499  if( pFly->GetFix() < rInf.Width() )
2500  rInf.Width( pFly->GetFix() );
2501 
2502  SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
2503  if ( !pGrid )
2504  return;
2505 
2506  const SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
2507  const SwLayoutFrame* pBody = pPageFrame->FindBodyCont();
2508 
2509  SwRectFnSet aRectFnSet(pPageFrame);
2510 
2511  const long nGridOrigin = pBody ?
2512  aRectFnSet.GetPrtLeft(*pBody) :
2513  aRectFnSet.GetPrtLeft(*pPageFrame);
2514 
2515  const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
2516  const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, rDoc);
2517 
2518  SwTwips nStartX = GetLeftMargin();
2519  if ( aRectFnSet.IsVert() )
2520  {
2521  Point aPoint( nStartX, 0 );
2523  nStartX = aPoint.Y();
2524  }
2525 
2526  const SwTwips nOfst = nStartX - nGridOrigin;
2527  const SwTwips nTmpWidth = rInf.Width() + nOfst;
2528 
2529  const sal_uLong i = nTmpWidth / nGridWidth + 1;
2530 
2531  const long nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
2532  if ( nNewWidth > 0 )
2533  rInf.Width( static_cast<sal_uInt16>(nNewWidth) );
2534  else
2535  rInf.Width( 0 );
2536 
2537 
2538 }
2539 
2541  SwTextAttr *pHint ) const
2542 {
2543  const SwFrame *pFrame = m_pFrame;
2544 
2545  SwFlyInContentFrame *pFly;
2546  SwFrameFormat* pFrameFormat = static_cast<SwTextFlyCnt*>(pHint)->GetFlyCnt().GetFrameFormat();
2547  if( RES_FLYFRMFMT == pFrameFormat->Which() )
2548  pFly = static_cast<SwTextFlyCnt*>(pHint)->GetFlyFrame(pFrame);
2549  else
2550  pFly = nullptr;
2551  // aBase is the document-global position, from which the new extra portion is placed
2552  // aBase.X() = Offset in the line after the current position
2553  // aBase.Y() = LineIter.Y() + Ascent of the current position
2554 
2555  long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
2556  // i#11859 - use new method <SwLineLayout::MaxAscentDescent(..)>
2557  // to change line spacing behaviour at paragraph - Compatibility to MS Word
2558  //SwLinePortion *pPos = pCurr->GetFirstPortion();
2559  //lcl_MaxAscDescent( pPos, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2560  m_pCurr->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
2561 
2562  // If the ascent of the frame is larger than the ascent of the current position,
2563  // we use this one when calculating the base, or the frame would be positioned
2564  // too much to the top, sliding down after all causing a repaint in an area
2565  // he actually never was in.
2566  sal_uInt16 nAscent = 0;
2567 
2568  const bool bTextFrameVertical = GetInfo().GetTextFrame()->IsVertical();
2569 
2570  const bool bUseFlyAscent = pFly && pFly->isFrameAreaPositionValid() &&
2571  0 != ( bTextFrameVertical ?
2572  pFly->GetRefPoint().X() :
2573  pFly->GetRefPoint().Y() );
2574 
2575  if ( bUseFlyAscent )
2576  nAscent = static_cast<sal_uInt16>( std::abs( int( bTextFrameVertical ?
2577  pFly->GetRelPos().X() :
2578  pFly->GetRelPos().Y() ) ) );
2579 
2580  // Check if be prefer to use the ascent of the last portion:
2581  if ( IsQuick() ||
2582  !bUseFlyAscent ||
2583  nAscent < rInf.GetLast()->GetAscent() )
2584  {
2585  nAscent = rInf.GetLast()->GetAscent();
2586  }
2587  else if( nAscent > nFlyAsc )
2588  nFlyAsc = nAscent;
2589 
2590  Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent );
2592  if( GetMulti() && GetMulti()->HasRotation() )
2593  {
2594  nMode |= AsCharFlags::Rotate;
2595  if( GetMulti()->IsRevers() )
2596  nMode |= AsCharFlags::Reverse;
2597  }
2598 
2599  Point aTmpBase( aBase );
2600  if ( GetInfo().GetTextFrame()->IsVertical() )
2602 
2603  SwFlyCntPortion* pRet(nullptr);
2604  if( pFly )
2605  {
2606  pRet = sw::FlyContentPortion::Create(*GetInfo().GetTextFrame(), pFly, aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode);
2607  // We need to make sure that our font is set again in the OutputDevice
2608  // It could be that the FlyInCnt was added anew and GetFlyFrame() would
2609  // in turn cause, that it'd be created anew again.
2610  // This one's frames get formatted right away, which change the font.
2611  rInf.SelectFont();
2612  if( pRet->GetAscent() > nAscent )
2613  {
2614  aBase.setY( Y() + pRet->GetAscent() );
2615  nMode |= AsCharFlags::UlSpace;
2616  if( !rInf.IsTest() )
2617  {
2618  aTmpBase = aBase;
2619  if ( GetInfo().GetTextFrame()->IsVertical() )
2621 
2622  pRet->SetBase( *rInf.GetTextFrame(), aTmpBase, nTmpAscent,
2623  nTmpDescent, nFlyAsc, nFlyDesc, nMode );
2624  }
2625  }
2626  }
2627  else
2628  {
2629  pRet = sw::DrawFlyCntPortion::Create(*rInf.GetTextFrame(), *pFrameFormat, aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode);
2630  }
2631  return pRet;
2632 }
2633 
2634 /* Drop portion is a special case, because it has parts which aren't portions
2635  but we have handle them just like portions */
2637 {
2638  if( rPortion.GetLines() > 1 )
2639  {
2640  SwDropPortionPart* pCurrPart = rPortion.GetPart();
2641  while( pCurrPart )
2642  {
2643  if( pCurrPart->GetFollow() &&
2644  ::lcl_HasSameBorder(pCurrPart->GetFont(), pCurrPart->GetFollow()->GetFont()) )
2645  {
2646  pCurrPart->SetJoinBorderWithNext(true);
2647  pCurrPart->GetFollow()->SetJoinBorderWithPrev(true);
2648  }
2649  pCurrPart = pCurrPart->GetFollow();
2650  }
2651  }
2652 }
2653 
2655 {
2656  const SwFont aCurFont = *rInf.GetFont();
2657  if( aCurFont.HasBorder() )
2658  {
2659  if (pPrev && pPrev->GetJoinBorderWithNext() )
2660  {
2661  // In some case border merge is called twice to the portion
2662  if( !rPortion.GetJoinBorderWithPrev() )
2663  {
2664  rPortion.SetJoinBorderWithPrev(true);
2665  if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetLeftBorderSpace() )
2666  rPortion.Width(rPortion.Width() - aCurFont.GetLeftBorderSpace());
2667  }
2668  }
2669  else
2670  {
2671  rPortion.SetJoinBorderWithPrev(false);
2672  m_pFirstOfBorderMerge = &rPortion;
2673  }
2674 
2675  // Get next portion's font
2676  bool bSeek = false;
2677  if (!rInf.IsFull() && // Not the last portion of the line (in case of line break)
2678  rInf.GetIdx() + rPortion.GetLen() != TextFrameIndex(rInf.GetText().getLength())) // Not the last portion of the paragraph
2679  {
2680  bSeek = Seek(rInf.GetIdx() + rPortion.GetLen());
2681  }
2682  // Don't join the next portion if SwKernPortion sits between two different boxes.
2683  bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev();
2684  // If next portion has the same border then merge
2685  if( bSeek && GetFnt()->HasBorder() && ::lcl_HasSameBorder(aCurFont, *GetFnt()) && !bDisconnect )
2686  {
2687  // In some case border merge is called twice to the portion
2688  if( !rPortion.GetJoinBorderWithNext() )
2689  {
2690  rPortion.SetJoinBorderWithNext(true);
2691  if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetRightBorderSpace() )
2692  rPortion.Width(rPortion.Width() - aCurFont.GetRightBorderSpace());
2693  }
2694  }
2695  // If this is the last portion of the merge group then make the real height merge
2696  else
2697  {
2698  rPortion.SetJoinBorderWithNext(false);
2699  if( m_pFirstOfBorderMerge != &rPortion )
2700  {
2701  // Calculate maximum height and ascent
2703  sal_uInt16 nMaxAscent = 0;
2704  sal_uInt16 nMaxHeight = 0;
2705  bool bReachCurrent = false;
2706  while( pActPor )
2707  {
2708  if( nMaxHeight < pActPor->Height() )
2709  nMaxHeight = pActPor->Height();
2710  if( nMaxAscent < pActPor->GetAscent() )
2711  nMaxAscent = pActPor->GetAscent();
2712 
2713  pActPor = pActPor->GetNextPortion();
2714  if( !pActPor && !bReachCurrent )
2715  {
2716  pActPor = &rPortion;
2717  bReachCurrent = true;
2718  }
2719  }
2720 
2721  // Change all portion's height and ascent
2722  pActPor = m_pFirstOfBorderMerge;
2723  bReachCurrent = false;
2724  while( pActPor )
2725  {
2726  if( nMaxHeight > pActPor->Height() )
2727  pActPor->Height(nMaxHeight);
2728  if( nMaxAscent > pActPor->GetAscent() )
2729  pActPor->SetAscent(nMaxAscent);
2730 
2731  pActPor = pActPor->GetNextPortion();
2732  if( !pActPor && !bReachCurrent )
2733  {
2734  pActPor = &rPortion;
2735  bReachCurrent = true;
2736  }
2737  }
2738  m_pFirstOfBorderMerge = nullptr;
2739  }
2740  }
2741  Seek(rInf.GetIdx());
2742  }
2743 }
2744 
2745 namespace {
2746  // calculates and sets optimal repaint offset for the current line
2747  long lcl_CalcOptRepaint( SwTextFormatter &rThis,
2748  SwLineLayout const &rCurr,
2749  TextFrameIndex const nOldLineEnd,
2750  const std::vector<long> &rFlyStarts )
2751  {
2752  SwTextFormatInfo& txtFormatInfo = rThis.GetInfo();
2753  if ( txtFormatInfo.GetIdx() < txtFormatInfo.GetReformatStart() )
2754  // the reformat position is behind our new line, that means
2755  // something of our text has moved to the next line
2756  return 0;
2757 
2758  TextFrameIndex nReformat = std::min(txtFormatInfo.GetReformatStart(), nOldLineEnd);
2759 
2760  // in case we do not have any fly in our line, our repaint position
2761  // is the changed position - 1
2762  if ( rFlyStarts.empty() && ! rCurr.IsFly() )
2763  {
2764  // this is the maximum repaint offset determined during formatting
2765  // for example: the beginning of the first right tab stop
2766  // if this value is 0, this means that we do not have an upper
2767  // limit for the repaint offset
2768  const long nFormatRepaint = txtFormatInfo.GetPaintOfst();
2769 
2770  if (nReformat < txtFormatInfo.GetLineStart() + TextFrameIndex(3))
2771  return 0;
2772 
2773  // step back two positions for smoother repaint
2774  nReformat -= TextFrameIndex(2);
2775 
2776  // i#28795, i#34607, i#38388
2777  // step back more characters, this is required by complex scripts
2778  // e.g., for Khmer (thank you, Javier!)
2779  static const TextFrameIndex nMaxContext(10);
2780  if (nReformat > txtFormatInfo.GetLineStart() + nMaxContext)
2781  nReformat = nReformat - nMaxContext;
2782  else
2783  {
2784  nReformat = txtFormatInfo.GetLineStart();
2785  //reset the margin flag - prevent loops
2787  }
2788 
2789  // Weird situation: Our line used to end with a hole portion
2790  // and we delete some characters at the end of our line. We have
2791  // to take care for repainting the blanks which are not anymore
2792  // covered by the hole portion
2793  while ( nReformat > txtFormatInfo.GetLineStart() &&
2794  CH_BLANK == txtFormatInfo.GetChar( nReformat ) )
2795  --nReformat;
2796 
2797  OSL_ENSURE( nReformat < txtFormatInfo.GetIdx(), "Reformat too small for me!" );
2798  SwRect aRect;
2799 
2800  // Note: GetChareRect is not const. It definitely changes the
2801  // bMulti flag. We have to save and restore the old value.
2802  bool bOldMulti = txtFormatInfo.IsMulti();
2803  rThis.GetCharRect( &aRect, nReformat );
2804  txtFormatInfo.SetMulti( bOldMulti );
2805 
2806  return nFormatRepaint ? std::min( aRect.Left(), nFormatRepaint ) :
2807  aRect.Left();
2808  }
2809  else
2810  {
2811  // nReformat may be wrong, if something around flys has changed:
2812  // we compare the former and the new fly positions in this line
2813  // if anything has changed, we carefully have to adjust the right
2814  // repaint position
2815  long nPOfst = 0;
2816  size_t nCnt = 0;
2817  long nX = 0;
2818  TextFrameIndex nIdx = rThis.GetInfo().GetLineStart();
2819  SwLinePortion* pPor = rCurr.GetFirstPortion();
2820 
2821  while ( pPor )
2822  {
2823  if ( pPor->IsFlyPortion() )
2824  {
2825  // compare start of fly with former start of fly
2826  if (nCnt < rFlyStarts.size() &&
2827  nX == rFlyStarts[ nCnt ] &&
2828  nIdx < nReformat
2829  )
2830  // found fix position, nothing has changed left from nX
2831  nPOfst = nX + pPor->Width();
2832  else
2833  break;
2834 
2835  nCnt++;
2836  }
2837  nX = nX + pPor->Width();
2838  nIdx = nIdx + pPor->GetLen();
2839  pPor = pPor->GetNextPortion();
2840  }
2841 
2842  return nPOfst + rThis.GetLeftMargin();
2843  }
2844  }
2845 
2846  // Determine if we need to build hidden portions
2847  bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex & rPos)
2848  {
2849  // Only if hidden text should not be shown:
2850  // if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
2851  const bool bShowInDocView = rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar();
2852  const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( true ) && rInf.GetOpt().IsPrinting();
2853  if (bShowInDocView || bShowForPrinting)
2854  return false;
2855 
2856  const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
2857  TextFrameIndex nHiddenStart;
2858  TextFrameIndex nHiddenEnd;
2859  rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
2860  if ( nHiddenEnd )
2861  {
2862  rPos = nHiddenEnd;
2863  return true;
2864  }
2865 
2866  return false;
2867  }
2868 
2869  bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond)
2870  {
2871  return
2872  rFirst.GetTopBorder() == rSecond.GetTopBorder() &&
2873  rFirst.GetBottomBorder() == rSecond.GetBottomBorder() &&
2874  rFirst.GetLeftBorder() == rSecond.GetLeftBorder() &&
2875  rFirst.GetRightBorder() == rSecond.GetRightBorder() &&
2876  rFirst.GetTopBorderDist() == rSecond.GetTopBorderDist() &&
2877  rFirst.GetBottomBorderDist() == rSecond.GetBottomBorderDist() &&
2878  rFirst.GetLeftBorderDist() == rSecond.GetLeftBorderDist() &&
2879  rFirst.GetRightBorderDist() == rSecond.GetRightBorderDist() &&
2880  rFirst.GetOrientation() == rSecond.GetOrientation() &&
2881  rFirst.GetShadowColor() == rSecond.GetShadowColor() &&
2882  rFirst.GetShadowWidth() == rSecond.GetShadowWidth() &&
2883  rFirst.GetShadowLocation() == rSecond.GetShadowLocation();
2884  }
2885 
2886 } //end unnamed namespace
2887 
2888 /* 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:184
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:118
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:721
void FormatReset(SwTextFormatInfo &rInf)
Definition: itrform2.cxx:1929
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:110
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:1614
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:116
SwFlyCntPortion * NewFlyCntPortion(SwTextFormatInfo &rInf, SwTextAttr *pHt) const
Sets a new portion for an object anchored as character.
Definition: itrform2.cxx:2540
bool IsRest() const
Definition: porlay.hxx:119
sal_uInt16 Height() const
Definition: possiz.hxx:44
SwTwips GetPaintOfst() const
Definition: inftxt.hxx:737
SwFont * GetFont()
Definition: inftxt.hxx:238
SwLineLayout * GetNext()
Definition: porlay.hxx:143
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:396
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:1667
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:2636
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:297
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:67
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:325
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:168
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:604
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:179
bool IsLastBlock() const
Definition: itrtxt.hxx:188
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:170
long GetLen(const Point &rPnt)
SwTextFormatInfo & GetInfo()
Definition: itrform2.hxx:213
void CalcUnclipped(SwTwips &rTop, SwTwips &rBottom)
Definition: itrform2.cxx:2043
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:318
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:137
#define DIR_BOTTOM2TOP
Definition: inftxt.hxx:55
void ResetFlags()
Definition: porlay.cxx:655
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:1991
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:2312
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:1691
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:1640
void CalcAscentAndHeight(sal_uInt16 &rAscent, sal_uInt16 &rHeight) const
Definition: itrtxt.cxx:63
void SetEndHyph(const bool bNew)
Definition: porlay.hxx:112
bool HasScriptSpace() const
Definition: inftxt.hxx:218
void SetRealHeight(sal_uInt16 nNew)
Definition: porlay.hxx:152
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:245
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1288
void UpdatePos(SwLineLayout *pCurr, Point aStart, TextFrameIndex nStartIdx, bool bAlways=false) const
The position of the portions changes with the adjustment.
Definition: itrform2.cxx:2055
bool IsFootnoteNumPortion() const
Definition: porlin.hxx:119
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:1980
void Bottom()
Definition: itrtxt.cxx:185
bool IsDummy() const
Definition: porlay.hxx:135
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
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:266
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:2515
SwNumberPortion * NewNumberPortion(SwTextFormatInfo &rInf) const
Definition: txtfld.cxx:537
sal_uInt16 GetBottomBorderDist() const
Definition: swfont.hxx:357
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:670
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:183
SwLinePortion * NewExtraPortion(SwTextFormatInfo &rInf)
Definition: txtfld.cxx:357
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:168
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2805
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:173
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:2224
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:40
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:1000
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:126
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:169
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:1627
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:305
SwTwips CalcBottomLine() const
Definition: itrform2.cxx:1955
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:294
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:145
PortionType GetWhichPor() const
Definition: porlin.hxx:95
SvxShadowLocation GetShadowLocation() const
Definition: swfont.hxx:376
SwRepaint & GetRepaint()
Definition: porlay.hxx:264
bool IsFootnotePortion() const
Definition: porlin.hxx:120
void SetFootnoteDone(const bool bNew)
Definition: inftxt.hxx:632
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
SwLinePortion * GetRest()
Definition: inftxt.hxx:582
void SetDummy(const bool bNew)
Definition: porlay.hxx:134
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:175
SvxAdjust GetAdjust() const
Definition: itrtxt.hxx:190
bool IsLastCenter() const
Definition: itrtxt.hxx:189
bool IsFly() const
Definition: porlay.hxx:117
long GetNextTop() const
Definition: txtfly.hxx:346
TextFrameIndex NextBookmark(TextFrameIndex nPos) const
Definition: porlay.cxx:1679
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:46
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:270
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:2529
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:919
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:174
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:1905
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:1763
const std::optional< editeng::SvxBorderLine > & GetTopBorder() const
Definition: swfont.hxx:336
sal_uInt16 GetRealHeight() const
Definition: porlay.hxx:153
#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:294
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:114
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:2177
void SetRest(SwLinePortion *pNewRest)
Definition: inftxt.hxx:583
CharClass & GetAppCharClass()
Definition: init.cxx:709
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:315
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:1942
#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:2409
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo