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