[Libreoffice-commits] core.git: sc/source

Nickson Thanda nicksonthanda10 at msn.com
Thu Jun 28 11:29:11 UTC 2018


 sc/source/ui/app/inputhdl.cxx |   31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

New commits:
commit 0e0ceebc0d6facf803ad089ef38d559355407c54
Author: Nickson Thanda <nicksonthanda10 at 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 <erack at redhat.com>

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


More information about the Libreoffice-commits mailing list