summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorThomas Lange <tl@openoffice.org>2001-08-17 10:04:21 +0000
committerThomas Lange <tl@openoffice.org>2001-08-17 10:04:21 +0000
commit39cc6c7b445408b8a7d90afea6f972764ec83c61 (patch)
tree88652de79314a39f1456ed8629344ebde3fd16b7 /linguistic
parent31d3b67cea93790c2967fe17108cb2ad4e153d43 (diff)
#90905# soft-hyphen behaviour changed again
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/hyphdsp.cxx17
-rw-r--r--linguistic/source/misc.cxx37
2 files changed, 23 insertions, 31 deletions
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 5079983c67b4..1bee136b9618 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: hyphdsp.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: tl $ $Date: 2001-08-14 09:15:49 $
+ * last change: $Author: tl $ $Date: 2001-08-17 11:04:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -317,19 +317,6 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
- // allow only hyphenation positions to the left of the
- // first soft-hyphen
- INT32 nLastSoftHyphenPos = rWord.lastIndexOf( SVT_SOFT_HYPHEN );
- if (nLastSoftHyphenPos >= 0 && nLastSoftHyphenPos <= nMaxLeading)
- {
- INT16 nP = nLastSoftHyphenPos - 1;
- DBG_ASSERT( nP >= 0, "unexpected soft-hyphen pos" );
- xRes = queryAlternativeSpelling( rWord, rLocale, nP, rProperties );
- if (!xRes.is())
- xRes = new HyphenatedWord( rWord, nLanguage, nP, rWord, nP );
- return xRes;
- }
-
OUString aChkWord( rWord );
bWordModified |= RemoveHyphens( aChkWord );
if (IsIgnoreControlChars( rProperties, GetPropSet() ))
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 1aecef5b1684..19778016d914 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: misc.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: tl $ $Date: 2001-08-14 09:15:49 $
+ * last change: $Author: tl $ $Date: 2001-08-17 11:04:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -443,16 +443,14 @@ INT32 GetPosInWordToCheck( const OUString &rTxt, INT32 nPos )
INT32 nLen = rTxt.getLength();
if (0 <= nPos && nPos < nLen)
{
- INT32 nSkipped = 0;
- BOOL bSkip;
- for (INT32 i = 0; i <= nPos; ++i)
+ nRes = 0;
+ for (INT32 i = 0; i < nPos; ++i)
{
sal_Unicode cChar = rTxt[i];
- bSkip = IsHyphen( cChar ) || IsControlChar( cChar );
- if (bSkip)
- ++nSkipped;
+ BOOL bSkip = IsHyphen( cChar ) || IsControlChar( cChar );
+ if (!bSkip)
+ ++nRes;
}
- nRes = nPos - nSkipped;
}
return nRes;
}
@@ -469,24 +467,32 @@ Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
nChgLen = 0;
OUString aRplc;
BOOL bAltSpelling = GetAltSpelling( nChgPos, nChgLen, aRplc, rxHyphWord );
+#ifdef DEBUG
+ OUString aWord( rxHyphWord->getWord() );
+#endif
OUString aOrigHyphenatedWord;
INT16 nOrigHyphenPos = -1;
INT16 nOrigHyphenationPos = -1;
if (!bAltSpelling)
{
-#ifdef DEBUG
- OUString aWord( rxHyphWord->getWord() );
-#endif
aOrigHyphenatedWord = rOrigWord;
nOrigHyphenPos = GetOrigWordPos( rOrigWord, rxHyphWord->getHyphenPos() );
nOrigHyphenationPos = GetOrigWordPos( rOrigWord, rxHyphWord->getHyphenationPos() );
}
else
{
+ //! should at least work with the German words
+ //! Bä-c-k-er and Sc-hif-fah-rt
+
OUString aLeft, aRight;
INT16 nPos = GetOrigWordPos( rOrigWord, nChgPos );
- nPos += (-1 + nChgLen);
+
+ // get words like Sc-hif-fah-rt to work correct
+ INT16 nHyphenationPos = rxHyphWord->getHyphenationPos();
+ if (nChgPos > nHyphenationPos)
+ --nPos;
+
aLeft = rOrigWord.copy( 0, nPos );
aRight = rOrigWord.copy( nPos + nChgLen );
@@ -495,9 +501,8 @@ Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
aOrigHyphenatedWord += aRight;
nOrigHyphenPos = aLeft.getLength() +
- rxHyphWord->getHyphenPos() - nChgPos;
- nOrigHyphenationPos = aLeft.getLength() +
- rxHyphWord->getHyphenationPos() - nChgPos;
+ rxHyphWord->getHyphenPos() - nChgPos;
+ nOrigHyphenationPos = GetOrigWordPos( rOrigWord, nHyphenationPos );
}
if (nOrigHyphenPos == -1 || nOrigHyphenationPos == -1)