summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNickson Thanda <nicksonthanda10@msn.com>2018-06-14 17:13:26 +0100
committerEike Rathke <erack@redhat.com>2018-06-29 12:13:27 +0200
commit828cea44d910d8f0e27519b4283c9038bcb022ac (patch)
tree799e909e3faf4b7f492958a64911b3ea9b39b4f7
parentdd8fe3e2e03e4de59e5359973c326146d5147b16 (diff)
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 <erack@redhat.com> (cherry picked from commit 0e0ceebc0d6facf803ad089ef38d559355407c54) Reviewed-on: https://gerrit.libreoffice.org/56590
-rw-r--r--sc/source/ui/app/inputhdl.cxx31
1 files changed, 22 insertions, 9 deletions
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