framework/source/interaction/quietinteraction.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 879f73cf5181f92b582b9cd2a38a9cf27a9621ef
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Oct 19 19:21:29 2021 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Oct 20 12:36:53 2021 +0200

    framework: allow tests to run with read-only $SRCDIR
    
    SfxMedium constructor will call QuietInteraction::handle()
    which invokes abort(), so can't load any documents.
    
    (regression from commit 95eb088802562b75f8b299908160145c7e88d763)
    
    Change-Id: I7958ad30a06ffea299d70a9a8132eb9ffcf33f43
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123834
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit a86b0e83177f15320c4fe2906a0a02486ba60d49)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123850
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/framework/source/interaction/quietinteraction.cxx 
b/framework/source/interaction/quietinteraction.cxx
index b6f3495fff09..3719e00dc3ec 100644
--- a/framework/source/interaction/quietinteraction.cxx
+++ b/framework/source/interaction/quietinteraction.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/document/XInteractionFilterSelect.hpp>
 #include <com/sun/star/document/XInteractionFilterOptions.hpp>
 #include <com/sun/star/document/FilterOptionsRequest.hpp>
+#include <com/sun/star/document/ReadOnlyOpenRequest.hpp>
 #include <com/sun/star/task/ErrorCodeRequest.hpp>
 
 #include <com/sun/star/document/LockedDocumentRequest.hpp>
@@ -77,6 +78,7 @@ void SAL_CALL QuietInteraction::handle( const 
css::uno::Reference< css::task::XI
     css::task::ErrorCodeRequest          aErrorCodeRequest;
     css::document::LockedDocumentRequest aLockedDocumentRequest;
     css::document::FilterOptionsRequest  aFilterOptionsRequest;
+    css::document::ReadOnlyOpenRequest   aReadOnlyOpenRequest;
 
     if( aRequest >>= aErrorCodeRequest )
     {
@@ -109,6 +111,19 @@ void SAL_CALL QuietInteraction::handle( const 
css::uno::Reference< css::task::XI
         }
     }
     else
+    if (aRequest >>= aReadOnlyOpenRequest)
+    {
+        // allow unit tests to run on read-only SRCDIR
+        if (xApprove.is())
+        {
+            xApprove->select();
+        }
+        else if (xAbort.is())
+        {
+            xAbort->select();
+        }
+    }
+    else
     if (xAbort.is())
         xAbort->select();
 }

Reply via email to