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 
359 {
360  const SwLinePortion *pLast = rInf.GetLast();
361  Height( pLast->Height() );
362  SetAscent( pLast->GetAscent() );
363  OUString aText;
364 
365  if( !GetExpText( rInf, aText ) )
366  return false;
367 
368  PrtWidth( rInf.GetTextSize( aText ).Width() );
369  const bool bFull = rInf.Width() <= rInf.X() + PrtWidth();
370  if( bFull && !rInf.IsUnderflow() ) {
371  Truncate();
372  rInf.SetUnderflow( this );
373  }
374 
375  return bFull;
376 }
377 
378 bool SwHyphStrPortion::GetExpText( const SwTextSizeInfo &, OUString &rText ) const
379 {
380  rText = aExpand;
381  return true;
382 }
383 
385 {
386  rPH.Special( GetLen(), aExpand, GetWhichPor() );
387 }
388 
390 
392  bExpand(false), nViewWidth(0)
393 {
396 }
397 
398 sal_uInt16 SwSoftHyphPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
399 {
400  // Although we're in the const, nViewWidth should be calculated at
401  // the last possible moment
402  if( !Width() && rInf.OnWin() && rInf.GetOpt().IsSoftHyph() && !IsExpand() )
403  {
404  if( !nViewWidth )
405  const_cast<SwSoftHyphPortion*>(this)->nViewWidth
406  = rInf.GetTextSize(OUString('-')).Width();
407  }
408  else
409  const_cast<SwSoftHyphPortion*>(this)->nViewWidth = 0;
410  return nViewWidth;
411 }
412 
423 void SwSoftHyphPortion::Paint( const SwTextPaintInfo &rInf ) const
424 {
425  if( Width() )
426  {
427  rInf.DrawViewOpt( *this, PortionType::SoftHyphen );
428  SwExpandPortion::Paint( rInf );
429  }
430 }
431 
450 {
451  bool bFull = true;
452 
453  // special case for old German spelling
454  if( rInf.IsUnderflow() )
455  {
456  if( rInf.GetSoftHyphPos() )
457  return true;
458 
459  const bool bHyph = rInf.ChgHyph( true );
460  if( rInf.IsHyphenate() )
461  {
462  rInf.SetSoftHyphPos( rInf.GetIdx() );
463  Width(0);
464  // if the soft hyphened word has an alternative spelling
465  // when hyphenated (old German spelling), the soft hyphen
466  // portion has to trigger an underflow
467  SwTextGuess aGuess;
468  bFull = rInf.IsInterHyph() ||
469  !aGuess.AlternativeSpelling(rInf, rInf.GetIdx() - TextFrameIndex(1));
470  }
471  rInf.ChgHyph( bHyph );
472 
473  if( bFull && !rInf.IsHyphForbud() )
474  {
476  FormatEOL( rInf );
477  if ( rInf.GetFly() )
478  rInf.GetRoot()->SetMidHyph( true );
479  else
480  rInf.GetRoot()->SetEndHyph( true );
481  }
482  else
483  {
484  rInf.SetSoftHyphPos( rInf.GetIdx() );
485  Truncate();
486  rInf.SetUnderflow( this );
487  }
488  return true;
489  }
490 
492  SetExpand( true );
493  bFull = SwHyphPortion::Format( rInf );
494  SetExpand( false );
495  if( !bFull )
496  {
497  // By default, we do not have a width, but we do have a height
498  Width(0);
499  }
500  return bFull;
501 }
502 
507 {
508  if( !IsExpand() )
509  {
510  SetExpand( true );
511  if( rInf.GetLast() == this )
512  rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
513 
514  // We need to reset the old values
515  const SwTwips nOldX = rInf.X();
516  TextFrameIndex const nOldIdx = rInf.GetIdx();
517  rInf.X( rInf.X() - PrtWidth() );
518  rInf.SetIdx( rInf.GetIdx() - GetLen() );
519  const bool bFull = SwHyphPortion::Format( rInf );
520 
521  // Shady business: We're allowed to get wider, but a Fly is also
522  // being processed, which needs a correct X position
523  if( bFull || !rInf.GetFly() )
524  rInf.X( nOldX );
525  else
526  rInf.X( nOldX + Width() );
527  rInf.SetIdx( nOldIdx );
528  }
529 }
530 
537 bool SwSoftHyphPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const
538 {
539  if( IsExpand() || ( rInf.OnWin() && rInf.GetOpt().IsSoftHyph() ) ||
540  ( GetNextPortion() && ( GetNextPortion()->InFixGrp() ||
543  {
544  return SwHyphPortion::GetExpText( rInf, rText );
545  }
546  return false;
547 }
548 
550 {
551  const PortionType nWhich = ! Width() ?
553  GetWhichPor();
554  rPH.Special( GetLen(), OUString('-'), nWhich );
555 }
556 
558 {
559  // Bug or feature?:
560  // {Zu}{k-}{ker}, {k-} will be gray instead of {-}
561  rInf.DrawViewOpt( *this, PortionType::SoftHyphen );
562  SwHyphStrPortion::Paint( rInf );
563 }
564 
566  : SwHyphStrPortion( rStr )
567 {
570 }
571 
572 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:341
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
Definition: swtypes.cxx:50
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:506
short CheckKerning()
Definition: swfont.hxx:323
SvxAlternativeSpelling SvxGetAltSpelling(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rHyphWord)
bool IsUnderflow() const
Definition: inftxt.hxx:589
bool IsExpand() const
Definition: porhyph.hxx:67
const css::beans::PropertyValues & GetHyphValues() const
Definition: inftxt.cxx:1443
sal_uInt16 Height() const
Definition: possiz.hxx:44
SwFont * GetFont()
Definition: inftxt.hxx:238
bool IsSwapped() const
Definition: txtfrm.hxx:528
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:64
virtual void Paint(const SwTextPaintInfo &rInf) const override
Definition: txthyph.cxx:557
void BreakCut(SwTextFormatInfo &rInf, const SwTextGuess &rGuess)
Definition: portxt.cxx:218
void CalcTextSize(const SwTextSizeInfo &rInfo)
Definition: porlin.cxx:141
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:568
SwFont * m_pFnt
Definition: inftxt.hxx:157
virtual bool Format(SwTextFormatInfo &rInf) override
We get the final width from the FormatEOL()
Definition: txthyph.cxx:449
virtual sal_uInt16 GetViewWidth(const SwTextSizeInfo &rInf) const override
Definition: txthyph.cxx:398
void SetLen(TextFrameIndex const nLen)
Definition: porlin.hxx:75
long SwTwips
Definition: swtypes.hxx:49
void CharToLine(TextFrameIndex)
Definition: itrtxt.cxx:191
const SwLineLayout * Next()
Definition: itrtxt.cxx:106
bool IsSymbol(SwViewShell const *pSh)
Definition: swfont.hxx:269
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1785
bool InFieldGrp() const
Definition: porlin.hxx:104
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
Definition: inftxt.cxx:384
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:229
bool ChgHyph(const bool bNew)
Definition: inftxt.cxx:2000
bool IsParaPortion() const
Definition: porlin.hxx:123
bool Hyphenate(SwInterHyphInfoTextFrame &rInf)
We format a Line for interactive hyphenation.
Definition: txthyph.cxx:58
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:174
void InitCntHyph()
Definition: itrform2.hxx:218
SwTextFormatInfo & GetInfo()
Definition: itrform2.hxx:213
bool IsLayPortion() const
Definition: porlin.hxx:122
bool IsInterHyph() const
Definition: inftxt.hxx:588
virtual SwLinePortion * Compress() override
Definition: txthyph.cxx:389
bool InHyphGrp() const
Definition: porlin.hxx:101
bool IsBreakPortion() const
Definition: porlin.hxx:114
TextFrameIndex m_nWordStart
output: found word
Definition: txtfrm.hxx:63
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
TextFrameIndex BreakStart() const
Definition: guess.hxx:55
TextFrameIndex GetLineStart() const
Definition: inftxt.hxx:596
TextFrameIndex m_nEnd
Definition: txtfrm.hxx:61
SwFontScript GetActual() const
Definition: swfont.hxx:183
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:848
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:127
virtual bool Format(SwTextFormatInfo &rInf) override
Definition: txthyph.cxx:358
bool IsEmpty() const
Definition: txtfrm.hxx:511
void SetEndHyph(const bool bNew)
Definition: porlay.hxx:112
const SwViewOption & GetOpt() const
Definition: inftxt.hxx:245
Collection of SwLinePortion instances, representing one line of text.
Definition: porlay.hxx:78
SwTextFly & GetTextFly()
Definition: inftxt.hxx:390
Mutex aLock
void SetWhichPor(const PortionType nNew)
Definition: porlin.hxx:94
void SetUnderflow(SwLinePortion *pNew)
Definition: inftxt.hxx:607
SwLinePortion * GetFirstPortion() const
Definition: porlay.cxx:668
bool IsHyphForbud() const
Definition: inftxt.hxx:571
void SetExpand(const bool bNew)
Definition: porhyph.hxx:66
sal_uInt16 Width() const
Definition: inftxt.hxx:534
SwLineLayout * GetRoot()
Definition: inftxt.hxx:563
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:3351
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:278
bool IsDropPortion() const
Definition: porlin.hxx:121
bool IsLocked() const
Definition: txtfrm.hxx:507
TextFrameIndex GetLen() const
Definition: porlin.hxx:74
const OUString & GetText() const
Definition: inftxt.hxx:246
void Truncate()
Definition: porlin.hxx:196
SwLinePortion * mpNextPortion
Definition: porlin.hxx:54
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
SwTwips X() const
Definition: inftxt.hxx:385
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
const SwLineLayout * Prev()
Definition: itrtxt.cxx:88
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
void SetSoftHyphPos(TextFrameIndex const nNew)
Definition: inftxt.hxx:610
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:537
LanguageType GetLanguage() const
Definition: swfont.hxx:282
TextFrameIndex m_nStart
Definition: itrtxt.hxx:41
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: txthyph.cxx:378
TextFrameIndex FormatLine(TextFrameIndex nStart)
Definition: itrform2.cxx:1530
bool IsHyphenate() const
If the Hyphenator returns ERROR or the language is set to NOLANGUAGE we do not hyphenate.
Definition: inftxt.cxx:1517
void SetLen(const TextFrameIndex nNew)
Definition: inftxt.hxx:281
css::uno::Reference< css::linguistic2::XHyphenatedWord > HyphWord(const OUString &rText, const sal_Int32 nMinTrail)
Definition: txthyph.cxx:39
PortionType GetWhichPor() const
Definition: porlin.hxx:95
sal_uInt16 nViewWidth
Definition: porhyph.hxx:57
void SwapWidthAndHeight()
Swaps width and height of the text frame.
Definition: txtfrm.cxx:418
bool OnWin() const
Definition: inftxt.hxx:199
TextFrameIndex m_nStart
input: requested range to hyphenate
Definition: txtfrm.hxx:60
TextFrameIndex GetLen() const
Definition: inftxt.hxx:280
SwLinePortion * FindPrevPortion(const SwLinePortion *pRoot)
Definition: porlin.cxx:212
sal_uInt16 Width() const
Definition: possiz.hxx:46
virtual void Paint(const SwTextPaintInfo &rInf) const override
Cases:
Definition: txthyph.cxx:423
SwParaPortion * m_pPara
Definition: inftxt.hxx:115
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txthyph.cxx:384
SwLinePortion * GetLast()
Definition: inftxt.hxx:567
a clone of SwInterHyphInfo, but with TextFrameIndex instead of node index
Definition: txtfrm.hxx:53
bool IsSoftHyph() const
Definition: viewopt.hxx:258
SwSoftHyphStrPortion(const OUString &rStr)
Definition: txthyph.cxx:565
const SwLineLayout * GetNext() const
Definition: itrtxt.hxx:84
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
void SetAscent(const sal_uInt16 nNewAsc)
Definition: porlin.hxx:79
bool IsVertical() const
Definition: frame.hxx:951
bool IsOn() const
Definition: txtfly.hxx:313
SwLineLayout * m_pCurr
Definition: itrtxt.hxx:36
void PrtWidth(sal_uInt16 nNewWidth)
Definition: porlin.hxx:80
virtual void HandlePortion(SwPortionHandler &rPH) const override
Definition: txthyph.cxx:549
sal_uInt16 PrtWidth() const
Definition: porlin.hxx:81
SwFlyPortion * GetFly()
Definition: inftxt.hxx:615
void SetMidHyph(const bool bNew)
Definition: porlay.hxx:114
SwLinePortion * GetNextPortion() const
Definition: porlin.hxx:72
bool InFixGrp() const
Definition: porlin.hxx:103
void SetIdx(const TextFrameIndex nNew)
Definition: inftxt.hxx:279
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
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:146
TextFrameIndex m_nWordLen
Definition: txtfrm.hxx:64
OUString aExpand
Definition: porhyph.hxx:40
sal_uInt16 & GetAscent()
Definition: porlin.hxx:77
virtual SwLinePortion * Insert(SwLinePortion *pPortion)
Definition: porlin.cxx:171
TextFrameIndex GetSoftHyphPos() const
Definition: inftxt.hxx:609
SwRootFrame * getRootFrame()
Definition: frame.hxx:659
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich) const
Definition: inftxt.cxx:1352
void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &xHW)
Definition: txtfrm.hxx:71
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & HyphWord() const
Definition: guess.hxx:58
void GetFontCacheId(const void *&rnFontCacheId, sal_uInt16 &rIdx, SwFontScript nWhich)
Definition: swfont.hxx:197