From 61b224f392eb856bf4cfa0c04c68202a463cbdbf Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 20 Mar 2015 11:27:10 +0200 Subject: vclwidget: fixup locally allocated vcl::Window objects They need to be wrapped in ScopedVclPtr in order to be disposed properly. Change-Id: Ib64dba353774f54711e4de7f5d15d859c6a4dc7e --- sd/source/ui/animations/CustomAnimationDialog.cxx | 2 +- sd/source/ui/animations/SlideTransitionPane.cxx | 2 +- sd/source/ui/annotations/annotationmanager.cxx | 2 +- sd/source/ui/dlg/LayerTabBar.cxx | 2 +- sd/source/ui/dlg/PhotoAlbumDialog.cxx | 4 ++-- sd/source/ui/dlg/animobjs.cxx | 2 +- sd/source/ui/dlg/brkdlg.cxx | 2 +- sd/source/ui/dlg/custsdlg.cxx | 4 ++-- sd/source/ui/dlg/sdtreelb.cxx | 2 +- sd/source/ui/dlg/tpoption.cxx | 2 +- sd/source/ui/func/fuinsert.cxx | 2 +- sd/source/ui/func/fuinsfil.cxx | 6 +++--- sd/source/ui/func/fulinend.cxx | 2 +- sd/source/ui/func/fupage.cxx | 2 +- sd/source/ui/slidesorter/controller/SlsClipboard.cxx | 2 +- sd/source/ui/view/DocumentRenderer.cxx | 2 +- sd/source/ui/view/Outliner.cxx | 8 ++++---- sd/source/ui/view/ViewShellBase.cxx | 2 +- sd/source/ui/view/drviews2.cxx | 6 +++--- sd/source/ui/view/drviews6.cxx | 2 +- sd/source/ui/view/drviews9.cxx | 2 +- sd/source/ui/view/drviewsi.cxx | 2 +- 22 files changed, 31 insertions(+), 31 deletions(-) (limited to 'sd/source/ui') diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index a21d4f67b53e..f0aba1483ff3 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -1548,7 +1548,7 @@ void CustomAnimationEffectTabPage::openSoundFileDialog() { OUString aStrWarning(SD_RESSTR(STR_WARNING_NOSOUNDFILE)); aStrWarning = aStrWarning.replaceFirst("%", aFile); - VclPtr aWarningBox(new WarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning )); + ScopedVclPtr aWarningBox(new WarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning )); aWarningBox->SetModalInputMode (true); bQuitLoop = aWarningBox->Execute() != RET_RETRY; diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 370ef4964297..9a5a28549b0b 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -743,7 +743,7 @@ void SlideTransitionPane::openSoundFileDialog() { OUString aStrWarning(SD_RESSTR(STR_WARNING_NOSOUNDFILE)); aStrWarning = aStrWarning.replaceFirst("%", aFile); - VclPtr aWarningBox(new WarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning )); + ScopedVclPtr aWarningBox(new WarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning )); aWarningBox->SetModalInputMode (true); bQuitLoop = (aWarningBox->Execute() != RET_RETRY); diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 09887ec32a94..9ac354940fb1 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -694,7 +694,7 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) // Pop up question box that asks the user whether to wrap around. // The dialog is made modal with respect to the whole application. - VclPtr aQuestionBox (new QueryBox( NULL, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId))); + ScopedVclPtr aQuestionBox (new QueryBox( NULL, (WB_YES_NO | WB_DEF_YES), SD_RESSTR(nStringId))); aQuestionBox->SetImage( QueryBox::GetStandardImage() ); if (aQuestionBox->Execute() != RET_YES) break; diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx index 14b88f9ea422..955854324725 100644 --- a/sd/source/ui/dlg/LayerTabBar.cxx +++ b/sd/source/ui/dlg/LayerTabBar.cxx @@ -203,7 +203,7 @@ TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming() (rLayerAdmin.GetLayer( aNewName, false ) && aLayerName != aNewName) ) { // Name already exists - VclPtr aWarningBox(new WarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ), + ScopedVclPtr aWarningBox(new WarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ), SD_RESSTR( STR_WARN_NAME_DUPLICATE ) )); aWarningBox->Execute(); bOK = false; diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index 2f79921609e9..ddc8b9b9fb90 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -105,7 +105,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) { if (pImagesLst->GetEntryCount() == 0) { - VclPtr aWarning(new WarningBox(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING))); + ScopedVclPtr aWarning(new WarningBox(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING))); aWarning->Execute(); } else @@ -462,7 +462,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) } else { - VclPtr aInfo(new InfoBox(this, OUString("Function is not implemented!"))); + ScopedVclPtr aInfo(new InfoBox(this, OUString("Function is not implemented!"))); aInfo->Execute(); } EndDialog(); diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 6b79455d35ff..3fcebfbff8e9 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -455,7 +455,7 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn ) } else // delete everything { - VclPtr aWarnBox(new WarningBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) )); + ScopedVclPtr aWarnBox(new WarningBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) )); short nReturn = aWarnBox->Execute(); if( nReturn == RET_YES ) diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx index 2bd293b12059..4cd524707300 100644 --- a/sd/source/ui/dlg/brkdlg.cxx +++ b/sd/source/ui/dlg/brkdlg.cxx @@ -103,7 +103,7 @@ IMPL_LINK( BreakDlg, UpDate, void*, nInit ) // update status bar or show a error message? if(nInit == reinterpret_cast(1L)) { - VclPtr aErrBox(new MessageDialog(this, SD_RESSTR(STR_BREAK_FAIL))); + ScopedVclPtr aErrBox(new MessageDialog(this, SD_RESSTR(STR_BREAK_FAIL))); aErrBox->Execute(); } else diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index b6c290586403..00cec79e80a2 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -126,7 +126,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) if( p == m_pBtnNew ) { pCustomShow = NULL; - VclPtr aDlg(new SdDefineCustomShowDlg( this, rDoc, pCustomShow )); + ScopedVclPtr aDlg(new SdDefineCustomShowDlg( this, rDoc, pCustomShow )); if( aDlg->Execute() == RET_OK ) { if( pCustomShow ) @@ -154,7 +154,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) { DBG_ASSERT( pCustomShowList, "pCustomShowList does not exist" ); pCustomShow = (*pCustomShowList)[ nPos ]; - VclPtr aDlg(new SdDefineCustomShowDlg( this, rDoc, pCustomShow )); + ScopedVclPtr aDlg(new SdDefineCustomShowDlg( this, rDoc, pCustomShow )); if( aDlg->Execute() == RET_OK ) { diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 02bedafa2cad..9afcdcfc7176 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -1012,7 +1012,7 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed) if ( !mpBookmarkDoc ) { - VclPtr aErrorBox(new MessageDialog(this, SD_RESSTR(STR_READ_DATA_ERROR))); + ScopedVclPtr aErrorBox(new MessageDialog(this, SD_RESSTR(STR_READ_DATA_ERROR))); aErrorBox->Execute(); mpMedium = 0; //On failure the SfxMedium is invalid } diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index 6faf6e5efb63..4f4e783515e6 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -373,7 +373,7 @@ int SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet ) FillItemSet( pActiveSet ); return LEAVE_PAGE; } - VclPtr aWarnBox(new WarningBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) )); + ScopedVclPtr aWarnBox(new WarningBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) )); if( aWarnBox->Execute() == RET_YES ) return KEEP_PAGE; diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index d47f025ff538..72a5bc118e0a 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -151,7 +151,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& ) // really store as link only? if( SvtMiscOptions().ShowLinkWarningDialog() ) { - VclPtr aWarnDlg(new SvxLinkWarningDialog(mpWindow,aDlg.GetPath())); + ScopedVclPtr aWarnDlg(new SvxLinkWarningDialog(mpWindow,aDlg.GetPath())); if( aWarnDlg->Execute() != RET_OK ) return; // don't store as link } diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index e47b22a797de..fa683dbe7d94 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -281,7 +281,7 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) if( !bInserted ) { - VclPtr aErrorBox(new MessageDialog(mpWindow, SD_RESSTR( STR_READ_DATA_ERROR))); + ScopedVclPtr aErrorBox(new MessageDialog(mpWindow, SD_RESSTR( STR_READ_DATA_ERROR))); aErrorBox->Execute(); delete pMedium; } @@ -431,7 +431,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { - VclPtr aErrorBox(new MessageDialog(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR))); + ScopedVclPtr aErrorBox(new MessageDialog(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR))); aErrorBox->Execute(); } else @@ -575,7 +575,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { - VclPtr aErrorBox(new MessageDialog(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR))); + ScopedVclPtr aErrorBox(new MessageDialog(mpWindow, SD_RESSTR(STR_READ_DATA_ERROR))); aErrorBox->Execute(); } else diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx index cc94ac446bff..16a3bae4f3b4 100644 --- a/sd/source/ui/func/fulinend.cxx +++ b/sd/source/ui/func/fulinend.cxx @@ -138,7 +138,7 @@ void FuLineEnd::DoExecute( SfxRequest& ) } else { - VclPtr aWarningBox(new WarningBox( mpWindow, WinBits( WB_OK ), + ScopedVclPtr aWarningBox(new WarningBox( mpWindow, WinBits( WB_OK ), SD_RESSTR( STR_WARN_NAME_DUPLICATE ) ) ); aWarningBox->Execute(); } diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 670bbff5802b..4143f0c0892d 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -351,7 +351,7 @@ const SfxItemSet* FuPage::ExecuteDialog( ::vcl::Window* pParent ) // notice-masterpage (at the moment) if( ePageKind != PK_NOTES ) { - VclPtr aQuestionBox (new MessBox( + ScopedVclPtr aQuestionBox (new MessBox( pParent, WB_YES_NO | WB_DEF_YES, SD_RESSTR(STR_PAGE_BACKGROUND_TITLE), diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 92a880853d19..c3f3bad8043c 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -287,7 +287,7 @@ sal_Int32 Clipboard::GetInsertionPosition (::vcl::Window* pWindow) else if (mrController.GetFocusManager().IsFocusShowing()) { // Use the focus to determine the insertion position. - VclPtr aDialog (new SdInsertPasteDlg(pWindow)); + ScopedVclPtr aDialog (new SdInsertPasteDlg(pWindow)); if (aDialog->Execute() == RET_OK) { nInsertPosition = mrController.GetFocusManager().GetFocusedPageIndex(); diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 20b2df7c70f0..ba7826b19d39 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1301,7 +1301,7 @@ public: // Show warning that the orientation could not be set. if (pViewShell) { - VclPtr aWarnBox(new WarningBox( + ScopedVclPtr aWarnBox(new WarningBox( pViewShell->GetActiveWindow(), (WinBits)(WB_OK_CANCEL | WB_DEF_CANCEL), SD_RESSTR(STR_WARN_PRINTFORMAT_FAILURE))); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index b46951154485..c14c68f1793a 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1068,7 +1068,7 @@ void Outliner::ShowEndOfSearchDialog (void) // Show the message in an info box that is modal with respect to the // whole application. - VclPtr aInfoBox(new MessageDialog(NULL, aString, VCL_MESSAGE_INFO)); + ScopedVclPtr aInfoBox(new MessageDialog(NULL, aString, VCL_MESSAGE_INFO)); ShowModalMessageBox (*aInfoBox.get()); @@ -1109,7 +1109,7 @@ bool Outliner::ShowWrapArroundDialog (void) // Pop up question box that asks the user whether to wrap around. // The dialog is made modal with respect to the whole application. - VclPtr aQuestionBox (new QueryBox( + ScopedVclPtr aQuestionBox (new QueryBox( NULL, WB_YES_NO | WB_DEF_YES, SD_RESSTR(nStringId))); @@ -1157,7 +1157,7 @@ void Outliner::PrepareSpellCheck (void) { mbError = true; mbEndOfSearch = true; - VclPtr aErrorBox (new MessageDialog(NULL, + ScopedVclPtr aErrorBox (new MessageDialog(NULL, SD_RESSTR(STR_NOLANGUAGE))); ShowModalMessageBox (*aErrorBox.get()); } @@ -1376,7 +1376,7 @@ bool Outliner::HandleFailedSearch (void) if (HasNoPreviousMatch ()) { // No match found in the whole presentation. Tell the user. - VclPtr aInfoBox (new InfoBox(NULL, SD_RESSTR(STR_SAR_NOT_FOUND))); + ScopedVclPtr aInfoBox (new InfoBox(NULL, SD_RESSTR(STR_SAR_NOT_FOUND))); ShowModalMessageBox (*aInfoBox.get()); } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 03ba2b10588a..fefb13b71b41 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -533,7 +533,7 @@ sal_uInt16 ViewShellBase::SetPrinter ( bool bScaleAll = false; if ( bIsAPI ) { - VclPtr aWarnBox (new WarningBox( + ScopedVclPtr aWarnBox (new WarningBox( GetWindow(), (WinBits)(WB_YES_NO | WB_DEF_YES), SD_RESSTR(STR_SCALE_OBJS_TO_PAGE))); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index e442aeb9be15..f780db94fcd6 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -993,7 +993,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if( pObj && pObj->ISA( SdrGrafObj ) && static_cast(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { SdrGrafObj* pGraphicObj = static_cast(pObj); - VclPtr dialog(new CompressGraphicsDialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() ) ); + ScopedVclPtr dialog(new CompressGraphicsDialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() ) ); if ( dialog->Execute() == RET_OK ) { SdrGrafObj* pNewObject = dialog->GetCompressedSdrGrafObj(); @@ -1422,7 +1422,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) || aLayerName.isEmpty() ) { // name already exists - VclPtr aWarningBox (new WarningBox( + ScopedVclPtr aWarningBox (new WarningBox( GetParentWindow(), WinBits( WB_OK ), SD_RESSTR(STR_WARN_NAME_DUPLICATE))); @@ -1591,7 +1591,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) aLayerName != aOldLayerName) || aLayerName.isEmpty() ) { // name already exists - VclPtr aWarningBox (new WarningBox( + ScopedVclPtr aWarningBox (new WarningBox( GetParentWindow(), WinBits( WB_OK ), SD_RESSTR(STR_WARN_NAME_DUPLICATE))); diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index c76556e9a177..adffc746bf5c 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -294,7 +294,7 @@ void DrawViewShell::ExecBmpMask( SfxRequest& rReq ) if( pNewObj->IsLinkedGraphic() ) { - VclPtr aQueryBox(new MessageDialog( (vcl::Window*) GetActiveWindow(),"QueryUnlinkImageDialog","modules/sdraw/ui/queryunlinkimagedialog.ui") ); + ScopedVclPtr aQueryBox(new MessageDialog( (vcl::Window*) GetActiveWindow(),"QueryUnlinkImageDialog","modules/sdraw/ui/queryunlinkimagedialog.ui") ); if (RET_YES == aQueryBox->Execute()) pNewObj->ReleaseGraphicLink(); diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index 66745078a240..19bd115c7a85 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -87,7 +87,7 @@ void DrawViewShell::ExecGallery(SfxRequest& rReq) Graphic aGraphic( pGalleryItem->GetGraphic() ); // reduce size if necessary - VclPtr aWindow(GetActiveWindow()); + ScopedVclPtr aWindow(new Window(GetActiveWindow())); aWindow->SetMapMode(aGraphic.GetPrefMapMode()); Size aSizePix = aWindow->LogicToPixel(aGraphic.GetPrefSize()); aWindow->SetMapMode( MapMode(MAP_100TH_MM) ); diff --git a/sd/source/ui/view/drviewsi.cxx b/sd/source/ui/view/drviewsi.cxx index e15f19627216..f926b7ebac46 100644 --- a/sd/source/ui/view/drviewsi.cxx +++ b/sd/source/ui/view/drviewsi.cxx @@ -164,7 +164,7 @@ void DrawViewShell::AssignFrom3DWindow() } else { - VclPtr aInfoBox (new InfoBox( + ScopedVclPtr aInfoBox (new InfoBox( GetActiveWindow(), SD_RESSTR(STR_ACTION_NOTPOSSIBLE))); aInfoBox->Execute(); -- cgit