offapi/UnoApi_offapi.mk                        |    1 
 offapi/com/sun/star/task/ErrorCodeRequest2.idl |   42 +++++++++++++++++++++++++
 sfx2/source/doc/objmisc.cxx                    |    7 ++--
 sfx2/source/doc/sfxbasemodel.cxx               |    7 ++--
 uui/source/iahndl.cxx                          |   20 ++++++++---
 uui/source/iahndl.hxx                          |    2 -
 6 files changed, 67 insertions(+), 12 deletions(-)

New commits:
commit dd009cffc38a280d3b072ae4dc9ee9cda2e1f13f
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Oct 9 18:46:32 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Oct 9 22:13:18 2023 +0200

    tdf#157650 Unhelpful error when XML in content.xml is malformed
    
    regression from
        commit d9e322d60f65ff20631dab87baa5a2c7c71daaa2
        replace ErrorInfo with simpler mechanism
    we need to tunnel the necessary information through the uui stuff, so
    add a new Exception class to do that.
    
    Change-Id: Ie1fde486e8637b802340795348a5e5aad6a54e96
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157732
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 90753f08384e..eba803973aa5 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -3699,6 +3699,7 @@ $(eval $(call 
gb_UnoApi_add_idlfiles,offapi,com/sun/star/task,\
        DocumentPasswordRequest2 \
        ErrorCodeIOException \
        ErrorCodeRequest \
+       ErrorCodeRequest2 \
        InteractionClassification \
        MasterPasswordRequest \
        NoMasterException \
diff --git a/offapi/com/sun/star/task/ErrorCodeRequest2.idl 
b/offapi/com/sun/star/task/ErrorCodeRequest2.idl
new file mode 100644
index 000000000000..b11a61a3e72c
--- /dev/null
+++ b/offapi/com/sun/star/task/ErrorCodeRequest2.idl
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+ module com {  module sun {  module star {  module task {
+
+
+/** represents a general error exception.
+    It can be used to transport the error code information.
+    E.g. that can be useful for interactions.
+
+    This is designed to mesh with tools::ErrCodeMsg
+
+    @since LibreOffice 24.2
+ */
+exception ErrorCodeRequest2 : com::sun::star::task::ErrorCodeRequest
+{
+        string Arg1;
+        string Arg2;
+        short DialogMask;
+};
+
+
+}; }; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 123d234734f7..a8f39d06f492 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -48,7 +48,7 @@
 
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Any.h>
-#include <com/sun/star/task/ErrorCodeRequest.hpp>
+#include <com/sun/star/task/ErrorCodeRequest2.hpp>
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
@@ -1757,8 +1757,9 @@ bool SfxObjectShell::UseInteractionToHandleError(
                 pAbort, pApprove
             };
 
-            task::ErrorCodeRequest aErrorCode;
-            aErrorCode.ErrCode = sal_uInt32(nError.GetCode());
+            task::ErrorCodeRequest2 aErrorCode(OUString(), 
uno::Reference<XInterface>(),
+                sal_Int32(sal_uInt32(nError.GetCode())), nError.GetArg1(), 
nError.GetArg2(),
+                static_cast<sal_Int16>(nError.GetDialogMask()));
             aInteraction <<= aErrorCode;
             xHandler->handle(::framework::InteractionRequest::CreateRequest 
(aInteraction,lContinuations));
             bResult = pAbort->wasSelected();
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index b3d0d78b5e2a..f4b1f8305588 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -30,7 +30,7 @@
 #include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #include <com/sun/star/task/ErrorCodeIOException.hpp>
-#include <com/sun/star/task/ErrorCodeRequest.hpp>
+#include <com/sun/star/task/ErrorCodeRequest2.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <com/sun/star/view/XPrintJobListener.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
@@ -3220,8 +3220,9 @@ void SfxBaseModel::impl_store(  const   OUString&         
          sURL
                 // TODO/LATER: a general way to set the error context should 
be available
                 SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, 
m_pData->m_pObjectShell->GetTitle() );
 
-                task::ErrorCodeRequest aErrorCode;
-                aErrorCode.ErrCode = sal_uInt32(nErrCode.GetCode());
+                task::ErrorCodeRequest2 aErrorCode(OUString(), 
uno::Reference<XInterface>(),
+                    sal_Int32(sal_uInt32(nErrCode.GetCode())), 
nErrCode.GetArg1(), nErrCode.GetArg2(),
+                    static_cast<sal_Int16>(nErrCode.GetDialogMask()));
                 SfxMedium::CallApproveHandler( xHandler, Any( aErrorCode ), 
false );
             }
         }
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index bc6f12742b47..85c820bd3f1c 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -32,7 +32,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
 #include <com/sun/star/task/ErrorCodeIOException.hpp>
-#include <com/sun/star/task/ErrorCodeRequest.hpp>
+#include <com/sun/star/task/ErrorCodeRequest2.hpp>
 #include <com/sun/star/task/InteractionHandler.hpp>
 #include <com/sun/star/task/XInteractionAbort.hpp>
 #include <com/sun/star/task/XInteractionApprove.hpp>
@@ -710,6 +710,17 @@ UUIInteractionHelper::handleRequest_impl(
             return true;
         }
 
+        task::ErrorCodeRequest2 aErrorCodeRequest2;
+        if (aAnyRequest >>= aErrorCodeRequest2)
+        {
+            handleGenericErrorRequest(
+                    ErrCodeMsg(ErrCode(aErrorCodeRequest2.ErrCode), 
aErrorCodeRequest2.Arg1, aErrorCodeRequest2.Arg2, 
static_cast<DialogMask>(aErrorCodeRequest2.DialogMask)),
+                    rRequest->getContinuations(),
+                    bObtainErrorStringOnly,
+                    bHasErrorString,
+                    rErrorString);
+            return true;
+        }
         task::ErrorCodeRequest aErrorCodeRequest;
         if (aAnyRequest >>= aErrorCodeRequest)
         {
@@ -1047,7 +1058,7 @@ UUIInteractionHelper::handleNameClashResolveRequest(
 
 void
 UUIInteractionHelper::handleGenericErrorRequest(
-    ErrCode nErrorCode,
+    ErrCodeMsg nErrorCode,
     uno::Sequence< uno::Reference<
         task::XInteractionContinuation > > const & rContinuations,
     bool bObtainErrorStringOnly,
@@ -1073,10 +1084,9 @@ UUIInteractionHelper::handleGenericErrorRequest(
         // Note: It's important to convert the transported long to the
         // required  unsigned long value. Otherwise using as flag field
         // can fail ...
-        ErrCode  nError(nErrorCode);
-        bool bWarning = !nError.IgnoreWarning();
+        bool bWarning = !nErrorCode.IgnoreWarning();
 
-        if ( nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
+        if ( nErrorCode == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
         {
             // the security warning box needs a special title
             OUString aErrorString;
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index cf468f57dbcf..284fb685a902 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -190,7 +190,7 @@ private:
 
     void
     handleGenericErrorRequest(
-        ErrCode nErrorCode,
+        ErrCodeMsg nErrorCode,
         css::uno::Sequence<
             css::uno::Reference< css::task::XInteractionContinuation > > const 
&  rContinuations,
         bool bObtainErrorStringOnly,

Reply via email to