diff options
-rw-r--r-- | sfx2/source/appl/app.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 21 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/versdlg.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 6 |
7 files changed, 27 insertions, 45 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 848c7a42b5c5..72e2a0f6e48b 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -116,6 +116,7 @@ #include <unotools/extendedsecurityoptions.hxx> #include <rtl/instance.hxx> #include <rtl/strbuf.hxx> +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; @@ -561,8 +562,8 @@ SfxApplication::ChooseScript() const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() ); - AbstractScriptSelectorDialog* pDlg = - pFact->CreateScriptSelectorDialog( NULL, false, xFrame ); + boost::scoped_ptr<AbstractScriptSelectorDialog> pDlg( + pFact->CreateScriptSelectorDialog( NULL, false, xFrame )); SAL_INFO( "sfx.appl", "done, now exec it"); @@ -574,8 +575,6 @@ SfxApplication::ChooseScript() { aScriptURL = pDlg->GetScriptURL(); } - - delete pDlg; } #endif return aScriptURL; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 08adac7eec52..2de745f48211 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -118,6 +118,7 @@ #include <officecfg/Office/Common.hxx> #include <officecfg/Setup.hxx> +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -357,9 +358,9 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if ( pFrameItem ) xFrame = pFrameItem->GetFrame(); - SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateTabDialog( RID_SVXDLG_CUSTOMIZE, - NULL, &aSet, xFrame ); + NULL, &aSet, xFrame )); if ( pDlg ) { @@ -367,8 +368,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) if ( nRet ) bDone = true; - - delete pDlg; } } break; @@ -529,9 +528,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) { - VclAbstractDialog* pDlg = pFact->CreateVclDialog( 0, RID_DEFAULTABOUT ); + boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( 0, RID_DEFAULTABOUT )); pDlg->Execute(); - delete pDlg; bDone = true; } break; @@ -1163,8 +1161,8 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) do // artificial loop for flow control { - AbstractScriptSelectorDialog* pDlg = pFact->CreateScriptSelectorDialog( - lcl_getDialogParent( xFrame, GetTopWindow() ), false, xFrame ); + boost::scoped_ptr<AbstractScriptSelectorDialog> pDlg(pFact->CreateScriptSelectorDialog( + lcl_getDialogParent( xFrame, GetTopWindow() ), false, xFrame )); OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" ); if ( !pDlg ) break; @@ -1172,10 +1170,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) short nDialogResult = pDlg->Execute(); if ( !nDialogResult ) - { - delete pDlg; break; - } Sequence< Any > args; Sequence< sal_Int16 > outIndex; @@ -1193,7 +1188,6 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) xScriptContext = xController; SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs ); - delete pDlg; } while ( false ); rReq.Done(); @@ -1259,9 +1253,8 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), false, &pItem ) == SFX_ITEM_SET ) aSet.Put( *pItem ); - SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL ); + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL )); pDlg->Execute(); - delete pDlg; } break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 3f3e9ada8028..7ba8c7e2cbcf 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -72,6 +72,7 @@ #include <vcl/help.hxx> #include <algorithm> +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -1344,10 +1345,9 @@ CustomPropertiesEditButton::~CustomPropertiesEditButton() IMPL_LINK_NOARG(CustomPropertiesEditButton, ClickHdl) { - DurationDialog_Impl* pDurationDlg = new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() ); + boost::scoped_ptr<DurationDialog_Impl> pDurationDlg(new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() )); if ( RET_OK == pDurationDlg->Execute() ) m_pLine->m_aDurationField.SetDuration( pDurationDlg->GetDuration() ); - delete pDurationDlg; return 1; } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index a2912eae8f29..35565df6ca58 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1903,7 +1903,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) nFilter=pStyleSheetPool->GetSearchMask(); pStyleSheetPool->SetSearchMask( eFam, SFXSTYLEBIT_USERDEF ); - SfxNewStyleDlg *pDlg = new SfxNewStyleDlg(pWindow, *pStyleSheetPool); + boost::scoped_ptr<SfxNewStyleDlg> pDlg(new SfxNewStyleDlg(pWindow, *pStyleSheetPool)); // why? : FloatingWindow must not be parent of a modal dialog if(RET_OK == pDlg->Execute()) { @@ -1915,7 +1915,6 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) nFilter); } pStyleSheetPool->SetSearchMask( eFam, nFilter ); - delete pDlg; } break; } diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 8902006282af..d1128aa23f1e 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <boost/noncopyable.hpp> +#include <boost/scoped_ptr.hpp> #include <unotools/localedatawrapper.hxx> #include <comphelper/processfactory.hxx> #include <svl/eitem.hxx> @@ -399,7 +400,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) { SfxVersionInfo aInfo; aInfo.aAuthor = SvtUserOptions().GetFullName(); - SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, aInfo, true); + boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, aInfo, true)); short nRet = pDlg->Execute(); if ( nRet == RET_OK ) { @@ -414,8 +415,6 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) Init_Impl(); m_pVersionBox->SetUpdateMode( true ); } - - delete pDlg; } if (pButton == m_pDeleteButton && pEntry) { @@ -433,9 +432,8 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) else if (pButton == m_pViewButton && pEntry) { SfxVersionInfo* pInfo = (SfxVersionInfo*) pEntry->GetUserData(); - SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, *pInfo, false); + boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, *pInfo, false)); pDlg->Execute(); - delete pDlg; } else if (pEntry && pButton == m_pCompareButton) { @@ -457,9 +455,8 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) } else if (pButton == m_pCmisButton) { - SfxCmisVersionsDialog* pDlg = new SfxCmisVersionsDialog(pViewFrame, false); + boost::scoped_ptr<SfxCmisVersionsDialog> pDlg(new SfxCmisVersionsDialog(pViewFrame, false)); pDlg->Execute(); - delete pDlg; } return 0L; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 20395ea87b68..2f87469f572b 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -100,6 +100,7 @@ #include "guisaveas.hxx" #include "templatedlg.hxx" +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -333,9 +334,8 @@ void SfxObjectShell::CheckOut( ) } catch ( const uno::RuntimeException& e ) { - MessageDialog* pErrorBox = new MessageDialog( &GetFrame()->GetWindow(), e.Message ); + boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog( &GetFrame()->GetWindow(), e.Message )); pErrorBox->Execute( ); - delete pErrorBox; } } @@ -352,9 +352,8 @@ void SfxObjectShell::CancelCheckOut( ) } catch ( const uno::RuntimeException& e ) { - MessageDialog* pErrorBox = new MessageDialog(&GetFrame()->GetWindow(), e.Message); + boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message)); pErrorBox->Execute( ); - delete pErrorBox; } } @@ -377,9 +376,8 @@ void SfxObjectShell::CheckIn( ) } catch ( const uno::RuntimeException& e ) { - MessageDialog* pErrorBox = new MessageDialog(&GetFrame()->GetWindow(), e.Message); + boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message)); pErrorBox->Execute( ); - delete pErrorBox; } } @@ -392,9 +390,8 @@ uno::Sequence< document::CmisVersion > SfxObjectShell::GetCmisVersions( ) } catch ( const uno::RuntimeException& e ) { - MessageDialog* pErrorBox = new MessageDialog(&GetFrame()->GetWindow(), e.Message); + boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message)); pErrorBox->Execute( ); - delete pErrorBox; } return uno::Sequence< document::CmisVersion > ( ); } @@ -441,10 +438,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( !IsOwnStorageFormat_Impl( *GetMedium() ) ) return; - SfxVersionDialog *pDlg = new SfxVersionDialog( pFrame, IsSaveVersionOnClose() ); + boost::scoped_ptr<SfxVersionDialog> pDlg(new SfxVersionDialog( pFrame, IsSaveVersionOnClose() )); pDlg->Execute(); SetSaveVersionOnClose( pDlg->IsSaveVersionOnClose() ); - delete pDlg; rReq.Done(); return; } @@ -502,7 +498,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // creating dialog is done via virtual method; application will // add its own statistics page - SfxDocumentInfoDialog *pDlg = CreateDocumentInfoDialog(0, aSet); + boost::scoped_ptr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(0, aSet)); if ( RET_OK == pDlg->Execute() ) { SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pDocInfoItem, SfxDocumentInfoItem, SID_DOCINFO, false); @@ -525,8 +521,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) else // nothing done; no recording rReq.Ignore(); - - delete pDlg; } return; diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 362c8199e5d4..56ac2e64e931 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -46,6 +46,7 @@ #include <sfx2/docfilt.hxx> #include <toolkit/awt/vclxdevice.hxx> +#include <boost/scoped_ptr.hpp> #include "view.hrc" #include "helpid.hrc" @@ -453,8 +454,8 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute) return 0; // Create Dialog - SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( static_cast<Window*>(_pSetupParent), - _pViewSh, _pOptions ); + boost::scoped_ptr<SfxPrintOptionsDialog> pDlg(new SfxPrintOptionsDialog( static_cast<Window*>(_pSetupParent), + _pViewSh, _pOptions )); if ( _bHelpDisabled ) pDlg->DisableHelp(); if ( pDlg->Execute() == RET_OK ) @@ -463,7 +464,6 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute) _pOptions = pDlg->GetOptions().Clone(); } - delete pDlg; return 0; } |