diff options
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob1.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/scuiautofmt.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/tphf.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/tphfedit.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/filtuno.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh3.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshf.cxx | 5 |
10 files changed, 37 insertions, 46 deletions
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 38ce5bef4883..f0ed72efa5fb 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -76,6 +76,8 @@ #define ScDrawTextObjectBar #include "scslots.hxx" +#include <boost/scoped_ptr.hpp> + using namespace ::com::sun::star; SFX_IMPL_INTERFACE(ScDrawTextObjectBar, SfxShell, ScResId(SCSTR_DRAWTEXTSHELL)) @@ -833,14 +835,14 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) case SID_DRAWTEXT_ATTR_DLG: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( pViewData->GetDialogParent(), &aEditAttr, pView ); + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog( pViewData->GetDialogParent(), &aEditAttr, pView )); bDone = ( RET_OK == pDlg->Execute() ); if ( bDone ) aNewAttr.Put( *pDlg->GetOutputItemSet() ); - delete pDlg; + pDlg.reset(); SfxBindings& rBindings = pViewData->GetBindings(); rBindings.Invalidate( SID_TABLE_VERT_NONE ); diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx index d993d814d563..5cb6368aa9b8 100644 --- a/sc/source/ui/drawfunc/drtxtob1.cxx +++ b/sc/source/ui/drawfunc/drtxtob1.cxx @@ -38,6 +38,7 @@ #include "scresid.hxx" #include "scabstdlg.hxx" +#include <boost/scoped_ptr.hpp> bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, @@ -46,9 +47,9 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg( pViewData->GetDialogParent(), &rArgs, - pViewData->GetSfxDocShell()); + pViewData->GetSfxDocShell())); OSL_ENSURE(pDlg, "Dialog create fail!"); if (nSlot == SID_CHAR_DLG_EFFECT) { @@ -62,7 +63,6 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, if ( pNewAttrs ) rOutSet.Put( *pNewAttrs ); } - delete pDlg; return bRet; } @@ -94,8 +94,8 @@ bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs, ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg( - pViewData->GetDialogParent(), &aNewAttr); + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScParagraphDlg( + pViewData->GetDialogParent(), &aNewAttr)); OSL_ENSURE(pDlg, "Dialog create fail!"); bool bRet = ( pDlg->Execute() == RET_OK ); @@ -105,7 +105,6 @@ bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs, if ( pNewAttrs ) rOutSet.Put( *pNewAttrs ); } - delete pDlg; return bRet; } @@ -115,7 +114,7 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ ) SdrView* pView = pViewData->GetScDrawView(); OutlinerView* pOutView = pView->GetTextEditOutlinerView(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() ); + boost::scoped_ptr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( pViewData->GetDialogParent() )); pDlg->Insert( SOT_FORMAT_STRING, EMPTY_OUSTRING ); pDlg->Insert( SOT_FORMAT_RTF, EMPTY_OUSTRING ); @@ -133,7 +132,6 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ ) else pOutView->PasteSpecial(); } - delete pDlg; } diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 9c7b192f5a27..4e7b0dc6fe05 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -83,6 +83,7 @@ using namespace ::com::sun::star; #include "drawview.hxx" #include "markdata.hxx" #include "gridwin.hxx" +#include <boost/scoped_ptr.hpp> namespace { @@ -245,9 +246,9 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie case SID_INSERT_FLOATINGFRAME : { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - SfxAbstractInsertObjectDialog* pDlg = + boost::scoped_ptr<SfxAbstractInsertObjectDialog> pDlg( pFact->CreateInsertObjectDialog( pViewShell->GetWindow(), SC_MOD()->GetSlotPool()->GetSlot(nSlot)->GetCommandString(), - xStorage, &aServerLst ); + xStorage, &aServerLst )); if ( pDlg ) { pDlg->Execute(); @@ -261,7 +262,6 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie pViewSh->GetObjectShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName ); // damit DrawShell eingeschaltet wird (Objekt aktivieren ist unnoetig): bIsFromFile = !pDlg->IsCreateNew(); - DELETEZ( pDlg ); } break; diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index 8618f7aac695..1b7f9f3db5b6 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -50,6 +50,7 @@ #include "scuiautofmt.hxx" #include "scresid.hxx" #include "document.hxx" +#include <boost/scoped_ptr.hpp> // AutoFormat-Dialog: @@ -203,16 +204,15 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl) { OUString aStrStandard( SfxResId(STR_STANDARD) ); OUString aFormatName; - ScStringInputDlg* pDlg; bool bOk = false; while ( !bOk ) { - pDlg = new ScStringInputDlg( this, + boost::scoped_ptr<ScStringInputDlg> pDlg(new ScStringInputDlg( this, aStrTitle, aStrLabel, aFormatName, - HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME ); + HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME )); if ( pDlg->Execute() == RET_OK ) { @@ -261,8 +261,6 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl) } else bOk = true; - - delete pDlg; } } @@ -316,11 +314,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl) OUString aFormatName = m_pLbFormat->GetSelectEntry(); OUString aEntry; - ScStringInputDlg* pDlg = new ScStringInputDlg( this, + boost::scoped_ptr<ScStringInputDlg> pDlg(new ScStringInputDlg( this, aStrRename, aStrLabel, aFormatName, - HID_SC_REN_AFMT_DLG, HID_SC_REN_AFMT_NAME ); + HID_SC_REN_AFMT_DLG, HID_SC_REN_AFMT_NAME )); if( pDlg->Execute() == RET_OK ) { bool bFmtRenamed = false; @@ -386,7 +384,6 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl) } else bOk = true; - delete pDlg; } return 0; diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx index 5134f38d34cb..0d22eed7306f 100644 --- a/sc/source/ui/pagedlg/tphf.cxx +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -41,6 +41,7 @@ #include "scresid.hxx" #include "scuitphfedit.hxx" #undef _TPHF_CXX +#include <boost/scoped_ptr.hpp> // class ScHFPage @@ -191,21 +192,19 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - SfxAbstractTabDialog* pDlg = pFact->CreateScHFEditDlg( - pViewSh->GetViewFrame(), this, aDataSet, aStrPageStyle, nResId); + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScHFEditDlg( + pViewSh->GetViewFrame(), this, aDataSet, aStrPageStyle, nResId)); OSL_ENSURE(pDlg, "Dialog create fail!"); if ( pDlg->Execute() == RET_OK ) { aDataSet.Put( *pDlg->GetOutputItemSet() ); } - - delete pDlg; } else { OUString aText; - SfxSingleTabDialog* pDlg = new SfxSingleTabDialog(this, aDataSet); + boost::scoped_ptr<SfxSingleTabDialog> pDlg(new SfxSingleTabDialog(this, aDataSet)); const int nSettingsId = 42; bool bRightPage = m_pCntSharedBox->IsChecked() || ( SVX_PAGE_LEFT != SvxPageUsage(nPageUsage) ); @@ -239,8 +238,6 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl) { aDataSet.Put( *pDlg->GetOutputItemSet() ); } - - delete pDlg; } return 0; diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index b7b00018ea77..da277055e6f8 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -45,6 +45,7 @@ #include "AccessibleEditObject.hxx" #include "scabstdlg.hxx" +#include <boost/scoped_ptr.hpp> // STATIC DATA ----------------------------------------------------------- @@ -201,8 +202,8 @@ void ScEditWindow::SetCharAttriutes() ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( - GetParent(), &aSet, pDocSh); + boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg( + GetParent(), &aSet, pDocSh)); OSL_ENSURE(pDlg, "Dialog create fail!"); pDlg->SetText( ScGlobal::GetRscString( STR_TEXTATTRS ) ); if ( pDlg->Execute() == RET_OK ) @@ -213,7 +214,6 @@ void ScEditWindow::SetCharAttriutes() } if(pTabViewSh!=NULL) pTabViewSh->SetInFormatDialog(false); - delete pDlg; } } diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index 0fa086fb0c0d..ee29b0f41649 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -40,6 +40,7 @@ #include <optutil.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; @@ -194,11 +195,11 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st INetURLObject aURL( aFileName ); OUString aPrivDatName(aURL.getName()); - SvStream* pInStream = NULL; + boost::scoped_ptr<SvStream> pInStream; if ( xInputStream.is() ) - pInStream = utl::UcbStreamHelper::CreateStream( xInputStream ); + pInStream.reset(utl::UcbStreamHelper::CreateStream( xInputStream )); - AbstractScImportAsciiDlg* pDlg = pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream, SC_IMPORTFILE); + boost::scoped_ptr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream.get(), SC_IMPORTFILE)); OSL_ENSURE(pDlg, "Dialog create fail!"); if ( pDlg->Execute() == RET_OK ) { @@ -208,8 +209,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st aFilterOptions = aOptions.WriteToString(); nRet = ui::dialogs::ExecutableDialogResults::OK; } - delete pDlg; - delete pInStream; } else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() ) { @@ -301,9 +300,9 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st ScImportOptions aOptions( cAsciiDel, cStrDel, eEncoding); - AbstractScImportOptionsDlg* pDlg = pFact->CreateScImportOptionsDlg(NULL, + boost::scoped_ptr<AbstractScImportOptionsDlg> pDlg(pFact->CreateScImportOptionsDlg(NULL, bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc, - !bExport); + !bExport)); OSL_ENSURE(pDlg, "Dialog create fail!"); if ( pDlg->Execute() == RET_OK ) { @@ -315,7 +314,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st aFilterOptions = aOptions.aStrFont; nRet = ui::dialogs::ExecutableDialogResults::OK; } - delete pDlg; } xInputStream.clear(); // don't hold the stream longer than necessary diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 5a26a6eaacfd..7cb29367aa52 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -272,7 +272,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) case SID_PASTE_SPECIAL: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() ); + boost::scoped_ptr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( pViewData->GetDialogParent() )); sal_uLong nFormat = 0; if ( pDlg ) { @@ -283,8 +283,8 @@ void ScEditShell::Execute( SfxRequest& rReq ) TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); - DELETEZ(pDlg); } + pDlg.reset(); // while the dialog was open, edit mode may have been stopped if (!SC_MOD()->IsInputMode()) diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 7c2a2c2aa383..58665e25b376 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -790,7 +790,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - AbstractScShowTabDlg* pDlg = pFact->CreateScShowTabDlg(GetDialogParent()); + boost::scoped_ptr<AbstractScShowTabDlg> pDlg(pFact->CreateScShowTabDlg(GetDialogParent())); OSL_ENSURE(pDlg, "Dialog create fail!"); pDlg->SetDescription( OUString( ScResId( STR_DLG_SELECTTABLES_TITLE ) ), @@ -811,7 +811,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) sal_uInt16 nSelIx; for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx ) aIndexList.insert( aIndexList.begin()+nSelIx, pDlg->GetSelectEntryPos( nSelIx ) ); - delete pDlg; + pDlg.reset(); rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, aIndexList ) ); } else diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 8055546a96e4..01b33721543d 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -698,12 +698,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) aTabBgColor = pDoc->GetTabBgColor( nCurrentTab ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - AbstractScTabBgColorDlg* pDlg = pFact->CreateScTabBgColorDlg( + boost::scoped_ptr<AbstractScTabBgColorDlg> pDlg(pFact->CreateScTabBgColorDlg( GetDialogParent(), OUString(ScResId(SCSTR_SET_TAB_BG_COLOR)), OUString(ScResId(SCSTR_NO_TAB_BG_COLOR)), aTabBgColor, - CMD_FID_TAB_SET_TAB_BG_COLOR); + CMD_FID_TAB_SET_TAB_BG_COLOR)); while ( !bDone && nRet == RET_OK ) { nRet = pDlg->Execute(); @@ -747,7 +747,6 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } } } - delete( pDlg ); } } break; |