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