From be8a02364c82df5252a1ced49db29f855c85677a Mon Sep 17 00:00:00 2001 From: Philippe Jung Date: Tue, 26 May 2015 16:26:35 +0200 Subject: Rewrite all calls like Dialog(params).Execute() Replace all calls looking like ADialog(some params).Execute() by ScopedVclPtrInstance::Create(some parms)->Execute() Change-Id: I0b6f0a9ea5ef0a749ffa30ce131e9dc989604639 Reviewed-on: https://gerrit.libreoffice.org/15915 Tested-by: Jenkins Tested-by: Michael Meeks Reviewed-by: Michael Meeks --- sfx2/source/appl/appserv.cxx | 2 +- sfx2/source/appl/lnkbase2.cxx | 2 +- sfx2/source/dialog/dinfdlg.cxx | 2 +- sfx2/source/dialog/newstyle.cxx | 2 +- sfx2/source/doc/objserv.cxx | 12 ++++++------ sfx2/source/doc/templatedlg.cxx | 18 +++++++++--------- sfx2/source/view/viewprn.cxx | 8 ++++---- 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index b60da280bf12..40c80143dc92 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1258,7 +1258,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) SvtModuleOptions aModuleOpt; if ( !aModuleOpt.IsImpress() ) { - MessageDialog( 0, SFX2_RESSTR( STR_MODULENOTINSTALLED )).Execute(); + ScopedVclPtrInstance::Create( nullptr, SFX2_RESSTR( STR_MODULENOTINSTALLED ))->Execute(); return; } diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index 3c899b35c91e..ac35800f3d99 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -545,7 +545,7 @@ bool SvBaseLink::ExecuteEdit( const OUString& _rNewName ) else return false; - MessageDialog(pImpl->m_pParentWin, sError).Execute(); + ScopedVclPtrInstance::Create(pImpl->m_pParentWin, sError)->Execute(); } } else if( !pImpl->m_bIsConnect ) diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index bda4806c4c89..0e47101b7385 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1652,7 +1652,7 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr if ( bIsFromTypeBox ) // LoseFocus of TypeBox pLine->m_bTypeLostFocus = true; vcl::Window* pParent = GetParent()->GetParent(); - if (MessageDialog(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL).Execute() == RET_OK) + if (ScopedVclPtrInstance::Create(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL)->Execute() == RET_OK) pLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast(CUSTOM_TYPE_TEXT) ) ); else pLine->m_aValueEdit->GrabFocus(); diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index 0824e3d3c09d..464d12a6a5b3 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -37,7 +37,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl ) { if ( !pStyle->IsUserDefined() ) { - MessageDialog( this, SfxResId( STR_POOL_STYLE_NAME ), VCL_MESSAGE_INFO ).Execute(); + ScopedVclPtrInstance::Create( this, SfxResId( STR_POOL_STYLE_NAME ), VCL_MESSAGE_INFO )->Execute(); return 0; } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index f4ba28b17d79..f35c470dbaed 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -872,7 +872,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } case SID_CANCELCHECKOUT: { - if (MessageDialog(NULL, SfxResId(STR_QUERY_CANCELCHECKOUT), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() == RET_YES) + if (ScopedVclPtrInstance::Create(nullptr, SfxResId(STR_QUERY_CANCELCHECKOUT), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() == RET_YES) { CancelCheckOut( ); @@ -1398,7 +1398,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) ) { // Only OASIS and OOo6.x formats will be handled further - MessageDialog( NULL, SfxResId( STR_INFO_WRONGDOCFORMAT ), VCL_MESSAGE_INFO ).Execute(); + ScopedVclPtrInstance::Create( nullptr, SfxResId( STR_INFO_WRONGDOCFORMAT ), VCL_MESSAGE_INFO )->Execute(); return; } @@ -1432,8 +1432,8 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) if ( nVersion >= SvtSaveOptions::ODFVER_012 ) { - if ( (bHasSign && MessageDialog(NULL, SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() == RET_YES) - || (!bHasSign && MessageDialog(NULL, SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() == RET_YES) ) + if ( (bHasSign && ScopedVclPtrInstance::Create(nullptr, SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() == RET_YES) + || (!bHasSign && ScopedVclPtrInstance::Create(nullptr, SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() == RET_YES) ) { sal_uInt16 nId = SID_SAVEDOC; if ( !GetMedium() || GetMedium()->GetName().isEmpty() ) @@ -1449,7 +1449,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) || SotStorage::GetVersion( GetMedium()->GetStorage() ) <= SOFFICE_FILEFORMAT_60 ) ) { // Only OASIS format will be handled further - MessageDialog( NULL, SfxResId( STR_INFO_WRONGDOCFORMAT ), VCL_MESSAGE_INFO ).Execute(); + ScopedVclPtrInstance::Create( nullptr, SfxResId( STR_INFO_WRONGDOCFORMAT ), VCL_MESSAGE_INFO )->Execute(); return; } } @@ -1464,7 +1464,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) } else { - MessageDialog(NULL, SfxResId(STR_XMLSEC_ODF12_EXPECTED)).Execute(); + ScopedVclPtrInstance::Create(nullptr, SfxResId(STR_XMLSEC_ODF12_EXPECTED))->Execute(); return; } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index d86ffc0b09fe..4b1952f813ae 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -942,7 +942,7 @@ void SfxTemplateManagerDlg::OnTemplateImport () { OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString()); aMsg = aMsg.replaceFirst("$1",pFolder->maTitle); - MessageDialog(this, aMsg.replaceFirst("$2",aTemplateList)).Execute(); + ScopedVclPtrInstance::Create(this, aMsg.replaceFirst("$2",aTemplateList))->Execute(); } } } @@ -965,7 +965,7 @@ void SfxTemplateManagerDlg::OnTemplateImport () { OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString()); aMsg = aMsg.replaceFirst("$1",mpLocalView->getCurRegionName()); - MessageDialog(this, aMsg.replaceFirst("$2",aTemplateList)).Execute(); + ScopedVclPtrInstance::Create(this, aMsg.replaceFirst("$2",aTemplateList))->Execute(); } } @@ -1054,7 +1054,7 @@ void SfxTemplateManagerDlg::OnTemplateExport() if (!aTemplateList.isEmpty()) { OUString aText( SfxResId(STR_MSG_ERROR_EXPORT).toString() ); - MessageDialog(this, aText.replaceFirst("$1",aTemplateList)).Execute(); + ScopedVclPtrInstance::Create(this, aText.replaceFirst("$1",aTemplateList))->Execute(); } } } @@ -1216,7 +1216,7 @@ void SfxTemplateManagerDlg::OnTemplateDelete () if (!aTemplateList.isEmpty()) { OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_TEMPLATE).toString() ); - MessageDialog(this, aMsg.replaceFirst("$1",aTemplateList)).Execute(); + ScopedVclPtrInstance::Create(this, aMsg.replaceFirst("$1",aTemplateList))->Execute(); } } @@ -1280,7 +1280,7 @@ void SfxTemplateManagerDlg::OnFolderDelete() if (!aFolderList.isEmpty()) { OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() ); - MessageDialog(this, aMsg.replaceFirst("$1",aFolderList)).Execute(); + ScopedVclPtrInstance::Create(this, aMsg.replaceFirst("$1",aFolderList))->Execute(); } } @@ -1301,7 +1301,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() if (!mpLocalView->isNonRootRegionVisible() && maSelFolders.empty()) { - MessageDialog(this, SfxResId(STR_MSG_ERROR_SELECT_FOLDER)).Execute(); + ScopedVclPtrInstance::Create(this, SfxResId(STR_MSG_ERROR_SELECT_FOLDER))->Execute(); return; } @@ -1480,7 +1480,7 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId) OUString aDst = mpLocalView->getRegionItemName(nItemId); OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString()); aMsg = aMsg.replaceFirst("$1",aDst); - MessageDialog(this, aMsg.replaceFirst( "$2",aTemplateList)).Execute(); + ScopedVclPtrInstance::Create(this, aMsg.replaceFirst( "$2",aTemplateList))->Execute(); } } } @@ -1534,7 +1534,7 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId) OUString aMsg(SfxResId(STR_MSG_ERROR_REMOTE_MOVE).toString()); aMsg = aMsg.replaceFirst("$1",mpRemoteView->getCurRegionName()); aMsg = aMsg.replaceFirst("$2",mpLocalView->getRegionItemName(nItemId)); - MessageDialog(this, aMsg.replaceFirst("$1",aTemplateList)).Execute(); + ScopedVclPtrInstance::Create(this, aMsg.replaceFirst("$1",aTemplateList))->Execute(); } } } @@ -1590,7 +1590,7 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) OUString aDst = mpLocalView->getRegionItemName(nItemId); OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString()); aMsg = aMsg.replaceFirst("$1",aDst); - MessageDialog(this, aMsg.replaceFirst( "$2",aTemplateList)).Execute(); + ScopedVclPtrInstance::Create(this, aMsg.replaceFirst( "$2",aTemplateList))->Execute(); } } diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 5655d61b7a50..3f238fb9d965 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -343,7 +343,7 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt // "real" problem (not simply printing cancelled by user) OUString aMsg( SfxResId(STR_NOSTARTPRINTER).toString() ); if ( !m_bApi ) - MessageDialog(mpViewShell->GetWindow(), aMsg).Execute(); + ScopedVclPtrInstance::Create(mpViewShell->GetWindow(), aMsg)->Execute(); // intentionally no break } case view::PrintableState_JOB_ABORTED : @@ -521,7 +521,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( VclPtr& pNewPrinter ) // Ask if possible, if page format should be taken over from printer. if ( ( bOriChg || bPgSzChg ) && - RET_YES == MessageDialog(NULL, aMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() ) + RET_YES == ScopedVclPtrInstance::Create(nullptr, aMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() ) { // Flags with changes for are maintained nChangedFlags |= nNewOpt; @@ -794,7 +794,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // no valid printer either in ItemSet or at the document if ( !bSilent ) - MessageDialog(NULL, SfxResId(STR_NODEFPRINTER)).Execute(); + ScopedVclPtrInstance::Create(nullptr, SfxResId(STR_NODEFPRINTER))->Execute(); rReq.SetReturnValue(SfxBoolItem(0,false)); @@ -806,7 +806,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // if printer is busy, abort configuration if ( !bSilent ) - MessageDialog(NULL, SfxResId(STR_ERROR_PRINTER_BUSY), VCL_MESSAGE_INFO).Execute(); + ScopedVclPtrInstance::Create(nullptr, SfxResId(STR_ERROR_PRINTER_BUSY), VCL_MESSAGE_INFO)->Execute(); rReq.SetReturnValue(SfxBoolItem(0,false)); return; -- cgit v1.2.3