diff options
Diffstat (limited to 'sd/source/ui/dlg')
44 files changed, 849 insertions, 394 deletions
diff --git a/sd/source/ui/dlg/AnimationChildWindow.cxx b/sd/source/ui/dlg/AnimationChildWindow.cxx index 7e7ec61574db..d59f0ac2a083 100644 --- a/sd/source/ui/dlg/AnimationChildWindow.cxx +++ b/sd/source/ui/dlg/AnimationChildWindow.cxx @@ -39,7 +39,7 @@ AnimationChildWindow::AnimationChildWindow( SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - AnimationWindow* pAnimWin = new AnimationWindow(pBindings, this, _pParent); + VclPtr<AnimationWindow> pAnimWin = VclPtr<AnimationWindow>::Create(pBindings, this, _pParent); pWindow = pAnimWin; eChildAlignment = SfxChildAlignment::NOALIGNMENT; diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx index cfc97fd3a543..934c5bbf89f9 100644 --- a/sd/source/ui/dlg/LayerTabBar.cxx +++ b/sd/source/ui/dlg/LayerTabBar.cxx @@ -203,9 +203,9 @@ TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming() (rLayerAdmin.GetLayer( aNewName, false ) && aLayerName != aNewName) ) { // Name already exists - WarningBox aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ), + ScopedVclPtrInstance<WarningBox> aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), WinBits( WB_OK ), SD_RESSTR( STR_WARN_NAME_DUPLICATE ) ); - aWarningBox.Execute(); + aWarningBox->Execute(); bOK = false; } diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx index 480a5f74e0e7..0beb6d1f38e0 100644 --- a/sd/source/ui/dlg/NavigatorChildWindow.cxx +++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx @@ -52,7 +52,8 @@ NavigatorChildWindow::NavigatorChildWindow ( SfxChildWinInfo* ) : SfxChildWindowContext( nId ) { - SdNavigatorWin* pNavWin = new SdNavigatorWin( + VclPtr<SdNavigatorWin> pNavWin = VclPtr<SdNavigatorWin>::Create( + pParent, this, SdResId( FLT_NAVIGATOR ), diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index 364a4dc47b4b..b004e766131a 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -56,13 +56,14 @@ PaneChildWindow::PaneChildWindow ( SfxChildAlignment eAlignment) : SfxChildWindow (pParentWindow, nId) { - pWindow = new PaneDockingWindow( + pWindow = VclPtr<PaneDockingWindow>::Create( + pBindings, this, pParentWindow, SD_RESSTR(nTitleBarResId)); eChildAlignment = eAlignment; - static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo); + static_cast<SfxDockingWindow*>(pWindow.get())->Initialize(pInfo); SetHideNotDelete(true); ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pBindings->GetDispatcher()->GetFrame()); @@ -75,7 +76,7 @@ PaneChildWindow::PaneChildWindow ( PaneChildWindow::~PaneChildWindow() { ViewShellBase* pBase = NULL; - PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow); + PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow.get()); if (pDockingWindow != NULL) pBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame()); diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index a3da722b97e5..ecf89cf9054f 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -76,6 +76,23 @@ SdPhotoAlbumDialog::SdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pAc SdPhotoAlbumDialog::~SdPhotoAlbumDialog() { + disposeOnce(); +} + +void SdPhotoAlbumDialog::dispose() +{ + pCancelBtn.clear(); + pCreateBtn.clear(); + pAddBtn.clear(); + pUpBtn.clear(); + pDownBtn.clear(); + pRemoveBtn.clear(); + pImagesLst.clear(); + pImg.clear(); + pInsTypeCombo.clear(); + pASRCheck.clear(); + pCapCheck.clear(); + ModalDialog::dispose(); } IMPL_LINK_NOARG(SdPhotoAlbumDialog, CancelHdl) @@ -88,8 +105,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) { if (pImagesLst->GetEntryCount() == 0) { - WarningBox aWarning(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING)); - aWarning.Execute(); + ScopedVclPtrInstance< WarningBox > aWarning(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING)); + aWarning->Execute(); } else { @@ -445,8 +462,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) } else { - InfoBox aInfo(this, OUString("Function is not implemented!")); - aInfo.Execute(); + ScopedVclPtrInstance< InfoBox > aInfo(this, OUString("Function is not implemented!")); + aInfo->Execute(); } EndDialog(); return 0; diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.hxx b/sd/source/ui/dlg/PhotoAlbumDialog.hxx index c7d12e47bcc8..44b1f5c97a1e 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.hxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.hxx @@ -46,25 +46,27 @@ class SdPhotoAlbumDialog : public ModalDialog public: SdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pActDoc); virtual ~SdPhotoAlbumDialog(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; private: static OUString sDirUrl; - CancelButton* pCancelBtn; - PushButton* pCreateBtn; + VclPtr<CancelButton> pCancelBtn; + VclPtr<PushButton> pCreateBtn; - PushButton* pAddBtn; - PushButton* pUpBtn; - PushButton* pDownBtn; - PushButton* pRemoveBtn; + VclPtr<PushButton> pAddBtn; + VclPtr<PushButton> pUpBtn; + VclPtr<PushButton> pDownBtn; + VclPtr<PushButton> pRemoveBtn; - ListBox* pImagesLst; - FixedImage* pImg; + VclPtr<ListBox> pImagesLst; + VclPtr<FixedImage> pImg; + + VclPtr<ListBox> pInsTypeCombo; + VclPtr<CheckBox> pASRCheck; + VclPtr<CheckBox> pCapCheck; - ListBox* pInsTypeCombo; - CheckBox* pASRCheck; - CheckBox* pCapCheck; SdDrawDocument* pDoc; GraphicFilter* mpGraphicFilter; diff --git a/sd/source/ui/dlg/RemoteDialog.cxx b/sd/source/ui/dlg/RemoteDialog.cxx index f9cd67cb8dad..62c9d3eaffe7 100644 --- a/sd/source/ui/dlg/RemoteDialog.cxx +++ b/sd/source/ui/dlg/RemoteDialog.cxx @@ -30,6 +30,19 @@ RemoteDialog::RemoteDialog( vcl::Window *pWindow ) m_pButtonClose->SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) ); } +RemoteDialog::~RemoteDialog() +{ + disposeOnce(); +} + +void RemoteDialog::dispose() +{ + m_pButtonConnect.clear(); + m_pButtonClose.clear(); + m_pClientBox.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton) { // setBusy( true ); diff --git a/sd/source/ui/dlg/RemoteDialog.hxx b/sd/source/ui/dlg/RemoteDialog.hxx index 7334c4bea548..3c936eb10a1a 100644 --- a/sd/source/ui/dlg/RemoteDialog.hxx +++ b/sd/source/ui/dlg/RemoteDialog.hxx @@ -24,14 +24,16 @@ namespace sd class RemoteDialog : public ModalDialog { private: - PushButton* m_pButtonConnect; - CloseButton* m_pButtonClose; - ClientBox* m_pClientBox; + VclPtr<PushButton> m_pButtonConnect; + VclPtr<CloseButton> m_pButtonClose; + VclPtr<ClientBox> m_pClientBox; DECL_DLLPRIVATE_LINK( HandleConnectButton, void * ); DECL_LINK( CloseHdl, void * ); public: RemoteDialog( vcl::Window* pWindow ); + virtual ~RemoteDialog(); + virtual void dispose() SAL_OVERRIDE; }; } diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx index c3f4ebafb86b..83abb22a0184 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx @@ -73,16 +73,16 @@ ClientBox::ClientBox( vcl::Window* pParent, WinBits nStyle ) : m_nTopIndex( 0 ), m_nActiveHeight( 0 ), m_nExtraHeight( 2 ), - m_aPinBox( this, 0 ), - m_aDeauthoriseButton( this ), - m_aScrollBar( this, WB_VERT ) + m_aPinBox( VclPtr<NumericBox>::Create( this, 0 ) ), + m_aDeauthoriseButton( VclPtr<PushButton>::Create( this ) ), + m_aScrollBar( VclPtr<ScrollBar>::Create( this, WB_VERT ) ) { - m_aScrollBar.SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) ); - m_aScrollBar.EnableDrag(); + m_aScrollBar->SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) ); + m_aScrollBar->EnableDrag(); - m_aPinBox.SetUseThousandSep(false); - m_aDeauthoriseButton.SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) ); - m_aDeauthoriseButton.SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) ); + m_aPinBox->SetUseThousandSep(false); + m_aDeauthoriseButton->SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) ); + m_aDeauthoriseButton->SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) ); SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) ); long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE; @@ -124,6 +124,11 @@ Size ClientBox::GetOptimalSize() const ClientBox::~ClientBox() { + disposeOnce(); +} + +void ClientBox::dispose() +{ if ( ! m_bInDelete ) DeleteRemoved(); @@ -132,6 +137,11 @@ ClientBox::~ClientBox() m_vEntries.clear(); m_xRemoveListener.clear(); + + m_aPinBox.disposeAndClear(); + m_aDeauthoriseButton.disposeAndClear(); + m_aScrollBar.disposeAndClear(); + Control::dispose(); } // Title + description @@ -152,7 +162,7 @@ void ClientBox::CalcActiveHeight( const long nPos ) // Text entry height Size aSize = GetOutputSizePixel(); if ( m_bHasScrollBar ) - aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar->GetSizePixel().Width(); aSize.Width() -= ICON_OFFSET; @@ -173,7 +183,7 @@ Rectangle ClientBox::GetEntryRect( const long nPos ) const Size aSize( GetOutputSizePixel() ); if ( m_bHasScrollBar ) - aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar->GetSizePixel().Width(); if ( m_vEntries[ nPos ]->m_bActive ) aSize.Height() = m_nActiveHeight; @@ -246,7 +256,7 @@ void ClientBox::selectEntry( const long nPos ) // We empty the pin box now too, just in case the user previously // entered a pin, but then changed their selected device. - m_aPinBox.SetText( "" ); + m_aPinBox->SetText( "" ); if ( m_bHasActive ) { bool bAlreadyAuthorised = @@ -254,11 +264,11 @@ void ClientBox::selectEntry( const long nPos ) if ( bAlreadyAuthorised ) { - m_aDeauthoriseButton.GetFocus(); + m_aDeauthoriseButton->GetFocus(); } else { - m_aPinBox.GetFocus(); + m_aPinBox->GetFocus(); } } @@ -350,19 +360,19 @@ void ClientBox::RecalcAll() Size aPBSize = LogicToPixel( Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ), MapMode( MAP_APPFONT ) ); - m_aPinBox.SetSizePixel( aPBSize ); - m_aDeauthoriseButton.SetSizePixel( m_aDeauthoriseButton.GetOptimalSize() ); + m_aPinBox->SetSizePixel( aPBSize ); + m_aDeauthoriseButton->SetSizePixel( m_aDeauthoriseButton->GetOptimalSize() ); if ( !m_bHasActive ) { - m_aPinBox.Show( false ); - m_aDeauthoriseButton.Show( false ); + m_aPinBox->Show( false ); + m_aDeauthoriseButton->Show( false ); } else { Rectangle aEntryRect = GetEntryRect( m_nActive ); - Size aPinBoxSize( m_aPinBox.GetSizePixel() ); + Size aPinBoxSize( m_aPinBox->GetSizePixel() ); Point aPos( aEntryRect.Left(), aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() ); @@ -378,7 +388,7 @@ void ClientBox::RecalcAll() aPos = Point( aEntryRect.Left() + GetTextWidth( sPinText ), aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() ); - m_aPinBox.SetPosPixel( aPos ); + m_aPinBox->SetPosPixel( aPos ); // The text would have it's TOP aligned with the top of // the pin box -- hence we push it down to align baselines. m_sPinTextRect += Point( 0, 4 ); @@ -386,11 +396,11 @@ void ClientBox::RecalcAll() else { aPos += Point( 20, 0 ); - m_aDeauthoriseButton.SetPosPixel( aPos ); + m_aDeauthoriseButton->SetPosPixel( aPos ); } - m_aPinBox.Show( !bAlreadyAuthorised ); - m_aDeauthoriseButton.Show( bAlreadyAuthorised ); + m_aPinBox->Show( !bAlreadyAuthorised ); + m_aDeauthoriseButton->Show( bAlreadyAuthorised ); if ( m_bAdjustActive ) { @@ -424,7 +434,7 @@ void ClientBox::RecalcAll() } if ( m_bHasScrollBar ) - m_aScrollBar.SetThumbPos( m_nTopIndex ); + m_aScrollBar->SetThumbPos( m_nTopIndex ); } } @@ -487,7 +497,7 @@ void ClientBox::Paint( const Rectangle &/*rPaintRect*/ ) Size aSize( GetOutputSizePixel() ); if ( m_bHasScrollBar ) - aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar->GetSizePixel().Width(); const ::osl::MutexGuard aGuard( m_entriesMutex ); @@ -525,20 +535,20 @@ void ClientBox::SetupScrollBar() if ( m_nTopIndex + aSize.Height() > nTotalHeight ) m_nTopIndex = nTotalHeight - aSize.Height(); - m_aScrollBar.SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), + m_aScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), Size( nScrBarSize, aSize.Height() ) ); - m_aScrollBar.SetRangeMax( nTotalHeight ); - m_aScrollBar.SetVisibleSize( aSize.Height() ); - m_aScrollBar.SetPageSize( ( aSize.Height() * 4 ) / 5 ); - m_aScrollBar.SetLineSize( m_nStdHeight ); - m_aScrollBar.SetThumbPos( m_nTopIndex ); + m_aScrollBar->SetRangeMax( nTotalHeight ); + m_aScrollBar->SetVisibleSize( aSize.Height() ); + m_aScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 ); + m_aScrollBar->SetLineSize( m_nStdHeight ); + m_aScrollBar->SetThumbPos( m_nTopIndex ); if ( !m_bHasScrollBar ) - m_aScrollBar.Show(); + m_aScrollBar->Show(); } else if ( m_bHasScrollBar ) { - m_aScrollBar.Hide(); + m_aScrollBar->Hide(); m_nTopIndex = 0; } @@ -567,7 +577,7 @@ long ClientBox::PointToPos( const Point& rPos ) OUString ClientBox::getPin() { - return OUString::number( m_aPinBox.GetValue() ); + return OUString::number( m_aPinBox->GetValue() ); } void ClientBox::MouseButtonDown( const MouseEvent& rMEvt ) @@ -608,11 +618,11 @@ bool ClientBox::Notify( NotifyEvent& rNEvt ) const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); if ( pData->GetMode() == CommandWheelMode::SCROLL ) { - long nThumbPos = m_aScrollBar.GetThumbPos(); + long nThumbPos = m_aScrollBar->GetThumbPos(); if ( pData->GetDelta() < 0 ) - m_aScrollBar.DoScroll( nThumbPos + m_nStdHeight ); + m_aScrollBar->DoScroll( nThumbPos + m_nStdHeight ); else - m_aScrollBar.DoScroll( nThumbPos - m_nStdHeight ); + m_aScrollBar->DoScroll( nThumbPos - m_nStdHeight ); bHandled = true; } } @@ -702,13 +712,13 @@ void ClientBox::populateEntries() void ClientBox::DoScroll( long nDelta ) { m_nTopIndex += nDelta; - Point aNewSBPt( m_aScrollBar.GetPosPixel() ); + Point aNewSBPt( m_aScrollBar->GetPosPixel() ); Rectangle aScrRect( Point(), GetOutputSizePixel() ); - aScrRect.Right() -= m_aScrollBar.GetSizePixel().Width(); + aScrRect.Right() -= m_aScrollBar->GetSizePixel().Width(); Scroll( 0, -nDelta, aScrRect ); - m_aScrollBar.SetPosPixel( aNewSBPt ); + m_aScrollBar->SetPosPixel( aNewSBPt ); } IMPL_LINK( ClientBox, ScrollHdl, ScrollBar*, pScrBar ) diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx index 1dc481ebd79a..63bf2db5a577 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx @@ -69,7 +69,7 @@ class ClientBox; class ClientRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener > { - ClientBox *m_pParent; + VclPtr<ClientBox> m_pParent; public: @@ -101,11 +101,11 @@ class ClientBox: Link m_aClickHdl; Link m_aDeauthoriseHdl; - NumericBox m_aPinBox; - PushButton m_aDeauthoriseButton; - Rectangle m_sPinTextRect; + VclPtr<NumericBox> m_aPinBox; + VclPtr<PushButton> m_aDeauthoriseButton; + Rectangle m_sPinTextRect; - ScrollBar m_aScrollBar; + VclPtr<ScrollBar> m_aScrollBar; com::sun::star::uno::Reference< ClientRemovedListener > m_xRemoveListener; @@ -136,7 +136,8 @@ class ClientBox: public: ClientBox( vcl::Window* pParent, WinBits nStyle ); - virtual ~ClientBox(); + virtual ~ClientBox(); + virtual void dispose() SAL_OVERRIDE; void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; void Paint( const Rectangle &rPaintRect ) SAL_OVERRIDE; diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 1eaf723dd3bd..272c2f6e16bd 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -158,7 +158,7 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW, get(m_pLbAdjustment, "alignment"); get(m_pBtnCreateGroup, "create"); - m_pCtlDisplay = new SdDisplay(get<Window>("box")); + m_pCtlDisplay = VclPtr<SdDisplay>::Create(get<Window>("box")); m_pCtlDisplay->set_hexpand(true); m_pCtlDisplay->set_vexpand(true); m_pCtlDisplay->Show(); @@ -206,6 +206,11 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW, AnimationWindow::~AnimationWindow() { + disposeOnce(); +} + +void AnimationWindow::dispose() +{ delete pControllerItem; for (size_t i = 0; i < m_FrameList.size(); ++i) @@ -219,7 +224,27 @@ AnimationWindow::~AnimationWindow() // delete the clones delete pMyDoc; - delete m_pCtlDisplay; + m_pCtlDisplay.disposeAndClear(); + m_pBtnFirst.clear(); + m_pBtnReverse.clear(); + m_pBtnStop.clear(); + m_pBtnPlay.clear(); + m_pBtnLast.clear(); + m_pNumFldBitmap.clear(); + m_pTimeField.clear(); + m_pLbLoopCount.clear(); + m_pBtnGetOneObject.clear(); + m_pBtnGetAllObjects.clear(); + m_pBtnRemoveBitmap.clear(); + m_pBtnRemoveAll.clear(); + m_pFiCount.clear(); + m_pRbtGroup.clear(); + m_pRbtBitmap.clear(); + m_pFtAdjustment.clear(); + m_pLbAdjustment.clear(); + m_pBtnCreateGroup.clear(); + pWin.clear(); + SfxDockingWindow::dispose(); } IMPL_LINK_NOARG(AnimationWindow, ClickFirstHdl) @@ -430,8 +455,8 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn ) } else // delete everything { - WarningBox aWarnBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) ); - short nReturn = aWarnBox.Execute(); + ScopedVclPtrInstance< WarningBox > aWarnBox( this, WB_YES_NO, SD_RESSTR( STR_ASK_DELETE_ALL_PICTURES ) ); + short nReturn = aWarnBox->Execute(); if( nReturn == RET_YES ) { @@ -523,23 +548,23 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls) static_cast<SdrObject*>(pPage->GetObj(m_nCurrentFrame)); if( pObject ) { - VirtualDevice aVD; + ScopedVclPtrInstance< VirtualDevice > pVD; Rectangle aObjRect( pObject->GetCurrentBoundRect() ); Size aObjSize( aObjRect.GetSize() ); Point aOrigin( Point( -aObjRect.Left(), -aObjRect.Top() ) ); - MapMode aMap( aVD.GetMapMode() ); + MapMode aMap( pVD->GetMapMode() ); aMap.SetMapUnit( MAP_100TH_MM ); aMap.SetOrigin( aOrigin ); - aVD.SetMapMode( aMap ); - aVD.SetOutputSize( aObjSize ); + pVD->SetMapMode( aMap ); + pVD->SetOutputSize( aObjSize ); const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); - aVD.SetBackground( Wallpaper( rStyles.GetFieldColor() ) ); - aVD.SetDrawMode( rStyles.GetHighContrastMode() + pVD->SetBackground( Wallpaper( rStyles.GetFieldColor() ) ); + pVD->SetDrawMode( rStyles.GetHighContrastMode() ? ViewShell::OUTPUT_DRAWMODE_CONTRAST : ViewShell::OUTPUT_DRAWMODE_COLOR ); - aVD.Erase(); - pObject->SingleObjectPainter( aVD ); - aBmp = BitmapEx( aVD.GetBitmap( aObjRect.TopLeft(), aObjSize ) ); + pVD->Erase(); + pObject->SingleObjectPainter( *pVD.get() ); + aBmp = BitmapEx( pVD->GetBitmap( aObjRect.TopLeft(), aObjSize ) ); } m_pCtlDisplay->SetBitmapEx(&aBmp); diff --git a/sd/source/ui/dlg/assclass.cxx b/sd/source/ui/dlg/assclass.cxx index e77375bb10a0..7049c5b10946 100644 --- a/sd/source/ui/dlg/assclass.cxx +++ b/sd/source/ui/dlg/assclass.cxx @@ -86,8 +86,8 @@ bool Assistent::GotoPage(const int nPageToGo) { int nIndex=mnCurrentPage-1; - std::vector<vcl::Window*>::iterator iter = maPages[nIndex].begin(); - std::vector<vcl::Window*>::iterator iterEnd = maPages[nIndex].end(); + auto iter = maPages[nIndex].begin(); + auto iterEnd = maPages[nIndex].end(); for(; iter != iterEnd; ++iter) { diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx index ce7448d5caa2..eff19c5f365f 100644 --- a/sd/source/ui/dlg/brkdlg.cxx +++ b/sd/source/ui/dlg/brkdlg.cxx @@ -67,8 +67,20 @@ BreakDlg::BreakDlg( BreakDlg::~BreakDlg() { + disposeOnce(); +} + +void BreakDlg::dispose() +{ delete mpProgress; + mpProgress = NULL; delete pProgrInfo; + pProgrInfo = NULL; + m_pFiObjInfo.clear(); + m_pFiActInfo.clear(); + m_pFiInsInfo.clear(); + m_pBtnCancel.clear(); + SfxModalDialog::dispose(); } // Control-Handler for cancel button @@ -93,8 +105,8 @@ IMPL_LINK( BreakDlg, UpDate, void*, nInit ) // update status bar or show a error message? if(nInit == reinterpret_cast<void*>(1L)) { - MessageDialog aErrBox(this, SD_RESSTR(STR_BREAK_FAIL)); - aErrBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrBox(this, SD_RESSTR(STR_BREAK_FAIL)); + aErrBox->Execute(); } else { diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index c0b9b05f0b02..b87f58e0908c 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -84,30 +84,23 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, CopyDlg::~CopyDlg() { - OUString& rStr = GetExtraData(); - - rStr = OUString::number(m_pNumFldCopies->GetValue()); - rStr += OUString(TOKEN); - - rStr += OUString::number(m_pMtrFldMoveX->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldMoveY->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldAngle->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldWidth->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number(m_pMtrFldHeight->GetValue()); - rStr += OUString( TOKEN ); - - rStr += OUString::number( m_pLbStartColor->GetSelectEntryColor().GetColor() ); - rStr += OUString( TOKEN ); + disposeOnce(); +} - rStr += OUString::number( m_pLbEndColor->GetSelectEntryColor().GetColor() ); +void CopyDlg::dispose() +{ + m_pNumFldCopies.clear(); + m_pBtnSetViewData.clear(); + m_pMtrFldMoveX.clear(); + m_pMtrFldMoveY.clear(); + m_pMtrFldAngle.clear(); + m_pMtrFldWidth.clear(); + m_pMtrFldHeight.clear(); + m_pLbStartColor.clear(); + m_pFtEndColor.clear(); + m_pLbEndColor.clear(); + m_pBtnSetDefault.clear(); + SfxModalDialog::dispose(); } /** diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index 45355fee5ad7..8de00aa58c42 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -85,6 +85,21 @@ SdCustomShowDlg::SdCustomShowDlg( vcl::Window* pWindow, SdCustomShowDlg::~SdCustomShowDlg() { + disposeOnce(); +} + +void SdCustomShowDlg::dispose() +{ + m_pLbCustomShows.clear(); + m_pCbxUseCustomShow.clear(); + m_pBtnNew.clear(); + m_pBtnEdit.clear(); + m_pBtnRemove.clear(); + m_pBtnCopy.clear(); + m_pBtnHelp.clear(); + m_pBtnStartShow.clear(); + m_pBtnOK.clear(); + ModalDialog::dispose(); } void SdCustomShowDlg::CheckState() @@ -111,8 +126,8 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) if( p == m_pBtnNew ) { pCustomShow = NULL; - SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow ); - if( aDlg.Execute() == RET_OK ) + ScopedVclPtrInstance< SdDefineCustomShowDlg > aDlg( this, rDoc, pCustomShow ); + if( aDlg->Execute() == RET_OK ) { if( pCustomShow ) { @@ -125,7 +140,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) m_pLbCustomShows->SelectEntry( pCustomShow->GetName() ); } - if( aDlg.IsModified() ) + if( aDlg->IsModified() ) bModified = true; } else if( pCustomShow ) @@ -139,9 +154,9 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) { DBG_ASSERT( pCustomShowList, "pCustomShowList does not exist" ); pCustomShow = (*pCustomShowList)[ nPos ]; - SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow ); + ScopedVclPtrInstance< SdDefineCustomShowDlg > aDlg( this, rDoc, pCustomShow ); - if( aDlg.Execute() == RET_OK ) + if( aDlg->Execute() == RET_OK ) { if( pCustomShow ) { @@ -151,7 +166,7 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p ) m_pLbCustomShows->InsertEntry( pCustomShow->GetName(), nPos ); m_pLbCustomShows->SelectEntryPos( nPos ); } - if( aDlg.IsModified() ) + if( aDlg->IsModified() ) bModified = true; } } @@ -336,6 +351,20 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg( vcl::Window* pWindow, SdDefineCustomShowDlg::~SdDefineCustomShowDlg() { + disposeOnce(); +} + +void SdDefineCustomShowDlg::dispose() +{ + m_pEdtName.clear(); + m_pLbPages.clear(); + m_pBtnAdd.clear(); + m_pBtnRemove.clear(); + m_pLbCustomPages.clear(); + m_pBtnOK.clear(); + m_pBtnCancel.clear(); + m_pBtnHelp.clear(); + ModalDialog::dispose(); } // CheckState diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx index 41c2754c2a4f..e2307ac7c2c8 100644 --- a/sd/source/ui/dlg/diactrl.cxx +++ b/sd/source/ui/dlg/diactrl.cxx @@ -132,9 +132,9 @@ void SdTbxCtlDiaPages::StateChanged( sal_uInt16, } } -vcl::Window* SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent ) { - return new SdPagesField( pParent, m_xFrame ); + return VclPtrInstance<SdPagesField>( pParent, m_xFrame ).get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index 98df35d60900..69219b06c354 100644 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -101,8 +101,8 @@ public: void Enable (bool bEnable); private: - PushButton* mpNextButton1; - PushButton* mpNextButton2; + VclPtr<PushButton> mpNextButton1; + VclPtr<PushButton> mpNextButton2; bool mbIsFirstButtonActive; }; @@ -160,7 +160,7 @@ public: */ bool mbPreviewUpdating; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; void SavePassword( SfxObjectShellLock xDoc, const OUString& rPath ); void RestorePassword( SfxItemSet* pSet, const OUString& rPath ); @@ -247,74 +247,74 @@ public: // Common Assistent maAssistentFunc; - CheckBox* mpPreviewFlag; - CheckBox* mpStartWithFlag; - PushButton* mpLastPageButton; - NextButton* mpNextPageButton; - PushButton* mpFinishButton; - SdDocPreviewWin* mpPreview; - VclContainer* mpPage1235; + VclPtr<CheckBox> mpPreviewFlag; + VclPtr<CheckBox> mpStartWithFlag; + VclPtr<PushButton> mpLastPageButton; + NextButton* mpNextPageButton; + VclPtr<PushButton> mpFinishButton; + VclPtr<SdDocPreviewWin> mpPreview; + VclPtr<VclContainer> mpPage1235; // page 1 - VclContainer* mpPage1; - FixedImage* mpPage1FB; - FixedText* mpPage1ArtFL; - RadioButton* mpPage1EmptyRB; - RadioButton* mpPage1TemplateRB; - ListBox* mpPage1RegionLB; - ListBox* mpPage1TemplateLB; - RadioButton* mpPage1OpenRB; - ListBox* mpPage1OpenLB; - PushButton* mpPage1OpenPB; + VclPtr<VclContainer> mpPage1; + VclPtr<FixedImage> mpPage1FB; + VclPtr<FixedText> mpPage1ArtFL; + VclPtr<RadioButton> mpPage1EmptyRB; + VclPtr<RadioButton> mpPage1TemplateRB; + VclPtr<ListBox> mpPage1RegionLB; + VclPtr<ListBox> mpPage1TemplateLB; + VclPtr<RadioButton> mpPage1OpenRB; + VclPtr<ListBox> mpPage1OpenLB; + VclPtr<PushButton> mpPage1OpenPB; // page 2 - VclContainer* mpPage2; - FixedImage* mpPage2FB; - FixedText* mpPage2LayoutFL; - ListBox* mpPage2RegionLB; - ListBox* mpPage2LayoutLB; - FixedText* mpPage2OutTypesFL; - RadioButton* mpPage2Medium1RB; - RadioButton* mpPage2Medium2RB; - RadioButton* mpPage2Medium3RB; - RadioButton* mpPage2Medium4RB; - RadioButton* mpPage2Medium5RB; - RadioButton* mpPage2Medium6RB; + VclPtr<VclContainer> mpPage2; + VclPtr<FixedImage> mpPage2FB; + VclPtr<FixedText> mpPage2LayoutFL; + VclPtr<ListBox> mpPage2RegionLB; + VclPtr<ListBox> mpPage2LayoutLB; + VclPtr<FixedText> mpPage2OutTypesFL; + VclPtr<RadioButton> mpPage2Medium1RB; + VclPtr<RadioButton> mpPage2Medium2RB; + VclPtr<RadioButton> mpPage2Medium3RB; + VclPtr<RadioButton> mpPage2Medium4RB; + VclPtr<RadioButton> mpPage2Medium5RB; + VclPtr<RadioButton> mpPage2Medium6RB; // page 3 - VclContainer* mpPage3; - FixedImage* mpPage3FB; - FixedText* mpPage3EffectFL; - FixedText* mpPage3EffectFT; - FadeEffectLB* mpPage3EffectLB; - FixedText* mpPage3SpeedFT; - ListBox* mpPage3SpeedLB; - FixedText* mpPage3PresTypeFL; - RadioButton* mpPage3PresTypeLiveRB; - RadioButton* mpPage3PresTypeKioskRB; - FixedText* mpPage3PresTimeFT; - TimeField* mpPage3PresTimeTMF; - FixedText* mpPage3BreakFT; - TimeField* mpPage3BreakTMF; - CheckBox* mpPage3LogoCB; + VclPtr<VclContainer> mpPage3; + VclPtr<FixedImage> mpPage3FB; + VclPtr<FixedText> mpPage3EffectFL; + VclPtr<FixedText> mpPage3EffectFT; + VclPtr<FadeEffectLB> mpPage3EffectLB; + VclPtr<FixedText> mpPage3SpeedFT; + VclPtr<ListBox> mpPage3SpeedLB; + VclPtr<FixedText> mpPage3PresTypeFL; + VclPtr<RadioButton> mpPage3PresTypeLiveRB; + VclPtr<RadioButton> mpPage3PresTypeKioskRB; + VclPtr<FixedText> mpPage3PresTimeFT; + VclPtr<TimeField> mpPage3PresTimeTMF; + VclPtr<FixedText> mpPage3BreakFT; + VclPtr<TimeField> mpPage3BreakTMF; + VclPtr<CheckBox> mpPage3LogoCB; // page 4 - VclContainer* mpPage4; - FixedImage* mpPage4FB; - FixedText* mpPage4PersonalFL; - FixedText* mpPage4AskNameFT; - Edit* mpPage4AskNameEDT; - FixedText* mpPage4AskTopicFT; - Edit* mpPage4AskTopicEDT; - FixedText* mpPage4AskInfoFT; - VclMultiLineEdit* mpPage4AskInfoEDT; + VclPtr<VclContainer> mpPage4; + VclPtr<FixedImage> mpPage4FB; + VclPtr<FixedText> mpPage4PersonalFL; + VclPtr<FixedText> mpPage4AskNameFT; + VclPtr<Edit> mpPage4AskNameEDT; + VclPtr<FixedText> mpPage4AskTopicFT; + VclPtr<Edit> mpPage4AskTopicEDT; + VclPtr<FixedText> mpPage4AskInfoFT; + VclPtr<VclMultiLineEdit> mpPage4AskInfoEDT; // page 5 - VclContainer* mpPage5; - FixedImage* mpPage5FB; - FixedText* mpPage5PageListFT; - SdPageListControl* mpPage5PageListCT; - CheckBox* mpPage5SummaryCB; + VclPtr<VclContainer> mpPage5; + VclPtr<FixedImage> mpPage5FB; + VclPtr<FixedText> mpPage5PageListFT; + VclPtr<SdPageListControl> mpPage5PageListCT; + VclPtr<CheckBox> mpPage5SummaryCB; }; @@ -1769,7 +1769,13 @@ IMPL_LINK_NOARG(AssistentDlg, FinishHdl) AssistentDlg::~AssistentDlg() { + disposeOnce(); +} + +void AssistentDlg::dispose() +{ delete mpImpl; + ModalDialog::dispose(); } SfxObjectShellLock AssistentDlg::GetDocument() diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx index 5eaab0185c9f..652a2b232c26 100644 --- a/sd/source/ui/dlg/dlgassim.cxx +++ b/sd/source/ui/dlg/dlgassim.cxx @@ -78,7 +78,13 @@ IMPL_LINK_NOARG(SdPageListControl, CheckButtonClickHdl) SdPageListControl::~SdPageListControl() { + disposeOnce(); +} + +void SdPageListControl::dispose() +{ delete m_pCheckButton; + SvTreeListBox::dispose(); } void SdPageListControl::Clear() diff --git a/sd/source/ui/dlg/dlgassim.hxx b/sd/source/ui/dlg/dlgassim.hxx index 8e966f856323..ee39788cb136 100644 --- a/sd/source/ui/dlg/dlgassim.hxx +++ b/sd/source/ui/dlg/dlgassim.hxx @@ -37,6 +37,7 @@ private: public: SdPageListControl( vcl::Window* pParent, const WinBits nStyle ); virtual ~SdPageListControl(); + virtual void dispose() SAL_OVERRIDE; void Fill( SdDrawDocument* pDoc ); void Clear(); diff --git a/sd/source/ui/dlg/dlgctrls.cxx b/sd/source/ui/dlg/dlgctrls.cxx index 10923287ac1b..cb9df95d7261 100644 --- a/sd/source/ui/dlg/dlgctrls.cxx +++ b/sd/source/ui/dlg/dlgctrls.cxx @@ -40,7 +40,13 @@ FadeEffectLB::FadeEffectLB(vcl::Window* pParent, WinBits nStyle) FadeEffectLB::~FadeEffectLB() { + disposeOnce(); +} + +void FadeEffectLB::dispose() +{ delete mpImpl; + ListBox::dispose(); } void FadeEffectLB::Fill() diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx index 64e4d476baa7..7927f4d9f54a 100644 --- a/sd/source/ui/dlg/dlgfield.cxx +++ b/sd/source/ui/dlg/dlgfield.cxx @@ -53,6 +53,21 @@ SdModifyFieldDlg::SdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pI FillControls(); } +SdModifyFieldDlg::~SdModifyFieldDlg() +{ + disposeOnce(); +} + +void SdModifyFieldDlg::dispose() +{ + m_pRbtFix.clear(); + m_pRbtVar.clear(); + m_pLbLanguage.clear(); + m_pLbFormat.clear(); + ModalDialog::dispose(); +} + + /** * Returns the new field, owned by caller. * Returns NULL if nothing has changed. diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx index c3a77103b247..2582ca25c534 100644 --- a/sd/source/ui/dlg/dlgolbul.cxx +++ b/sd/source/ui/dlg/dlgolbul.cxx @@ -138,7 +138,13 @@ OutlineBulletDlg::OutlineBulletDlg( OutlineBulletDlg::~OutlineBulletDlg() { + disposeOnce(); +} + +void OutlineBulletDlg::dispose() +{ delete pOutputSet; + SfxTabDialog::dispose(); } void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx index 07d6e2c2886d..aed2a1059f4a 100644 --- a/sd/source/ui/dlg/dlgsnap.cxx +++ b/sd/source/ui/dlg/dlgsnap.cxx @@ -111,6 +111,25 @@ SdSnapLineDlg::SdSnapLineDlg( m_pRbPoint->Check(); } +SdSnapLineDlg::~SdSnapLineDlg() +{ + disposeOnce(); +} + +void SdSnapLineDlg::dispose() +{ + m_pFtX.clear(); + m_pMtrFldX.clear(); + m_pFtY.clear(); + m_pMtrFldY.clear(); + m_pRadioGroup.clear(); + m_pRbPoint.clear(); + m_pRbVert.clear(); + m_pRbHorz.clear(); + m_pBtnDelete.clear(); + ModalDialog::dispose(); +} + /** * fills provided item sets with dialog box attributes */ diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx index e3f9a2a394c5..e0895092d7fb 100644 --- a/sd/source/ui/dlg/docprev.cxx +++ b/sd/source/ui/dlg/docprev.cxx @@ -83,7 +83,13 @@ SdDocPreviewWin::SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle ) SdDocPreviewWin::~SdDocPreviewWin() { + disposeOnce(); +} + +void SdDocPreviewWin::dispose() +{ delete pMetaFile; + Control::dispose(); } Size SdDocPreviewWin::GetOptimalSize() const @@ -235,17 +241,17 @@ void SdDocPreviewWin::updateViewSettings() pMtf = new GDIMetaFile; - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; const Fraction aFrac( pDoc->GetScaleFraction() ); const MapMode aMap( pDoc->GetScaleUnit(), Point(), aFrac, aFrac ); - aVDev.SetMapMode( aMap ); + pVDev->SetMapMode( aMap ); // Disable output, as we only want to record a metafile - aVDev.EnableOutput( false ); + pVDev->EnableOutput( false ); - pMtf->Record( &aVDev ); + pMtf->Record( pVDev ); ::sd::DrawView* pView = new ::sd::DrawView(pDocShell, this, NULL); @@ -261,18 +267,18 @@ void SdDocPreviewWin::updateViewSettings() const Rectangle aClipRect( aNewOrg, aNewSize ); MapMode aVMap( aMap ); - aVDev.Push(); + pVDev->Push(); aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) ); - aVDev.SetRelativeMapMode( aVMap ); - aVDev.IntersectClipRegion( aClipRect ); + pVDev->SetRelativeMapMode( aVMap ); + pVDev->IntersectClipRegion( aClipRect ); // Use new StandardCheckVisisbilityRedirector StandardCheckVisisbilityRedirector aRedirector; const Rectangle aRedrawRectangle = Rectangle( Point(), aNewSize ); vcl::Region aRedrawRegion(aRedrawRectangle); - pView->SdrPaintView::CompleteRedraw(&aVDev,aRedrawRegion,&aRedirector); + pView->SdrPaintView::CompleteRedraw(pVDev,aRedrawRegion,&aRedirector); - aVDev.Pop(); + pVDev->Pop(); pMtf->Stop(); pMtf->WindStart(); diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx index b21f7104b53c..181dd7af049f 100644 --- a/sd/source/ui/dlg/gluectrl.cxx +++ b/sd/source/ui/dlg/gluectrl.cxx @@ -160,14 +160,12 @@ void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId, SfxToolBoxControl::StateChanged( nSId, eState, pState ); } -vcl::Window* SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent ) { if( GetSlotId() == SID_GLUE_ESCDIR ) - { - return new GlueEscDirLB( pParent, m_xFrame ); - } + return VclPtr<GlueEscDirLB>::Create( pParent, m_xFrame ).get(); - return NULL; + return VclPtr<vcl::Window>(); } /** diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index e7590357f67e..84d0da17bd27 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -115,29 +115,29 @@ class HeaderFooterTabPage : public TabPage { private: - FixedText* mpFTIncludeOn; + VclPtr<FixedText> mpFTIncludeOn; - CheckBox* mpCBHeader; - VclContainer* mpHeaderBox; - Edit* mpTBHeader; + VclPtr<CheckBox> mpCBHeader; + VclPtr<VclContainer> mpHeaderBox; + VclPtr<Edit> mpTBHeader; - CheckBox* mpCBDateTime; - RadioButton* mpRBDateTimeFixed; - RadioButton* mpRBDateTimeAutomatic; - Edit* mpTBDateTimeFixed; - ListBox* mpCBDateTimeFormat; - FixedText* mpFTDateTimeLanguage; - SvxLanguageBox* mpCBDateTimeLanguage; + VclPtr<CheckBox> mpCBDateTime; + VclPtr<RadioButton> mpRBDateTimeFixed; + VclPtr<RadioButton> mpRBDateTimeAutomatic; + VclPtr<Edit> mpTBDateTimeFixed; + VclPtr<ListBox> mpCBDateTimeFormat; + VclPtr<FixedText> mpFTDateTimeLanguage; + VclPtr<SvxLanguageBox> mpCBDateTimeLanguage; - CheckBox* mpCBFooter; - VclContainer* mpFooterBox; - Edit* mpTBFooter; + VclPtr<CheckBox> mpCBFooter; + VclPtr<VclContainer> mpFooterBox; + VclPtr<Edit> mpTBFooter; - CheckBox* mpCBSlideNumber; + VclPtr<CheckBox> mpCBSlideNumber; - CheckBox* mpCBNotOnTitle; + VclPtr<CheckBox> mpCBNotOnTitle; - PresLayoutPreview* mpCTPreview; + VclPtr<PresLayoutPreview> mpCTPreview; SdDrawDocument* mpDoc; LanguageType meOldLanguage; @@ -155,6 +155,7 @@ private: public: HeaderFooterTabPage( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); virtual ~HeaderFooterTabPage(); + virtual void dispose() SAL_OVERRIDE; void init( const HeaderFooterSettings& rSettings, bool bNotOnTitle ); void getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle ); @@ -198,7 +199,7 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar mpTabCtrl->Show(); mnSlidesId = mpTabCtrl->GetPageId("slides"); - mpSlideTabPage = new HeaderFooterTabPage( mpTabCtrl, pDoc, pSlide, false ); + mpSlideTabPage = VclPtr<HeaderFooterTabPage>::Create( mpTabCtrl, pDoc, pSlide, false ); mpTabCtrl->SetTabPage( mnSlidesId, mpSlideTabPage ); Size aSiz = mpSlideTabPage->GetSizePixel(); @@ -211,7 +212,7 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar } mnNotesId = mpTabCtrl->GetPageId("notes"); - mpNotesHandoutsTabPage = new HeaderFooterTabPage( mpTabCtrl, pDoc, pNotes, true ); + mpNotesHandoutsTabPage = VclPtr<HeaderFooterTabPage>::Create( mpTabCtrl, pDoc, pNotes, true ); mpTabCtrl->SetTabPage( mnNotesId, mpNotesHandoutsTabPage ); get(maPBApplyToAll, "apply_all" ); @@ -240,8 +241,18 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar HeaderFooterDialog::~HeaderFooterDialog() { - delete mpSlideTabPage; - delete mpNotesHandoutsTabPage; + disposeOnce(); +} + +void HeaderFooterDialog::dispose() +{ + mpSlideTabPage.disposeAndClear(); + mpNotesHandoutsTabPage.disposeAndClear(); + mpTabCtrl.clear(); + maPBApplyToAll.clear(); + maPBApply.clear(); + maPBCancel.clear(); + TabDialog::dispose(); } IMPL_LINK( HeaderFooterDialog, ActivatePageHdl, TabControl *, pTabCtrl ) @@ -451,6 +462,29 @@ HeaderFooterTabPage::HeaderFooterTabPage( vcl::Window* pWindow, SdDrawDocument* HeaderFooterTabPage::~HeaderFooterTabPage() { + disposeOnce(); +} + +void HeaderFooterTabPage::dispose() +{ + mpFTIncludeOn.clear(); + mpCBHeader.clear(); + mpHeaderBox.clear(); + mpTBHeader.clear(); + mpCBDateTime.clear(); + mpRBDateTimeFixed.clear(); + mpRBDateTimeAutomatic.clear(); + mpTBDateTimeFixed.clear(); + mpCBDateTimeFormat.clear(); + mpFTDateTimeLanguage.clear(); + mpCBDateTimeLanguage.clear(); + mpCBFooter.clear(); + mpFooterBox.clear(); + mpTBFooter.clear(); + mpCBSlideNumber.clear(); + mpCBNotOnTitle.clear(); + mpCTPreview.clear(); + TabPage::dispose(); } IMPL_LINK_NOARG(HeaderFooterTabPage, LanguageChangeHdl) diff --git a/sd/source/ui/dlg/ins_paste.cxx b/sd/source/ui/dlg/ins_paste.cxx index a256990697e0..ad9e9821e4e0 100644 --- a/sd/source/ui/dlg/ins_paste.cxx +++ b/sd/source/ui/dlg/ins_paste.cxx @@ -28,6 +28,18 @@ SdInsertPasteDlg::SdInsertPasteDlg(vcl::Window* pWindow) m_pRbAfter->Check( true ); } +SdInsertPasteDlg::~SdInsertPasteDlg() +{ + disposeOnce(); +} + +void SdInsertPasteDlg::dispose() +{ + m_pRbBefore.clear(); + m_pRbAfter.clear(); + ModalDialog::dispose(); +} + bool SdInsertPasteDlg::IsInsertBefore() const { return( m_pRbBefore->IsChecked() ); diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx index 5593562947c1..c77ba67a4c40 100644 --- a/sd/source/ui/dlg/inspagob.cxx +++ b/sd/source/ui/dlg/inspagob.cxx @@ -55,6 +55,15 @@ SdInsertPagesObjsDlg::SdInsertPagesObjsDlg( SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg() { + disposeOnce(); +} + +void SdInsertPagesObjsDlg::dispose() +{ + m_pLbTree.clear(); + m_pCbxLink.clear(); + m_pCbxMasters.clear(); + ModalDialog::dispose(); } /** diff --git a/sd/source/ui/dlg/layeroptionsdlg.cxx b/sd/source/ui/dlg/layeroptionsdlg.cxx index 86df27c22cb1..a1e5d7f1a03b 100644 --- a/sd/source/ui/dlg/layeroptionsdlg.cxx +++ b/sd/source/ui/dlg/layeroptionsdlg.cxx @@ -50,6 +50,22 @@ SdInsertLayerDlg::SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInA get<VclContainer>("nameframe")->Enable(bDeletable); } +SdInsertLayerDlg::~SdInsertLayerDlg() +{ + disposeOnce(); +} + +void SdInsertLayerDlg::dispose() +{ + m_pEdtName.clear(); + m_pEdtTitle.clear(); + m_pEdtDesc.clear(); + m_pCbxVisible.clear(); + m_pCbxPrintable.clear(); + m_pCbxLocked.clear(); + ModalDialog::dispose(); +} + void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs ) { rAttrs.Put( SdAttrLayerName( m_pEdtName->GetText() ) ); diff --git a/sd/source/ui/dlg/masterlayoutdlg.cxx b/sd/source/ui/dlg/masterlayoutdlg.cxx index d10f8224ad8b..e1cce5c63ec6 100644 --- a/sd/source/ui/dlg/masterlayoutdlg.cxx +++ b/sd/source/ui/dlg/masterlayoutdlg.cxx @@ -75,6 +75,21 @@ MasterLayoutDialog::MasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pD mpCBPageNumber->Check( mbOldPageNumber ); } +MasterLayoutDialog::~MasterLayoutDialog() +{ + disposeOnce(); +} + +void MasterLayoutDialog::dispose() +{ + mpCBDate.clear(); + mpCBPageNumber.clear(); + mpCBSlideNumber.clear(); + mpCBHeader.clear(); + mpCBFooter.clear(); + ModalDialog::dispose(); +} + short MasterLayoutDialog::Execute() { if ( ModalDialog::Execute() ) diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx index db55129d3f8a..ebd28b18dad1 100644 --- a/sd/source/ui/dlg/morphdlg.cxx +++ b/sd/source/ui/dlg/morphdlg.cxx @@ -66,6 +66,15 @@ MorphDlg::MorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObjec MorphDlg::~MorphDlg() { + disposeOnce(); +} + +void MorphDlg::dispose() +{ + m_pMtfSteps.clear(); + m_pCbxAttributes.clear(); + m_pCbxOrientation.clear(); + ModalDialog::dispose(); } void MorphDlg::LoadSettings() diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index 21fa0d9998d6..a37b13015a77 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -68,9 +68,9 @@ SdNavigatorWin::SdNavigatorWin( SfxBindings* pInBindings, const UpdateRequestFunctor& rUpdateRequest) : vcl::Window( pParent, rSdResId ) - , maToolbox ( this, SdResId( 1 ) ) - , maTlbObjects( this, SdResId( TLB_OBJECTS ) ) - , maLbDocs ( this, SdResId( LB_DOCS ) ) + , maToolbox ( VclPtr<ToolBox>::Create( this, SdResId( 1 ) ) ) + , maTlbObjects( VclPtr<SdPageObjsTLB>::Create( this, SdResId( TLB_OBJECTS ) ) ) + , maLbDocs ( VclPtr<ListBox>::Create( this, SdResId( LB_DOCS ) ) ) , mpChildWinContext( pChWinCtxt ) , mbDocImported ( false ) // On changes of the DragType: adjust SelectionMode of TLB! @@ -78,58 +78,58 @@ SdNavigatorWin::SdNavigatorWin( , mpBindings ( pInBindings ) , maImageList ( SdResId( IL_NAVIGATR ) ) { - maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); + maTlbObjects->SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); FreeResource(); - maTlbObjects.SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE)); + maTlbObjects->SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE)); mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest); mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest); ApplyImageList(); // load images *before* calculating sizes to get something useful !!! - Size aTbxSize( maToolbox.CalcWindowSizePixel() ); - maToolbox.SetOutputSizePixel( aTbxSize ); - maToolbox.SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) ); - maToolbox.SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) ); - maToolbox.SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) ); - maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY ); + Size aTbxSize( maToolbox->CalcWindowSizePixel() ); + maToolbox->SetOutputSizePixel( aTbxSize ); + maToolbox->SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) ); + maToolbox->SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) ); + maToolbox->SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) ); + maToolbox->SetItemBits( TBI_DRAGTYPE, maToolbox->GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY ); // Shape filter drop down menu. - maToolbox.SetItemBits( + maToolbox->SetItemBits( TBI_SHAPE_FILTER, - maToolbox.GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY); + maToolbox->GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY); // TreeListBox // set position below toolbox - long nListboxYPos = maToolbox.GetPosPixel().Y() + maToolbox.GetSizePixel().Height() + 4; - maTlbObjects.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); - maTlbObjects.SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) ); - maTlbObjects.SetSelectionMode( SINGLE_SELECTION ); + long nListboxYPos = maToolbox->GetPosPixel().Y() + maToolbox->GetSizePixel().Height() + 4; + maTlbObjects->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + maTlbObjects->SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) ); + maTlbObjects->SetSelectionMode( SINGLE_SELECTION ); // set focus to listbox, otherwise it is in the toolbox which is only useful // for keyboard navigation - maTlbObjects.GrabFocus(); - maTlbObjects.SetSdNavigatorWinFlag(true); + maTlbObjects->GrabFocus(); + maTlbObjects->SetSdNavigatorWinFlag(true); // DragTypeListBox - maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) ); + maLbDocs->SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) ); // set position below treelistbox - nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4; - maLbDocs.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + nListboxYPos = maTlbObjects->GetPosPixel().Y() + maTlbObjects->GetSizePixel().Height() + 4; + maLbDocs->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); // assure that tool box is at least as wide as the tree list box { - const Size aTlbSize( maTlbObjects.GetOutputSizePixel() ); + const Size aTlbSize( maTlbObjects->GetOutputSizePixel() ); if ( aTlbSize.Width() > aTbxSize.Width() ) { - maToolbox.setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH ); - aTbxSize = maToolbox.GetOutputSizePixel(); + maToolbox->setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH ); + aTbxSize = maToolbox->GetOutputSizePixel(); } } // set min outputsize after all sizes are known - const long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4; + const long nFullHeight = nListboxYPos + maLbDocs->GetSizePixel().Height() + 4; maSize = GetOutputSizePixel(); if( maSize.Height() < nFullHeight ) { @@ -137,7 +137,7 @@ SdNavigatorWin::SdNavigatorWin( SetOutputSizePixel( maSize ); } maMinSize = maSize; - const long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox + const long nMinWidth = 2*maToolbox->GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox if( nMinWidth > maMinSize.Width() ) maMinSize.Width() = nMinWidth; maMinSize.Height() -= 40; @@ -152,8 +152,17 @@ SdNavigatorWin::SdNavigatorWin( SdNavigatorWin::~SdNavigatorWin() { + disposeOnce(); +} + +void SdNavigatorWin::dispose() +{ delete mpNavigatorCtrlItem; delete mpPageNameCtrlItem; + maToolbox.disposeAndClear(); + maTlbObjects.disposeAndClear(); + maLbDocs.disposeAndClear(); + vcl::Window::dispose(); } //when object is marked , fresh the corresponding entry tree . @@ -163,17 +172,17 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc ) sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh(); OUString aDocShName( pDocShell->GetName() ); OUString aDocName = pDocShell->GetMedium()->GetName(); - maTlbObjects.SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385 - maTlbObjects.Clear(); - maTlbObjects.Fill( pDoc, false, aDocName ); // Nur normale Seiten - maTlbObjects.SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385 + maTlbObjects->SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385 + maTlbObjects->Clear(); + maTlbObjects->Fill( pDoc, false, aDocName ); // Nur normale Seiten + maTlbObjects->SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385 RefreshDocumentLB(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SelectEntry( aDocShName ); } void SdNavigatorWin::FreshEntry( ) { - maTlbObjects.FreshCurEntry(); + maTlbObjects->FreshCurEntry(); } void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc ) @@ -189,35 +198,35 @@ void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc ) { ::sd::FrameView* pFrameView = pViewShell->GetFrameView(); if (pFrameView != NULL) - maTlbObjects.SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false); + maTlbObjects->SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false); } // Disable the shape filter drop down menu when there is a running slide // show. if (pViewShell!=NULL && sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() )) - maToolbox.EnableItem(TBI_SHAPE_FILTER, false); + maToolbox->EnableItem(TBI_SHAPE_FILTER, false); else - maToolbox.EnableItem(TBI_SHAPE_FILTER); + maToolbox->EnableItem(TBI_SHAPE_FILTER); - if( !maTlbObjects.IsEqualToDoc( pDoc ) ) + if( !maTlbObjects->IsEqualToDoc( pDoc ) ) { OUString aDocName = pDocShell->GetMedium()->GetName(); - maTlbObjects.Clear(); - maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages + maTlbObjects->Clear(); + maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages RefreshDocumentLB(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SelectEntry( aDocShName ); } else { - maLbDocs.SetNoSelection(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SetNoSelection(); + maLbDocs->SelectEntry( aDocShName ); // commented in order to fix 30246 -// if( maLbDocs.GetSelectEntryCount() == 0 ) +// if( maLbDocs->GetSelectEntryCount() == 0 ) { RefreshDocumentLB(); - maLbDocs.SelectEntry( aDocShName ); + maLbDocs->SelectEntry( aDocShName ); } } @@ -235,7 +244,7 @@ NavigatorDragType SdNavigatorWin::GetNavigatorDragType() NavigatorDragType eDT = meDragType; NavDocInfo* pInfo = GetDocInfo(); - if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) ) + if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() ) ) eDT = NAVIGATOR_DRAGTYPE_NONE; return eDT; @@ -252,7 +261,7 @@ sd::DrawDocShell* SdNavigatorWin::GetDrawDocShell( const SdDrawDocument* pDoc ) IMPL_LINK_NOARG(SdNavigatorWin, SelectToolboxHdl) { - sal_uInt16 nId = maToolbox.GetCurItemId(); + sal_uInt16 nId = maToolbox->GetCurItemId(); sal_uInt16 nSId = 0; PageJump ePage = PAGE_NONE; @@ -307,7 +316,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickToolboxHdl) IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) { - sal_uInt16 nId = maToolbox.GetCurItemId(); + sal_uInt16 nId = maToolbox->GetCurItemId(); switch( nId ) { @@ -339,7 +348,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) } NavDocInfo* pInfo = GetDocInfo(); - if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) + if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() ) { pMenu->EnableItem( NAVIGATOR_DRAGTYPE_LINK, false ); pMenu->EnableItem( NAVIGATOR_DRAGTYPE_URL, false ); @@ -349,7 +358,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) pMenu->CheckItem( (sal_uInt16)meDragType ); pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, MenuSelectHdl ) ); - pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); + pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); pBox->EndSelection(); delete pMenu; } @@ -366,13 +375,13 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) nShowAllShapesFilter, SD_RESSTR(STR_NAVIGATOR_SHOW_ALL_SHAPES)); - if (maTlbObjects.GetShowAllShapes()) + if (maTlbObjects->GetShowAllShapes()) pMenu->CheckItem(nShowAllShapesFilter); else pMenu->CheckItem(nShowNamedShapesFilter); pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, ShapeFilterCallback ) ); - pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); + pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN ); pBox->EndSelection(); delete pMenu; } @@ -383,14 +392,14 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox ) IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl) { - if( !mbDocImported || maLbDocs.GetSelectEntryPos() != 0 ) + if( !mbDocImported || maLbDocs->GetSelectEntryPos() != 0 ) { NavDocInfo* pInfo = GetDocInfo(); // if it is the active window, we jump to the page if( pInfo && pInfo->IsActive() ) { - OUString aStr( maTlbObjects.GetSelectEntry() ); + OUString aStr( maTlbObjects->GetSelectEntry() ); if( !aStr.isEmpty() ) { @@ -398,7 +407,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl) mpBindings->GetDispatcher()->Execute( SID_NAVIGATOR_OBJECT, SfxCallMode::SLOT | SfxCallMode::RECORD, &aItem, 0L ); //set sign variable - maTlbObjects.MarkCurEntry(aStr); + maTlbObjects->MarkCurEntry(aStr); // moved here from SetGetFocusHdl. Reset the // focus only if something has been selected in the @@ -419,8 +428,8 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl) IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl) { - OUString aStrLb = maLbDocs.GetSelectEntry(); - long nPos = maLbDocs.GetSelectEntryPos(); + OUString aStrLb = maLbDocs->GetSelectEntry(); + long nPos = maLbDocs->GetSelectEntryPos(); bool bFound = false; ::sd::DrawDocShell* pDocShell = NULL; NavDocInfo* pInfo = GetDocInfo(); @@ -441,18 +450,18 @@ IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl) if( bFound ) { SdDrawDocument* pDoc = pDocShell->GetDoc(); - if( !maTlbObjects.IsEqualToDoc( pDoc ) ) + if( !maTlbObjects->IsEqualToDoc( pDoc ) ) { SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... ::sd::DrawDocShell* pNCDocShell = pNonConstDoc->GetDocSh(); OUString aDocName = pNCDocShell->GetMedium()->GetName(); - maTlbObjects.Clear(); - maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages + maTlbObjects->Clear(); + maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages } } // check if link or url is possible - if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) ) + if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) ) { meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED; SetDragImage(); @@ -484,13 +493,13 @@ IMPL_LINK( SdNavigatorWin, MenuSelectHdl, Menu *, pMenu ) if( meDragType == NAVIGATOR_DRAGTYPE_URL ) { // patch, prevents endless loop - if( maTlbObjects.GetSelectionCount() > 1 ) - maTlbObjects.SelectAll( false ); + if( maTlbObjects->GetSelectionCount() > 1 ) + maTlbObjects->SelectAll( false ); - maTlbObjects.SetSelectionMode( SINGLE_SELECTION ); + maTlbObjects->SetSelectionMode( SINGLE_SELECTION ); } else - maTlbObjects.SetSelectionMode( MULTIPLE_SELECTION ); + maTlbObjects->SetSelectionMode( MULTIPLE_SELECTION ); } } return 0; @@ -500,7 +509,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu ) { if (pMenu != NULL) { - bool bShowAllShapes (maTlbObjects.GetShowAllShapes()); + bool bShowAllShapes (maTlbObjects->GetShowAllShapes()); sal_uInt16 nMenuId (pMenu->GetCurItemId()); switch (nMenuId) { @@ -518,7 +527,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu ) break; } - maTlbObjects.SetShowAllShapes(bShowAllShapes, true); + maTlbObjects->SetShowAllShapes(bShowAllShapes, true); // Remember the selection in the FrameView. NavDocInfo* pInfo = GetDocInfo(); @@ -554,26 +563,26 @@ void SdNavigatorWin::Resize() aDiffSize.Height() = aWinSize.Height() - maSize.Height(); // change size of Toolbox - Size aObjSize( maToolbox.GetOutputSizePixel() ); + Size aObjSize( maToolbox->GetOutputSizePixel() ); aObjSize.Width() += aDiffSize.Width(); - maToolbox.SetOutputSizePixel( aObjSize ); + maToolbox->SetOutputSizePixel( aObjSize ); // change size of TreeLB - aObjSize = maTlbObjects.GetSizePixel(); + aObjSize = maTlbObjects->GetSizePixel(); aObjSize.Width() += aDiffSize.Width(); - aObjSize.Height() = maLbDocs.GetPosPixel().Y() + aDiffSize.Height() - - maTlbObjects.GetPosPixel().Y() - 4; - maTlbObjects.SetSizePixel( aObjSize ); + aObjSize.Height() = maLbDocs->GetPosPixel().Y() + aDiffSize.Height() - + maTlbObjects->GetPosPixel().Y() - 4; + maTlbObjects->SetSizePixel( aObjSize ); Point aPt( 0, aDiffSize.Height() ); // move other controls (DocumentLB) - maLbDocs.Hide(); - aObjSize = maLbDocs.GetOutputSizePixel(); + maLbDocs->Hide(); + aObjSize = maLbDocs->GetOutputSizePixel(); aObjSize.Width() += aDiffSize.Width(); - maLbDocs.SetPosPixel( maLbDocs.GetPosPixel() + aPt ); - maLbDocs.SetOutputSizePixel( aObjSize ); - maLbDocs.Show(); + maLbDocs->SetPosPixel( maLbDocs->GetPosPixel() + aPt ); + maLbDocs->SetOutputSizePixel( aObjSize ); + maLbDocs->Show(); maSize = aWinSize; } @@ -623,19 +632,19 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName) if (pMedium->IsStorage()) { // Now depending on mode: - // maTlbObjects.SetSelectionMode(MULTIPLE_SELECTION); + // maTlbObjects->SetSelectionMode(MULTIPLE_SELECTION); // handover of ownership of pMedium; - SdDrawDocument* pDropDoc = maTlbObjects.GetBookmarkDoc(pMedium); + SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(pMedium); if (pDropDoc) { - maTlbObjects.Clear(); + maTlbObjects->Clear(); maDropFileName = aFileName; - if( !maTlbObjects.IsEqualToDoc( pDropDoc ) ) + if( !maTlbObjects->IsEqualToDoc( pDropDoc ) ) { // only normal pages - maTlbObjects.Fill(pDropDoc, false, maDropFileName); + maTlbObjects->Fill(pDropDoc, false, maDropFileName); RefreshDocumentLB( &maDropFileName ); } } @@ -662,28 +671,28 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) if( pDocName ) { if( mbDocImported ) - maLbDocs.RemoveEntry( 0 ); + maLbDocs->RemoveEntry( 0 ); - maLbDocs.InsertEntry( *pDocName, 0 ); + maLbDocs->InsertEntry( *pDocName, 0 ); mbDocImported = true; } else { - nPos = maLbDocs.GetSelectEntryPos(); + nPos = maLbDocs->GetSelectEntryPos(); if( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = 0; OUString aStr; if( mbDocImported ) - aStr = maLbDocs.GetEntry( 0 ); + aStr = maLbDocs->GetEntry( 0 ); - maLbDocs.Clear(); + maLbDocs->Clear(); // delete list of DocInfos maDocList.clear(); if( mbDocImported ) - maLbDocs.InsertEntry( aStr, 0 ); + maLbDocs->InsertEntry( aStr, 0 ); ::sd::DrawDocShell* pCurrentDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); @@ -707,7 +716,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) // is shown in url notation! aStr = pDocShell->GetName(); - maLbDocs.InsertEntry( aStr, LISTBOX_APPEND ); + maLbDocs->InsertEntry( aStr, LISTBOX_APPEND ); if( pDocShell == pCurrentDocShell ) aInfo.SetActive(); @@ -719,7 +728,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName ) pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0, false ); } } - maLbDocs.SelectEntryPos( nPos ); + maLbDocs->SelectEntryPos( nPos ); } sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImage ) @@ -741,7 +750,7 @@ sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImag NavDocInfo* SdNavigatorWin::GetDocInfo() { - sal_uInt32 nPos = maLbDocs.GetSelectEntryPos(); + sal_uInt32 nPos = maLbDocs->GetSelectEntryPos(); if( mbDocImported ) { @@ -834,14 +843,14 @@ void SdNavigatorWin::DataChanged( const DataChangedEvent& rDCEvt ) void SdNavigatorWin::SetDragImage() { - maToolbox.SetItemImage( TBI_DRAGTYPE, maToolbox.GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) ); + maToolbox->SetItemImage( TBI_DRAGTYPE, maToolbox->GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) ); } void SdNavigatorWin::ApplyImageList() { - maToolbox.SetImageList( maImageList ); - maToolbox.SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC)))); + maToolbox->SetImageList( maImageList ); + maToolbox->SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC)))); SetDragImage(); } @@ -871,17 +880,17 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, // pen if( nState & NAVBTN_PEN_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PEN ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PEN ); if( nState & NAVBTN_PEN_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PEN, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PEN, false ); if( nState & NAVBTN_PEN_CHECKED && - !pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) ) - pNavigatorWin->maToolbox.CheckItem( TBI_PEN ); + !pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) ) + pNavigatorWin->maToolbox->CheckItem( TBI_PEN ); if( nState & NAVBTN_PEN_UNCHECKED && - pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) ) - pNavigatorWin->maToolbox.CheckItem( TBI_PEN, false ); + pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) ) + pNavigatorWin->maToolbox->CheckItem( TBI_PEN, false ); // only if doc in LB is the active NavDocInfo* pInfo = pNavigatorWin->GetDocInfo(); @@ -889,35 +898,35 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, { // First if( nState & NAVBTN_FIRST_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_FIRST ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_FIRST ); if( nState & NAVBTN_FIRST_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_FIRST, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_FIRST, false ); // Prev if( nState & NAVBTN_PREV_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS ); if( nState & NAVBTN_PREV_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS, false ); // Last if( nState & NAVBTN_LAST_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_LAST ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_LAST ); if( nState & NAVBTN_LAST_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_LAST, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_LAST, false ); // Next if( nState & NAVBTN_NEXT_ENABLED && - !pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_NEXT ); + !pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_NEXT ); if( nState & NAVBTN_NEXT_DISABLED && - pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) ) - pNavigatorWin->maToolbox.EnableItem( TBI_NEXT, false ); + pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) ) + pNavigatorWin->maToolbox->EnableItem( TBI_NEXT, false ); if( nState & NAVTLB_UPDATE ) { @@ -956,14 +965,14 @@ void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId, DBG_ASSERT( pStateItem, "SfxStringItem expected"); OUString aPageName = pStateItem->GetValue(); - if( !pNavigatorWin->maTlbObjects.HasSelectedChildren( aPageName ) ) + if( !pNavigatorWin->maTlbObjects->HasSelectedChildren( aPageName ) ) { - if( pNavigatorWin->maTlbObjects.GetSelectionMode() == MULTIPLE_SELECTION ) + if( pNavigatorWin->maTlbObjects->GetSelectionMode() == MULTIPLE_SELECTION ) { // because otherwise it is always additional select - pNavigatorWin->maTlbObjects.SelectAll( false ); + pNavigatorWin->maTlbObjects->SelectAll( false ); } - pNavigatorWin->maTlbObjects.SelectEntry( aPageName ); + pNavigatorWin->maTlbObjects->SelectEntry( aPageName ); } } } diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx index 53fb0adb873e..29bc961a7e41 100644 --- a/sd/source/ui/dlg/paragr.cxx +++ b/sd/source/ui/dlg/paragr.cxx @@ -39,17 +39,18 @@ class SdParagraphNumTabPage : public SfxTabPage public: SdParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SdParagraphNumTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges(); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; private: - TriStateBox* m_pNewStartCB; - TriStateBox* m_pNewStartNumberCB; - NumericField* m_pNewStartNF; + VclPtr<TriStateBox> m_pNewStartCB; + VclPtr<TriStateBox> m_pNewStartNumberCB; + VclPtr<NumericField> m_pNewStartNF; bool mbModified; DECL_LINK( ImplNewStartHdl, void* ); @@ -72,11 +73,20 @@ SdParagraphNumTabPage::SdParagraphNumTabPage(vcl::Window* pParent, const SfxItem SdParagraphNumTabPage::~SdParagraphNumTabPage() { + disposeOnce(); } -SfxTabPage* SdParagraphNumTabPage::Create(vcl::Window *pParent, const SfxItemSet * rAttrSet) +void SdParagraphNumTabPage::dispose() { - return new SdParagraphNumTabPage( pParent, *rAttrSet ); + m_pNewStartCB.clear(); + m_pNewStartNumberCB.clear(); + m_pNewStartNF.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SdParagraphNumTabPage::Create(vcl::Window *pParent, const SfxItemSet * rAttrSet) +{ + return VclPtr<SdParagraphNumTabPage>::Create( pParent, *rAttrSet ); } const sal_uInt16* SdParagraphNumTabPage::GetRanges() diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx index c4b95a9d2458..bd635ad96676 100644 --- a/sd/source/ui/dlg/present.cxx +++ b/sd/source/ui/dlg/present.cxx @@ -150,6 +150,39 @@ SdStartPresentationDlg::SdStartPresentationDlg( vcl::Window* pWindow, ChangePauseHdl( NULL ); } +SdStartPresentationDlg::~SdStartPresentationDlg() +{ + disposeOnce(); +} + +void SdStartPresentationDlg::dispose() +{ + aRbtAll.clear(); + aRbtAtDia.clear(); + aRbtCustomshow.clear(); + aLbDias.clear(); + aLbCustomshow.clear(); + aRbtStandard.clear(); + aRbtWindow.clear(); + aRbtAuto.clear(); + aTmfPause.clear(); + aCbxAutoLogo.clear(); + aCbxManuel.clear(); + aCbxMousepointer.clear(); + aCbxPen.clear(); + aCbxNavigator.clear(); + aCbxAnimationAllowed.clear(); + aCbxChangePage.clear(); + aCbxAlwaysOnTop.clear(); + maFtMonitor.clear(); + maLBMonitor.clear(); + msMonitor.clear(); + msAllMonitors.clear(); + msMonitorExternal.clear(); + msExternal.clear(); + ModalDialog::dispose(); +} + OUString SdStartPresentationDlg::GetDisplayName( sal_Int32 nDisplay, DisplayType eType ) { diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx index e2330f9f6b2f..42a02cc15734 100644 --- a/sd/source/ui/dlg/prltempl.cxx +++ b/sd/source/ui/dlg/prltempl.cxx @@ -223,7 +223,13 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, SdPresLayoutTemplateDlg::~SdPresLayoutTemplateDlg() { + disposeOnce(); +} + +void SdPresLayoutTemplateDlg::dispose() +{ delete pOutSet; + SfxTabDialog::dispose(); } void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx index 943144be7a53..3785de353d1f 100644 --- a/sd/source/ui/dlg/prntopts.cxx +++ b/sd/source/ui/dlg/prntopts.cxx @@ -30,7 +30,7 @@ */ SdPrintOptions::SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : SfxTabPage ( pParent, "prntopts" , "modules/simpress/ui/prntopts.ui" , &rInAttrs ), - rOutAttrs ( rInAttrs ) + rOutAttrs ( rInAttrs ) { get( m_pFrmContent , "contentframe" ); get( m_pCbxDraw , "drawingcb" ); @@ -74,6 +74,31 @@ SdPrintOptions::SdPrintOptions( vcl::Window* pParent, const SfxItemSet& rInAttrs SdPrintOptions::~SdPrintOptions() { + disposeOnce(); +} + +void SdPrintOptions::dispose() +{ + m_pFrmContent.clear(); + m_pCbxDraw.clear(); + m_pCbxNotes.clear(); + m_pCbxHandout.clear(); + m_pCbxOutline.clear(); + m_pRbtColor.clear(); + m_pRbtGrayscale.clear(); + m_pRbtBlackWhite.clear(); + m_pCbxPagename.clear(); + m_pCbxDate.clear(); + m_pCbxTime.clear(); + m_pCbxHiddenPages.clear(); + m_pRbtDefault.clear(); + m_pRbtPagesize.clear(); + m_pRbtPagetile.clear(); + m_pRbtBooklet.clear(); + m_pCbxFront.clear(); + m_pCbxBack.clear(); + m_pCbxPaperbin.clear(); + SfxTabPage::dispose(); } bool SdPrintOptions::FillItemSet( SfxItemSet* rAttrs ) @@ -182,10 +207,10 @@ void SdPrintOptions::Reset( const SfxItemSet* rAttrs ) ClickBookletHdl( NULL ); } -SfxTabPage* SdPrintOptions::Create( vcl::Window* pWindow, - const SfxItemSet* rOutAttrs ) +VclPtr<SfxTabPage> SdPrintOptions::Create( vcl::Window* pWindow, + const SfxItemSet* rOutAttrs ) { - return( new SdPrintOptions( pWindow, *rOutAttrs ) ); + return VclPtr<SdPrintOptions>::Create( pWindow, *rOutAttrs ); } IMPL_LINK( SdPrintOptions, ClickCheckboxHdl, CheckBox *, pCbx ) diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 8e5c87a381d3..ad902b933e38 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -121,37 +121,37 @@ OUString SdAbstractTabDialog_Impl::GetText() const void AbstractBulletDialog_Impl::SetCurPageId( sal_uInt16 nId ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( nId ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( nId ); } void AbstractBulletDialog_Impl::SetCurPageId( const OString& rName ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetCurPageId( rName ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( rName ); } const SfxItemSet* AbstractBulletDialog_Impl::GetOutputItemSet() const { - return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetOutputItemSet(); + return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetOutputItemSet(); } const sal_uInt16* AbstractBulletDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) { - return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetInputRanges( pItem ); + return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetInputRanges( pItem ); } void AbstractBulletDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetInputSet( pInSet ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetInputSet( pInSet ); } void AbstractBulletDialog_Impl::SetText( const OUString& rStr ) { - static_cast< ::sd::OutlineBulletDlg*>(pDlg)->SetText( rStr ); + static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetText( rStr ); } OUString AbstractBulletDialog_Impl::GetText() const { - return static_cast< ::sd::OutlineBulletDlg*>(pDlg)->GetText(); + return static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->GetText(); } void SdPresLayoutTemplateDlg_Impl::SetCurPageId( sal_uInt16 nId ) @@ -391,47 +391,47 @@ AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg( AbstractSdCustomShowDlg * SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg( vcl::Window* pWindow, SdDrawDocument& rDrawDoc ) { - return new AbstractSdCustomShowDlg_Impl( new SdCustomShowDlg( pWindow, rDrawDoc ) ); + return new AbstractSdCustomShowDlg_Impl( VclPtr<SdCustomShowDlg>::Create( pWindow, rDrawDoc ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabCharDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ) { - return new SdAbstractTabDialog_Impl( new SdCharDlg( pParent, pAttr, pDocShell ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdCharDlg>::Create( pParent, pAttr, pDocShell ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabPageDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage ) { - return new SdAbstractTabDialog_Impl( new SdPageDlg( pDocShell, pParent, pAttr, bAreaPage ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdPageDlg>::Create( pDocShell, pParent, pAttr, bAreaPage ) ); } AbstractAssistentDlg * SdAbstractDialogFactory_Impl::CreateAssistentDlg( vcl::Window* pParent, bool bAutoPilot) { - return new AbstractAssistentDlg_Impl( new AssistentDlg( pParent, bAutoPilot ) ); + return new AbstractAssistentDlg_Impl( VclPtr<AssistentDlg>::Create( pParent, bAutoPilot ) ); } AbstractSdModifyFieldDlg * SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) { - return new AbstractSdModifyFieldDlg_Impl( new SdModifyFieldDlg( pWindow, pInField, rSet ) ); + return new AbstractSdModifyFieldDlg_Impl( VclPtr<SdModifyFieldDlg>::Create( pWindow, pInField, rSet ) ); } AbstractSdSnapLineDlg * SdAbstractDialogFactory_Impl::CreateSdSnapLineDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView) { - return new AbstractSdSnapLineDlg_Impl( new SdSnapLineDlg( pWindow, rInAttrs, pView ) ); + return new AbstractSdSnapLineDlg_Impl( VclPtr<SdSnapLineDlg>::Create( pWindow, rInAttrs, pView ) ); } AbstractSdInsertLayerDlg * SdAbstractDialogFactory_Impl::CreateSdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr ) { - return new AbstractSdInsertLayerDlg_Impl( new SdInsertLayerDlg( pWindow, rInAttrs, bDeletable, aStr ) ); + return new AbstractSdInsertLayerDlg_Impl( VclPtr<SdInsertLayerDlg>::Create( pWindow, rInAttrs, bDeletable, aStr ) ); } AbstractSdInsertPasteDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPasteDlg( vcl::Window* pWindow ) { - return new AbstractSdInsertPasteDlg_Impl( new SdInsertPasteDlg( pWindow ) ); + return new AbstractSdInsertPasteDlg_Impl( VclPtr<SdInsertPasteDlg>::Create( pWindow ) ); } AbstractSdInsertPagesObjsDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg( vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) { - return new AbstractSdInsertPagesObjsDlg_Impl( new SdInsertPagesObjsDlg( pParent, pDoc, pSfxMedium, rFileName ) ); + return new AbstractSdInsertPagesObjsDlg_Impl( VclPtr<SdInsertPagesObjsDlg>::Create( pParent, pDoc, pSfxMedium, rFileName ) ); } AbstractMorphDlg * SdAbstractDialogFactory_Impl::CreateMorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) @@ -446,13 +446,13 @@ SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDl SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg( vcl::Window* pParent, const SfxItemSet* pAttr ) { - return new SdAbstractTabDialog_Impl( new SdParagraphDlg( pParent, pAttr ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdParagraphDlg>::Create( pParent, pAttr ) ); } AbstractSdStartPresDlg * SdAbstractDialogFactory_Impl::CreateSdStartPresentationDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList ) { - return new AbstractSdStartPresDlg_Impl( new SdStartPresentationDlg( pWindow, rInAttrs, rPageNames, pCSList ) ); + return new AbstractSdStartPresDlg_Impl( VclPtr<SdStartPresentationDlg>::Create( pWindow, rInAttrs, rPageNames, pCSList ) ); } VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateRemoteDialog( vcl::Window* pWindow ) @@ -462,32 +462,32 @@ VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateRemoteDialog( vcl::Windo SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, const SdResId& DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool ) { - return new SdPresLayoutTemplateDlg_Impl( new SdPresLayoutTemplateDlg( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) ); + return new SdPresLayoutTemplateDlg_Impl( VclPtr<SdPresLayoutTemplateDlg>::Create( pDocSh, pParent, DlgId, rStyleBase, ePO, pSSPool ) ); } AbstractSdPresLayoutDlg * SdAbstractDialogFactory_Impl::CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, vcl::Window* pWindow, const SfxItemSet& rInAttrs) { - return new AbstractSdPresLayoutDlg_Impl( new SdPresLayoutDlg( pDocShell, pWindow, rInAttrs ) ); + return new AbstractSdPresLayoutDlg_Impl( VclPtr<SdPresLayoutDlg>::Create( pDocShell, pWindow, rInAttrs ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdTabTemplateDlg( vcl::Window* pParent, const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView ) { - return new SdAbstractTabDialog_Impl( new SdTabTemplateDlg( pParent, pDocShell, rStyleBase, pModel, pView ) ); + return new SdAbstractTabDialog_Impl( VclPtr<SdTabTemplateDlg>::Create( pParent, pDocShell, rStyleBase, pModel, pView ) ); } SfxAbstractDialog* SdAbstractDialogFactory_Impl::CreatSdActionDialog( vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) { - return new SdAbstractSfxDialog_Impl( new SdActionDlg( pParent, pAttr, pView ) ); + return new SdAbstractSfxDialog_Impl( VclPtr<SdActionDlg>::Create( pParent, pAttr, pView ) ); } AbstractSdVectorizeDlg * SdAbstractDialogFactory_Impl::CreateSdVectorizeDlg( vcl::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ) { - return new AbstractSdVectorizeDlg_Impl( new SdVectorizeDlg( pParent, rBmp, pDocShell ) ); + return new AbstractSdVectorizeDlg_Impl( VclPtr<SdVectorizeDlg>::Create( pParent, rBmp, pDocShell ) ); } AbstractSdPublishingDlg * SdAbstractDialogFactory_Impl::CreateSdPublishingDlg( vcl::Window* pWindow, DocumentType eDocType) { - return new AbstractSdPublishingDlg_Impl( new SdPublishingDlg( pWindow, eDocType ) ); + return new AbstractSdPublishingDlg_Impl( VclPtr<SdPublishingDlg>::Create( pWindow, eDocType ) ); } // Factories for TabPages diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 38d6d1e4c1e7..3ba9b486d787 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -23,7 +23,7 @@ #include <sfx2/basedlgs.hxx> #define DECL_ABSTDLG_BASE(Class,DialogClass) \ - DialogClass* pDlg; \ + ScopedVclPtr<DialogClass> pDlg; \ public: \ Class( DialogClass* p) \ : pDlg(p) \ @@ -34,7 +34,6 @@ public: \ #define IMPL_ABSTDLG_BASE(Class) \ Class::~Class() \ { \ - delete pDlg; \ } \ short Class::Execute() \ { \ diff --git a/sd/source/ui/dlg/sdpreslt.cxx b/sd/source/ui/dlg/sdpreslt.cxx index 21d8a89afb6f..51206936dd07 100644 --- a/sd/source/ui/dlg/sdpreslt.cxx +++ b/sd/source/ui/dlg/sdpreslt.cxx @@ -55,6 +55,16 @@ SdPresLayoutDlg::SdPresLayoutDlg(::sd::DrawDocShell* pDocShell, SdPresLayoutDlg::~SdPresLayoutDlg() { + disposeOnce(); +} + +void SdPresLayoutDlg::dispose() +{ + m_pVS.clear(); + m_pCbxMasterPage.clear(); + m_pCbxCheckMasters.clear(); + m_pBtnLoad.clear(); + ModalDialog::dispose(); } /** @@ -169,7 +179,7 @@ IMPL_LINK_NOARG(SdPresLayoutDlg, ClickLayoutHdl) */ IMPL_LINK_NOARG(SdPresLayoutDlg, ClickLoadHdl) { - boost::scoped_ptr<SfxNewFileDialog> pDlg(new SfxNewFileDialog(this, SFXWB_PREVIEW)); + VclPtrInstance< SfxNewFileDialog > pDlg(this, SFXWB_PREVIEW); pDlg->SetText(SD_RESSTR(STR_LOAD_PRESENTATION_LAYOUT)); if(!IsReallyVisible()) diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 0a96dd736de3..5e358bf35578 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -255,11 +255,19 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle ) SdPageObjsTLB::~SdPageObjsTLB() { + disposeOnce(); +} + +void SdPageObjsTLB::dispose() +{ if ( mpBookmarkDoc ) CloseBookmarkDoc(); else // no document was created from mpMedium, so this object is still the owner of it delete mpMedium; + mpParent.clear(); + mpDropNavWin.clear(); + SvTreeListBox::dispose(); } // helper function for GetEntryAltText and GetEntryLongDescription @@ -1004,8 +1012,8 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed) if ( !mpBookmarkDoc ) { - MessageDialog aErrorBox(this, SD_RESSTR(STR_READ_DATA_ERROR)); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SD_RESSTR(STR_READ_DATA_ERROR)); + aErrorBox->Execute(); mpMedium = 0; //On failure the SfxMedium is invalid } } @@ -1343,7 +1351,7 @@ sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt ) OUString aFile; if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, aFile ) && - static_cast<SdNavigatorWin*>(mpParent)->InsertFile( aFile ) ) + static_cast<SdNavigatorWin*>(mpParent.get())->InsertFile( aFile ) ) { nRet = rEvt.mnAction; } diff --git a/sd/source/ui/dlg/sduiexp.cxx b/sd/source/ui/dlg/sduiexp.cxx index 3c526380a538..84127950fcd2 100644 --- a/sd/source/ui/dlg/sduiexp.cxx +++ b/sd/source/ui/dlg/sduiexp.cxx @@ -18,6 +18,21 @@ */ #include "sddlgfact.hxx" +#include "morphdlg.hxx" +#include "present.hxx" +#include "inspagob.hxx" +#include "vectdlg.hxx" +#include "sdpreslt.hxx" +#include "headerfooterdlg.hxx" +#include "pubdlg.hxx" +#include "ins_paste.hxx" +#include "layeroptionsdlg.hxx" +#include "dlgsnap.hxx" +#include "dlgfield.hxx" +#include "dlgass.hxx" +#include "prltempl.hxx" +#include "custsdlg.hxx" +#include "copydlg.hxx" #include "sal/types.h" extern "C" diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 253e7142aa34..e038120c6a00 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -83,12 +83,12 @@ SdActionDlg::SdActionDlg ( , rOutAttrs(*pAttr) { // FreeResource(); - SfxTabPage* pNewPage = SdTPAction::Create(get_content_area(), rOutAttrs); + VclPtr<SfxTabPage> pNewPage = SdTPAction::Create(get_content_area(), rOutAttrs); assert(pNewPage); //Unable to create page // formerly in PageCreated - static_cast<SdTPAction*>( pNewPage )->SetView( pView ); - static_cast<SdTPAction*>( pNewPage )->Construct(); + static_cast<SdTPAction*>( pNewPage.get() )->SetView( pView ); + static_cast<SdTPAction*>( pNewPage.get() )->Construct(); SetTabPage( pNewPage ); } @@ -142,6 +142,25 @@ SdTPAction::SdTPAction(vcl::Window* pWindow, const SfxItemSet& rInAttrs) SdTPAction::~SdTPAction() { + disposeOnce(); +} + +void SdTPAction::dispose() +{ + m_pLbAction.clear(); + m_pFtTree.clear(); + m_pLbTree.clear(); + m_pLbTreeDocument.clear(); + m_pLbOLEAction.clear(); + m_pFrame.clear(); + m_pEdtSound.clear(); + m_pEdtBookmark.clear(); + m_pEdtDocument.clear(); + m_pEdtProgram.clear(); + m_pEdtMacro.clear(); + m_pBtnSearch.clear(); + m_pBtnSeek.clear(); + SfxTabPage::dispose(); } void SdTPAction::SetView( const ::sd::View* pSdView ) @@ -359,10 +378,10 @@ SfxTabPage::sfxpg SdTPAction::DeactivatePage( SfxItemSet* pPageSet ) return LEAVE_PAGE; } -SfxTabPage* SdTPAction::Create( vcl::Window* pWindow, - const SfxItemSet& rAttrs ) +VclPtr<SfxTabPage> SdTPAction::Create( vcl::Window* pWindow, + const SfxItemSet& rAttrs ) { - return new SdTPAction( pWindow, rAttrs ); + return VclPtr<SdTPAction>::Create( pWindow, rAttrs ); } void SdTPAction::UpdateTree() diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index cc69f5e8627a..35c5cb3435af 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -99,10 +99,10 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs ) pCbxRotate->GetClickHdl().Call(0); } -SfxTabPage* SdTpOptionsSnap::Create( vcl::Window* pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SdTpOptionsSnap::Create( vcl::Window* pWindow, + const SfxItemSet* rAttrs ) { - return new SdTpOptionsSnap( pWindow, *rAttrs ); + return VclPtr<SdTpOptionsSnap>::Create( pWindow, *rAttrs ); } /************************************************************************* @@ -122,6 +122,16 @@ SdTpOptionsContents::SdTpOptionsContents( vcl::Window* pParent, const SfxItemSet SdTpOptionsContents::~SdTpOptionsContents() { + disposeOnce(); +} + +void SdTpOptionsContents::dispose() +{ + m_pCbxRuler.clear(); + m_pCbxDragStripes.clear(); + m_pCbxHandlesBezier.clear(); + m_pCbxMoveOutline.clear(); + SfxTabPage::dispose(); } bool SdTpOptionsContents::FillItemSet( SfxItemSet* rAttrs ) @@ -165,10 +175,10 @@ void SdTpOptionsContents::Reset( const SfxItemSet* rAttrs ) m_pCbxHandlesBezier->SaveValue(); } -SfxTabPage* SdTpOptionsContents::Create( vcl::Window* pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SdTpOptionsContents::Create( vcl::Window* pWindow, + const SfxItemSet* rAttrs ) { - return new SdTpOptionsContents( pWindow, *rAttrs ); + return VclPtr<SdTpOptionsContents>::Create( pWindow, *rAttrs ); } /************************************************************************* @@ -276,6 +286,38 @@ SdTpOptionsMisc::SdTpOptionsMisc(vcl::Window* pParent, const SfxItemSet& rInAttr SdTpOptionsMisc::~SdTpOptionsMisc() { + disposeOnce(); +} + +void SdTpOptionsMisc::dispose() +{ + m_pCbxQuickEdit.clear(); + m_pCbxPickThrough.clear(); + m_pNewDocumentFrame.clear(); + m_pCbxStartWithTemplate.clear(); + m_pCbxMasterPageCache.clear(); + m_pCbxCopy.clear(); + m_pCbxMarkedHitMovesAlways.clear(); + m_pPresentationFrame.clear(); + m_pLbMetric.clear(); + m_pMtrFldTabstop.clear(); + m_pCbxEnableSdremote.clear(); + m_pCbxEnablePresenterScreen.clear(); + m_pCbxUsePrinterMetrics.clear(); + m_pCbxCompatibility.clear(); + m_pScaleFrame.clear(); + m_pCbScale.clear(); + m_pNewDocLb.clear(); + m_pFiInfo1.clear(); + m_pMtrFldOriginalWidth.clear(); + m_pWidthLb.clear(); + m_pHeightLb.clear(); + m_pFiInfo2.clear(); + m_pMtrFldOriginalHeight.clear(); + m_pCbxDistrot.clear(); + m_pMtrFldInfo1.clear(); + m_pMtrFldInfo2.clear(); + SfxTabPage::dispose(); } void SdTpOptionsMisc::ActivatePage( const SfxItemSet& rSet ) @@ -331,10 +373,9 @@ SfxTabPage::sfxpg SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet ) FillItemSet( pActiveSet ); return LEAVE_PAGE; } - WarningBox aWarnBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) ); - short nReturn = aWarnBox.Execute(); + ScopedVclPtrInstance< WarningBox > aWarnBox( GetParent(), WB_YES_NO, SD_RESSTR( STR_WARN_SCALE_FAIL ) ); - if( nReturn == RET_YES ) + if( aWarnBox->Execute() == RET_YES ) return KEEP_PAGE; if( pActiveSet ) @@ -488,10 +529,10 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs ) UpdateCompatibilityControls (); } -SfxTabPage* SdTpOptionsMisc::Create( vcl::Window* pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SdTpOptionsMisc::Create( vcl::Window* pWindow, + const SfxItemSet* rAttrs ) { - return new SdTpOptionsMisc( pWindow, *rAttrs ); + return VclPtr<SdTpOptionsMisc>::Create( pWindow, *rAttrs ); } IMPL_LINK_NOARG(SdTpOptionsMisc, SelectMetricHdl_Impl) diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index f533073cfe32..d7cde0582f7e 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -72,6 +72,22 @@ SdVectorizeDlg::SdVectorizeDlg(vcl::Window* pParent, const Bitmap& rBmp, ::sd::D SdVectorizeDlg::~SdVectorizeDlg() { + disposeOnce(); +} + +void SdVectorizeDlg::dispose() +{ + m_pNmLayers.clear(); + m_pMtReduce.clear(); + m_pFtFillHoles.clear(); + m_pMtFillHoles.clear(); + m_pCbFillHoles.clear(); + m_pBmpWin.clear(); + m_pMtfWin.clear(); + m_pPrgs.clear(); + m_pBtnOK.clear(); + m_pBtnPreview.clear(); + ModalDialog::dispose(); } Rectangle SdVectorizeDlg::GetRect( const Size& rDispSize, const Size& rBmpSize ) const |