diff options
author | László Németh <nemeth@numbertext.org> | 2014-01-30 14:56:30 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2014-01-30 14:56:30 +0100 |
commit | e63923b0334ae381e0fcc576a6b6e08a62e657cf (patch) | |
tree | fd281a8df85ef40df228fcf8ef75bdb4067400e3 /lingucomponent | |
parent | a1aa702861694fb114403b3f2746a33eb315ed87 (diff) |
fdo#44314 non-standard hyphenation at soft hyphens + with pers. dic.
Change-Id: I25e7c13036c6ce1948cc33d45901ef69a258fb03
Diffstat (limited to 'lingucomponent')
-rw-r--r-- | lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 64fe545fcd21..1cb79963b41e 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -508,16 +508,22 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling( - const OUString& /*aWord*/, - const ::com::sun::star::lang::Locale& /*aLocale*/, - sal_Int16 /*nIndex*/, - const ::com::sun::star::beans::PropertyValues& /*aProperties*/ ) + const OUString& aWord, + const ::com::sun::star::lang::Locale& aLocale, + sal_Int16 nIndex, + const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - /* alternative spelling isn't supported by tex dictionaries */ - /* XXX: OOo's extended libhjn algorithm can support alternative spellings with extended TeX dic. */ - /* TASK: implement queryAlternativeSpelling() */ - return NULL; + // 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 + { + Reference< XHyphenatedWord > xRes = hyphenate(aWord, aLocale, nIndex + 1 + extrachar, aProperties); + if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex) + return xRes; + } + return NULL; } Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const OUString& aWord, @@ -658,7 +664,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const for ( i = 0; i < encWord.getLength(); i++) { - if (hyphens[i]&1 && (!rep || !rep[i])) + if (hyphens[i]&1) nHyphCount++; } @@ -670,8 +676,8 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const for (i = 0; i < nWord.getLength(); i++) { hyphenatedWordBuffer.append(aWord[i]); - // hyphenation position (not alternative) - if (hyphens[i]&1 && (!rep || !rep[i])) + // hyphenation position + if (hyphens[i]&1) { pPos[nHyphCount] = i; hyphenatedWordBuffer.append('='); |