From 604a0b7282e85c8404d0fcf6db6be0cb08463fb1 Mon Sep 17 00:00:00 2001 From: László Németh Date: Tue, 4 Feb 2014 10:43:49 +0100 Subject: fdo#44314 Unicode hyphenation at soft hyphens with two extra char. Change-Id: I4b8eba6d8353e4207cac4a8b24d2b9f0440ce9e6 --- lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 4 +--- linguistic/source/hyphdsp.cxx | 10 ++-------- linguistic/source/misc.cxx | 6 +++--- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 1cb79963b41e..567dc096b069 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -514,10 +514,8 @@ Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling( const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // FIXME: multiple character change, eg. briddzsel -> bridzs-dzsel is not supported, - // because Writer has got a layout problem here. // Firstly we allow only one plus character before the hyphen to avoid to miss the right break point: - for (int extrachar = 1; extrachar < 2; extrachar++) // temporarily i < 2 instead of i <= 2 + for (int extrachar = 1; extrachar <= 2; extrachar++) { Reference< XHyphenatedWord > xRes = hyphenate(aWord, aLocale, nIndex + 1 + extrachar, aProperties); if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex) diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index ecc9ec2dad5f..52f55f10dc86 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -456,15 +456,9 @@ Reference< XHyphenatedWord > SAL_CALL if (xEntry.is()) { - // FIXME: multiple character change, eg. briddzsel -> bridzs-dzsel is not supported, - // because Writer has got a layout problem here. - // Firstly we allow only one plus character before the hyphen to avoid to miss the right break point: - for (int extrachar = 1; extrachar < 2; extrachar++) // temporarily i < 2 instead of i <= 2 - { - xRes = buildHyphWord(aChkWord, xEntry, nLanguage, nIndex + 1 + extrachar); - if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex) + xRes = buildHyphWord(aChkWord, xEntry, nLanguage, nIndex + 1); + if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex) return xRes; - } } else { diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 737f4ae2ba33..d60ec3dbaa35 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -478,11 +478,11 @@ static sal_Bool GetAltSpelling( sal_Int16 &rnChgPos, sal_Int16 &rnChgLen, OUStri ; rnChgPos = sal::static_int_cast< sal_Int16 >(nPosL); - rnChgLen = sal::static_int_cast< sal_Int16 >(nPosR - nPosL + 1); + rnChgLen = sal::static_int_cast< sal_Int16 >(nAltPosR - nPosL); DBG_ASSERT( rnChgLen >= 0, "nChgLen < 0"); sal_Int32 nTxtStart = nPosL; - sal_Int32 nTxtLen = nAltPosL - nPosL + 1; + sal_Int32 nTxtLen = nAltPosR - nPosL + 1; rRplc = aHyphenatedWord.copy( nTxtStart, nTxtLen ); } return bRes; @@ -558,7 +558,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( --nPos; aLeft = rOrigWord.copy( 0, nPos ); - aRight = rOrigWord.copy( nPos + nChgLen ); + aRight = rOrigWord.copy( nPos ); // FIXME: changes at the right side aOrigHyphenatedWord = aLeft; aOrigHyphenatedWord += aRplc; -- cgit v1.2.3