summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-09-24 10:40:39 +0200
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-09-24 10:40:39 +0200
commitef6a0dc85ab7bc342b1e11083a4b276aa9c26f5e (patch)
treeaa0f37254bee2ad3492a79405985b6e3608c7b8f /editeng
parent22c66e37b889785f862cff576c3639bc297db703 (diff)
Fixed i#114659: non-breaking spaces corner case
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/svxacorr.cxx29
1 files changed, 13 insertions, 16 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 8eea009a4e..89a33ea853 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -658,8 +658,8 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
chars = OUString::createFromAscii( ":" );
sal_Unicode cChar = rTxt.GetChar( nEndPos );
- bool bHasSpace = chars.indexOf( sal_Unicode( cChar ) ) != -1;
- bool bIsSpecial = allChars.indexOf( sal_Unicode( cChar ) ) != -1;
+ bool bHasSpace = chars.indexOf( cChar ) != -1;
+ bool bIsSpecial = allChars.indexOf( cChar ) != -1;
if ( bIsSpecial )
{
// Get the last word delimiter position
@@ -673,7 +673,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
{
// Check the previous char
sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 );
- if ( ( chars.indexOf( sal_Unicode( cPrevChar ) ) == -1 ) && cPrevChar != '\t' )
+ if ( ( chars.indexOf( cPrevChar ) == -1 ) && cPrevChar != '\t' )
{
// Remove any previous normal space
xub_StrLen nPos = nEndPos - 1;
@@ -684,20 +684,17 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
cPrevChar = rTxt.GetChar( nPos );
}
- if ( nPos != 0 )
- {
- nPos++;
- if ( nEndPos - nPos > 0 )
- rDoc.Delete( nPos, nEndPos );
-
- // Add the non-breaking space at the end pos
- if ( bHasSpace )
- rDoc.Insert( nPos, CHAR_HARDBLANK );
- bRunNext = true;
- bRet = true;
- }
+ nPos++;
+ if ( nEndPos - nPos > 0 )
+ rDoc.Delete( nPos, nEndPos );
+
+ // Add the non-breaking space at the end pos
+ if ( bHasSpace )
+ rDoc.Insert( nPos, CHAR_HARDBLANK );
+ bRunNext = true;
+ bRet = true;
}
- else if ( chars.indexOf( sal_Unicode( cPrevChar ) ) != -1 )
+ else if ( chars.indexOf( cPrevChar ) != -1 )
bRunNext = true;
}
}