diff options
292 files changed, 2015 insertions, 1461 deletions
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 59f6c3cce90e..23cf4944e11c 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -28,6 +28,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <unotools/syslocale.hxx> #include <sfx2/viewfrm.hxx> #include <math.h> @@ -299,7 +300,7 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p, void ) if (MediaWindow::executeMediaURLDialog(this, aURL, nullptr)) { if( !MediaWindow::isMediaURL( aURL, ""/*TODO?*/, true ) ) - MediaWindow::executeFormatErrorBox( this ); + MediaWindow::executeFormatErrorBox(GetFrameWeld()); else { aExecItem.setURL( aURL, "", ""/*TODO?*/ ); diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index df416bb96db7..4d8ad4edec5c 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -23,7 +23,8 @@ #include <bitmaps.hlst> #include <strings.hrc> #include <tools/urlobj.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <unotools/pathoptions.hxx> #include <sfx2/filedlghelper.hxx> #include <comphelper/processfactory.hxx> @@ -295,16 +296,13 @@ bool MediaWindow::executeMediaURLDialog(const vcl::Window* pParent, OUString& rU return !rURL.isEmpty(); } - -void MediaWindow::executeFormatErrorBox( vcl::Window* pParent ) +void MediaWindow::executeFormatErrorBox(weld::Widget* pParent) { - ScopedVclPtrInstance< MessageDialog > aErrBox( pParent, AvmResId( AVMEDIA_STR_ERR_URL ) ); - - aErrBox->Execute(); - aErrBox.disposeAndClear(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, AvmResId(AVMEDIA_STR_ERR_URL))); + xBox->run(); } - bool MediaWindow::isMediaURL( const OUString& rURL, const OUString& rReferer, bool bDeep, Size* pPreferredSizePixel ) { const INetURLObject aURL( rURL ); 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> diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index c992e03070fe..bb2e6c71eabb 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -73,7 +73,7 @@ #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <osl/mutex.hxx> #include <sfx2/sidebar/SidebarController.hxx> @@ -1340,10 +1340,11 @@ void ChartController::executeDispatch_SourceData() SolarMutexGuard aSolarGuard; - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetChartWindow(), SchResId( STR_DLG_REMOVE_DATA_TABLE ), VclMessageType::Question, VclButtonsType::YesNo); - + VclPtr<ChartWindow> xChartWindow(GetChartWindow()); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(xChartWindow ? xChartWindow->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, SchResId(STR_DLG_REMOVE_DATA_TABLE))); // If "No" then just return - if (aQueryBox->Execute() == RET_NO) + if (xQueryBox->run() == RET_NO) return; // Remove data table diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx index 61277e9ac7ae..1c2ad24094d6 100644 --- a/cui/source/customize/SvxMenuConfigPage.cxx +++ b/cui/source/customize/SvxMenuConfigPage.cxx @@ -26,7 +26,7 @@ #include <vcl/commandinfoprovider.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <vcl/decoview.hxx> #include <vcl/toolbox.hxx> @@ -450,12 +450,13 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, ResetMenuHdl, Button *, void ) { SvxConfigEntry* pMenuData = GetTopLevelSelection(); - ScopedVclPtrInstance<MessageDialog> qbox(this, - CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT_MENU), VclMessageType::Question, VclButtonsType::YesNo); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT_MENU))); // Resetting individual top-level menus is not possible at the moment. // So we are resetting only if it is a context menu - if (!m_bIsMenuBar && qbox->Execute() == RET_YES) + if (!m_bIsMenuBar && xQueryBox->run() == RET_YES) { sal_Int32 nPos = m_pTopLevelListBox->GetSelectedEntryPos(); ContextMenuSaveInData* pSaveInData = static_cast< ContextMenuSaveInData* >(GetSaveInData()); diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx index 478f1c44022c..49c4349c459b 100644 --- a/cui/source/customize/SvxToolbarConfigPage.cxx +++ b/cui/source/customize/SvxToolbarConfigPage.cxx @@ -26,7 +26,7 @@ #include <vcl/commandinfoprovider.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <vcl/decoview.hxx> #include <vcl/toolbox.hxx> @@ -252,10 +252,10 @@ void SvxToolbarConfigPage::DeleteSelectedContent() if ( m_pContentsListBox->GetEntryCount() == 0 && GetTopLevelSelection()->IsDeletable() ) { - ScopedVclPtrInstance<MessageDialog> qbox(this, - CuiResId(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR), VclMessageType::Question, VclButtonsType::YesNo); - - if ( qbox->Execute() == RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + CuiResId(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR))); + if (xQueryBox->run() == RET_YES) { DeleteSelectedTopLevel(); } @@ -683,10 +683,10 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, ResetToolbarHdl, Button *, void ) SvxConfigEntry* pToolbar = static_cast<SvxConfigEntry*>(m_pTopLevelListBox->GetEntryData( nSelectionPos )); - ScopedVclPtrInstance<MessageDialog> qbox(this, - CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT), VclMessageType::Question, VclButtonsType::YesNo); - - if ( qbox->Execute() == RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + CuiResId(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT))); + if (xQueryBox->run() == RET_YES) { ToolbarSaveInData* pSaveInData = static_cast<ToolbarSaveInData*>(GetSaveInData()); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 2711eb1d5912..94b02b86b56d 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -26,7 +26,8 @@ #include <vcl/commandinfoprovider.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <vcl/decoview.hxx> #include <vcl/toolbox.hxx> @@ -1665,9 +1666,9 @@ SvTreeListEntry* SvxConfigPage::AddFunction( if ( pCurEntry->GetCommand() == pNewEntryData->GetCommand() ) { - ScopedVclPtrInstance<MessageDialog>(this, - CuiResId( RID_SVXSTR_MNUCFG_ALREADY_INCLUDED ), - VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, CuiResId(RID_SVXSTR_MNUCFG_ALREADY_INCLUDED))); + xBox->run(); delete pNewEntryData; return nullptr; } diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index c9ba680c8609..df8a0b131319 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -20,6 +20,7 @@ #include <config_features.h> #include <osl/process.h> #include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -143,9 +144,10 @@ IMPL_LINK( AboutDialog, HandleClick, Button*, pButton, void ) Any exc( ::cppu::getCaughtException() ); OUString msg( ::comphelper::anyToString( exc ) ); const SolarMutexGuard guard; - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg); - aErrorBox->SetText( GetText() ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pButton->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, msg)); + xErrorBox->set_title(GetText()); + xErrorBox->run(); } } diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index 8c2f03d1eada..69a867b4f036 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -18,7 +18,7 @@ */ #include <tools/debug.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <dialmgr.hxx> #include <sfx2/tabdlg.hxx> @@ -728,7 +728,9 @@ IMPL_LINK(FmSearchDialog, OnSearchProgress, const FmSearchProgress*, pProgress, const char* pErrorId = (FmSearchProgress::State::Error == pProgress->aSearchState) ? RID_STR_SEARCH_GENERAL_ERROR : RID_STR_SEARCH_NORECORD; - ScopedVclPtrInstance<MessageDialog>(this, CuiResId(pErrorId))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, CuiResId(pErrorId))); + xBox->run(); SAL_FALLTHROUGH; } case FmSearchProgress::State::Canceled: diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index b194dee47f67..ef138dc257a2 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -26,6 +26,7 @@ #include <ucbhelper/content.hxx> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <avmedia/mediawindow.hxx> #include <unotools/pathoptions.hxx> #include <sfx2/opengrf.hxx> @@ -949,7 +950,6 @@ void TPGalleryThemeProperties::FillFilterList() m_pCbbFileType->SetText( pFilterEntry->aFilterName ); } - IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl, ComboBox&, void) { OUString aText( m_pCbbFileType->GetText() ); @@ -958,12 +958,13 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl, ComboBox&, void) { aLastFilterName = aText; - if( ScopedVclPtrInstance<MessageDialog>( this, "QueryUpdateFileListDialog","cui/ui/queryupdategalleryfilelistdialog.ui" )->Execute() == RET_YES ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryupdategalleryfilelistdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryUpdateFileListDialog")); + if (xQuery->run() == RET_YES) SearchFiles(); } } - void TPGalleryThemeProperties::SearchFiles() { VclPtrInstance<SearchProgress> pProgress( this, aURL ); diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index e350506707af..9db02b3b467f 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -44,7 +44,7 @@ #include <vcl/button.hxx> #include <vcl/fixed.hxx> #include <vcl/group.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/lstbox.hxx> #include <vcl/svapp.hxx> #include <comphelper/classids.hxx> @@ -267,7 +267,10 @@ short SvInsertOleDlg::Execute() // global Resource from svtools (former so3 resource) OUString aErr(SvtResId(STR_ERROR_OBJNOCREATE_FROM_FILE)); aErr = aErr.replaceFirst( "%", aFileName ); - ScopedVclPtrInstance<MessageDialog>(this, aErr)->Execute(); + + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, aErr)); + xBox->run(); } else { @@ -275,7 +278,10 @@ short SvInsertOleDlg::Execute() // global Resource from svtools (former so3 resource) OUString aErr(SvtResId(STR_ERROR_OBJNOCREATE)); aErr = aErr.replaceFirst( "%", aServerName ); - ScopedVclPtrInstance<MessageDialog>(this, aErr)->Execute(); + + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, aErr)); + xBox->run(); } } } @@ -316,7 +322,10 @@ short SvInsertOleDlg::Execute() // global Resource from svtools (former so3 resource) OUString aErr(SvtResId(STR_ERROR_OBJNOCREATE_FROM_FILE)); aErr = aErr.replaceFirst( "%", aFileName ); - ScopedVclPtrInstance<MessageDialog>(this, aErr)->Execute(); + + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, aErr)); + xBox->run(); } else { diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx index 21be42aec23d..fab6b3caa6cc 100644 --- a/cui/source/dialogs/passwdomdlg.cxx +++ b/cui/source/dialogs/passwdomdlg.cxx @@ -26,7 +26,7 @@ #include <vcl/fixed.hxx> #include <vcl/edit.hxx> #include <vcl/button.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> struct PasswordToOpenModifyDialog_Impl @@ -91,16 +91,17 @@ PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( m_pOptionsExpander->Hide(); } -IMPL_LINK_NOARG( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, Button *, void ) +IMPL_LINK(PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, Button *, pButton, void) { bool bInvalidState = !m_pOpenReadonlyCB->IsChecked() && m_pPasswdToOpenED->GetText().isEmpty() && m_pPasswdToModifyED->GetText().isEmpty(); if (bInvalidState) { - ScopedVclPtrInstance<MessageDialog> aErrorBox(m_pParent, - m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pButton->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2)); + xErrorBox->run(); } else // check for mismatched passwords... { @@ -109,8 +110,10 @@ IMPL_LINK_NOARG( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, Button *, void const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1); if (nMismatch > 0) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(m_pParent, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pButton->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch)); + xErrorBox->run(); Edit* pEdit = !bToOpenMatch ? m_pPasswdToOpenED.get() : m_pPasswdToModifyED.get(); Edit* pRepeatEdit = !bToOpenMatch? m_pReenterPasswdToOpenED.get() : m_pReenterPasswdToModifyED.get(); diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 2df5cd25e516..c219b6f56ef6 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -22,7 +22,7 @@ #include <sfx2/objsh.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/builderfactory.hxx> #include <o3tl/make_unique.hxx> @@ -896,9 +896,11 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry ) { bValid = false; OUString aError = m_createErrStr + m_createDupStr; - ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), aError); - aErrorBox->SetText( m_createErrTitleStr ); - aErrorBox->Execute(); + + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, aError)); + xErrorBox->set_title(m_createErrTitleStr); + xErrorBox->run(); xNewDlg->SetObjectName( aNewName ); break; } @@ -976,9 +978,10 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry ) { //ISSUE L10N & message from exception? OUString aError( m_createErrStr ); - ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), aError); - aErrorBox->SetText( m_createErrTitleStr ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, aError)); + xErrorBox->set_title(m_createErrTitleStr); + xErrorBox->run(); } } @@ -1035,9 +1038,10 @@ void SvxScriptOrgDialog::renameEntry( SvTreeListEntry* pEntry ) { //ISSUE L10N & message from exception? OUString aError( m_renameErrStr ); - ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), aError); - aErrorBox->SetText( m_renameErrTitleStr ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, aError)); + xErrorBox->set_title(m_renameErrTitleStr); + xErrorBox->run(); } } void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry ) @@ -1046,9 +1050,10 @@ void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry ) Reference< browse::XBrowseNode > node = getBrowseNode( pEntry ); // ISSUE L10N string & can we centre list? OUString aQuery = m_delQueryStr + getListOfChildren( node, 0 ); - VclPtrInstance< MessageDialog > aQueryBox(static_cast<vcl::Window*>(this), aQuery, VclMessageType::Question, VclButtonsType::YesNo); - aQueryBox->SetText( m_delQueryTitleStr ); - if ( aQueryBox->Execute() == RET_NO ) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, aQuery)); + xQueryBox->set_title(m_delQueryTitleStr); + if (xQueryBox->run() == RET_NO) { return; } @@ -1079,9 +1084,10 @@ void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry ) else { //ISSUE L10N & message from exception? - ScopedVclPtrInstance< MessageDialog > aErrorBox(static_cast<vcl::Window*>(this), m_delErrStr); - aErrorBox->SetText( m_delErrTitleStr ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, m_delErrStr)); + xErrorBox->set_title(m_delErrTitleStr); + xErrorBox->run(); } } @@ -1428,9 +1434,10 @@ IMPL_STATIC_LINK( SvxScriptErrorDialog, ShowDialog, void*, p, void ) message = CuiResId( RID_SVXSTR_ERROR_TITLE ); } - ScopedVclPtrInstance<MessageDialog> pBox( nullptr, message, VclMessageType::Warning ); - pBox->SetText( CuiResId( RID_SVXSTR_ERROR_TITLE ) ); - pBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, message)); + xBox->set_title(CuiResId(RID_SVXSTR_ERROR_TITLE)); + xBox->run(); delete pMessage; } diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index 2ab19ca73d15..1d3cf77c746b 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -27,7 +27,7 @@ #include <strings.hrc> #include <bitmaps.hlst> #include <vcl/field.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/eitem.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/uno/Exception.hpp> @@ -275,8 +275,9 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, DeleteHdl, Button*, void) SvTreeListEntry* pEntry = m_pPathBox->FirstSelected(); if ( pEntry ) { - ScopedVclPtrInstance< MessageDialog > aQuery(this, CuiResId(RID_SVXSTR_QUERY_DELETE_CONFIRM), VclMessageType::Question, VclButtonsType::YesNo); - if ( aQuery->Execute() == RET_YES ) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, CuiResId(RID_SVXSTR_QUERY_DELETE_CONFIRM))); + if (xQuery->run() == RET_YES) m_pPathBox->GetModel()->Remove(pEntry); } } diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx index f57cd6210ebd..abaabd906b90 100644 --- a/cui/source/options/doclinkdialog.cxx +++ b/cui/source/options/doclinkdialog.cxx @@ -23,7 +23,8 @@ #include <comphelper/processfactory.hxx> #include <strings.hrc> #include <svl/filenotation.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <ucbhelper/content.hxx> #include <dialmgr.hxx> #include <tools/urlobj.hxx> @@ -126,8 +127,9 @@ namespace svx { OUString sMsg = CuiResId(STR_LINKEDDOC_DOESNOTEXIST); sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText()); - ScopedVclPtrInstance< MessageDialog > aError(this, sMsg); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xErrorBox->run(); return; } // if (!bFileExists) INetURLObject aURL( sURL ); @@ -135,8 +137,9 @@ namespace svx { OUString sMsg = CuiResId(STR_LINKEDDOC_NO_SYSTEM_FILE); sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText()); - ScopedVclPtrInstance< MessageDialog > aError(this, sMsg); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xErrorBox->run(); return; } @@ -147,8 +150,9 @@ namespace svx { OUString sMsg = CuiResId(STR_NAME_CONFLICT); sMsg = sMsg.replaceFirst("$file$", sCurrentText); - ScopedVclPtrInstance< MessageDialog > aError(this, sMsg, VclMessageType::Info); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, sMsg)); + xErrorBox->run(); m_pName->SetSelection(Selection(0,sCurrentText.getLength())); m_pName->GrabFocus(); diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index 7cecd8e01376..0cedb6e21e9b 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -22,6 +22,7 @@ #include <dialmgr.hxx> #include <vcl/builderfactory.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <svx/svxids.hrc> @@ -286,7 +287,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor, Button*, void) // RemoveChartColor -IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) +IMPL_LINK_NOARG( SvxDefaultColorOptPage, RemoveChartColor, Button*, void ) { sal_Int32 nIndex = m_pLbChartColors->GetSelectedEntryPos(); @@ -297,9 +298,10 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) { OSL_ENSURE(pColorConfig->GetColorList().size() > 1, "don't delete the last chart color"); - ScopedVclPtrInstance<MessageDialog> aQuery(pButton, "QueryDeleteChartColorDialog", - "cui/ui/querydeletechartcolordialog.ui"); - if (RET_YES == aQuery->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletechartcolordialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteChartColorDialog")); + + if (RET_YES == xQuery->run()) { pColorConfig->GetColorList().remove( nIndex ); diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index c20b723a26be..1e8e4c5b2dc3 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -34,6 +34,7 @@ #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> +#include <vcl/weld.hxx> #include <svx/svxdlg.hxx> #include <helpids.h> #include <dialmgr.hxx> @@ -1130,9 +1131,11 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, Button*, pButton, void ) else { DBG_ASSERT(m_pColorSchemeLB->GetEntryCount() > 1, "don't delete the last scheme"); - ScopedVclPtrInstance< MessageDialog > aQuery(pButton, CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - aQuery->SetText(CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE)); - if(RET_YES == aQuery->Execute()) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(pButton->GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE))); + xQuery->set_title(CuiResId(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE)); + if (RET_YES == xQuery->run()) { OUString sDeleteScheme(m_pColorSchemeLB->GetSelectedEntry()); m_pColorSchemeLB->RemoveEntry(m_pColorSchemeLB->GetSelectedEntryPos()); diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 695f358a0346..7b4e4ea5797e 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -27,7 +27,7 @@ #include <comphelper/string.hxx> #include <unotools/intlwrapper.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> #include <svx/dialogs.hrc> @@ -151,7 +151,10 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, Button*, void) if ( bFound ) { // duplicate names? - ScopedVclPtrInstance<MessageDialog>(this, CuiResId(RID_SVXSTR_OPT_DOUBLE_DICTS), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_OPT_DOUBLE_DICTS))); + xInfoBox->run(); pNameEdit->GrabFocus(); return; } @@ -450,12 +453,14 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox&, void) if ( nLang != nOldLang ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, CuiResId( RID_SVXSTR_CONFIRM_SET_LANGUAGE), VclMessageType::Question, VclButtonsType::YesNo); - OUString sTxt(aBox->get_primary_text()); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + CuiResId(RID_SVXSTR_CONFIRM_SET_LANGUAGE))); + OUString sTxt(xBox->get_primary_text()); sTxt = sTxt.replaceFirst( "%1", pAllDictsLB->GetSelectedEntry() ); - aBox->set_primary_text(sTxt); + xBox->set_primary_text(sTxt); - if ( aBox->Execute() == RET_YES ) + if (xBox->run() == RET_YES) { xDic->setLocale( LanguageTag::convertToLocale( nLang ) ); bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE; diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index b1d5197e6687..1b4161575e67 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -39,7 +39,7 @@ #include <sfx2/objsh.hxx> #include <unotools/bootstrap.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/builderfactory.hxx> #include <sfx2/viewfrm.hxx> #include <unotools/pathoptions.hxx> @@ -138,7 +138,6 @@ void SvxNoSpaceEdit::KeyInput( const KeyEvent& rKEvent ) Edit::KeyInput(rKEvent); } - void SvxNoSpaceEdit::Modify() { Edit::Modify(); @@ -146,7 +145,12 @@ void SvxNoSpaceEdit::Modify() if ( bOnlyNumeric ) { if ( !isValidPort(GetText()) ) - ScopedVclPtrInstance<MessageDialog>(this, CuiResId( RID_SVXSTR_OPT_PROXYPORTS))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + CuiResId( RID_SVXSTR_OPT_PROXYPORTS))); + xErrorBox->run(); + } } } diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 26b34709384e..30d968607df6 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -35,7 +35,7 @@ #include <vcl/svapp.hxx> #include <vcl/help.hxx> #include <tools/urlobj.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <unotools/pathoptions.hxx> #include <svtools/imagemgr.hxx> @@ -538,13 +538,17 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder ) } else if ( JFW_E_NOT_RECOGNIZED == eErr ) { - ScopedVclPtrInstance< MessageDialog > aErrBox( this, CuiResId( RID_SVXSTR_JRE_NOT_RECOGNIZED ) ); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_JRE_NOT_RECOGNIZED))); + xBox->run(); } else if ( JFW_E_FAILED_VERSION == eErr ) { - ScopedVclPtrInstance< MessageDialog > aErrBox( this, CuiResId( RID_SVXSTR_JRE_FAILED_VERSION ) ); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_JRE_FAILED_VERSION))); + xBox->run(); } if ( bStartAgain ) @@ -928,7 +932,9 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, Button*, void) { OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); sMsg = sMsg.replaceFirst( "%1", sFile ); - ScopedVclPtrInstance<MessageDialog>(this, sMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xBox->run(); } } EnableRemoveButton(); @@ -963,7 +969,9 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, Button*, void) { OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); sMsg = sMsg.replaceFirst( "%1", sNewFolder ); - ScopedVclPtrInstance<MessageDialog>(this, sMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xBox->run(); } } EnableRemoveButton(); diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 9400320e3d2d..c2adea57d669 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -21,6 +21,7 @@ #include <vcl/field.hxx> #include <vcl/fixed.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <i18nlangtag/mslangid.hxx> #include <unotools/lingucfg.hxx> #include <editeng/unolingu.hxx> @@ -1553,9 +1554,9 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) } else if (m_pLinguDicsDelPB == pBtn) { - ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDeleteDictionaryDialog", - "cui/ui/querydeletedictionarydialog.ui"); - if (RET_NO == aQuery->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletedictionarydialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteDictionaryDialog")); + if (RET_NO == xQuery->run()) return; SvTreeListEntry *pEntry = m_pLinguDicsCLB->GetCurEntry(); diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx index 5e94bda5a12a..e757231a0c33 100644 --- a/cui/source/options/optopencl.cxx +++ b/cui/source/options/optopencl.cxx @@ -21,6 +21,7 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <svl/zforlist.hxx> #include <opencl/openclconfig.hxx> #include <opencl/openclwrapper.hxx> @@ -101,8 +102,10 @@ bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* ) if (bModified) { - ScopedVclPtrInstance<MessageDialog> aWarnBox(this, CuiResId(RID_SVXSTR_OPTIONS_RESTART), VclMessageType::Info); - aWarnBox->Execute(); + std::unique_ptr<weld::MessageDialog> xWarnBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + CuiResId(RID_SVXSTR_OPTIONS_RESTART))); + xWarnBox->run(); batch->commit(); } diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index fa75e28873bf..37ee324e01f5 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -38,7 +38,7 @@ #include <svl/intitem.hxx> #include <sfx2/request.hxx> #include <sfx2/opengrf.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svx/svxdlg.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/dialoghelper.hxx> @@ -584,10 +584,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void) } else { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xBox->run(); } } } @@ -600,9 +599,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl, SvxPresetListBox*, void) if( nPos != VALUESET_ITEM_NOTFOUND ) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelBitmapDialog","cui/ui/querydeletebitmapdialog.ui" ); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelBitmapDialog")); - if( aQueryBox->Execute() == RET_YES ) + if (xQueryBox->run() == RET_YES) { m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) ); m_pBitmapLB->RemoveItem( nId ); @@ -772,7 +772,6 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) if( !nError ) { OUString aDesc(CuiResId(RID_SVXSTR_DESC_EXT_BITMAP)); - ScopedVclPtr<MessageDialog> pWarnBox; // convert file URL to UI name OUString aName; @@ -798,19 +797,13 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) break; } - if( !pWarnBox ) - { - pWarnBox.disposeAndReset(VclPtr<MessageDialog>::Create( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui")); - } - - if( pWarnBox->Execute() != RET_OK ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + if (xBox->run() != RET_OK) break; } pDlg.disposeAndClear(); - pWarnBox.disposeAndClear(); if( !nError ) { @@ -827,10 +820,12 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) } } else + { // graphic couldn't be loaded - ScopedVclPtrInstance<MessageDialog>( GetParentDialog() - ,"NoLoadedFileDialog" - ,"cui/ui/querynoloadedfiledialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynoloadedfiledialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoLoadedFileDialog")); + xBox->run(); + } } } diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index fe6e5118fd23..85ffbce5373f 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -28,6 +28,7 @@ #include <sfx2/dispatch.hxx> #include <svtools/colrdlg.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/filedlghelper.hxx> #include <svx/ofaitem.hxx> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> @@ -365,7 +366,6 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); - ScopedVclPtr<MessageDialog> pWarnBox; sal_uInt16 nError = 1; while (pDlg->Execute() == RET_OK) @@ -379,19 +379,13 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, Button*, void) break; } - if( !pWarnBox ) - { - pWarnBox.disposeAndReset(VclPtr<MessageDialog>::Create( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui")); - } - - if( pWarnBox->Execute() != RET_OK ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + if (xWarnBox->run() != RET_OK) break; } pDlg.disposeAndClear(); - pWarnBox.disposeAndClear(); if (!nError) { diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index f145f8c4f509..52cf295e245e 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -21,6 +21,7 @@ #include <vcl/wrkwin.hxx> #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <unotools/pathoptions.hxx> #include <sfx2/app.hxx> #include <sfx2/dialoghelper.hxx> @@ -377,7 +378,6 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); - ScopedVclPtr<MessageDialog> pWarnBox; sal_uInt16 nError = 1; while (pDlg->Execute() == RET_OK) @@ -392,18 +392,12 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) break; } - if( !pWarnBox ) - { - pWarnBox.disposeAndReset(VclPtr<MessageDialog>::Create( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui")); - } - - if( pWarnBox->Execute() != RET_OK ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + if (xWarnBox->run() != RET_OK) break; } pDlg.disposeAndClear(); - pWarnBox.disposeAndClear(); if( !nError ) { @@ -475,9 +469,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void if( nPos != VALUESET_ITEM_NOTFOUND ) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelGradientDialog","cui/ui/querydeletegradientdialog.ui"); - - if ( aQueryBox->Execute() == RET_YES ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletegradientdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelGradientDialog")); + if (xQueryBox->run() == RET_YES) { m_pGradientList->Remove(nPos); m_pGradientLB->RemoveItem( nId ); @@ -531,10 +525,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void } else { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xBox->run(); } } } diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 17faefbdd114..c34e72484f13 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -21,6 +21,7 @@ #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <unotools/pathoptions.hxx> #include <sfx2/app.hxx> #include <sfx2/dialoghelper.hxx> @@ -447,7 +448,6 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) assert(pFact && "Dialog creation failed!"); ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); assert(pDlg && "Dialog creation failed!"); - ScopedVclPtr<MessageDialog> pWarnBox; sal_uInt16 nError = 1; while( pDlg->Execute() == RET_OK ) @@ -461,18 +461,12 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) break; } - if( !pWarnBox ) - { - pWarnBox.disposeAndReset(VclPtr<MessageDialog>::Create( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui")); - } - - if( pWarnBox->Execute() != RET_OK ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + if (xWarnBox->run() != RET_OK) break; } pDlg.disposeAndClear(); - pWarnBox.disposeAndClear(); if( !nError ) { @@ -535,9 +529,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) if( nPos != VALUESET_ITEM_NOTFOUND ) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelHatchDialog","cui/ui/querydeletehatchdialog.ui"); - - if( aQueryBox->Execute() == RET_YES ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletehatchdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelHatchDialog")); + if (xQueryBox->run() == RET_YES) { m_pHatchingList->Remove(nPos); m_pHatchLB->RemoveItem( nId ); @@ -588,10 +582,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void ) } else { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xBox->run(); } } } diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 5291075cc318..4c2ba2cd428e 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -20,6 +20,7 @@ #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <unotools/pathoptions.hxx> #include <sfx2/app.hxx> #include <sfx2/module.hxx> @@ -590,10 +591,9 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void) } else { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xBox->run(); } } pDlg.disposeAndClear(); @@ -663,10 +663,9 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, Button*, void) } else { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xBox->run(); } } } @@ -679,11 +678,9 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickDeleteHdl_Impl, Button*, void) if ( nPos != LISTBOX_ENTRY_NOTFOUND ) { - ScopedVclPtrInstance<MessageDialog> aQueryBox( GetParentDialog() - ,"AskDelLineStyleDialog" - ,"cui/ui/querydeletelinestyledialog.ui" ); - - if ( aQueryBox->Execute() == RET_YES ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletelinestyledialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelLineStyleDialog")); + if (xQueryBox->run() == RET_YES) { pDashList->Remove(nPos); m_pLbLineStyles->RemoveEntry( nPos ); @@ -713,9 +710,10 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, Button*, void) if ( *pnDashListState & ChangeType::MODIFIED ) { - nReturn = ScopedVclPtrInstance<MessageDialog>(GetParentDialog() - ,"AskSaveList" - ,"cui/ui/querysavelistdialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querysavelistdialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("AskSaveList")); + + nReturn = xBox->run(); if ( nReturn == RET_YES ) pDashList->Save(); @@ -765,10 +763,11 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, Button*, void) *pnDashListState &= ~ChangeType::MODIFIED; } else - //aIStream.Close(); - ScopedVclPtrInstance<MessageDialog>(GetParentDialog() - ,"NoLoadedFileDialog" - ,"cui/ui/querynoloadedfiledialog.ui")->Execute(); + { + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynoloadedfiledialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoLoadedFileDialog")); + xBox->run(); + } } } @@ -832,9 +831,9 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl, Button*, void) } else { - ScopedVclPtrInstance<MessageDialog>(GetParentDialog() - ,"NoSaveFileDialog" - ,"cui/ui/querynosavefiledialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynosavefiledialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoSaveFileDialog")); + xBox->run(); } } } diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index e669b92135ec..621d90929028 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -20,6 +20,7 @@ #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <unotools/pathoptions.hxx> #include <sfx2/app.hxx> #include <sfx2/filedlghelper.hxx> @@ -200,10 +201,9 @@ void SvxLineEndDefTabPage::CheckChanges_Impl() if( aString != m_pLbLineEnds->GetSelectedEntry() ) { - ScopedVclPtrInstance<MessageDialog> aQueryBox( GetParentDialog() - ,"AskChangeLineEndDialog" - ,"cui/ui/querychangelineenddialog.ui" ); - if ( aQueryBox->Execute() == RET_YES ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querychangelineenddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskChangeLineEndDialog")); + if (xQueryBox->run() == RET_YES) ClickModifyHdl_Impl( nullptr ); } } @@ -321,10 +321,9 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void) // if yes, repeat and demand a new name if ( !bDifferent ) { - ScopedVclPtrInstance<MessageDialog> aWarningBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aWarningBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarningBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xWarningBox->run(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); @@ -346,7 +345,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void) if( bDifferent ) bLoop = false; else - aWarningBox->Execute(); + xWarningBox->run(); } } @@ -466,10 +465,9 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, Button*, void) } else { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarningBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xWarningBox->run(); } } } @@ -492,11 +490,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickDeleteHdl_Impl, Button*, void) if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - ScopedVclPtrInstance<MessageDialog> aQueryBox( GetParentDialog() - ,"AskDelLineEndDialog" - ,"cui/ui/querydeletelineenddialog.ui" ); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletelineenddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelLineEndDialog")); - if ( aQueryBox->Execute() == RET_YES ) + if (xQueryBox->run() == RET_YES) { pLineEndList->Remove(nPos); m_pLbLineEnds->RemoveEntry( nPos ); @@ -526,9 +523,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, Button*, void) if ( *pnLineEndListState & ChangeType::MODIFIED ) { - nReturn = ScopedVclPtrInstance<MessageDialog>(GetParentDialog() - ,"AskSaveList" - ,"cui/ui/querysavelistdialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querysavelistdialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("AskSaveList")); + + nReturn = xBox->run(); if ( nReturn == RET_YES ) pLineEndList->Save(); @@ -580,9 +578,11 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, Button*, void) *pnLineEndListState &= ~ChangeType::MODIFIED; } else - ScopedVclPtrInstance<MessageDialog>(GetParentDialog() - ,"NoLoadedFileDialog" - ,"cui/ui/querynoloadedfiledialog.ui")->Execute(); + { + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynoloadedfiledialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoLoadedFileDialog")); + xBox->run(); + } } } @@ -647,9 +647,9 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl, Button*, void) } else { - ScopedVclPtrInstance<MessageDialog>(GetParentDialog() - ,"NoSaveFileDialog" - ,"cui/ui/querynosavefiledialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynosavefiledialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoSaveFileDialog")); + xBox->run(); } } } diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 8933c5fbe18c..611edb2cc557 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -32,6 +32,7 @@ #include <svx/dialmgr.hxx> #include <vcl/bitmapaccess.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <svx/dialogs.hrc> #include <svx/strings.hrc> @@ -360,7 +361,6 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) assert(pFact && "Dialog creation failed!"); ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); assert(pDlg && "Dialog creation failed!"); - ScopedVclPtr<MessageDialog> pWarnBox; sal_uInt16 nError(1); while( pDlg->Execute() == RET_OK ) @@ -374,19 +374,13 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) break; } - if( !pWarnBox ) - { - pWarnBox.disposeAndReset(VclPtr<MessageDialog>::Create( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui")); - } - - if( pWarnBox->Execute() != RET_OK ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + if (xWarnBox->run() != RET_OK) break; } pDlg.disposeAndClear(); - pWarnBox.disposeAndClear(); if( !nError ) { @@ -496,17 +490,14 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) } else { - ScopedVclPtrInstance<MessageDialog> aBox( - GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui"); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); + xWarnBox->run(); } } } } - IMPL_LINK_NOARG(SvxPatternTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) { sal_uInt16 nId = m_pPatternLB->GetSelectItemId(); @@ -514,9 +505,9 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) if( nPos != VALUESET_ITEM_NOTFOUND ) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelBitmapDialog","cui/ui/querydeletebitmapdialog.ui" ); - - if( aQueryBox->Execute() == RET_YES ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelBitmapDialog")); + if (xQueryBox->run() == RET_YES) { m_pPatternList->Remove(nPos); m_pPatternLB->RemoveItem( nId ); diff --git a/cui/uiconfig/ui/querychangelineenddialog.ui b/cui/uiconfig/ui/querychangelineenddialog.ui index b8e5f113a203..eddcaf4711aa 100644 --- a/cui/uiconfig/ui/querychangelineenddialog.ui +++ b/cui/uiconfig/ui/querychangelineenddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="AskChangeLineEndDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querychangelineenddialog|AskChangeLineEndDialog">Save Arrowhead?</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> diff --git a/cui/uiconfig/ui/querydeletebitmapdialog.ui b/cui/uiconfig/ui/querydeletebitmapdialog.ui index a737c87ee58a..8d47eb3e434f 100644 --- a/cui/uiconfig/ui/querydeletebitmapdialog.ui +++ b/cui/uiconfig/ui/querydeletebitmapdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="AskDelBitmapDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletebitmapdialog|AskDelBitmapDialog">Delete Bitmap?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/cui/uiconfig/ui/querydeletechartcolordialog.ui b/cui/uiconfig/ui/querydeletechartcolordialog.ui index ad07c12effdb..265390241b4c 100644 --- a/cui/uiconfig/ui/querydeletechartcolordialog.ui +++ b/cui/uiconfig/ui/querydeletechartcolordialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryDeleteChartColorDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletechartcolordialog|QueryDeleteChartColorDialog">Delete Color?</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> diff --git a/cui/uiconfig/ui/querydeletecolordialog.ui b/cui/uiconfig/ui/querydeletecolordialog.ui index fc142aacde96..9a46b038f36f 100644 --- a/cui/uiconfig/ui/querydeletecolordialog.ui +++ b/cui/uiconfig/ui/querydeletecolordialog.ui @@ -3,7 +3,6 @@ <!-- interface-requires gtk+ 3.0 --> <object class="GtkMessageDialog" id="AskDelColorDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletecolordialog|AskDelColorDialog">Delete color?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -19,7 +18,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area"> <property name="can_focus">False</property> - <property name="layout_style">center</property> </object> <packing> <property name="expand">False</property> diff --git a/cui/uiconfig/ui/querydeletedictionarydialog.ui b/cui/uiconfig/ui/querydeletedictionarydialog.ui index 663b917689a1..8d506808cce8 100644 --- a/cui/uiconfig/ui/querydeletedictionarydialog.ui +++ b/cui/uiconfig/ui/querydeletedictionarydialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryDeleteDictionaryDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletedictionarydialog|QueryDeleteDictionaryDialog">Delete Dictionary?</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> diff --git a/cui/uiconfig/ui/querydeletegradientdialog.ui b/cui/uiconfig/ui/querydeletegradientdialog.ui index b4353a10413f..b24920e2f2b7 100644 --- a/cui/uiconfig/ui/querydeletegradientdialog.ui +++ b/cui/uiconfig/ui/querydeletegradientdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="AskDelGradientDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletegradientdialog|AskDelGradientDialog">Delete gradient?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/cui/uiconfig/ui/querydeletehatchdialog.ui b/cui/uiconfig/ui/querydeletehatchdialog.ui index ab22d721852e..928ebc186c83 100644 --- a/cui/uiconfig/ui/querydeletehatchdialog.ui +++ b/cui/uiconfig/ui/querydeletehatchdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="AskDelHatchDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletehatchdialog|AskDelHatchDialog">Delete Hatching?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/cui/uiconfig/ui/querydeletelineenddialog.ui b/cui/uiconfig/ui/querydeletelineenddialog.ui index 30355fcd662c..1725bfefccc7 100644 --- a/cui/uiconfig/ui/querydeletelineenddialog.ui +++ b/cui/uiconfig/ui/querydeletelineenddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="AskDelLineEndDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletelineenddialog|AskDelLineEndDialog">Delete Arrowhead?</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> diff --git a/cui/uiconfig/ui/querydeletelinestyledialog.ui b/cui/uiconfig/ui/querydeletelinestyledialog.ui index 86aa1fdf08da..ac76319b821e 100644 --- a/cui/uiconfig/ui/querydeletelinestyledialog.ui +++ b/cui/uiconfig/ui/querydeletelinestyledialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="AskDelLineStyleDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletelinestyledialog|AskDelLineStyleDialog">Delete Line Style?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/cui/uiconfig/ui/queryduplicatedialog.ui b/cui/uiconfig/ui/queryduplicatedialog.ui index 172e14baddef..aa98dbb95a61 100644 --- a/cui/uiconfig/ui/queryduplicatedialog.ui +++ b/cui/uiconfig/ui/queryduplicatedialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="DuplicateNameDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="queryduplicatedialog|DuplicateNameDialog">Duplicate Name</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> diff --git a/cui/uiconfig/ui/querynoloadedfiledialog.ui b/cui/uiconfig/ui/querynoloadedfiledialog.ui index 397919a42717..6796c8934692 100644 --- a/cui/uiconfig/ui/querynoloadedfiledialog.ui +++ b/cui/uiconfig/ui/querynoloadedfiledialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="NoLoadedFileDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querynoloadedfiledialog|NoLoadedFileDialog">No Loaded File</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/cui/uiconfig/ui/querynosavefiledialog.ui b/cui/uiconfig/ui/querynosavefiledialog.ui index a579aba13727..7ef88a753fea 100644 --- a/cui/uiconfig/ui/querynosavefiledialog.ui +++ b/cui/uiconfig/ui/querynosavefiledialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="NoSaveFileDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querynosavefiledialog|NoSaveFileDialog">No Saved File</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/cui/uiconfig/ui/querysavelistdialog.ui b/cui/uiconfig/ui/querysavelistdialog.ui index 8ccf00b71b67..9ec49a3e8a1b 100644 --- a/cui/uiconfig/ui/querysavelistdialog.ui +++ b/cui/uiconfig/ui/querysavelistdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="AskSaveList"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querysavelistdialog|AskSaveList">Save List?</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> diff --git a/cui/uiconfig/ui/queryupdategalleryfilelistdialog.ui b/cui/uiconfig/ui/queryupdategalleryfilelistdialog.ui index e41d5cca1724..61dd02a9b91a 100644 --- a/cui/uiconfig/ui/queryupdategalleryfilelistdialog.ui +++ b/cui/uiconfig/ui/queryupdategalleryfilelistdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryUpdateFileListDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="queryupdategalleryfilelistdialog|QueryUpdateFileListDialog">Update File List?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area4"> <property name="can_focus">False</property> - <property name="layout_style">end</property> </object> <packing> <property name="expand">False</property> diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx index e30bd2652daf..4edd380f1a63 100644 --- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx @@ -42,7 +42,7 @@ #include <svl/filenotation.hxx> #include <tools/diagnose_ex.h> #include <ucbhelper/content.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vector> @@ -384,8 +384,9 @@ namespace dbmm // check that the backup location isn't the same as the document itself if ( lcl_equalURLs_nothrow( m_pData->aContext, sBackupLocation, m_pData->xDocumentModel->getURL() ) ) { - ScopedVclPtrInstance< MessageDialog > aErrorBox( const_cast< MacroMigrationDialog* >( this ), DBA_RES( STR_INVALID_BACKUP_LOCATION ) ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, DBA_RES(STR_INVALID_BACKUP_LOCATION))); + xErrorBox->run(); rBackupPage.grabLocationFocus(); return false; } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index fcc781ae6ef5..d5339f785a0d 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -84,6 +84,7 @@ #include <vcl/svapp.hxx> #include <vcl/menu.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <unotools/closeveto.hxx> #include <unotools/pathoptions.hxx> @@ -522,7 +523,7 @@ sal_Bool SAL_CALL OApplicationController::suspend(sal_Bool bSuspend) ) ) { - switch (ExecuteQuerySaveDocument(getView(),getStrippedDatabaseName())) + switch (ExecuteQuerySaveDocument(getFrameWeld(),getStrippedDatabaseName())) { case RET_YES: Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>()); diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 940ca99e81ee..7012171dd72c 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -45,7 +45,7 @@ #include <unotools/ucbhelper.hxx> #include <dlgsave.hxx> #include <comphelper/types.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> #include <connectivity/dbexception.hxx> @@ -178,8 +178,10 @@ void OApplicationController::deleteTables(const std::vector< OUString>& _rList) else { OUString sMessage(DBA_RES(STR_MISSING_TABLES_XDROP)); - ScopedVclPtrInstance< MessageDialog > aError(getView(), sMessage); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xError->run(); } } } @@ -190,7 +192,6 @@ void OApplicationController::deleteObjects( ElementType _eType, const std::vecto Reference< XHierarchicalNameContainer > xHierarchyName( xNames, UNO_QUERY ); if ( xNames.is() ) { - OString sDialogPosition; short eResult = _bConfirm ? svtools::QUERYDELETE_YES : svtools::QUERYDELETE_ALL; // The list of elements to delete is allowed to contain related elements: A given element may @@ -213,17 +214,12 @@ void OApplicationController::deleteObjects( ElementType _eType, const std::vecto if ( eResult != svtools::QUERYDELETE_ALL ) { - ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(getView(), *aThisRound); - - if ( !sDialogPosition.isEmpty() ) - aDlg->SetWindowState( sDialogPosition ); + svtools::QueryDeleteDlg_Impl aDlg(getFrameWeld(), *aThisRound); if ( nObjectsLeft > 1 ) - aDlg->EnableAllButton(); - - eResult = aDlg->Execute(); + aDlg.EnableAllButton(); - sDialogPosition = aDlg->GetWindowState( ); + eResult = aDlg.run(); } bool bSuccess = false; diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 1e0041d958c0..99a04d7b76e7 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -61,7 +61,7 @@ #include <tools/diagnose_ex.h> #include <osl/diagnose.h> #include <unotools/bootstrap.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> #include <vcl/waitobj.hxx> @@ -518,8 +518,10 @@ void OApplicationController::askToReconnect() bool bClear = true; if ( !m_pSubComponentManager->empty() ) { - ScopedVclPtrInstance< MessageDialog > aQry(getView(), DBA_RES(STR_QUERY_CLOSEDOCUMENTS), VclMessageType::Question, VclButtonsType::YesNo); - switch (aQry->Execute()) + std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_CLOSEDOCUMENTS))); + switch (xQry->run()) { case RET_YES: closeSubComponents(); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 372bd7b8b2ef..a23f0f9d2437 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -84,7 +84,7 @@ #include <svx/svxdlg.hxx> #include <tools/diagnose_ex.h> #include <osl/diagnose.h> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> using namespace ::com::sun::star; @@ -1372,9 +1372,11 @@ void SbaXDataBrowserController::resetted(const css::lang::EventObject& rEvent) sal_Bool SbaXDataBrowserController::confirmDelete(const css::sdb::RowChangeEvent& /*aEvent*/) { - if (ScopedVclPtrInstance<MessageDialog>(getBrowserView(), DBA_RES(STR_QUERY_BRW_DELETE_ROWS), VclMessageType::Question, VclButtonsType::YesNo)->Execute() != RET_YES) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_BRW_DELETE_ROWS))); + if (xQuery->run() != RET_YES) return false; - return true; } @@ -2145,11 +2147,9 @@ bool SbaXDataBrowserController::SaveModified(bool bAskFor) { getBrowserView()->getVclControl()->GrabFocus(); - ScopedVclPtrInstance<MessageDialog> aQry( getBrowserView()->getVclControl(), - "SaveModifiedDialog", - "dbaccess/ui/savemodifieddialog.ui" ); - - switch (aQry->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/savemodifieddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQry(xBuilder->weld_message_dialog("SaveModifiedDialog")); + switch (xQry->run()) { case RET_NO: Execute(ID_BROWSER_UNDORECORD,Sequence<PropertyValue>()); diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 0c3ebaf937e3..474104a89191 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -22,6 +22,7 @@ #include <toolkit/awt/vclxwindow.hxx> #include <browserids.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <dbaccess/dataview.hxx> #include <tools/diagnose_ex.h> @@ -204,7 +205,7 @@ bool OGenericUnoController::Construct(vcl::Window* /*pParent*/) { SAL_WARN("dbaccess.ui","OGenericUnoController::Construct: could not create (or start listening at) the database context!"); // at least notify the user. Though the whole component does not make any sense without the database context ... - ShowServiceNotAvailableError(getView(), "com.sun.star.sdb.DatabaseContext", true); + ShowServiceNotAvailableError(getFrameWeld(), "com.sun.star.sdb.DatabaseContext", true); } return true; @@ -1273,6 +1274,11 @@ void SAL_CALL OGenericUnoController::dispose() OGenericUnoController_Base::dispose(); } +weld::Window* OGenericUnoController::getFrameWeld() const +{ + return m_pView ? m_pView->GetFrameWeld() : nullptr; +} + } // namespace dbaui /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 1ff255712dd4..3dd943d14990 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -68,6 +68,7 @@ #include <vcl/msgbox.hxx> #include <vcl/stdtext.hxx> #include <vcl/waitobj.hxx> +#include <vcl/weld.hxx> #include <algorithm> #include <iterator> @@ -204,7 +205,8 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer } catch(const Exception&) { - ShowServiceNotAvailableError(_pParent->GetParent(), "com.sun.star.sdb.DatabaseContext", true); + vcl::Window* pTopParent = _pParent->GetParent(); + ShowServiceNotAvailableError(pTopParent ? pTopParent->GetFrameWeld() : nullptr, "com.sun.star.sdb.DatabaseContext", true); } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 93e7b4b9277a..d3bdf381a3eb 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -32,7 +32,7 @@ #include <svl/intitem.hxx> #include <dsitems.hxx> #include "dbfindex.hxx" -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/mnemonic.hxx> #include <svl/cjkoptions.hxx> #if HAVE_FEATURE_JAVA @@ -309,7 +309,10 @@ namespace dbaui } else return true; - ScopedVclPtrInstance<MessageDialog>(nullptr, MnemonicGenerator::EraseAllMnemonicChars(aErrorText))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + MnemonicGenerator::EraseAllMnemonicChars(aErrorText))); + xBox->run(); pErrorWin->GrabFocus(); return false; } diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx index 2c26dfe85376..b4d23c0815ba 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.cxx +++ b/dbaccess/source/ui/dlg/UserAdmin.cxx @@ -37,7 +37,7 @@ #include <strings.hxx> #include <core_resource.hxx> #include <dbadmin.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <sfx2/passwd.hxx> using namespace ::com::sun::star::container; @@ -103,8 +103,10 @@ IMPL_LINK_NOARG(OPasswordDialog, OKHdl_Impl, Button*, void) else { OUString aErrorMsg( DBA_RES( STR_ERROR_PASSWORDS_NOT_IDENTICAL)); - ScopedVclPtrInstance< MessageDialog > aErrorBox(this, aErrorMsg); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aErrorMsg)); + xErrorBox->run(); m_pEDPassword->SetText( OUString() ); m_pEDPasswordRepeat->SetText( OUString() ); m_pEDPassword->GrabFocus(); @@ -258,8 +260,10 @@ IMPL_LINK( OUserAdmin, UserHdl, Button *, pButton, void ) Reference<XDrop> xDrop(m_xUsers,UNO_QUERY); if(xDrop.is()) { - ScopedVclPtrInstance< MessageDialog > aQry(this, DBA_RES(STR_QUERY_USERADMIN_DELETE_USER), VclMessageType::Question, VclButtonsType::YesNo); - if(aQry->Execute() == RET_YES) + std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_USERADMIN_DELETE_USER))); + if (xQry->run() == RET_YES) xDrop->dropByName(GetUser()); } } diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index d2fa05ff41a0..486a8189b969 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -37,8 +37,8 @@ #include <vcl/button.hxx> #include <vcl/edit.hxx> #include <vcl/field.hxx> -#include <vcl/layout.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <algorithm> #include <stdlib.h> @@ -129,8 +129,10 @@ namespace dbaui // show an error message OUString sError(DBA_RES(STR_COULD_NOT_LOAD_ODBC_LIB)); sError = sError.replaceFirst("#lib#", aEnumeration.getLibraryName()); - ScopedVclPtrInstance< MessageDialog > aDialog(this, sError); - aDialog->Execute(); + std::unique_ptr<weld::MessageDialog> xDialog(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sError)); + xDialog->run(); return false; } else diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index c5adf93792b2..7ca010ee3228 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -21,7 +21,7 @@ #include <directsql.hxx> #include <dbu_dlg.hxx> #include <strings.hrc> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <comphelper/types.hxx> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> @@ -109,8 +109,10 @@ namespace dbaui { OUString sMessage(DBA_RES(STR_DIRECTSQL_CONNECTIONLOST)); - ScopedVclPtrInstance< MessageDialog > aError(this, sMessage); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xError->run(); } PostUserEvent(LINK(this, DirectSQLDialog, OnClose), nullptr, true); diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index 0b7635fd8a35..41eb4cf381c8 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -28,9 +28,9 @@ #include <bitmaps.hlst> #include <indexfieldscontrol.hxx> #include <indexcollection.hxx> -#include <vcl/layout.hxx> -#include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> +#include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/sdb/SQLContext.hpp> #include <UITools.hxx> #include <svtools/imgdef.hxx> @@ -414,8 +414,10 @@ namespace dbaui { OUString sConfirm(DBA_RES(STR_CONFIRM_DROP_INDEX)); sConfirm = sConfirm.replaceFirst("$name$", m_pIndexList->GetEntryText(pSelected)); - ScopedVclPtrInstance< MessageDialog > aConfirm(this, sConfirm, VclMessageType::Question, VclButtonsType::YesNo); - if (RET_YES != aConfirm->Execute()) + std::unique_ptr<weld::MessageDialog> xConfirm(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + sConfirm)); + if (RET_YES != xConfirm->run()) return; } @@ -576,9 +578,9 @@ namespace dbaui if (aSelected->isModified() || aSelected->isNew()) { - ScopedVclPtrInstance<MessageDialog> aQuestion(this, "SaveIndexDialog", - "dbaccess/ui/saveindexdialog.ui" ); - nResponse = aQuestion->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "dbaccess/ui/saveindexdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("SaveIndexDialog")); + nResponse = xQuery->run(); } } @@ -618,8 +620,10 @@ namespace dbaui { OUString sError(DBA_RES(STR_INDEX_NAME_ALREADY_USED)); sError = sError.replaceFirst("$name$", sNewName); - ScopedVclPtrInstance< MessageDialog > aError(this, sError); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sError)); + xError->run(); updateToolbox(); m_bEditAgain = true; @@ -679,8 +683,10 @@ namespace dbaui // need at least one field if (0 == _rPos->aFields.size()) { - ScopedVclPtrInstance< MessageDialog > aError(this, DBA_RES(STR_NEED_INDEX_FIELDS)); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + DBA_RES(STR_NEED_INDEX_FIELDS))); + xError->run(); m_pFields->GrabFocus(); return false; } @@ -697,8 +703,10 @@ namespace dbaui // a column is specified twice ... won't work anyway, so prevent this here and now OUString sMessage(DBA_RES(STR_INDEXDESIGN_DOUBLE_COLUMN_NAME)); sMessage = sMessage.replaceFirst("$name$", aFieldCheck->sFieldName); - ScopedVclPtrInstance< MessageDialog > aError(this, sMessage); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xError->run(); m_pFields->GrabFocus(); return false; } diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx index ee578a736466..7fa6db46298b 100644 --- a/dbaccess/source/ui/dlg/paramdialog.cxx +++ b/dbaccess/source/ui/dlg/paramdialog.cxx @@ -29,7 +29,7 @@ #include <connectivity/dbtools.hxx> #include <stringconstants.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <osl/diagnose.h> #include <tools/diagnose_ex.h> #include <unotools/syslocale.hxx> @@ -201,7 +201,10 @@ namespace dbaui OUString sMessage(DBA_RES(STR_COULD_NOT_CONVERT_PARAM)); sMessage = sMessage.replaceAll( "$name$", sName ); - ScopedVclPtrInstance<MessageDialog>(nullptr, sMessage)->Execute(); + std::unique_ptr<weld::MessageDialog> xDialog(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xDialog->run(); m_pParam->GrabFocus(); return true; } diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index 8171442361fb..b3935df22d6c 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -48,7 +48,8 @@ #include <toolkit/helper/vclunohelper.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> namespace dbaui { @@ -303,8 +304,10 @@ namespace dbaui bool bReConnect = true; if ( _bUI ) { - ScopedVclPtrInstance< MessageDialog > aQuery(getView(), DBA_RES(STR_QUERY_CONNECTION_LOST), VclMessageType::Question, VclButtonsType::YesNo); - bReConnect = ( RET_YES == aQuery->Execute() ); + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_CONNECTION_LOST))); + bReConnect = (RET_YES == xQuery->run()); } // now really reconnect ... @@ -452,7 +455,9 @@ namespace dbaui if ( !pWin ) pWin = getView()->Window::GetParent(); - ScopedVclPtrInstance<MessageDialog>(pWin, aMessage, VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfo(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, aMessage)); + xInfo->run(); } const Reference< XConnection >& DBSubComponentController::getConnection() const { diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index ee67a9a69fe2..e26af4db59ae 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -31,7 +31,7 @@ #include <vcl/svapp.hxx> #include <vcl/combobox.hxx> #include <vcl/msgbox.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <browserids.hxx> #include "SelectionBrowseBox.hxx" #include <strings.hrc> @@ -741,7 +741,12 @@ namespace { // only show the messagebox the first time if (!bCritsOnAsterikWarning) - ScopedVclPtrInstance<MessageDialog>(_pView, DBA_RES(STR_QRY_CRITERIA_ON_ASTERISK))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(_pView ? _pView->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + DBA_RES(STR_QRY_CRITERIA_ON_ASTERISK))); + xBox->run(); + } bCritsOnAsterikWarning = true; continue; } @@ -892,7 +897,12 @@ namespace { // only show the MessageBox the first time if (!bCritsOnAsterikWarning) - ScopedVclPtrInstance<MessageDialog>(_pView, DBA_RES(STR_QRY_ORDERBY_ON_ASTERISK))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(_pView ? _pView->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + DBA_RES(STR_QRY_ORDERBY_ON_ASTERISK))); + xBox->run(); + } bCritsOnAsterikWarning = true; continue; } diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index dfafc9291c24..316080ebca42 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -28,6 +28,7 @@ #include <strings.hrc> #include <strings.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <browserids.hxx> #include <comphelper/types.hxx> #include <core_resource.hxx> @@ -256,9 +257,9 @@ short ORelationController::saveModified() short nSaved = RET_YES; if(haveDataSource() && isModified()) { - ScopedVclPtrInstance<MessageDialog> aQry(getView(), "DesignSaveModifiedDialog", - "dbaccess/ui/designsavemodifieddialog.ui"); - nSaved = aQry->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/designsavemodifieddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DesignSaveModifiedDialog")); + nSaved = xQuery->run(); if(nSaved == RET_YES) Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>()); } diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index c117ef08ee91..0de9fce3f866 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -64,7 +64,8 @@ #include <cppuhelper/exc_hlp.hxx> #include <sfx2/sfxsids.hrc> #include <tools/diagnose_ex.h> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <algorithm> #include <functional> @@ -435,8 +436,10 @@ void OTableController::doEditIndexes() // table needs to be saved before editing indexes if (m_bNew || isModified()) { - ScopedVclPtrInstance< MessageDialog > aAsk(getView(), DBA_RES(STR_QUERY_SAVE_TABLE_EDIT_INDEXES), VclMessageType::Question, VclButtonsType::YesNo); - if (RET_YES != aAsk->Execute()) + std::unique_ptr<weld::MessageDialog> xAsk(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_SAVE_TABLE_EDIT_INDEXES))); + if (RET_YES != xAsk->run()) return; if (!doSaveDoc(false)) @@ -550,9 +553,9 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) if ( std::any_of(m_vRowList.begin(),m_vRowList.end(), std::mem_fn(&OTableRow::isValid)) ) { - ScopedVclPtrInstance<MessageDialog> aQry(getView(), "TableDesignSaveModifiedDialog", - "dbaccess/ui/tabledesignsavemodifieddialog.ui"); - switch (aQry->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/tabledesignsavemodifieddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("TableDesignSaveModifiedDialog")); + switch (xQuery->run()) { case RET_YES: Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>()); @@ -568,9 +571,9 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) } else if ( !m_bNew ) { - ScopedVclPtrInstance<MessageDialog> aQry(getView(), "DeleteAllRowsDialog", - "dbaccess/ui/deleteallrowsdialog.ui"); - switch (aQry->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/deleteallrowsdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DeleteAllRowsDialog")); + switch (xQuery->run()) { case RET_YES: { diff --git a/dbaccess/uiconfig/ui/deleteallrowsdialog.ui b/dbaccess/uiconfig/ui/deleteallrowsdialog.ui index 1d4ccc4ad04a..a9804934b6c5 100644 --- a/dbaccess/uiconfig/ui/deleteallrowsdialog.ui +++ b/dbaccess/uiconfig/ui/deleteallrowsdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="DeleteAllRowsDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -18,7 +17,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -74,9 +72,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/dbaccess/uiconfig/ui/designsavemodifieddialog.ui b/dbaccess/uiconfig/ui/designsavemodifieddialog.ui index 7719a809c283..87e19c826edf 100644 --- a/dbaccess/uiconfig/ui/designsavemodifieddialog.ui +++ b/dbaccess/uiconfig/ui/designsavemodifieddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="DesignSaveModifiedDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -19,7 +18,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -75,9 +73,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/dbaccess/uiconfig/ui/saveindexdialog.ui b/dbaccess/uiconfig/ui/saveindexdialog.ui index 55b4aa026e54..747c22db35f0 100644 --- a/dbaccess/uiconfig/ui/saveindexdialog.ui +++ b/dbaccess/uiconfig/ui/saveindexdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="SaveIndexDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="saveindexdialog|SaveIndexDialog">Exit Index Design</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -19,7 +18,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -75,9 +73,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/dbaccess/uiconfig/ui/savemodifieddialog.ui b/dbaccess/uiconfig/ui/savemodifieddialog.ui index 9683244795cd..29a8d2e6616f 100644 --- a/dbaccess/uiconfig/ui/savemodifieddialog.ui +++ b/dbaccess/uiconfig/ui/savemodifieddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="SaveModifiedDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -19,7 +18,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -75,9 +73,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/dbaccess/uiconfig/ui/tabledesignsavemodifieddialog.ui b/dbaccess/uiconfig/ui/tabledesignsavemodifieddialog.ui index 066ebe2e22d5..178b2a6c1ee0 100644 --- a/dbaccess/uiconfig/ui/tabledesignsavemodifieddialog.ui +++ b/dbaccess/uiconfig/ui/tabledesignsavemodifieddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="TableDesignSaveModifiedDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -19,7 +18,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -75,9 +73,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 936671f07e58..77152718287e 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -103,7 +103,7 @@ #include <svtools/menuoptions.hxx> #include <rtl/bootstrap.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <sfx2/sfxsids.hrc> #include <sfx2/app.hxx> @@ -634,9 +634,10 @@ void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStat OUString const aMessage(aDiagnosticMessage + "\n"); - ScopedVclPtrInstance< MessageDialog > aBootstrapFailedBox(nullptr, aMessage); - aBootstrapFailedBox->SetText( aProductKey ); - aBootstrapFailedBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBootstrapFailedBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aMessage)); + xBootstrapFailedBox->set_title(aProductKey); + xBootstrapFailedBox->run(); } } @@ -1049,8 +1050,9 @@ void restartOnMac(bool passArguments) { (void) passArguments; // avoid warnings OUString aMessage = DpResId(STR_LO_MUST_BE_RESTARTED); - MessageDialog aRestartBox(NULL, aMessage); - aRestartBox.Execute(); + std::unique_ptr<weld::MessageDialog> xRestartBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aMessage)); + xRestartBox->Execute(); #else OUString execUrl; OSL_VERIFY(osl_getExecutableFile(&execUrl.pData) == osl_Process_E_None); @@ -2153,8 +2155,10 @@ void Desktop::OpenClients() { aRequest.aPrintList.clear(); aRequest.aPrintToList.clear(); - ScopedVclPtrInstance< MessageDialog > aBox(nullptr, DpResId(STR_ERR_PRINTDISABLED)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + DpResId(STR_ERR_PRINTDISABLED))); + xBox->run(); } // Process request diff --git a/desktop/source/app/lockfile2.cxx b/desktop/source/app/lockfile2.cxx index 31911f561719..44447927f63b 100644 --- a/desktop/source/app/lockfile2.cxx +++ b/desktop/source/app/lockfile2.cxx @@ -17,14 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <dp_shared.hxx> #include <strings.hrc> #include <tools/config.hxx> #include <lockfile.hxx> - namespace desktop { bool Lockfile_execWarning( Lockfile const * that ) @@ -38,22 +37,22 @@ bool Lockfile_execWarning( Lockfile const * that ) OString aTime = aConfig.ReadKey( LOCKFILE_TIMEKEY ); // display warning and return response - ScopedVclPtrInstance<MessageDialog> aBox(nullptr, DpResId(STR_QUERY_USERDATALOCKED), - VclMessageType::Question, VclButtonsType::YesNo); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, DpResId(STR_QUERY_USERDATALOCKED))); // set box title OUString aTitle = DpResId(STR_TITLE_USERDATALOCKED); - aBox->SetText( aTitle ); + xBox->set_title( aTitle ); // insert values... - OUString aMsgText = aBox->get_primary_text(); + OUString aMsgText = xBox->get_primary_text(); aMsgText = aMsgText.replaceFirst( "$u", OStringToOUString( aUser, RTL_TEXTENCODING_ASCII_US) ); aMsgText = aMsgText.replaceFirst( "$h", OStringToOUString( aHost, RTL_TEXTENCODING_ASCII_US) ); aMsgText = aMsgText.replaceFirst( "$t", OStringToOUString( aTime, RTL_TEXTENCODING_ASCII_US) ); - aBox->set_primary_text(aMsgText); + xBox->set_primary_text(aMsgText); // do it - return aBox->Execute( ) == RET_YES; + return xBox->run() == RET_YES; } } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index f477e4245d31..9888958807b0 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -358,26 +358,24 @@ bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > return xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER; } - bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackage > &xPackage, - vcl::Window *pParent, + weld::Widget* pParent, const char* pResID, bool &bHadWarning ) { if ( !bHadWarning && IsSharedPkgMgr( xPackage ) ) { const SolarMutexGuard guard; - ScopedVclPtrInstance<MessageDialog> aInfoBox(pParent, DpResId(pResID), - VclMessageType::Warning, VclButtonsType::OkCancel); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(pResID))); bHadWarning = true; - return RET_OK == aInfoBox->Execute(); + return RET_OK == xBox->run(); } else return true; } - void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle ) const { if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty @@ -395,9 +393,10 @@ void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle uno::Any exc( ::cppu::getCaughtException() ); OUString msg( ::comphelper::anyToString( exc ) ); const SolarMutexGuard guard; - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg); - aErrorBox->SetText( sTitle ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, msg)); + xErrorBox->set_title(sTitle); + xErrorBox->run(); } } @@ -409,30 +408,30 @@ bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const // Check if extension installation is disabled in the expert configurations if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get()) { - ScopedVclPtrInstance<MessageDialog> aWarn(m_pVCLWindow, DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED), - VclMessageType::Warning, VclButtonsType::Ok); - aWarn->Execute(); + std::unique_ptr<weld::MessageDialog> xWarnBox(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED))); + xWarnBox->run(); return false; } - ScopedVclPtrInstance<MessageDialog> aInfo(m_pVCLWindow, DpResId(RID_STR_WARNING_INSTALL_EXTENSION), - VclMessageType::Warning, VclButtonsType::OkCancel); - - OUString sText(aInfo->get_primary_text()); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Warning, VclButtonsType::OkCancel, + DpResId(RID_STR_WARNING_INSTALL_EXTENSION))); + OUString sText(xInfoBox->get_primary_text()); sText = sText.replaceAll("%NAME", rExtensionName); - aInfo->set_primary_text(sText); + xInfoBox->set_primary_text(sText); - return ( RET_OK == aInfo->Execute() ); + return (RET_OK == xInfoBox->run()); } bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const { const SolarMutexGuard guard; - ScopedVclPtrInstance<MessageDialog> aQuery(m_pVCLWindow, "InstallForAllDialog", - "desktop/ui/installforalldialog.ui"); - - short nRet = aQuery->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "desktop/ui/installforalldialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("InstallForAllDialog")); + short nRet = xQuery->run(); if (nRet == RET_CANCEL) return false; @@ -592,14 +591,15 @@ void ExtMgrDialog::checkEntries() bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const { const SolarMutexGuard guard; - ScopedVclPtrInstance<MessageDialog> aInfo(const_cast<ExtMgrDialog*>(this), DpResId(RID_STR_WARNING_REMOVE_EXTENSION), - VclMessageType::Warning, VclButtonsType::OkCancel); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::OkCancel, + DpResId(RID_STR_WARNING_REMOVE_EXTENSION))); - OUString sText(aInfo->get_primary_text()); + OUString sText(xInfoBox->get_primary_text()); sText = sText.replaceAll("%NAME", rExtensionName); - aInfo->set_primary_text(sText); + xInfoBox->set_primary_text(sText); - return ( RET_OK == aInfo->Execute() ); + return (RET_OK == xInfoBox->run()); } void ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage, @@ -610,12 +610,12 @@ void ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > & if ( bEnable ) { - if ( ! continueOnSharedExtension( xPackage, this, RID_STR_WARNING_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) ) + if (!continueOnSharedExtension(xPackage, GetFrameWeld(), RID_STR_WARNING_ENABLE_SHARED_EXTENSION, m_bEnableWarning)) return; } else { - if ( ! continueOnSharedExtension( xPackage, this, RID_STR_WARNING_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) ) + if (!continueOnSharedExtension(xPackage, GetFrameWeld(), RID_STR_WARNING_DISABLE_SHARED_EXTENSION, m_bDisableWarning)) return; } @@ -634,7 +634,7 @@ void ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > & return; } - if ( ! continueOnSharedExtension( xPackage, this, RID_STR_WARNING_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) ) + if (!continueOnSharedExtension(xPackage, GetFrameWeld(), RID_STR_WARNING_REMOVE_SHARED_EXTENSION, m_bDeleteWarning)) return; m_pManager->getCmdQueue()->removeExtension( xPackage ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 29cf6b47722e..ed00106535e8 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -29,6 +29,7 @@ #include <vcl/prgsbar.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> +#include <vcl/weld.hxx> #include <svtools/svmedit.hxx> @@ -68,6 +69,7 @@ public: void openWebBrowser( const OUString & sURL, const OUString & sTitle ) const; Dialog* getWindow() const { return m_pVCLWindow; }; + weld::Window* getFrameWeld() const { return m_pVCLWindow ? m_pVCLWindow->GetFrameWeld() : nullptr; } void PostUserEvent( const Link<void*,void>& rLink, void* pCaller ); void clearEventID() { m_nEventID = nullptr; } @@ -85,7 +87,7 @@ public: static bool IsSharedPkgMgr( const css::uno::Reference< css::deployment::XPackage > &); static bool continueOnSharedExtension( const css::uno::Reference< css::deployment::XPackage > &, - vcl::Window *pParent, + weld::Widget* pParent, const char* pResID, bool &bHadWarning ); diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 84246cd046db..331acea1e170 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -62,7 +62,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/anytostring.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <toolkit/helper/vclunohelper.hxx> #include "dp_gui.h" @@ -145,7 +145,7 @@ public: , m_nCurrentProgress(0) {} - Dialog * activeDialog() { return m_pDialogHelper ? m_pDialogHelper->getWindow() : nullptr; } + weld::Window* activeDialog() { return m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr; } void startProgress(); void stopProgress(); @@ -421,12 +421,12 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & verExc.Deployed->getDisplayName(); { SolarMutexGuard guard; - ScopedVclPtrInstance<MessageDialog> box(m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, - DpResId(id), VclMessageType::Warning, VclButtonsType::OkCancel); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, DpResId(id))); OUString s; if (bEqualNames) { - s = box->get_primary_text(); + s = xBox->get_primary_text(); } else if (!strcmp(id, RID_STR_WARNING_VERSION_EQUAL)) { @@ -447,8 +447,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & s = s.replaceAll("$OLDNAME", verExc.Deployed->getDisplayName()); s = s.replaceAll("$NEW", getVersion(verExc.NewVersion)); s = s.replaceAll("$DEPLOYED", getVersion(verExc.Deployed)); - box->set_primary_text(s); - approve = box->Execute() == RET_OK; + xBox->set_primary_text(s); + approve = xBox->run() == RET_OK; abort = !approve; } } @@ -476,8 +476,9 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & SolarMutexGuard guard; OUString sMsg(DpResId(RID_STR_UNSUPPORTED_PLATFORM)); sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName()); - ScopedVclPtrInstance< MessageDialog > box(m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, sMsg); - box->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, sMsg)); + xBox->run(); approve = true; } @@ -539,8 +540,9 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus ) text = ::comphelper::anyToString( rStatus ); // fallback const SolarMutexGuard aGuard; - ScopedVclPtrInstance< MessageDialog > aBox(m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, text); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, text)); + xBox->run(); } ++m_nCurrentProgress; updateProgress(); @@ -781,11 +783,11 @@ void ExtensionCmdQueue::Thread::execute() msg = ::comphelper::anyToString(exc); const SolarMutexGuard guard; - ScopedVclPtr<MessageDialog> box( - VclPtr<MessageDialog>::Create(currentCmdEnv->activeDialog(), msg)); - if ( m_pDialogHelper ) - box->SetText( m_pDialogHelper->getWindow()->GetText() ); - box->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(currentCmdEnv->activeDialog(), + VclMessageType::Warning, VclButtonsType::Ok, msg)); + if (m_pDialogHelper) + xBox->set_title(m_pDialogHelper->getWindow()->GetText()); + xBox->run(); //Continue with installation of the remaining extensions } { diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index c3d7638c00fa..1f93cdd49fb7 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -28,7 +28,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/servicedecl.hxx> #include <comphelper/unwrapargs.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -214,9 +214,10 @@ void ServiceImpl::startExecuteModal( catch (const Exception & exc) { if (bAppUp) { const SolarMutexGuard guard; - ScopedVclPtrInstance<MessageDialog> box( - Application::GetActiveTopWindow(), exc.Message); - box->Execute(); + vcl::Window* pWin = Application::GetActiveTopWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, exc.Message)); + xBox->run(); } throw; } diff --git a/desktop/uiconfig/ui/installforalldialog.ui b/desktop/uiconfig/ui/installforalldialog.ui index c3d3576db024..220bc6f6b4ff 100644 --- a/desktop/uiconfig/ui/installforalldialog.ui +++ b/desktop/uiconfig/ui/installforalldialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="InstallForAllDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -19,7 +18,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> <child> <object class="GtkButton" id="no"> <property name="label" translatable="yes" context="installforalldialog|no">_For all users</property> @@ -75,9 +73,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index b7e6420b11c8..bf883bf72500 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -18,9 +18,9 @@ */ #include <rtl/ustring.hxx> -#include <vcl/wrkwin.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> +#include <vcl/wrkwin.hxx> #include <svtools/langtab.hxx> #include <vcl/errinf.hxx> @@ -363,8 +363,10 @@ bool SvxSpellWrapper::SpellNext( ) WAIT_OFF(); const char* pResId = bReverse ? RID_SVXSTR_QUERY_BW_CONTINUE : RID_SVXSTR_QUERY_CONTINUE; - ScopedVclPtrInstance< MessageDialog > aBox(pWin, EditResId(pResId), VclMessageType::Question, VclButtonsType::YesNo); - if ( aBox->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + EditResId(pResId))); + if (xBox->run() != RET_YES) { // sacrifice the other area if necessary ask for special area WAIT_ON(); diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index 270025e986c1..1236cac6decf 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -26,9 +26,10 @@ #include "typeselectionpage.hxx" #include "admininvokationpage.hxx" #include "tableselectionpage.hxx" -#include <vcl/waitobj.hxx> -#include <vcl/layout.hxx> #include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/waitobj.hxx> +#include <vcl/weld.hxx> #include "abpfinalpage.hxx" #include "fieldmappingpage.hxx" #include "fieldmappingimpl.hxx" @@ -263,7 +264,11 @@ namespace abp if ( aTables.empty() ) { - if (RET_YES != ScopedVclPtrInstance<MessageDialog>(this, compmodule::ModuleRes(getSettings().eType == AST_EVOLUTION_GROUPWISE ? RID_STR_QRY_NO_EVO_GW : RID_STR_QRY_NOTABLES), VclMessageType::Question, VclButtonsType::YesNo)->Execute()) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + compmodule::ModuleRes(getSettings().eType == AST_EVOLUTION_GROUPWISE ? RID_STR_QRY_NO_EVO_GW : RID_STR_QRY_NOTABLES))); + + if (RET_YES != xBox->run()) { // cannot ask the user, or the user chose to use this data source, though there are no tables bAllow = false; @@ -383,7 +388,7 @@ namespace abp if ( _bForceReConnect && m_aNewDataSource.isConnected( ) ) m_aNewDataSource.disconnect( ); - return m_aNewDataSource.connect( this ); + return m_aNewDataSource.connect(GetFrameWeld()); } diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx index 9f1706f2c086..fbb25e46853a 100644 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ b/extensions/source/abpilot/admininvokationimpl.cxx @@ -28,6 +28,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <strings.hrc> #include <componentmodule.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> @@ -51,7 +52,7 @@ namespace abp { DBG_ASSERT(m_xContext.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid service factory!"); DBG_ASSERT(m_xDataSource.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid preferred name!"); - DBG_ASSERT(m_pMessageParent, "OAdminDialogInvokation::OAdminDialogInvokation: invalid message parent!"); + assert(m_pMessageParent && "OAdminDialogInvokation::OAdminDialogInvokation: invalid message parent!"); } @@ -101,7 +102,7 @@ namespace abp return true; } else - ShowServiceNotAvailableError(m_pMessageParent, s_sAdministrationServiceName, true); + ShowServiceNotAvailableError(m_pMessageParent->GetFrameWeld(), s_sAdministrationServiceName, true); } catch(const Exception&) { diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 75f2685ea13b..2194f158cb00 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -48,6 +48,7 @@ #include <unotools/confignode.hxx> #include <unotools/sharedunocomponent.hxx> #include <vcl/stdtext.hxx> +#include <vcl/weld.hxx> #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> #include <sfx2/viewfrm.hxx> @@ -514,7 +515,7 @@ namespace abp } - bool ODataSource::connect( vcl::Window* _pMessageParent ) + bool ODataSource::connect(weld::Window* _pMessageParent) { if ( isConnected( ) ) // nothing to do diff --git a/extensions/source/abpilot/datasourcehandling.hxx b/extensions/source/abpilot/datasourcehandling.hxx index 7cde550a6e0b..f7f794fd41cf 100644 --- a/extensions/source/abpilot/datasourcehandling.hxx +++ b/extensions/source/abpilot/datasourcehandling.hxx @@ -33,7 +33,7 @@ namespace com { namespace sun { namespace star { } } } } -namespace vcl { class Window; } +namespace weld { class Window; } namespace abp @@ -144,7 +144,7 @@ namespace abp at all. @see isConnected */ - bool connect( vcl::Window* _pMessageParent ); + bool connect(weld::Window* _pMessageParent); /// returns <TRUE/> if the object has a valid connection, obtained from its data source bool isConnected( ) const; diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx index 1a730477b6ea..627f735f3fbc 100644 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ b/extensions/source/abpilot/typeselectionpage.cxx @@ -20,7 +20,8 @@ #include "typeselectionpage.hxx" #include "addresssettings.hxx" #include "abspilot.hxx" -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/sdbc/XDriver.hpp> #include <com/sun/star/sdbc/DriverManager.hpp> #include <comphelper/processfactory.hxx> @@ -228,8 +229,10 @@ namespace abp if (AST_INVALID == getSelectedType( )) { - ScopedVclPtrInstance< MessageDialog > aError(this, compmodule::ModuleRes(RID_STR_NEEDTYPESELECTION)); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + compmodule::ModuleRes(RID_STR_NEEDTYPESELECTION))); + xBox->run(); return false; } diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx index 08beda2a170b..4c2d7890c9c1 100644 --- a/extensions/source/dbpilots/commonpagesdbp.cxx +++ b/extensions/source/dbpilots/commonpagesdbp.cxx @@ -293,7 +293,7 @@ namespace dbp if (m_xDSContext->getByName(sCurrentDatasource) >>= xDatasource) { // connect // get the default SDB interaction handler - Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(this); + Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(GetFrameWeld()); if (!xHandler.is() ) return; xConn = xDatasource->connectWithCompletion(xHandler); @@ -353,7 +353,7 @@ namespace dbp try { // get the default SDB interaction handler - Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(this); + Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(GetFrameWeld()); if ( xHandler.is() ) xHandler->handle(xRequest); } diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 54d10fd2c036..8577aa14c80a 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -459,7 +459,7 @@ namespace dbp return initContext(); } - Reference< XInteractionHandler > OControlWizard::getInteractionHandler(vcl::Window* _pWindow) const + Reference< XInteractionHandler > OControlWizard::getInteractionHandler(weld::Window* _pWindow) const { Reference< XInteractionHandler > xHandler; try @@ -613,7 +613,7 @@ namespace dbp aContext.NextException = aSQLException; // create an interaction handler to display this exception - Reference< XInteractionHandler > xHandler = getInteractionHandler(this); + Reference< XInteractionHandler > xHandler = getInteractionHandler(GetFrameWeld()); if ( !xHandler.is() ) return false; diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx index 54453fcc071c..8b072eb1827e 100644 --- a/extensions/source/dbpilots/controlwizard.hxx +++ b/extensions/source/dbpilots/controlwizard.hxx @@ -30,6 +30,7 @@ #include <vcl/button.hxx> #include <vcl/lstbox.hxx> #include <vcl/combobox.hxx> +#include <vcl/weld.hxx> #include "dbptypes.hxx" #include <strings.hrc> #include <componentmodule.hxx> @@ -119,7 +120,7 @@ namespace dbp /** returns the com.sun.star.task.InteractionHandler @param _pWindow The window will be used when an error message has to be shown. */ - css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler(vcl::Window* _pWindow) const; + css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler(weld::Window* _pWindow) const; protected: // initialize the derivees settings (which have to be derived from OControlWizardSettings) diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 13553c7b6f76..d435b836f588 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -22,7 +22,7 @@ #include <tools/config.hxx> #include <unotools/resmgr.hxx> #include <vcl/dibtools.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/builderfactory.hxx> @@ -330,8 +330,10 @@ short SaneDlg::Execute() { if( ! Sane::IsSane() ) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SaneResId(STR_COULD_NOT_BE_INIT)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SaneResId(STR_COULD_NOT_BE_INIT))); + xErrorBox->run(); return RET_CANCEL; } LoadState(); @@ -610,8 +612,10 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton, void ) aString = aString.replaceFirst( "%s", Sane::GetVendor( mrSane.GetDeviceNumber() ) ); aString = aString.replaceFirst( "%s", Sane::GetModel( mrSane.GetDeviceNumber() ) ); aString = aString.replaceFirst( "%s", Sane::GetType( mrSane.GetDeviceNumber() ) ); - ScopedVclPtrInstance< MessageDialog > aInfoBox(this, aString, VclMessageType::Info); - aInfoBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + aString)); + xInfoBox->run(); } else if( pButton == mpPreviewButton ) AcquirePreview(); @@ -881,8 +885,10 @@ void SaneDlg::AcquirePreview() if( nOption == -1 ) { OUString aString(SaneResId(STR_SLOW_PREVIEW)); - ScopedVclPtrInstance< MessageDialog > aBox(this, aString, VclMessageType::Warning, VclButtonsType::OkCancel); - if (aBox->Execute() == RET_CANCEL) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::OkCancel, + aString)); + if (xBox->run() == RET_CANCEL) return; } else @@ -891,8 +897,10 @@ void SaneDlg::AcquirePreview() rtl::Reference<BitmapTransporter> xTransporter(new BitmapTransporter); if( ! mrSane.Start( *xTransporter.get() ) ) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SaneResId(STR_ERROR_SCAN)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SaneResId(STR_ERROR_SCAN))); + xErrorBox->run(); } else { diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index f6d9c1f2c1be..82e8e55a750a 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -40,7 +40,7 @@ #include <vcl/idle.hxx> #include <vcl/menu.hxx> #include <vcl/outdev.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <vcl/lineinfo.hxx> #include <vcl/button.hxx> @@ -544,7 +544,10 @@ IMPL_LINK_NOARG(UpdateCheckUI, ClickHdl, MenuBar::MenuBarButtonCallbackArg&, boo mrJob->execute( aEmpty ); } catch(const uno::Exception&) { - ScopedVclPtrInstance<MessageDialog>(nullptr, Translate::get(STR_NO_WEBBROWSER_FOUND, maSfxLocale))->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + Translate::get(STR_NO_WEBBROWSER_FOUND, maSfxLocale))); + xErrorBox->run(); } } diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index b76a73136d5c..5aef8a4695ff 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -23,9 +23,9 @@ #include <strings.hrc> #include <bitmaps.hlst> #include <officecfg/Office/Common.hxx> -#include <vcl/layout.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/passwd.hxx> #include <svtools/miscopt.hxx> #include <unotools/resmgr.hxx> @@ -869,8 +869,10 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl, CheckBox&, void) // if a password was set, inform the user that this will not be used in PDF/A case if( mpCbPDFA1b->IsChecked() && pSecPage && pSecPage->hasPassword() ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, PDFFilterResId(STR_WARN_PASSWORD_PDFA), VclMessageType::Warning); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + PDFFilterResId(STR_WARN_PASSWORD_PDFA))); + xBox->run(); } } diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index e6d332cbaa3e..cfd33647b1f9 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -27,7 +27,7 @@ #include <vcl/fixed.hxx> #include <vcl/field.hxx> #include <vcl/edit.hxx> -#include <vcl/layout.hxx> +#include <vcl/messagedialog.hxx> #include <vcl/lstbox.hxx> #include <vcl/combobox.hxx> #include <vcl/group.hxx> diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index c937e15a9e08..b153cb67ea2f 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/fileurl.hxx> #include <unotools/resmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <osl/file.hxx> #include <strings.hrc> @@ -261,8 +261,10 @@ bool XMLFilterTabDialog::onOk() aMessage = aMessage.replaceAll( "%s", aReplace1 ); } - ScopedVclPtrInstance< MessageDialog > aBox(this, aMessage); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aMessage)); + xBox->run(); if( pFocusWindow ) pFocusWindow->GrabFocus(); diff --git a/filter/uiconfig/ui/warnpdfdialog.ui b/filter/uiconfig/ui/warnpdfdialog.ui index 0eda449ff96d..093c7bca1709 100644 --- a/filter/uiconfig/ui/warnpdfdialog.ui +++ b/filter/uiconfig/ui/warnpdfdialog.ui @@ -23,7 +23,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> diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index d70723eb7634..c37ccc998ff9 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -853,9 +853,9 @@ IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void ) { OUString sMsg = FpsResId( STR_SVT_DELETESERVICE ); sMsg = sMsg.replaceFirst( "$servicename$", m_pServices_lb->GetSelectedEntry() ); - ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VclMessageType::Question, VclButtonsType::YesNo ); - - if( aBox->Execute() == RET_YES ) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, sMsg)); + if (xBox->run() == RET_YES) { // remove password try @@ -1158,8 +1158,9 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, Button*, void ) { OUString sMsg = FpsResId( STR_SVT_ALREADYEXISTOVERWRITE ); sMsg = sMsg.replaceFirst( "$filename$", sName ); - ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VclMessageType::Question, VclButtonsType::YesNo ); - if( aBox->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, sMsg)); + if (xBox->run() != RET_YES) return; } } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 873b5ccd2f76..8bc9a1dee129 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1076,8 +1076,9 @@ void SvtFileDialog::OpenHdl_Impl(void const * pVoid) "$filename$", aFileObj.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset) ); - ScopedVclPtrInstance< MessageDialog > aBox(this, aMsg, VclMessageType::Question, VclButtonsType::YesNo); - if ( aBox->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, aMsg)); + if (xBox->run() != RET_YES) return; } else @@ -1121,8 +1122,9 @@ void SvtFileDialog::OpenHdl_Impl(void const * pVoid) } sError = sError.replaceFirst( "$name$", sInvalidFile ); - ScopedVclPtrInstance< MessageDialog > aError(this, sError); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sError)); + xBox->run(); return; } } @@ -1834,8 +1836,10 @@ short SvtFileDialog::PrepareExecute() if ( bEmpty ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, FpsResId(STR_SVT_NOREMOVABLEDEVICE)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + FpsResId(STR_SVT_NOREMOVABLEDEVICE))); + xBox->run(); return 0; } } diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx index a285e26474fc..2b93d411e194 100644 --- a/include/avmedia/mediawindow.hxx +++ b/include/avmedia/mediawindow.hxx @@ -34,6 +34,7 @@ #define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0 namespace vcl { class Window; } +namespace weld { class Widget; } class KeyEvent; class MouseEvent; class CommandEvent; @@ -99,7 +100,7 @@ namespace avmedia /// @param o_pbLink if not 0, this is an "insert" dialog: display link /// checkbox and store its state in *o_pbLink static bool executeMediaURLDialog(const vcl::Window* pParent, OUString& rURL, bool *const o_pbLink); - static void executeFormatErrorBox( vcl::Window* pParent ); + static void executeFormatErrorBox(weld::Widget* pParent); static bool isMediaURL( const OUString& rURL, const OUString& rReferer, bool bDeep = false, Size* pPreferredSizePixel = nullptr ); static css::uno::Reference< css::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType = nullptr ); diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx index 52fc8bcbd994..4f97727acc9b 100644 --- a/include/dbaccess/genericcontroller.hxx +++ b/include/dbaccess/genericcontroller.hxx @@ -90,6 +90,7 @@ namespace com { namespace sun { namespace star { } } } namespace vcl { class Window; } +namespace weld { class Window; } class NotifyEvent; namespace dbaui @@ -415,6 +416,7 @@ namespace dbaui public: const css::uno::Reference< css::uno::XComponentContext >& getORB() const { return m_xContext; } ODataView* getView() const { return m_pView; } + weld::Window* getFrameWeld() const; void setView( const VclPtr<ODataView>& i_rView ); void clearView(); // shows a error box if the SQLExceptionInfo is valid diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx index 09922feb60ba..00aecfeaea99 100644 --- a/include/sfx2/QuerySaveDocument.hxx +++ b/include/sfx2/QuerySaveDocument.hxx @@ -22,7 +22,7 @@ #include <rtl/ustring.hxx> #include <sfx2/dllapi.h> -namespace vcl { class Window; } +namespace weld { class Widget; } /** Opens the general query save document dialog. @param _pParent @@ -31,7 +31,7 @@ namespace vcl { class Window; } The title of the document. */ SFX2_DLLPUBLIC short ExecuteQuerySaveDocument( - vcl::Window* _pParent, const OUString& _rTitle); + weld::Widget* _pParent, const OUString& _rTitle); #endif // INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx index bbafa704f76b..dceeeec2e7ec 100644 --- a/include/sfx2/newstyle.hxx +++ b/include/sfx2/newstyle.hxx @@ -27,6 +27,7 @@ #include <vcl/combobox.hxx> #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> +#include <vcl/weld.hxx> class SfxStyleSheetBasePool; @@ -36,7 +37,7 @@ private: VclPtr<ComboBox> m_pColBox; VclPtr<OKButton> m_pOKBtn; - VclPtr<MessageDialog> aQueryOverwriteBox; + std::unique_ptr<weld::MessageDialog> xQueryOverwriteBox; SfxStyleSheetBasePool& rPool; DECL_DLLPRIVATE_LINK( OKHdl, ComboBox&, void ); diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx index 617dd1853612..21a5098e89bf 100644 --- a/include/svtools/fileview.hxx +++ b/include/svtools/fileview.hxx @@ -28,7 +28,7 @@ #include <vcl/fixed.hxx> #include <vcl/dialog.hxx> #include <vcl/button.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <rtl/ustring.hxx> // class SvtFileView ----------------------------------------------------- @@ -209,17 +209,19 @@ enum QueryDeleteResult_Impl QUERYDELETE_ALL = 101 }; -class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public MessageDialog +class SVT_DLLPUBLIC QueryDeleteDlg_Impl { private: - VclPtr<PushButton> m_pAllButton; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; + std::unique_ptr<weld::Button> m_xAllButton; public: - QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& rName); - virtual ~QueryDeleteDlg_Impl() override; - virtual void dispose() override; + QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName); + short run() { return m_xDialog->run(); } + ~QueryDeleteDlg_Impl(); - void EnableAllButton() { m_pAllButton->Enable(); } + void EnableAllButton() { m_xAllButton->set_sensitive(true); } }; } diff --git a/include/svx/graphichelper.hxx b/include/svx/graphichelper.hxx index 72f13e70f56c..2a833aa9f9c5 100644 --- a/include/svx/graphichelper.hxx +++ b/include/svx/graphichelper.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_GRAPHICHELPER_HXX #include <vcl/graph.hxx> +#include <vcl/weld.hxx> #include <svx/svxdllapi.h> #include <com/sun/star/drawing/XShape.hpp> @@ -32,7 +33,7 @@ public: static void GetPreferredExtension( OUString& rExtension, const Graphic& rGraphic ); static OUString ExportGraphic(const vcl::Window* pWin, const Graphic& rGraphic, const OUString& rGraphicName); static void SaveShapeAsGraphic(const vcl::Window* pWin, const css::uno::Reference< css::drawing::XShape >& xShape); - static short HasToSaveTransformedImage(vcl::Window* pWin); + static short HasToSaveTransformedImage(weld::Widget* pWin); }; diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx index 3531cafb3046..e9bd472446c4 100644 --- a/include/svx/hdft.hxx +++ b/include/svx/hdft.hxx @@ -24,7 +24,8 @@ #include <vcl/fixed.hxx> #include <vcl/field.hxx> #include <vcl/group.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <svx/pagectrl.hxx> #include <svx/svxdllapi.h> @@ -120,24 +121,32 @@ public: SVX_DLLPRIVATE SvxFooterPage( vcl::Window* pParent, const SfxItemSet& rSet ); }; -class SVX_DLLPUBLIC DeleteHeaderDialog : public MessageDialog +class SVX_DLLPUBLIC DeleteHeaderDialog { +private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; public: - DeleteHeaderDialog(vcl::Window *pParent) - : MessageDialog(pParent, "DeleteHeaderDialog", - "svx/ui/deleteheaderdialog.ui") + DeleteHeaderDialog(weld::Widget* pParent) + : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/deleteheaderdialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("DeleteHeaderDialog")) { } + short run() { return m_xDialog->run(); } }; -class SVX_DLLPUBLIC DeleteFooterDialog : public MessageDialog +class SVX_DLLPUBLIC DeleteFooterDialog { +private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; public: - DeleteFooterDialog(vcl::Window *pParent) - : MessageDialog(pParent, "DeleteFooterDialog", - "svx/ui/deletefooterdialog.ui") + DeleteFooterDialog(weld::Widget* pParent) + : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/deletefooterdialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("DeleteFooterDialog")) { } + short run() { return m_xDialog->run(); } }; #endif diff --git a/include/svx/linkwarn.hxx b/include/svx/linkwarn.hxx index 07ea3b892c3c..96143fd0a68d 100644 --- a/include/svx/linkwarn.hxx +++ b/include/svx/linkwarn.hxx @@ -20,19 +20,20 @@ #ifndef INCLUDED_SVX_LINKWARN_HXX #define INCLUDED_SVX_LINKWARN_HXX -#include <vcl/button.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svx/svxdllapi.h> -class SVX_DLLPUBLIC SvxLinkWarningDialog : public MessageDialog +class SVX_DLLPUBLIC SvxLinkWarningDialog { private: - VclPtr<CheckBox> m_pWarningOnBox; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; + std::unique_ptr<weld::CheckButton> m_xWarningOnBox; public: - SvxLinkWarningDialog(vcl::Window* pParent, const OUString& _rFileName); - virtual ~SvxLinkWarningDialog() override; - virtual void dispose() override; + SvxLinkWarningDialog(weld::Widget* pParent, const OUString& _rFileName); + short run() { return m_xDialog->run(); } + ~SvxLinkWarningDialog(); }; #endif // INCLUDED_SVX_LINKWARN_HXX diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx index 9588da8b6fe6..d4a9b418c7ab 100644 --- a/include/vcl/edit.hxx +++ b/include/vcl/edit.hxx @@ -39,6 +39,9 @@ namespace i18n { class XBreakIterator; class XExtendedInputSequenceChecker; }}}} +namespace weld { + class Widget; +} class VclBuilder; struct DDInfo; @@ -249,7 +252,7 @@ public: sal_Int32 GetCharPos( const Point& rWindowPos ) const; // shows a warning box saying "text too long, truncated" - static void ShowTruncationWarning( vcl::Window* pParent ); + static void ShowTruncationWarning(weld::Widget* pParent); static void SetGetSpecialCharsFunction( FncGetSpecialChars fn ); static FncGetSpecialChars GetGetSpecialCharsFunction(); diff --git a/include/vcl/fixedhyper.hxx b/include/vcl/fixedhyper.hxx index c0ecc88db1e4..414ef1661c72 100644 --- a/include/vcl/fixedhyper.hxx +++ b/include/vcl/fixedhyper.hxx @@ -40,7 +40,7 @@ class VCL_DLLPUBLIC FixedHyperlink : public FixedText /** is position X position hitting text */ SAL_DLLPRIVATE bool ImplIsOverText(Point rPosition); - DECL_STATIC_LINK(FixedHyperlink, HandleClick, FixedHyperlink&, void); + DECL_LINK(HandleClick, FixedHyperlink&, void); protected: /** overwrites Window::MouseMove(). diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index ca60679d346c..f20bc18cac8a 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -610,50 +610,6 @@ public: void set_property(const OString &rKey, const OUString &rValue); }; -class VCL_DLLPUBLIC MessageDialog : public Dialog -{ -private: - VclButtonsType m_eButtonsType; - VclMessageType m_eMessageType; - VclPtr<VclBox> m_pOwnedContentArea; - VclPtr<VclButtonBox> m_pOwnedActionArea; - VclPtr<VclGrid> m_pGrid; - VclPtr<FixedImage> m_pImage; - VclPtr<VclMultiLineEdit> m_pPrimaryMessage; - VclPtr<VclMultiLineEdit> m_pSecondaryMessage; - std::vector<VclPtr<PushButton> > m_aOwnedButtons; - std::map< VclPtr<const vcl::Window>, short> m_aResponses; - OUString m_sPrimaryString; - OUString m_sSecondaryString; - DECL_DLLPRIVATE_LINK(ButtonHdl, Button *, void); - void setButtonHandlers(VclButtonBox const *pButtonBox); - short get_response(const vcl::Window *pWindow) const; - void create_owned_areas(); - - friend class VclPtr<MessageDialog>; - MessageDialog(vcl::Window* pParent, WinBits nStyle); -public: - - MessageDialog(vcl::Window* pParent, - const OUString &rMessage, - VclMessageType eMessageType = VclMessageType::Error, - VclButtonsType eButtonsType = VclButtonsType::Ok); - MessageDialog(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription); - virtual bool set_property(const OString &rKey, const OUString &rValue) override; - virtual short Execute() override; - ///Emitted when an action widget is clicked - virtual void response(short nResponseId); - OUString const & get_primary_text() const; - OUString const & get_secondary_text() const; - void set_primary_text(const OUString &rPrimaryString); - void set_secondary_text(const OUString &rSecondaryString); - virtual ~MessageDialog() override; - virtual void dispose() override; - - static void SetMessagesWidths(vcl::Window const *pParent, VclMultiLineEdit *pPrimaryMessage, - VclMultiLineEdit *pSecondaryMessage); -}; - class VCL_DLLPUBLIC VclDrawingArea : public vcl::Window { private: diff --git a/include/vcl/messagedialog.hxx b/include/vcl/messagedialog.hxx new file mode 100644 index 000000000000..6de75a9fb9a6 --- /dev/null +++ b/include/vcl/messagedialog.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_INC_MESSAGEDIALOG_HXX +#define INCLUDED_VCL_INC_MESSAGEDIALOG_HXX + +#include <vcl/dllapi.h> + +#include <vcl/dialog.hxx> +#include <vcl/layout.hxx> + +class VCL_DLLPUBLIC MessageDialog : public Dialog +{ +private: + VclButtonsType m_eButtonsType; + VclMessageType m_eMessageType; + VclPtr<VclBox> m_pOwnedContentArea; + VclPtr<VclButtonBox> m_pOwnedActionArea; + VclPtr<VclGrid> m_pGrid; + VclPtr<FixedImage> m_pImage; + VclPtr<VclMultiLineEdit> m_pPrimaryMessage; + VclPtr<VclMultiLineEdit> m_pSecondaryMessage; + std::vector<VclPtr<PushButton>> m_aOwnedButtons; + std::map<VclPtr<const vcl::Window>, short> m_aResponses; + OUString m_sPrimaryString; + OUString m_sSecondaryString; + DECL_DLLPRIVATE_LINK(ButtonHdl, Button*, void); + void setButtonHandlers(VclButtonBox const* pButtonBox); + short get_response(const vcl::Window* pWindow) const; + void create_owned_areas(); + + friend class VclPtr<MessageDialog>; + MessageDialog(vcl::Window* pParent, WinBits nStyle); + +public: + MessageDialog(vcl::Window* pParent, const OUString& rMessage, + VclMessageType eMessageType = VclMessageType::Error, + VclButtonsType eButtonsType = VclButtonsType::Ok); + MessageDialog(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription); + virtual bool set_property(const OString& rKey, const OUString& rValue) override; + virtual short Execute() override; + ///Emitted when an action widget is clicked + virtual void response(short nResponseId); + OUString const& get_primary_text() const; + OUString const& get_secondary_text() const; + void set_primary_text(const OUString& rPrimaryString); + void set_secondary_text(const OUString& rSecondaryString); + virtual ~MessageDialog() override; + virtual void dispose() override; + + static void SetMessagesWidths(vcl::Window const* pParent, VclMultiLineEdit* pPrimaryMessage, + VclMultiLineEdit* pSecondaryMessage); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/stdtext.hxx b/include/vcl/stdtext.hxx index 260e85d973fb..196725d4e278 100644 --- a/include/vcl/stdtext.hxx +++ b/include/vcl/stdtext.hxx @@ -23,9 +23,9 @@ #include <rtl/ustring.hxx> #include <vcl/dllapi.h> -namespace vcl { class Window; } +namespace weld { class Widget; } -void VCL_DLLPUBLIC ShowServiceNotAvailableError(vcl::Window* pParent, const OUString& rServiceName, bool bError); +void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget* pParent, const OUString& rServiceName, bool bError); #endif // INCLUDED_VCL_STDTEXT_HXX diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index e7cd5e7a4c79..bfc6a7e10214 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -39,7 +39,8 @@ public: } virtual void set_size_request(int nWidth, int nHeight) = 0; virtual Size get_preferred_size() const = 0; - virtual float approximate_char_width() const = 0; + virtual float get_approximate_char_width() const = 0; + virtual int get_text_height() const = 0; virtual Size get_pixel_size(const OUString& rText) const = 0; virtual OString get_buildable_name() const = 0; virtual OString get_help_id() const = 0; diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 4a956b5d701e..07b13ba98833 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/report/inspection/DefaultComponentInspectorModel.hpp> #include <svx/svxids.hrc> #include <vcl/stdtext.hxx> +#include <vcl/weld.hxx> #include <svx/svdview.hxx> #include <svx/svdogrp.hxx> #include <svx/svdpage.hxx> @@ -136,7 +137,7 @@ PropBrw::PropBrw(const Reference< XComponentContext >& _xORB, vcl::Window* pPare if ( !m_xBrowserController.is() ) { const OUString sServiceName( "com.sun.star.inspection.ObjectInspector" ); - ShowServiceNotAvailableError(pParent, sServiceName, true); + ShowServiceNotAvailableError(pParent ? pParent->GetFrameWeld() : nullptr, sServiceName, true); } else { diff --git a/sc/inc/documentlinkmgr.hxx b/sc/inc/documentlinkmgr.hxx index 86dba66f2d3d..1fd1bc231e8d 100644 --- a/sc/inc/documentlinkmgr.hxx +++ b/sc/inc/documentlinkmgr.hxx @@ -15,7 +15,7 @@ class ScDocument; class SfxObjectShell; -namespace vcl { class Window; } +namespace weld { class Window; } namespace sfx2 { @@ -57,7 +57,7 @@ public: bool hasDdeLinks() const; bool hasDdeOrOleOrWebServiceLinks() const; - bool updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin); + bool updateDdeOrOleOrWebServiceLinks(weld::Window* pWin); void updateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem ); diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx index 7515b21e29e9..d1cb884ca756 100644 --- a/sc/inc/validat.hxx +++ b/sc/inc/validat.hxx @@ -25,6 +25,7 @@ #include "scdllapi.h" namespace vcl { class Window; } +namespace weld { class Window; } namespace sc { @@ -74,10 +75,10 @@ private: OUString aErrorMessage; bool DoMacro( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const; + ScFormulaCell* pCell, weld::Window* pParent ) const; bool DoScript( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const; + ScFormulaCell* pCell, weld::Window* pParent ) const; using ScConditionEntry::operator==; diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 48b9c443990f..293641ac9d68 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -45,6 +45,7 @@ #include <vcl/virdev.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <inputopt.hxx> #include <global.hxx> @@ -864,8 +865,10 @@ void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin) aBuf.append(ScResId(SCSTR_EXTDOC_NOT_LOADED)); aBuf.append("\n\n"); aBuf.append(aFile); - ScopedVclPtrInstance< MessageDialog > aBox(pWin, aBuf.makeStringAndClear()); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + aBuf.makeStringAndClear())); + xBox->run(); } pExternalRefMgr->enableDocTimer(true); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 946f964cda05..5eb776843018 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -32,7 +32,7 @@ #include <basic/sbx.hxx> #include <svl/zforlist.hxx> #include <svl/sharedstringpool.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <rtl/math.hxx> @@ -181,7 +181,7 @@ bool ScValidationData::GetErrMsg( OUString& rTitle, OUString& rMsg, } bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const + ScFormulaCell* pCell, weld::Window* pParent ) const { ScDocument* pDocument = GetDocument(); SfxObjectShell* pDocSh = pDocument->GetDocumentShell(); @@ -251,9 +251,10 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, // Macro not found (only with input) { //TODO: different error message, if found, but not bAllowed ?? - - ScopedVclPtrInstance< MessageDialog > aBox( pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND))); + xBox->run(); } return bScriptReturnedFalse; @@ -262,7 +263,7 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, // true -> abort bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const + ScFormulaCell* pCell, weld::Window* pParent ) const { if ( SfxApplication::IsXScriptURL( aErrorTitle ) ) { @@ -356,9 +357,10 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, if ( !bDone && !pCell ) // Macro not found (only with input) { //TODO: different error message, if found, but not bAllowed ?? - - ScopedVclPtrInstance< MessageDialog > aBox(pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND))); + xBox->run(); } return bRet; @@ -376,7 +378,7 @@ bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput, const ScAddress& rPos ) const { if ( eErrorStyle == SC_VALERR_MACRO ) - return DoMacro( rPos, rInput, nullptr, pParent ); + return DoMacro( rPos, rInput, nullptr, pParent ? pParent->GetFrameWeld() : nullptr); // Output error message diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index bcad163d8623..5df04c90d1ae 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -24,6 +24,7 @@ #include <comphelper/string.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <reffact.hxx> #include <document.hxx> @@ -38,7 +39,16 @@ class DBSaveData; static DBSaveData* pSaveObj = nullptr; -#define ERRORBOX(s) ScopedVclPtrInstance<MessageDialog>(this, s)->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const OUString& rString) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + rString)); + xBox->run(); + } +} // class DBSaveData @@ -479,14 +489,14 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void) } else { - ERRORBOX( aStrInvalid ); + ERRORBOX(GetFrameWeld(), aStrInvalid); m_pEdAssign->SetSelection( Selection( 0, SELECTION_MAX ) ); m_pEdAssign->GrabFocus(); } } else { - ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME) ); + ERRORBOX(GetFrameWeld(), ScGlobal::GetRscString(STR_INVALIDNAME)); m_pEdName->SetSelection( Selection( 0, SELECTION_MAX ) ); m_pEdName->GrabFocus(); } diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 53c77d2aa706..22635dc8491b 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -36,7 +36,7 @@ #include <strings.hrc> #include <filtdlg.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/sharedstringpool.hxx> #include <o3tl/make_unique.hxx> @@ -680,7 +680,10 @@ IMPL_LINK( ScFilterDlg, EndDlgHdl, Button*, pBtn, void ) if (!pExpander->get_expanded()) pExpander->set_expanded(true); - ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString(STR_INVALID_TABREF))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_TABREF))); + xBox->run(); pEdCopyArea->GrabFocus(); bAreaInputOk = false; } diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index fe441db8bd16..0df2ed7769df 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -36,10 +36,20 @@ #include <filtdlg.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> // DEFINE -------------------------------------------------------------------- -#define ERRORBOX(rid) ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString(rid))->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const char* rid) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(rid))); + xBox->run(); + } +} // class ScSpecialFilterDialog @@ -309,7 +319,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) if (!pExpander->get_expanded()) pExpander->set_expanded(true); - ERRORBOX( STR_INVALID_TABREF ); + ERRORBOX(GetFrameWeld(), STR_INVALID_TABREF); pEdCopyArea->GrabFocus(); bEditInputOk = false; } @@ -321,7 +331,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) if ( (nResult & ScRefFlags::VALID) == ScRefFlags::ZERO ) { - ERRORBOX( STR_INVALID_TABREF ); + ERRORBOX(GetFrameWeld(), STR_INVALID_TABREF); pEdFilterArea->GrabFocus(); bEditInputOk = false; } @@ -379,7 +389,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) } else { - ERRORBOX( STR_INVALID_QUERYAREA ); + ERRORBOX(GetFrameWeld(), STR_INVALID_QUERYAREA); pEdFilterArea->GrabFocus(); } } diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 9ad1b3898960..58d2a7594dd3 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -20,6 +20,7 @@ #undef SC_DLLIMPLEMENTATION #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <i18nlangtag/languagetag.hxx> #include <svtools/collatorres.hxx> #include <unotools/collatorwrapper.hxx> @@ -810,7 +811,10 @@ DeactivateRC ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP ) if ( !bPosInputOk ) { - ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString( STR_INVALID_TABREF))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_TABREF))); + xBox->run(); m_pEdOutPos->GrabFocus(); m_pEdOutPos->SetSelection( Selection( 0, SELECTION_MAX ) ); theOutPos.Set(0,0,0); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index fc4f8829ada7..8721cecc6a97 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -119,9 +119,10 @@ void ScDocShell::ReloadAllLinks() getEmbeddedObjectContainer().setUserAllowsLinkUpdate(true); ReloadTabLinks(); - aDocument.UpdateExternalRefLinks(GetActiveDialogParent()); + vcl::Window *pDialogParent = GetActiveDialogParent(); + aDocument.UpdateExternalRefLinks(pDialogParent); - bool bAnyDde = aDocument.GetDocLinkManager().updateDdeOrOleOrWebServiceLinks(GetActiveDialogParent()); + bool bAnyDde = aDocument.GetDocLinkManager().updateDdeOrOleOrWebServiceLinks(pDialogParent ? pDialogParent->GetFrameWeld() : nullptr); if (bAnyDde) { diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index f71fe99d1bb3..c0fcfe0920ab 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -25,7 +25,8 @@ #include <scresid.hxx> #include <o3tl/deleter.hxx> #include <svx/svdoole2.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <memory> @@ -144,7 +145,7 @@ bool DocumentLinkManager::hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, boo return false; } -bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin) +bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin) { if (!mpImpl->mpLinkManager) return false; @@ -195,8 +196,10 @@ bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin) aBuf.append(aElem); aBuf.append("\nType : "); aBuf.append(aType); - ScopedVclPtrInstance< MessageDialog > aBox(pWin, aBuf.makeStringAndClear()); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, + VclMessageType::Warning, VclButtonsType::Ok, + aBuf.makeStringAndClear())); + xBox->run(); } } diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index 445d6193b239..fd3cd6d7c700 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -303,8 +303,8 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell* pViewSh, // really store as link only? if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() ) { - ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(pWin,aFileName); - if( aWarnDlg->Execute() != RET_OK ) + SvxLinkWarningDialog aWarnDlg(pWin ? pWin->GetFrameWeld() : nullptr, aFileName); + if (aWarnDlg.run() != RET_OK) bAsLink = false; // don't store as link } @@ -377,7 +377,7 @@ FuInsertMedia::FuInsertMedia( ScTabViewShell* pViewSh, pWin->LeaveWait(); if( !bAPI ) - ::avmedia::MediaWindow::executeFormatErrorBox( pWindow ); + ::avmedia::MediaWindow::executeFormatErrorBox(pWindow ? pWindow->GetFrameWeld() : nullptr); } else #endif diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index 02e7a0b4cbb8..90e408290f40 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -271,7 +271,7 @@ void ScGraphicShell::ExecuteSaveGraphic( SAL_UNUSED_PARAMETER SfxRequest& /*rReq { if (pWin) { - nState = GraphicHelper::HasToSaveTransformedImage(pWin); + nState = GraphicHelper::HasToSaveTransformedImage(pWin->GetFrameWeld()); } } else diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 1931a73b5cc8..7eae143a4565 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -24,9 +24,19 @@ #include <docsh.hxx> #include <crnrdlg.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <memory> -#define ERRORBOX(s) ScopedVclPtrInstance<MessageDialog>(this, s)->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const OUString& rString) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + rString)); + } +} + #define QUERYBOX(m) ScopedVclPtrInstance<QueryBox>(this, MessBoxStyle::YesNo|MessBoxStyle::DefaultYes, m)->Execute() const sal_uLong nEntryDataCol = 0; @@ -563,7 +573,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, Button*, void) } else { - ERRORBOX( ScGlobal::GetRscString(STR_INVALIDTABNAME) ); + ERRORBOX(GetFrameWeld(), ScGlobal::GetRscString(STR_INVALIDTABNAME)); if ( !bOk1 ) pEdAssign->GrabFocus(); else diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx index ab336f0bd816..c6ea273083e5 100644 --- a/sc/source/ui/miscdlgs/filldlg.cxx +++ b/sc/source/ui/miscdlgs/filldlg.cxx @@ -20,7 +20,8 @@ #undef SC_DLLIMPLEMENTATION #include <svl/zforlist.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <limits.h> #include <scresid.hxx> @@ -321,7 +322,9 @@ IMPL_LINK_NOARG(ScFillSeriesDlg, OKHdl, Button*, void) EndDialog( RET_OK ); else { - ScopedVclPtrInstance<MessageDialog>(this, aErrMsgInvalidVal)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, + VclButtonsType::Ok, aErrMsgInvalidVal)); + xBox->run(); pEdWrong->GrabFocus(); } } diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index fd7aa9a20df9..f5b5dc11f51c 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -26,6 +26,7 @@ #include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <global.hxx> #include <docsh.hxx> @@ -300,7 +301,9 @@ IMPL_LINK_NOARG(ScInsertTableDlg, DoEnterHdl, Button*, void) else { OUString aErrMsg ( ScGlobal::GetRscString( STR_INVALIDTABNAME ) ); - (void)ScopedVclPtrInstance<MessageDialog>(this, aErrMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, + VclButtonsType::Ok, aErrMsg)); + xBox->run(); } } diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 89594f57ab5b..73141f48b822 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -24,6 +24,7 @@ #include <vcl/builderfactory.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <uiitems.hxx> @@ -778,7 +779,10 @@ IMPL_LINK( ScOptSolverDlg, CursorDownHdl, ScCursorRefEdit&, rEdit, void ) void ScOptSolverDlg::ShowError( bool bCondition, formula::RefEdit* pFocus ) { OUString aMessage = bCondition ? maConditionError : maInputError; - ScopedVclPtrInstance<MessageDialog>(this, aMessage)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aMessage)); + xBox->run(); if (pFocus) { mpEdActive = pFocus; diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index eb9276d77e60..455091f6f86e 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -33,6 +33,7 @@ #include <editeng/wghtitem.hxx> #include <svl/zforlist.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <comphelper/processfactory.hxx> #include <sfx2/strings.hrc> #include <sfx2/sfxresid.hxx> @@ -262,11 +263,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl, Button*, void) if ( !bFmtInserted ) { - sal_uInt16 nRet = ScopedVclPtrInstance<MessageDialog>(this, - ScGlobal::GetRscString(STR_INVALID_AFNAME), - VclMessageType::Error, - VclButtonsType::OkCancel - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Error, VclButtonsType::OkCancel, + ScGlobal::GetRscString(STR_INVALID_AFNAME))); + + sal_uInt16 nRet = xBox->run(); bOk = ( nRet == RET_CANCEL ); } @@ -381,11 +382,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl, Button*, void) } if( !bFmtRenamed ) { - bOk = RET_CANCEL == ScopedVclPtrInstance<MessageDialog>( this, - ScGlobal::GetRscString(STR_INVALID_AFNAME), - VclMessageType::Error, - VclButtonsType::OkCancel - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Error, VclButtonsType::OkCancel, + ScGlobal::GetRscString(STR_INVALID_AFNAME))); + + bOk = RET_CANCEL == xBox->run(); } } else diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx index a3b81600872a..919bf98b91c2 100644 --- a/sc/source/ui/miscdlgs/solvrdlg.cxx +++ b/sc/source/ui/miscdlgs/solvrdlg.cxx @@ -22,6 +22,7 @@ #include <sfx2/dispatch.hxx> #include <svl/zforlist.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <uiitems.hxx> #include <reffact.hxx> @@ -33,9 +34,12 @@ namespace { - void lclErrorDialog( vcl::Window* pParent, const OUString& aString ) + void lclErrorDialog(weld::Window* pParent, const OUString& rString) { - ScopedVclPtrInstance<MessageDialog>(pParent, aString)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + rString)); + xBox->run(); } } @@ -163,22 +167,22 @@ void ScSolverDlg::RaiseError( ScSolverErr eError ) switch ( eError ) { case SOLVERR_NOFORMULA: - lclErrorDialog( this, errMsgNoFormula ); + lclErrorDialog(GetFrameWeld() , errMsgNoFormula); m_pEdFormulaCell->GrabFocus(); break; case SOLVERR_INVALID_FORMULA: - lclErrorDialog( this, errMsgInvalidForm ); + lclErrorDialog(GetFrameWeld(), errMsgInvalidForm); m_pEdFormulaCell->GrabFocus(); break; case SOLVERR_INVALID_VARIABLE: - lclErrorDialog( this, errMsgInvalidVar ); + lclErrorDialog(GetFrameWeld(), errMsgInvalidVar); m_pEdVariableCell->GrabFocus(); break; case SOLVERR_INVALID_TARGETVALUE: - lclErrorDialog( this, errMsgInvalidVal ); + lclErrorDialog(GetFrameWeld(), errMsgInvalidVal); m_pEdTargetVal->GrabFocus(); break; } diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx index 50bfa8180ec9..bb9e456bf822 100644 --- a/sc/source/ui/miscdlgs/tabopdlg.cxx +++ b/sc/source/ui/miscdlgs/tabopdlg.cxx @@ -19,7 +19,7 @@ #include <scitems.hxx> #include <sfx2/dispatch.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <uiitems.hxx> #include <global.hxx> @@ -224,7 +224,9 @@ void ScTabOpDlg::RaiseError( ScTabOpErr eError ) break; } - ScopedVclPtrInstance<MessageDialog>(this, *pMsg, VclMessageType::Error, VclButtonsType::OkCancel)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Error, VclButtonsType::OkCancel, *pMsg)); + xBox->run(); pEd->GrabFocus(); } diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 4a2e0a4e1a4a..3351289b43ce 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -21,6 +21,7 @@ #include <scitems.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <global.hxx> #include <globstr.hrc> @@ -235,9 +236,9 @@ DeactivateRC ScTpCalcOptions::DeactivatePage( SfxItemSet* pSetP ) if ( nReturn == DeactivateRC::KeepPage ) { - ScopedVclPtrInstance<MessageDialog>( this, - ScGlobal::GetRscString( STR_INVALID_EPS ) - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, + VclButtonsType::Ok, ScGlobal::GetRscString(STR_INVALID_EPS))); + xBox->run(); m_pEdEps->GrabFocus(); } diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index c43a82f5959a..4eb077076728 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -21,6 +21,7 @@ #include <comphelper/string.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <global.hxx> #include <document.hxx> @@ -692,9 +693,11 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, Button*, pBtn, void ) } else { - ScopedVclPtrInstance<MessageDialog>(this, - ScGlobal::GetRscString( STR_INVALID_TABREF ) - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_TABREF))); + + xBox->run(); mpEdCopyFrom->GrabFocus(); mpEdCopyFrom->SetSelection( Selection( 0, SELECTION_MAX ) ); } diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index 1ad3ebf896e2..89082ccfa240 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -23,6 +23,7 @@ #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <unotools/charclass.hxx> #include <stdlib.h> @@ -51,7 +52,16 @@ enum { }; #define HDL(hdl) LINK( this, ScPrintAreasDlg, hdl ) -#define ERRORBOX(nId) ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString(nId))->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const char* rId) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(rId))); + xBox->run(); + } +} // global functions (->at the end of the file): @@ -381,7 +391,7 @@ bool ScPrintAreasDlg::Impl_CheckRefStrings() else if ( !bRepeatRowOk ) pEd = pEdRepeatRow; else if ( !bRepeatColOk ) pEd = pEdRepeatCol; - ERRORBOX( STR_INVALID_TABREF ); + ERRORBOX(GetFrameWeld(), STR_INVALID_TABREF); OSL_ASSERT(pEd); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index d40a11d2dd79..ce2c030ac55c 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -26,6 +26,7 @@ #include <sfx2/request.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/app.hxx> #include <globstr.hrc> #include <scmod.hxx> @@ -429,9 +430,11 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else if( ! rReq.IsAPI() ) { - ScopedVclPtrInstance<MessageDialog> aErrorBox(pTabViewShell->GetDialogParent(), - ScGlobal::GetRscString(STR_NOAREASELECTED)); - aErrorBox->Execute(); + vcl::Window* pWin = pTabViewShell->GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_NOAREASELECTED))); + xErrorBox->run(); } } else @@ -883,8 +886,12 @@ void ScCellShell::Execute( SfxRequest& rReq ) } } else - ScopedVclPtrInstance<MessageDialog>(pDlgParent, - ScGlobal::GetRscString(STR_INVALID_AFAREA) )->Execute(); + { + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pDlgParent ? pDlgParent->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_AFAREA))); + xErrorBox->run(); + } } break; diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 707a487c3067..f72d8bdecb35 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -21,6 +21,7 @@ #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/sdbc/XResultSet.hpp> @@ -365,9 +366,11 @@ void ScDBFunc::ToggleAutoFilter() } else { - ScopedVclPtrInstance<MessageDialog> aErrorBox(GetViewData().GetDialogParent(), - ScGlobal::GetRscString(STR_ERR_AUTOFILTER)); - aErrorBox->Execute(); + vcl::Window* pWin = GetViewData().GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_ERR_AUTOFILTER))); + xErrorBox->run(); } } diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index f315b6cbe89f..75f2d375a2cb 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -30,6 +30,7 @@ #include <svl/stritem.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/objface.hxx> #include <svx/svxdlg.hxx> #include <editeng/colritem.hxx> @@ -428,9 +429,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } else { - nRet = ScopedVclPtrInstance<MessageDialog>(GetDialogParent(), - aErrMsg - )->Execute(); + vcl::Window* pWin = GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aErrMsg)); + nRet = xBox->run(); } } } diff --git a/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui b/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui index a46d426f18f1..a7f7ceb633a2 100644 --- a/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui +++ b/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryRunStreamScriptDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -19,7 +18,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> diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 563faeed79e8..e1e27cc8a4a6 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -24,7 +24,8 @@ #include <sfx2/strings.hrc> #include <sfx2/app.hxx> #include <sfx2/sfxresid.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <tools/diagnose_ex.h> #include <com/sun/star/awt/XControl.hpp> @@ -624,7 +625,9 @@ namespace dlgprov aOUFinal += aQuoteChar; aOUFinal += aRes.copy( nIndex + 2 ); - ScopedVclPtrInstance<MessageDialog>(nullptr, aOUFinal)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aOUFinal)); + xBox->run(); } } diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx index 3ce1454a07f9..c58e749305bf 100644 --- a/sd/inc/Outliner.hxx +++ b/sd/inc/Outliner.hxx @@ -32,6 +32,11 @@ class SdrObject; class SdrTextObj; class SdDrawDocument; +namespace weld +{ +class MessageDialog; +} + namespace sd { class View; @@ -521,7 +526,7 @@ private: window. This function makes sure that the otherwise non-modal search dialog, if visible, is locked, too. */ - sal_uInt16 ShowModalMessageBox (Dialog& rMessageBox); + sal_uInt16 ShowModalMessageBox(weld::MessageDialog& rMessageBox); }; #endif diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index d1d3da08ac36..3e50db1f9643 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -37,8 +37,8 @@ #include <svx/svdpagv.hxx> #include <svx/svdogrp.hxx> #include <svx/svdundo.hxx> -#include <vcl/layout.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sot/formats.hxx> #include <xmloff/autolayout.hxx> @@ -244,8 +244,9 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium* pMedium) if (!bOK) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SdResId(STR_READ_DATA_ERROR)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); + xErrorBox->run(); CloseBookmarkDoc(); pBookmarkDoc = nullptr; diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 537f9e579b5d..d5dd2d1cedfb 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -26,7 +26,7 @@ #include <unotools/localfilehelper.hxx> #include <vcl/errinf.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/metaact.hxx> #include <vcl/virdev.hxx> #include <sfx2/sfxsids.hrc> @@ -149,8 +149,9 @@ void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, ErrCode nStrea ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); else { - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, pId ? SdResId(pId) : OUString()); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, pId ? SdResId(pId) : OUString())); + xErrorBox->run(); } } diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx index db3919fc527f..b12f9de4314a 100644 --- a/sd/source/filter/html/pubdlg.cxx +++ b/sd/source/filter/html/pubdlg.cxx @@ -30,6 +30,7 @@ #include <svl/itemset.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svtools/valueset.hxx> #include <vcl/graph.hxx> #include <svl/eitem.hxx> @@ -1153,9 +1154,10 @@ IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl, Button*, void) if (iter != m_aDesignList.end()) { - ScopedVclPtrInstance<MessageDialog> aErrorBox(this, SdResId(STR_PUBDLG_SAMENAME), - VclMessageType::Error, VclButtonsType::YesNo); - bRetry = aErrorBox->Execute() == RET_NO; + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Error, VclButtonsType::YesNo, + SdResId(STR_PUBDLG_SAMENAME))); + bRetry = xErrorBox->run() == RET_NO; if(!bRetry) m_aDesignList.erase(iter); diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 7bdede6cd75a..5049d6fb42df 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -28,6 +28,7 @@ #include <editeng/langitem.hxx> #include <editeng/editdata.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <editeng/svxenum.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> @@ -230,7 +231,10 @@ void SdModule::Execute(SfxRequest& rReq) } else { - ScopedVclPtrInstance<MessageDialog>(nullptr, SdResId(STR_CANT_PERFORM_IN_LIVEMODE))->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_CANT_PERFORM_IN_LIVEMODE))); + + xErrorBox->run(); const SfxLinkItem* pLinkItem = rReq.GetArg<SfxLinkItem>(SID_DONELINK); if( pLinkItem ) diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx index 9ef0228fb995..a0ffda6385d3 100644 --- a/sd/source/ui/dlg/brkdlg.cxx +++ b/sd/source/ui/dlg/brkdlg.cxx @@ -24,6 +24,7 @@ #include <svx/svdetc.hxx> #include <sfx2/app.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sdattr.hxx> #include <sdresid.hxx> @@ -107,8 +108,10 @@ IMPL_LINK( BreakDlg, UpDate, void*, nInit, bool ) // update status bar or show a error message? if(nInit == reinterpret_cast<void*>(1)) { - ScopedVclPtrInstance< MessageDialog > aErrBox(this, SdResId(STR_BREAK_FAIL)); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SdResId(STR_BREAK_FAIL))); + xErrBox->run(); } else { diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 57f1619f2613..71ac14cd518a 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -20,7 +20,7 @@ #include <sal/types.h> #include <sot/formats.hxx> #include <sot/storage.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/urihelper.hxx> #include <svx/svditer.hxx> #include <sfx2/docfile.hxx> @@ -841,8 +841,9 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed) if ( !mpBookmarkDoc ) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SdResId(STR_READ_DATA_ERROR)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); + xErrorBox->run(); mpMedium = nullptr; //On failure the SfxMedium is invalid } } diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 77cd60c685ea..7d18f8e6ab4c 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -191,8 +191,8 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) // really store as link only? if( SvtMiscOptions().ShowLinkWarningDialog() ) { - ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(mpWindow, aFileName); - if( aWarnDlg->Execute() != RET_OK ) + SvxLinkWarningDialog aWarnDlg(mpWindow->GetFrameWeld(), aFileName); + if (aWarnDlg.run() != RET_OK) return; // don't store as link } @@ -726,7 +726,7 @@ void FuInsertAVMedia::DoExecute( SfxRequest& rReq ) mpWindow->LeaveWait(); if( !bAPI ) - ::avmedia::MediaWindow::executeFormatErrorBox( mpWindow ); + ::avmedia::MediaWindow::executeFormatErrorBox(mpWindow->GetFrameWeld()); } else { diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 0cd20acf99c8..01f5490ce035 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -27,6 +27,7 @@ #include <sfx2/request.hxx> #include <sfx2/app.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/printer.hxx> #include <svx/svdorect.hxx> #include <svx/svdundo.hxx> @@ -318,8 +319,9 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) if( !bInserted ) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SdResId( STR_READ_DATA_ERROR)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); + xErrorBox->run(); } } @@ -460,8 +462,9 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SdResId(STR_READ_DATA_ERROR)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); + xErrorBox->run(); } else { @@ -604,8 +607,9 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(mpWindow, SdResId(STR_READ_DATA_ERROR)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); + xErrorBox->run(); } else { diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 868973a78b15..0686db158ea6 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -42,6 +42,11 @@ class ScrollBarBox; class SdDrawDocument; class ScrollBar; +namespace weld +{ + class Window; +} + namespace com { namespace sun { namespace star { namespace embed { class XEmbeddedObject; @@ -155,6 +160,7 @@ public: show running then the active window is a ShowWindow. */ ::sd::Window* GetActiveWindow() const { return mpActiveWindow;} + weld::Window* GetFrameWeld() const; /** Set the active window. When the shell is displayed in the center pane then the window of the ViewShellBase is also set to the given diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 45ea0dcec4fa..f25fdd32b7f8 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -29,7 +29,7 @@ #include <vcl/outdev.hxx> #include <svx/dlgutil.hxx> #include <svx/xtable.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/printer.hxx> @@ -1208,8 +1208,9 @@ void SdOutliner::ShowEndOfSearchDialog() // Show the message in an info box that is modal with respect to the // whole application. - ScopedVclPtrInstance< MessageDialog > aInfoBox(nullptr, aString, VclMessageType::Info); - ShowModalMessageBox (*aInfoBox.get()); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, aString)); + ShowModalMessageBox(*xInfoBox.get()); } bool SdOutliner::ShowWrapArroundDialog() @@ -1247,9 +1248,9 @@ 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. - ScopedVclPtrInstance<QueryBox> aQuestionBox(nullptr, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, SdResId(pStringId)); - aQuestionBox->SetImage(QueryBox::GetStandardImage()); - sal_uInt16 nBoxResult = ShowModalMessageBox(*aQuestionBox.get()); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, SdResId(pStringId))); + sal_uInt16 nBoxResult = ShowModalMessageBox(*xQueryBox.get()); return (nBoxResult == RET_YES); } @@ -1685,7 +1686,7 @@ bool SdOutliner::ConvertNextDocument() return !mbEndOfSearch; } -sal_uInt16 SdOutliner::ShowModalMessageBox (Dialog& rMessageBox) +sal_uInt16 SdOutliner::ShowModalMessageBox(weld::MessageDialog& rMessageBox) { // 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 @@ -1718,7 +1719,7 @@ sal_uInt16 SdOutliner::ShowModalMessageBox (Dialog& rMessageBox) if (pSearchDialog != nullptr) pSearchDialog->EnableInput(false); - sal_uInt16 nResult = rMessageBox.Execute(); + sal_uInt16 nResult = rMessageBox.run(); // Unlock the search dialog. if (pSearchDialog != nullptr) diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index de6c08948bd3..615bfb9e9a00 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -96,6 +96,7 @@ #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> #include <vcl/waitobj.hxx> +#include <vcl/weld.hxx> #include <editeng/cmapitem.hxx> #include <editeng/escapementitem.hxx> @@ -1283,13 +1284,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if (pObj && pObj->GetGraphicType() == GraphicType::Bitmap) { vcl::Window* pWin = GetActiveWindow(); + weld::Window* pFrame = GetFrameWeld(); GraphicAttr aGraphicAttr = pObj->GetGraphicAttr(); short nState = RET_CANCEL; if (aGraphicAttr != GraphicAttr()) // the image has been modified { - if (pWin) + if (pFrame) { - nState = GraphicHelper::HasToSaveTransformedImage(pWin); + nState = GraphicHelper::HasToSaveTransformedImage(pFrame); } } else diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index d332935e4799..f9a736b7744b 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -24,6 +24,7 @@ #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/viewfrm.hxx> #include <svx/svdograf.hxx> #include <svx/svxids.hrc> @@ -284,9 +285,10 @@ void DrawViewShell::ExecBmpMask( SfxRequest const & rReq ) if (xNewObj->IsLinkedGraphic()) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( static_cast<vcl::Window*>(GetActiveWindow()),"QueryUnlinkImageDialog","modules/sdraw/ui/queryunlinkimagedialog.ui"); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/sdraw/ui/queryunlinkimagedialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryUnlinkImageDialog")); - if (RET_YES == aQueryBox->Execute()) + if (RET_YES == xQueryBox->run()) xNewObj->ReleaseGraphicLink(); else bCont = false; diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 0497d6693656..9a8c4e856198 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -1655,6 +1655,11 @@ void ViewShell::NotifyAccUpdate( ) GetViewShellBase().GetDrawController().NotifyAccUpdate(); } +weld::Window* ViewShell::GetFrameWeld() const +{ + return mpActiveWindow ? mpActiveWindow->GetFrameWeld() : nullptr; +} + sd::Window* ViewShell::GetContentWindow() const { return mpContentWindow.get(); diff --git a/sd/uiconfig/sdraw/ui/queryunlinkimagedialog.ui b/sd/uiconfig/sdraw/ui/queryunlinkimagedialog.ui index ad01ff617e81..f1d69f6bf8de 100644 --- a/sd/uiconfig/sdraw/ui/queryunlinkimagedialog.ui +++ b/sd/uiconfig/sdraw/ui/queryunlinkimagedialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryUnlinkImageDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="queryunlinkimagedialog|QueryUnlinkImageDialog">Release image's link?</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_area4"> <property name="can_focus">False</property> - <property name="layout_style">end</property> </object> <packing> <property name="expand">False</property> diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index c9a4d8ace070..2f3744e3fc04 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -65,6 +65,7 @@ #include <unotools/extendedsecurityoptions.hxx> #include <comphelper/docpasswordhelper.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> @@ -837,11 +838,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) SolarMutexGuard aGuard; vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); - ScopedVclPtrInstance<MessageDialog> aSecurityWarningBox(pWindow, - SfxResId(STR_SECURITY_WARNING_NO_HYPERLINKS), - VclMessageType::Warning); - aSecurityWarningBox->SetText( SfxResId(RID_SECURITY_WARNING_TITLE) ); - aSecurityWarningBox->Execute(); + std::unique_ptr<weld::MessageDialog> xSecurityWarningBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_SECURITY_WARNING_NO_HYPERLINKS))); + xSecurityWarningBox->set_title(SfxResId(RID_SECURITY_WARNING_TITLE)); + xSecurityWarningBox->run(); return; } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index e118bbafae24..f8b08137a326 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -59,8 +59,8 @@ #include <unotools/configmgr.hxx> #include <tools/svlibrary.h> #include <tools/diagnose_ex.h> -#include <vcl/layout.hxx> #include <vcl/sysdata.hxx> +#include <vcl/weld.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> @@ -1605,7 +1605,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) SvtModuleOptions aModuleOpt; if ( !aModuleOpt.IsImpress() ) { - ScopedVclPtrInstance<MessageDialog>( nullptr, SfxResId( STR_MODULENOTINSTALLED ))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_MODULENOTINSTALLED))); + xBox->run(); return; } diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index cf59639cde9e..82c6129b11bf 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -27,6 +27,7 @@ #include <vcl/layout.hxx> #include <sfx2/linkmgr.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/strings.hrc> #include <sfx2/sfxresid.hxx> #include <sfx2/filedlghelper.hxx> @@ -515,7 +516,9 @@ bool SvBaseLink::ExecuteEdit( const OUString& _rNewName ) else return false; - ScopedVclPtrInstance<MessageDialog>(pImpl->m_pParentWin, sError)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pImpl->m_pParentWin->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sError)); + xBox->run(); } } else if( !pImpl->m_bIsConnect ) diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 9ecbf4672d46..61ef0588bf30 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -89,10 +89,11 @@ #include <svtools/miscopt.hxx> #include <svtools/imgdef.hxx> #include <vcl/builderfactory.hxx> -#include <vcl/layout.hxx> #include <vcl/unohelp.hxx> #include <vcl/i18nhelp.hxx> +#include <vcl/layout.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <ucbhelper/content.hxx> #include <vcl/msgbox.hxx> @@ -1046,8 +1047,10 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl, LinkParamNone*, void) if ( aFactories.empty() ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_INFO_NOSEARCHRESULTS ), VclMessageType::Info); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_INFO_NOSEARCHRESULTS))); + xBox->run(); } } } @@ -2265,9 +2268,10 @@ void SfxHelpTextWindow_Impl::FindHdl(sfx2::SearchDialog* pDlg) } else { - DBG_ASSERT( pSrchDlg, "no search dialog" ); - ScopedVclPtrInstance< MessageDialog > aBox(pSrchDlg, SfxResId( STR_INFO_NOSEARCHTEXTFOUND ), VclMessageType::Info); - aBox->Execute(); + assert(pSrchDlg && "no search dialog"); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pSrchDlg->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_NOSEARCHTEXTFOUND))); + xBox->run(); pSrchDlg->SetFocusOnEdit(); } } diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index 5b3e4821b200..c412d40aeb39 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -21,8 +21,8 @@ #include <rtl/ustring.hxx> #include <sfx2/app.hxx> #include <sfx2/sfxresid.hxx> -#include <vcl/layout.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <openuriexternally.hxx> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> @@ -57,24 +57,27 @@ bool sfx2::openUriExternally( "unexpected IllegalArgumentException: " + e.Message); } SolarMutexGuard g; - ScopedVclPtrInstance<MessageDialog> eb( - SfxGetpApp()->GetTopWindow(), SfxResId(STR_NO_ABS_URI_REF)); + vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_NO_ABS_URI_REF))); eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", uri)); - eb->Execute(); + eb->run(); } catch (css::system::SystemShellExecuteException & e) { if (!handleSystemShellExecuteException) { throw; } SolarMutexGuard g; - ScopedVclPtrInstance<MessageDialog> eb( - SfxGetpApp()->GetTopWindow(), - SfxResId(STR_NO_WEBBROWSER_FOUND)); + vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_NO_WEBBROWSER_FOUND))); eb->set_primary_text( eb->get_primary_text().replaceFirst("$(ARG1)", uri) .replaceFirst("$(ARG2)", OUString::number(e.PosixError)) .replaceFirst("$(ARG3)", e.Message)); //TODO: avoid subsequent replaceFirst acting on previous replacement - eb->Execute(); + eb->run(); } return false; } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 9803d63fdb75..7fe8d968dbe7 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -83,24 +83,6 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::system; -namespace old -{ - class NoHelpErrorBox : public MessageDialog - { - public: - explicit NoHelpErrorBox(vcl::Window* _pParent) - : MessageDialog(_pParent, SfxResId(RID_STR_HLPFILENOTEXIST)) - { - // Error message: "No help available" - } - - virtual void RequestHelp( const HelpEvent& ) override - { - // do nothing, because no help available - } - }; -} - class NoHelpErrorBox { private: @@ -836,14 +818,14 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const if ( !impl_hasHelpInstalled() ) { - ScopedVclPtrInstance< MessageDialog > aQueryBox(const_cast< vcl::Window* >( pWindow ), - "onlinehelpmanual", "sfx/ui/helpmanual.ui"); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() ); - OUString sPrimTex = aQueryBox->get_primary_text(); - aQueryBox->set_primary_text(sPrimTex.replaceAll("$UILOCALE", sLocaleString)); - short OnlineHelpBox = aQueryBox->Execute(); + OUString sPrimTex = xQueryBox->get_primary_text(); + xQueryBox->set_primary_text(sPrimTex.replaceAll("$UILOCALE", sLocaleString)); + short OnlineHelpBox = xQueryBox->run(); if(OnlineHelpBox == RET_OK) { @@ -851,8 +833,8 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const return true; else { - ScopedVclPtrInstance< old::NoHelpErrorBox > aErrBox(const_cast< vcl::Window* >( pWindow )); - aErrBox->Execute(); + NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr); + aErrBox.run(); return false; } } diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index ec4321606bfb..b95a7f60c535 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -23,7 +23,8 @@ #include <unotools/moduleoptions.hxx> #include <vcl/builderfactory.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XStorage.hpp> @@ -281,8 +282,9 @@ IMPL_LINK(TemplateLocalView, ContextMenuSelectHdl, Menu*, pMenu, bool) break; case MNI_DELETE: { - ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - if ( aQueryDlg->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE))); + if (xQueryDlg->run() != RET_YES) break; maDeleteTemplateHdl.Call(maSelectedItem); @@ -511,8 +513,9 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_ { OUString sQuery = SfxResId(STR_MSG_QUERY_COPY).replaceFirst("$1", pViewItem->maTitle).replaceFirst("$2", getRegionName(nTargetRegion)); - ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, sQuery, VclMessageType::Question, VclButtonsType::YesNo); - if ( aQueryDlg->Execute() != RET_YES ) + + std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, sQuery)); + if (xQueryDlg->run() != RET_YES) return false; if (!mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId)) @@ -609,13 +612,14 @@ void TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s { OUString sQuery = SfxResId(STR_MSG_QUERY_COPY).replaceFirst("$1", pViewItem->maTitle).replaceFirst("$2", getRegionName(nTargetRegion)); - ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, sQuery, VclMessageType::Question, VclButtonsType::YesNo); - - if ( aQueryDlg->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, sQuery)); + if (xQueryDlg->run() != RET_YES) { OUString sMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE)); sMsg = sMsg.replaceFirst("$1",getRegionName(nTargetRegion)); - ScopedVclPtrInstance<MessageDialog>(this, sMsg.replaceFirst( "$2",pViewItem->maTitle))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sMsg.replaceFirst( "$2",pViewItem->maTitle))); + xBox->run(); return; //return if any single move operation fails } @@ -890,9 +894,9 @@ void TemplateLocalView::KeyInput( const KeyEvent& rKEvt ) } else if( aKeyCode == KEY_DELETE && !mFilteredItemList.empty()) { - ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - - if ( aQueryDlg->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE))); + if (xQueryDlg->run() != RET_YES) return; //copy to avoid changing filtered item list during deletion diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx index 374a3b268ef3..ace6b4fcb32e 100644 --- a/sfx2/source/control/templatesearchview.cxx +++ b/sfx2/source/control/templatesearchview.cxx @@ -12,7 +12,8 @@ #include <sfx2/templatelocalview.hxx> #include <sfx2/sfxresid.hxx> #include <tools/urlobj.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/strings.hrc> #include <bitmaps.hlst> @@ -60,9 +61,9 @@ void TemplateSearchView::KeyInput( const KeyEvent& rKEvt ) } else if( aKeyCode == KEY_DELETE && !mFilteredItemList.empty()) { - ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - - if ( aQueryDlg->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE))); + if (xQueryDlg->run() != RET_YES) return; //copy to avoid changing filtered item list during deletion @@ -159,8 +160,9 @@ IMPL_LINK(TemplateSearchView, ContextMenuSelectHdl, Menu*, pMenu, bool) break; case MNI_DELETE: { - ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - if ( aQueryDlg->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE))); + if (xQueryDlg->run() != RET_YES) break; maDeleteTemplateHdl.Call(maSelectedItem); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 91e21b80360a..d7703f62a73e 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -21,9 +21,9 @@ #include <svl/urihelper.hxx> #include <tools/datetime.hxx> #include <tools/urlobj.hxx> -#include <vcl/layout.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/cmdoptions.hxx> #include <comphelper/processfactory.hxx> @@ -1658,7 +1658,9 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr if ( bIsFromTypeBox ) // LoseFocus of TypeBox pLine->m_bTypeLostFocus = true; vcl::Window* pParent = GetParent()->GetParent(); - if (ScopedVclPtrInstance<MessageDialog>(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VclMessageType::Question, VclButtonsType::OkCancel)->Execute() == RET_OK) + std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::OkCancel, SfxResId(STR_SFX_QUERY_WRONG_TYPE))); + if (xMessageBox->run() == RET_OK) pLine->m_aTypeBox->SelectEntryPos(pLine->m_aTypeBox->GetEntryPos(reinterpret_cast<void*>(CUSTOM_TYPE_TEXT))); else pLine->m_aValueEdit->GrabFocus(); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 3d20a6a3333d..32249bd1db6b 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -51,6 +51,7 @@ #include <comphelper/types.hxx> #include <tools/urlobj.hxx> #include <vcl/help.hxx> +#include <vcl/weld.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/ucbhelper.hxx> #include <osl/file.hxx> @@ -1540,10 +1541,10 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList, } catch( const IllegalArgumentException& ) { - ScopedVclPtrInstance< MessageDialog > aBox( - mpPreferredParentWindow, - SfxResId(RID_SVXSTR_GPG_ENCRYPT_FAILURE)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(mpPreferredParentWindow ? mpPreferredParentWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(RID_SVXSTR_GPG_ENCRYPT_FAILURE))); + xBox->run(); } } diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 00fdcb0a2264..aa712142cf6b 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -52,7 +52,7 @@ #include <rtl/uri.h> #include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <sfx2/mailmodelapi.hxx> #include <sfxtypes.hxx> @@ -784,8 +784,9 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: SolarMutexGuard aGuard; VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); - ScopedVclPtrInstance< MessageDialog > aBox(pParentWindow, "ErrorFindEmailDialog", "sfx/ui/errorfindemaildialog.ui"); - aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pParentWindow ? pParentWindow->GetFrameWeld() : nullptr, "sfx/ui/errorfindemaildialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("ErrorFindEmailDialog")); + xBox->run(); eResult = SEND_MAIL_CANCELLED; } else diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 1dc87a2c537d..6268c5d61ace 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -18,7 +18,7 @@ */ #include <comphelper/string.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <vcl/field.hxx> #include <svl/eitem.hxx> @@ -602,8 +602,10 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) if (!pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' '))) { - ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDNAME ), VclMessageType::Info); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_TABPAGE_INVALIDNAME))); + xBox->run(); m_pNameRw->GrabFocus(); m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); return DeactivateRC::KeepPage; @@ -619,8 +621,10 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) { if ( !pStyle->SetFollow( aFollowEntry ) ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDSTYLE ), VclMessageType::Info); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_TABPAGE_INVALIDSTYLE))); + xBox->run(); m_pFollowLb->GrabFocus(); return DeactivateRC::KeepPage; } @@ -639,8 +643,10 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) { if ( !pStyle->SetParent( aParentEntry ) ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDPARENT ), VclMessageType::Info); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_TABPAGE_INVALIDPARENT))); + xBox->run(); m_pBaseLb->GrabFocus(); return DeactivateRC::KeepPage; } diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index 76dd62b0539d..e72f454a0795 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -25,6 +25,7 @@ #include <sfx2/strings.hrc> #include <sfx2/sfxresid.hxx> #include <vcl/layout.hxx> +#include <vcl/weld.hxx> // Private methods ------------------------------------------------------ @@ -40,11 +41,14 @@ IMPL_LINK_NOARG( SfxNewStyleDlg, OKHdl, ComboBox&, void ) { if ( !pStyle->IsUserDefined() ) { - ScopedVclPtrInstance<MessageDialog>( this, SfxResId( STR_POOL_STYLE_NAME ), VclMessageType::Info )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_POOL_STYLE_NAME))); + xBox->run(); return; } - if ( RET_YES == aQueryOverwriteBox->Execute() ) + if (RET_YES == xQueryOverwriteBox->run()) EndDialog( RET_OK ); } else @@ -58,8 +62,8 @@ IMPL_LINK( SfxNewStyleDlg, ModifyHdl, Edit&, rBox, void ) SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rInPool ) : ModalDialog(pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui") - , aQueryOverwriteBox(VclPtr<MessageDialog>::Create(this, SfxResId(STR_QUERY_OVERWRITE), - VclMessageType::Question, VclButtonsType::YesNo)) + , xQueryOverwriteBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QUERY_OVERWRITE))) , rPool(rInPool) { get(m_pColBox, "stylename"); @@ -86,7 +90,7 @@ SfxNewStyleDlg::~SfxNewStyleDlg() void SfxNewStyleDlg::dispose() { - aQueryOverwriteBox.disposeAndClear(); + xQueryOverwriteBox.reset(); m_pColBox.clear(); m_pOKBtn.clear(); ModalDialog::dispose(); diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index 347629fc7615..8c0f2378329c 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -17,16 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -// Include --------------------------------------------------------------- -#include <vcl/layout.hxx> - #include <sfx2/passwd.hxx> #include <sfxtypes.hxx> #include <sfx2/sfxresid.hxx> - #include <sfx2/strings.hrc> - +#include <vcl/weld.hxx> IMPL_LINK( SfxPasswordDialog, EditModifyHdl, Edit&, rEdit, void ) { @@ -71,8 +66,10 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl, Button*, void) bConfirmFailed = true; if ( bConfirmFailed ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId(STR_ERROR_WRONG_CONFIRM)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_ERROR_WRONG_CONFIRM))); + xBox->run(); mpConfirm1ED->SetText( OUString() ); mpConfirm1ED->GrabFocus(); } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 38d9fd8b4cc4..412b02f35110 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1885,14 +1885,10 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl() // we only want to show the dialog once and if we want to delete a style in use (UX-advice) if ( bUsedStyle ) { - #if defined UNX - ScopedVclPtrInstance<MessageDialog> aBox(SfxGetpApp()->GetTopWindow(), aMsg, - VclMessageType::Question, VclButtonsType::YesNo); - #else - ScopedVclPtrInstance<MessageDialog> aBox(GetWindow(), aMsg, - VclMessageType::Question, VclButtonsType::YesNo); - #endif - aApproved = aBox->Execute() == RET_YES; + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + aMsg)); + aApproved = xBox->run() == RET_YES; } // if there are no used styles selected or the user approved the changes diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx index a6f5ec97b73f..9d66a164563c 100644 --- a/sfx2/source/doc/QuerySaveDocument.cxx +++ b/sfx2/source/doc/QuerySaveDocument.cxx @@ -18,10 +18,10 @@ */ #include <sfx2/QuerySaveDocument.hxx> -#include <vcl/layout.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> -short ExecuteQuerySaveDocument(vcl::Window* _pParent, const OUString& _rTitle) +short ExecuteQuerySaveDocument(weld::Widget* _pParent, const OUString& _rTitle) { if (Application::IsHeadlessModeEnabled()) { @@ -29,9 +29,10 @@ short ExecuteQuerySaveDocument(vcl::Window* _pParent, const OUString& _rTitle) return RET_NO; } - ScopedVclPtrInstance< MessageDialog > aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui"); - aQBox->set_primary_text(aQBox->get_primary_text().replaceFirst("$(DOC)", _rTitle)); - return aQBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(_pParent, "sfx/ui/querysavedialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QuerySaveDialog")); + xQBox->set_primary_text(xQBox->get_primary_text().replaceFirst("$(DOC)", _rTitle)); + return xQBox->run(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 4f878d32f14d..824f8598f3cc 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -64,7 +64,7 @@ #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/mimeconfighelper.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/window.hxx> #include <toolkit/awt/vclxwindow.hxx> #include <o3tl/char16_t2wchar_t.hxx> @@ -666,10 +666,10 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus ) && GetMediaDescr().find( OUString("VersionComment") ) == GetMediaDescr().end() ) { // notify the user that SaveAs is going to be done - vcl::Window* pWin = SfxStoringHelper::GetModelWindow( m_xModel ); - ScopedVclPtrInstance<MessageDialog> aMessageBox(pWin, SfxResId(STR_NEW_FILENAME_SAVE), - VclMessageType::Question, VclButtonsType::OkCancel); - if ( aMessageBox->Execute() == RET_OK ) + vcl::Window* pWin = SfxStoringHelper::GetModelWindow(m_xModel); + std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::OkCancel, SfxResId(STR_NEW_FILENAME_SAVE))); + if (xMessageBox->run() == RET_OK) nResult = STATUS_SAVEAS; else nResult = STATUS_NO_ACTION; @@ -1388,8 +1388,9 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo || SignatureState::NOTVALIDATED == nDocumentSignatureState || SignatureState::PARTIAL_OK == nDocumentSignatureState) { - if (ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE), - VclMessageType::Question, VclButtonsType::YesNo)->Execute() != RET_YES) + std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE))); + if (xMessageBox->run() != RET_YES) { // the user has decided not to store the document throw task::ErrorCodeIOException( diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 52af0eb7a3c1..2d59f8fc6bbe 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -63,6 +63,7 @@ #include <basic/sbstar.hxx> #include <basic/basmgr.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <basic/sbx.hxx> #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> @@ -1826,8 +1827,9 @@ bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMess if (!aErrMessage.isEmpty()) aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_DETAILS) + aErrMessage; aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_CONTINUE); - ScopedVclPtrInstance< MessageDialog > aBox(nullptr, aMessage, VclMessageType::Question, VclButtonsType::YesNo); - mbContinueImportOnFilterExceptions = (aBox->Execute() == RET_YES) ? yes : no; + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, aMessage)); + mbContinueImportOnFilterExceptions = (xBox->run() == RET_YES) ? yes : no; } else mbContinueImportOnFilterExceptions = no; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 51e1a1ecfe16..c69cbe927643 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -45,10 +45,10 @@ #include <com/sun/star/security/DocumentDigitalSignatures.hpp> #include <tools/urlobj.hxx> #include <svl/whiter.hxx> -#include <vcl/layout.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <svl/visitem.hxx> +#include <vcl/weld.hxx> #include <vcl/wrkwin.hxx> #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> @@ -319,8 +319,9 @@ void SfxObjectShell::CheckOut( ) } catch ( const uno::RuntimeException& e ) { - ScopedVclPtrInstance< MessageDialog > pErrorBox( &GetFrame()->GetWindow(), e.Message ); - pErrorBox->Execute( ); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, e.Message)); + xBox->run(); } } @@ -337,8 +338,9 @@ void SfxObjectShell::CancelCheckOut( ) } catch ( const uno::RuntimeException& e ) { - ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message); - pErrorBox->Execute( ); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, e.Message)); + xBox->run(); } } @@ -359,8 +361,9 @@ void SfxObjectShell::CheckIn( ) } catch ( const uno::RuntimeException& e ) { - ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message); - pErrorBox->Execute( ); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, e.Message)); + xBox->run(); } } @@ -373,8 +376,9 @@ uno::Sequence< document::CmisVersion > SfxObjectShell::GetCmisVersions( ) } catch ( const uno::RuntimeException& e ) { - ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message); - pErrorBox->Execute( ); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, e.Message)); + xBox->run(); } return uno::Sequence< document::CmisVersion > ( ); } @@ -795,7 +799,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } case SID_CANCELCHECKOUT: { - if (ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_QUERY_CANCELCHECKOUT), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_YES) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, SfxResId(STR_QUERY_CANCELCHECKOUT))); + if (xBox->run() == RET_YES) { CancelCheckOut( ); @@ -1344,7 +1350,10 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) ) { // Only OASIS and OOo6.x formats will be handled further - ScopedVclPtrInstance<MessageDialog>( nullptr, SfxResId( STR_INFO_WRONGDOCFORMAT ), VclMessageType::Info )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_WRONGDOCFORMAT))); + + xBox->run(); return; } @@ -1388,9 +1397,12 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) if ( nVersion >= SvtSaveOptions::ODFVER_012 ) { + OUString sQuestion(bHasSign ? SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN) : SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN)); + std::unique_ptr<weld::MessageDialog> xQuestion(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, sQuestion)); + - if ( (bHasSign && ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_YES) - || (!bHasSign && ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_YES) ) + if (xQuestion->run() == RET_YES) { sal_uInt16 nId = SID_SAVEDOC; if ( !GetMedium() || GetMedium()->GetName().isEmpty() ) @@ -1406,7 +1418,9 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) || SotStorage::GetVersion( GetMedium()->GetStorage() ) <= SOFFICE_FILEFORMAT_60 ) ) { // Only OASIS format will be handled further - ScopedVclPtrInstance<MessageDialog>( nullptr, SfxResId( STR_INFO_WRONGDOCFORMAT ), VclMessageType::Info )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_WRONGDOCFORMAT))); + xBox->run(); return; } } @@ -1421,7 +1435,9 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) } else { - ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_XMLSEC_ODF12_EXPECTED))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_XMLSEC_ODF12_EXPECTED))); + xBox->run(); return; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index f22557e7ce24..53ec4e2af9c6 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -35,6 +35,7 @@ #include <osl/file.hxx> #include <rtl/instance.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/wrkwin.hxx> #include <vcl/svapp.hxx> #include <svl/eitem.hxx> @@ -576,7 +577,7 @@ bool SfxObjectShell::PrepareClose { const Reference< XTitle > xTitle( *pImpl->pBaseModel.get(), UNO_QUERY_THROW ); const OUString sTitle = xTitle->getTitle (); - nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); + nRet = ExecuteQuerySaveDocument(pFrame->GetWindow().GetFrameWeld(), sTitle); } /*HACK for plugin::destroy()*/ diff --git a/sfx2/source/doc/saveastemplatedlg.cxx b/sfx2/source/doc/saveastemplatedlg.cxx index 8096f60b9de9..168c39bc7e79 100644 --- a/sfx2/source/doc/saveastemplatedlg.cxx +++ b/sfx2/source/doc/saveastemplatedlg.cxx @@ -19,8 +19,8 @@ #include <sfx2/doctempl.hxx> #include <sfx2/docfilt.hxx> #include <vcl/edit.hxx> -#include <vcl/layout.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <sot/storage.hxx> #include <com/sun/star/frame/DocumentTemplates.hpp> @@ -77,15 +77,15 @@ void SfxSaveAsTemplateDialog::setDocumentModel(const uno::Reference<frame::XMode IMPL_LINK_NOARG(SfxSaveAsTemplateDialog, OkClickHdl, Button*, void) { - ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, OUString(), VclMessageType::Question, VclButtonsType::YesNo); - + std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + OUString())); if(!IsTemplateNameUnique()) { OUString sQueryMsg(SfxResId(STR_QMSG_TEMPLATE_OVERWRITE)); sQueryMsg = sQueryMsg.replaceFirst("$1",msTemplateName); - aQueryDlg->set_primary_text(sQueryMsg.replaceFirst("$2", msSelectedCategory)); + xQueryDlg->set_primary_text(sQueryMsg.replaceFirst("$2", msSelectedCategory)); - if( aQueryDlg->Execute() == RET_NO ) + if (xQueryDlg->run() == RET_NO) return; } @@ -94,7 +94,9 @@ IMPL_LINK_NOARG(SfxSaveAsTemplateDialog, OkClickHdl, Button*, void) else { OUString sText( SfxResId(STR_ERROR_SAVEAS) ); - ScopedVclPtrInstance<MessageDialog>(this, sText.replaceFirst("$1", msTemplateName))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + sText.replaceFirst("$1", msTemplateName))); + xBox->run(); } } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 6ab085296433..a5388e1a5649 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -36,9 +36,9 @@ #include <unotools/pathoptions.hxx> #include <unotools/viewoptions.hxx> #include <vcl/edit.hxx> -#include <vcl/layout.hxx> #include <vcl/toolbox.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> @@ -630,7 +630,9 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, ImportClickHdl, Button*, void) else { OUString aMsg( SfxResId(STR_CREATE_ERROR) ); - ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1", sCategory))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + aMsg.replaceFirst("$1", sCategory))); + xBox->run(); return; } } @@ -748,7 +750,9 @@ IMPL_LINK(SfxTemplateManagerDlg, DeleteTemplateHdl, ThumbnailViewItem*, pItem, v if (!aDeletedTemplate.isEmpty()) { OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_TEMPLATE) ); - ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1",aDeletedTemplate))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + aMsg.replaceFirst("$1",aDeletedTemplate))); + xBox->run(); } } @@ -967,7 +971,9 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(const OUString& sCategory) { OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT)); aMsg = aMsg.replaceFirst("$1",pContItem->maTitle); - ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$2",aTemplateList))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + aMsg.replaceFirst("$2",aTemplateList))); + xBox->run(); } } } @@ -1056,12 +1062,16 @@ void SfxTemplateManagerDlg::OnTemplateExport() if (!aTemplateList.isEmpty()) { OUString aText( SfxResId(STR_MSG_ERROR_EXPORT) ); - ScopedVclPtrInstance<MessageDialog>(this, aText.replaceFirst("$1",aTemplateList))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + aText.replaceFirst("$1",aTemplateList))); + xBox->run(); } else { OUString sText( SfxResId(STR_MSG_EXPORT_SUCCESS) ); - ScopedVclPtrInstance<MessageDialog>(this, sText.replaceFirst("$1", OUString::number(nCount)), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Info, VclButtonsType::Ok, + sText.replaceFirst("$1", OUString::number(nCount)))); + xBox->run(); } } } @@ -1117,7 +1127,9 @@ void SfxTemplateManagerDlg::OnCategoryNew() else { OUString aMsg( SfxResId(STR_CREATE_ERROR) ); - ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1", aName))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + aMsg.replaceFirst("$1", aName))); + xBox->run(); } } } @@ -1147,7 +1159,9 @@ void SfxTemplateManagerDlg::OnCategoryRename() else { OUString aMsg( SfxResId(STR_CREATE_ERROR) ); - ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1", aName))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + aMsg.replaceFirst("$1", aName))); + xBox->run(); } } } @@ -1164,10 +1178,9 @@ void SfxTemplateManagerDlg::OnCategoryDelete() { OUString sCategory = aDlg->GetSelectedCategory(); aDlg.disposeAndClear(); - ScopedVclPtrInstance< MessageDialog > popupDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE), - VclMessageType::Question, VclButtonsType::YesNo); - - if ( popupDlg->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> popupDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QMSG_SEL_FOLDER_DELETE))); + if (popupDlg->run() != RET_YES) return; sal_Int16 nItemId = mpLocalView->getRegionId(sCategory); @@ -1175,7 +1188,9 @@ void SfxTemplateManagerDlg::OnCategoryDelete() if (!mpLocalView->removeRegion(nItemId)) { OUString sMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER) ); - ScopedVclPtrInstance<MessageDialog>(this, sMsg.replaceFirst("$1",sCategory))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + sMsg.replaceFirst("$1",sCategory))); + xBox->run(); } else { @@ -1241,7 +1256,9 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nItemId) OUString sDst = mpLocalView->getRegionItemName(nItemId); OUString sMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE)); sMsg = sMsg.replaceFirst("$1",sDst); - ScopedVclPtrInstance<MessageDialog>(this, sMsg.replaceFirst( "$2",pItem->maTitle))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, + sMsg.replaceFirst( "$2",pItem->maTitle))); + xBox->run(); } } } diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx index fc4a52bfad1a..7d2414aad8bc 100644 --- a/sfx2/source/inc/alienwarn.hxx +++ b/sfx2/source/inc/alienwarn.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX #include <vcl/button.hxx> -#include <vcl/layout.hxx> +#include <vcl/messagedialog.hxx> class SfxAlienWarningDialog : public MessageDialog { diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 381da18b8916..5263a8b74b16 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -28,6 +28,7 @@ class SfxTemplateControllerItem; #include <vcl/button.hxx> #include <vcl/toolbox.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <svl/lstner.hxx> #include <svtools/treelistbox.hxx> #include <svl/eitem.hxx> @@ -316,6 +317,11 @@ public: return pWindow; } + weld::Widget* GetFrameWeld() + { + return pWindow ? pWindow->GetFrameWeld() : nullptr; + } + void EnableTreeDrag(bool b); void EnableExample_Impl(sal_uInt16 nId, bool bEnable); SfxStyleFamily GetActualFamily() const; diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index f167dc8428a8..a642d19b65e8 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -33,7 +33,7 @@ #include <sfx2/viewfrm.hxx> #include <tools/datetime.hxx> #include <unotools/datetime.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/fstathelper.hxx> #include <config_folders.h> @@ -528,14 +528,24 @@ bool SfxClassificationHelper::ShowPasteInfo(SfxClassificationCheckPasteResult eR case SfxClassificationCheckPasteResult::TargetDocNotClassified: { if (!Application::IsHeadlessModeEnabled()) - ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_TARGET_DOC_NOT_CLASSIFIED), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_TARGET_DOC_NOT_CLASSIFIED))); + xBox->run(); + } return false; } break; case SfxClassificationCheckPasteResult::DocClassificationTooLow: { if (!Application::IsHeadlessModeEnabled()) - ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_DOC_CLASSIFICATION_TOO_LOW), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_DOC_CLASSIFICATION_TOO_LOW))); + xBox->run(); + } return false; } break; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ea7e02d26475..a7874e1934b0 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -40,7 +40,7 @@ #include <svl/slstitm.hxx> #include <svl/whiter.hxx> #include <svl/undo.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svtools/sfxecode.hxx> #include <svtools/miscopt.hxx> #include <svtools/ehdl.hxx> @@ -154,35 +154,25 @@ void SfxViewFrame::InitInterface_Impl() namespace { /// Asks the user if editing a read-only document is really wanted. -class SfxEditDocumentDialog : public MessageDialog +class SfxEditDocumentDialog { private: - VclPtr<PushButton> m_pEditDocument; - VclPtr<PushButton> m_pCancel; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; + std::unique_ptr<weld::Button> m_xEditDocument; + std::unique_ptr<weld::Button> m_xCancel; public: - SfxEditDocumentDialog(vcl::Window* pParent); - ~SfxEditDocumentDialog() override; - void dispose() override; + SfxEditDocumentDialog(weld::Widget* pParent); + short run() { return m_xDialog->run(); } }; -SfxEditDocumentDialog::SfxEditDocumentDialog(vcl::Window* pParent) - : MessageDialog(pParent, "EditDocumentDialog", "sfx/ui/editdocumentdialog.ui") +SfxEditDocumentDialog::SfxEditDocumentDialog(weld::Widget* pParent) + : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/editdocumentdialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("EditDocumentDialog")) + , m_xEditDocument(m_xBuilder->weld_button("edit")) + , m_xCancel(m_xBuilder->weld_button("cancel")) { - get(m_pEditDocument, "edit"); - get(m_pCancel, "cancel"); -} - -SfxEditDocumentDialog::~SfxEditDocumentDialog() -{ - disposeOnce(); -} - -void SfxEditDocumentDialog::dispose() -{ - m_pEditDocument.clear(); - m_pCancel.clear(); - MessageDialog::dispose(); } class SfxQueryOpenAsTemplate : public QueryBox @@ -588,9 +578,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if ( bDo && GetFrame().DocIsModified_Impl() && !rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) ) { - ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_LASTVERSION), - VclMessageType::Question, VclButtonsType::YesNo); - bDo = ( RET_YES == aBox->Execute() ); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow().GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QUERY_LASTVERSION))); + bDo = RET_YES == xBox->run(); } if ( bDo ) @@ -756,9 +747,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if ( bForEdit && ( SID_EDITDOC == rReq.GetSlot() || SID_READONLYDOC == rReq.GetSlot() ) ) { // ask user for opening as template - ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE), - VclMessageType::Question, VclButtonsType::YesNo); - if ( RET_YES == aBox->Execute() ) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow().GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QUERY_OPENASTEMPLATE))); + if (RET_YES == xBox->run()) { SfxAllItemSet aSet( pApp->GetPool() ); aSet.Put( SfxStringItem( SID_FILE_NAME, pMedium->GetName() ) ); @@ -1345,12 +1337,12 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } } -IMPL_LINK_NOARG(SfxViewFrame, SwitchReadOnlyHandler, Button*, void) +IMPL_LINK(SfxViewFrame, SwitchReadOnlyHandler, Button*, pButton, void) { if (m_xObjSh.is() && IsSignPDF(m_xObjSh)) { - ScopedVclPtrInstance<SfxEditDocumentDialog> pDialog(nullptr); - if (pDialog->Execute() != RET_OK) + SfxEditDocumentDialog aDialog(pButton->GetFrameWeld()); + if (aDialog.run() != RET_OK) return; } GetDispatcher()->Execute(SID_EDITDOC); diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index a5be4fff8b7d..1d070d54e978 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -23,7 +23,7 @@ #include <com/sun/star/view/XRenderable.hpp> #include <svl/itempool.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svtools/prnsetup.hxx> #include <svl/flagitem.hxx> #include <svl/stritem.hxx> @@ -333,7 +333,13 @@ void SfxPrinterController::jobFinished( css::view::PrintableState nState ) // "real" problem (not simply printing cancelled by user) OUString aMsg( SfxResId(STR_NOSTARTPRINTER) ); if ( !m_bApi ) - ScopedVclPtrInstance<MessageDialog>(mpViewShell->GetWindow(), aMsg)->Execute(); + { + vcl::Window* pWindow = mpViewShell->GetWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + aMsg)); + xBox->run(); + } SAL_FALLTHROUGH; } case view::PrintableState_JOB_ABORTED : @@ -505,11 +511,16 @@ void SfxViewShell::SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter ) SfxPrinterChangeFlags nChangedFlags = SfxPrinterChangeFlags::NONE; // Ask if possible, if page format should be taken over from printer. - if ( ( bOriChg || bPgSzChg ) && - RET_YES == ScopedVclPtrInstance<MessageDialog>(nullptr, aMsg, VclMessageType::Question, VclButtonsType::YesNo)->Execute() ) + if (bOriChg || bPgSzChg) { - // Flags with changes for <SetPrinter(SfxPrinter*)> are maintained - nChangedFlags |= nNewOpt; + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aMsg)); + if (RET_YES == xBox->run()) + { + // Flags with changes for <SetPrinter(SfxPrinter*)> are maintained + nChangedFlags |= nNewOpt; + } } // For the MAC to have its "temporary of class String" in next if() @@ -778,7 +789,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // no valid printer either in ItemSet or at the document if ( !bSilent ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_NODEFPRINTER))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_NODEFPRINTER))); + xBox->run(); + } rReq.SetReturnValue(SfxBoolItem(0,false)); @@ -790,7 +806,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // if printer is busy, abort configuration if ( !bSilent ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_ERROR_PRINTER_BUSY), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_ERROR_PRINTER_BUSY))); + xBox->run(); + } rReq.SetReturnValue(SfxBoolItem(0,false)); return; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index d7962e72be16..f5b0f7399318 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -22,9 +22,9 @@ #include <svl/stritem.hxx> #include <svl/eitem.hxx> #include <svl/whiter.hxx> -#include <vcl/layout.hxx> #include <vcl/msgbox.hxx> #include <vcl/toolbox.hxx> +#include <vcl/weld.hxx> #include <svl/intitem.hxx> #include <svtools/langhelp.hxx> #include <svtools/sfxecode.hxx> @@ -497,8 +497,11 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) if ( eResult == SfxMailModel::SEND_MAIL_ERROR ) { - ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VclMessageType::Info); - aBox->Execute(); + vcl::Window* pWin = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_ERROR_SEND_MAIL))); + xBox->run(); rReq.Ignore(); } else @@ -517,9 +520,12 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame ); if( eResult == SfxMailModel::SEND_MAIL_ERROR ) { - ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VclMessageType::Info); - aBox->Execute(); - rReq.Ignore(); + vcl::Window* pWin = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_ERROR_SEND_MAIL))); + xBox->run(); + rReq.Ignore(); } else rReq.Done(); @@ -1116,8 +1122,10 @@ bool SfxViewShell::PrepareClose { if ( bUI ) { - ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetViewFrame()->GetWindow(), SfxResId( STR_CANT_CLOSE ), VclMessageType::Info ); - aInfoBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_CANT_CLOSE))); + xBox->run(); } return false; diff --git a/sfx2/uiconfig/ui/alienwarndialog.ui b/sfx2/uiconfig/ui/alienwarndialog.ui index d92c8bbbf757..feabad732dd7 100644 --- a/sfx2/uiconfig/ui/alienwarndialog.ui +++ b/sfx2/uiconfig/ui/alienwarndialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sfx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="AlienWarnDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="alienwarndialog|AlienWarnDialog">Confirm File Format</property> <property name="resizable">False</property> <property name="modal">True</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> <child> <object class="GtkButton" id="cancel"> <property name="label" translatable="yes" context="alienwarndialog|cancel">Use %DEFAULTEXTENSION _Format</property> @@ -82,8 +80,8 @@ </object> </child> <action-widgets> - <action-widget response="0">cancel</action-widget> - <action-widget response="1">save</action-widget> + <action-widget response="-6">cancel</action-widget> + <action-widget response="-5">save</action-widget> </action-widgets> </object> </interface> diff --git a/sfx2/uiconfig/ui/editdocumentdialog.ui b/sfx2/uiconfig/ui/editdocumentdialog.ui index e879e95dcfc9..f47c31b06c55 100644 --- a/sfx2/uiconfig/ui/editdocumentdialog.ui +++ b/sfx2/uiconfig/ui/editdocumentdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sfx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="EditDocumentDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="editdocumentdialog|EditDocumentDialog">Confirm editing of document</property> <property name="resizable">False</property> <property name="modal">True</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> <child> <object class="GtkButton" id="edit"> <property name="label" translatable="yes" context="editdocumentdialog|edit">Edit Document</property> @@ -66,8 +64,8 @@ </object> </child> <action-widgets> - <action-widget response="1">edit</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-5">edit</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/sfx2/uiconfig/ui/errorfindemaildialog.ui b/sfx2/uiconfig/ui/errorfindemaildialog.ui index 0f0195015ba0..be42a0c6c723 100644 --- a/sfx2/uiconfig/ui/errorfindemaildialog.ui +++ b/sfx2/uiconfig/ui/errorfindemaildialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="ErrorFindEmailDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="errorfindemaildialog|ErrorFindEmailDialog">No e-mail configuration</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> diff --git a/sfx2/uiconfig/ui/helpmanual.ui b/sfx2/uiconfig/ui/helpmanual.ui index 4104d13ce9bb..b5942c301e27 100644 --- a/sfx2/uiconfig/ui/helpmanual.ui +++ b/sfx2/uiconfig/ui/helpmanual.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.20"/> <object class="GtkMessageDialog" id="onlinehelpmanual"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="helpmanual|onlinehelpmanual">%PRODUCTNAME Help Not Installed</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> diff --git a/sfx2/uiconfig/ui/querysavedialog.ui b/sfx2/uiconfig/ui/querysavedialog.ui index 4d48d2379296..4f0b54aecb40 100644 --- a/sfx2/uiconfig/ui/querysavedialog.ui +++ b/sfx2/uiconfig/ui/querysavedialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sfx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QuerySaveDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querysavedialog|QuerySaveDialog">Save Document?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> <child> <object class="GtkButton" id="discard"> <property name="label" translatable="yes" context="querysavedialog|discard">_Don’t Save</property> @@ -77,9 +75,9 @@ </object> </child> <action-widgets> - <action-widget response="3">discard</action-widget> - <action-widget response="0">cancel</action-widget> - <action-widget response="2">save</action-widget> + <action-widget response="-9">discard</action-widget> + <action-widget response="-6">cancel</action-widget> + <action-widget response="-8">save</action-widget> </action-widgets> </object> </interface> diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 5da957ec7650..1fad0b099758 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -26,7 +26,7 @@ #include <svl/intitem.hxx> #include <svl/stritem.hxx> #include <vcl/builderfactory.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svtools/ctrltool.hxx> #include <vcl/waitobj.hxx> #include <vcl/settings.hxx> @@ -394,19 +394,24 @@ void SmFontDialog::DataChanged( const DataChangedEvent& rDCEvt ) ModalDialog::DataChanged( rDCEvt ); } -class SaveDefaultsQuery : public MessageDialog +class SaveDefaultsQuery { +private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xBox; public: - explicit SaveDefaultsQuery(vcl::Window *pParent) - : MessageDialog(pParent, "SaveDefaultsDialog", - "modules/smath/ui/savedefaultsdialog.ui") + explicit SaveDefaultsQuery(weld::Widget* pParent) + : m_xBuilder(Application::CreateBuilder(pParent, "modules/smath/ui/savedefaultsdialog.ui")) + , m_xBox(m_xBuilder->weld_message_dialog("SaveDefaultsDialog")) { } + short run() { return m_xBox->run(); } }; IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, Button *, void ) { - if (ScopedVclPtrInstance<SaveDefaultsQuery>(this)->Execute() == RET_YES) + SaveDefaultsQuery aQuery(GetFrameWeld()); + if (aQuery.run() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); @@ -508,7 +513,8 @@ IMPL_LINK( SmFontTypeDialog, MenuSelectHdl, Menu *, pMenu, bool ) IMPL_LINK_NOARG( SmFontTypeDialog, DefaultButtonClickHdl, Button *, void ) { - if (ScopedVclPtrInstance<SaveDefaultsQuery>(this)->Execute() == RET_YES) + SaveDefaultsQuery aQuery(GetFrameWeld()); + if (aQuery.run() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); @@ -704,7 +710,8 @@ IMPL_LINK( SmDistanceDialog, MenuSelectHdl, Menu *, pMenu, bool ) IMPL_LINK_NOARG( SmDistanceDialog, DefaultButtonClickHdl, Button *, void ) { - if (ScopedVclPtrInstance<SaveDefaultsQuery>(this)->Execute() == RET_YES) + SaveDefaultsQuery aQuery(GetFrameWeld()); + if (aQuery.run() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); @@ -996,7 +1003,8 @@ void SmDistanceDialog::WriteTo(SmFormat &rFormat) /*const*/ IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, Button *, void ) { - if (ScopedVclPtrInstance<SaveDefaultsQuery>(this)->Execute() == RET_YES) + SaveDefaultsQuery aQuery(GetFrameWeld()); + if (aQuery.run() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); diff --git a/starmath/uiconfig/smath/ui/savedefaultsdialog.ui b/starmath/uiconfig/smath/ui/savedefaultsdialog.ui index 8fe8f882162f..c4128f71e133 100644 --- a/starmath/uiconfig/smath/ui/savedefaultsdialog.ui +++ b/starmath/uiconfig/smath/ui/savedefaultsdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="SaveDefaultsDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="savedefaultsdialog|SaveDefaultsDialog">Save defaults?</property> <property name="resizable">False</property> <property name="modal">True</property> @@ -22,7 +21,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> diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index df6ef2fda9ae..c58f0a6609be 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -726,7 +726,6 @@ void ViewTabListBox_Impl::DeleteEntries() SvTreeListEntry* pEntry = FirstSelected(); OUString aURL; - OString sDialogPosition; while ( pEntry ) { SvTreeListEntry *pCurEntry = pEntry; @@ -759,16 +758,12 @@ void ViewTabListBox_Impl::DeleteEntries() if ( eResult != svtools::QUERYDELETE_ALL ) { INetURLObject aObj( aURL ); - ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(nullptr, aObj.GetName( INetURLObject::DecodeMechanism::WithCharset ) ); - if ( sDialogPosition.getLength() ) - aDlg->SetWindowState( sDialogPosition ); + svtools::QueryDeleteDlg_Impl aDlg(GetFrameWeld(), aObj.GetName(INetURLObject::DecodeMechanism::WithCharset)); if ( GetSelectionCount() > 1 ) - aDlg->EnableAllButton(); + aDlg.EnableAllButton(); - eResult = aDlg->Execute(); - - sDialogPosition = aDlg->GetWindowState( ); + eResult = aDlg.run(); } if ( ( eResult == svtools::QUERYDELETE_ALL ) || @@ -2186,24 +2181,17 @@ void SvtFileView_Impl::SetActualFolder( const INetURLObject& rActualFolder ) namespace svtools { -QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& rName) - : MessageDialog(pParent, "QueryDeleteDialog", "svt/ui/querydeletedialog.ui") +QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName) + : m_xBuilder(Application::CreateBuilder(pParent, "svt/ui/querydeletedialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("QueryDeleteDialog")) + , m_xAllButton(m_xBuilder->weld_button("all")) { - get(m_pAllButton, "all"); - // display specified texts - set_secondary_text(get_secondary_text().replaceFirst("%s", rName)); + m_xDialog->set_secondary_text(m_xDialog->get_secondary_text().replaceFirst("%s", rName)); } QueryDeleteDlg_Impl::~QueryDeleteDlg_Impl() { - disposeOnce(); -} - -void QueryDeleteDlg_Impl::dispose() -{ - m_pAllButton.clear(); - MessageDialog::dispose(); } } diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 7dafc5d4dbd8..c526c7744935 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -30,6 +30,7 @@ #include <vcl/waitobj.hxx> #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp> #include <com/sun/star/awt/XWindow.hpp> @@ -723,7 +724,7 @@ void AssignmentPersistentData::ImplCommit() if (!m_xDatabaseContext.is()) { const OUString sContextServiceName("com.sun.star.sdb.DatabaseContext"); - ShowServiceNotAvailableError( this, sContextServiceName, false); + ShowServiceNotAvailableError(GetFrameWeld(), sContextServiceName, false); return; } } @@ -774,7 +775,7 @@ void AssignmentPersistentData::ImplCommit() if (!xHandler.is()) { const OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler"); - ShowServiceNotAvailableError(this, sInteractionHandlerServiceName, true); + ShowServiceNotAvailableError(GetFrameWeld(), sInteractionHandlerServiceName, true); return; } @@ -1141,7 +1142,7 @@ void AssignmentPersistentData::ImplCommit() catch(const Exception&) { } if (!xAdminDialog.is()) { - ShowServiceNotAvailableError(this, "com.sun.star.ui.dialogs.AddressBookSourcePilot", true); + ShowServiceNotAvailableError(GetFrameWeld(), "com.sun.star.ui.dialogs.AddressBookSourcePilot", true); return; } diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx index 94f0491fd676..094961c51ce3 100644 --- a/svtools/source/java/javainteractionhandler.cxx +++ b/svtools/source/java/javainteractionhandler.cxx @@ -27,8 +27,8 @@ #include <com/sun/star/java/JavaVMCreationFailureException.hpp> #include <com/sun/star/java/RestartRequiredException.hpp> #include <comphelper/processfactory.hxx> -#include <vcl/layout.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <jvmfwk/framework.hxx> #include <svtools/restartdialog.hxx> @@ -90,7 +90,6 @@ void SAL_CALL JavaInteractionHandler::release( ) throw () delete this; } - void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionRequest >& Request ) { Any anyExc = Request->getRequest(); @@ -131,20 +130,23 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque // No suitable JRE found g_JavaEvents.bNotFoundHandled = true; #if defined( MACOSX ) - ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND_MAC), VclMessageType::Warning); + std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SvtResId(STR_WARNING_JAVANOTFOUND_MAC))); #elif defined( _WIN32 ) - ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND_WIN), VclMessageType::Warning); - OUString sPrimTex = aWarningBox->get_primary_text(); + std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SvtResId(STR_WARNING_JAVANOTFOUND_WIN))); + OUString sPrimTex = xWarningBox->get_primary_text(); #if defined( _WIN64 ) - aWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "64" )); + xWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "64" )); #else - aWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "32" )); + xWarningBox->set_primary_text(sPrimTex.replaceAll( "%BITNESS", "32" )); #endif #else - ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND), VclMessageType::Warning); + std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SvtResId(STR_WARNING_JAVANOTFOUND))); #endif - aWarningBox->SetText(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE)); - nResult = aWarningBox->Execute(); + xWarningBox->set_title(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE)); + nResult = xWarningBox->run(); } else { @@ -159,12 +161,14 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque // javavendors.xml was updated and Java has not been configured yet g_JavaEvents.bInvalidSettingsHandled = true; #ifdef MACOSX - ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC), VclMessageType::Warning); + OUString sWarning(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC)); #else - ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS), VclMessageType::Warning); + OUString sWarning(SvtResId(STR_WARNING_INVALIDJAVASETTINGS)); #endif - aWarningBox->SetText(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE)); - nResult = aWarningBox->Execute(); + std::unique_ptr<weld::MessageDialog> xWarningBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, sWarning)); + xWarningBox->set_title(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE)); + nResult = xWarningBox->run(); } else { @@ -178,9 +182,9 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque { g_JavaEvents.bDisabledHandled = true; // Java disabled. Give user a chance to enable Java inside Office. - ScopedVclPtrInstance<MessageDialog> aQueryBox(nullptr , "JavaDisabledDialog", - "svt/ui/javadisableddialog.ui"); - nResult = aQueryBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "svt/ui/javadisableddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("JavaDisabledDialog")); + nResult = xQueryBox->run(); if ( nResult == RET_YES ) { jfw_setEnabled(true); @@ -202,12 +206,14 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque // Java not correctly installed, or damaged g_JavaEvents.bVMCreationFailureHandled = true; #ifdef MACOSX - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC)); + OUString sWarning(SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC)); #else - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED)); + OUString sWarning(SvtResId(STR_ERROR_JVMCREATIONFAILED)); #endif - aErrorBox->SetText(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE)); - nResult = aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, sWarning)); + xErrorBox->set_title(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE)); + nResult = xErrorBox->run(); } else { diff --git a/svtools/uiconfig/ui/javadisableddialog.ui b/svtools/uiconfig/ui/javadisableddialog.ui index bc2d7b250207..a60d6aa74ded 100644 --- a/svtools/uiconfig/ui/javadisableddialog.ui +++ b/svtools/uiconfig/ui/javadisableddialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svt"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="JavaDisabledDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="javadisableddialog|JavaDisabledDialog">Enable JRE?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -19,7 +18,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -77,9 +75,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/svtools/uiconfig/ui/querydeletedialog.ui b/svtools/uiconfig/ui/querydeletedialog.ui index de2e3d102235..71ee4c7af917 100644 --- a/svtools/uiconfig/ui/querydeletedialog.ui +++ b/svtools/uiconfig/ui/querydeletedialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryDeleteDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletedialog|QueryDeleteDialog">Confirm Delete</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area"> <property name="can_focus">False</property> - <property name="layout_style">center</property> <child> <object class="GtkButton" id="yes"> <property name="label" translatable="yes" context="querydeletedialog|yes">_Delete</property> @@ -91,10 +89,10 @@ </object> </child> <action-widgets> - <action-widget response="2">yes</action-widget> + <action-widget response="-8">yes</action-widget> <action-widget response="101">all</action-widget> - <action-widget response="3">no</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index 9e8f3dfceab8..918cb173a525 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -26,7 +26,8 @@ #include <svx/graphichelper.hxx> #include <svx/strings.hrc> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <cppuhelper/exc_hlp.hxx> #include <comphelper/anytostring.hxx> @@ -416,11 +417,12 @@ void GraphicHelper::SaveShapeAsGraphic(const vcl::Window* pParent, const Refere } } -short GraphicHelper::HasToSaveTransformedImage(vcl::Window* pWin) +short GraphicHelper::HasToSaveTransformedImage(weld::Widget* pWin) { OUString aMsg(SvxResId(RID_SVXSTR_SAVE_MODIFIED_IMAGE)); - ScopedVclPtrInstance< MessageDialog > aBox(pWin, aMsg, VclMessageType::Question, VclButtonsType::YesNo); - return aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, + VclMessageType::Question, VclButtonsType::YesNo, aMsg)); + return xBox->run(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx index 4d3ff711e9ce..12027f312a42 100644 --- a/svx/source/dialog/SafeModeDialog.cxx +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -14,7 +14,7 @@ #include <osl/file.hxx> #include <sfx2/safemode.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <comphelper/anytostring.hxx> #include <comphelper/processfactory.hxx> #include <unotools/ZipPackageHelper.hxx> @@ -373,8 +373,10 @@ IMPL_LINK(SafeModeDialog, CreateZipBtnHdl, Button*, /*pBtn*/, void) } catch (uno::Exception) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SvxResId(RID_SVXSTR_SAFEMODE_ZIP_FAILURE)); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SvxResId(RID_SVXSTR_SAFEMODE_ZIP_FAILURE))); + xBox->run(); return; } diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx index 25e8045e64f8..5cdae19699bc 100644 --- a/svx/source/dialog/_contdlg.cxx +++ b/svx/source/dialog/_contdlg.cxx @@ -44,7 +44,7 @@ #include <vcl/settings.hxx> #include <vcl/virdev.hxx> #include "dlgunit.hxx" -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> SFX_IMPL_FLOATINGWINDOW_WITHID( SvxContourDlgChildWindow, SID_CONTOUR_DLG ); @@ -317,8 +317,9 @@ bool SvxSuperContourDlg::Close() if (m_pTbx1->IsItemEnabled(mnApplyId)) { - ScopedVclPtrInstance< MessageDialog > aQBox( this,"QuerySaveContourChangesDialog","svx/ui/querysavecontchangesdialog.ui"); - const long nRet = aQBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querysavecontchangesdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QuerySaveContourChangesDialog")); + const short nRet = xQBox->run(); if ( nRet == RET_YES ) { @@ -438,9 +439,10 @@ IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx, void ) { if (m_pTbx1->IsItemChecked(mnWorkSpaceId)) { - ScopedVclPtrInstance< MessageDialog > aQBox( this,"QueryDeleteContourDialog","svx/ui/querydeletecontourdialog.ui" ); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querydeletecontourdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryDeleteContourDialog")); - if ( !m_pContourWnd->IsContourChanged() || ( aQBox->Execute() == RET_YES ) ) + if (!m_pContourWnd->IsContourChanged() || (xQBox->run() == RET_YES)) m_pContourWnd->SetWorkplaceMode( true ); else m_pTbx1->CheckItem(mnWorkSpaceId, false); @@ -512,9 +514,10 @@ IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx, void ) m_pStbStatus->Invalidate(); else if ( bGraphicLinked ) { - ScopedVclPtrInstance<MessageDialog> aQBox(this, "QueryUnlinkGraphicsDialog", - "svx/ui/queryunlinkgraphicsdialog.ui"); - if (aQBox->Execute() != RET_YES) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/queryunlinkgraphicsdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryUnlinkGraphicsDialog")); + + if (xQBox->run() != RET_YES) { bPipette = false; m_pTbx1->CheckItem(mnPipetteId, bPipette); @@ -694,7 +697,9 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void ) if( !!aMask ) { - ScopedVclPtrInstance< MessageDialog > aQBox( this,"QueryNewContourDialog","svx/ui/querynewcontourdialog.ui" ); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querynewcontourdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryNewContourDialog")); + bool bNewContour; aRedoGraphic = Graphic(); @@ -702,7 +707,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void ) aGraphic = Graphic( BitmapEx( aBmp, aMask ) ); mnGrfChanged++; - bNewContour = ( aQBox->Execute() == RET_YES ); + bNewContour = (xQBox->run() == RET_YES); rWnd.SetGraphic( aGraphic, bNewContour ); if( bNewContour ) diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index a943eb4565f3..040afecf3b37 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -33,7 +33,7 @@ #include <vcl/xtextedt.hxx> #include <vcl/settings.hxx> #include <tools/urlobj.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/scrbar.hxx> @@ -828,10 +828,11 @@ void RecovDocList::InitEntry(SvTreeListEntry* pEntry, } -short impl_askUserForWizardCancel(vcl::Window* pParent, const char* pRes) +short impl_askUserForWizardCancel(weld::Widget* pParent, const char* pRes) { - ScopedVclPtrInstance< MessageDialog > aQuery(pParent, SvxResId(pRes), VclMessageType::Question, VclButtonsType::YesNo); - if (aQuery->Execute() == RET_YES) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(pParent, + VclMessageType::Question, VclButtonsType::YesNo, SvxResId(pRes))); + if (xQuery->run() == RET_YES) return DLG_RET_OK; else return DLG_RET_CANCEL; @@ -1161,7 +1162,7 @@ IMPL_LINK_NOARG(RecoveryDialog, CancelButtonHdl, Button*, void) switch (m_eRecoveryState) { case RecoveryDialog::E_RECOVERY_PREPARED: - if (impl_askUserForWizardCancel(this, RID_SVXSTR_QUERY_EXIT_RECOVERY) != DLG_RET_CANCEL) + if (impl_askUserForWizardCancel(GetFrameWeld(), RID_SVXSTR_QUERY_EXIT_RECOVERY) != DLG_RET_CANCEL) { m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED; execute(); diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 392e98473ffd..e109b7472fa7 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -540,9 +540,15 @@ IMPL_LINK( SvxHFPage, TurnOnHdl, Button *, pButton, void ) { short nResult; if (nId == SID_ATTR_PAGE_HEADERSET) - nResult = ScopedVclPtrInstance<DeleteHeaderDialog>(this)->Execute(); + { + DeleteHeaderDialog aDlg(GetFrameWeld()); + nResult = aDlg.run(); + } else - nResult = ScopedVclPtrInstance<DeleteFooterDialog>(this)->Execute(); + { + DeleteFooterDialog aDlg(GetFrameWeld()); + nResult = aDlg.run(); + } bDelete = nResult == RET_YES; } diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 8972b9155282..e910cd964b40 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -40,6 +40,7 @@ #include <unotools/localedatawrapper.hxx> #include <comphelper/processfactory.hxx> #include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svx/imapdlg.hxx> #include <svx/dialmgr.hxx> #include <svx/strings.hrc> @@ -242,8 +243,9 @@ bool SvxIMapDlg::Close() if ( m_pTbxIMapDlg1->IsItemEnabled( mnApplyId ) ) { - ScopedVclPtrInstance< MessageDialog > aQBox(this,"QueryModifyImageMapChangesDialog","svx/ui/querymodifyimagemapchangesdialog.ui"); - const long nRet = aQBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querymodifyimagemapchangesdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryModifyImageMapChangesDialog")); + const long nRet = xQBox->run(); if( nRet == RET_YES ) { @@ -257,8 +259,9 @@ bool SvxIMapDlg::Close() } else if( pIMapWnd->IsChanged() ) { - ScopedVclPtrInstance< MessageDialog > aQBox(this,"QuerySaveImageMapChangesDialog","svx/ui/querysaveimagemapchangesdialog.ui"); - const long nRet = aQBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querysaveimagemapchangesdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QuerySaveImageMapChangesDialog")); + const long nRet = xQBox->run(); if( nRet == RET_YES ) bRet = DoSave(); @@ -724,11 +727,14 @@ IMPL_LINK_NOARG(SvxIMapDlg, UpdateHdl, Timer *, void) if ( pOwnData->pUpdateEditingObject != pCheckObj ) { - if ( pIMapWnd->IsChanged() && - ( ScopedVclPtrInstance<MessageDialog>(this,"QuerySaveImageMapChangesDialog", - "svx/ui/querysaveimagemapchangesdialog.ui")->Execute() == RET_YES ) ) + if (pIMapWnd->IsChanged()) { - DoSave(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querysaveimagemapchangesdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QuerySaveImageMapChangesDialog")); + if (xQBox->run() == RET_YES) + { + DoSave(); + } } pIMapWnd->SetGraphic( pOwnData->aUpdateGraphic ); diff --git a/svx/source/dialog/linkwarn.cxx b/svx/source/dialog/linkwarn.cxx index 26879f23f7fe..23a4f0d2102f 100644 --- a/svx/source/dialog/linkwarn.cxx +++ b/svx/source/dialog/linkwarn.cxx @@ -18,43 +18,36 @@ */ #include <osl/file.hxx> +#include <vcl/svapp.hxx> #include <svx/linkwarn.hxx> #include <svtools/miscopt.hxx> -SvxLinkWarningDialog::SvxLinkWarningDialog( vcl::Window* pParent, const OUString& _rFileName ) - : MessageDialog(pParent, "LinkWarnDialog" , "svx/ui/linkwarndialog.ui") +SvxLinkWarningDialog::SvxLinkWarningDialog(weld::Widget* pParent, const OUString& _rFileName) + : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/linkwarndialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("LinkWarnDialog")) + , m_xWarningOnBox(m_xBuilder->weld_check_button("ask")) { - get(m_pWarningOnBox, "ask"); - // replace filename - OUString sInfoText = get_primary_text(); + OUString sInfoText = m_xDialog->get_primary_text(); OUString aPath; if ( osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL( _rFileName, aPath ) ) aPath = _rFileName; sInfoText = sInfoText.replaceAll("%FILENAME", aPath); - set_primary_text( sInfoText ); + m_xDialog->set_primary_text(sInfoText); // load state of "warning on" checkbox from misc options SvtMiscOptions aMiscOpt; - m_pWarningOnBox->Check( aMiscOpt.ShowLinkWarningDialog() ); - if( aMiscOpt.IsShowLinkWarningDialogReadOnly() ) - m_pWarningOnBox->Disable(); + m_xWarningOnBox->set_active(aMiscOpt.ShowLinkWarningDialog()); + m_xWarningOnBox->set_sensitive(!aMiscOpt.IsShowLinkWarningDialogReadOnly()); } SvxLinkWarningDialog::~SvxLinkWarningDialog() { - disposeOnce(); -} - -void SvxLinkWarningDialog::dispose() -{ // save value of "warning off" checkbox, if necessary SvtMiscOptions aMiscOpt; - bool bChecked = m_pWarningOnBox->IsChecked(); - if ( aMiscOpt.ShowLinkWarningDialog() != bChecked ) - aMiscOpt.SetShowLinkWarningDialog( bChecked ); - m_pWarningOnBox.clear(); - MessageDialog::dispose(); + bool bChecked = m_xWarningOnBox->get_active(); + if (aMiscOpt.ShowLinkWarningDialog() != bChecked) + aMiscOpt.SetShowLinkWarningDialog(bChecked); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx index e44397770bab..641624fd236e 100644 --- a/svx/source/dialog/passwd.cxx +++ b/svx/source/dialog/passwd.cxx @@ -18,7 +18,8 @@ */ #include <comphelper/string.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <svx/passwd.hxx> #include <svx/dialmgr.hxx> #include <svx/strings.hrc> @@ -29,7 +30,10 @@ IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl, Button*, void) if ( m_pNewPasswdED->GetText() != m_pRepeatPasswdED->GetText() ) { - ScopedVclPtrInstance<MessageDialog>(this, aRepeatPasswdErrStr)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aRepeatPasswdErrStr)); + xBox->run(); m_pNewPasswdED->SetText( "" ); m_pRepeatPasswdED->SetText( "" ); m_pNewPasswdED->GrabFocus(); @@ -38,7 +42,10 @@ IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl, Button*, void) if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) ) { - ScopedVclPtrInstance<MessageDialog>(this, aOldPasswdErrStr)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aOldPasswdErrStr)); + xBox->run(); m_pOldPasswdED->SetText( "" ); m_pOldPasswdED->GrabFocus(); bOK = false; @@ -48,7 +55,6 @@ IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl, Button*, void) EndDialog( RET_OK ); } - IMPL_LINK_NOARG(SvxPasswordDialog, EditModifyHdl, Edit&, void) { if ( !bEmpty ) diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index a75633f13962..9f0bf7f064d2 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -43,7 +43,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/builderfactory.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/container/XSet.hpp> @@ -522,8 +522,8 @@ namespace svxform { if ( !m_sInstanceURL.isEmpty() ) { - ScopedVclPtrInstance< LinkedInstanceWarningBox > aMsgBox( this ); - if ( aMsgBox->Execute() != RET_OK ) + LinkedInstanceWarningBox aMsgBox(GetFrameWeld()); + if (aMsgBox.run() != RET_OK) return bHandled; } @@ -685,8 +685,8 @@ namespace svxform { if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() ) { - ScopedVclPtrInstance< LinkedInstanceWarningBox > aMsgBox( this ); - if ( aMsgBox->Execute() != RET_OK ) + LinkedInstanceWarningBox aMsgBox(GetFrameWeld()); + if (aMsgBox.run() != RET_OK) return bHandled; } @@ -770,8 +770,8 @@ namespace svxform bHandled = true; if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() ) { - ScopedVclPtrInstance< LinkedInstanceWarningBox > aMsgBox( this ); - if ( aMsgBox->Execute() != RET_OK ) + LinkedInstanceWarningBox aMsgBox(GetFrameWeld()); + if (aMsgBox.run() != RET_OK) return bHandled; } bIsDocModified = RemoveEntry(); @@ -952,12 +952,14 @@ namespace svxform bool bIsElement = ( eChildType == css::xml::dom::NodeType_ELEMENT_NODE ); const char* pResId = bIsElement ? RID_STR_QRY_REMOVE_ELEMENT : RID_STR_QRY_REMOVE_ATTRIBUTE; OUString sVar = bIsElement ? OUString(ELEMENTNAME) : OUString(ATTRIBUTENAME); - ScopedVclPtrInstance< MessageDialog > aQBox(this, SvxResId(pResId), VclMessageType::Question, VclButtonsType::YesNo); - OUString sMessText = aQBox->get_primary_text(); + std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SvxResId(pResId))); + OUString sMessText = xQBox->get_primary_text(); sMessText = sMessText.replaceFirst( sVar, m_xUIHelper->getNodeDisplayName( pNode->m_xNode, false ) ); - aQBox->set_primary_text(sMessText); - if ( aQBox->Execute() == RET_YES ) + xQBox->set_primary_text(sMessText); + if (xQBox->run() == RET_YES) { SvTreeListEntry* pParent = m_pItemList->GetParent( pEntry ); DBG_ASSERT( pParent, "XFormsPage::RemoveEntry(): no parent entry" ); @@ -994,12 +996,13 @@ namespace svxform { SAL_WARN( "svx.form", "XFormsPage::RemoveEntry(): exception caught" ); } - ScopedVclPtrInstance<MessageDialog> aQBox(this, SvxResId(pResId), - VclMessageType::Question, VclButtonsType::YesNo); - OUString sMessText = aQBox->get_primary_text(); + std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SvxResId(pResId))); + OUString sMessText = xQBox->get_primary_text(); sMessText = sMessText.replaceFirst( sSearch, sName); - aQBox->set_primary_text(sMessText); - if ( aQBox->Execute() == RET_YES ) + xQBox->set_primary_text(sMessText); + if (xQBox->run() == RET_YES) { try { @@ -1496,9 +1499,11 @@ namespace svxform if ( m_pModelsBox->GetEntryPos( sNewName ) != LISTBOX_ENTRY_NOTFOUND ) { // error: model name already exists - ScopedVclPtrInstance< MessageDialog > aErrBox( this, SvxResId( RID_STR_DOUBLE_MODELNAME ) ); - aErrBox->set_primary_text(aErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName)); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SvxResId(RID_STR_DOUBLE_MODELNAME))); + xErrBox->set_primary_text(xErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName)); + xErrBox->run(); bShowDialog = true; } else @@ -1586,12 +1591,13 @@ namespace svxform } else if (sIdent == "modelsremove") { - ScopedVclPtrInstance<MessageDialog> aQBox(this, SvxResId( RID_STR_QRY_REMOVE_MODEL), - VclMessageType::Question, VclButtonsType::YesNo); - OUString sText = aQBox->get_primary_text(); + std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SvxResId( RID_STR_QRY_REMOVE_MODEL))); + OUString sText = xQBox->get_primary_text(); sText = sText.replaceFirst( MODELNAME, sSelectedModel ); - aQBox->set_primary_text(sText); - if ( aQBox->Execute() == RET_YES ) + xQBox->set_primary_text(sText); + if (xQBox->run() == RET_YES) { try { @@ -1686,12 +1692,13 @@ namespace svxform if ( pPage ) { OUString sInstName = pPage->GetInstanceName(); - ScopedVclPtrInstance<MessageDialog> aQBox(this, SvxResId(RID_STR_QRY_REMOVE_INSTANCE), - VclMessageType::Question, VclButtonsType::YesNo); - OUString sMessText = aQBox->get_primary_text(); + std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SvxResId(RID_STR_QRY_REMOVE_INSTANCE))); + OUString sMessText = xQBox->get_primary_text(); sMessText = sMessText.replaceFirst( INSTANCENAME, sInstName ); - aQBox->set_primary_text(sMessText); - if ( aQBox->Execute() == RET_YES ) + xQBox->set_primary_text(sMessText); + if (xQBox->run() == RET_YES) { bool bDoRemove = false; if (IsAdditionalPage(nId)) @@ -2439,9 +2446,11 @@ namespace svxform ( bIsHandleBinding && sNewName.isEmpty() ) ) { // Error and don't close the dialog - ScopedVclPtrInstance< MessageDialog > aErrBox( this, SvxResId( RID_STR_INVALID_XMLNAME ) ); - aErrBox->set_primary_text(aErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName)); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SvxResId(RID_STR_INVALID_XMLNAME))); + xErrBox->set_primary_text(xErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName)); + xErrBox->run(); return; } @@ -3072,9 +3081,11 @@ namespace svxform { if ( !m_pConditionDlg->GetUIHelper()->isValidPrefixName( sPrefix ) ) { - ScopedVclPtrInstance< MessageDialog > aErrBox(this, SvxResId( RID_STR_INVALID_XMLPREFIX ) ); - aErrBox->set_primary_text(aErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sPrefix)); - aErrBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SvxResId(RID_STR_INVALID_XMLPREFIX))); + xErrBox->set_primary_text(xErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sPrefix)); + xErrBox->run(); return; } } @@ -3144,11 +3155,13 @@ namespace svxform IMPL_LINK_NOARG(AddSubmissionDialog, OKHdl, Button*, void) { OUString sName(m_pNameED->GetText()); - if(sName.isEmpty()) { - - ScopedVclPtrInstance< MessageDialog > aErrorBox(this,SvxResId(RID_STR_EMPTY_SUBMISSIONNAME)); - aErrorBox->set_primary_text( Application::GetDisplayName() ); - aErrorBox->Execute(); + if(sName.isEmpty()) + { + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SvxResId(RID_STR_EMPTY_SUBMISSIONNAME))); + xErrorBox->set_primary_text(Application::GetDisplayName()); + xErrorBox->run(); return; } @@ -3388,8 +3401,9 @@ namespace svxform m_pURLED->SetText( aDlg.GetPath() ); } - LinkedInstanceWarningBox::LinkedInstanceWarningBox( vcl::Window* pParent ) - : MessageDialog(pParent, "FormLinkWarnDialog", "svx/ui/formlinkwarndialog.ui") + LinkedInstanceWarningBox::LinkedInstanceWarningBox(weld::Widget* pParent) + : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/formlinkwarndialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("FormLinkWarnDialog")) { } diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 7642cad54cfd..f3fd91f1f10b 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -63,6 +63,7 @@ #include <tools/diagnose_ex.h> #include <unotools/confignode.hxx> #include <vcl/stdtext.hxx> +#include <vcl/weld.hxx> #include <algorithm> @@ -563,7 +564,8 @@ void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell ) if ( !m_xBrowserController.is() ) { - ShowServiceNotAvailableError( GetParent(), "com.sun.star.inspection.ObjectInspector", true ); + vcl::Window *pWin = GetParent(); + ShowServiceNotAvailableError(pWin ? pWin->GetFrameWeld() : nullptr, "com.sun.star.inspection.ObjectInspector", true); } else { diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 8b4e0a97f99b..6fce0e94f774 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/awt/XTabControllerModel.hpp> #include <sfx2/viewfrm.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/wrkwin.hxx> #include <svl/whiter.hxx> #include <sfx2/app.hxx> @@ -250,10 +250,9 @@ bool FmFormShell::PrepareClose(bool bUI) if ( bModified && bUI ) { - ScopedVclPtrInstance<MessageDialog> aQry( - nullptr, "SaveModifiedDialog", - "svx/ui/savemodifieddialog.ui"); - switch (aQry->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "svx/ui/savemodifieddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQry(xBuilder->weld_message_dialog("SaveModifiedDialog")); + switch (xQry->run()) { case RET_YES: bResult = rController->commitCurrentRecord( ); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 7724e4221205..5fc8ea4f226b 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -92,7 +92,7 @@ #include <sfx2/viewsh.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <vcl/settings.hxx> #include <o3tl/make_unique.hxx> @@ -1474,8 +1474,12 @@ void FmXFormShell::ExecuteSearch_Lock() } if (m_aSearchForms.empty() ) - { // there are no controls that meet all the conditions for a search - ScopedVclPtrInstance<MessageDialog>(nullptr, SvxResId(RID_STR_NODATACONTROLS))->Execute(); + { + // there are no controls that meet all the conditions for a search + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SvxResId(RID_STR_NODATACONTROLS))); + xBox->run(); return; } @@ -3154,7 +3158,10 @@ void FmXFormShell::CreateExternalView_Lock() if (!bHaveUsableControls) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SvxResId(RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SvxResId(RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY))); + xBox->run(); return; } } diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 1217a632a0a0..2082050ecc4e 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -24,6 +24,8 @@ #include <unotools/datetime.hxx> #include <vcl/msgbox.hxx> #include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <ucbhelper/content.hxx> #include <sfx2/app.hxx> #include <helpids.h> @@ -358,7 +360,9 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) } else if (rIdent == "delete") { - if( ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryDeleteThemeDialog","svx/ui/querydeletethemedialog.ui")->Execute() == RET_YES ) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querydeletethemedialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteThemeDialog")); + if (xQuery->run() == RET_YES) mpGallery->RemoveTheme( mpThemes->GetSelectedEntry() ); } else if (rIdent == "rename") diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 220e358380ae..43b79f3bd33a 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -43,6 +43,7 @@ #include <galbrws2.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <svx/fmmodel.hxx> #include <svx/dialmgr.hxx> #include <svx/svxdlg.hxx> @@ -1099,10 +1100,14 @@ void GalleryBrowser2::Execute(const OString &rIdent) SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? GALLERYBROWSERMODE_PREVIEW : meLastMode ); else if (rIdent == "delete") { - if( !mpCurTheme->IsReadOnly() && - ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryDeleteObjectDialog","svx/ui/querydeleteobjectdialog.ui")->Execute() == RET_YES ) + if (!mpCurTheme->IsReadOnly()) { - mpCurTheme->RemoveObject( mnCurActionPos ); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querydeleteobjectdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteObjectDialog")); + if (xQuery->run() == RET_YES) + { + mpCurTheme->RemoveObject( mnCurActionPos ); + } } } else if (rIdent == "title") diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx index 1d38dd5102b1..c2daff365856 100644 --- a/svx/source/inc/datanavi.hxx +++ b/svx/source/inc/datanavi.hxx @@ -29,6 +29,7 @@ #include <vcl/tabpage.hxx> #include <vcl/toolbox.hxx> #include <vcl/idle.hxx> +#include <vcl/weld.hxx> #include <svtools/inettbc.hxx> #include <svtools/simptabl.hxx> #include <svtools/svmedit.hxx> @@ -632,13 +633,15 @@ namespace svxform }; - class LinkedInstanceWarningBox : public MessageDialog + class LinkedInstanceWarningBox { + private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::MessageDialog> m_xDialog; public: - LinkedInstanceWarningBox( vcl::Window* pParent ); + LinkedInstanceWarningBox(weld::Widget* pParent); + short run() { return m_xDialog->run(); } }; - - } diff --git a/svx/uiconfig/ui/deletefooterdialog.ui b/svx/uiconfig/ui/deletefooterdialog.ui index f77b40390d99..ce33ef1315ca 100644 --- a/svx/uiconfig/ui/deletefooterdialog.ui +++ b/svx/uiconfig/ui/deletefooterdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="DeleteFooterDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="deletefooterdialog|DeleteFooterDialog">Delete footer?</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> diff --git a/svx/uiconfig/ui/deleteheaderdialog.ui b/svx/uiconfig/ui/deleteheaderdialog.ui index 9a09130c24d2..2d2a7f02912c 100644 --- a/svx/uiconfig/ui/deleteheaderdialog.ui +++ b/svx/uiconfig/ui/deleteheaderdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="DeleteHeaderDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="deleteheaderdialog|DeleteHeaderDialog">Delete header?</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> diff --git a/svx/uiconfig/ui/formlinkwarndialog.ui b/svx/uiconfig/ui/formlinkwarndialog.ui index dcd7d76bc5ff..8fb64ac1dae8 100644 --- a/svx/uiconfig/ui/formlinkwarndialog.ui +++ b/svx/uiconfig/ui/formlinkwarndialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="FormLinkWarnDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -21,7 +20,6 @@ How do you want to proceed?</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area"> <property name="can_focus">False</property> - <property name="layout_style">end</property> <child> <object class="GtkButton" id="ok"> <property name="label" translatable="yes" context="formlinkwarndialog|ok">_Edit</property> @@ -63,8 +61,8 @@ How do you want to proceed?</property> </object> </child> <action-widgets> - <action-widget response="1">ok</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/svx/uiconfig/ui/linkwarndialog.ui b/svx/uiconfig/ui/linkwarndialog.ui index 7da928127f10..f1f22847db6f 100644 --- a/svx/uiconfig/ui/linkwarndialog.ui +++ b/svx/uiconfig/ui/linkwarndialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="LinkWarnDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="linkwarndialog|LinkWarnDialog">Confirm Linked Graphic</property> <property name="resizable">False</property> <property name="modal">True</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> <child> <object class="GtkButton" id="ok"> <property name="label" translatable="yes" context="linkwarndialog|ok">_Keep Link</property> @@ -83,8 +81,8 @@ </object> </child> <action-widgets> - <action-widget response="1">ok</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/svx/uiconfig/ui/querydeletecontourdialog.ui b/svx/uiconfig/ui/querydeletecontourdialog.ui index f2d7c3d35c4c..15af36d2b81e 100644 --- a/svx/uiconfig/ui/querydeletecontourdialog.ui +++ b/svx/uiconfig/ui/querydeletecontourdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryDeleteContourDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletecontourdialog|QueryDeleteContourDialog">Delete the contour?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -22,7 +21,6 @@ cause the contour to be deleted.</property> <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> diff --git a/svx/uiconfig/ui/querydeleteobjectdialog.ui b/svx/uiconfig/ui/querydeleteobjectdialog.ui index 024e704d8d44..cd5b7c6a9fd4 100644 --- a/svx/uiconfig/ui/querydeleteobjectdialog.ui +++ b/svx/uiconfig/ui/querydeleteobjectdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryDeleteObjectDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeleteobjectdialog|QueryDeleteObjectDialog">Delete this object?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area4"> <property name="can_focus">False</property> - <property name="layout_style">end</property> </object> <packing> <property name="expand">False</property> @@ -31,5 +29,8 @@ </child> </object> </child> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/svx/uiconfig/ui/querydeletethemedialog.ui b/svx/uiconfig/ui/querydeletethemedialog.ui index a7eb54ab2d3e..4c1a05c4f5c2 100644 --- a/svx/uiconfig/ui/querydeletethemedialog.ui +++ b/svx/uiconfig/ui/querydeletethemedialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryDeleteThemeDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydeletethemedialog|QueryDeleteThemeDialog">Delete this theme?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area2"> <property name="can_focus">False</property> - <property name="layout_style">end</property> </object> <packing> <property name="expand">False</property> @@ -31,5 +29,8 @@ </child> </object> </child> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/svx/uiconfig/ui/querymodifyimagemapchangesdialog.ui b/svx/uiconfig/ui/querymodifyimagemapchangesdialog.ui index 1d874646ad9b..eff11a64bb29 100644 --- a/svx/uiconfig/ui/querymodifyimagemapchangesdialog.ui +++ b/svx/uiconfig/ui/querymodifyimagemapchangesdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryModifyImageMapChangesDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querymodifyimagemapchangesdialog|QueryModifyImageMapChangesDialog">Save ImageMap changes?</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_area5"> <property name="can_focus">False</property> - <property name="layout_style">end</property> <child> <object class="GtkButton" id="cancel"> <property name="label">gtk-cancel</property> @@ -49,7 +47,7 @@ </object> </child> <action-widgets> - <action-widget response="0">cancel</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/svx/uiconfig/ui/querynewcontourdialog.ui b/svx/uiconfig/ui/querynewcontourdialog.ui index 8dc1d1994cf8..b511a02dc6af 100644 --- a/svx/uiconfig/ui/querynewcontourdialog.ui +++ b/svx/uiconfig/ui/querynewcontourdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryNewContourDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querynewcontourdialog|QueryNewContourDialog">Create a new contour?</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/svx/uiconfig/ui/querysavecontchangesdialog.ui b/svx/uiconfig/ui/querysavecontchangesdialog.ui index 91af4774429e..f4b3d022305c 100644 --- a/svx/uiconfig/ui/querysavecontchangesdialog.ui +++ b/svx/uiconfig/ui/querysavecontchangesdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QuerySaveContourChangesDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querysavecontchangesdialog|QuerySaveContourChangesDialog">Save contour changes?</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> <child> <object class="GtkButton" id="cancel"> <property name="label">gtk-cancel</property> @@ -47,7 +45,10 @@ </object> </child> <action-widgets> - <action-widget response="0">cancel</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/svx/uiconfig/ui/querysaveimagemapchangesdialog.ui b/svx/uiconfig/ui/querysaveimagemapchangesdialog.ui index a74be0694b8d..f0ad846b6935 100644 --- a/svx/uiconfig/ui/querysaveimagemapchangesdialog.ui +++ b/svx/uiconfig/ui/querysaveimagemapchangesdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QuerySaveImageMapChangesDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querysaveimagemapchangesdialog|QuerySaveImageMapChangesDialog">Save ImageMap changes?</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_area4"> <property name="can_focus">False</property> - <property name="layout_style">end</property> <child> <object class="GtkButton" id="cancel"> <property name="label">gtk-cancel</property> @@ -49,7 +47,7 @@ </object> </child> <action-widgets> - <action-widget response="0">cancel</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/svx/uiconfig/ui/queryunlinkgraphicsdialog.ui b/svx/uiconfig/ui/queryunlinkgraphicsdialog.ui index 82bd731b9ea8..1449fcae153a 100644 --- a/svx/uiconfig/ui/queryunlinkgraphicsdialog.ui +++ b/svx/uiconfig/ui/queryunlinkgraphicsdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="svx"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryUnlinkGraphicsDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="queryunlinkgraphicsdialog|QueryUnlinkGraphicsDialog">Unlink the graphics?</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> diff --git a/svx/uiconfig/ui/savemodifieddialog.ui b/svx/uiconfig/ui/savemodifieddialog.ui index 8ad47b0b3925..0c98506f092a 100644 --- a/svx/uiconfig/ui/savemodifieddialog.ui +++ b/svx/uiconfig/ui/savemodifieddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="SaveModifiedDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -19,7 +18,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -77,9 +75,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 5de324db4c85..1f2641b89b0a 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -20,7 +20,8 @@ #include <config_features.h> #include <vcl/dialog.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> +#include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/settings.hxx> #include <viewopt.hxx> @@ -691,8 +692,9 @@ short SwShellCursor::MaxReplaceArived() } vActionCounts.push_back(nActCnt); } - nRet = ScopedVclPtrInstance<MessageDialog>(pDlg, "AskSearchDialog", - "modules/swriter/ui/asksearchdialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pDlg->GetFrameWeld(), "modules/swriter/ui/asksearchdialog.ui")); + std::unique_ptr<weld::MessageDialog> xDialog(xBuilder->weld_message_dialog("AskSearchDialog")); + nRet = xDialog->run(); auto pActionCount = vActionCounts.begin(); for(SwViewShell& rShell : const_cast< SwCursorShell* >( GetShell() )->GetRingContainer()) { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 166152f275b7..923bb541952c 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -29,7 +29,8 @@ #include <strings.hrc> #include <swmodule.hxx> #include <editsh.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <comphelper/flagguard.hxx> using namespace com::sun::star; @@ -2709,8 +2710,9 @@ void DocumentRedlineManager::checkRedlining(RedlineFlags& _rReadlineMode) if ( pParent && !mbReadlineChecked && rRedlineTable.size() > MAX_REDLINE_COUNT && ((_rReadlineMode & RedlineFlags::ShowDelete) != RedlineFlags::ShowDelete) ) { - ScopedVclPtrInstance< MessageDialog > aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui"); - sal_uInt16 nResult = aQuery->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pParent->GetFrameWeld(), "modules/swriter/ui/queryshowchangesdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryShowChangesDialog")); + sal_uInt16 nResult = xQuery->run(); mbReadlineChecked = true; if ( nResult == RET_YES ) { diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index 688125e3202a..c02c74ce3851 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -28,7 +28,7 @@ #include <globals.hrc> #include <unotools/configmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> @@ -260,9 +260,9 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl, ListBox&, void) IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl, Button*, void) { - ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDefaultCompatDialog", - "modules/swriter/ui/querydefaultcompatdialog.ui"); - if (aQuery->Execute() == RET_YES) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/querydefaultcompatdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryDefaultCompatDialog")); + if (xQueryBox->run() == RET_YES) { for ( vector< SvtCompatibilityEntry >::iterator pItem = m_pImpl->m_aList.begin(); pItem != m_pImpl->m_aList.end(); ++pItem ) diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index ded560e5bdb0..853574e67eb2 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -21,7 +21,7 @@ #include <mailmergewizard.hxx> #include <swtypes.hxx> #include "addresslistdialog.hxx" -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/txtattr.hxx> #include <vcl/xtextedt.hxx> #include <vcl/builderfactory.hxx> @@ -183,7 +183,9 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl, Button*, void) catch (const uno::Exception& e) { SAL_WARN("sw", e); - ScopedVclPtrInstance<MessageDialog>(this, e.Message)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, e.Message)); + xBox->run(); } } diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index 3adfa2970897..6212ae20cf5c 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -21,6 +21,7 @@ #include <mailmergewizard.hxx> #include <mmconfigitem.hxx> #include <vcl/msgbox.hxx> +#include <vcl/messagedialog.hxx> #include <dbui.hrc> #include <strings.hrc> #include <bitmaps.hlst> diff --git a/sw/source/ui/dialog/swmessdialog.cxx b/sw/source/ui/dialog/swmessdialog.cxx index 79aba4459af6..c57f23534eb8 100644 --- a/sw/source/ui/dialog/swmessdialog.cxx +++ b/sw/source/ui/dialog/swmessdialog.cxx @@ -11,7 +11,7 @@ #include <vcl/button.hxx> #include <vcl/edit.hxx> #include <vcl/fixed.hxx> -#include <vcl/layout.hxx> +#include <vcl/messagedialog.hxx> #include <vcl/msgbox.hxx> #include <vcl/vclmedit.hxx> diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index aac5e2c1dfd1..1096103092da 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -22,7 +22,7 @@ #include <svl/urihelper.hxx> #include <svl/PasswordHelper.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> #include <sfx2/passwd.hxx> @@ -422,7 +422,10 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox) } else { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_WRONG_PASSWORD), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_PASSWORD))); + xInfoBox->run(); } } } @@ -989,7 +992,10 @@ IMPL_LINK( SwEditRegionDlg, UseFileHdl, Button *, pButton, void ) bool bContent = pSectRepr->IsContent(); if( pBox->IsChecked() && bContent && rSh.HasSelection() ) { - if (RET_NO == ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_QUERY_CONNECT), VclMessageType::Question, VclButtonsType::YesNo)->Execute()) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_CONNECT))); + if (RET_NO == xQueryBox->run()) pBox->Check( false ); } if( bFile ) @@ -1265,7 +1271,10 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox, void ) } else { - ScopedVclPtrInstance<MessageDialog>(pBox, SwResId(STR_WRONG_PASSWD_REPEAT), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pBox->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_PASSWD_REPEAT))); + xInfoBox->run(); ChangePasswdHdl(pBox); break; } @@ -1702,7 +1711,10 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton, void ) } else { - ScopedVclPtrInstance<MessageDialog>(pButton, SwResId(STR_WRONG_PASSWD_REPEAT), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pButton->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_PASSWD_REPEAT))); + xInfoBox->run(); } } else if(!bChange) @@ -1725,9 +1737,14 @@ IMPL_LINK( SwInsertSectionTabPage, UseFileHdl, Button *, pButton, void ) CheckBox* pBox = static_cast<CheckBox*>(pButton); if( pBox->IsChecked() ) { - if( m_pWrtSh->HasSelection() && - RET_NO == ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_QUERY_CONNECT), VclMessageType::Question, VclButtonsType::YesNo)->Execute()) - pBox->Check( false ); + if (m_pWrtSh->HasSelection()) + { + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_CONNECT))); + if (RET_NO == xQueryBox->run()) + pBox->Check( false ); + } } bool bFile = pBox->IsChecked(); diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 18c4b2feb4bd..82a5b754f9c7 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -18,7 +18,7 @@ */ #include <tools/poly.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> @@ -639,19 +639,20 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl, Button*, void) if ( rCfg.IsPredefinedLabel(sMake, sType) ) { SAL_WARN( "sw.envelp", "label is predefined and cannot be overwritten" ); - ScopedVclPtrInstance<MessageDialog>(this, "CannotSaveLabelDialog", "modules/swriter/ui/cannotsavelabeldialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/cannotsavelabeldialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("CannotSaveLabelDialog")); + xBox->run(); return; } - ScopedVclPtrInstance<MessageDialog> aQuery(this, "QuerySaveLabelDialog", - "modules/swriter/ui/querysavelabeldialog.ui"); - - aQuery->set_primary_text(aQuery->get_primary_text(). + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/querysavelabeldialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QuerySaveLabelDialog")); + xQuery->set_primary_text(xQuery->get_primary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - aQuery->set_secondary_text(aQuery->get_secondary_text(). + xQuery->set_secondary_text(xQuery->get_secondary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - if (RET_YES != aQuery->Execute()) + if (RET_YES != xQuery->run()) return; } rLabRec.m_aType = sType; diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 4de77fd36e65..c5628740ffdb 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/util/SearchFlags.hpp> #include <i18nutil/searchopt.hxx> #include <svl/stritem.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <sfx2/dispatch.hxx> #include <svl/eitem.hxx> #include <unotools/textsearch.hxx> @@ -1219,8 +1219,10 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl, Button*, void) bDifferent |= m_sFields[i] != pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)); if(bDifferent) { - ScopedVclPtrInstance< MessageDialog > aQuery(&m_rDialog, SwResId(STR_QUERY_CHANGE_AUTH_ENTRY), VclMessageType::Question, VclButtonsType::YesNo); - if(RET_YES != aQuery->Execute()) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(m_rDialog.GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_CHANGE_AUTH_ENTRY))); + if (RET_YES != xQuery->run()) return; } } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index e69802781349..53eade41ba0c 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -21,7 +21,7 @@ #include <o3tl/any.hxx> #include <vcl/menu.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/help.hxx> #include <vcl/builderfactory.hxx> #include <svl/stritem.hxx> @@ -461,7 +461,10 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool ) const OUString aShortName(m_pShortNameEdit->GetText()); if(pGlossaryHdl->HasShortName(aShortName)) { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_DOUBLE_SHORTNAME), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_DOUBLE_SHORTNAME))); + xInfoBox->run(); m_pShortNameEdit->SetSelection(Selection(0, SELECTION_MAX)); m_pShortNameEdit->GrabFocus(); return true; @@ -589,7 +592,10 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool ) Init(); else { - ScopedVclPtrInstance<MessageDialog>(this, SwResId( STR_NO_GLOSSARIES ), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_NO_GLOSSARIES))); + xInfoBox->run(); } } } @@ -668,9 +674,10 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl, Button*, void) } else { - ScopedVclPtrInstance< MessageDialog > aBox(this, sReadonlyPath, VclMessageType::Question, VclButtonsType::YesNo); - - if(RET_YES == aBox->Execute()) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + sReadonlyPath)); + if (RET_YES == xBox->run()) PathHdl(m_pPathBtn); } } @@ -802,7 +809,10 @@ IMPL_LINK_NOARG(SwNewGlosNameDlg, Rename, Button*, void) if( pDlg->pGlossaryHdl->HasShortName(m_pNewShort->GetText()) && sNew != m_pOldShort->GetText() ) { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_DOUBLE_SHORTNAME), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_DOUBLE_SHORTNAME))); + xBox->run(); m_pNewShort->GrabFocus(); } else @@ -1138,8 +1148,10 @@ void SwGlossaryDlg::DeleteEntry() const bool bExists = nullptr != pChild; const bool bIsGroup = pEntry && !pParent; - ScopedVclPtrInstance< MessageDialog > aQuery(this, SwResId(STR_QUERY_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - if (bExists && !bIsGroup && RET_YES == aQuery->Execute()) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_DELETE))); + if (bExists && !bIsGroup && RET_YES == xQuery->run()) { if (!aTitle.isEmpty() && pGlossaryHdl->DelGlossary(aShortName)) { diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index e20fb410a7bb..da09f637d51e 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -23,6 +23,7 @@ #include <vcl/lstbox.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <sfx2/dispatch.hxx> @@ -366,7 +367,13 @@ void SwSortDlg::Apply() } if( !bRet ) - ScopedVclPtrInstance<MessageDialog>(GetParent(), SwResId(STR_SRTERR), VclMessageType::Info)->Execute(); + { + vcl::Window* pWin = GetParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_SRTERR))); + xInfoBox->run(); + } } IMPL_LINK( SwSortDlg, DelimHdl, Button*, pButton, void ) diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index fe915df54d11..c7d65cb6f2db 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -19,7 +19,7 @@ #include <hintids.hxx> #include <comphelper/string.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> @@ -633,7 +633,10 @@ DeactivateRC SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet ) OUString sTableName = m_pNameED->GetText(); if(sTableName.indexOf(' ') != -1) { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_WRONG_TABLENAME), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_TABLENAME))); + xInfoBox->run(); m_pNameED->GrabFocus(); return DeactivateRC::KeepPage; } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 870766a2312e..c52304ff341a 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -30,8 +30,9 @@ #include <tools/urlobj.hxx> #include <unotools/tempfile.hxx> #include <unotools/configmgr.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> #include <svl/lckbitem.hxx> #include <svl/eitem.hxx> #include <svl/zforlist.hxx> @@ -608,10 +609,9 @@ void SwDocShell::Execute(SfxRequest& rReq) std::shared_ptr<const SfxFilter> pFlt = GetMedium()->GetFilter(); if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData()) { - ScopedVclPtrInstance<MessageDialog> aQuery(&pViewFrame->GetWindow(), - "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui"); - - if(RET_YES == aQuery->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pViewFrame->GetWindow().GetFrameWeld(), "modules/swriter/ui/saveashtmldialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("SaveAsHTMLDialog")); + if (RET_YES == xQuery->run()) bLocalHasName = false; else break; diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 2ebbe2be324d..dd2ee979dad6 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -19,7 +19,8 @@ #include <memory> #include <SwSpellDialogChildWindow.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <editeng/svxacorr.hxx> #include <editeng/acorrcfg.hxx> #include <svx/svxids.hrc> @@ -386,9 +387,10 @@ The code below would only be part of the solution. if(m_pSpellState->m_xStartRange.is()) { LockFocusNotification( true ); - sal_uInt16 nRet = ScopedVclPtrInstance<MessageDialog>(GetWindow(), SwResId(STR_QUERY_SPELL_CONTINUE), - VclMessageType::Question, VclButtonsType::YesNo)->Execute(); - if(RET_YES == nRet) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow()->GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, SwResId(STR_QUERY_SPELL_CONTINUE))); + sal_uInt16 nRet = xBox->run(); + if (RET_YES == nRet) { SwUnoInternalPaM aPam(*pWrtShell->GetDoc()); if (::sw::XTextRangeToSwPaM(aPam, @@ -415,8 +417,9 @@ The code below would only be part of the solution. LockFocusNotification( true ); OUString sInfo(SwResId(STR_SPELLING_COMPLETED)); // #i84610# - vcl::Window* pTemp = GetWindow(); // temporary needed for g++ 3.3.5 - ScopedVclPtrInstance<MessageDialog>(pTemp, sInfo, VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow()->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, sInfo)); + xBox->run(); LockFocusNotification( false ); // take care that the now valid selection is stored LoseFocus(); diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 494c348a6465..e583f189d5dc 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -47,7 +47,8 @@ #include <strings.hrc> #include <swerror.h> #include <frmmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <vcl/lstbox.hxx> #include <editeng/acorrcfg.hxx> @@ -321,7 +322,9 @@ bool SwGlossaryHdl::NewGlossary(const OUString& rName, const OUString& rShortNam rCfg.IsSaveRelFile(), pOnlyText ); if(nSuccess == sal_uInt16(-1) ) { - ScopedVclPtrInstance<MessageDialog>(pWrtShell->GetView().GetWindow(), SwResId(STR_ERR_INSERT_GLOS), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWrtShell->GetView().GetWindow()->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, SwResId(STR_ERR_INSERT_GLOS))); + xBox->run(); } if( !pCurGrp ) delete pTmp; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 42c82b5e7550..34fe1fa3855a 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -42,7 +42,7 @@ #include <sfx2/linkmgr.hxx> #include <tools/urlobj.hxx> #include <vcl/wrkwin.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> @@ -378,10 +378,9 @@ namespace sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( - nullptr, "QueryRotateIntoStandardOrientationDialog", - "modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox->Execute() == RET_YES) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/queryrotateintostandarddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryRotateIntoStandardOrientationDialog")); + if (xQueryBox->run() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); @@ -1700,7 +1699,10 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData, if (bMsg && pResId) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(pResId), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(pResId))); + xBox->run(); } return bRet; } @@ -1774,7 +1776,12 @@ bool SwTransferable::PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, if( ! aReader.Read( *pRead ).IsError() ) bRet = true; else if( bMsg ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_ERROR_CLPBRD_READ), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERROR_CLPBRD_READ))); + xBox->run(); + } } else { @@ -2152,7 +2159,12 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, if (nRows > SAL_MAX_UINT16 || nCols > SAL_MAX_UINT16) { if( bMsg ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_TABLE_TOO_LARGE), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_TABLE_TOO_LARGE))); + xBox->run(); + } pDDETyp = nullptr; break; } @@ -2161,7 +2173,12 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, if( !nRows || !nCols ) { if( bMsg ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_NO_TABLE), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_NO_TABLE))); + xBox->run(); + } pDDETyp = nullptr; break; } @@ -2707,7 +2724,10 @@ bool SwTransferable::PasteDBData( TransferableDataHelper& rData, } else if( bMsg ) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_CLPBRD_FORMAT_ERROR), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_CLPBRD_FORMAT_ERROR))); + xBox->run(); } return bRet; } @@ -2746,7 +2766,10 @@ bool SwTransferable::PasteFileList( TransferableDataHelper& rData, } else if( bMsg ) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_CLPBRD_FORMAT_ERROR), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_CLPBRD_FORMAT_ERROR))); + xBox->run(); } return bRet; } diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 132387b9ff6b..38493c9587b8 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -37,7 +37,7 @@ #include <vcl/svapp.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <vcl/gradient.hxx> #include <vcl/scrbar.hxx> @@ -271,8 +271,9 @@ void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt ) } else { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xQuery->run(); } } if (bDone) diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 6168e4fde52f..8c33ce4e5ba3 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -34,6 +34,7 @@ #include <vcl/help.hxx> #include <vcl/graph.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sot/storage.hxx> #include <svl/macitem.hxx> #include <unotools/securityoptions.hxx> @@ -1848,8 +1849,9 @@ KEYINPUT_CHECKTABLE_INSDEL: } else if (!rSh.IsCursorInParagraphMetadataField()) { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xInfo->run(); eKeyState = SwKeyState::End; } break; @@ -2024,8 +2026,9 @@ KEYINPUT_CHECKTABLE_INSDEL: } else if (!rSh.IsCursorInParagraphMetadataField()) { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xInfo->run(); eKeyState = SwKeyState::End; } break; @@ -2471,8 +2474,9 @@ KEYINPUT_CHECKTABLE_INSDEL: } else { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xInfo->run(); eKeyState = SwKeyState::End; } break; diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index 109b4f4d86dc..405f27a27a57 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -59,6 +59,8 @@ #include <rtl/string.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/graphicfilter.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <sfx2/sfxdlg.hxx> @@ -795,9 +797,10 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) uno::Any exc( ::cppu::getCaughtException() ); OUString msg( ::comphelper::anyToString( exc ) ); const SolarMutexGuard guard; - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg); - aErrorBox->SetText( "Explanations" ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pSh->GetView().GetViewFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, msg)); + xBox->set_title("Explanations"); + xBox->run(); } } else if (nId == m_nRedlineAcceptId || nId == m_nRedlineRejectId diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 3d2e439b1083..e536f5bab523 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -161,7 +161,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) vcl::Window* pWin = GetView().GetWindow(); if (pWin) { - nState = GraphicHelper::HasToSaveTransformedImage(pWin); + nState = GraphicHelper::HasToSaveTransformedImage(pWin->GetFrameWeld()); } } else diff --git a/sw/source/uibase/shells/grfshex.cxx b/sw/source/uibase/shells/grfshex.cxx index 0d842fe8f8fd..faebe58c21fd 100644 --- a/sw/source/uibase/shells/grfshex.cxx +++ b/sw/source/uibase/shells/grfshex.cxx @@ -35,6 +35,7 @@ #include <frmfmt.hxx> #include <frmmgr.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svx/svdomedia.hxx> #include <svx/svdview.hxx> #include <svx/svdpagv.hxx> @@ -87,7 +88,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq ) pWindow->LeaveWait(); if( !bAPI ) - ::avmedia::MediaWindow::executeFormatErrorBox( pWindow ); + ::avmedia::MediaWindow::executeFormatErrorBox(pWindow ? pWindow->GetFrameWeld() : nullptr); } else { diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 7e5c43c3e188..022bb8b4dd44 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -40,7 +40,7 @@ #include <svx/svxdlg.hxx> #include <svl/zformat.hxx> #include <sfx2/bindings.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> @@ -763,9 +763,11 @@ void SwTableShell::Execute(SfxRequest &rReq) break; case TableMergeErr::TooComplex: { - ScopedVclPtrInstance<MessageDialog> aInfoBox( GetView().GetWindow(), - SwResId( STR_ERR_TABLE_MERGE ), VclMessageType::Info ); - aInfoBox->Execute(); + vcl::Window* pWin = GetView().GetWindow(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERR_TABLE_MERGE))); + xInfoBox->run(); break; } default: diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index a3775558fed1..fa3fe1ee1dae 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -23,7 +23,7 @@ #include <unotools/tempfile.hxx> #include <tools/urlobj.hxx> #include <vcl/errinf.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/print.hxx> #include <vcl/msgbox.hxx> #include <vcl/wrkwin.hxx> @@ -612,8 +612,9 @@ void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, { if(bNotFoundMessage) { - ScopedVclPtrInstance<MessageDialog>(nullptr, "InfoNotFoundDialog", - "modules/swriter/ui/infonotfounddialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/infonotfounddialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfoBox(xBuilder->weld_message_dialog("InfoNotFoundDialog")); + xInfoBox->run(); } else if(!bRecursive) { @@ -621,13 +622,15 @@ void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, if (!bForward) { - nRet = ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryContinueEndDialog", - "modules/swriter/ui/querycontinueenddialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/querycontinueenddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryContinueEndDialog")); + nRet = xQueryBox->run(); } else { - nRet = ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryContinueBeginDialog", - "modules/swriter/ui/querycontinuebegindialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/querycontinuebegindialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryContinueBeginDialog")); + nRet = xQueryBox->run(); } if (nRet == RET_YES) @@ -804,8 +807,11 @@ void SwSrcView::Load(SwDocShell* pDocShell) } else { - vcl::Window *pTmpWindow = &GetViewFrame()->GetWindow(); - ScopedVclPtrInstance<MessageDialog>(pTmpWindow, SwResId(STR_ERR_SRCSTREAM), VclMessageType::Info)->Execute(); + vcl::Window& rTmpWindow = GetViewFrame()->GetWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(rTmpWindow.GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERR_SRCSTREAM))); + xBox->run(); } } else diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index a758545edebc..a3e6107aa71b 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/scanner/XScannerManager2.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <comphelper/processfactory.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/msgbox.hxx> @@ -172,7 +172,10 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) if( !bDone ) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_SCAN_NOSOURCE), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_SCAN_NOSOURCE))); + xBox->run(); rReq.Ignore(); } else diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 62212cae6083..31f7deb72e16 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -55,7 +55,7 @@ #include <editeng/lrspitem.hxx> #include <unotools/textsearch.hxx> #include <editeng/unolingu.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <editeng/tstpitem.hxx> #include <sfx2/event.hxx> @@ -228,8 +228,10 @@ ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter, const sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox->Execute() == RET_YES) + vcl::Window* pWin = GetWindow(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr, "modules/swriter/ui/queryrotateintostandarddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryRotateIntoStandardOrientationDialog")); + if (xQueryBox->run() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); @@ -426,8 +428,9 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) // really store as link only? if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() ) { - ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(GetWindow(),pFileDlg->GetPath()); - if( aWarnDlg->Execute() != RET_OK ) + vcl::Window* pWin = GetWindow(); + SvxLinkWarningDialog aWarnDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFileDlg->GetPath()); + if(aWarnDlg.run() != RET_OK) bAsLink=false; // don't store as link } } @@ -482,8 +485,11 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) { if( bShowError ) { - ScopedVclPtrInstance< MessageDialog > aInfoBox( GetWindow(), SwResId(pResId), VclMessageType::Info); - aInfoBox->Execute(); + vcl::Window* pWin = GetWindow(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(pResId))); + xInfoBox->run(); } rReq.Ignore(); } @@ -2224,8 +2230,10 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe if (!bCompare && !nFound) { - vcl::Window* pWin = &GetEditWin(); - ScopedVclPtrInstance<MessageDialog>(pWin, SwResId(STR_NO_MERGE_ENTRY), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_NO_MERGE_ENTRY))); + xInfoBox->run(); } if( nRet==2 && xDocSh.is() ) xDocSh->DoClose(); @@ -2278,11 +2286,10 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) if ( lcl_NeedAdditionalDataSource( xDBContext ) ) { // no data sources are available - create a new one - ScopedVclPtrInstance<MessageDialog> aQuery(&GetViewFrame()->GetWindow(), - "DataSourcesUnavailableDialog", - "modules/swriter/ui/datasourcesunavailabledialog.ui"); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewFrame()->GetWindow().GetFrameWeld(), "modules/swriter/ui/datasourcesunavailabledialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DataSourcesUnavailableDialog")); // no cancel allowed - if (RET_OK != aQuery->Execute()) + if (RET_OK != xQuery->run()) return; bCallAddressPilot = true; } @@ -2327,12 +2334,11 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) OUString sSource; if(!GetWrtShell().IsFieldDataSourceAvailable(sSource)) { - ScopedVclPtrInstance<MessageDialog> aWarning(&GetViewFrame()->GetWindow(), - "WarnDataSourceDialog", - "modules/swriter/ui/warndatasourcedialog.ui"); - OUString sTmp(aWarning->get_primary_text()); - aWarning->set_primary_text(sTmp.replaceFirst("%1", sSource)); - if (RET_OK == aWarning->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewFrame()->GetWindow().GetFrameWeld(), "modules/swriter/ui/warndatasourcedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarning(xBuilder->weld_message_dialog("WarnDataSourceDialog")); + OUString sTmp(xWarning->get_primary_text()); + xWarning->set_primary_text(sTmp.replaceFirst("%1", sSource)); + if (RET_OK == xWarning->run()) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 1bcd1e5c6872..895bf7e2ddab 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -31,6 +31,7 @@ #include <comphelper/scopeguard.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svtools/ehdl.hxx> #include <svl/stritem.hxx> #include <sfx2/dispatch.hxx> @@ -445,8 +446,10 @@ void SwView::HyphenateDocument() // turned on no special area { // I want also in special areas hyphenation - ScopedVclPtrInstance< MessageDialog > aBox(&GetEditWin(), SwResId(STR_QUERY_SPECIAL_FORCED), VclMessageType::Question, VclButtonsType::YesNo); - if( aBox->Execute() == RET_YES ) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_SPECIAL_FORCED))); + if (xBox->run() == RET_YES) { bOther = true; if (xProp.is()) diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index fc2f4645235f..9c4b94c53c2b 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -23,7 +23,7 @@ #include <sfx2/request.hxx> #include <sfx2/progress.hxx> #include <sfx2/app.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/oldprintadaptor.hxx> #include <sfx2/printer.hxx> #include <sfx2/prnmon.hxx> @@ -176,10 +176,12 @@ void SwView::ExecutePrint(SfxRequest& rReq) } else { - ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetEditWin(), SwResId(STR_ERR_NO_FAX), VclMessageType::Info); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERR_NO_FAX))); const char* pResId = bWeb ? STR_WEBOPTIONS : STR_TEXTOPTIONS; - aInfoBox->set_primary_text(aInfoBox->get_primary_text().replaceFirst("%1", SwResId(pResId))); - aInfoBox->Execute(); + xInfoBox->set_primary_text(xInfoBox->get_primary_text().replaceFirst("%1", SwResId(pResId))); + xInfoBox->run(); SfxUInt16Item aDefPage(SID_SW_EDITOPTIONS, TP_OPTPRINT_PAGE); GetViewFrame()->GetDispatcher()->ExecuteList(SID_SW_EDITOPTIONS, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, @@ -201,9 +203,9 @@ void SwView::ExecutePrint(SfxRequest& rReq) if(!bSilent && !bFromMerge && SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc()) { - ScopedVclPtrInstance<MessageDialog> aBox(&GetEditWin(), "PrintMergeDialog", - "modules/swriter/ui/printmergedialog.ui"); - short nRet = aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetEditWin().GetFrameWeld(), "modules/swriter/ui/printmergedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("PrintMergeDialog")); + short nRet = xBox->run(); if(RET_NO != nRet) { if(RET_YES == nRet) diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index b68b4b77df00..697adae10c90 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1782,12 +1782,12 @@ void SwWrtShell::ChangeHeaderOrFooter( //Actions have to be closed while the dialog is showing EndAllAction(); - vcl::Window* pParent = &GetView().GetViewFrame()->GetWindow(); + weld::Window* pParent = GetView().GetViewFrame()->GetWindow().GetFrameWeld(); short nResult; if (bHeader) { - nResult = ScopedVclPtrInstance<DeleteHeaderDialog>(pParent)->Execute(); + nResult = DeleteHeaderDialog(pParent).run(); } else { - nResult = ScopedVclPtrInstance<DeleteFooterDialog>(pParent)->Execute(); + nResult = DeleteFooterDialog(pParent).run(); } bExecute = nResult == RET_YES; diff --git a/sw/uiconfig/swriter/ui/asksearchdialog.ui b/sw/uiconfig/swriter/ui/asksearchdialog.ui index acde35107de1..269c6a84da44 100644 --- a/sw/uiconfig/swriter/ui/asksearchdialog.ui +++ b/sw/uiconfig/swriter/ui/asksearchdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="AskSearchDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -18,7 +17,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> <child> <object class="GtkButton" id="no"> <property name="label">gtk-no</property> @@ -76,9 +74,9 @@ </object> </child> <action-widgets> - <action-widget response="3">no</action-widget> - <action-widget response="2">yes</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/sw/uiconfig/swriter/ui/cannotsavelabeldialog.ui b/sw/uiconfig/swriter/ui/cannotsavelabeldialog.ui index bce632b6d45e..8f380c58781c 100644 --- a/sw/uiconfig/swriter/ui/cannotsavelabeldialog.ui +++ b/sw/uiconfig/swriter/ui/cannotsavelabeldialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="CannotSaveLabelDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="cannotsavelabeldialog|CannotSaveLabelDialog">Cannot Add Label</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> diff --git a/sw/uiconfig/swriter/ui/datasourcesunavailabledialog.ui b/sw/uiconfig/swriter/ui/datasourcesunavailabledialog.ui index 378d919ee2cc..65ecd8eb333e 100644 --- a/sw/uiconfig/swriter/ui/datasourcesunavailabledialog.ui +++ b/sw/uiconfig/swriter/ui/datasourcesunavailabledialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="DataSourcesUnavailableDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="datasourcesunavailabledialog|DataSourcesUnavailableDialog">Create a New Data Source?</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> diff --git a/sw/uiconfig/swriter/ui/infonotfounddialog.ui b/sw/uiconfig/swriter/ui/infonotfounddialog.ui index d72fa13ea00a..a1a0518c2d8f 100644 --- a/sw/uiconfig/swriter/ui/infonotfounddialog.ui +++ b/sw/uiconfig/swriter/ui/infonotfounddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="InfoNotFoundDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="infonotfounddialog|InfoNotFoundDialog">Find</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -19,7 +18,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> diff --git a/sw/uiconfig/swriter/ui/inforeadonlydialog.ui b/sw/uiconfig/swriter/ui/inforeadonlydialog.ui index e4aa997f110f..533a982bff59 100644 --- a/sw/uiconfig/swriter/ui/inforeadonlydialog.ui +++ b/sw/uiconfig/swriter/ui/inforeadonlydialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="InfoReadonlyDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="inforeadonlydialog|InfoReadonlyDialog">Read-Only Content</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> diff --git a/sw/uiconfig/swriter/ui/printmergedialog.ui b/sw/uiconfig/swriter/ui/printmergedialog.ui index 8a4a29aa0fcd..913821aee475 100644 --- a/sw/uiconfig/swriter/ui/printmergedialog.ui +++ b/sw/uiconfig/swriter/ui/printmergedialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="PrintMergeDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -18,7 +17,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> <child> <object class="GtkButton" id="yes"> <property name="label">gtk-yes</property> @@ -76,9 +74,9 @@ </object> </child> <action-widgets> - <action-widget response="2">yes</action-widget> - <action-widget response="3">no</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-8">yes</action-widget> + <action-widget response="-9">no</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/sw/uiconfig/swriter/ui/querycontinuebegindialog.ui b/sw/uiconfig/swriter/ui/querycontinuebegindialog.ui index 290e8364978c..00f690f3c142 100644 --- a/sw/uiconfig/swriter/ui/querycontinuebegindialog.ui +++ b/sw/uiconfig/swriter/ui/querycontinuebegindialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryContinueBeginDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querycontinuebegindialog|QueryContinueBeginDialog">Continue at the beginning?</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> diff --git a/sw/uiconfig/swriter/ui/querycontinueenddialog.ui b/sw/uiconfig/swriter/ui/querycontinueenddialog.ui index 590bab521aed..f7abfce69428 100644 --- a/sw/uiconfig/swriter/ui/querycontinueenddialog.ui +++ b/sw/uiconfig/swriter/ui/querycontinueenddialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryContinueEndDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querycontinueenddialog|QueryContinueEndDialog">Continue at the end?</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> diff --git a/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui b/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui index 953172780740..ea12aa245314 100644 --- a/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui +++ b/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="QueryDefaultCompatDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querydefaultcompatdialog|QueryDefaultCompatDialog">Use as default?</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> diff --git a/sw/uiconfig/swriter/ui/queryrotateintostandarddialog.ui b/sw/uiconfig/swriter/ui/queryrotateintostandarddialog.ui index 85c4c9d588f9..91b60e353ff3 100644 --- a/sw/uiconfig/swriter/ui/queryrotateintostandarddialog.ui +++ b/sw/uiconfig/swriter/ui/queryrotateintostandarddialog.ui @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryRotateIntoStandardOrientationDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> - <property name="title" translatable="yes" context="queryrotateintostandarddialog|QueryRotateIntoStandardOrientationDialog">Rotate into standard orientation?</property> + <property name="title" translatable="yes" context="queryrotateintostandarddialog|QueryRotateIntoStandardOrientationDialog">Rotate into standard orientation?`</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -20,8 +19,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area4"> <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="layout_style">center</property> </object> <packing> <property name="expand">False</property> diff --git a/sw/uiconfig/swriter/ui/querysavelabeldialog.ui b/sw/uiconfig/swriter/ui/querysavelabeldialog.ui index b0b829cc7444..201344055d07 100644 --- a/sw/uiconfig/swriter/ui/querysavelabeldialog.ui +++ b/sw/uiconfig/swriter/ui/querysavelabeldialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="QuerySaveLabelDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="querysavelabeldialog|QuerySaveLabelDialog">Save label?</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> diff --git a/sw/uiconfig/swriter/ui/queryshowchangesdialog.ui b/sw/uiconfig/swriter/ui/queryshowchangesdialog.ui index 9fb6638d686b..65416f8ac60d 100644 --- a/sw/uiconfig/swriter/ui/queryshowchangesdialog.ui +++ b/sw/uiconfig/swriter/ui/queryshowchangesdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryShowChangesDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="queryshowchangesdialog|QueryShowChangesDialog">Show changes?</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> diff --git a/sw/uiconfig/swriter/ui/saveashtmldialog.ui b/sw/uiconfig/swriter/ui/saveashtmldialog.ui index 61655b95a96f..dfd49cea621f 100644 --- a/sw/uiconfig/swriter/ui/saveashtmldialog.ui +++ b/sw/uiconfig/swriter/ui/saveashtmldialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="SaveAsHTMLDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="saveashtmldialog|SaveAsHTMLDialog">Save as HTML?</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> diff --git a/sw/uiconfig/swriter/ui/warndatasourcedialog.ui b/sw/uiconfig/swriter/ui/warndatasourcedialog.ui index 97919f266e9d..a98b68fbe878 100644 --- a/sw/uiconfig/swriter/ui/warndatasourcedialog.ui +++ b/sw/uiconfig/swriter/ui/warndatasourcedialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="WarnDataSourceDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="warndatasourcedialog|WarnDataSourceDialog">Data Source Not Found</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> @@ -20,7 +19,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> <child> <object class="GtkButton" id="check"> <property name="label" translatable="yes" context="warndatasourcedialog|check">Check Connection Settings...</property> @@ -63,8 +61,8 @@ </object> </child> <action-widgets> - <action-widget response="1">check</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-5">check</action-widget> + <action-widget response="-6">cancel</action-widget> </action-widgets> </object> </interface> diff --git a/sw/uiconfig/swriter/ui/warnemaildialog.ui b/sw/uiconfig/swriter/ui/warnemaildialog.ui index fb5234175815..fc62f59d7ebd 100644 --- a/sw/uiconfig/swriter/ui/warnemaildialog.ui +++ b/sw/uiconfig/swriter/ui/warnemaildialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.6"/> <object class="GtkMessageDialog" id="WarnEmailDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="warnemaildialog|WarnEmailDialog">E-Mails could not be sent</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> diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx index 6ceaa7315dc0..42d4a053bd95 100644 --- a/uui/source/masterpasscrtdlg.cxx +++ b/uui/source/masterpasscrtdlg.cxx @@ -19,7 +19,8 @@ #include <sal/macros.h> #include <unotools/resmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <strings.hrc> #include "masterpasscrtdlg.hxx" @@ -39,8 +40,10 @@ IMPL_LINK_NOARG(MasterPasswordCreateDialog, OKHdl_Impl, Button*, void) else { OUString aErrorMsg(Translate::get(STR_ERROR_PASSWORDS_NOT_IDENTICAL, rResLocale)); - ScopedVclPtrInstance< MessageDialog > aErrorBox(this, aErrorMsg); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aErrorMsg)); + xErrorBox->run(); m_pEDMasterPasswordCrt->SetText( OUString() ); m_pEDMasterPasswordRepeat->SetText( OUString() ); m_pEDMasterPasswordCrt->GrabFocus(); diff --git a/uui/source/masterpassworddlg.cxx b/uui/source/masterpassworddlg.cxx index 7f860bfe81ef..f743db94f327 100644 --- a/uui/source/masterpassworddlg.cxx +++ b/uui/source/masterpassworddlg.cxx @@ -18,7 +18,8 @@ */ #include <unotools/resmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <strings.hrc> #include "masterpassworddlg.hxx" @@ -46,8 +47,9 @@ MasterPasswordDialog::MasterPasswordDialog if( nDialogMode == css::task::PasswordRequestMode_PASSWORD_REENTER ) { OUString aErrorMsg(Translate::get(STR_ERROR_MASTERPASSWORD_WRONG, rResLocale)); - ScopedVclPtrInstance< MessageDialog > aErrorBox(pParent, aErrorMsg); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aErrorMsg)); + xErrorBox->run(); } m_pOKBtn->SetClickHdl( LINK( this, MasterPasswordDialog, OKHdl_Impl ) ); diff --git a/uui/source/nameclashdlg.cxx b/uui/source/nameclashdlg.cxx index 8426086abbb8..9403c21af606 100644 --- a/uui/source/nameclashdlg.cxx +++ b/uui/source/nameclashdlg.cxx @@ -19,7 +19,8 @@ #include <osl/file.hxx> #include <unotools/resmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <strings.hrc> #include "nameclashdlg.hxx" @@ -35,8 +36,10 @@ IMPL_LINK( NameClashDialog, ButtonHdl_Impl, Button *, pBtn, void ) OUString aNewName = m_pEDNewName->GetText(); if ( ( aNewName == maNewName ) || aNewName.isEmpty() ) { - ScopedVclPtrInstance< MessageDialog > aError(nullptr, maSameName); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + maSameName)); + xErrorBox->run(); return; } maNewName = aNewName; diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx index 1c1899b5657d..eec9540de9a8 100644 --- a/uui/source/passworddlg.cxx +++ b/uui/source/passworddlg.cxx @@ -22,7 +22,8 @@ #include <unotools/resmgr.hxx> #include <tools/urlobj.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> using namespace ::com::sun::star; @@ -46,8 +47,9 @@ PasswordDialog::PasswordDialog(vcl::Window* _pParent, const char* pOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG; const char* pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : pOpenToModifyErrStrId; OUString aErrorMsg(Translate::get(pErrStrId, rResLocale)); - ScopedVclPtrInstance< MessageDialog > aErrorBox(GetParent(), aErrorMsg); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(_pParent ? _pParent->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aErrorMsg)); + xBox->run(); } // default settings for enter password or reenter passwd... @@ -112,8 +114,10 @@ IMPL_LINK_NOARG(PasswordDialog, OKHdl_Impl, Button*, void) if (m_pEDConfirmPassword->IsVisible() && bPasswdMismatch) { - ScopedVclPtrInstance< MessageDialog > aErrorBox(this, aPasswdMismatch); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aPasswdMismatch)); + xBox->run(); } else if (bValid) EndDialog( RET_OK ); diff --git a/uui/source/sslwarndlg.hxx b/uui/source/sslwarndlg.hxx index 42aa51026146..2c0a992dcc2d 100644 --- a/uui/source/sslwarndlg.hxx +++ b/uui/source/sslwarndlg.hxx @@ -21,7 +21,7 @@ #include <vcl/fixed.hxx> #include <vcl/button.hxx> -#include <vcl/layout.hxx> +#include <vcl/messagedialog.hxx> #include <com/sun/star/security/XCertificate.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/uno/XComponentContext.hpp> diff --git a/uui/source/unknownauthdlg.hxx b/uui/source/unknownauthdlg.hxx index ad87b7579784..9c9274ef83f9 100644 --- a/uui/source/unknownauthdlg.hxx +++ b/uui/source/unknownauthdlg.hxx @@ -20,7 +20,7 @@ #define INCLUDED_UUI_SOURCE_UNKNOWNAUTHDLG_HXX #include <vcl/button.hxx> -#include <vcl/layout.hxx> +#include <vcl/messagedialog.hxx> #include <com/sun/star/security/XCertificate.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/uno/XComponentContext.hpp> diff --git a/uui/uiconfig/ui/sslwarndialog.ui b/uui/uiconfig/ui/sslwarndialog.ui index 2a3d857816a3..9770d75e74d0 100644 --- a/uui/uiconfig/ui/sslwarndialog.ui +++ b/uui/uiconfig/ui/sslwarndialog.ui @@ -73,8 +73,8 @@ </object> </child> <action-widgets> - <action-widget response="1">ok</action-widget> - <action-widget response="0">cancel</action-widget> + <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> <action-widget response="101">view</action-widget> </action-widgets> </object> diff --git a/uui/uiconfig/ui/unknownauthdialog.ui b/uui/uiconfig/ui/unknownauthdialog.ui index 9988e57b9e13..2e59c41a6859 100644 --- a/uui/uiconfig/ui/unknownauthdialog.ui +++ b/uui/uiconfig/ui/unknownauthdialog.ui @@ -131,9 +131,9 @@ </object> </child> <action-widgets> - <action-widget response="1">ok</action-widget> - <action-widget response="0">cancel</action-widget> - <action-widget response="10">help</action-widget> + <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> + <action-widget response="-11">help</action-widget> </action-widgets> </object> </interface> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index d2bef1fe030a..77a3df7d6ed7 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -28,6 +28,7 @@ #include <salobj.hxx> #include <salmenu.hxx> #include <svdata.hxx> +#include <vcl/messagedialog.hxx> #include <vcl/builder.hxx> #include <vcl/combobox.hxx> #include <vcl/lstbox.hxx> @@ -236,11 +237,16 @@ public: return m_xWidget->get_preferred_size(); } - virtual float approximate_char_width() const override + virtual float get_approximate_char_width() const override { return m_xWidget->approximate_char_width(); } + virtual int get_text_height() const override + { + return m_xWidget->GetTextHeight(); + } + virtual Size get_pixel_size(const OUString& rText) const override { //TODO, or do I want GetTextBoundRect ?, just using width at the moment anyway diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx index 2e549e539db4..dbd6a0f5b82c 100644 --- a/vcl/source/app/stdtext.cxx +++ b/vcl/source/app/stdtext.cxx @@ -17,18 +17,19 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/layout.hxx> #include <vcl/stdtext.hxx> +#include <vcl/weld.hxx> #include <strings.hrc> #include <svdata.hxx> -void ShowServiceNotAvailableError(vcl::Window* pParent, +void ShowServiceNotAvailableError(weld::Widget* pParent, const OUString& rServiceName, bool bError) { OUString aText = VclResId(SV_STDTEXT_SERVICENOTAVAILABLE).replaceAll("%s", rServiceName); - ScopedVclPtrInstance< MessageDialog > aBox( pParent, aText, bError ? VclMessageType::Error : VclMessageType::Warning ); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + bError ? VclMessageType::Error : VclMessageType::Warning, VclButtonsType::Ok, aText)); + xBox->run(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 1d011da56520..c11b78ff6bf8 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -26,7 +26,7 @@ #include <vcl/virdev.hxx> #include <vcl/menu.hxx> #include <vcl/edit.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/uitest/uiobject.hxx> @@ -777,10 +777,11 @@ uno::Reference < i18n::XExtendedInputSequenceChecker > const & Edit::ImplGetInpu return mxISC; } -void Edit::ShowTruncationWarning( vcl::Window* pParent ) +void Edit::ShowTruncationWarning(weld::Widget* pParent) { - ScopedVclPtrInstance< MessageDialog > aBox(pParent, VclResId(SV_EDIT_WARNING_STR), VclMessageType::Warning); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, + VclButtonsType::Ok, VclResId(SV_EDIT_WARNING_STR))); + xBox->run(); } bool Edit::ImplTruncateToMaxLen( OUString& rStr, sal_Int32 nSelectionLen ) const @@ -1306,7 +1307,7 @@ void Edit::ImplPaste( uno::Reference< datatransfer::clipboard::XClipboard > cons OUString aText; aData >>= aText; if( ImplTruncateToMaxLen( aText, maSelection.Len() ) ) - ShowTruncationWarning( this ); + ShowTruncationWarning(GetFrameWeld()); ReplaceSelected( aText ); } catch( const css::uno::Exception& ) diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx index 4d0631b85867..49ce74bb502e 100644 --- a/vcl/source/control/fixedhyper.cxx +++ b/vcl/source/control/fixedhyper.cxx @@ -19,7 +19,7 @@ #include <vcl/fixedhyper.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <comphelper/anytostring.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -149,7 +149,7 @@ bool FixedHyperlink::set_property(const OString &rKey, const OUString &rValue) return true; } -IMPL_STATIC_LINK(FixedHyperlink, HandleClick, FixedHyperlink&, rHyperlink, void) +IMPL_LINK(FixedHyperlink, HandleClick, FixedHyperlink&, rHyperlink, void) { if ( rHyperlink.m_sURL.isEmpty() ) // Nothing to do, when the URL is empty return; @@ -165,10 +165,10 @@ IMPL_STATIC_LINK(FixedHyperlink, HandleClick, FixedHyperlink&, rHyperlink, void) { uno::Any exc(cppu::getCaughtException()); OUString msg(comphelper::anyToString(exc)); - const SolarMutexGuard guard; - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg); - aErrorBox->SetText( rHyperlink.GetText() ); - aErrorBox->Execute(); + SolarMutexGuard g; + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Error, VclButtonsType::Ok, msg)); + xErrorBox->set_title(rHyperlink.GetText()); + xErrorBox->run(); } } diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 0d063ae1e091..901110ab4b8c 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -30,6 +30,7 @@ #include <svl/undo.hxx> #include <vcl/cursor.hxx> +#include <vcl/weld.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <tools/stream.hxx> @@ -1078,7 +1079,7 @@ void TextView::Paste( css::uno::Reference< css::datatransfer::clipboard::XClipbo mpImpl->mpTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) ); if( bWasTruncated ) - Edit::ShowTruncationWarning( mpImpl->mpWindow ); + Edit::ShowTruncationWarning(mpImpl->mpWindow->GetFrameWeld()); } catch( const css::datatransfer::UnsupportedFlavorException& ) { diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 938dca6dd7dc..f8a34049fb0d 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.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 <vcl/print.hxx> #include <vcl/svapp.hxx> #include <vcl/metaact.hxx> @@ -305,10 +305,10 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if (xController->isShowDialogs()) { - ScopedVclPtrInstance<MessageDialog> aBox( - xController->getWindow(), "ErrorNoPrinterDialog", - "vcl/ui/errornoprinterdialog.ui"); - aBox->Execute(); + VclPtr<vcl::Window> xParent = xController->getWindow(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(xParent ? xParent->GetFrameWeld() : nullptr, "vcl/ui/errornoprinterdialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("ErrorNoPrinterDialog")); + xBox->run(); } xController->setValue( "IsDirect", css::uno::makeAny( false ) ); @@ -456,10 +456,10 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if( xController->getFilteredPageCount() == 0 ) { - ScopedVclPtrInstance<MessageDialog> aBox( - xController->getWindow(), "ErrorNoContentDialog", - "vcl/ui/errornocontentdialog.ui"); - aBox->Execute(); + VclPtr<vcl::Window> xParent = xController->getWindow(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(xParent ? xParent->GetFrameWeld() : nullptr, "vcl/ui/errornocontentdialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("ErrorNoContentDialog")); + xBox->run(); return false; } } diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index c6d345434bc6..1fac71679e85 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -43,6 +43,7 @@ #include <vcl/commandinfoprovider.hxx> #include <svdata.hxx> #include <bitmaps.hlst> +#include <vcl/messagedialog.hxx> #include <window.h> #include <xmlreader/xmlreader.hxx> #include <desktop/crashreport.hxx> @@ -172,7 +173,7 @@ namespace weld m_xSpinButton->get_range(min, max); auto width = std::max(m_xSpinButton->get_pixel_size(format_number(min)).Width(), m_xSpinButton->get_pixel_size(format_number(max)).Width()); - int chars = ceil(width / m_xSpinButton->approximate_char_width()); + int chars = ceil(width / m_xSpinButton->get_approximate_char_width()); m_xSpinButton->set_width_chars(chars); } @@ -1314,6 +1315,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & if (extractResizable(rMap)) nBits |= WB_SIZEABLE; xWindow = VclPtr<MessageDialog>::Create(pParent, nBits); + xWindow->set_border_width(12); } else if (name == "GtkBox") { diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index cdad91241c35..9ba5d57da2d4 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -56,6 +56,7 @@ #include <vcl/uitest/logger.hxx> #include <vcl/virdev.hxx> #include <vcl/IDialogRenderable.hxx> +#include <vcl/messagedialog.hxx> #include <salframe.hxx> #include <iostream> diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 0b0eb098f0c7..69c492b28e70 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -15,6 +15,7 @@ #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/messagedialog.hxx> #include <window.h> #include <boost/multi_array.hpp> #include <officecfg/Office/Common.hxx> diff --git a/vcl/uiconfig/ui/errornocontentdialog.ui b/vcl/uiconfig/ui/errornocontentdialog.ui index 9dca59ed8f19..0dd24555a756 100644 --- a/vcl/uiconfig/ui/errornocontentdialog.ui +++ b/vcl/uiconfig/ui/errornocontentdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="vcl"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="ErrorNoContentDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="errornocontentdialog|ErrorNoContentDialog">%PRODUCTNAME</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> diff --git a/vcl/uiconfig/ui/errornoprinterdialog.ui b/vcl/uiconfig/ui/errornoprinterdialog.ui index 9032b011bccf..f3a4c43b4201 100644 --- a/vcl/uiconfig/ui/errornoprinterdialog.ui +++ b/vcl/uiconfig/ui/errornoprinterdialog.ui @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="vcl"> <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="ErrorNoPrinterDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="title" translatable="yes" context="errornoprinterdialog|ErrorNoPrinterDialog">%PRODUCTNAME</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> @@ -32,5 +30,8 @@ </child> </object> </child> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 5777a4d4d838..6a1a2f77c279 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1232,7 +1232,7 @@ public: return Size(size.width, size.height); } - virtual float approximate_char_width() const override + virtual float get_approximate_char_width() const override { PangoContext* pContext = gtk_widget_get_pango_context(m_pWidget); PangoFontMetrics* pMetrics = pango_context_get_metrics(pContext, @@ -1245,6 +1245,17 @@ public: return std::max(nCharWidth, nDigitWidth) / PANGO_SCALE; } + virtual int get_text_height() const override + { + PangoContext* pContext = gtk_widget_get_pango_context(m_pWidget); + PangoFontMetrics* pMetrics = pango_context_get_metrics(pContext, + pango_context_get_font_description(pContext), + pango_context_get_language(pContext)); + int nLineHeight = pango_font_metrics_get_ascent(pMetrics) + pango_font_metrics_get_descent(pMetrics); + pango_font_metrics_unref(pMetrics); + return nLineHeight / PANGO_SCALE; + } + virtual Size get_pixel_size(const OUString& rText) const override { OString aStr(OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); @@ -1375,6 +1386,10 @@ public: ret = RET_OK; else if (ret == GTK_RESPONSE_CANCEL) ret = RET_CANCEL; + else if (ret == GTK_RESPONSE_YES) + ret = RET_YES; + else if (ret == GTK_RESPONSE_NO) + ret = RET_NO; break; } hide(); @@ -1387,6 +1402,10 @@ public: nResponse = GTK_RESPONSE_OK; else if (nResponse == RET_CANCEL) nResponse = GTK_RESPONSE_CANCEL; + else if (nResponse == RET_YES) + nResponse = GTK_RESPONSE_YES; + else if (nResponse == RET_NO) + nResponse = GTK_RESPONSE_NO; else if (nResponse == RET_HELP) nResponse = GTK_RESPONSE_HELP; gtk_dialog_response(m_pDialog, nResponse); diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index af32a2433760..2978bd133522 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/ucb/Command.hpp> #include <com/sun/star/uno/SecurityException.hpp> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <unotools/securityoptions.hxx> #include <com/sun/star/security/CertificateValidity.hpp> #include <comphelper/documentconstants.hxx> @@ -343,8 +343,10 @@ bool DocumentDigitalSignatures::ImplViewSignatures( } else { - ScopedVclPtrInstance< MessageDialog > aBox(nullptr, XsResId(RID_XMLSECWB_NO_MOZILLA_PROFILE), VclMessageType::Warning); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + XsResId(RID_XMLSECWB_NO_MOZILLA_PROFILE))); + xBox->run(); } return bChanges; diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 4526786c4cc0..db47daff47db 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -52,8 +52,8 @@ #include <strings.hrc> #include <resourcemanager.hxx> -#include <vcl/layout.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <unotools/configitem.hxx> #include <comphelper/storagehelper.hxx> @@ -281,8 +281,10 @@ bool DigitalSignaturesDialog::canAddRemove() if ( (!bSave1_1 && bDoc1_1) || (bSave1_1 && bDoc1_1) ) { //#4 - ScopedVclPtrInstance< MessageDialog > err(nullptr, XsResId(STR_XMLSECDLG_OLD_ODF_FORMAT)); - err->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + XsResId(STR_XMLSECDLG_OLD_ODF_FORMAT))); + xBox->run(); ret = false; } @@ -299,8 +301,10 @@ bool DigitalSignaturesDialog::canAddRemove() //It the user presses 'Add' or 'Remove' several times then, then the warning //is shown every time until the user presses 'OK'. From then on, the warning //is not displayed anymore as long as the signatures dialog is alive. - if (ScopedVclPtrInstance<MessageDialog>( - nullptr, XsResId(STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_NO) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + XsResId(STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN))); + if (xBox->run() == RET_NO) ret = false; else m_bWarningShowSignMacro = true; @@ -321,8 +325,10 @@ bool DigitalSignaturesDialog::canRemove() if ( maSignatureManager.meSignatureMode == DocumentSignatureMode::Content ) { - short nDlgRet = ScopedVclPtrInstance<MessageDialog>( - nullptr, XsResId(STR_XMLSECDLG_QUERY_REALLYREMOVE), VclMessageType::Question, VclButtonsType::YesNo)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + XsResId(STR_XMLSECDLG_QUERY_REALLYREMOVE))); + short nDlgRet = xBox->run(); bRet = ( nDlgRet == RET_YES ); } |