summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-19 16:33:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-22 22:07:38 +0100
commit6a4c464b49dbfa2801818ead1b50bc9580824d00 (patch)
tree3d6381b6b13576bc536670992b36784436486e95 /basctl
parentf7733528e88a6619f82b54b59e92a9bca72c0a89 (diff)
weld native message dialogs
just the straight-forward MessageDialog cases first a) remove border_width from message dialog .ui so as to take the default border width b) retain 12 as default message dialog border for vcl widget case c) remove layour_style from message dialog button boxes so as to take the default mode (a no-op for vcl widget case) d) use gtk response ids (vcl builder will converts to vcl ones) Change-Id: I7de281093a1b64f92f71ca11e7cbba42bb658154 Reviewed-on: https://gerrit.libreoffice.org/50143 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.cxx21
-rw-r--r--basctl/source/basicide/baside3.cxx12
-rw-r--r--basctl/source/basicide/basides1.cxx3
-rw-r--r--basctl/source/basicide/basobj2.cxx17
-rw-r--r--basctl/source/basicide/basobj3.cxx14
-rw-r--r--basctl/source/basicide/bastypes.cxx30
-rw-r--r--basctl/source/basicide/macrodlg.cxx20
-rw-r--r--basctl/source/basicide/moduldl2.cxx62
-rw-r--r--basctl/source/basicide/moduldlg.cxx22
-rw-r--r--basctl/source/dlged/managelang.cxx7
-rw-r--r--basctl/source/dlged/propbrw.cxx4
-rw-r--r--basctl/source/inc/basobj.hxx7
-rw-r--r--basctl/source/inc/bastypes.hxx15
-rw-r--r--basctl/uiconfig/basicide/ui/deletelangdialog.ui2
14 files changed, 156 insertions, 80 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 7edd29b9bbb7..23bc4f2483ca 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -48,8 +48,9 @@
#include <svl/visitem.hxx>
#include <svl/whiter.hxx>
#include <svx/svxids.hrc>
-#include <vcl/xtextedt.hxx>
#include <vcl/settings.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/xtextedt.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <cassert>
@@ -301,7 +302,9 @@ void ModulWindow::BasicExecute()
{
if ( !aDocument.allowMacros() )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_CANNOTRUNMACRO), VclMessageType::Warning)->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_CANNOTRUNMACRO)));
+ xBox->run();
return;
}
}
@@ -431,7 +434,11 @@ void ModulWindow::LoadBasic()
ErrorHandler::HandleError( nError );
}
else
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_COULDNTREAD))->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_COULDNTREAD)));
+ xBox->run();
+ }
}
}
@@ -472,7 +479,11 @@ void ModulWindow::SaveBasicSource()
ErrorHandler::HandleError( nError );
}
else
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_COULDNTWRITE))->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_COULDNTWRITE)));
+ xErrorBox->run();
+ }
}
}
@@ -989,7 +1000,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
break;
case SID_BASICIDE_DELETECURRENT:
{
- if (QueryDelModule(m_aName, this))
+ if (QueryDelModule(m_aName, GetFrameWeld()))
if (m_aDocument.removeModule(m_aLibName, m_aName))
MarkDocumentModified(m_aDocument);
}
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 5b705b15f2c4..fa23eca1a822 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -49,7 +49,7 @@
#include <svx/svxids.hrc>
#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/settings.hxx>
#include <xmlscript/xmldlg_imexp.hxx>
@@ -534,7 +534,7 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq )
break;
case SID_BASICIDE_DELETECURRENT:
- if (QueryDelDialog(m_aName, this))
+ if (QueryDelDialog(m_aName, GetFrameWeld()))
{
if (RemoveDialog(m_aDocument, m_aLibName, m_aName))
{
@@ -571,7 +571,7 @@ Reference< container::XNameContainer > const & DialogWindow::GetDialog() const
bool DialogWindow::RenameDialog( const OUString& rNewName )
{
- if ( !basctl::RenameDialog( this, GetDocument(), GetLibName(), GetName(), rNewName ) )
+ if (!basctl::RenameDialog(GetFrameWeld(), GetDocument(), GetLibName(), GetName(), rNewName))
return false;
if (SfxBindings* pBindings = GetBindingsPtr())
@@ -739,7 +739,11 @@ void DialogWindow::SaveDialog()
}
}
else
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_COULDNTWRITE))->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_COULDNTWRITE)));
+ xBox->run();
+ }
}
}
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index b78f9138bf32..32969aaf594a 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -49,6 +49,7 @@
#include <svl/whiter.hxx>
#include <vcl/xtextedt.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/weld.hxx>
namespace basctl
{
@@ -358,7 +359,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
OUString aLibName = pModWin->GetLibName();
ScriptDocument aDocument( pWin->GetDocument() );
- if (RenameModule(pModWin, aDocument, aLibName, aOldName, aNewName))
+ if (RenameModule(pModWin->GetFrameWeld(), aDocument, aLibName, aOldName, aNewName))
{
bRenameOk = true;
// Because we listen for container events for script
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 72c6b250853a..1b64d85aac28 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -30,6 +30,7 @@
#include <framework/documentundoguard.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/moduleoptions.hxx>
+#include <vcl/weld.hxx>
#include <memory>
#include <vector>
@@ -137,7 +138,7 @@ Sequence< OUString > GetMergedLibraryNames( const Reference< script::XLibraryCon
}
bool RenameModule (
- vcl::Window* pErrorParent,
+ weld::Widget* pErrorParent,
const ScriptDocument& rDocument,
const OUString& rLibName,
const OUString& rOldName,
@@ -152,16 +153,18 @@ bool RenameModule (
if ( rDocument.hasModule( rLibName, rNewName ) )
{
- ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDEResId(RID_STR_SBXNAMEALLREADYUSED2));
- aError->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(pErrorParent,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED2)));
+ xError->run();
return false;
}
// #i74440
if ( rNewName.isEmpty() )
{
- ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDEResId(RID_STR_BADSBXNAME));
- aError->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(pErrorParent,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xError->run();
return false;
}
@@ -325,7 +328,9 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
{
// error
bError = true;
- ScopedVclPtrInstance<MessageDialog>(nullptr, IDEResId(RID_STR_ERRORCHOOSEMACRO))->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_ERRORCHOOSEMACRO)));
+ xError->run();
}
}
}
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index 7043bba6110a..77b0e8829f1d 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <basic/basmgr.hxx>
#include <basic/sbmeth.hxx>
#include <unotools/moduleoptions.hxx>
@@ -128,7 +128,7 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName )
}
bool RenameDialog (
- vcl::Window* pErrorParent,
+ weld::Widget* pErrorParent,
ScriptDocument const& rDocument,
OUString const& rLibName,
OUString const& rOldName,
@@ -143,16 +143,18 @@ bool RenameDialog (
if ( rDocument.hasDialog( rLibName, rNewName ) )
{
- ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDEResId(RID_STR_SBXNAMEALLREADYUSED2));
- aError->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(pErrorParent,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED2)));
+ xError->run();
return false;
}
// #i74440
if ( rNewName.isEmpty() )
{
- ScopedVclPtrInstance< MessageDialog > aError(pErrorParent, IDEResId(RID_STR_BADSBXNAME));
- aError->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(pErrorParent,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xError->run();
return false;
}
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 5e6cf568f1dd..f8332d8a4243 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -32,6 +32,7 @@
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
#include <svl/srchdefs.hxx>
+#include <vcl/weld.hxx>
namespace basctl
{
@@ -477,7 +478,11 @@ TabBarAllowRenamingReturnCode TabBar::AllowRenaming()
bool const bValid = IsValidSbxName(GetEditText());
if ( !bValid )
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_BADSBXNAME))->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xError->run();
+ }
return bValid ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO;
}
@@ -706,37 +711,38 @@ LibInfo::Item::Item (
LibInfo::Item::~Item ()
{ }
-bool QueryDel(const OUString& rName, const OUString &rStr, vcl::Window* pParent)
+bool QueryDel(const OUString& rName, const OUString &rStr, weld::Widget* pParent)
{
OUStringBuffer aNameBuf( rName );
aNameBuf.append('\'');
aNameBuf.insert(0, '\'');
OUString aQuery = rStr.replaceAll("XX", aNameBuf.makeStringAndClear());
- ScopedVclPtrInstance< MessageDialog > aQueryBox(pParent, aQuery, VclMessageType::Question, VclButtonsType::YesNo);
- return ( aQueryBox->Execute() == RET_YES );
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pParent,
+ VclMessageType::Question, VclButtonsType::YesNo, aQuery));
+ return (xQueryBox->run() == RET_YES);
}
-bool QueryDelMacro( const OUString& rName, vcl::Window* pParent )
+bool QueryDelMacro( const OUString& rName, weld::Widget* pParent )
{
return QueryDel( rName, IDEResId( RID_STR_QUERYDELMACRO ), pParent );
}
-bool QueryReplaceMacro( const OUString& rName, vcl::Window* pParent )
+bool QueryReplaceMacro( const OUString& rName, weld::Widget* pParent )
{
return QueryDel( rName, IDEResId( RID_STR_QUERYREPLACEMACRO ), pParent );
}
-bool QueryDelDialog( const OUString& rName, vcl::Window* pParent )
+bool QueryDelDialog( const OUString& rName, weld::Widget* pParent )
{
return QueryDel( rName, IDEResId( RID_STR_QUERYDELDIALOG ), pParent );
}
-bool QueryDelLib( const OUString& rName, bool bRef, vcl::Window* pParent )
+bool QueryDelLib( const OUString& rName, bool bRef, weld::Widget* pParent )
{
return QueryDel( rName, IDEResId( bRef ? RID_STR_QUERYDELLIBREF : RID_STR_QUERYDELLIB ), pParent );
}
-bool QueryDelModule( const OUString& rName, vcl::Window* pParent )
+bool QueryDelModule( const OUString& rName, weld::Widget* pParent )
{
return QueryDel( rName, IDEResId( RID_STR_QUERYDELMODULE ), pParent );
}
@@ -777,8 +783,10 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
if ( !bOK )
{
- ScopedVclPtrInstance< MessageDialog > aErrorBox(Application::GetDefDialogParent(), IDEResId(RID_STR_WRONGPASSWORD));
- aErrorBox->Execute();
+ vcl::Window* pParent = Application::GetDefDialogParent();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_WRONGPASSWORD)));
+ xErrorBox->run();
}
}
}
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 9bb61bc870f0..fda0bd567051 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -33,7 +33,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/minfitem.hxx>
#include <sfx2/request.hxx>
-
+#include <vcl/weld.hxx>
#include <map>
@@ -280,7 +280,7 @@ void MacroChooser::DeleteMacro()
{
SbMethod* pMethod = GetMacro();
DBG_ASSERT( pMethod, "DeleteMacro: No Macro !" );
- if ( pMethod && QueryDelMacro( pMethod->GetName(), this ) )
+ if (pMethod && QueryDelMacro(pMethod->GetName(), GetFrameWeld()))
{
if (SfxDispatcher* pDispatcher = GetDispatcher())
pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES );
@@ -465,7 +465,7 @@ IMPL_LINK_NOARG(MacroChooser, MacroDoubleClickHdl, SvTreeListBox*, bool)
if (nMode == Recording)
{
SbMethod* pMethod = GetMacro();
- if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) )
+ if (pMethod && !QueryReplaceMacro(pMethod->GetName(), GetFrameWeld()))
return false;
}
@@ -612,7 +612,9 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
if ( aDocument.isDocument() && !aDocument.allowMacros() )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_CANNOTRUNMACRO), VclMessageType::Warning)->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_CANNOTRUNMACRO)));
+ xError->run();
return;
}
}
@@ -621,14 +623,16 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
{
if ( !IsValidSbxName(m_pMacroNameEdit->GetText()) )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_BADSBXNAME))->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xError->run();
m_pMacroNameEdit->SetSelection( Selection( 0, m_pMacroNameEdit->GetText().getLength() ) );
m_pMacroNameEdit->GrabFocus();
return;
}
SbMethod* pMethod = GetMacro();
- if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) )
+ if (pMethod && !QueryReplaceMacro(pMethod->GetName(), GetFrameWeld()))
return;
}
@@ -694,7 +698,9 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton, void )
{
if ( !IsValidSbxName(m_pMacroNameEdit->GetText()) )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_BADSBXNAME))->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xError->run();
m_pMacroNameEdit->SetSelection( Selection( 0, m_pMacroNameEdit->GetText().getLength() ) );
m_pMacroNameEdit->GrabFocus();
return;
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index d563ddcb7cf8..d2fcf703cc2f 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -37,6 +37,7 @@
#include <svtools/svlbitm.hxx>
#include <svtools/treelistentry.hxx>
#include <vcl/builderfactory.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/io/Pipe.hpp>
#include <com/sun/star/ui/dialogs/FilePicker.hpp>
@@ -265,7 +266,9 @@ bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
OUString aLibName = GetEntryText( pEntry, 0 );
if ( aLibName.equalsIgnoreAsciiCase( "Standard" ) )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_CANNOTCHANGENAMESTDLIB))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_CANNOTCHANGENAMESTDLIB)));
+ xErrorBox->run();
return false;
}
@@ -275,7 +278,9 @@ bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) && !xModLibContainer->isLibraryLink( aLibName ) ) ||
( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_LIBISREADONLY))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_LIBISREADONLY)));
+ xErrorBox->run();
return false;
}
@@ -325,7 +330,9 @@ bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewName )
}
catch (const container::ElementExistException& )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_SBXNAMEALLREADYUSED))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED)));
+ xErrorBox->run();
return false;
}
catch (const container::NoSuchElementException& )
@@ -337,10 +344,11 @@ bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewName )
if ( !bValid )
{
- if ( rNewName.getLength() > 30 )
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_LIBNAMETOLONG))->Execute();
- else
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_BADSBXNAME))->Execute();
+ OUString sWarning(rNewName.getLength() > 30 ? IDEResId(RID_STR_LIBNAMETOLONG) : IDEResId(RID_STR_BADSBXNAME));
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, sWarning));
+ xErrorBox->run();
+
}
return bValid;
@@ -353,7 +361,9 @@ IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler, Button*, void)
EndDialog(1);
else
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_BADSBXNAME))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xErrorBox->run();
m_pEdit->GrabFocus();
}
}
@@ -840,7 +850,11 @@ void LibPage::InsertLib()
}
if ( !pLibDlg )
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_NOLIBINSTORAGE), VclMessageType::Info)->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_NOLIBINSTORAGE)));
+ xErrorBox->run();
+ }
else
{
bool bChanges = false;
@@ -877,7 +891,9 @@ void LibPage::InsertLib()
// check, if the library is the Standard library
if ( aLibName == "Standard" )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_REPLACESTDLIB))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_REPLACESTDLIB)));
+ xErrorBox->run();
continue;
}
@@ -887,7 +903,9 @@ void LibPage::InsertLib()
{
OUString aErrStr( IDEResId(RID_STR_REPLACELIB) );
aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" + IDEResId(RID_STR_LIBISREADONLY);
- ScopedVclPtrInstance<MessageDialog>(this, aErrStr)->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
+ xErrorBox->run();
continue;
}
@@ -902,7 +920,9 @@ void LibPage::InsertLib()
else
aErrStr = IDEResId(RID_STR_IMPORTNOTPOSSIBLE);
aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" +IDEResId(RID_STR_SBXNAMEALLREADYUSED);
- ScopedVclPtrInstance<MessageDialog>(this, aErrStr)->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
+ xErrorBox->run();
continue;
}
}
@@ -921,7 +941,9 @@ void LibPage::InsertLib()
{
OUString aErrStr( IDEResId(RID_STR_NOIMPORT) );
aErrStr = aErrStr.replaceAll("XX", aLibName);
- ScopedVclPtrInstance<MessageDialog>(this, aErrStr)->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
+ xErrorBox->run();
continue;
}
}
@@ -1337,7 +1359,7 @@ void LibPage::DeleteCurrent()
bIsLibraryLink = true;
}
- if ( QueryDelLib( aLibName, bIsLibraryLink, this ) )
+ if (QueryDelLib(aLibName, bIsLibraryLink, GetFrameWeld()))
{
// inform BasicIDE
SfxUnoAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, Any( m_aCurDocument.getDocumentOrNull() ) );
@@ -1488,15 +1510,21 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
if ( aLibName.getLength() > 30 )
{
- ScopedVclPtrInstance<MessageDialog>(pWin, IDEResId(RID_STR_LIBNAMETOLONG))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_LIBNAMETOLONG)));
+ xErrorBox->run();
}
else if ( !IsValidSbxName( aLibName ) )
{
- ScopedVclPtrInstance<MessageDialog>(pWin, IDEResId(RID_STR_BADSBXNAME))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xErrorBox->run();
}
else if ( rDocument.hasLibrary( E_SCRIPTS, aLibName ) || rDocument.hasLibrary( E_DIALOGS, aLibName ) )
{
- ScopedVclPtrInstance<MessageDialog>(pWin, IDEResId(RID_STR_SBXNAMEALLREADYUSED2))->Execute();
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED2)));
+ xErrorBox->run();
}
else
{
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 421a10edc9e9..d0abbe481951 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -35,6 +35,7 @@
#include <sfx2/request.hxx>
#include <svl/stritem.hxx>
#include <vcl/builderfactory.hxx>
+#include <vcl/weld.hxx>
#include <tools/diagnose_ex.h>
#include <xmlscript/xmldlg_imexp.hxx>
#include <svtools/treelistentry.hxx>
@@ -86,7 +87,9 @@ bool ExtTreeListBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewT
{
if ( !IsValidSbxName(rNewText) )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_BADSBXNAME))->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_BADSBXNAME)));
+ xError->run();
return false;
}
@@ -104,8 +107,8 @@ bool ExtTreeListBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewT
EntryType eType = aDesc.GetType();
bool bSuccess = eType == OBJ_TYPE_MODULE ?
- RenameModule(this, aDocument, aLibName, aCurText, rNewText) :
- RenameDialog(this, aDocument, aLibName, aCurText, rNewText);
+ RenameModule(GetFrameWeld(), aDocument, aLibName, aCurText, rNewText) :
+ RenameDialog(GetFrameWeld(), aDocument, aLibName, aCurText, rNewText);
if ( !bSuccess )
return false;
@@ -824,7 +827,9 @@ void ObjectPage::NewDialog()
if ( aDocument.hasDialog( aLibName, aDlgName ) )
{
- ScopedVclPtrInstance<MessageDialog>(this, IDEResId(RID_STR_SBXNAMEALLREADYUSED2))->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED2)));
+ xError->run();
}
else
{
@@ -882,8 +887,8 @@ void ObjectPage::DeleteCurrent()
OUString aName( aDesc.GetName() );
EntryType eType = aDesc.GetType();
- if ( ( eType == OBJ_TYPE_MODULE && QueryDelModule( aName, this ) ) ||
- ( eType == OBJ_TYPE_DIALOG && QueryDelDialog( aName, this ) ) )
+ if ( ( eType == OBJ_TYPE_MODULE && QueryDelModule(aName, GetFrameWeld()) ) ||
+ ( eType == OBJ_TYPE_DIALOG && QueryDelDialog(aName, GetFrameWeld()) ) )
{
m_pBasicBox->GetModel()->Remove( pCurEntry );
if ( m_pBasicBox->GetCurEntry() ) // OV-Bug ?
@@ -1038,7 +1043,9 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
}
catch (const container::ElementExistException& )
{
- ScopedVclPtrInstance<MessageDialog>(pWin, IDEResId(RID_STR_SBXNAMEALLREADYUSED2))->Execute();
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_SBXNAMEALLREADYUSED2)));
+ xError->run();
}
catch (const container::NoSuchElementException& )
{
@@ -1048,7 +1055,6 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
return pModule;
}
-
} // namespace basctl
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 5fff9ceff408..dd6899492c81 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -35,7 +35,7 @@
#include <svx/langbox.hxx>
#include <vcl/unohelp.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <vcl/settings.hxx>
namespace basctl
@@ -162,8 +162,9 @@ IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl, Button*, void)
IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl, Button*, void)
{
- ScopedVclPtrInstance< MessageDialog > aQBox(this, "DeleteLangDialog", "modules/BasicIDE/ui/deletelangdialog.ui");
- if ( aQBox->Execute() == RET_OK )
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/BasicIDE/ui/deletelangdialog.ui"));
+ std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("DeleteLangDialog"));
+ if (xQBox->run() == RET_OK)
{
sal_Int32 nCount = m_pLanguageLB->GetSelectedEntryCount();
sal_Int32 nPos = m_pLanguageLB->GetSelectedEntryPos();
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index cbf3e47b70ed..411cd288d899 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -39,6 +39,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/stdtext.hxx>
+#include <vcl/weld.hxx>
#include <memory>
@@ -135,7 +136,8 @@ void PropBrw::ImplReCreateController()
m_xBrowserController.set( xFactory->createInstanceWithContext( s_sControllerServiceName, xInspectorContext ), UNO_QUERY );
if ( !m_xBrowserController.is() )
{
- ShowServiceNotAvailableError( GetParent(), s_sControllerServiceName, true );
+ vcl::Window* pWin = GetParent();
+ ShowServiceNotAvailableError(pWin ? pWin->GetFrameWeld() : nullptr, s_sControllerServiceName, true);
}
else
{
diff --git a/basctl/source/inc/basobj.hxx b/basctl/source/inc/basobj.hxx
index 91862bff751f..7b84c2f02f27 100644
--- a/basctl/source/inc/basobj.hxx
+++ b/basctl/source/inc/basobj.hxx
@@ -30,7 +30,7 @@ class StarBASIC;
class SfxUInt16Item;
class SfxBindings;
class SfxDispatcher;
-namespace vcl { class Window; }
+namespace weld { class Widget; }
namespace basctl
{
@@ -68,7 +68,7 @@ namespace basctl
Will show an error message when renaming fails because the new name is already used.
*/
bool RenameModule(
- vcl::Window* pErrorParent, const ScriptDocument& rDocument,
+ weld::Widget* pErrorParent, const ScriptDocument& rDocument,
const OUString& rLibName, const OUString& rOldName, const OUString& rNewName );
// new methods for macros
@@ -98,8 +98,7 @@ namespace basctl
@throws css::container::NoSuchElementException
@throws css::uno::RuntimeException
*/
- bool RenameDialog(
- vcl::Window* pErrorParent, const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rOldName, const OUString& rNewName );
+ bool RenameDialog(weld::Widget* pErrorParent, const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rOldName, const OUString& rNewName);
bool RemoveDialog( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index 429f4137a971..454601db0bed 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -41,6 +41,11 @@ namespace svl
class IUndoManager;
}
+namespace weld
+{
+ class Widget;
+}
+
namespace basctl
{
@@ -290,11 +295,11 @@ void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines
OUString CreateMgrAndLibStr( const OUString& rMgrName, const OUString& rLibName );
sal_uLong CalcLineCount( SvStream& rStream );
-bool QueryReplaceMacro( const OUString& rName, vcl::Window* pParent );
-bool QueryDelMacro( const OUString& rName, vcl::Window* pParent );
-bool QueryDelDialog( const OUString& rName, vcl::Window* pParent );
-bool QueryDelModule( const OUString& rName, vcl::Window* pParent );
-bool QueryDelLib( const OUString& rName, bool bRef, vcl::Window* pParent );
+bool QueryReplaceMacro( const OUString& rName, weld::Widget* pParent );
+bool QueryDelMacro( const OUString& rName, weld::Widget* pParent );
+bool QueryDelDialog( const OUString& rName, weld::Widget* pParent );
+bool QueryDelModule( const OUString& rName, weld::Widget* pParent );
+bool QueryDelLib( const OUString& rName, bool bRef, weld::Widget* pParent );
bool QueryPassword( const css::uno::Reference< css::script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat = false, bool bNewTitle = false );
class ModuleInfoHelper
diff --git a/basctl/uiconfig/basicide/ui/deletelangdialog.ui b/basctl/uiconfig/basicide/ui/deletelangdialog.ui
index 7b91b3014903..20d77dbd6720 100644
--- a/basctl/uiconfig/basicide/ui/deletelangdialog.ui
+++ b/basctl/uiconfig/basicide/ui/deletelangdialog.ui
@@ -4,7 +4,6 @@
<requires lib="gtk+" version="3.0"/>
<object class="GtkMessageDialog" id="DeleteLangDialog">
<property name="can_focus">False</property>
- <property name="border_width">6</property>
<property name="title" translatable="yes" context="deletelangdialog|DeleteLangDialog">Delete Language Resources</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
@@ -21,7 +20,6 @@
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>