summaryrefslogtreecommitdiff
path: root/linguistic/source/dicimp.cxx
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2014-01-30 14:56:30 +0100
committerLászló Németh <nemeth@numbertext.org>2014-01-30 14:56:30 +0100
commite63923b0334ae381e0fcc576a6b6e08a62e657cf (patch)
treefd281a8df85ef40df228fcf8ef75bdb4067400e3 /linguistic/source/dicimp.cxx
parenta1aa702861694fb114403b3f2746a33eb315ed87 (diff)
fdo#44314 non-standard hyphenation at soft hyphens + with pers. dic.
Change-Id: I25e7c13036c6ce1948cc33d45901ef69a258fb03
Diffstat (limited to 'linguistic/source/dicimp.cxx')
-rw-r--r--linguistic/source/dicimp.cxx29
1 files changed, 26 insertions, 3 deletions
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index f50c942b2e81..1306253e0596 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -550,24 +550,37 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
}
const sal_Unicode cIgnChar = '=';
+ const sal_Unicode cIgnBeg = '['; // for alternative hyphenation, eg. Schif[f]fahrt, Zuc[1k]ker
+ const sal_Unicode cIgnEnd = ']'; // planned: gee"[1-/e]rfde or ge[-/1e]e"rfde (gee"rfde -> ge=erfde)
sal_Int32 nIdx1 = 0,
nIdx2 = 0,
nNumIgnChar1 = 0,
nNumIgnChar2 = 0;
+ bool IgnState;
sal_Int32 nDiff = 0;
sal_Unicode cChar1 = '\0';
sal_Unicode cChar2 = '\0';
do
{
// skip chars to be ignored
- while (nIdx1 < nLen1 && (cChar1 = aWord1[ nIdx1 ]) == cIgnChar)
+ IgnState = false;
+ while (nIdx1 < nLen1 && ((cChar1 = aWord1[ nIdx1 ]) == cIgnChar || cChar1 == cIgnBeg || IgnState ))
{
+ if ( cChar1 == cIgnBeg )
+ IgnState = true;
+ else if (cChar1 == cIgnEnd)
+ IgnState = false;
nIdx1++;
nNumIgnChar1++;
}
- while (nIdx2 < nLen2 && (cChar2 = aWord2[ nIdx2 ]) == cIgnChar)
+ IgnState = false;
+ while (nIdx2 < nLen2 && ((cChar2 = aWord2[ nIdx2 ]) == cIgnChar || cChar2 == cIgnBeg || IgnState ))
{
+ if ( cChar2 == cIgnBeg )
+ IgnState = true;
+ else if (cChar2 == cIgnEnd)
+ IgnState = false;
nIdx2++;
nNumIgnChar2++;
}
@@ -590,15 +603,25 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
// shorter one
// count remaining IgnChars
+ IgnState = false;
while (nIdx1 < nLen1 )
{
- if (aWord1[ nIdx1++ ] == cIgnChar)
+ if (aWord1[ nIdx1 ] == cIgnBeg)
+ IgnState = true;
+ if (IgnState || aWord1[ nIdx1++ ] == cIgnChar)
nNumIgnChar1++;
+ if (aWord1[ nIdx1] == cIgnEnd)
+ IgnState = false;
}
+ IgnState = false;
while (nIdx2 < nLen2 )
{
+ if (aWord1[ nIdx2 ] == cIgnBeg)
+ IgnState = true;
if (aWord2[ nIdx2++ ] == cIgnChar)
nNumIgnChar2++;
+ if (aWord1[ nIdx1] == cIgnEnd)
+ IgnState = false;
}
nRes = ((sal_Int32) nLen1 - nNumIgnChar1) - ((sal_Int32) nLen2 - nNumIgnChar2);