Kaydet (Commit) 284eb106 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

[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.
üst 6b9635f6
......@@ -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
......
......@@ -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() );
}
......
......@@ -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 ) &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment