LibreOffice Module sw (master)  1
guess.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 <editeng/unolingu.hxx>
21 #include <breakit.hxx>
22 #include <dlelstnr.hxx>
23 #include <swmodule.hxx>
25 #include "guess.hxx"
26 #include "inftxt.hxx"
27 #include <pagefrm.hxx>
28 #include <pagedesc.hxx>
29 #include <tgrditem.hxx>
30 #include <com/sun/star/i18n/BreakType.hpp>
31 #include <com/sun/star/i18n/WordType.hpp>
32 #include <com/sun/star/i18n/XBreakIterator.hpp>
33 #include <unotools/charclass.hxx>
34 #include "porfld.hxx"
35 #include <paratr.hxx>
36 #include <doc.hxx>
37 
38 using namespace ::com::sun::star;
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::i18n;
41 using namespace ::com::sun::star::beans;
42 using namespace ::com::sun::star::linguistic2;
43 
44 namespace{
45 
46 const sal_Unicode CH_FULL_BLANK = 0x3000;
47 const sal_Unicode CH_NB_SPACE = 0xA0;
48 
49 bool IsBlank(sal_Unicode ch) { return ch == CH_BLANK || ch == CH_FULL_BLANK || ch == CH_NB_SPACE; }
50 
51 }
52 
53 // provides information for line break calculation
54 // returns true if no line break has to be performed
55 // otherwise possible break or hyphenation position is determined
57  const sal_uInt16 nPorHeight )
58 {
59  nCutPos = rInf.GetIdx();
60 
61  // Empty strings are always 0
62  if( !rInf.GetLen() || rInf.GetText().isEmpty() )
63  return false;
64 
65  OSL_ENSURE( rInf.GetIdx() < TextFrameIndex(rInf.GetText().getLength()),
66  "+SwTextGuess::Guess: invalid SwTextFormatInfo" );
67 
68  OSL_ENSURE( nPorHeight, "+SwTextGuess::Guess: no height" );
69 
70  sal_uInt16 nMaxSizeDiff;
71 
72  const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
73 
74  sal_uInt16 nMaxComp = ( SwFontScript::CJK == rInf.GetFont()->GetActual() ) &&
75  rSI.CountCompChg() &&
76  ! rInf.IsMulti() &&
77  ! rPor.InFieldGrp() &&
78  ! rPor.IsDropPortion() ?
79  10000 :
80  0 ;
81 
82  SwTwips nLineWidth = rInf.GetLineWidth();
83  TextFrameIndex nMaxLen = TextFrameIndex(rInf.GetText().getLength()) - rInf.GetIdx();
84 
86 
87  // tdf#104668 space chars at the end should be cut if the compatibility option is enabled
88  // for LTR mode only
89  if ( !rInf.GetTextFrame()->IsRightToLeft() )
90  {
93  {
94  if ( rAdjust == SvxAdjust::Right || rAdjust == SvxAdjust::Center )
95  {
96  TextFrameIndex nSpaceCnt(0);
97  for (sal_Int32 i = rInf.GetText().getLength() - 1;
98  sal_Int32(rInf.GetIdx()) <= i; --i)
99  {
100  sal_Unicode cChar = rInf.GetText()[i];
101  if ( cChar != CH_BLANK && cChar != CH_FULL_BLANK )
102  break;
103  ++nSpaceCnt;
104  }
105  TextFrameIndex nCharsCnt = nMaxLen - nSpaceCnt;
106  if ( nSpaceCnt && nCharsCnt < rPor.GetLen() )
107  {
108  nMaxLen = nCharsCnt;
109  if ( !nMaxLen )
110  return true;
111  }
112  }
113  }
114  }
115 
116  if ( rInf.GetLen() < nMaxLen )
117  nMaxLen = rInf.GetLen();
118 
119  if( !nMaxLen )
120  return false;
121 
122  sal_uInt16 nItalic = 0;
123  if( ITALIC_NONE != rInf.GetFont()->GetItalic() && !rInf.NotEOL() )
124  {
125  bool bAddItalic = true;
126 
127  // do not add extra italic value if we have an active character grid
128  if ( rInf.SnapToGrid() )
129  {
130  SwTextGridItem const*const pGrid(
132  bAddItalic = !pGrid || GRID_LINES_CHARS != pGrid->GetGridType();
133  }
134 
135  // do not add extra italic value for an isolated blank:
136  if (TextFrameIndex(1) == rInf.GetLen() &&
137  CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx())])
138  {
139  bAddItalic = false;
140  }
141 
142  nItalic = bAddItalic ? nPorHeight / 12 : 0;
143 
144  nLineWidth -= nItalic;
145 
146  // #i46524# LineBreak bug with italics
147  if ( nLineWidth < 0 ) nLineWidth = 0;
148  }
149 
150  const sal_Int32 nLeftRightBorderSpace =
151  (!rPor.GetJoinBorderWithNext() ? rInf.GetFont()->GetRightBorderSpace() : 0) +
152  (!rPor.GetJoinBorderWithPrev() ? rInf.GetFont()->GetLeftBorderSpace() : 0);
153 
154  nLineWidth -= nLeftRightBorderSpace;
155 
156  const bool bUnbreakableNumberings = rInf.GetTextFrame()->GetDoc()
158 
159  // first check if everything fits to line
160  if ( ( nLineWidth * 2 > SwTwips(sal_Int32(nMaxLen)) * nPorHeight ) ||
161  ( bUnbreakableNumberings && rPor.IsNumberPortion() ) )
162  {
163  // call GetTextSize with maximum compression (for kanas)
164  rInf.GetTextSize( &rSI, rInf.GetIdx(), nMaxLen,
165  nMaxComp, nBreakWidth, nMaxSizeDiff );
166 
167  if ( ( nBreakWidth <= nLineWidth ) || ( bUnbreakableNumberings && rPor.IsNumberPortion() ) )
168  {
169  // portion fits to line
170  nCutPos = rInf.GetIdx() + nMaxLen;
171  if( nItalic &&
172  (nCutPos >= TextFrameIndex(rInf.GetText().getLength()) ||
173  // #i48035# Needed for CalcFitToContent
174  // if first line ends with a manual line break
175  rInf.GetText()[sal_Int32(nCutPos)] == CH_BREAK))
176  nBreakWidth = nBreakWidth + nItalic;
177 
178  // save maximum width for later use
179  if ( nMaxSizeDiff )
180  rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff );
181 
182  nBreakWidth += nLeftRightBorderSpace;
183 
184  return true;
185  }
186  }
187 
188  bool bHyph = rInf.IsHyphenate() && !rInf.IsHyphForbud();
189  TextFrameIndex nHyphPos(0);
190 
191  // nCutPos is the first character not fitting to the current line
192  // nHyphPos is the first character not fitting to the current line,
193  // considering an additional "-" for hyphenation
194  if( bHyph )
195  {
196  nCutPos = rInf.GetTextBreak( nLineWidth, nMaxLen, nMaxComp, nHyphPos, rInf.GetCachedVclData().get() );
197 
198  if ( !nHyphPos && rInf.GetIdx() )
199  nHyphPos = rInf.GetIdx() - TextFrameIndex(1);
200  }
201  else
202  {
203  nCutPos = rInf.GetTextBreak( nLineWidth, nMaxLen, nMaxComp, rInf.GetCachedVclData().get() );
204 
205 #if OSL_DEBUG_LEVEL > 1
207  {
208  sal_uInt16 nMinSize;
209  rInf.GetTextSize( &rSI, rInf.GetIdx(), nCutPos - rInf.GetIdx(),
210  nMaxComp, nMinSize, nMaxSizeDiff );
211  OSL_ENSURE( nMinSize <= nLineWidth, "What a Guess!!!" );
212  }
213 #endif
214  }
215 
216  if( nCutPos > rInf.GetIdx() + nMaxLen )
217  {
218  // second check if everything fits to line
219  nCutPos = nBreakPos = rInf.GetIdx() + nMaxLen - TextFrameIndex(1);
220  rInf.GetTextSize( &rSI, rInf.GetIdx(), nMaxLen, nMaxComp,
221  nBreakWidth, nMaxSizeDiff );
222 
223  // The following comparison should always give true, otherwise
224  // there likely has been a pixel rounding error in GetTextBreak
225  if ( nBreakWidth <= nLineWidth )
226  {
227  if (nItalic && (nBreakPos + TextFrameIndex(1)) >= TextFrameIndex(rInf.GetText().getLength()))
228  nBreakWidth = nBreakWidth + nItalic;
229 
230  // save maximum width for later use
231  if ( nMaxSizeDiff )
232  rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff );
233 
234  nBreakWidth += nLeftRightBorderSpace;
235 
236  return true;
237  }
238  }
239 
240  // we have to trigger an underflow for a footnote portion
241  // which does not fit to the current line
242  if ( rPor.IsFootnotePortion() )
243  {
244  nBreakPos = rInf.GetIdx();
245  nCutPos = TextFrameIndex(-1);
246  return false;
247  }
248 
249  TextFrameIndex nPorLen(0);
250  // do not call the break iterator nCutPos is a blank
251  sal_Unicode cCutChar = nCutPos < TextFrameIndex(rInf.GetText().getLength())
252  ? rInf.GetText()[sal_Int32(nCutPos)]
253  : 0;
254  if (IsBlank(cCutChar))
255  {
256  nBreakPos = nCutPos;
258 
259  if ( rAdjust == SvxAdjust::Left )
260  {
261  // we step back until a non blank character has been found
262  // or there is only one more character left
263  while (nX && TextFrameIndex(rInf.GetText().getLength()) < nBreakPos &&
264  IsBlank(rInf.GetChar(--nX)))
265  --nBreakPos;
266  }
267  else // #i20878#
268  {
269  while (nX && nBreakPos > rInf.GetLineStart() + TextFrameIndex(1) &&
270  IsBlank(rInf.GetChar(--nX)))
271  --nBreakPos;
272  }
273 
274  if( nBreakPos > rInf.GetIdx() )
275  nPorLen = nBreakPos - rInf.GetIdx();
276  while (++nCutPos < TextFrameIndex(rInf.GetText().getLength()) &&
277  IsBlank(rInf.GetChar(nCutPos)))
278  ; // nothing
279 
281  }
282  else
283  {
284  // New: We should have a look into the last portion, if it was a
285  // field portion. For this, we expand the text of the field portion
286  // into our string. If the line break position is inside of before
287  // the field portion, we trigger an underflow.
288 
289  TextFrameIndex nOldIdx = rInf.GetIdx();
290  sal_Unicode cFieldChr = 0;
291 
292 #if OSL_DEBUG_LEVEL > 0
293  OUString aDebugString;
294 #endif
295 
296  // be careful: a field portion can be both: 0x01 (common field)
297  // or 0x02 (the follow of a footnode)
298  if ( rInf.GetLast() && rInf.GetLast()->InFieldGrp() &&
299  ! rInf.GetLast()->IsFootnotePortion() &&
300  rInf.GetIdx() > rInf.GetLineStart() &&
302  (cFieldChr = rInf.GetText()[sal_Int32(rInf.GetIdx()) - 1]))
303  {
304  SwFieldPortion* pField = static_cast<SwFieldPortion*>(rInf.GetLast());
305  OUString aText;
306  pField->GetExpText( rInf, aText );
307 
308  if ( !aText.isEmpty() )
309  {
310  nFieldDiff = TextFrameIndex(aText.getLength() - 1);
311  nCutPos = nCutPos + nFieldDiff;
312  nHyphPos = nHyphPos + nFieldDiff;
313 
314 #if OSL_DEBUG_LEVEL > 0
315  aDebugString = rInf.GetText();
316 #endif
317 
318  // this is pretty nutso... reverted at the end...
319  OUString& rOldText = const_cast<OUString&> (rInf.GetText());
320  rOldText = rOldText.replaceAt(sal_Int32(rInf.GetIdx()) - 1, 1, aText);
321  rInf.SetIdx( rInf.GetIdx() + nFieldDiff );
322  }
323  else
324  cFieldChr = 0;
325  }
326 
327  LineBreakHyphenationOptions aHyphOpt;
328  Reference< XHyphenator > xHyph;
329  if( bHyph )
330  {
331  xHyph = ::GetHyphenator();
332  aHyphOpt = LineBreakHyphenationOptions( xHyph,
333  rInf.GetHyphValues(), sal_Int32(nHyphPos));
334  }
335 
336  // Get Language for break iterator.
337  // We have to switch the current language if we have a script
338  // change at nCutPos. Otherwise LATIN punctuation would never
339  // be allowed to be hanging punctuation.
340  // NEVER call GetLang if the string has been modified!!!
341  LanguageType aLang = rInf.GetFont()->GetLanguage();
342 
343  // If we are inside a field portion, we use a temporary string which
344  // differs from the string at the textnode. Therefore we are not allowed
345  // to call the GetLang function.
346  if ( nCutPos && ! rPor.InFieldGrp() )
347  {
348  const CharClass& rCC = GetAppCharClass();
349 
350  // step back until a non-punctuation character is reached
351  TextFrameIndex nLangIndex = nCutPos;
352 
353  // If a field has been expanded right in front of us we do not
354  // step further than the beginning of the expanded field
355  // (which is the position of the field placeholder in our
356  // original string).
357  const TextFrameIndex nDoNotStepOver = CH_TXTATR_BREAKWORD == cFieldChr
358  ? rInf.GetIdx() - nFieldDiff - TextFrameIndex(1)
359  : TextFrameIndex(0);
360 
361  if ( nLangIndex > nDoNotStepOver &&
362  TextFrameIndex(rInf.GetText().getLength()) == nLangIndex)
363  --nLangIndex;
364 
365  while ( nLangIndex > nDoNotStepOver &&
366  !rCC.isLetterNumeric(rInf.GetText(), sal_Int32(nLangIndex)))
367  --nLangIndex;
368 
369  // last "real" character is not inside our current portion
370  // we have to check the script type of the last "real" character
371  if ( nLangIndex < rInf.GetIdx() )
372  {
373  sal_uInt16 nScript = g_pBreakIt->GetRealScriptOfText( rInf.GetText(),
374  sal_Int32(nLangIndex));
375  OSL_ENSURE( nScript, "Script is not between 1 and 4" );
376 
377  // compare current script with script from last "real" character
378  if ( SwFontScript(nScript - 1) != rInf.GetFont()->GetActual() )
379  {
380  aLang = rInf.GetTextFrame()->GetLangOfChar(
381  CH_TXTATR_BREAKWORD == cFieldChr
382  ? nDoNotStepOver
383  : nLangIndex,
384  nScript, true);
385  }
386  }
387  }
388 
389  const ForbiddenCharacters aForbidden(
391 
392  const bool bAllowHanging = rInf.IsHanging() && ! rInf.IsMulti() &&
393  ! rInf.GetTextFrame()->IsInTab() &&
394  ! rPor.InFieldGrp();
395 
396  LineBreakUserOptions aUserOpt(
397  aForbidden.beginLine, aForbidden.endLine,
398  rInf.HasForbiddenChars(), bAllowHanging, false );
399 
400  // !!! We must have a local copy of the locale, because inside
401  // getLineBreak the LinguEventListener can trigger a new formatting,
402  // which can corrupt the locale pointer inside pBreakIt.
403  const lang::Locale aLocale = g_pBreakIt->GetLocale( aLang );
404 
405  // determines first possible line break from nCutPos to
406  // start index of current line
407  LineBreakResults aResult = g_pBreakIt->GetBreakIter()->getLineBreak(
408  rInf.GetText(), sal_Int32(nCutPos), aLocale,
409  sal_Int32(rInf.GetLineStart()), aHyphOpt, aUserOpt );
410 
411  nBreakPos = TextFrameIndex(aResult.breakIndex);
412 
413  // if we are formatting multi portions we want to allow line breaks
414  // at the border between single line and multi line portion
415  // we have to be careful with footnote portions, they always come in
416  // with an index 0
417  if ( nBreakPos < rInf.GetLineStart() && rInf.IsFirstMulti() &&
418  ! rInf.IsFootnoteInside() )
419  nBreakPos = rInf.GetLineStart();
420 
422 
423  bHyph = BreakType::HYPHENATION == aResult.breakType;
424 
425  if (bHyph && nBreakPos != TextFrameIndex(COMPLETE_STRING))
426  {
427  // found hyphenation position within line
428  // nBreakPos is set to the hyphenation position
429  xHyphWord = aResult.rHyphenatedWord;
430  nBreakPos += TextFrameIndex(xHyphWord->getHyphenationPos() + 1);
431 
432  // if not in interactive mode, we have to break behind a soft hyphen
433  if ( ! rInf.IsInterHyph() && rInf.GetIdx() )
434  {
435  sal_Int32 const nSoftHyphPos =
436  xHyphWord->getWord().indexOf( CHAR_SOFTHYPHEN );
437 
438  if ( nSoftHyphPos >= 0 &&
439  nBreakStart + TextFrameIndex(nSoftHyphPos) <= nBreakPos &&
440  nBreakPos > rInf.GetLineStart() )
441  nBreakPos = rInf.GetIdx() - TextFrameIndex(1);
442  }
443 
444  if( nBreakPos >= rInf.GetIdx() )
445  {
446  nPorLen = nBreakPos - rInf.GetIdx();
447  if ('-' == rInf.GetText()[ sal_Int32(nBreakPos) - 1 ])
448  xHyphWord = nullptr;
449  }
450  }
451  else if ( !bHyph && nBreakPos >= rInf.GetLineStart() )
452  {
453  OSL_ENSURE(sal_Int32(nBreakPos) != COMPLETE_STRING, "we should have found a break pos");
454 
455  // found break position within line
456  xHyphWord = nullptr;
457 
458  // check, if break position is soft hyphen and an underflow
459  // has to be triggered
460  if( nBreakPos > rInf.GetLineStart() && rInf.GetIdx() &&
461  CHAR_SOFTHYPHEN == rInf.GetText()[ sal_Int32(nBreakPos) - 1 ])
462  {
463  nBreakPos = rInf.GetIdx() - TextFrameIndex(1);
464  }
465 
466  if( rAdjust != SvxAdjust::Left )
467  {
468  // Delete any blanks at the end of a line, but be careful:
469  // If a field has been expanded, we do not want to delete any
470  // blanks inside the field portion. This would cause an unwanted
471  // underflow
473  while( nX > rInf.GetLineStart() &&
474  ( CH_TXTATR_BREAKWORD != cFieldChr || nX > rInf.GetIdx() ) &&
475  ( CH_BLANK == rInf.GetChar( --nX ) ||
476  CH_FULL_BLANK == rInf.GetChar( nX ) ) )
477  nBreakPos = nX;
478  }
479  if( nBreakPos > rInf.GetIdx() )
480  nPorLen = nBreakPos - rInf.GetIdx();
481  }
482  else
483  {
484  // no line break found, setting nBreakPos to COMPLETE_STRING
485  // causes a break cut
487  OSL_ENSURE( nCutPos >= rInf.GetIdx(), "Deep cut" );
488  nPorLen = nCutPos - rInf.GetIdx();
489  }
490 
492  {
493  const TextFrameIndex nHangingLen = nBreakPos - nCutPos;
494  SwPosSize aTmpSize = rInf.GetTextSize( &rSI, nCutPos, nHangingLen );
495  aTmpSize.Width(aTmpSize.Width() + nLeftRightBorderSpace);
496  OSL_ENSURE( !pHanging, "A hanging portion is hanging around" );
497  pHanging.reset( new SwHangingPortion( aTmpSize ) );
498  pHanging->SetLen( nHangingLen );
499  nPorLen = nCutPos - rInf.GetIdx();
500  }
501 
502  // If we expanded a field, we must repair the original string.
503  // In case we do not trigger an underflow, we correct the nBreakPos
504  // value, but we cannot correct the nBreakStart value:
505  // If we have found a hyphenation position, nBreakStart can lie before
506  // the field.
507  if ( CH_TXTATR_BREAKWORD == cFieldChr )
508  {
509  if ( nBreakPos < rInf.GetIdx() )
510  nBreakPos = nOldIdx - TextFrameIndex(1);
512  {
513  OSL_ENSURE( nBreakPos >= nFieldDiff, "I've got field trouble!" );
515  }
516 
517  OSL_ENSURE( nCutPos >= rInf.GetIdx() && nCutPos >= nFieldDiff,
518  "I've got field trouble, part2!" );
519  nCutPos = nCutPos - nFieldDiff;
520 
521  OUString& rOldText = const_cast<OUString&> (rInf.GetText());
522  OUString aReplacement( cFieldChr );
523  rOldText = rOldText.replaceAt(sal_Int32(nOldIdx) - 1, sal_Int32(nFieldDiff) + 1, aReplacement);
524  rInf.SetIdx( nOldIdx );
525 
526 #if OSL_DEBUG_LEVEL > 0
527  OSL_ENSURE( aDebugString == rInf.GetText(),
528  "Somebody, somebody, somebody put something in my string" );
529 #endif
530  }
531  }
532 
533  if( nPorLen )
534  {
535  rInf.GetTextSize( &rSI, rInf.GetIdx(), nPorLen,
536  nMaxComp, nBreakWidth, nMaxSizeDiff,
537  rInf.GetCachedVclData().get() );
538 
539  // save maximum width for later use
540  if ( nMaxSizeDiff )
541  rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff );
542 
543  nBreakWidth += nItalic + nLeftRightBorderSpace;
544  }
545  else
546  nBreakWidth = 0;
547 
548  if( pHanging )
549  {
550  nBreakPos = nCutPos;
551  // Keep following SwBreakPortion in the same line.
552  if ( CH_BREAK == rInf.GetChar( nBreakPos + pHanging->GetLen() ) )
553  return true;
554  }
555 
556  return false;
557 }
558 
559 // returns true if word at position nPos has a different spelling
560 // if hyphenated at this position (old german spelling)
562  const TextFrameIndex nPos)
563 {
564  // get word boundaries
565  Boundary aBound = g_pBreakIt->GetBreakIter()->getWordBoundary(
566  rInf.GetText(), sal_Int32(nPos),
567  g_pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
568  WordType::DICTIONARY_WORD, true );
569  nBreakStart = TextFrameIndex(aBound.startPos);
570  sal_Int32 nWordLen = aBound.endPos - sal_Int32(nBreakStart);
571 
572  // if everything else fails, we want to cut at nPos
573  nCutPos = nPos;
574 
575  OUString const aText( rInf.GetText().copy(sal_Int32(nBreakStart), nWordLen) );
576 
577  // check, if word has alternative spelling
578  Reference< XHyphenator > xHyph( ::GetHyphenator() );
579  OSL_ENSURE( xHyph.is(), "Hyphenator is missing");
581  xHyphWord = xHyph->queryAlternativeSpelling( aText,
582  g_pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
583  sal::static_int_cast<sal_Int16>(sal_Int32(nPos - nBreakStart)),
584  rInf.GetHyphValues() );
585  return xHyphWord.is() && xHyphWord->isAlternativeSpelling();
586 }
587 
588 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
Definition: swtypes.cxx:71
const sal_Unicode CH_BREAK
Definition: swfont.hxx:43
bool IsFirstMulti() const
Definition: inftxt.hxx:212
sal_uInt16 GetLeftBorderSpace() const
Definition: swfont.hxx:905
SvxAdjust GetAdjust() const
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
Definition: txtfrm.cxx:1332
const css::beans::PropertyValues & GetHyphValues() const
Definition: inftxt.cxx:1366
SwFont * GetFont()
Definition: inftxt.hxx:238
bool GetJoinBorderWithPrev() const
Definition: porlin.hxx:167
sal_uInt16 GetRightBorderSpace() const
Definition: swfont.hxx:890
virtual const css::i18n::ForbiddenCharacters * getForbiddenCharacters(LanguageType nLang, bool bLocaleData) const =0
Return the forbidden characters.
bool Guess(const SwTextPortion &rPor, SwTextFormatInfo &rInf, const sal_uInt16 nHeight)
Definition: guess.cxx:56
long SwTwips
Definition: swtypes.hxx:49
bool InFieldGrp() const
Definition: porlin.hxx:103
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
Definition: inftxt.cxx:387
bool AlternativeSpelling(const SwTextFormatInfo &rInf, const TextFrameIndex nPos)
Definition: guess.cxx:561
bool IsMulti() const
Definition: inftxt.hxx:210
sal_uInt16 GetRealScriptOfText(const OUString &rText, sal_Int32 nPos) const
Definition: breakit.cxx:84
size_t CountCompChg() const
Definition: scriptinfo.hxx:157
#define CHAR_SOFTHYPHEN
Definition: swtypes.hxx:174
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:43
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
sal_uInt16 sal_Unicode
bool IsInterHyph() const
Definition: inftxt.hxx:587
bool IsFootnoteInside() const
Definition: inftxt.hxx:206
sal_Unicode GetChar(TextFrameIndex const nPos) const
Definition: inftxt.hxx:247
bool IsInTab() const
Definition: frame.hxx:931
css::uno::Reference< css::linguistic2::XHyphenatedWord > xHyphWord
Definition: guess.hxx:33
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
bool IsHanging() const
Definition: inftxt.hxx:216
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
Definition: porfld.cxx:442
TextFrameIndex GetLineStart() const
Definition: inftxt.hxx:595
SwFontScript GetActual() const
Definition: swfont.hxx:180
This portion represents a part of the paragraph string.
Definition: portxt.hxx:27
TextFrameIndex nBreakPos
Definition: guess.hxx:37
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1292
TextFrameIndex nCutPos
Definition: guess.hxx:35
SvxAdjust
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
Definition: inftxt.cxx:1702
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
SwParaPortion * GetParaPortion()
Definition: inftxt.hxx:128
bool HasForbiddenChars() const
Definition: inftxt.hxx:220
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2516
int i
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
bool IsHyphForbud() const
Definition: inftxt.hxx:570
bool IsNumberPortion() const
Definition: porlin.hxx:134
void SetMaxWidthDiff(const SwLinePortion *nKey, sal_uInt16 nVal)
Definition: inftxt.hxx:301
const SvxAdjustItem & GetAdjust(bool=true) const
Definition: paratr.hxx:180
bool NotEOL() const
Definition: inftxt.hxx:201
TextFrameIndex GetIdx() const
Definition: inftxt.hxx:278
bool IsDropPortion() const
Definition: porlin.hxx:120
ITALIC_NONE
TextFrameIndex GetTextBreak(const long nLineWidth, const TextFrameIndex nMaxLen, const sal_uInt16 nComp, vcl::TextLayoutCache const *) const
Definition: inftxt.cxx:438
bool SnapToGrid() const
Definition: inftxt.hxx:222
TextFrameIndex GetLen() const
Definition: porlin.hxx:73
SwTextFrame * GetTextFrame()
Definition: inftxt.hxx:291
const OUString & GetText() const
Definition: inftxt.hxx:246
const std::shared_ptr< vcl::TextLayoutCache > & GetCachedVclData() const
Definition: inftxt.hxx:335
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
LanguageType GetLanguage() const
Definition: swfont.hxx:279
bool IsHyphenate() const
If the Hyphenator returns ERROR or the language is set to NOLANGUAGE we do not hyphenate.
Definition: inftxt.cxx:1439
bool IsFootnotePortion() const
Definition: porlin.hxx:119
FontItalic GetItalic() const
Definition: swfont.hxx:278
TextFrameIndex nFieldDiff
Definition: guess.hxx:38
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:208
bool IsRightToLeft() const
Definition: frame.hxx:963
TextFrameIndex GetLen() const
Definition: inftxt.hxx:280
sal_uInt16 Width() const
Definition: possiz.hxx:46
SwScriptInfo & GetScriptInfo()
Definition: porlay.hxx:270
SwFontScript
Definition: swfont.hxx:119
SwLinePortion * GetLast()
Definition: inftxt.hxx:566
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter()
Definition: breakit.hxx:62
std::unique_ptr< SwHangingPortion > pHanging
Definition: guess.hxx:34
SwDoc & GetDoc()
Definition: txtfrm.hxx:448
SwTextGrid GetGridType() const
Definition: tgrditem.hxx:81
bool GetJoinBorderWithNext() const
Definition: porlin.hxx:168
sal_uInt16 nBreakWidth
Definition: guess.hxx:40
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...
CharClass & GetAppCharClass()
Definition: init.cxx:751
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
TextFrameIndex nBreakStart
Definition: guess.hxx:36