diff options
author | Eike Rathke <erack@redhat.com> | 2017-08-23 17:44:16 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-09-05 16:24:11 +0200 |
commit | c5fcab1ec72be1cf2868215ee71d3cb2668498c1 (patch) | |
tree | 8f3d3875bd402ec9f397ae9803db9a75dbb54301 /sc | |
parent | 02b95a0e8191fc560637b2fa3a62bca0bd51b9c4 (diff) |
Resolves: tdf#108795 merge table EditEngine language attributes to input line
... and change SvxAutoCorrect to be stateless again to make that work.
This is a combination of 3 commits.
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.
Reviewed-on: https://gerrit.libreoffice.org/41475
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 06d14411a447cd798d1f0678a3c5e06f5278a1cb)
Backported.
Related: tdf#108795 never use an unresolved LANGUAGE_SYSTEM in SvxAutoCorrect
Substitute with the current work locale, using MsLangId::getSystemLanguage()
instead was also wrong.
Reviewed-on: https://gerrit.libreoffice.org/41476
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 311be7d70146e4963e4dfd1f39d6c71d45d241ca)
Resolves: tdf#108795 merge table EditEngine language attributes to input line
... when editing there, so the SvxAutoCorrect behaviour is synchronized.
Depends on commit 06d14411a447cd798d1f0678a3c5e06f5278a1cb that disentangles
the stateful SvxAutoCorrect instance.
Reviewed-on: https://gerrit.libreoffice.org/41521
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit d31a8263d564ebd7886f6debdf36cedd031915ea)
55db3bc1f76329320afc1f366d7426a8c2f66fb2
c6aac1f2acc36b500144be50a20a4784a3ba62dc
Change-Id: I79a26d2ba44cc40771979a78b686c89f0c80b412
Reviewed-on: https://gerrit.libreoffice.org/41525
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/inputhdl.hxx | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index dfbd1c43bbb3..cc702882c72e 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2184,6 +2184,14 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn return bNewTable; } +void ScInputHandler::MergeLanguageAttributes( ScEditEngineDefaulter& rDestEngine ) const +{ + const SfxItemSet& rSrcSet = mpEditEngine->GetDefaults(); + rDestEngine.SetDefaultItem( rSrcSet.Get( EE_CHAR_LANGUAGE )); + rDestEngine.SetDefaultItem( rSrcSet.Get( EE_CHAR_LANGUAGE_CJK )); + rDestEngine.SetDefaultItem( rSrcSet.Get( EE_CHAR_LANGUAGE_CTL )); +} + static void lcl_SetTopSelection( EditView* pEditView, ESelection& rSel ) { OSL_ENSURE( rSel.nStartPara==0 && rSel.nEndPara==0, "SetTopSelection: Para != 0" ); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 243783490cbb..6ef5adab11c2 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1108,7 +1108,13 @@ void ScTextWnd::StartEditEngine() ScInputHandler* pHdl = mpViewShell->GetInputHandler(); if (pHdl) + { + bool bStarting = !pHdl->IsEditMode(); pHdl->SetMode(SC_INPUT_TOP); + if (bStarting) + // necessary to sync SvxAutoCorrect behavior + pHdl->MergeLanguageAttributes( *mpEditEngine); + } SfxViewFrame* pViewFrm = SfxViewFrame::Current(); if (pViewFrm) diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index dd36ff84219b..b4c98b3edc2b 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -180,6 +180,7 @@ public: const ScAddress& GetCursorPos() const { return aCursorPos; } bool GetTextAndFields( ScEditEngineDefaulter& rDestEngine ); + void MergeLanguageAttributes( ScEditEngineDefaulter& rDestEngine ) const; bool KeyInput( const KeyEvent& rKEvt, bool bStartEdit ); void EnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL ); |