Kaydet (Commit) ade4f564 authored tarafından Jens-Heiner Rechtien's avatar Jens-Heiner Rechtien

INTEGRATION: CWS ooo20030412 (1.2.2.6.24); FILE MERGED

2003/04/08 12:33:57 khendricks 1.2.2.6.24.1: partial fix for Issuezilla 13095
periods at the end of words were improperly being sent
to the hyphenation dictionary which confused it.

To completely fix this issue and others, a new hyphenation
dictionary for English (US) must be used as well.
üst 314a18f2
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: hyphenimp.cxx,v $ * $RCSfile: hyphenimp.cxx,v $
* *
* $Revision: 1.7 $ * $Revision: 1.8 $
* *
* last change: $Author: hr $ $Date: 2003-03-26 13:02:08 $ * last change: $Author: hr $ $Date: 2003-04-28 17:04:41 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -408,28 +408,42 @@ Hyphenator::hyphenate( const ::rtl::OUString& aWord, ...@@ -408,28 +408,42 @@ Hyphenator::hyphenate( const ::rtl::OUString& aWord,
lcword = new char[wordlen+1]; lcword = new char[wordlen+1];
hyphens = new char[wordlen+5]; hyphens = new char[wordlen+5];
enmkallsmall(lcword,encWord.getStr(),dict->cset); enmkallsmall(lcword,encWord.getStr(),dict->cset);
// now strip off any ending periods
int n = wordlen-1;
while((n >=0) && (lcword[n] == '.')) n--;
n++;
// fprintf(stderr,"hyphenate... %s\n",lcword); fflush(stderr);
if (n > 0) {
if (hnj_hyphen_hyphenate(dict, lcword, n, hyphens))
{
//whoops something did not work
delete[] hyphens;
delete[] lcword;
return NULL;
}
}
// now backfill hyphens[] for any removed trailing periods
for (int c = n; c < wordlen; c++) hyphens[c] = '0';
hyphens[wordlen] = '\0';
if (hnj_hyphen_hyphenate(dict, lcword, wordlen, hyphens)) // fprintf(stderr,"... %s\n",hyphens); fflush(stderr);
{ OUStringBuffer hyphenatedWordBuffer;
//whoops something did not work OUString hyphenatedWord;
delete[] hyphens;
delete[] lcword;
return NULL;
}
OUStringBuffer hyphenatedWord;
INT32 Leading = GetPosInWordToCheck( aWord, nMaxLeading ); INT32 Leading = GetPosInWordToCheck( aWord, nMaxLeading );
for (INT32 i = 0; i < encWord.getLength(); i++) for (INT32 i = 0; i < encWord.getLength(); i++)
{ {
hyphenatedWord.append(aWord[i]); hyphenatedWordBuffer.append(aWord[i]);
if ((hyphens[i]&1) && (i < Leading)) if ((hyphens[i]&1) && (i < Leading))
{ {
nHyphenationPos = i; nHyphenationPos = i;
hyphenatedWord.append(sal_Unicode('=')); hyphenatedWordBuffer.append(sal_Unicode('='));
} }
} }
hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
fprintf(stderr,"result is %s\n",OU2A(hyphenatedWord));
fflush(stderr);
if (nHyphenationPos == -1) if (nHyphenationPos == -1)
xRes = NULL; xRes = NULL;
else else
...@@ -531,13 +545,23 @@ Reference< XPossibleHyphens > SAL_CALL ...@@ -531,13 +545,23 @@ Reference< XPossibleHyphens > SAL_CALL
lcword = new char[wordlen+1]; lcword = new char[wordlen+1];
hyphens = new char[wordlen+5]; hyphens = new char[wordlen+5];
enmkallsmall(lcword,encWord.getStr(),dict->cset); enmkallsmall(lcword,encWord.getStr(),dict->cset);
// first remove any trailing periods
if (hnj_hyphen_hyphenate(dict, lcword, wordlen, hyphens)) int n = wordlen-1;
{ while((n >=0) && (lcword[n] == '.')) n--;
delete[] hyphens; n++;
delete[] lcword; // fprintf(stderr,"hyphenate... %s\n",lcword); fflush(stderr);
return NULL; if (n > 0) {
if (hnj_hyphen_hyphenate(dict, lcword, n, hyphens))
{
delete[] hyphens;
delete[] lcword;
return NULL;
}
} }
// now backfill hyphens[] for any removed periods
for (int c = n; c < wordlen; c++) hyphens[c] = '0';
hyphens[wordlen] = '\0';
// fprintf(stderr,"... %s\n",hyphens); fflush(stderr);
INT16 nHyphCount = 0; INT16 nHyphCount = 0;
...@@ -563,6 +587,8 @@ Reference< XPossibleHyphens > SAL_CALL ...@@ -563,6 +587,8 @@ Reference< XPossibleHyphens > SAL_CALL
} }
hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear(); hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
fprintf(stderr,"result is %s\n",OU2A(hyphenatedWord));
fflush(stderr);
xRes = new PossibleHyphens( aWord, LocaleToLanguage( aLocale ), xRes = new PossibleHyphens( aWord, LocaleToLanguage( aLocale ),
hyphenatedWord, aHyphPos ); hyphenatedWord, aHyphPos );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment