diff options
author | Eike Rathke <erack@redhat.com> | 2017-08-23 17:44:16 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-08-24 00:30:37 +0200 |
commit | 06d14411a447cd798d1f0678a3c5e06f5278a1cb (patch) | |
tree | 37fd5ccedaff3491bb8d17a1072d60371d3801a0 /include/editeng | |
parent | 5a9b20c8bd0c2d7065cde37ebef330aaee0056e2 (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 'include/editeng')
-rw-r--r-- | include/editeng/svxacorr.hxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index 1f8e31287f7e..a7d03a9a971a 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -236,8 +236,6 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect std::map<LanguageTag, sal_Int64> aLastFileTable; std::unique_ptr<CharClass> pCharClass; - bool bRunNext; - LanguageType eCharClassLang; long nFlags; @@ -274,13 +272,19 @@ public: SvxAutoCorrect( const SvxAutoCorrect& ); virtual ~SvxAutoCorrect(); - // Execute an AutoCorrect. - // Returns what has been executed, according to the above flags + /** Execute an AutoCorrect. + Returns what has been executed, according to the above auto correct flags. + @param io_bNbspRunNext + Remembers if a NO-BREAK SPACE was added (eg. in "fr" language) + (set to <TRUE/>) at the last character input that may have to + be removed again depending on what character is following. + */ // FIXME: this has the horrible flaw that the rTxt must be a reference // to the actual SwTxtNode/EditNode string because it inserts the character // in rDoc and expects that to side-effect rTxt void DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, - sal_Int32 nPos, sal_Unicode cInsChar, bool bInsert, vcl::Window const * pFrameWin = nullptr ); + sal_Int32 nPos, sal_Unicode cInsChar, bool bInsert, bool& io_bNbspRunNext, + vcl::Window const * pFrameWin = nullptr ); // Return for the autotext expansion the previous word, // AutoCorrect - corresponding algorithm @@ -383,7 +387,7 @@ public: LanguageType eLang ); bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const OUString&, sal_Int32 nEndPos, - LanguageType eLang ); + LanguageType eLang, bool& io_bNbspRunNext ); bool FnSetINetAttr( SvxAutoCorrDoc&, const OUString&, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ); @@ -396,8 +400,6 @@ public: sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ); - bool HasRunNext() { return bRunNext; } - static long GetDefaultFlags(); // returns sal_True for characters where the function |