summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-03-15 18:16:49 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-03-15 18:16:49 +0100
commit284eb106767d094fc5c547efd6c11cc390e3538a (patch)
tree5cc4abd63115f3a1ada5713cfebc3fb502f9a6bc /editeng
parent6b9635f6b2d62537052bdc11ec84247d3bc72832 (diff)
[cbosdo05] Fixed a usability problem introduced by cbosdo01
Removing the non-breaking space when the character typed immediately after the punctuation mark if the last character typed isn't a blank.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/svxacorr.hxx4
-rw-r--r--editeng/source/editeng/editeng.cxx5
-rw-r--r--editeng/source/misc/svxacorr.cxx19
3 files changed, 25 insertions, 3 deletions
diff --git a/editeng/inc/editeng/svxacorr.hxx b/editeng/inc/editeng/svxacorr.hxx
index c900228cc053..1ef6bad09d9b 100644
--- a/editeng/inc/editeng/svxacorr.hxx
+++ b/editeng/inc/editeng/svxacorr.hxx
@@ -209,6 +209,8 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect
SvxAutoCorrLastFileAskTable_Impl* pLastFileTable;
CharClass* pCharClass;
+ bool bRunNext;
+
LanguageType eCharClassLang;
long nFlags;
@@ -374,6 +376,8 @@ public:
xub_StrLen nSttPos, xub_StrLen nEndPos,
LanguageType eLang = LANGUAGE_SYSTEM);
+ bool HasRunNext() { return bRunNext; }
+
static long GetDefaultFlags();
// returns TRUE for charcters where the function
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 212fb8ff9446..abfcc28282fd 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -49,6 +49,7 @@
#include <eerdll2.hxx>
#include <editeng/eerdll.hxx>
#include <editeng.hrc>
+#include <acorrcfg.hxx>
#include <editeng/flditem.hxx>
#include <editeng/txtrange.hxx>
#include <vcl/graph.hxx>
@@ -1144,8 +1145,10 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie
xub_Unicode nCharCode = rKeyEvent.GetCharCode();
pEditView->pImpEditView->DrawSelection();
// Autokorrektur ?
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) &&
- SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) )
+ ( SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) ||
+ pAutoCorrect->HasRunNext() ) )
{
aCurSel = pImpEditEngine->AutoCorrect( aCurSel, nCharCode, !pEditView->IsInsertMode() );
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 2631c71a6b17..6dfc5e8e1ca1 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -363,7 +363,7 @@ SvxAutoCorrect::SvxAutoCorrect( const String& rShareAutocorrFile,
sUserAutoCorrFile( rUserAutocorrFile ),
pLangTable( new SvxAutoCorrLanguageTable_Impl ),
pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
- pCharClass( 0 ),
+ pCharClass( 0 ), bRunNext( false ),
cStartDQuote( 0 ), cEndDQuote( 0 ), cStartSQuote( 0 ), cEndSQuote( 0 )
{
nFlags = SvxAutoCorrect::GetDefaultFlags();
@@ -380,7 +380,7 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
pLangTable( new SvxAutoCorrLanguageTable_Impl ),
pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
- pCharClass( 0 ),
+ pCharClass( 0 ), bRunNext( false ),
nFlags( rCpy.nFlags & ~(ChgWordLstLoad|CplSttLstLoad|WrdSttLstLoad)),
cStartDQuote( rCpy.cStartDQuote ), cEndDQuote( rCpy.cEndDQuote ),
@@ -711,6 +711,9 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
}
}
+ // Run on the next character if nbsp added
+ bRunNext = bRet;
+
return bRet;
}
@@ -1189,9 +1192,21 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
BOOL bInsert )
{
ULONG nRet = 0;
+ bRunNext = false; // if it was set, then it has to be turned off
+
do{ // only for middle check loop !!
if( cChar )
{
+ // Remove the NBSP if it wasn't an autocorrection
+ if ( !IsAutoCorrectChar( cChar ) && IsAutoCorrFlag( AddNonBrkSpace ) )
+ {
+ if ( NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
+ isblank( (unsigned char) cChar) == 0 )
+ {
+ rDoc.Delete( nInsPos - 2, nInsPos - 1 );
+ }
+ }
+
//JP 10.02.97: doppelte Spaces verhindern
if( nInsPos && ' ' == cChar &&
IsAutoCorrFlag( IgnoreDoubleSpace ) &&