diff options
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 16 |
2 files changed, 21 insertions, 6 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 9fa0b7da23a4..d06e374d0366 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2756,6 +2756,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 ); } } @@ -3779,6 +3782,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 9158748a9c98..df42b593bc3d 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -266,13 +266,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-> |