summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-26 16:53:37 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-27 11:22:49 +0100
commit082e69fefb7439fd4f3d543f0c402039e94c1e9c (patch)
tree8348cacdc54a15dae722b93fc198995756924fc0 /basctl
parentf41a08183504a59d6ffc7a00ed7f24e6b19995ab (diff)
convert various MessBox to weld::MessageDialog
Change-Id: I4d2d0393c753114aeb9bb7e646dfdc810f6caa38 Reviewed-on: https://gerrit.libreoffice.org/50398 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 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx2
-rw-r--r--basctl/source/basicide/baside3.cxx84
-rw-r--r--basctl/source/inc/baside3.hxx2
-rw-r--r--basctl/source/inc/basidesh.hxx2
4 files changed, 38 insertions, 52 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 23bc4f2483ca..f27cff062a77 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -491,7 +491,7 @@ void ModulWindow::ImportDialog()
{
const ScriptDocument& rDocument = GetDocument();
OUString aLibName = GetLibName();
- implImportDialog( this, m_sCurPath, rDocument, aLibName );
+ implImportDialog(GetFrameWeld(), m_sCurPath, rDocument, aLibName);
}
void ModulWindow::ToggleBreakPoint( sal_uLong nLine )
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 322097b38105..4ea41cba9036 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -50,7 +50,6 @@
#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
#include <vcl/weld.hxx>
-#include <vcl/msgbox.hxx>
#include <vcl/settings.hxx>
#include <xmlscript/xmldlg_imexp.hxx>
@@ -782,56 +781,44 @@ std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq
}
-class NameClashQueryBox : public MessBox
+class NameClashQueryBox
{
+private:
+ std::unique_ptr<weld::MessageDialog> m_xQueryBox;
public:
- NameClashQueryBox( vcl::Window* pParent,
- const OUString& rTitle, const OUString& rMessage );
+ NameClashQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage)
+ : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage))
+ {
+ if (!rTitle.isEmpty())
+ m_xQueryBox->set_title(rTitle);
+ m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_RENAME), RET_YES);
+ m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO);
+ m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+ m_xQueryBox->set_default_response(RET_YES);
+ }
+ short run() { return m_xQueryBox->run(); }
};
-NameClashQueryBox::NameClashQueryBox( vcl::Window* pParent,
- const OUString& rTitle, const OUString& rMessage )
- : MessBox( pParent, MessBoxStyle::NONE, 0, rTitle, rMessage )
-{
- if ( !rTitle.isEmpty() )
- SetText( rTitle );
-
- maMessText = rMessage;
-
- AddButton( IDEResId(RID_STR_DLGIMP_CLASH_RENAME), RET_YES,
- ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus );
- AddButton( IDEResId(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO );
- AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
-
- SetImage(GetStandardQueryBoxImage());
-}
-
-
-class LanguageMismatchQueryBox : public MessBox
+class LanguageMismatchQueryBox
{
+private:
+ std::unique_ptr<weld::MessageDialog> m_xQueryBox;
public:
- LanguageMismatchQueryBox( vcl::Window* pParent,
- const OUString& rTitle, const OUString& rMessage );
+ LanguageMismatchQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage)
+ : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage))
+ {
+ if (!rTitle.isEmpty())
+ m_xQueryBox->set_title(rTitle);
+ m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_ADD), RET_YES);
+ m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_OMIT), RET_NO);
+ m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+ m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Help), RET_HELP);
+ m_xQueryBox->set_default_response(RET_YES);
+ }
+ short run() { return m_xQueryBox->run(); }
};
-LanguageMismatchQueryBox::LanguageMismatchQueryBox( vcl::Window* pParent,
- const OUString& rTitle, const OUString& rMessage )
- : MessBox( pParent, MessBoxStyle::NONE, 0, rTitle, rMessage )
-{
- if ( !rTitle.isEmpty() )
- SetText( rTitle );
-
- maMessText = rMessage;
- AddButton( IDEResId(RID_STR_DLGIMP_MISMATCH_ADD), RET_YES,
- ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus );
- AddButton( IDEResId(RID_STR_DLGIMP_MISMATCH_OMIT), RET_NO );
- AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel );
- AddButton( StandardButtonType::Help, RET_HELP, ButtonDialogFlags::Help, 4 );
-
- SetImage(GetStandardQueryBoxImage() );
-}
-
-bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName )
+bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName)
{
bool bDone = false;
@@ -914,8 +901,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_CLASH_TEXT));
aQueryBoxText = aQueryBoxText.replaceAll("$(ARG1)", aXmlDlgName);
- ScopedVclPtrInstance< NameClashQueryBox > aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- sal_uInt16 nRet = aQueryBox->Execute();
+ NameClashQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText);
+ sal_uInt16 nRet = aQueryBox.run();
if( nRet == RET_YES )
{
// RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
@@ -975,8 +962,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
{
OUString aQueryBoxTitle(IDEResId(RID_STR_DLGIMP_MISMATCH_TITLE));
OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_MISMATCH_TEXT));
- ScopedVclPtrInstance< LanguageMismatchQueryBox > aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- sal_uInt16 nRet = aQueryBox->Execute();
+ LanguageMismatchQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText);
+ sal_uInt16 nRet = aQueryBox.run();
if( nRet == RET_YES )
{
// RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
@@ -1117,12 +1104,11 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
return bDone;
}
-
void DialogWindow::ImportDialog()
{
const ScriptDocument& rDocument = GetDocument();
OUString aLibName = GetLibName();
- implImportDialog( this, m_sCurPath, rDocument, aLibName );
+ implImportDialog(GetFrameWeld(), m_sCurPath, rDocument, aLibName);
}
DlgEdModel& DialogWindow::GetModel() const
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index 5062e8050751..c553466268c8 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -49,7 +49,7 @@ class DlgEdView;
class DialogWindowLayout;
class ObjectCatalog;
-bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName );
+bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& rLibName);
class DialogWindow: public BaseWindow
{
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 6e5aa6f5185e..0362ad0bbcea 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -59,7 +59,7 @@ public:
private:
friend class JavaDebuggingListenerImpl;
friend class LocalizationMgr;
- friend bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ); // defined in baside3.cxx
+ friend bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& rLibName); // defined in baside3.cxx
WindowTable aWindowTable;
sal_uInt16 nCurKey;