summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2014-08-29 13:01:55 +0200
committerLászló Németh <nemeth@numbertext.org>2014-08-29 13:23:59 +0200
commitf78eeee1b7c6599589c37b456c4b2f1c6c2e249c (patch)
treeda3ab73b9bc784d06c1d02233118411c00e3b371 /editeng
parent610cfb377161a84f24c9022fc04cf7cb55d74ea9 (diff)
fdo#62923 Autocorrect opt. 'Replace dashes' uses en-dash between numbers
to avoid the bad replacement of the frequent number ranges between years, page numbers etc., more information: http://en.wikipedia.org/wiki/Dash Change-Id: I9cae6bcbc227e80d59e091be591448c9289371eb
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/svxacorr.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 5fb94248aeff..9aae3350fc13 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -586,7 +586,8 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
}
}
- // Replace [A-z0-9]--[A-z0-9] double dash with "emDash" or "enDash".
+ // Replace [A-z0-9]--[A-z0-9] double dash with "emDash" or "enDash"
+ // [0-9]--[0-9] double dash always replaced with "enDash"
// Finnish and Hungarian use enDash instead of emDash.
bool bEnDash = (eLang == LANGUAGE_HUNGARIAN || eLang == LANGUAGE_FINNISH);
if( ((cEmDash && !bEnDash) || (cEnDash && bEnDash)) && 4 <= nEndPos - nSttPos )
@@ -602,7 +603,8 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
{
nSttPos = nSttPos + nFndPos;
rDoc.Delete( nSttPos, nSttPos + 2 );
- rDoc.Insert( nSttPos, (bEnDash ? OUString(cEnDash) : OUString(cEmDash)) );
+ rDoc.Insert( nSttPos, (bEnDash || (rCC.isDigit( sTmp, nFndPos - 1 ) &&
+ rCC.isDigit( sTmp, nFndPos + 2 )) ? OUString(cEnDash) : OUString(cEmDash)) );
bRet = true;
}
}