LibreOffice Module sw (master)  1
txthyph.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 <breakit.hxx>
21 #include <editeng/unolingu.hxx>
22 #include <com/sun/star/i18n/WordType.hpp>
23 #include <com/sun/star/i18n/XBreakIterator.hpp>
24 #include <viewopt.hxx>
25 #include <viewsh.hxx>
26 #include <SwPortionHandler.hxx>
27 #include "porhyph.hxx"
28 #include "inftxt.hxx"
29 #include "itrform2.hxx"
30 #include "guess.hxx"
31 #include <rootfrm.hxx>
32 
33 using namespace ::com::sun::star;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::beans;
36 using namespace ::com::sun::star::linguistic2;
37 using namespace ::com::sun::star::i18n;
38 
39 Reference< XHyphenatedWord > SwTextFormatInfo::HyphWord(
40  const OUString &rText, const sal_Int32 nMinTrail )
41 {
42  if( rText.getLength() < 4 || m_pFnt->IsSymbol(m_pVsh) )
43  return nullptr;
44  Reference< XHyphenator > xHyph = ::GetHyphenator();
45  Reference< XHyphenatedWord > xHyphWord;
46 
47  if( xHyph.is() )
48  xHyphWord = xHyph->hyphenate( rText,
50  rText.getLength() - nMinTrail, GetHyphValues() );
51  return xHyphWord;
52 
53 }
54 
59 {
60  vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
61  OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"swapped frame at SwTextFrame::Hyphenate" );
62 
63  assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
64 
65  // We lock it, to start with
66  OSL_ENSURE( !IsLocked(), "SwTextFrame::Hyphenate: this is locked" );
67 
68  // The frame::Frame must have a valid SSize!
69  Calc(pRenderContext);
70  GetFormatted();
71 
72  bool bRet = false;
73  if( !IsEmpty() )
74  {
75  // We always need to enable hyphenation
76  // Don't be afraid: the SwTextIter saves the old row in the hyphenate
77  TextFrameLockGuard aLock( this );
78 
79  if ( IsVertical() )
81 
82  SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this, true ); // true for interactive hyph!
83  SwTextFormatter aLine( this, &aInf );
84  aLine.CharToLine( rHyphInf.m_nStart );
85 
86  // If we're within the first word of a row, it could've been hyphenated
87  // in the row earlier.
88  // That's why we go one row back.
89  if( aLine.Prev() )
90  {
91  SwLinePortion *pPor = aLine.GetCurr()->GetFirstPortion();
92  while( pPor->GetNextPortion() )
93  pPor = pPor->GetNextPortion();
94  if( pPor->GetWhichPor() == PortionType::SoftHyphen ||
96  aLine.Next();
97  }
98 
99  const TextFrameIndex nEnd = rHyphInf.m_nEnd;
100  while( !bRet && aLine.GetStart() < nEnd )
101  {
102  bRet = aLine.Hyphenate( rHyphInf );
103  if( !aLine.Next() )
104  break;
105  }
106 
107  if ( IsVertical() )
109  }
110  return bRet;
111 }
112 
121 {
122  OSL_ENSURE( pRoot, "SetParaPortion: no root anymore" );
123  pInf->m_pPara = pRoot;
124 }
125 
127 {
128  SwTextFormatInfo &rInf = GetInfo();
129 
130  // We never need to hyphenate anything in the last row
131  // Except for, if it contains a FlyPortion or if it's the
132  // last row of the Master
133  if( !GetNext() && !rInf.GetTextFly().IsOn() && !m_pFrame->GetFollow() )
134  return false;
135 
136  TextFrameIndex nWrdStart = m_nStart;
137 
138  // We need to retain the old row
139  // E.g.: The attribute for hyphenation was not set, but
140  // it's always set in SwTextFrame::Hyphenate, because we want
141  // to set breakpoints.
142  SwLineLayout *pOldCurr = m_pCurr;
143 
144  InitCntHyph();
145 
146  // 5298: IsParaLine() (ex.IsFirstLine) calls GetParaPortion().
147  // We have to create the same conditions: in the first line
148  // we format SwParaPortions...
149  if( pOldCurr->IsParaPortion() )
150  {
151  SwParaPortion *pPara = new SwParaPortion();
152  SetParaPortion( &rInf, pPara );
153  m_pCurr = pPara;
154  OSL_ENSURE( IsParaLine(), "SwTextFormatter::Hyphenate: not the first" );
155  }
156  else
157  m_pCurr = new SwLineLayout();
158 
159  nWrdStart = FormatLine( nWrdStart );
160 
161  // You always should keep in mind that for example there are fields
162  // which can be hyphenated
163  if( m_pCurr->PrtWidth() && m_pCurr->GetLen() )
164  {
165  // We must be prepared that there are FlyFrames in the line,
166  // at which line breaking is possible. So we search for the first
167  // HyphPortion in the specified range.
168 
170  const TextFrameIndex nPamStart = rHyphInf.m_nStart;
171  nWrdStart = m_nStart;
172  const TextFrameIndex nEnd = rHyphInf.m_nEnd;
173  while( pPos )
174  {
175  // Either we are above or we are running into a HyphPortion
176  // at the end of line or before a Fly.
177  if( nWrdStart >= nEnd )
178  {
179  nWrdStart = TextFrameIndex(0);
180  break;
181  }
182 
183  if( nWrdStart >= nPamStart && pPos->InHyphGrp()
184  && ( !pPos->IsSoftHyphPortion()
185  || static_cast<SwSoftHyphPortion*>(pPos)->IsExpand() ) )
186  {
187  nWrdStart = nWrdStart + pPos->GetLen();
188  break;
189  }
190 
191  nWrdStart = nWrdStart + pPos->GetLen();
192  pPos = pPos->GetNextPortion();
193  }
194  // When pPos is null, no hyphen position was found.
195  if( !pPos )
196  nWrdStart = TextFrameIndex(0);
197  }
198  else
199  // In case the whole line is zero-length, that's the same situation as
200  // above when the portion iteration ends without explicitly breaking
201  // from the loop.
202  nWrdStart = TextFrameIndex(0);
203 
204  // the old LineLayout is set again ...
205  delete m_pCurr;
206  m_pCurr = pOldCurr;
207 
208  if( pOldCurr->IsParaPortion() )
209  {
210  SetParaPortion( &rInf, static_cast<SwParaPortion*>(pOldCurr) );
211  OSL_ENSURE( IsParaLine(), "SwTextFormatter::Hyphenate: even not the first" );
212  }
213 
214  if (nWrdStart == TextFrameIndex(0))
215  return false;
216 
217  // nWrdStart contains the position in string that should be hyphenated
218  rHyphInf.m_nWordStart = nWrdStart;
219 
220  TextFrameIndex nLen(0);
221  const TextFrameIndex nEnd = nWrdStart;
222 
223  // we search forwards
224  Reference< XHyphenatedWord > xHyphWord;
225 
226  Boundary const aBound = g_pBreakIt->GetBreakIter()->getWordBoundary(
227  rInf.GetText(), sal_Int32(nWrdStart),
228  g_pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ), WordType::DICTIONARY_WORD, true );
229  nWrdStart = TextFrameIndex(aBound.startPos);
230  nLen = TextFrameIndex(aBound.endPos) - nWrdStart;
231  if (nLen == TextFrameIndex(0))
232  return false;
233 
234  OUString const aSelText(rInf.GetText().copy(sal_Int32(nWrdStart), sal_Int32(nLen)));
235  const sal_Int32 nMinTrail = (nWrdStart + nLen > nEnd)
236  ? sal_Int32(nWrdStart + nLen - nEnd) - 1
237  : 0;
238 
240  xHyphWord = rInf.HyphWord( aSelText, nMinTrail );
241  if ( xHyphWord.is() )
242  {
243  rHyphInf.SetHyphWord( xHyphWord );
244  rHyphInf.m_nWordStart = nWrdStart;
245  rHyphInf.m_nWordLen = nLen;
246  return true;
247  }
248 
249  return false;
250 }
251 
253 {
254  const Reference< XHyphenatedWord >& xHyphWord = rGuess.HyphWord();
255 
256  OSL_ENSURE( !mpNextPortion, "SwTextPortion::CreateHyphen(): another portion, another planet..." );
257  OSL_ENSURE( xHyphWord.is(), "SwTextPortion::CreateHyphen(): You are lucky! The code is robust here." );
258 
259  if( rInf.IsHyphForbud() ||
260  mpNextPortion || // robust
261  !xHyphWord.is() || // more robust
262  // multi-line fields can't be hyphenated interactively
263  ( rInf.IsInterHyph() && InFieldGrp() ) )
264  return false;
265 
266  std::unique_ptr<SwHyphPortion> pHyphPor;
267  TextFrameIndex nPorEnd;
268  SwTextSizeInfo aInf( rInf );
269 
270  // first case: hyphenated word has alternative spelling
271  if ( xHyphWord->isAlternativeSpelling() )
272  {
273  SvxAlternativeSpelling aAltSpell = SvxGetAltSpelling( xHyphWord );
274  OSL_ENSURE( aAltSpell.bIsAltSpelling, "no alternative spelling" );
275 
276  OUString aAltText = aAltSpell.aReplacement;
277  nPorEnd = TextFrameIndex(aAltSpell.nChangedPos) + rGuess.BreakStart() - rGuess.FieldDiff();
278  sal_Int32 nTmpLen = 0;
279 
280  // soft hyphen at alternative spelling position?
281  if( rInf.GetText()[sal_Int32(rInf.GetSoftHyphPos())] == CHAR_SOFTHYPHEN )
282  {
283  pHyphPor.reset(new SwSoftHyphStrPortion( aAltText ));
284  nTmpLen = 1;
285  }
286  else {
287  pHyphPor.reset(new SwHyphStrPortion( aAltText ));
288  }
289 
290  // length of pHyphPor is adjusted
291  pHyphPor->SetLen( TextFrameIndex(aAltText.getLength() + 1) );
292  static_cast<SwPosSize&>(*pHyphPor) = pHyphPor->GetTextSize( rInf );
293  pHyphPor->SetLen( TextFrameIndex(aAltSpell.nChangedLength + nTmpLen) );
294  }
295  else
296  {
297  // second case: no alternative spelling
298  pHyphPor.reset(new SwHyphPortion);
299  pHyphPor->SetLen(TextFrameIndex(1));
300 
301  static const void* nLastFontCacheId = nullptr;
302  static sal_uInt16 aMiniCacheH = 0, aMiniCacheW = 0;
303  const void* nTmpFontCacheId;
304  sal_uInt16 nFntIdx;
305  rInf.GetFont()->GetFontCacheId( nTmpFontCacheId, nFntIdx, rInf.GetFont()->GetActual() );
306  if( !nLastFontCacheId || nLastFontCacheId != nTmpFontCacheId ) {
307  nLastFontCacheId = nTmpFontCacheId;
308  static_cast<SwPosSize&>(*pHyphPor) = pHyphPor->GetTextSize( rInf );
309  aMiniCacheH = pHyphPor->Height();
310  aMiniCacheW = pHyphPor->Width();
311  } else {
312  pHyphPor->Height( aMiniCacheH );
313  pHyphPor->Width( aMiniCacheW );
314  }
315  pHyphPor->SetLen(TextFrameIndex(0));
316 
317  // values required for this
318  nPorEnd = TextFrameIndex(xHyphWord->getHyphenPos() + 1)
319  + rGuess.BreakStart() - rGuess.FieldDiff();
320  }
321 
322  // portion end must be in front of us
323  // we do not put hyphens at start of line
324  if ( nPorEnd > rInf.GetIdx() ||
325  ( nPorEnd == rInf.GetIdx() && rInf.GetLineStart() != rInf.GetIdx() ) )
326  {
327  aInf.SetLen( nPorEnd - rInf.GetIdx() );
328  pHyphPor->SetAscent( GetAscent() );
329  SetLen( aInf.GetLen() );
330  CalcTextSize( aInf );
331 
332  Insert( pHyphPor.release() );
333 
334  short nKern = rInf.GetFont()->CheckKerning();
335  if( nKern )
336  new SwKernPortion( *this, nKern );
337 
338  return true;
339  }
340 
341  // last exit for the lost
342  pHyphPor.reset();
343  BreakCut( rInf, rGuess );
344  return false;
345 }
346 
347 bool SwHyphPortion::GetExpText( const SwTextSizeInfo &/*rInf*/, OUString &rText ) const
348 {
349  rText = "-";
350  return true;
351 }
352 
354 {
355  rPH.Special( GetLen(), OUString('-'), GetWhichPor() );
356 }
357 
358 void SwHyphPortion::dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText,
359  TextFrameIndex& nOffset) const
360 {
361  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwHyphPortion"));
362  dumpAsXmlAttributes(pWriter, rText, nOffset);
363  nOffset += GetLen();
364 
365  (void)xmlTextWriterEndElement(pWriter);
366 }
367 
369 {
370  const SwLinePortion *pLast = rInf.GetLast();
371  Height( pLast->Height() );
372  SetAscent( pLast->GetAscent() );
373  OUString aText;
374 
375  if( !GetExpText( rInf, aText ) )
376  return false;
377 
378  PrtWidth( rInf.GetTextSize( aText ).Width() );
379  const bool bFull = rInf.Width() <= rInf.X() + PrtWidth();
380  if( bFull && !rInf.IsUnderflow() ) {
381  Truncate();
382  rInf.SetUnderflow( this );
383  }
384 
385  return bFull;
386 }
387 
388 bool SwHyphStrPortion::GetExpText( const SwTextSizeInfo &, OUString &rText ) const
389 {
390  rText = m_aExpand;
391  return true;
392 }
393 
395 {
396  rPH.Special( GetLen(), m_aExpand, GetWhichPor() );
397 }
398 
400 
402  m_bExpand(false), m_nViewWidth(0)
403 {
406 }
407 
408 sal_uInt16 SwSoftHyphPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
409 {
410  // Although we're in the const, nViewWidth should be calculated at
411  // the last possible moment
412  if( !Width() && rInf.OnWin() && rInf.GetOpt().IsSoftHyph() && !IsExpand() )
413  {
414  if( !m_nViewWidth )
415  const_cast<SwSoftHyphPortion*>(this)->m_nViewWidth
416  = rInf.GetTextSize(OUString('-')).Width();
417  }
418  else
419  const_cast<SwSoftHyphPortion*>(this)->m_nViewWidth = 0;
420  return m_nViewWidth;
421 }
422 
433 void SwSoftHyphPortion::Paint( const SwTextPaintInfo &rInf ) const
434 {
435  if( Width() )
436  {
437  rInf.DrawViewOpt( *this, PortionType::SoftHyphen );
438  SwExpandPortion::Paint( rInf );
439  }
440 }
441 
460 {
461  bool bFull = true;
462 
463  // special case for old German spelling
464  if( rInf.IsUnderflow() )
465  {
466  if( rInf.GetSoftHyphPos() )
467  return true;
468 
469  const bool bHyph = rInf.ChgHyph( true );
470  if( rInf.IsHyphenate() )
471  {
472  rInf.SetSoftHyphPos( rInf.GetIdx() );
473  Width(0);
474  // if the soft hyphened word has an alternative spelling
475  // when hyphenated (old German spelling), the soft hyphen
476  // portion has to trigger an underflow
477  SwTextGuess aGuess;
478  bFull = rInf.IsInterHyph() ||
479  !aGuess.AlternativeSpelling(rInf, rInf.GetIdx() - TextFrameIndex(1));
480  }
481  rInf.ChgHyph( bHyph );
482 
483  if( bFull && !rInf.IsHyphForbud() )
484  {
486  FormatEOL( rInf );
487  if ( rInf.GetFly() )
488  rInf.GetRoot()->SetMidHyph( true );
489  else
490  rInf.GetRoot()->SetEndHyph( true );
491  }
492  else
493  {
494  rInf.SetSoftHyphPos( rInf.GetIdx() );
495  Truncate();
496  rInf.SetUnderflow( this );
497  }
498  return true;
499  }
500 
502  SetExpand( true );
503  bFull = SwHyphPortion::Format( rInf );
504  SetExpand( false );
505  if( !bFull )
506  {
507  // By default, we do not have a width, but we do have a height
508  Width(0);
509  }
510  return bFull;
511 }
512 
517 {
518  if( IsExpand() )
519  return;
520 
521  SetExpand( true );
522  if( rInf.GetLast() == this )
523  rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
524 
525  // We need to reset the old values
526  const SwTwips nOldX = rInf.X();
527  TextFrameIndex const nOldIdx = rInf.GetIdx();
528  rInf.X( rInf.X() - PrtWidth() );
529  rInf.SetIdx( rInf.GetIdx() - GetLen() );
530  const bool bFull = SwHyphPortion::Format( rInf );
531 
532  // Shady business: We're allowed to get wider, but a Fly is also
533  // being processed, which needs a correct X position
534  if( bFull || !rInf.GetFly() )
535  rInf.X( nOldX );
536  else
537  rInf.X( nOldX + Width() );
538  rInf.SetIdx( nOldIdx );
539 }
540 
547 bool SwSoftHyphPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const
548 {
549  if( IsExpand() || ( rInf.OnWin() && rInf.GetOpt().IsSoftHyph() ) ||
550  ( GetNextPortion() && ( GetNextPortion()->InFixGrp() ||
553  {
554  return SwHyphPortion::GetExpText( rInf, rText );
555  }
556  return false;
557 }
558 
560 {
561  const PortionType nWhich = ! Width() ?
563  GetWhichPor();
564  rPH.Special( GetLen(), OUString('-'), nWhich );
565 }
566 
568 {
569  // Bug or feature?:
570  // {Zu}{k-}{ker}, {k-} will be gray instead of {-}
571  rInf.DrawViewOpt( *this, PortionType::SoftHyphen );
572  SwHyphStrPortion::Paint( rInf );
573 }
574 
576  : SwHyphStrPortion( rStr )
577 {
580 }
581 
582 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
SwTwips PrtWidth() const
Definition: porlin.hxx:83
bool IsParaLine() const
Definition: itrtxt.hxx:125
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txthyph.cxx:353
TextFrameIndex FieldDiff() const
Definition: guess.hxx:57
virtual void FormatEOL(SwTextFormatInfo &rInf) override
Format End of Line.
Definition: txthyph.cxx:516
short CheckKerning()
Definition: swfont.hxx:324
SwSoftHyphStrPortion(std::u16string_view rStr)
Definition: txthyph.cxx:575
SvxAlternativeSpelling SvxGetAltSpelling(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rHyphWord)
bool IsUnderflow() const
Definition: inftxt.hxx:583
bool IsExpand() const
Definition: porhyph.hxx:73
const css::beans::PropertyValues & GetHyphValues() const
Definition: inftxt.cxx:1396
SwFont * GetFont()
Definition: inftxt.hxx:231
bool IsSwapped() const
Definition: txtfrm.hxx:536
TextFrameIndex GetStart() const
Definition: itrtxt.hxx:88
void SetParaPortion(SwTextInfo *pInf, SwParaPortion *pRoot)
We format a row for interactive hyphenation We can assume that we've already formatted.
Definition: txthyph.cxx:120
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: porexp.cxx:74
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: txthyph.cxx:567
void BreakCut(SwTextFormatInfo &rInf, const SwTextGuess &rGuess)
Definition: portxt.cxx:219
void CalcTextSize(const SwTextSizeInfo &rInfo)
Definition: porlin.cxx:139
void dumpAsXmlAttributes(xmlTextWriterPtr writer, std::u16string_view rText, TextFrameIndex nOffset) const
Definition: porlin.cxx:330
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
bool Hyphenate(SwInterHyphInfoTextFrame &rInf)
Definition: txthyph.cxx:126
void SetLast(SwLinePortion *pNewLast)
Definition: inftxt.hxx:562
SwFont * m_pFnt
Definition: inftxt.hxx:150
virtual bool Format(SwTextFormatInfo &rInf) override
We get the final width from the FormatEOL()
Definition: txthyph.cxx:459
virtual sal_uInt16 GetViewWidth(const SwTextSizeInfo &rInf) const override
Definition: txthyph.cxx:408
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:77
void CharToLine(TextFrameIndex)
Definition: itrtxt.cxx:193
const SwLineLayout * Next()
Definition: itrtxt.cxx:107
bool IsSymbol(SwViewShell const *pSh)
Definition: swfont.hxx:270
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1788
bool InFieldGrp() const
Definition: porlin.hxx:108
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
Definition: inftxt.cxx:382
sal_uInt16 m_nViewWidth
Definition: porhyph.hxx:63
bool AlternativeSpelling(const SwTextFormatInfo &rInf, const TextFrameIndex nPos)
Definition: guess.cxx:564
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
Definition: porlay.hxx:250
bool ChgHyph(const bool bNew)
Definition: inftxt.cxx:1963
bool IsParaPortion() const
Definition: porlin.hxx:129
bool Hyphenate(SwInterHyphInfoTextFrame &rInf)
We format a Line for interactive hyphenation.
Definition: txthyph.cxx:58
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:163
void InitCntHyph()
Definition: itrform2.hxx:218
SwTextFormatInfo & GetInfo()
Definition: itrform2.hxx:213
bool IsLayPortion() const
Definition: porlin.hxx:128
bool IsInterHyph() const
Definition: inftxt.hxx:582
virtual SwLinePortion * Compress() override
Definition: txthyph.cxx:399
bool InHyphGrp() const
Definition: porlin.hxx:105
bool IsBreakPortion() const
Definition: porlin.hxx:118
TextFrameIndex m_nWordStart
output: found word
Definition: txtfrm.hxx:65
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
TextFrameIndex BreakStart() const
Definition: guess.hxx:55
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
Definition: inftxt.cxx:1304
TextFrameIndex GetLineStart() const
Definition: inftxt.hxx:590
TextFrameIndex m_nEnd
Definition: txtfrm.hxx:63
SwFontScript GetActual() const
Definition: swfont.hxx:184
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:856
virtual void Special(TextFrameIndex nLength, const OUString &rText, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0, const SwFont *pFont=nullptr)=0
special portion.
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: txthyph.cxx:347
bool IsSoftHyphPortion() const
Definition: porlin.hxx:133
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txthyph.cxx:368
bool IsEmpty() const
Definition: txtfrm.hxx:522
void SetEndHyph(const bool bNew)
Definition: porlay.hxx:122
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:238
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:78
void PrtWidth(SwTwips nNewWidth)
Definition: porlin.hxx:82
SwTextFly & GetTextFly()
Definition: inftxt.hxx:384
Mutex aLock
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:98
void SetUnderflow(SwLinePortion *pNew)
Definition: inftxt.hxx:601
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:827
bool IsHyphForbud() const
Definition: inftxt.hxx:565
void SetExpand(const bool bNew)
Definition: porhyph.hxx:72
void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &nOffset) const override
Definition: txthyph.cxx:358
sal_uInt16 Width() const
Definition: inftxt.hxx:528
SwLineLayout * GetRoot()
Definition: inftxt.hxx:557
PortionType
Definition: txttypes.hxx:23
SwTextFrame * GetFormatted(bool bForceQuickFormat=false)
In case the SwLineLayout was cleared out of the s_pTextCache, recreate it.
Definition: txtfrm.cxx:3376
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:272
bool IsDropPortion() const
Definition: porlin.hxx:127
SwTwips Height() const
Definition: possiz.hxx:49
bool IsLocked() const
Definition: txtfrm.hxx:518
TextFrameIndex GetLen() const
Definition: porlin.hxx:76
tools::Long SwTwips
Definition: swtypes.hxx:51
const OUString & GetText() const
Definition: inftxt.hxx:239
OUString m_aExpand
Definition: porhyph.hxx:46
SwTwips & GetAscent()
Definition: porlin.hxx:79
void Truncate()
Definition: porlin.hxx:209
SwLinePortion * mpNextPortion
Definition: porlin.hxx:55
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
SwTwips X() const
Definition: inftxt.hxx:379
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:51
const SwLineLayout * Prev()
Definition: itrtxt.cxx:89
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
void SetSoftHyphPos(TextFrameIndex const nNew)
Definition: inftxt.hxx:604
bool CreateHyphen(SwTextFormatInfo &rInf, SwTextGuess const &rGuess)
Definition: txthyph.cxx:252
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
We're expanding:
Definition: txthyph.cxx:547
LanguageType GetLanguage() const
Definition: swfont.hxx:283
TextFrameIndex m_nStart
Definition: itrtxt.hxx:41
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: txthyph.cxx:388
TextFrameIndex FormatLine(TextFrameIndex nStart)
Definition: itrform2.cxx:1659
bool IsHyphenate() const
If the Hyphenator returns ERROR or the language is set to NOLANGUAGE we do not hyphenate.
Definition: inftxt.cxx:1470
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:275
SwTwips Width() const
Definition: possiz.hxx:51
css::uno::Reference< css::linguistic2::XHyphenatedWord > HyphWord(const OUString &rText, const sal_Int32 nMinTrail)
Definition: txthyph.cxx:39
PortionType GetWhichPor() const
Definition: porlin.hxx:99
void SwapWidthAndHeight()
Swaps width and height of the text frame.
Definition: txtfrm.cxx:423
bool OnWin() const
Definition: inftxt.hxx:192
TextFrameIndex m_nStart
input: requested range to hyphenate
Definition: txtfrm.hxx:62
TextFrameIndex GetLen() const
Definition: inftxt.hxx:274
SwLinePortion * FindPrevPortion(const SwLinePortion *pRoot)
Definition: porlin.cxx:210
virtual void Paint(const SwTextPaintInfo &rInf) const override
Cases:
Definition: txthyph.cxx:433
SwParaPortion * m_pPara
Definition: inftxt.hxx:108
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txthyph.cxx:394
SwLinePortion * GetLast()
Definition: inftxt.hxx:561
a clone of SwInterHyphInfo, but with TextFrameIndex instead of node index
Definition: txtfrm.hxx:55
bool IsSoftHyph() const
Definition: viewopt.hxx:264
const SwLineLayout * GetNext() const
Definition: itrtxt.hxx:84
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
bool IsVertical() const
Definition: frame.hxx:973
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
Definition: swtypes.cxx:57
struct _xmlTextWriter * xmlTextWriterPtr
bool IsOn() const
Definition: txtfly.hxx:319
SwLineLayout * m_pCurr
Definition: itrtxt.hxx:36
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txthyph.cxx:559
SwFlyPortion * GetFly()
Definition: inftxt.hxx:609
void SetMidHyph(const bool bNew)
Definition: porlay.hxx:124
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:74
bool InFixGrp() const
Definition: porlin.hxx:107
void SetIdx(const TextFrameIndex nNew)
Definition: inftxt.hxx:273
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
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...
SwViewShell * m_pVsh
Definition: inftxt.hxx:139
TextFrameIndex m_nWordLen
Definition: txtfrm.hxx:66
virtual SwLinePortion * Insert(SwLinePortion *pPortion)
Definition: porlin.cxx:169
TextFrameIndex GetSoftHyphPos() const
Definition: inftxt.hxx:603
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &xHW)
Definition: txtfrm.hxx:73
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & HyphWord() const
Definition: guess.hxx:58
bool m_bDetectedRangeSegmentation false
void SetAscent(const SwTwips nNewAsc)
Definition: porlin.hxx:81
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
void GetFontCacheId(const void *&rnFontCacheId, sal_uInt16 &rIdx, SwFontScript nWhich)
Definition: swfont.hxx:198