desktop/source/lib/init.cxx | 15 ++++++++++----- sc/source/ui/view/tabvwsha.cxx | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-)
New commits: commit 2d4e43ef8c6f563087330c180b18ef83a1fad207 Author: Gabriel Masei <[email protected]> AuthorDate: Wed Sep 2 19:22:23 2020 +0300 Commit: Jan Holesovsky <[email protected]> CommitDate: Mon Sep 21 16:57:35 2020 +0200 lok: remove .uno:ModifiedStatus message from deduplication mechanism This fixes the following issue in Online: When a save is performed while a cell is still edited the save icon does not reflect the correct state of the document: it shows that the document is dirty although it is not. This is generated by two facts: 1. The status cache is avoided when sending the -dirty- status right after the cell editing is finished. Because the cache has an old value of -false- for ModifiedStatus, the notification that is sent after saving, with -false- value, is ignored. We should not avoid the status cache. 2. Because there is a mechanism that keeps only the last notification value for a status change in the queue that keeps messages that were not sent yet (deduplication), the .uno:ModifiedStatus message with a value of -true- that is enqueued right after the cell edit is finished is replaced by the same message with a value of -false- that is enqueued after the save is finished. This happens if the flush mechanism doesn't occur between them. Change-Id: I3348bf230ba53a154c29e7d8ab064df7694adeae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103053 Reviewed-by: Gabriel Masei <[email protected]> Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index eaba422a3e4a..2dffed0204b5 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1584,11 +1584,16 @@ void CallbackFlushHandler::queue(const int type, const char* data) if (pos != std::string::npos) { const std::string name = payload.substr(0, pos + 1); - removeAll( - [type, &name] (const queue_type::value_type& elem) { - return (elem.Type == type) && (elem.PayloadString.compare(0, name.size(), name) == 0); - } - ); + // This is needed because otherwise it creates some problems when + // a save occurs while a cell is still edited in Calc. + if (name != ".uno:ModifiedStatus=") + { + removeAll( + [type, &name] (const queue_type::value_type& elem) { + return (elem.Type == type) && (elem.PayloadString.compare(0, name.size(), name) == 0); + } + ); + } } } break; diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index f527e539b62b..19ac69aec2d0 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -745,20 +745,25 @@ void ScTabViewShell::ExecuteSave( SfxRequest& rReq ) // Finish entering unless 'DontTerminateEdit' is specified, even if a formula is being processed if (bCommitChanges) { + SC_MOD()->InputEnterHandler(); + if (comphelper::LibreOfficeKit::isActive()) { // Normally this isn't needed, but in Calc when editing a cell formula // and manually saving (without changing cells or hitting enter), while // InputEnterHandler will mark the doc as modified (when it is), because // we will save the doc immediately afterwards, the modified state event - // is clobbered. To avoid that, we notify all views immediately of the - // modified state, apply the modification, then save the document. - ScInputHandler* pHdl = GetInputHandler(); - if (pHdl != nullptr && pHdl->GetModified()) - SfxLokHelper::notifyAllViews(LOK_CALLBACK_STATE_CHANGED, ".uno:ModifiedStatus=true"); + // is clobbered. To avoid that, we need to update SID_DOC_MODIFIED so that + // a possible state of "true" after "InputEnterHandler" will be sent + // as a notification. It is important that the notification goes through + // normal process (cache) rather than directly notifying the views. + // Otherwise, because there is a previous state of "false" in cache, the + // "false" state after saving will be ignored. + // This will work only if .uno:ModifiedStatus message will be removed from + // the mechanism that keeps in the message queue only last message of + // a particular status even if the values are different. + GetViewData().GetDocShell()->GetViewBindings()->Update(SID_DOC_MODIFIED); } - - SC_MOD()->InputEnterHandler(); } if ( GetViewData().GetDocShell()->IsDocShared() ) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
