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