Kaydet (Commit) 8112af33 authored tarafından Eike Rathke's avatar Eike Rathke

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
üst 291874c0
......@@ -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 );
......
......@@ -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)
......
......@@ -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); }
......
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