summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-22 17:45:12 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2024-08-23 10:40:09 +0200
commit43c46151a74264ee2424f766c1c809760b6a4871 (patch)
treea56f30942837d4bde3f632485d7044b141904cac /sw
parent8941140c7c458b77626a8303c74afb4489e69bcb (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/+/172267 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@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 c4f74de7cef7..3c8a3512b327 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -582,12 +582,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))
{