summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-22 17:45:12 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-22 20:37:34 +0200
commitc06eee519d8a235385b4910d9ec96e5492dd0e9b (patch)
treec2800bba3620f306fe8f70baccf777f66fb9ca50 /sw
parent1b8292342f53bf0f5d9ce3bc729078fb5ed49b9d (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>
Diffstat (limited to 'sw')
-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 f28d4838a554..f0867a2557a6 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))
{