desktop/source/lib/init.cxx |    5 +++++
 sfx2/source/doc/objmisc.cxx |   11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 44e79f02241fbc213462df03a37b621cb72f9d05
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Tue May 14 16:13:43 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue May 14 21:01:06 2024 +0200

    lok: get faster ModifiedStatus from the core.
    
    Gives a more responsive UI, closes a number of races, and helps us
    to make better decisions, more quickly on whether to save.
    
    Change-Id: I6e2548f06f715ba56ba75fd746273bdd57dc20dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167635
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3ae89cf84ba1..8edd138cc907 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5160,6 +5160,11 @@ void LibLibreOffice_Impl::dumpState(rtl::OStringBuffer 
&rState)
     rState.append(static_cast<sal_Int64>(mOptionalFeatures), 16);
     rState.append("
        CallbackData:   0x");
     rState.append(reinterpret_cast<sal_Int64>(mpCallback), 16);
+    rState.append("
        IsModified:     ");
+    if (SfxObjectShell::Current())
+        rState.append(SfxObjectShell::Current()->IsModified() ? "modified" : 
"unmodified");
+    else
+        rState.append("noshell");
     // TODO: dump mInteractionMap
     SfxLokHelper::dumpState(rState);
     vcl::lok::dumpState(rState);
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index e5a69d717657..ef7eed6b90fc 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -51,6 +51,7 @@
 #include <com/sun/star/task/ErrorCodeRequest2.hpp>
 
 #include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 
@@ -102,6 +103,7 @@
 #include <workwin.hxx>
 #include <sfx2/sfxdlg.hxx>
 #include <sfx2/infobar.hxx>
+#include <sfx2/lokhelper.hxx>
 #include <sfx2/sfxbasemodel.hxx>
 #include <openflag.hxx>
 #include "objstor.hxx"
@@ -325,7 +327,6 @@ void SfxObjectShell::ModifyChanged()
         // SetModified dispose of the models!
         return;
 
-
     SfxViewFrame* pViewFrame = SfxViewFrame::Current();
     if ( pViewFrame )
         pViewFrame->GetBindings().Invalidate( SID_SAVEDOCS );
@@ -335,6 +336,14 @@ void SfxObjectShell::ModifyChanged()
     Broadcast( SfxHint( SfxHintId::TitleChanged ) );    // xmlsec05, signed 
state might change in title...
 
     SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::ModifyChanged, 
GlobalEventConfig::GetEventName(GlobalEventId::MODIFYCHANGED), this ) );
+
+    // Don't wait to get this important state via binding notification timeout.
+    if ( comphelper::LibreOfficeKit::isActive() )
+    {
+        OString aStatus = ".uno:ModifiedStatus="_ostr;
+        aStatus += IsModified() ? "true" : "false";
+        SfxLokHelper::notifyAllViews(LOK_CALLBACK_STATE_CHANGED, aStatus);
+    }
 }
 
 

Reply via email to