sc/source/ui/app/inputwin.cxx |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 1a6d250f34c63808552f783a31a315bc7d80ca93
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun May 28 12:07:38 2023 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun May 28 14:43:40 2023 +0200

    Resolves: tdf#155453 formatting lost when formula bar edited via IM
    
    do like we do for simple key strokes and forward to the ScModule
    InputHdl
    
    Change-Id: I2d99c23e8ac03b6de2498c6378a0dc5d11530248
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152351
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a85baa1ccca4..a3e8f0fd591b 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1709,7 +1709,19 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt )
 
         // Prevent that the EditView is lost when switching between Views
         pScMod->SetInEditCommand( true );
-        m_xEditView->Command( rCEvt );
+
+        // tdf#155453 send InputMethod events received by the InputBar through
+        // ScInputHandler so formatting in other views can be retained
+        bool bExtInput = nCommand == CommandEventId::StartExtTextInput ||
+                         nCommand == CommandEventId::ExtTextInput ||
+                         nCommand == CommandEventId::EndExtTextInput;
+
+        ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
+        if (bExtInput && pInputHdl)
+            pInputHdl->InputCommand(rCEvt);
+        else
+            m_xEditView->Command( rCEvt );
+
         pScMod->SetInEditCommand( false );
 
         //  CommandEventId::StartDrag does not mean by far that the content 
was actually changed,
@@ -1731,15 +1743,6 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt )
                 }
             }
         }
-        else if ( nCommand == CommandEventId::EndExtTextInput )
-        {
-            if (bFormulaMode)
-            {
-                ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
-                if (pHdl)
-                    pHdl->InputCommand(rCEvt);
-            }
-        }
         else if ( nCommand == CommandEventId::CursorPos )
         {
             //  don't call InputChanged for CommandEventId::CursorPos

Reply via email to