summaryrefslogtreecommitdiff
path: root/lingucomponent/source
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2003-12-01 15:13:27 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2003-12-01 15:13:27 +0000
commitac192ca2ef379178d3bd09762f5859754d5731c5 (patch)
tree4f8f58df0f5a30d6cc65e04cb562581f591e6866 /lingucomponent/source
parentebfaadeb8d3866a48f750f6f43bfdf29af4245df (diff)
INTEGRATION: CWS ooo20031110 (1.10.6); FILE MERGED
2003/11/11 12:09:33 waratah 1.10.6.2: #i22301# Correct for scoping rules 2003/10/24 15:46:02 khendricks 1.10.6.1: updating lingucomponent to match changes found in fix1 so that they get merged back to HEAD and not diverge Please see discussion on dev@porting concerning this. Kevin
Diffstat (limited to 'lingucomponent/source')
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx41
1 files changed, 33 insertions, 8 deletions
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
index ca0878ef1344..aa9e5f14b8f3 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: hyphenimp.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: hjs $ $Date: 2003-08-18 14:34:53 $
+ * last change: $Author: rt $ $Date: 2003-12-01 16:13:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -400,7 +400,19 @@ Hyphenator::hyphenate( const ::rtl::OUString& aWord,
dict = aDicts[k].aPtr;
aEnc = aDicts[k].aEnc;
- OString encWord(OU2ENC(aWord,aEnc));
+ // first convert any smart quotes or apostrophes to normal ones
+ OUStringBuffer rBuf(aWord);
+ sal_Int32 nc = rBuf.getLength();
+ sal_Unicode ch;
+ for (sal_Int32 ix=0; ix < nc; ix++) {
+ ch = rBuf.charAt(ix);
+ if ((ch == 0x201C) || (ch == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022);
+ if ((ch == 0x2018) || (ch == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027);
+ }
+ OUString nWord(rBuf.makeStringAndClear());
+
+ // now convert word to needed encoding
+ OString encWord(OU2ENC(nWord,aEnc));
wordlen = encWord.getLength();
lcword = new char[wordlen+1];
@@ -424,7 +436,7 @@ Hyphenator::hyphenate( const ::rtl::OUString& aWord,
for (int c = n; c < wordlen; c++) hyphens[c] = '0';
hyphens[wordlen] = '\0';
- // fprintf(stderr,"... %s\n",hyphens); fflush(stderr);
+ //fprintf(stderr,"... %s\n",hyphens); fflush(stderr);
OUStringBuffer hyphenatedWordBuffer;
OUString hyphenatedWord;
INT32 Leading = GetPosInWordToCheck( aWord, nMaxLeading );
@@ -541,7 +553,19 @@ Reference< XPossibleHyphens > SAL_CALL
aEnc = aDicts[k].aEnc;
- OString encWord(OU2ENC(aWord, aEnc));
+ // first handle smart quotes both single and double
+ OUStringBuffer rBuf(aWord);
+ sal_Int32 nc = rBuf.getLength();
+ sal_Unicode ch;
+ for (sal_Int32 ix=0; ix < nc; ix++) {
+ ch = rBuf.charAt(ix);
+ if ((ch == 0x201C) || (ch == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022);
+ if ((ch == 0x2018) || (ch == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027);
+ }
+ OUString nWord(rBuf.makeStringAndClear());
+
+ // now convert the string to the proper encoding
+ OString encWord(OU2ENC(nWord, aEnc));
wordlen = encWord.getLength();
lcword = new char[wordlen+1];
@@ -566,8 +590,9 @@ Reference< XPossibleHyphens > SAL_CALL
// fprintf(stderr,"... %s\n",hyphens); fflush(stderr);
INT16 nHyphCount = 0;
+ INT16 i;
- for (INT16 i = 0; i < encWord.getLength(); i++)
+ for ( i = 0; i < encWord.getLength(); i++)
if (hyphens[i]&1)
nHyphCount++;
@@ -589,8 +614,8 @@ Reference< XPossibleHyphens > SAL_CALL
}
hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
- // fprintf(stderr,"result is %s\n",OU2A(hyphenatedWord));
- // fflush(stderr);
+ //fprintf(stderr,"result is %s\n",OU2A(hyphenatedWord));
+ //fflush(stderr);
xRes = new PossibleHyphens( aWord, LocaleToLanguage( aLocale ),
hyphenatedWord, aHyphPos );