27#include <com/sun/star/i18n/BreakType.hpp>
28#include <com/sun/star/i18n/WordType.hpp>
29#include <com/sun/star/i18n/XBreakIterator.hpp>
53 const sal_uInt16 nPorHeight )
62 "+SwTextGuess::Guess: invalid SwTextFormatInfo" );
64 OSL_ENSURE( nPorHeight,
"+SwTextGuess::Guess: no height" );
66 sal_uInt16 nMaxSizeDiff;
90 if ( rAdjust == SvxAdjust::Right || rAdjust == SvxAdjust::Center )
93 for (sal_Int32
i = rInf.
GetText().getLength() - 1;
102 if ( nSpaceCnt && nCharsCnt < rPor.
GetLen() )
115 if ( rInf.
GetLen() < nMaxLen )
121 sal_uInt16 nItalic = 0;
124 bool bAddItalic =
true;
149 nItalic = bAddItalic ? nPorHeight / 12 : 0;
157 const sal_Int32 nLeftRightBorderSpace =
206 sal_Int32 nHyphZone = -1;
207 const css::beans::PropertyValues & rHyphValues = rInf.
GetHyphValues();
208 assert( rHyphValues.getLength() > 5 && rHyphValues[5].Name ==
UPN_HYPH_ZONE );
210 sal_uInt16 nTextHyphenZone;
211 if ( rHyphValues[5].
Value >>= nTextHyphenZone )
222 sal_Int32 nZonePos = sal_Int32(
m_nCutPos);
228 for (; sal_Int32(rInf.
GetIdx()) <= nZonePos && nHyphZone <= nZonePos; --nZonePos )
271 sal_Int32 nLastWord = rInf.
GetText().getLength() - 1;
272 bool bHyphenationNoLastWord =
false;
274 if ( rHyphValues[3].
Value >>= bHyphenationNoLastWord )
277 bool bCutBlank =
false;
278 for (; sal_Int32(rInf.
GetIdx()) <= nLastWord; --nLastWord )
283 else if ( bCutBlank )
289 if ( bHyphenationNoLastWord && sal_Int32(
m_nCutPos) > nLastWord &&
295 sal_Int32(rInf.
GetIdx()) < nLastWord )
301 if ( !nHyphPos && rInf.
GetIdx() )
308#if OSL_DEBUG_LEVEL > 1
313 nMaxComp, nMinSize, nMaxSizeDiff );
314 OSL_ENSURE( nMinSize <=
nLineWidth,
"What a Guess!!!" );
357 if (IsBlank(cCutChar))
362 if ( rAdjust == SvxAdjust::Left )
395#if OSL_DEBUG_LEVEL > 0
396 OUString aDebugString;
411 if ( !aText.isEmpty() )
417#if OSL_DEBUG_LEVEL > 0
422 OUString& rOldText =
const_cast<OUString&
> (rInf.
GetText());
423 rOldText = rOldText.replaceAt(sal_Int32(rInf.
GetIdx()) - 1, 1, aText);
430 LineBreakHyphenationOptions aHyphOpt;
431 Reference< XHyphenator > xHyph;
435 aHyphOpt = LineBreakHyphenationOptions( xHyph,
464 if ( nLangIndex > nDoNotStepOver &&
468 while ( nLangIndex > nDoNotStepOver &&
474 if ( nLangIndex < rInf.
GetIdx() )
477 sal_Int32(nLangIndex));
478 OSL_ENSURE( nScript,
"Script is not between 1 and 4" );
492 const ForbiddenCharacters aForbidden(
499 LineBreakUserOptions aUserOpt(
500 aForbidden.beginLine, aForbidden.endLine,
526 bHyph = BreakType::HYPHENATION == aResult.breakType;
538 sal_Int32
const nSoftHyphPos =
541 if ( nSoftHyphPos >= 0 &&
569 if( rAdjust != SvxAdjust::Left )
599 aTmpSize.
Width(aTmpSize.
Width() + nLeftRightBorderSpace);
600 OSL_ENSURE( !
m_pHanging,
"A hanging portion is hanging around" );
622 "I've got field trouble, part2!" );
625 OUString& rOldText =
const_cast<OUString&
> (rInf.
GetText());
626 OUString aReplacement( cFieldChr );
627 rOldText = rOldText.replaceAt(sal_Int32(nOldIdx) - 1, sal_Int32(
m_nFieldDiff) + 1, aReplacement);
630#if OSL_DEBUG_LEVEL > 0
631 OSL_ENSURE( aDebugString == rInf.
GetText(),
632 "Somebody, somebody, somebody put something in my string" );
679 WordType::DICTIONARY_WORD,
true );
681 sal_Int32 nWordLen = aBound.endPos - sal_Int32(
m_nBreakStart);
690 OSL_ENSURE( xHyph.is(),
"Hyphenator is missing");
692 m_xHyphWord = xHyph->queryAlternativeSpelling( aText,
@ HYPHENATE_URLS
tdf#152952
@ MS_WORD_COMP_TRAILING_BLANKS
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...
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual const css::i18n::ForbiddenCharacters * getForbiddenCharacters(LanguageType nLang, bool bLocaleData) const =0
Return the forbidden characters.
SvxAdjust GetAdjust() const
const SvxAdjustItem & GetAdjust(bool=true) const
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
const css::lang::Locale & GetLocale(const LanguageType aLang)
sal_uInt16 GetRealScriptOfText(const OUString &rText, sal_Int32 nPos) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
IDocumentSettingAccess const & getIDocumentSettingAccess() const
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
FontItalic GetItalic() const
sal_uInt16 GetRightBorderSpace() const
SwFontScript GetActual() const
LanguageType GetLanguage() const
sal_uInt16 GetLeftBorderSpace() const
bool IsRightToLeft() const
SwPageFrame * FindPageFrame()
bool GetJoinBorderWithPrev() const
TextFrameIndex GetLen() const
bool GetJoinBorderWithNext() const
bool IsFootnotePortion() const
bool IsDropPortion() const
bool IsNumberPortion() const
SwScriptInfo & GetScriptInfo()
size_t CountCompChg() const
SwLinePortion * GetLast()
TextFrameIndex GetLineStart() const
bool IsHyphenate() const
If the Hyphenator returns ERROR or the language is set to NOLANGUAGE we do not hyphenate.
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
const css::beans::PropertyValues & GetHyphValues() const
bool IsHyphForbud() const
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
SwTextNode const * GetTextNodeForParaProps() const
SwTextGrid GetGridType() const
bool AlternativeSpelling(const SwTextFormatInfo &rInf, const TextFrameIndex nPos)
sal_uInt16 m_nExtraBlankWidth
TextFrameIndex m_nBreakPos
std::unique_ptr< SwHangingPortion > m_pHanging
TextFrameIndex m_nBreakStart
css::uno::Reference< css::linguistic2::XHyphenatedWord > m_xHyphWord
bool Guess(const SwTextPortion &rPor, SwTextFormatInfo &rInf, const sal_uInt16 nHeight)
TextFrameIndex m_nFieldDiff
SwParaPortion * GetParaPortion()
This portion represents a part of the paragraph string.
SwTextFrame * GetTextFrame()
void SetMaxWidthDiff(const SwLinePortion *nKey, sal_uInt16 nVal)
TextFrameIndex GetTextBreak(const tools::Long nLineWidth, const TextFrameIndex nMaxLen, const sal_uInt16 nComp, vcl::text::TextLayoutCache const *) const
const std::shared_ptr< const vcl::text::TextLayoutCache > & GetCachedVclData() const
void SetIdx(const TextFrameIndex nNew)
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
sal_Unicode GetChar(TextFrameIndex const nPos) const
TextFrameIndex GetLen() const
bool IsFootnoteInside() const
bool IsFirstMulti() const
const OUString & GetText() const
TextFrameIndex GetIdx() const
bool HasForbiddenChars() const
#define CH_TXTATR_BREAKWORD
CharClass & GetAppCharClass()
constexpr OUStringLiteral UPN_HYPH_ZONE
constexpr OUStringLiteral UPN_HYPH_NO_LAST_WORD
SVL_DLLPUBLIC OUString FindFirstURLInText(OUString const &rText, sal_Int32 &rBegin, sal_Int32 &rEnd, CharClass const &rCharClass, INetURLObject::EncodeMechanism eMechanism=INetURLObject::EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
double getLength(const B2DPolygon &rCandidate)
enumrange< T >::Iterator begin(enumrange< T >)
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
const sal_Unicode CH_BREAK
const sal_Unicode CH_NB_SPACE
const sal_Unicode CH_SIX_PER_EM
const sal_Unicode CH_BLANK
const sal_Unicode CH_FULL_BLANK
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
constexpr sal_Int32 COMPLETE_STRING