summaryrefslogtreecommitdiff
path: root/sc/source/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-16 20:35:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-18 13:43:34 +0100
commit2fb266bb77722cd45af7346e99a8f214c3f8b198 (patch)
tree00901e9e800809ea30ab378be622446bb7804e46 /sc/source/filter
parent6709db941ff3257226f48212d2c36ee1b0d68200 (diff)
unify the message dialogs with extra widgets cases
Change-Id: I9ad3573b15d24c3d1737b9f450792952ae20a31b Reviewed-on: https://gerrit.libreoffice.org/51476 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/filter')
-rw-r--r--sc/source/filter/oox/workbookfragment.cxx37
1 files changed, 18 insertions, 19 deletions
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 7a57a2a04402..d1fef597ae2f 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -516,6 +516,19 @@ ScDocShell& getDocShell(const ScDocument& rDoc)
return static_cast<ScDocShell&>(*rDoc.GetDocumentShell());
}
+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(); }
+};
+
}
void WorkbookFragment::recalcFormulaCells()
@@ -534,27 +547,13 @@ void WorkbookFragment::recalcFormulaCells()
// Ask the user if full re-calculation is desired.
vcl::Window* pWin = ScDocShell::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_XLS));
- 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_XLS));
+ 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());