diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
commit | 5a7157d319477830426797532e02ac39d3b859f4 (patch) | |
tree | 3773f5ce209bee14a5643e98672e0f3828c71434 /sw/source/core/txtnode/thints.cxx | |
parent | Releasing progress-linux version 4:24.2.0-3~progress7.99u1. (diff) | |
download | libreoffice-5a7157d319477830426797532e02ac39d3b859f4.tar.xz libreoffice-5a7157d319477830426797532e02ac39d3b859f4.zip |
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/source/core/txtnode/thints.cxx')
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 0556facafe..cf5e1ff1cc 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -23,6 +23,7 @@ #include <DocumentContentOperationsManager.hxx> #include <hintids.hxx> #include <editeng/rsiditem.hxx> +#include <editeng/nhypitem.hxx> #include <osl/diagnose.h> #include <svl/whiter.hxx> #include <svl/itemiter.hxx> @@ -3487,7 +3488,7 @@ void SwTextNode::ClearSwpHintsArr( bool bDelFields ) } LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, - sal_uInt16 nScript ) const + sal_uInt16 nScript, bool const bNoneIfNoHyphenation ) const { LanguageType nRet = LANGUAGE_DONTKNOW; @@ -3497,7 +3498,9 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, } // #i91465# Consider nScript if pSwpHints == 0 - const TypedWhichId<SvxLanguageItem> nWhichId = GetWhichOfScript( RES_CHRATR_LANGUAGE, nScript ); + const sal_uInt16 nWhichId = bNoneIfNoHyphenation + ? RES_CHRATR_NOHYPHEN + : GetWhichOfScript( RES_CHRATR_LANGUAGE, nScript ); if ( HasHints() ) { @@ -3531,8 +3534,18 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, if( pHt->DontExpand() ? nBegin >= *pEndIdx : nBegin > *pEndIdx) continue; } - const SvxLanguageItem* pItem = CharFormat::GetItem( *pHt, nWhichId ); - const LanguageType nLng = pItem->GetLanguage(); + const SfxPoolItem* pItem = CharFormat::GetItem( *pHt, nWhichId ); + + if ( RES_CHRATR_NOHYPHEN == nWhichId ) + { + // bNoneIfNoHyphenation = true: return with LANGUAGE_NONE, + // if the hyphenation is disabled by character formatting + if ( static_cast<const SvxNoHyphenItem*>(pItem)->GetValue() ) + return LANGUAGE_NONE; + continue; + } + + const LanguageType nLng = static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(); // does the attribute completely cover the range? if( nAttrStart <= nBegin && nEnd <= *pEndIdx ) @@ -3542,9 +3555,9 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, } } } - if( LANGUAGE_DONTKNOW == nRet ) + if( LANGUAGE_DONTKNOW == nRet && !bNoneIfNoHyphenation ) { - nRet = GetSwAttrSet().Get( nWhichId ).GetLanguage(); + nRet = static_cast<const SvxLanguageItem&>(GetSwAttrSet().Get( nWhichId )).GetLanguage(); if( LANGUAGE_DONTKNOW == nRet ) nRet = GetAppLanguage(); } |