resolved fdo#71667 and fdo#72278, fdo#69971 follow-up fix

a9d85d62a8 used
ScInputHandler::EnterHandler() to reset all sort of things related to
input EditEngine, but that is a handler for Enter and does not enter a
handler and actually attempts to finalize input, which lead to various
unwanted side effects.

Introduced ScInputHandler::InputTurnOffWinEngine() as only the input bar
window EditEngine needs to be reset in the window switching case (which
EnterHandler also does hence it did prevent that bug). The approach
could be polished with further refinement but most importantly fixes the
actual problems now.

Change-Id: I9a0bc452b49ba11a3313cafbc1e5972f41dc65c7
This commit is contained in:
Eike Rathke
2013-12-05 01:50:38 +01:00
parent 45c5124e0e
commit dfd1a47a38
5 changed files with 24 additions and 1 deletions

View File

@@ -217,6 +217,7 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO
void InputGetSelection( sal_Int32& rStart, sal_Int32& rEnd );
void InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd );
void InputReplaceSelection( const OUString& rStr );
void InputTurnOffWinEngine();
OUString InputGetFormulaStr();
void ActivateInputWindow( const OUString* pStr = NULL,
sal_Bool bMatrix = false );

View File

@@ -3904,6 +3904,20 @@ void ScInputHandler::InputReplaceSelection( const OUString& rStr )
bModified = true;
}
void ScInputHandler::InputTurnOffWinEngine()
{
bInOwnChange = true; // disable ModifyHdl (reset below)
eMode = SC_INPUT_NONE;
/* TODO: it would be better if there was some way to reset the input bar
* engine instead of deleting and having it recreate through
* GetFuncEditView(), but first least invasively let this fix fdo#71667 and
* fdo#72278 without reintroducing fdo#69971. */
StopInputWinEngine(true);
bInOwnChange = false;
}
//========================================================================
// ScInputHdlState
//========================================================================

View File

@@ -1543,6 +1543,13 @@ void ScModule::InputReplaceSelection( const OUString& rStr )
pHdl->InputReplaceSelection( rStr );
}
void ScModule::InputTurnOffWinEngine()
{
ScInputHandler* pHdl = GetInputHdl();
if (pHdl)
pHdl->InputTurnOffWinEngine();
}
OUString ScModule::InputGetFormulaStr()
{
ScInputHandler* pHdl = GetInputHdl();

View File

@@ -623,7 +623,7 @@ void ScFormulaDlg::setCurrentFormula(const OUString& _sReplacement)
//ScMultiTextWnd::Paint a new editengine will have been created via
//GetEditView with its default Modification handler enabled. So ensure
//its off when we will access it via InputReplaceSelection
pScMod->InputEnterHandler();
pScMod->InputTurnOffWinEngine();
}
pScMod->InputReplaceSelection(_sReplacement);
}

View File

@@ -233,6 +233,7 @@ public:
void InputGetSelection ( sal_Int32& rStart, sal_Int32& rEnd );
void InputSetSelection ( sal_Int32 nStart, sal_Int32 nEnd );
void InputReplaceSelection ( const OUString& rStr );
void InputTurnOffWinEngine();
bool IsFormulaMode() const { return bFormulaMode; }
ScInputWindow* GetInputWindow() { return pInputWin; }