summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-12-02 16:18:02 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2023-01-03 06:36:09 +0000
commitac738382d63203965e13d3fe6f7745cdea95ea38 (patch)
tree450673002d83cd7c73a8607843d124c3e97fc3ff
parentcc487218ae05fd05265191253d44b098ea6ace5f (diff)
jsdialog: fix validation error dialog in Calc
Change-Id: Ie6551e386cd53f6b4bf4cceb6d7bd6170a2072ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143599 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Rashesh Padia <rashesh.padia@collabora.com> Reviewed-by: Aron Budea <aron.budea@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144951 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--cui/source/dialogs/scriptdlg.cxx3
-rw-r--r--include/vcl/svapp.hxx3
-rw-r--r--sc/inc/validat.hxx4
-rw-r--r--sc/source/core/data/validat.cxx11
-rw-r--r--sfx2/source/appl/app.cxx3
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx10
-rw-r--r--vcl/source/window/builder.cxx3
7 files changed, 22 insertions, 15 deletions
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index fc27b3fbf3b6..a2d798e80a78 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_CUISTR_ERROR_TITLE));
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 398358f1bfad..55d7aa87adf2 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1348,8 +1348,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 79eb9b75a334..f28da4a1c50b 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 79f21d8de202..08f77ad4f862 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -366,6 +366,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,
@@ -399,12 +404,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 3d3adb84bfe4..f225315d6ecd 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -413,8 +413,7 @@ IMPL_STATIC_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBas
pViewFrame ? pViewFrame->GetFrameWeld() : nullptr,
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 51566201638d..c7885c369249 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1175,11 +1175,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 82002d44f1d4..55c5fca696ad 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -212,8 +212,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);