summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-08-22 16:11:02 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-04 17:57:13 +0200
commiteda6f4bab8cf7ea899c875581d47c96cf006f657 (patch)
treedd977f4b6a160dcb20df540ed2c7bf58450a5c3a
parent887ee9111f42847406c5ffc85a0ba635080de3de (diff)
Resolves: tdf#118799 use spelling/search dialog as message dialog parent
when visible Change-Id: Id4d6df2a85aebd6887949f285e1a5ec1046dbf64 Reviewed-on: https://gerrit.libreoffice.org/59456 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 50c9ed67d29d6105f3907cb7a2fe3322685af53c) Reviewed-on: https://gerrit.libreoffice.org/59975 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r--sd/inc/Outliner.hxx9
-rw-r--r--sd/source/ui/view/Outliner.cxx27
2 files changed, 16 insertions, 20 deletions
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx
index 672fd1ac4dbb..b1c0b7cfdfb6 100644
--- a/sd/inc/Outliner.hxx
+++ b/sd/inc/Outliner.hxx
@@ -521,12 +521,11 @@ private:
*/
virtual bool SpellNextDocument() override;
- /** Show the given message box and make it modal. It is assumed that
- the parent of the given dialog is NULL, i.e. the application
- window. This function makes sure that the otherwise non-modal
- search dialog, if visible, is locked, too.
+ /** Find the right parent to use for a message. This function makes sure
+ that the otherwise non-modal search or spell dialogs, if visible, are
+ locked, too.
*/
- sal_uInt16 ShowModalMessageBox(weld::MessageDialog& rMessageBox);
+ VclPtr<vcl::Window> GetMessageBoxParent();
};
#endif
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 1628d1c25693..efe694f06585 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1203,11 +1203,11 @@ void SdOutliner::ShowEndOfSearchDialog()
else
aString = SdResId(STR_END_SPELLING);
- // Show the message in an info box that is modal with respect to the
- // whole application.
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
+ // Show the message in an info box that is modal with respect to the whole application.
+ VclPtr<vcl::Window> xParent(GetMessageBoxParent());
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(xParent ? xParent->GetFrameWeld() : nullptr,
VclMessageType::Info, VclButtonsType::Ok, aString));
- ShowModalMessageBox(*xInfoBox.get());
+ xInfoBox->run();
}
bool SdOutliner::ShowWrapArroundDialog()
@@ -1245,9 +1245,10 @@ bool SdOutliner::ShowWrapArroundDialog()
// Pop up question box that asks the user whether to wrap around.
// The dialog is made modal with respect to the whole application.
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr,
+ VclPtr<vcl::Window> xParent(GetMessageBoxParent());
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(xParent ? xParent->GetFrameWeld() : nullptr,
VclMessageType::Question, VclButtonsType::YesNo, SdResId(pStringId)));
- sal_uInt16 nBoxResult = ShowModalMessageBox(*xQueryBox.get());
+ sal_uInt16 nBoxResult = xQueryBox->run();
return (nBoxResult == RET_YES);
}
@@ -1683,7 +1684,7 @@ bool SdOutliner::ConvertNextDocument()
return !mbEndOfSearch;
}
-sal_uInt16 SdOutliner::ShowModalMessageBox(weld::MessageDialog& rMessageBox)
+VclPtr<vcl::Window> SdOutliner::GetMessageBoxParent()
{
// We assume that the parent of the given message box is NULL, i.e. it is
// modal with respect to the top application window. However, this
@@ -1713,16 +1714,12 @@ sal_uInt16 SdOutliner::ShowModalMessageBox(weld::MessageDialog& rMessageBox)
if (pChildWindow != nullptr)
pSearchDialog = pChildWindow->GetWindow();
- if (pSearchDialog != nullptr)
- pSearchDialog->EnableInput(false);
- sal_uInt16 nResult = rMessageBox.run();
+ if (pSearchDialog)
+ return pSearchDialog;
- // Unlock the search dialog.
- if (pSearchDialog != nullptr)
- pSearchDialog->EnableInput();
-
- return nResult;
+ std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
+ return pViewShell->GetActiveWindow();
}
//===== SdOutliner::Implementation ==============================================