[Libreoffice-commits] core.git: shell/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue May 14 08:47:41 UTC 2019


 shell/source/win32/spsupp/COMOpenDocuments.cxx |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 430c352139b96c7f26b95d730dc19123869520ee
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue May 14 09:52:20 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue May 14 10:46:44 2019 +0200

    Implement OpenDocuments::PromptedOnLastOpen
    
    This prevents SharePoint from trying to download documents in browser
    after they were already opened by LibreOffice SharePoint integration
    ActiveX control.
    
    The implementation just returns true, to avoid instant refresh of the
    site in browser. TODO: fine-tune when understood when and why it makes
    sense to return false.
    
    Change-Id: I1ceae82db16ca8e418850fafd8c171ee6a2e039b
    Reviewed-on: https://gerrit.libreoffice.org/72266
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx
index 68940e016147..319cd8c1751a 100644
--- a/shell/source/win32/spsupp/COMOpenDocuments.cxx
+++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx
@@ -320,10 +320,23 @@ STDMETHODIMP COMOpenDocuments::CreateNewDocument2(
 // refreshes itself the next time it receives focus. One refresh can occur after the new document
 // is saved to the server
 STDMETHODIMP COMOpenDocuments::PromptedOnLastOpen(
-    VARIANT_BOOL* /*pbResult*/) // true if the security dialog box that appears when a document is opened has already appeared; otherwise false
+    VARIANT_BOOL* pbResult) // true if the security dialog box that appears when a document is opened has already appeared; otherwise false
 {
-    // TODO
-    return E_NOTIMPL;
+    // This method is used by SharePoint e.g. after calling ViewDocument3. Needs to be implemented,
+    // otherwise IE would show download bar ("Do you want to open Foo.xls?"), as if opening with
+    // LibreOffice failed, even if actually it succeeded.
+    if (!pbResult)
+        return E_POINTER;
+    // Returning true makes SharePoint library to refresh only when focused next time; false makes
+    // it refresh instantly. The JavaScript code involved is this:
+    //			var fRefreshOnNextFocus=stsOpen.PromptedOnLastOpen();
+    //			if (fRefreshOnNextFocus)
+    //				window.onfocus=RefreshOnNextFocus;
+    //			else
+    //				SetWindowRefreshOnFocus();
+    // It seems to be no reason to require immediate refresh, so just return true.
+    *pbResult = VARIANT_TRUE;
+    return S_OK;
 }
 
 // IOWSNewDocument3 methods


More information about the Libreoffice-commits mailing list