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-28 13:28:48 +0200
commit0e0ceebc0d6facf803ad089ef38d559355407c54 (patch)
treec856210da815f5cd98591ce4d41f59af85c822d6
parentb80207f5ac67ff585ce10f741803df12d3a308a7 (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>
-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 58b416fbb47c..d8ab78fe524e 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 )
@@ -2881,12 +2883,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();
@@ -2925,17 +2929,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