diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-29 14:16:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-29 14:25:24 +0100 |
commit | 5f04439b17f20ba3b3aeb3432fe90e6d11c34161 (patch) | |
tree | 8fc15f900886a7aaca04fff2def1c0fb611d08e1 /lingucomponent/source | |
parent | db3a8faba14e89be39df5fb98f5535c1ca295f62 (diff) |
Resolves: fdo#41083 honour minimum word hyphenation length
Diffstat (limited to 'lingucomponent/source')
-rw-r--r-- | lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx index 1f8a5089efce..615c4885cfe6 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx @@ -549,23 +549,21 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - int wordlen; - char *hyphens; - char *lcword; - int k; - PropertyHelper_Hyphenation& rHelper = GetPropHelper(); rHelper.SetTmpPropVals(aProperties); sal_Int16 minTrail = rHelper.GetMinTrailing(); sal_Int16 minLead = rHelper.GetMinLeading(); + sal_Int16 minLen = rHelper.GetMinWordLength(); - HyphenDict *dict = NULL; - rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW; - CharClass* pCC = NULL; - - Reference< XPossibleHyphens > xRes; + //Resolves: fdo#41083 honour MinWordLength in "createPossibleHyphens" as + //well as "hyphenate" + if (aWord.getLength() < minLen) + { + return PossibleHyphens::CreatePossibleHyphens( aWord, LocaleToLanguage( aLocale ), + aWord, Sequence< sal_Int16 >() ); + } - k = -1; + int k = -1; for (int j = 0; j < numdict; j++) { if (aLocale == aDicts[j].aLoc) k = j; @@ -574,6 +572,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const // if we have a hyphenation dictionary matching this locale if (k != -1) { + HyphenDict *dict = NULL; // if this dictioanry has not been loaded yet do that if (!aDicts[k].aPtr) { @@ -602,8 +601,8 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const // other wise hyphenate the word with that dictionary dict = aDicts[k].aPtr; - eEnc = aDicts[k].eEnc; - pCC = aDicts[k].apCC; + rtl_TextEncoding eEnc = aDicts[k].eEnc; + CharClass* pCC = aDicts[k].apCC; // we don't want to work with a default text encoding since following incorrect // results may occur only for specific text and thus may be hard to notice. @@ -633,9 +632,9 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const // now convert word to needed encoding OString encWord(OU2ENC(nTerm,eEnc)); - wordlen = encWord.getLength(); - lcword = new char[wordlen+1]; - hyphens = new char[wordlen+5]; + int wordlen = encWord.getLength(); + char *lcword = new char[wordlen+1]; + char *hyphens = new char[wordlen+5]; char ** rep = NULL; // replacements of discretionary hyphenation int * pos = NULL; // array of [hyphenation point] minus [deletion position] int * cut = NULL; // length of deletions in original word @@ -690,7 +689,6 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const Sequence< sal_Int16 > aHyphPos(nHyphCount); sal_Int16 *pPos = aHyphPos.getArray(); OUStringBuffer hyphenatedWordBuffer; - OUString hyphenatedWord; nHyphCount = 0; for (i = 0; i < nWord.getLength(); i++) @@ -705,10 +703,10 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const } } - hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear(); + OUString hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear(); - xRes = PossibleHyphens::CreatePossibleHyphens( aWord, LocaleToLanguage( aLocale ), - hyphenatedWord, aHyphPos ); + Reference< XPossibleHyphens > xRes = PossibleHyphens::CreatePossibleHyphens( + aWord, LocaleToLanguage( aLocale ), hyphenatedWord, aHyphPos); delete[] hyphens; delete[] lcword; |