desktop/source/lib/lokinteractionhandler.cxx |   30 ++++++++++++++++++++++++---
 desktop/source/lib/lokinteractionhandler.hxx |    1 
 2 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 89783b2613fa410bddc4e9729ce455d2ded73d90
Author:     Andras Timar <[email protected]>
AuthorDate: Wed Mar 4 16:09:39 2026 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Mar 4 17:00:47 2026 +0100

    LOKInteractionHandler: handle FilterOptionsRequest directly
    
    Instead of falling back to the standard VCL interaction handler
    for FilterOptionsRequest (which shows the CSV import dialog that
    DialogCancelMode::LOKSilent then cancels, aborting the load),
    handle it directly by accepting the provided filter options — the
    same behavior QuietInteraction had before cb2ac5366d2b removed it
    from the LOK+Silent path.
    
    This lets CSV files load in batch/convert-to mode when
    FilterOptions are provided via the documentLoad options string.
    
    Change-Id: I8f3a2b7c4d1e5a9f0b2c6d8e3f7a4b1c5d9e2f6a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200944
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/desktop/source/lib/lokinteractionhandler.cxx 
b/desktop/source/lib/lokinteractionhandler.cxx
index 858793b856b9..c848f3bfe58c 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -42,6 +42,7 @@
 #include <com/sun/star/task/DocumentMSPasswordRequest2.hpp>
 
 #include <com/sun/star/document/FilterOptionsRequest.hpp>
+#include <com/sun/star/document/XInteractionFilterOptions.hpp>
 
 #include "../../inc/lib/init.hxx"
 
@@ -151,9 +152,6 @@ bool ShouldFallbackToStandard(const 
uno::Reference<task::XInteractionRequest>& x
     if (document::BrokenPackageRequest aStruct; request >>= aStruct)
         return true;
 
-    if (document::FilterOptionsRequest aStruct; request >>= aStruct)
-        return true;
-
     if (document::FontsDisallowEditingRequest aStruct; request >>= aStruct)
         return true;
 
@@ -371,6 +369,29 @@ bool LOKInteractionHandler::handlePasswordRequest(const 
uno::Sequence<uno::Refer
     return true;
 }
 
+bool LOKInteractionHandler::handleFilterOptionsRequest(
+        const uno::Sequence<uno::Reference<task::XInteractionContinuation>>& 
rContinuations,
+        const uno::Any& rRequest)
+{
+    document::FilterOptionsRequest aFilterOptionsRequest;
+    if (!(rRequest >>= aFilterOptionsRequest))
+        return false;
+
+    // Accept the provided/default filter options without showing a dialog,
+    // same as QuietInteraction did. This lets CSV files (and other formats
+    // that need import filter options) load in batch/silent mode.
+    for (auto const& cont : rContinuations)
+    {
+        uno::Reference<document::XInteractionFilterOptions> xFOptions(cont, 
uno::UNO_QUERY);
+        if (xFOptions.is())
+        {
+            xFOptions->select();
+            return true;
+        }
+    }
+    return false;
+}
+
 sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest(
         const uno::Reference<task::XInteractionRequest>& xRequest)
 {
@@ -386,6 +407,9 @@ sal_Bool SAL_CALL 
LOKInteractionHandler::handleInteractionRequest(
     if (handlePasswordRequest(aContinuations, request))
         return true;
 
+    if (handleFilterOptionsRequest(aContinuations, request))
+        return true;
+
     if (ShouldFallbackToStandard(xRequest))
         return FallbackToStandard(xRequest);
 
diff --git a/desktop/source/lib/lokinteractionhandler.hxx 
b/desktop/source/lib/lokinteractionhandler.hxx
index cb4345832aa3..aa9c05b1b36c 100644
--- a/desktop/source/lib/lokinteractionhandler.hxx
+++ b/desktop/source/lib/lokinteractionhandler.hxx
@@ -74,6 +74,7 @@ private:
     bool handleIOException(const 
css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> 
&rContinuations, const css::uno::Any& rRequest);
     bool handleNetworkException(const 
css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> 
&rContinuations, const css::uno::Any& rRequest);
     bool handlePasswordRequest(const 
css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> 
&rContinuations, const css::uno::Any& rRequest);
+    static bool handleFilterOptionsRequest(const 
css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> 
&rContinuations, const css::uno::Any& rRequest);
 
 public:
     void SetPassword(char const* pPassword);

Reply via email to