summaryrefslogtreecommitdiff
path: root/editeng/source/misc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-08-23 17:44:16 +0200
committerEike Rathke <erack@redhat.com>2017-08-24 00:30:37 +0200
commit06d14411a447cd798d1f0678a3c5e06f5278a1cb (patch)
tree37fd5ccedaff3491bb8d17a1072d60371d3801a0 /editeng/source/misc
parent5a9b20c8bd0c2d7065cde37ebef330aaee0056e2 (diff)
Related: tdf#108795 a shared SvxAutoCorrect instance can not be stateful
An SvxAutoCorrect instance is shared via SvxAutoCorrCfg::Get().GetAutoCorrect(). Since commit 284eb106767d094fc5c547efd6c11cc390e3538a and following the SvxAutoCorrect::bRunNext/HasRunNext() introduced a state whether a previously inserted NO-BREAK SPACE should be removed again, depending on the next character input. That does not work, for example, if SvxAutoCorrect::DoAutoCorrect() is called from two different EditEngine instances, like it is the case in the Calc input line and cell which are synchronized; or any other two or more instances for that matter. The caller has to pass and remember a flag that is maintained by SvxAutoCorrect. Change-Id: I79a26d2ba44cc40771979a78b686c89f0c80b412 Reviewed-on: https://gerrit.libreoffice.org/41475 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'editeng/source/misc')
-rw-r--r--editeng/source/misc/svxacorr.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index d97961831540..51571e1af1ca 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -296,7 +296,6 @@ SvxAutoCorrect::SvxAutoCorrect( const OUString& rShareAutocorrFile,
const OUString& rUserAutocorrFile )
: sShareAutoCorrFile( rShareAutocorrFile )
, sUserAutoCorrFile( rUserAutocorrFile )
- , bRunNext( false )
, eCharClassLang( LANGUAGE_DONTKNOW )
, nFlags(SvxAutoCorrect::GetDefaultFlags())
, cStartDQuote( 0 )
@@ -312,7 +311,6 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
: sShareAutoCorrFile( rCpy.sShareAutoCorrFile )
, sUserAutoCorrFile( rCpy.sUserAutoCorrFile )
, aSwFlags( rCpy.aSwFlags )
- , bRunNext( false )
, eCharClassLang(rCpy.eCharClassLang)
, nFlags( rCpy.nFlags & ~(ChgWordLstLoad|CplSttLstLoad|WrdSttLstLoad))
, cStartDQuote( rCpy.cStartDQuote )
@@ -630,7 +628,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
bool SvxAutoCorrect::FnAddNonBrkSpace(
SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nEndPos,
- LanguageType eLang )
+ LanguageType eLang, bool& io_bNbspRunNext )
{
bool bRet = false;
@@ -689,11 +687,11 @@ bool SvxAutoCorrect::FnAddNonBrkSpace(
// Add the non-breaking space at the end pos
if ( bHasSpace )
rDoc.Insert( nPos, OUString(cNonBreakingSpace) );
- bRunNext = true;
+ io_bNbspRunNext = true;
bRet = true;
}
else if ( chars.indexOf( cPrevChar ) != -1 )
- bRunNext = true;
+ io_bNbspRunNext = true;
}
}
else if ( cChar == '/' && nEndPos > 1 && rTxt.getLength() > (nEndPos - 1) )
@@ -1234,10 +1232,10 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPo
void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nInsPos, sal_Unicode cChar,
- bool bInsert, vcl::Window const * pFrameWin )
+ bool bInsert, bool& io_bNbspRunNext, vcl::Window const * pFrameWin )
{
- bool bIsNextRun = bRunNext;
- bRunNext = false; // if it was set, then it has to be turned off
+ bool bIsNextRun = io_bNbspRunNext;
+ io_bNbspRunNext = false; // if it was set, then it has to be turned off
do{ // only for middle check loop !!
if( cChar )
@@ -1276,7 +1274,7 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
if ( IsAutoCorrFlag( AddNonBrkSpace ) )
{
if ( NeedsHardspaceAutocorr( cChar ) &&
- FnAddNonBrkSpace( rDoc, rTxt, nInsPos, rDoc.GetLanguage( nInsPos ) ) )
+ FnAddNonBrkSpace( rDoc, rTxt, nInsPos, rDoc.GetLanguage( nInsPos ), io_bNbspRunNext ) )
{
;
}