Kaydet (Commit) c623612b authored tarafından Takeshi Abe's avatar Takeshi Abe

Avoid possible memory leaks in case of exceptions

Change-Id: Icc1e11e173329fd88898a3d13270406fd651eb2b
üst 558618e0
...@@ -76,6 +76,8 @@ ...@@ -76,6 +76,8 @@
#define ScDrawTextObjectBar #define ScDrawTextObjectBar
#include "scslots.hxx" #include "scslots.hxx"
#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
SFX_IMPL_INTERFACE(ScDrawTextObjectBar, SfxShell, ScResId(SCSTR_DRAWTEXTSHELL)) SFX_IMPL_INTERFACE(ScDrawTextObjectBar, SfxShell, ScResId(SCSTR_DRAWTEXTSHELL))
...@@ -833,14 +835,14 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) ...@@ -833,14 +835,14 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq )
case SID_DRAWTEXT_ATTR_DLG: case SID_DRAWTEXT_ATTR_DLG:
{ {
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 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() ); bDone = ( RET_OK == pDlg->Execute() );
if ( bDone ) if ( bDone )
aNewAttr.Put( *pDlg->GetOutputItemSet() ); aNewAttr.Put( *pDlg->GetOutputItemSet() );
delete pDlg; pDlg.reset();
SfxBindings& rBindings = pViewData->GetBindings(); SfxBindings& rBindings = pViewData->GetBindings();
rBindings.Invalidate( SID_TABLE_VERT_NONE ); rBindings.Invalidate( SID_TABLE_VERT_NONE );
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "scresid.hxx" #include "scresid.hxx"
#include "scabstdlg.hxx" #include "scabstdlg.hxx"
#include <boost/scoped_ptr.hpp>
bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
...@@ -46,9 +47,9 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, ...@@ -46,9 +47,9 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg(
pViewData->GetDialogParent(), &rArgs, pViewData->GetDialogParent(), &rArgs,
pViewData->GetSfxDocShell()); pViewData->GetSfxDocShell()));
OSL_ENSURE(pDlg, "Dialog create fail!"); OSL_ENSURE(pDlg, "Dialog create fail!");
if (nSlot == SID_CHAR_DLG_EFFECT) if (nSlot == SID_CHAR_DLG_EFFECT)
{ {
...@@ -62,7 +63,6 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, ...@@ -62,7 +63,6 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
if ( pNewAttrs ) if ( pNewAttrs )
rOutSet.Put( *pNewAttrs ); rOutSet.Put( *pNewAttrs );
} }
delete pDlg;
return bRet; return bRet;
} }
...@@ -94,8 +94,8 @@ bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs, ...@@ -94,8 +94,8 @@ bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg( boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScParagraphDlg(
pViewData->GetDialogParent(), &aNewAttr); pViewData->GetDialogParent(), &aNewAttr));
OSL_ENSURE(pDlg, "Dialog create fail!"); OSL_ENSURE(pDlg, "Dialog create fail!");
bool bRet = ( pDlg->Execute() == RET_OK ); bool bRet = ( pDlg->Execute() == RET_OK );
...@@ -105,7 +105,6 @@ bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs, ...@@ -105,7 +105,6 @@ bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
if ( pNewAttrs ) if ( pNewAttrs )
rOutSet.Put( *pNewAttrs ); rOutSet.Put( *pNewAttrs );
} }
delete pDlg;
return bRet; return bRet;
} }
...@@ -115,7 +114,7 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ ) ...@@ -115,7 +114,7 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
SdrView* pView = pViewData->GetScDrawView(); SdrView* pView = pViewData->GetScDrawView();
OutlinerView* pOutView = pView->GetTextEditOutlinerView(); OutlinerView* pOutView = pView->GetTextEditOutlinerView();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 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_STRING, EMPTY_OUSTRING );
pDlg->Insert( SOT_FORMAT_RTF, EMPTY_OUSTRING ); pDlg->Insert( SOT_FORMAT_RTF, EMPTY_OUSTRING );
...@@ -133,7 +132,6 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ ) ...@@ -133,7 +132,6 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
else else
pOutView->PasteSpecial(); pOutView->PasteSpecial();
} }
delete pDlg;
} }
......
...@@ -83,6 +83,7 @@ using namespace ::com::sun::star; ...@@ -83,6 +83,7 @@ using namespace ::com::sun::star;
#include "drawview.hxx" #include "drawview.hxx"
#include "markdata.hxx" #include "markdata.hxx"
#include "gridwin.hxx" #include "gridwin.hxx"
#include <boost/scoped_ptr.hpp>
namespace { namespace {
...@@ -245,9 +246,9 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie ...@@ -245,9 +246,9 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie
case SID_INSERT_FLOATINGFRAME : case SID_INSERT_FLOATINGFRAME :
{ {
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractInsertObjectDialog* pDlg = boost::scoped_ptr<SfxAbstractInsertObjectDialog> pDlg(
pFact->CreateInsertObjectDialog( pViewShell->GetWindow(), SC_MOD()->GetSlotPool()->GetSlot(nSlot)->GetCommandString(), pFact->CreateInsertObjectDialog( pViewShell->GetWindow(), SC_MOD()->GetSlotPool()->GetSlot(nSlot)->GetCommandString(),
xStorage, &aServerLst ); xStorage, &aServerLst ));
if ( pDlg ) if ( pDlg )
{ {
pDlg->Execute(); pDlg->Execute();
...@@ -261,7 +262,6 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie ...@@ -261,7 +262,6 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie
pViewSh->GetObjectShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName ); pViewSh->GetObjectShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName );
// damit DrawShell eingeschaltet wird (Objekt aktivieren ist unnoetig): // damit DrawShell eingeschaltet wird (Objekt aktivieren ist unnoetig):
bIsFromFile = !pDlg->IsCreateNew(); bIsFromFile = !pDlg->IsCreateNew();
DELETEZ( pDlg );
} }
break; break;
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "scuiautofmt.hxx" #include "scuiautofmt.hxx"
#include "scresid.hxx" #include "scresid.hxx"
#include "document.hxx" #include "document.hxx"
#include <boost/scoped_ptr.hpp>
// AutoFormat-Dialog: // AutoFormat-Dialog:
...@@ -203,16 +204,15 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl) ...@@ -203,16 +204,15 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl)
{ {
OUString aStrStandard( SfxResId(STR_STANDARD) ); OUString aStrStandard( SfxResId(STR_STANDARD) );
OUString aFormatName; OUString aFormatName;
ScStringInputDlg* pDlg;
bool bOk = false; bool bOk = false;
while ( !bOk ) while ( !bOk )
{ {
pDlg = new ScStringInputDlg( this, boost::scoped_ptr<ScStringInputDlg> pDlg(new ScStringInputDlg( this,
aStrTitle, aStrTitle,
aStrLabel, aStrLabel,
aFormatName, aFormatName,
HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME ); HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME ));
if ( pDlg->Execute() == RET_OK ) if ( pDlg->Execute() == RET_OK )
{ {
...@@ -261,8 +261,6 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl) ...@@ -261,8 +261,6 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl)
} }
else else
bOk = true; bOk = true;
delete pDlg;
} }
} }
...@@ -316,11 +314,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl) ...@@ -316,11 +314,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl)
OUString aFormatName = m_pLbFormat->GetSelectEntry(); OUString aFormatName = m_pLbFormat->GetSelectEntry();
OUString aEntry; OUString aEntry;
ScStringInputDlg* pDlg = new ScStringInputDlg( this, boost::scoped_ptr<ScStringInputDlg> pDlg(new ScStringInputDlg( this,
aStrRename, aStrRename,
aStrLabel, aStrLabel,
aFormatName, 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 ) if( pDlg->Execute() == RET_OK )
{ {
bool bFmtRenamed = false; bool bFmtRenamed = false;
...@@ -386,7 +384,6 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl) ...@@ -386,7 +384,6 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl)
} }
else else
bOk = true; bOk = true;
delete pDlg;
} }
return 0; return 0;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "scresid.hxx" #include "scresid.hxx"
#include "scuitphfedit.hxx" #include "scuitphfedit.hxx"
#undef _TPHF_CXX #undef _TPHF_CXX
#include <boost/scoped_ptr.hpp>
// class ScHFPage // class ScHFPage
...@@ -191,21 +192,19 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl) ...@@ -191,21 +192,19 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl)
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
SfxAbstractTabDialog* pDlg = pFact->CreateScHFEditDlg( boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScHFEditDlg(
pViewSh->GetViewFrame(), this, aDataSet, aStrPageStyle, nResId); pViewSh->GetViewFrame(), this, aDataSet, aStrPageStyle, nResId));
OSL_ENSURE(pDlg, "Dialog create fail!"); OSL_ENSURE(pDlg, "Dialog create fail!");
if ( pDlg->Execute() == RET_OK ) if ( pDlg->Execute() == RET_OK )
{ {
aDataSet.Put( *pDlg->GetOutputItemSet() ); aDataSet.Put( *pDlg->GetOutputItemSet() );
} }
delete pDlg;
} }
else else
{ {
OUString aText; OUString aText;
SfxSingleTabDialog* pDlg = new SfxSingleTabDialog(this, aDataSet); boost::scoped_ptr<SfxSingleTabDialog> pDlg(new SfxSingleTabDialog(this, aDataSet));
const int nSettingsId = 42; const int nSettingsId = 42;
bool bRightPage = m_pCntSharedBox->IsChecked() bool bRightPage = m_pCntSharedBox->IsChecked()
|| ( SVX_PAGE_LEFT != SvxPageUsage(nPageUsage) ); || ( SVX_PAGE_LEFT != SvxPageUsage(nPageUsage) );
...@@ -239,8 +238,6 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl) ...@@ -239,8 +238,6 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl)
{ {
aDataSet.Put( *pDlg->GetOutputItemSet() ); aDataSet.Put( *pDlg->GetOutputItemSet() );
} }
delete pDlg;
} }
return 0; return 0;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "AccessibleEditObject.hxx" #include "AccessibleEditObject.hxx"
#include "scabstdlg.hxx" #include "scabstdlg.hxx"
#include <boost/scoped_ptr.hpp>
// STATIC DATA ----------------------------------------------------------- // STATIC DATA -----------------------------------------------------------
...@@ -201,8 +202,8 @@ void ScEditWindow::SetCharAttriutes() ...@@ -201,8 +202,8 @@ void ScEditWindow::SetCharAttriutes()
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg(
GetParent(), &aSet, pDocSh); GetParent(), &aSet, pDocSh));
OSL_ENSURE(pDlg, "Dialog create fail!"); OSL_ENSURE(pDlg, "Dialog create fail!");
pDlg->SetText( ScGlobal::GetRscString( STR_TEXTATTRS ) ); pDlg->SetText( ScGlobal::GetRscString( STR_TEXTATTRS ) );
if ( pDlg->Execute() == RET_OK ) if ( pDlg->Execute() == RET_OK )
...@@ -213,7 +214,6 @@ void ScEditWindow::SetCharAttriutes() ...@@ -213,7 +214,6 @@ void ScEditWindow::SetCharAttriutes()
} }
if(pTabViewSh!=NULL) pTabViewSh->SetInFormatDialog(false); if(pTabViewSh!=NULL) pTabViewSh->SetInFormatDialog(false);
delete pDlg;
} }
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <optutil.hxx> #include <optutil.hxx>
#include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Sequence.hxx>
#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -194,11 +195,11 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st ...@@ -194,11 +195,11 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st
INetURLObject aURL( aFileName ); INetURLObject aURL( aFileName );
OUString aPrivDatName(aURL.getName()); OUString aPrivDatName(aURL.getName());
SvStream* pInStream = NULL; boost::scoped_ptr<SvStream> pInStream;
if ( xInputStream.is() ) 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!"); OSL_ENSURE(pDlg, "Dialog create fail!");
if ( pDlg->Execute() == RET_OK ) if ( pDlg->Execute() == RET_OK )
{ {
...@@ -208,8 +209,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st ...@@ -208,8 +209,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st
aFilterOptions = aOptions.WriteToString(); aFilterOptions = aOptions.WriteToString();
nRet = ui::dialogs::ExecutableDialogResults::OK; nRet = ui::dialogs::ExecutableDialogResults::OK;
} }
delete pDlg;
delete pInStream;
} }
else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() ) else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() )
{ {
...@@ -301,9 +300,9 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st ...@@ -301,9 +300,9 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st
ScImportOptions aOptions( cAsciiDel, cStrDel, eEncoding); ScImportOptions aOptions( cAsciiDel, cStrDel, eEncoding);
AbstractScImportOptionsDlg* pDlg = pFact->CreateScImportOptionsDlg(NULL, boost::scoped_ptr<AbstractScImportOptionsDlg> pDlg(pFact->CreateScImportOptionsDlg(NULL,
bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc, bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc,
!bExport); !bExport));
OSL_ENSURE(pDlg, "Dialog create fail!"); OSL_ENSURE(pDlg, "Dialog create fail!");
if ( pDlg->Execute() == RET_OK ) if ( pDlg->Execute() == RET_OK )
{ {
...@@ -315,7 +314,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st ...@@ -315,7 +314,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st
aFilterOptions = aOptions.aStrFont; aFilterOptions = aOptions.aStrFont;
nRet = ui::dialogs::ExecutableDialogResults::OK; nRet = ui::dialogs::ExecutableDialogResults::OK;
} }
delete pDlg;
} }
xInputStream.clear(); // don't hold the stream longer than necessary xInputStream.clear(); // don't hold the stream longer than necessary
......
...@@ -272,7 +272,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) ...@@ -272,7 +272,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
case SID_PASTE_SPECIAL: case SID_PASTE_SPECIAL:
{ {
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() ); boost::scoped_ptr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( pViewData->GetDialogParent() ));
sal_uLong nFormat = 0; sal_uLong nFormat = 0;
if ( pDlg ) if ( pDlg )
{ {
...@@ -283,8 +283,8 @@ void ScEditShell::Execute( SfxRequest& rReq ) ...@@ -283,8 +283,8 @@ void ScEditShell::Execute( SfxRequest& rReq )
TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
DELETEZ(pDlg);
} }
pDlg.reset();
// while the dialog was open, edit mode may have been stopped // while the dialog was open, edit mode may have been stopped
if (!SC_MOD()->IsInputMode()) if (!SC_MOD()->IsInputMode())
......
...@@ -790,7 +790,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) ...@@ -790,7 +790,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); 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!"); OSL_ENSURE(pDlg, "Dialog create fail!");
pDlg->SetDescription( pDlg->SetDescription(
OUString( ScResId( STR_DLG_SELECTTABLES_TITLE ) ), OUString( ScResId( STR_DLG_SELECTTABLES_TITLE ) ),
...@@ -811,7 +811,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) ...@@ -811,7 +811,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
sal_uInt16 nSelIx; sal_uInt16 nSelIx;
for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx ) for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx )
aIndexList.insert( aIndexList.begin()+nSelIx, pDlg->GetSelectEntryPos( nSelIx ) ); aIndexList.insert( aIndexList.begin()+nSelIx, pDlg->GetSelectEntryPos( nSelIx ) );
delete pDlg; pDlg.reset();
rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, aIndexList ) ); rReq.AppendItem( SfxIntegerListItem( SID_SELECT_TABLES, aIndexList ) );
} }
else else
......
...@@ -698,12 +698,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) ...@@ -698,12 +698,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
aTabBgColor = pDoc->GetTabBgColor( nCurrentTab ); aTabBgColor = pDoc->GetTabBgColor( nCurrentTab );
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
AbstractScTabBgColorDlg* pDlg = pFact->CreateScTabBgColorDlg( boost::scoped_ptr<AbstractScTabBgColorDlg> pDlg(pFact->CreateScTabBgColorDlg(
GetDialogParent(), GetDialogParent(),
OUString(ScResId(SCSTR_SET_TAB_BG_COLOR)), OUString(ScResId(SCSTR_SET_TAB_BG_COLOR)),
OUString(ScResId(SCSTR_NO_TAB_BG_COLOR)), OUString(ScResId(SCSTR_NO_TAB_BG_COLOR)),
aTabBgColor, aTabBgColor,
CMD_FID_TAB_SET_TAB_BG_COLOR); CMD_FID_TAB_SET_TAB_BG_COLOR));
while ( !bDone && nRet == RET_OK ) while ( !bDone && nRet == RET_OK )
{ {
nRet = pDlg->Execute(); nRet = pDlg->Execute();
...@@ -747,7 +747,6 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) ...@@ -747,7 +747,6 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
} }
} }
} }
delete( pDlg );
} }
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment