[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/source

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 15:08:28 UTC 2020


 sc/source/ui/app/inputhdl.cxx |   11 +++++++++++
 sc/source/ui/view/cellsh3.cxx |   16 ++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit af8258512eb7e58054c3d527c2af8aeaeb34364e
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jul 16 11:58:11 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Jun 4 17:07:54 2020 +0200

    LOK: Emit the doc. modified state even when changing the cell inline.
    
    The "LOK: emit modified status on entering cell data" patch did this
    only for the formula input line, and did not change the state when the
    user just clicked on the cell and started modifying it; so this patch
    extends it.
    
    Also change the actual DocumentModified state of the document directly
    instead of just sending a flag, so that the state in LOOLWSD and in the
    core don't get out of sync.
    
    Change-Id: Ie516ce5a74d94247d79cf993517d7f4a6657cc94
    Reviewed-on: https://gerrit.libreoffice.org/75701
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95517
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index b8d126c936b7..4ccdfa70b639 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2774,6 +2774,9 @@ void ScInputHandler::InvalidateAttribs()
         rBindings.Invalidate( SID_SET_SUB_SCRIPT );
         rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
         rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
+
+        rBindings.Invalidate( SID_SAVEDOC );
+        rBindings.Invalidate( SID_DOC_MODIFIED );
     }
 }
 
@@ -3776,6 +3779,14 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false
             // #i114511# don't count cursor keys as modification
             bool bSetModified = !bCursorKey;
             DataChanged(false, bSetModified); // also calls UpdateParenthesis()
+
+            // In the LOK case, we want to set the document modified state
+            // right away at the start of the edit, so that the content is
+            // saved even when the user leaves the document before hitting
+            // Enter
+            if (comphelper::LibreOfficeKit::isActive() && bSetModified && pActiveViewSh && !pActiveViewSh->GetViewData().GetDocShell()->IsModified())
+                pActiveViewSh->GetViewData().GetDocShell()->SetModified();
+
             InvalidateAttribs();        //! in DataChanged?
         }
     }
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 6b9b40cb075d..581ea4e85166 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -268,13 +268,17 @@ void ScCellShell::Execute( SfxRequest& rReq )
             {
                 if ( pReqArgs )
                 {
-                    if (comphelper::LibreOfficeKit::isActive())
+                    // In the LOK case, we want to set the document modified state
+                    // right away at the start of the edit, so that the content is
+                    // saved even when the user leaves the document before hitting
+                    // Enter
+                    // NOTE: This also means we want to set the modified state
+                    // regardless of the DontCommit parameter's value.
+                    if (comphelper::LibreOfficeKit::isActive() && !GetViewData()->GetDocShell()->IsModified())
                     {
-                        // Let the client know about our entry, so if they save
-                        // (say because the user closes the document or window,)
-                        // this change gets persisted (assuming DontTerminateEdit
-                        // is set to false in the .uno:Save command).
-                        SfxLokHelper::notifyAllViews(LOK_CALLBACK_STATE_CHANGED, ".uno:ModifiedStatus=true");
+                        GetViewData()->GetDocShell()->SetModified();
+                        rBindings.Invalidate(SID_SAVEDOC);
+                        rBindings.Invalidate(SID_DOC_MODIFIED);
                     }
 
                     OUString aStr( static_cast<const SfxStringItem&>(pReqArgs->


More information about the Libreoffice-commits mailing list