summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-22 17:45:12 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2024-08-23 11:42:27 +0200
commitebeaced0f7bbdbeec9762b85cc6f92a1f8610240 (patch)
tree9aed46f2c3dc6544017470bd3d51fbb5c40dd6e0
parent8d5b4a68b864a3f2c865b7370d508ca0d72c70e2 (diff)
crashtesting: crash on hyphenation of ooo56629-9.odt
a problem I think since: commit b5e275f47a54bd7fee39dad516a433fde5be872d CommitDate: Fri Jan 19 17:37:41 2024 +0100 tdf#106733 sw: implement CharNoHyphenation Change-Id: Ic49c136019e93f79818bec7811317bb4f37d6ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172287 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit c06eee519d8a235385b4910d9ec96e5492dd0e9b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172268 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/core/text/guess.cxx26
1 files changed, 21 insertions, 5 deletions
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 661c349f5d70..d16fddef5224 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -627,12 +627,28 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
m_nBreakStart = m_nBreakPos;
- bHyph = BreakType::HYPHENATION == aResult.breakType &&
+ bHyph = BreakType::HYPHENATION == aResult.breakType;
+ if (bHyph)
+ {
+ LanguageType aNoHyphLang;
+ if (rPor.InFieldGrp())
+ {
+ // If we are inside a field portion, we use a temporary string which
+ // differs from the string at the textnode. Therefore we are not allowed
+ // to call the GetLangOfChar function.
+ aNoHyphLang = LANGUAGE_DONTKNOW;
+ }
+ else
+ {
// allow hyphenation of the word only if it's not disabled by character formatting
- LANGUAGE_NONE != rInf.GetTextFrame()->GetLangOfChar(
- TextFrameIndex( sal_Int32(m_nBreakPos) +
- aResult.rHyphenatedWord->getHyphenationPos() ),
- 1, true, /*bNoneIfNoHyphenation=*/true );
+ aNoHyphLang = rInf.GetTextFrame()->GetLangOfChar(
+ TextFrameIndex( sal_Int32(m_nBreakPos) +
+ aResult.rHyphenatedWord->getHyphenationPos() ),
+ 1, true, /*bNoneIfNoHyphenation=*/true );
+ }
+ // allow hyphenation of the word only if it's not disabled by character formatting
+ bHyph = aNoHyphLang != LANGUAGE_NONE;
+ }
if (bHyph && m_nBreakPos != TextFrameIndex(COMPLETE_STRING))
{