summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/docshell/docsh.cxx60
-rw-r--r--sc/source/ui/inc/warnbox.hxx3
-rw-r--r--sc/source/ui/miscdlgs/warnbox.cxx16
3 files changed, 24 insertions, 55 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index ec9505da8840..e59ee43400e8 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -428,6 +428,19 @@ void processDataStream( ScDocShell& rShell, const sc::ImportPostProcessData& rDa
rMgr.setDataStream(pStrm);
}
+class MessageWithCheck : public weld::MessageDialogController
+{
+private:
+ std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
+public:
+ MessageWithCheck(weld::Window *pParent, const OUString& rUIFile, const OString& rDialogId)
+ : weld::MessageDialogController(pParent, rUIFile, rDialogId, "ask")
+ , m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
+ {
+ }
+ bool get_active() const { return m_xWarningOnBox->get_active(); }
+};
+
}
bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css::embed::XStorage >& xStor )
@@ -475,27 +488,14 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css
// full re-calculation.
vcl::Window* pWin = GetActiveDialogParent();
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr,
- "modules/scalc/ui/recalcquerydialog.ui"));
- std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("RecalcQueryDialog"));
- xQueryBox->set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
- xQueryBox->set_default_response(RET_YES);
- std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
-
- //fdo#75121, a bit tricky because the widgets we want to align with
- //don't actually exist in the ui description, they're implied
- std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
- std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area());
- xOrigParent->remove(xWarningOnBox.get());
- xContentArea->add(xWarningOnBox.get());
-
- bHardRecalc = xQueryBox->run() == RET_YES;
+ MessageWithCheck aQueryBox(pWin ? pWin->GetFrameWeld() : nullptr,
+ "modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog");
+ aQueryBox.set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
+ aQueryBox.set_default_response(RET_YES);
- //put them back as they were
- xContentArea->remove(xWarningOnBox.get());
- xOrigParent->add(xWarningOnBox.get());
+ bHardRecalc = aQueryBox.run() == RET_YES;
- if (xWarningOnBox->get_active())
+ if (aQueryBox.get_active())
{
// Always perform selected action in the future.
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
@@ -725,25 +725,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr,
- "modules/scalc/ui/sharedwarningdialog.ui"));
- std::unique_ptr<weld::MessageDialog> xWarningBox(xBuilder->weld_message_dialog("SharedWarningDialog"));
- std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
-
- //fdo#75121, a bit tricky because the widgets we want to align with
- //don't actually exist in the ui description, they're implied
- std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
- std::unique_ptr<weld::Container> xContentArea(xWarningBox->weld_message_area());
- xOrigParent->remove(xWarningOnBox.get());
- xContentArea->add(xWarningOnBox.get());
-
- xWarningBox->run();
-
- //put them back as they were
- xContentArea->remove(xWarningOnBox.get());
- xOrigParent->add(xWarningOnBox.get());
+ MessageWithCheck aWarningBox(pWin ? pWin->GetFrameWeld() : nullptr,
+ "modules/scalc/ui/sharedwarningdialog.ui", "SharedWarningDialog");
+ aWarningBox.run();
- bool bChecked = xWarningOnBox->get_active();
+ bool bChecked = aWarningBox.get_active();
if (bChecked)
{
aAppOptions.SetShowSharedDocumentWarning( !bChecked );
diff --git a/sc/source/ui/inc/warnbox.hxx b/sc/source/ui/inc/warnbox.hxx
index 54bdd269ebeb..02fea50e181a 100644
--- a/sc/source/ui/inc/warnbox.hxx
+++ b/sc/source/ui/inc/warnbox.hxx
@@ -27,11 +27,8 @@
class ScReplaceWarnBox : public weld::MessageDialogController
{
std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
- std::unique_ptr<weld::Container> m_xOrigParent;
- std::unique_ptr<weld::Container> m_xContentArea;
public:
ScReplaceWarnBox(weld::Window* pParent);
- virtual ~ScReplaceWarnBox() override;
/** Opens dialog if IsDialogEnabled() returns true.
@descr If after executing the dialog the checkbox "Do not show again" is set,
diff --git a/sc/source/ui/miscdlgs/warnbox.cxx b/sc/source/ui/miscdlgs/warnbox.cxx
index bc0302c4bcbd..279639c7996f 100644
--- a/sc/source/ui/miscdlgs/warnbox.cxx
+++ b/sc/source/ui/miscdlgs/warnbox.cxx
@@ -27,26 +27,12 @@
ScReplaceWarnBox::ScReplaceWarnBox(weld::Window* pParent)
: MessageDialogController(pParent, "modules/scalc/ui/checkwarningdialog.ui",
- "CheckWarningDialog")
+ "CheckWarningDialog", "ask")
// By default, the check box is ON, and the user needs to un-check it to
// disable all future warnings.
, m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
- , m_xOrigParent(m_xWarningOnBox->weld_parent())
- , m_xContentArea(m_xDialog->weld_message_area())
{
m_xDialog->set_default_response(RET_YES);
-
- //fdo#75121, a bit tricky because the widgets we want to align with
- //don't actually exist in the ui description, they're implied
- m_xOrigParent->remove(m_xWarningOnBox.get());
- m_xContentArea->add(m_xWarningOnBox.get());
-}
-
-ScReplaceWarnBox::~ScReplaceWarnBox()
-{
- //put them back as they were
- m_xContentArea->remove(m_xWarningOnBox.get());
- m_xOrigParent->add(m_xWarningOnBox.get());
}
short ScReplaceWarnBox::execute()