cui/source/dialogs/scriptdlg.cxx |    3 +--
 include/vcl/svapp.hxx            |    3 +--
 sc/inc/validat.hxx               |    4 ++++
 sc/source/core/data/validat.cxx  |   11 +++++++----
 sfx2/source/appl/app.cxx         |    3 +--
 vcl/jsdialog/jsdialogbuilder.cxx |   10 +++++++---
 vcl/source/window/builder.cxx    |    3 +--
 7 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 9785cebe4cfdc296143757da6098a74b0252c618
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Dec 2 16:18:02 2022 +0100
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Thu Dec 8 09:49:22 2022 +0000

    jsdialog: fix validation error dialog in Calc
    
    Change-Id: Ie6551e386cd53f6b4bf4cceb6d7bd6170a2072ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143599
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Rashesh Padia <rashesh.pa...@collabora.com>
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index acbdad7a1b16..32ea202c4dcd 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -1327,8 +1327,7 @@ IMPL_STATIC_LINK( SvxScriptErrorDialog, ShowDialog, 
void*, p, void )
             xData->pParent,
             VclMessageType::Warning,
             VclButtonsType::Ok,
-            message,
-            comphelper::LibreOfficeKit::isActive()));
+            message));
 
     xBox->set_title(CuiResId(RID_SVXSTR_ERROR_TITLE));
 
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 4762d1d64d57..d2c0113ea422 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1329,8 +1329,7 @@ public:
     static std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* 
pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 
nLOKWindowId = 0);
 
     static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, 
VclMessageType eMessageType,
-                                                    VclButtonsType 
eButtonType, const OUString& rPrimaryMessage,
-                                                    bool bMobile = false);
+                                                    VclButtonsType 
eButtonType, const OUString& rPrimaryMessage);
 
     static weld::Window* GetFrameWeld(const 
css::uno::Reference<css::awt::XWindow>& rWindow);
 
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index b0709dc0da14..9310a3804393 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -30,6 +30,8 @@ struct RefUpdateContext;
 
 }
 
+namespace vcl { class ILibreOfficeKitNotifier; }
+
 class ScPatternAttr;
 class ScTokenArray;
 class ScTypedStrData;
@@ -80,6 +82,8 @@ private:
 
     using ScConditionEntry::operator==;
 
+    DECL_STATIC_LINK(ScValidationData, InstallLOKNotifierHdl, void*, 
vcl::ILibreOfficeKitNotifier*);
+
 public:
             ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
                                 const OUString& rExpr1, const OUString& rExpr2,
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 78541960a11c..43ebb8faea58 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -367,6 +367,11 @@ void ScValidationData::DoCalcError( ScFormulaCell* pCell ) 
const
         DoMacro( pCell->aPos, OUString(), pCell, nullptr );
 }
 
+IMPL_STATIC_LINK_NOARG(ScValidationData, InstallLOKNotifierHdl, void*, 
vcl::ILibreOfficeKitNotifier*)
+{
+    return SfxViewShell::Current();
+}
+
     // true -> abort
 
 bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput,
@@ -400,12 +405,10 @@ bool ScValidationData::DoError(weld::Window* pParent, 
const OUString& rInput,
             break;
     }
 
-    bool bIsMobile = comphelper::LibreOfficeKit::isActive() && 
SfxViewShell::Current()
-                        && SfxViewShell::Current()->isLOKMobilePhone();
-
     std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(pParent, eType,
-                                              eStyle, aMessage, bIsMobile));
+                                              eStyle, aMessage));
     xBox->set_title(aTitle);
+    xBox->SetInstallLOKNotifierHdl(LINK(nullptr, ScValidationData, 
InstallLOKNotifierHdl));
 
     switch (eErrorStyle)
     {
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 42144afc33e8..aabdd2e83cce 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -424,8 +424,7 @@ IMPL_STATIC_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, 
StarBASIC*, pStarBas
                            pViewFrame->GetFrameWeld(),
                            VclMessageType::Error,
                            VclButtonsType::Ok,
-                           aError,
-                           true));
+                           aError));
 
             xBox->runAsync(xBox, [](sal_Int32 /*nResult*/) {});
         }
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index e28a4e5d9aee..45c0781e898b 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1177,11 +1177,15 @@ weld::MessageDialog* 
JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParen
 
         std::string sWindowId = 
std::to_string(xMessageDialog->GetLOKWindowId());
         InsertWindowToMap(sWindowId);
-    }
+        xMessageDialog->SetLOKTunnelingState(false);
 
-    xMessageDialog->SetLOKTunnelingState(false);
+        return new JSMessageDialog(xMessageDialog, nullptr, true);
+    }
+    else
+        SAL_WARN("vcl", "No notifier in 
JSInstanceBuilder::CreateMessageDialog");
 
-    return new JSMessageDialog(xMessageDialog, nullptr, true);
+    // fallback
+    return new SalInstanceMessageDialog(xMessageDialog, nullptr, true);
 }
 
 JSDialog::JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, 
SalInstanceBuilder* pBuilder,
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 813939b12222..024bb45663e2 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -208,8 +208,7 @@ std::unique_ptr<weld::Builder> 
Application::CreateInterimBuilder(vcl::Window* pP
 }
 
 weld::MessageDialog* Application::CreateMessageDialog(weld::Widget* pParent, 
VclMessageType eMessageType,
-                                                      VclButtonsType 
eButtonType, const OUString& rPrimaryMessage,
-                                                      bool /*bMobile*/)
+                                                      VclButtonsType 
eButtonType, const OUString& rPrimaryMessage)
 {
     if (comphelper::LibreOfficeKit::isActive())
         return JSInstanceBuilder::CreateMessageDialog(pParent, eMessageType, 
eButtonType, rPrimaryMessage);

Reply via email to