sc/source/ui/app/inputhdl.cxx | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
New commits: commit 828cea44d910d8f0e27519b4283c9038bcb022ac Author: Nickson Thanda <nicksonthand...@msn.com> Date: Thu Jun 14 17:13:26 2018 +0100 tdf#36867 - Undo autocapitalization when inserting a cell in Calc Change-Id: Ia70144d6c86b1b08e14425bf537e9c39d585a614 Reviewed-on: https://gerrit.libreoffice.org/55820 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 0e0ceebc0d6facf803ad089ef38d559355407c54) Reviewed-on: https://gerrit.libreoffice.org/56590 diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 54f6acb4bbeb..adb1c2437cac 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2628,6 +2628,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) bool bForget = false; // Remove due to validity? OUString aString = GetEditText(mpEditEngine.get()); + OUString aPreAutoCorrectString(aString); EditView* pActiveView = pTopView ? pTopView : pTableView; if (bModified && pActiveView && !aString.isEmpty() && !lcl_IsNumber(aString)) { @@ -2648,6 +2649,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) aString = GetEditText(mpEditEngine.get()); } lcl_RemoveTabs(aString); + lcl_RemoveTabs(aPreAutoCorrectString); // Test if valid (always with simple string) if ( bModified && nValidation && pActiveViewSh ) @@ -2871,12 +2873,14 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) if (bOldMod && !bProtected && !bForget) { + bool bInsertPreCorrectedString = true; // No typographic quotes in formulas if (aString.startsWith("=")) { SvxAutoCorrect* pAuto = SvxAutoCorrCfg::Get().GetAutoCorrect(); if ( pAuto ) { + bInsertPreCorrectedString = false; OUString aReplace(pAuto->GetStartDoubleQuote()); if( aReplace.isEmpty() ) aReplace = ScGlobal::pLocaleData->getDoubleQuotationMarkStart(); @@ -2915,17 +2919,26 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) else if ( nBlockMode == ScEnterMode::MATRIX ) nId = FID_INPUTLINE_MATRIX; - ScInputStatusItem aItem( FID_INPUTLINE_STATUS, - aCursorPos, aCursorPos, aCursorPos, - aString, pObject.get() ); - - if (!aMisspellRanges.empty()) - aItem.SetMisspellRanges(&aMisspellRanges); - const SfxPoolItem* aArgs[2]; - aArgs[0] = &aItem; aArgs[1] = nullptr; - rBindings.Execute( nId, aArgs ); + + if ( bInsertPreCorrectedString && aString != aPreAutoCorrectString ) + { + ScInputStatusItem aItem(FID_INPUTLINE_STATUS, + aCursorPos, aCursorPos, aCursorPos, + aPreAutoCorrectString, pObject.get()); + aArgs[0] = &aItem; + rBindings.Execute(nId, aArgs); + } + + ScInputStatusItem aItemCorrected(FID_INPUTLINE_STATUS, + aCursorPos, aCursorPos, aCursorPos, + aString, pObject.get()); + if ( !aMisspellRanges.empty() ) + aItemCorrected.SetMisspellRanges(&aMisspellRanges); + + aArgs[0] = &aItemCorrected; + rBindings.Execute(nId, aArgs); } pLastState.reset(); // pLastState still contains the old text _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits