sc/source/ui/app/inputhdl.cxx |    7 +++++++
 sc/source/ui/inc/inputhdl.hxx |    2 ++
 2 files changed, 9 insertions(+)

New commits:
commit 0a3b5c428b7bdf7abc1d024d187f1107886bba0e
Author:     Laurent Balland <[email protected]>
AuthorDate: Sun Mar 23 09:14:25 2025 +0100
Commit:     Laurent Balland <[email protected]>
CommitDate: Sun Oct 12 19:11:02 2025 +0200

    tdf#104888 change mode to Matrix is a modification
    
    When editing a formula, changing mode from normal to matrix
    should be treated as a modification to enable recalculation.
    Other changes do not count.
    
    Change-Id: Ida903a1f21de5c33d6376af9120d2e0319b7b7ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183236
    Reviewed-by: Laurent Balland <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index a5d8669fcc45..ba1679b9a7e1 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2655,11 +2655,14 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, 
bool bFromCommand, bool bIn
 
             if (aStr.startsWith("{=") && aStr.endsWith("}") )  // Matrix 
formula?
             {
+                monPrevBlockMode = ScEnterMode::MATRIX;
                 aStr = aStr.copy(1, aStr.getLength() -2);
                 mpEditEngine->SetTextCurrentDefaults(aStr);
                 if ( pInputWin )
                     pInputWin->SetTextString(aStr, true);
             }
+            else
+                monPrevBlockMode = ScEnterMode::NORMAL;
 
             UpdateAdjust( cTyped );
 
@@ -3145,6 +3148,10 @@ void ScInputHandler::EnterHandler( ScEnterMode 
nBlockMode, bool bBeforeSavingInL
     bInEnterHandler = true;
     bInOwnChange = true; // disable ModifyHdl (reset below)
     mbPartialPrefix = false;
+    // tdf#104888: Normal mode => Matrix mode should be treated as a 
modification of the formula
+    if( !bModified && monPrevBlockMode && monPrevBlockMode.value() == 
ScEnterMode::NORMAL && nBlockMode == ScEnterMode::MATRIX )
+        bModified = true;
+    monPrevBlockMode.reset();
 
     ImplCreateEditEngine();
 
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index b1656c4c5656..bd3736ba7a0b 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -126,6 +126,8 @@ private:
 
     std::unique_ptr<ScRangeFindList>
                             pRangeFindList;
+    std::optional<ScEnterMode>
+                            monPrevBlockMode;
 
 private:
     void            UpdateActiveView();

Reply via email to