diff options
author | Eike Rathke <erack@redhat.com> | 2017-10-19 19:23:01 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-10-19 19:33:40 +0200 |
commit | 8112af3361fdf15fcf5d3177cd967e1d8d97d5f3 (patch) | |
tree | 04cfb60235395e700c3d46421c786ad0b4376622 /sc/source/ui | |
parent | 291874c09c4bcde61f2c6808f2df6079f38d74e0 (diff) |
Resolves: tdf#113179 merge language attributes early, tdf#108795 follow-up
Merging attributes from table to top EditEngine has to be done
before colorizing with the range finder, as the resulting merged
default item set *overwrites* the items set.
Change-Id: I6561201de11344161f61d7d4cf6a7b79d76ba493
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/inputhdl.hxx | 9 |
3 files changed, 20 insertions, 13 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 5a0436f6a745..f8231e731a11 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2011,7 +2011,8 @@ void ScInputHandler::RemoveRangeFinder() DeleteRangeFinder(); // Deletes the list and the labels on the table } -bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bInputActivated ) +bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bInputActivated, + ScEditEngineDefaulter* pTopEngine ) { bool bNewTable = false; @@ -2132,6 +2133,13 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn } } + if (pTopEngine) + { + // Necessary to sync SvxAutoCorrect behavior. This has to be + // done before InitRangeFinder() below. + MergeLanguageAttributes( *pTopEngine); + } + // UpdateSpellSettings enables online spelling if needed // -> also call if attributes are unchanged UpdateSpellSettings( true ); // uses pLastPattern @@ -2263,7 +2271,7 @@ bool ScInputHandler::DataChanging( sal_Unicode cTyped, bool bFromCommand ) bInOwnChange = true; // disable ModifyHdl (reset in DataChanged) if ( eMode == SC_INPUT_NONE ) - return StartTable( cTyped, bFromCommand, false ); + return StartTable( cTyped, bFromCommand, false, nullptr ); else return false; } @@ -2479,7 +2487,7 @@ void ScInputHandler::InvalidateAttribs() // --------------- public methods -------------------------------------------- -void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText ) +void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText, ScEditEngineDefaulter* pTopEngine ) { if ( eMode == eNewMode ) return; @@ -2510,7 +2518,7 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText ) { if (eOldMode == SC_INPUT_NONE) // not if switching between modes { - if (StartTable(0, false, eMode == SC_INPUT_TABLE)) + if (StartTable(0, false, eMode == SC_INPUT_TABLE, pTopEngine)) { if (pActiveViewSh) pActiveViewSh->GetViewData().GetDocShell()->PostEditView( mpEditEngine.get(), aCursorPos ); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index dca31015375a..92e7db4dd5a3 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1108,13 +1108,7 @@ 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); - } + pHdl->SetMode(SC_INPUT_TOP, nullptr, mpEditEngine.get()); SfxViewFrame* pViewFrm = SfxViewFrame::Current(); if (pViewFrm) diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index c470792fa662..9457f42577e6 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -131,9 +131,13 @@ private: * for text or number. * @param bInputActivated true if the cell input mode is activated (via * F2), false otherwise. + * @param pTopEngine top window input line EditEngine. If not nullptr then + * some default attributes are merged to it from the + * table EditEngine. * @return true if the new edit mode has been started. */ - bool StartTable( sal_Unicode cTyped, bool bFromCommand, bool bInputActivated ); + bool StartTable( sal_Unicode cTyped, bool bFromCommand, bool bInputActivated, + ScEditEngineDefaulter* pTopEngine ); void RemoveSelection(); void UpdateFormulaMode(); static void InvalidateAttribs(); @@ -171,7 +175,8 @@ public: ScInputHandler(); ~ScInputHandler(); - void SetMode( ScInputMode eNewMode, const OUString* pInitText = nullptr ); + void SetMode( ScInputMode eNewMode, const OUString* pInitText = nullptr, + ScEditEngineDefaulter* pTopEngine = nullptr ); bool IsInputMode() const { return (eMode != SC_INPUT_NONE); } bool IsEditMode() const { return (eMode != SC_INPUT_NONE && eMode != SC_INPUT_TYPE); } |