summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-12-02 16:18:02 +0100
committerAron Budea <aron.budea@collabora.com>2022-12-08 09:49:22 +0000
commit9785cebe4cfdc296143757da6098a74b0252c618 (patch)
tree0479bbc09cf0b36f632417100c8800be4fb50f77
parent321029dc9de8b2125fd272c116b3ce7c557be711 (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>
-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 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);