diff options
Diffstat (limited to 'sw/source')
290 files changed, 5918 insertions, 3052 deletions
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx index 1fae89e7db8e..c31d2945c329 100644 --- a/sw/source/core/access/accdoc.hxx +++ b/sw/source/core/access/accdoc.hxx @@ -36,7 +36,7 @@ class SwAccessibleDocumentBase : public SwAccessibleContext ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> mxParent; - vcl::Window* mpChildWin; // protected by solar mutext + VclPtr<vcl::Window> mpChildWin; // protected by solar mutext using SwAccessibleFrame::SetVisArea; diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx index 04e0bbc43ce7..c6c40fa28088 100644 --- a/sw/source/core/access/accfrmobj.cxx +++ b/sw/source/core/access/accfrmobj.cxx @@ -212,7 +212,7 @@ bool SwAccessibleChild::IsValid() const { return mpFrm != 0 || mpDrawObj != 0 || - mpWindow != 0; + mpWindow != nullptr; } bool SwAccessibleChild::IsVisibleChildrenOnly() const diff --git a/sw/source/core/access/accfrmobj.hxx b/sw/source/core/access/accfrmobj.hxx index bfd188f79ad1..31a489e43640 100644 --- a/sw/source/core/access/accfrmobj.hxx +++ b/sw/source/core/access/accfrmobj.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJ_HXX #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCFRMOBJ_HXX +#include <vcl/vclptr.hxx> class SwAccessibleMap; class SwFrm; @@ -71,7 +72,7 @@ class SwAccessibleChild private: const SwFrm* mpFrm; const SdrObject* mpDrawObj; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; void Init( const SdrObject* pDrawObj ); void Init( const SwFrm* pFrm ); diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index d0bdabdaca10..c1e79806fdd2 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -49,7 +49,7 @@ SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW ) { } -SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput ) +SwRefMarkFldUpdate::SwRefMarkFldUpdate( OutputDevice* pOutput ) : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ), pOut( pOutput ) { diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index f2f751779ff9..6da2747e8689 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -55,8 +55,8 @@ DocumentDeviceManager::DocumentDeviceManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwd SfxPrinter* DocumentDeviceManager::getPrinter(/*[in]*/ bool bCreate ) const { SfxPrinter* pRet = 0; - if ( !bCreate || mpPrt ) - pRet = mpPrt; + if ( !bCreate || mpPrt ) + pRet = mpPrt; else pRet = &CreatePrinter_(); @@ -65,10 +65,11 @@ SfxPrinter* DocumentDeviceManager::getPrinter(/*[in]*/ bool bCreate ) const void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged ) { - if ( pP != mpPrt ) + assert ( !pP || !pP->isDisposed() ); + if ( pP != mpPrt ) { if ( bDeleteOld ) - delete mpPrt; + mpPrt.disposeAndClear(); mpPrt = pP; // our printer should always use TWIP. Don't rely on this being set in SwViewShell::InitPrt, there @@ -78,7 +79,7 @@ void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDe { MapMode aMapMode( mpPrt->GetMapMode() ); aMapMode.SetMapUnit( MAP_TWIP ); - mpPrt->SetMapMode( aMapMode ); + mpPrt->SetMapMode( aMapMode ); } if ( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && !m_rDoc.GetDocumentSettingManager().get( DocumentSettingId::USE_VIRTUAL_DEVICE ) ) @@ -100,15 +101,19 @@ VirtualDevice* DocumentDeviceManager::getVirtualDevice(/*[in]*/ bool bCreate ) c else pRet = &CreateVirtualDevice_(); + assert ( !pRet || !pRet->isDisposed() ); + return pRet; } void DocumentDeviceManager::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool ) { - if ( mpVirDev != pVd ) + assert ( !pVd->isDisposed() ); + + if ( mpVirDev.get() != pVd ) { if ( bDeleteOld ) - delete mpVirDev; + mpVirDev.disposeAndClear(); mpVirDev = pVd; if ( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && m_rDoc.GetDocumentSettingManager().get( DocumentSettingId::USE_VIRTUAL_DEVICE ) ) @@ -133,6 +138,8 @@ OutputDevice* DocumentDeviceManager::getReferenceDevice(/*[in]*/ bool bCreate ) pRet = getVirtualDevice( bCreate ); } + assert ( !pRet || !pRet->isDisposed() ); + return pRet; } @@ -193,7 +200,7 @@ void DocumentDeviceManager::setJobsetup(/*[in]*/ const JobSetup &rJobSetup ) } } else - delete mpPrt, mpPrt = 0; + mpPrt.disposeAndClear(); } if( !mpPrt ) @@ -205,7 +212,7 @@ void DocumentDeviceManager::setJobsetup(/*[in]*/ const JobSetup &rJobSetup ) SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - SfxPrinter *p = new SfxPrinter( pSet, rJobSetup ); + VclPtr<SfxPrinter> p = VclPtr<SfxPrinter>::Create( pSet, rJobSetup ); if ( bCheckPageDescs ) setPrinter( p, true, true ); else @@ -247,16 +254,16 @@ void DocumentDeviceManager::setPrintData(/*[in]*/ const SwPrintData& rPrtData ) DocumentDeviceManager::~DocumentDeviceManager() { delete mpPrtData; - delete mpVirDev; - DELETEZ( mpPrt ); + mpVirDev.disposeAndClear(); + mpPrt.disposeAndClear(); } VirtualDevice& DocumentDeviceManager::CreateVirtualDevice_() const { #ifdef IOS - VirtualDevice* pNewVir = new VirtualDevice( 8 ); + VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create( 8 ); #else - VirtualDevice* pNewVir = new VirtualDevice( 1 ); + VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create( 1 ); #endif pNewVir->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); @@ -290,9 +297,9 @@ SfxPrinter& DocumentDeviceManager::CreatePrinter_() const SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - SfxPrinter* pNewPrt = new SfxPrinter( pSet ); + VclPtr<SfxPrinter> pNewPrt = VclPtr<SfxPrinter>::Create( pSet ); const_cast<DocumentDeviceManager*>(this)->setPrinter( pNewPrt, true, true ); - return *mpPrt; + return *mpPrt.get(); } void DocumentDeviceManager::PrtDataChanged() diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 398a4ee13e78..38918b0320c0 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2665,8 +2665,8 @@ void DocumentRedlineManager::checkRedlining(RedlineMode_t& _rReadlineMode) if ( pParent && !mbReadlineChecked && rRedlineTbl.size() > MAX_REDLINE_COUNT && !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) ) { - MessageDialog aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui"); - sal_uInt16 nResult = aQuery.Execute(); + ScopedVclPtrInstance< MessageDialog > aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui"); + sal_uInt16 nResult = aQuery->Execute(); mbReadlineChecked = true; if ( nResult == RET_YES ) { diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index b4eb8602a74d..ec6a2f3c7855 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -439,7 +439,7 @@ namespace private: bool mbMapModeRestored; - OutputDevice* mpOutDev; + VclPtr<OutputDevice> mpOutDev; }; } // <-- diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index fdce8999502c..6a8f53eea98e 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -143,13 +143,13 @@ bool SwAnnotationItem::UseElement() return mrFmtFld.IsFldInDoc(); } -sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow( +VclPtr<sw::sidebarwindows::SwSidebarWin> SwAnnotationItem::GetSidebarWindow( SwEditWin& rEditWin, WinBits nBits, SwPostItMgr& aMgr, SwPostItBits aBits) { - return new sw::annotation::SwAnnotationWin( rEditWin, nBits, + return VclPtr<sw::annotation::SwAnnotationWin>::Create( rEditWin, nBits, aMgr, aBits, *this, &mrFmtFld ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 0e36a90abc63..3ed004c9a617 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1239,16 +1239,16 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFmt, Graphic& rGrf ) co Point aPt; GetGrfSize( aSz ); - VirtualDevice aVirtDev; - aVirtDev.EnableOutput( false ); + ScopedVclPtrInstance< VirtualDevice > pVirtDev; + pVirtDev->EnableOutput( false ); MapMode aTmp( GetWin()->GetMapMode() ); aTmp.SetOrigin( aPt ); - aVirtDev.SetMapMode( aTmp ); + pVirtDev->SetMapMode( aTmp ); GDIMetaFile aMtf; - aMtf.Record( &aVirtDev ); - aGrf.Draw( &aVirtDev, aPt, aSz ); + aMtf.Record( pVirtDev.get() ); + aGrf.Draw( pVirtDev, aPt, aSz ); aMtf.Stop(); aMtf.SetPrefMapMode( aTmp ); aMtf.SetPrefSize( aSz ); @@ -1266,14 +1266,14 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFmt, Graphic& rGrf ) co // Otherwise it could happen that for vector graphics // many MB's of memory are allocated. const Size aSz( FindFlyFrm()->Prt().SSize() ); - VirtualDevice aVirtDev( *GetWin() ); + ScopedVclPtrInstance< VirtualDevice > pVirtDev(*GetWin()); MapMode aTmp( MAP_TWIP ); - aVirtDev.SetMapMode( aTmp ); - if( aVirtDev.SetOutputSize( aSz ) ) + pVirtDev->SetMapMode( aTmp ); + if( pVirtDev->SetOutputSize( aSz ) ) { - aGrf.Draw( &aVirtDev, Point(), aSz ); - rGrf = aVirtDev.GetBitmap( Point(), aSz ); + aGrf.Draw( pVirtDev.get(), Point(), aSz ); + rGrf = pVirtDev->GetBitmap( Point(), aSz ); } else { diff --git a/sw/source/core/inc/DocumentDeviceManager.hxx b/sw/source/core/inc/DocumentDeviceManager.hxx index 1440b63897b6..f388b4d8d273 100644 --- a/sw/source/core/inc/DocumentDeviceManager.hxx +++ b/sw/source/core/inc/DocumentDeviceManager.hxx @@ -22,7 +22,7 @@ #include <IDocumentDeviceAccess.hxx> #include <boost/utility.hpp> #include <sal/types.h> - +#include <vcl/vclptr.hxx> class SwDoc; class SfxPrinter; @@ -72,8 +72,8 @@ private: invalidations and notifications. */ SwDoc& m_rDoc; - SfxPrinter* mpPrt; - VirtualDevice* mpVirDev; + VclPtr<SfxPrinter> mpPrt; + VclPtr<VirtualDevice> mpVirDev; SwPrintData* mpPrtData; }; diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx index fee34b12737e..a601ce4aa20c 100644 --- a/sw/source/core/inc/drawfont.hxx +++ b/sw/source/core/inc/drawfont.hxx @@ -22,9 +22,10 @@ #include <tools/solar.h> #include <osl/diagnose.h> +#include <vcl/vclptr.hxx> +#include <vcl/outdev.hxx> class SwTxtFrm; -class OutputDevice; class SwViewShell; class SwScriptInfo; class Point; @@ -41,7 +42,7 @@ class SwUnderlineFont; class SwDrawTextInfo { const SwTxtFrm* pFrm; - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; SwViewShell const * pSh; const SwScriptInfo* pScriptInfo; Point m_aPos; diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index dfc4c7c2aa34..6755965d0f91 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX #include <vcl/font.hxx> +#include <vcl/vclptr.hxx> #include <tools/mempool.hxx> #include "swtypes.hxx" #include "swcache.hxx" @@ -63,7 +64,7 @@ class SwFntObj : public SwCacheObj vcl::Font aFont; vcl::Font *pScrFont; vcl::Font *pPrtFont; - OutputDevice* pPrinter; + VclPtr<OutputDevice> pPrinter; sal_uInt16 nGuessedLeading; sal_uInt16 nExtLeading; sal_uInt16 nScrAscent; @@ -77,7 +78,7 @@ class SwFntObj : public SwCacheObj static long nPixWidth; static MapMode *pPixMap; - static OutputDevice *pPixOut; + static VclPtr<OutputDevice> pPixOut; void calcLinePos(SwDrawTextInfo& rInf, Point& aStart, Point& aEnd, sal_Int32 nStart, sal_Int32 nWrLen, sal_Int32 nCnt, const bool bSwitchH2V, const bool bSwitchL2R, diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f352675fb9b9..78588cfcfb3c 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -241,7 +241,7 @@ struct SwPaintProperties { // Only repaint the Fly content as well as the background of the Fly content if // a metafile is taken of the Fly. bool bSFlyMetafile; - OutputDevice *pSFlyMetafileOut; + VclPtr<OutputDevice> pSFlyMetafileOut; SwViewShell *pSGlobalShell; // Retouch for transparent Flys is done by the background of the Flys. @@ -1248,7 +1248,7 @@ void SwAlignRect( SwRect &rRect, const SwViewShell *pSh ) } const OutputDevice *pOut = gProp.bSFlyMetafile ? - gProp.pSFlyMetafileOut : pSh->GetOut(); + gProp.pSFlyMetafileOut.get() : pSh->GetOut(); // Hold original rectangle in pixel const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() ); @@ -7660,21 +7660,21 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pFirst); OutputDevice *pOld = pSh->GetOut(); - VirtualDevice aDev( *pOld ); - aDev.EnableOutput( false ); + ScopedVclPtrInstance< VirtualDevice > pDev( *pOld ); + pDev->EnableOutput( false ); GDIMetaFile aMet; MapMode aMap( pOld->GetMapMode().GetMapUnit() ); - aDev.SetMapMode( aMap ); + pDev->SetMapMode( aMap ); aMet.SetPrefMapMode( aMap ); ::SwCalcPixStatics( pSh->GetOut() ); aMet.SetPrefSize( pFly->Frm().SSize() ); - aMet.Record( &aDev ); - aDev.SetLineColor(); - aDev.SetFillColor(); - aDev.SetFont( pOld->GetFont() ); + aMet.Record( pDev.get() ); + pDev->SetLineColor(); + pDev->SetFillColor(); + pDev->SetFont( pOld->GetFont() ); //Enlarge the rectangle if needed, so the border is painted too. SwRect aOut( pFly->Frm() ); @@ -7691,7 +7691,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) vcl::Window *pWin = pSh->GetWin(); sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom(); - ::SetOutDevAndWin( pSh, &aDev, 0, 100 ); + ::SetOutDevAndWin( pSh, pDev, 0, 100 ); gProp.bSFlyMetafile = true; gProp.pSFlyMetafileOut = pWin; @@ -7709,15 +7709,15 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); - gProp.pSLines->PaintLines( &aDev, gProp ); + gProp.pSLines->PaintLines( pDev, gProp ); if ( pFly->IsFlyInCntFrm() ) pFly->Paint( aOut ); - gProp.pSLines->PaintLines( &aDev, gProp ); + gProp.pSLines->PaintLines( pDev, gProp ); // OD 30.08.2002 #102450# - add 3rd parameter pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); - gProp.pSLines->PaintLines( &aDev, gProp ); + gProp.pSLines->PaintLines( pDev, gProp ); DELETEZ( gProp.pSLines ); gProp.pSFlyOnlyDraw = 0; diff --git a/sw/source/core/layout/virtoutp.cxx b/sw/source/core/layout/virtoutp.cxx index 78e5cfef4b23..d8ea404f17fd 100644 --- a/sw/source/core/layout/virtoutp.cxx +++ b/sw/source/core/layout/virtoutp.cxx @@ -119,7 +119,7 @@ bool SwLayVout::DoesFit( const Size &rNew ) return true; if( !pVirDev ) { - pVirDev = new VirtualDevice(); + pVirDev = VclPtr<VirtualDevice>::Create(); pVirDev->SetLineColor(); if( pOut ) { @@ -133,8 +133,7 @@ bool SwLayVout::DoesFit( const Size &rNew ) aSize.Width() = rNew.Width(); if( !pVirDev->SetOutputSizePixel( aSize ) ) { - delete pVirDev; - pVirDev = NULL; + pVirDev.disposeAndClear(); aSize.Width() = 0; return false; } diff --git a/sw/source/core/layout/virtoutp.hxx b/sw/source/core/layout/virtoutp.hxx index f3b007375bd1..ea44b5be2b9f 100644 --- a/sw/source/core/layout/virtoutp.hxx +++ b/sw/source/core/layout/virtoutp.hxx @@ -32,8 +32,8 @@ class SwLayVout friend void _FrmFinit(); //deletes Vout private: SwViewShell* pSh; - OutputDevice* pOut; - VirtualDevice* pVirDev; + VclPtr<OutputDevice> pOut; + VclPtr<VirtualDevice> pVirDev; SwRect aRect; SwRect aOrgRect; Size aSize; @@ -43,7 +43,7 @@ private: public: SwLayVout() : pSh(0), pOut(0), pVirDev(0), aSize(0, VIRTUALHEIGHT), nCount(0) {} - ~SwLayVout() { delete pVirDev; } + ~SwLayVout() { pVirDev.disposeAndClear(); } /// OD 27.09.2002 #103636# - change 2nd parameter <rRect> - no longer <const> void Enter( SwViewShell *pShell, SwRect &rRect, bool bOn ); diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index c9dabd6825b1..3354df5e45e4 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -156,8 +156,8 @@ protected: SwViewShell *m_pVsh; // m_pOut is the output device, m_pRef is the device used for formatting - OutputDevice* m_pOut; - OutputDevice* m_pRef; + VclPtr<OutputDevice> m_pOut; + VclPtr<OutputDevice> m_pRef; // performance hack - this is only used by SwTxtFormatInfo but // because it's not even possible to dynamic_cast these things diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 38dc69ed5887..b85e351b0a82 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -109,7 +109,7 @@ SwTxtAttr *SwAttrIter::GetAttr( const sal_Int32 nPosition ) const bool SwAttrIter::SeekAndChgAttrIter( const sal_Int32 nNewPos, OutputDevice* pOut ) { bool bChg = nStartIndex && nNewPos == nPos ? pFnt->IsFntChg() : Seek( nNewPos ); - if ( pLastOut != pOut ) + if ( pLastOut.get() != pOut ) { pLastOut = pOut; pFnt->SetFntChg( true ); @@ -174,7 +174,7 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo } bool bChg = pFnt->IsFntChg(); - if ( pLastOut != pOut ) + if ( pLastOut.get() != pOut ) { pLastOut = pOut; pFnt->SetFntChg( true ); @@ -338,7 +338,7 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const class SwMinMaxArgs { public: - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; SwViewShell const * pSh; sal_uLong &rMin; sal_uLong &rMax; diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index 81aa9fd489ba..7fb9ada2e7ad 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -47,7 +47,7 @@ protected: SwScriptInfo* pScriptInfo; private: - OutputDevice *pLastOut; + VclPtr<OutputDevice> pLastOut; short nChgCnt; SwRedlineItr *pRedln; size_t nStartIndex; diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx index 85890254dfbc..2008fefcff30 100644 --- a/sw/source/core/text/itrtxt.hxx +++ b/sw/source/core/text/itrtxt.hxx @@ -305,7 +305,7 @@ public: class SwHookOut { SwTxtSizeInfo* pInf; - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; bool bOnWin; public: SwHookOut( SwTxtSizeInfo& rInfo ); diff --git a/sw/source/core/text/txtpaint.hxx b/sw/source/core/text/txtpaint.hxx index c14c6560cf81..607d6c5cf3a1 100644 --- a/sw/source/core/text/txtpaint.hxx +++ b/sw/source/core/text/txtpaint.hxx @@ -29,7 +29,7 @@ class SwSaveClip const bool bOn; bool bChg; protected: - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; void _ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm, bool bEnlargeRect ); public: @@ -60,7 +60,7 @@ inline SwSaveClip::~SwSaveClip() class SwDbgOut { protected: - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; public: inline SwDbgOut( OutputDevice* pOutDev, const bool bOn = true ); }; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 77894fa20d62..e4726abcb48d 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -67,7 +67,7 @@ Color *pWaveCol = 0; long SwFntObj::nPixWidth; MapMode* SwFntObj::pPixMap = NULL; -OutputDevice* SwFntObj::pPixOut = NULL; +VclPtr<OutputDevice> SwFntObj::pPixOut; namespace { @@ -1401,7 +1401,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) if ( pPrinter ) { // pTmpFont has already been set as current font for rInf.GetOut() - if ( pPrinter != rInf.GetpOut() || pTmpFont != pPrtFont ) + if ( pPrinter.get() != rInf.GetpOut() || pTmpFont != pPrtFont ) { if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) ) pPrinter->SetFont( *pPrtFont ); @@ -1886,7 +1886,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) // This is the part used e.g., for cursor travelling // See condition for DrawText or DrawTextArray (bDirectPrint) - if ( pPrinter && pPrinter != rInf.GetpOut() ) + if ( pPrinter && pPrinter.get() != rInf.GetpOut() ) { if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) ) pPrinter->SetFont(*pPrtFont); @@ -2247,7 +2247,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic, ( !pFntObj->pPrinter || pFntObj->pPrinter == pOut ) ) ) pFntObj = pFntCache->Next( pFntObj ); - if( pFntObj && pFntObj->pPrinter != pOut ) + if( pFntObj && pFntObj->pPrinter.get() != pOut ) { // found one without printer, let's see if there is one with // the same printer as well @@ -2272,7 +2272,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic, else // Font has been found, so we lock it. { pFntObj->Lock(); - if (pFntObj->pPrinter != pOut) // if no printer is known by now + if (pFntObj->pPrinter.get() != pOut) // if no printer is known by now { OSL_ENSURE( !pFntObj->pPrinter, "SwFntAccess: Printer Changed" ); pFntObj->CreatePrtFont( *pOut ); diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 337816cbc030..076e8933c039 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -158,7 +158,6 @@ SwPrintUIOptions::SwPrintUIOptions( bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData ) : - m_pLast( NULL ), m_rDefaultPrintData( rDefaultPrintData ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -471,13 +470,14 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< bea uno::Any aVal( getValue( "RenderDevice" ) ); aVal >>= xRenderDevice; - OutputDevice* pOut = 0; + VclPtr< OutputDevice > pOut; if (xRenderDevice.is()) { VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - pOut = pDevice ? pDevice->GetOutputDevice() : 0; + if (pDevice) + pOut = pDevice->GetOutputDevice(); } - bChanged = bChanged || (pOut != m_pLast); + bChanged = bChanged || (pOut.get() != m_pLast.get()); if( pOut ) m_pLast = pOut; diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 1ed7fa0f8278..27c72a10ee0f 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -322,7 +322,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) pRegion->Compress(); - VirtualDevice *pVout = 0; + VclPtr<VirtualDevice> pVout; while ( !pRegion->empty() ) { SwRect aRect( pRegion->back() ); @@ -333,7 +333,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) { //create virtual device and set. if ( !pVout ) - pVout = new VirtualDevice( *GetOut() ); + pVout = VclPtr<VirtualDevice>::Create( *GetOut() ); MapMode aMapMode( GetOut()->GetMapMode() ); pVout->SetMapMode( aMapMode ); @@ -375,7 +375,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) aMapMode.SetOrigin( aOrigin ); pVout->SetMapMode( aMapMode ); - mpOut = pVout; + mpOut = pVout.get(); if ( bPaintsFromSystem ) PaintDesktop( aRect ); pCurrentLayout->Paint( aRect ); @@ -411,7 +411,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) lcl_PaintTransparentFormControls(*this, aRect); // i#107365 } - delete pVout; + pVout.disposeAndClear(); delete pRegion; Imp()->DelRegion(); } @@ -464,7 +464,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) { //Refresh with virtual device to avoid flickering. - VirtualDevice *pVout = new VirtualDevice( *mpOut ); + VclPtrInstance<VirtualDevice> pVout( *mpOut ); pVout->SetMapMode( mpOut->GetMapMode() ); Size aSize( VisArea().SSize() ); aSize.Width() += 20; @@ -483,7 +483,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) DLPrePaint2(aRepaintRegion); OutputDevice *pOld = mpOut; - mpOut = pVout; + mpOut = pVout.get(); Paint( VisArea().SVRect() ); mpOut = pOld; mpOut->DrawOutDev( VisArea().Pos(), aSize, @@ -500,7 +500,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) GetWin()->EnablePaint( true ); GetWin()->Invalidate( INVALIDATE_CHILDREN ); } - delete pVout; + pVout.disposeAndClear(); } else { @@ -1207,7 +1207,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect //create virtual device and set. const Size aPixSz = GetWin()->PixelToLogic(Size(1,1)); - VirtualDevice *pVout = new VirtualDevice( *GetWin() ); + VclPtrInstance<VirtualDevice> pVout( *GetWin() ); pVout->SetLineColor( GetWin()->GetLineColor() ); pVout->SetFillColor( GetWin()->GetFillColor() ); MapMode aMapMode( GetWin()->GetMapMode() ); @@ -1239,7 +1239,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect aMapMode.SetOrigin( aPt ); pVout->SetMapMode( aMapMode ); OutputDevice *pOld = mpOut; - mpOut = pVout; + mpOut = pVout.get(); { // #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the @@ -1384,14 +1384,14 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect --mnLockPaint; } } - delete pVout; + pVout.disposeAndClear(); GetWin()->Update(); if ( !Imp()->bStopSmooth ) --mnLockPaint; SetFirstVisPageInvalid(); return true; } - delete pVout; + pVout.disposeAndClear(); } #endif @@ -2262,7 +2262,7 @@ SwViewShell::CreateAccessiblePreview() void SwViewShell::InvalidateAccessibleFocus() { - if( Imp()->IsAccessible() ) + if( Imp() && Imp()->IsAccessible() ) Imp()->GetAccessibleMap().InvalidateFocus(); } diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index c47190894897..096265b5f3ef 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -372,7 +372,7 @@ SwViewShell::~SwViewShell() } } - delete mpTmpRef; + mpTmpRef.disposeAndClear(); delete mpAccOptions; } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 80ba9ce1666d..4bc1c06207c6 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -331,7 +331,7 @@ SwDoc * SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) //! Make a copy of it since it gets destroyed with the temporary document //! used for PDF export if (pPrt) - pPrtDoc->getIDocumentDeviceAccess().setPrinter( new SfxPrinter(*pPrt), true, true ); + pPrtDoc->getIDocumentDeviceAccess().setPrinter( VclPtr<SfxPrinter>::Create(*pPrt), true, true ); const SfxItemPool& rPool = GetAttrPool(); for( sal_uInt16 nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh ) diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 355ef9bda016..77bd84f96805 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -726,9 +726,9 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd, { case GRAPHIC_BITMAP: // Bitmap -> play in Metafile { - VirtualDevice aVirt; - aMeta.Record(&aVirt); - aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); + ScopedVclPtrInstance< VirtualDevice > pVirt; + aMeta.Record(pVirt.get()); + pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); aMeta.Stop(); aMeta.WindStart(); aMeta.SetPrefMapMode( rGrf.GetPrefMapMode()); @@ -854,9 +854,9 @@ void SwWW8WrGrf::WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uIn { case GRAPHIC_BITMAP: // Bitmap -> in Metafile abspielen { - VirtualDevice aVirt; - aMeta.Record(&aVirt); - aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); + ScopedVclPtrInstance< VirtualDevice > pVirt; + aMeta.Record(pVirt.get()); + pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); aMeta.Stop(); aMeta.WindStart(); aMeta.SetPrefMapMode( rGrf.GetPrefMapMode()); diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index a7616885ad21..d0dea5ffafbc 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -173,6 +173,23 @@ SwBreakDlg::SwBreakDlg( vcl::Window *pParent, SwWrtShell &rS ) m_pPageNumEdit->SetText(OUString()); } +SwBreakDlg::~SwBreakDlg() +{ + disposeOnce(); +} + +void SwBreakDlg::dispose() +{ + m_pLineBtn.clear(); + m_pColumnBtn.clear(); + m_pPageBtn.clear(); + m_pPageCollText.clear(); + m_pPageCollBox.clear(); + m_pPageNumBox.clear(); + m_pPageNumEdit.clear(); + SvxStandardDialog::dispose(); +} + void SwBreakDlg::CheckEnable() { bool bEnable = true; @@ -206,8 +223,4 @@ void SwBreakDlg::CheckEnable() m_pPageNumEdit->Enable(bEnable); } -SwBreakDlg::~SwBreakDlg() -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 7ef726f89087..9e461fc14622 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -185,7 +185,23 @@ SwCharURLPage::SwCharURLPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) SwCharURLPage::~SwCharURLPage() { + disposeOnce(); +} + +void SwCharURLPage::dispose() +{ delete pINetItem; + m_pURLED.clear(); + m_pTextFT.clear(); + m_pTextED.clear(); + m_pNameED.clear(); + m_pTargetFrmLB.clear(); + m_pURLPB.clear(); + m_pEventPB.clear(); + m_pVisitedLB.clear(); + m_pNotVisitedLB.clear(); + m_pCharStyleContainer.clear(); + SfxTabPage::dispose(); } void SwCharURLPage::Reset(const SfxItemSet* rSet) @@ -279,10 +295,10 @@ bool SwCharURLPage::FillItemSet(SfxItemSet* rSet) return bModified; } -SfxTabPage* SwCharURLPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwCharURLPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwCharURLPage( pParent, *rAttrSet ) ); + return VclPtr<SwCharURLPage>::Create( pParent, *rAttrSet ); } IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl) diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 20b8e9b3f01b..cd402d033ad0 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -62,7 +62,7 @@ const sal_uInt16 SwDropCapsPage::aPageRg[] = { class SwDropCapsPict : public Control { - SwDropCapsPage* mpPage; + VclPtr<SwDropCapsPage> mpPage; OUString maText; OUString maScriptText; Color maBackColor; @@ -72,7 +72,7 @@ class SwDropCapsPict : public Control long mnLineH; long mnTextH; sal_uInt16 mnDistance; - Printer* mpPrinter; + VclPtr<Printer> mpPrinter; bool mbDelPrinter; /// The _ScriptInfo structure holds information on where we change from one /// script to another. @@ -117,6 +117,7 @@ public: void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; } virtual ~SwDropCapsPict(); + virtual void dispose() SAL_OVERRIDE; void UpdatePaintSettings(); // also invalidates control! @@ -202,8 +203,15 @@ static void calcFontHeightAnyAscent( OutputDevice* _pWin, vcl::Font& _rFont, lon SwDropCapsPict::~SwDropCapsPict() { + disposeOnce(); +} + +void SwDropCapsPict::dispose() +{ if( mbDelPrinter ) - delete mpPrinter; + mpPrinter.disposeAndClear(); + mpPage.clear(); + Control::dispose(); } /// Get the details of the first script change. @@ -512,7 +520,7 @@ void SwDropCapsPict::_InitPrinter() SwDropCapsDlg::SwDropCapsDlg(vcl::Window *pParent, const SfxItemSet &rSet ) : SfxSingleTabDialog(pParent, rSet) { - SwDropCapsPage* pNewPage = static_cast<SwDropCapsPage*>( SwDropCapsPage::Create(get_content_area(), &rSet)); + VclPtr<SwDropCapsPage> pNewPage( static_cast<SwDropCapsPage*>( SwDropCapsPage::Create(get_content_area(), &rSet).get() ) ); pNewPage->SetFormat(false); SetTabPage(pNewPage); } @@ -568,6 +576,25 @@ SwDropCapsPage::SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet) SwDropCapsPage::~SwDropCapsPage() { + disposeOnce(); +} + +void SwDropCapsPage::dispose() +{ + m_pDropCapsBox.clear(); + m_pWholeWordCB.clear(); + m_pSwitchText.clear(); + m_pDropCapsField.clear(); + m_pLinesText.clear(); + m_pLinesField.clear(); + m_pDistanceText.clear(); + m_pDistanceField.clear(); + m_pTextText.clear(); + m_pTextEdit.clear(); + m_pTemplateText.clear(); + m_pTemplateBox.clear(); + m_pPict.clear(); + SfxTabPage::dispose(); } SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet) @@ -578,10 +605,10 @@ SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet) return LEAVE_PAGE; } -SfxTabPage* SwDropCapsPage::Create(vcl::Window *pParent, - const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwDropCapsPage::Create(vcl::Window *pParent, + const SfxItemSet *rSet) { - return new SwDropCapsPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwDropCapsPage(pParent, *rSet), SAL_NO_ACQUIRE); } bool SwDropCapsPage::FillItemSet(SfxItemSet *rSet) diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 29429aa16da0..659ad559640e 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -101,15 +101,36 @@ SwParagraphNumTabPage::SwParagraphNumTabPage(vcl::Window* pParent, const SfxItem SwParagraphNumTabPage::~SwParagraphNumTabPage() { + disposeOnce(); } -SfxTabPage* SwParagraphNumTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rSet ) +void SwParagraphNumTabPage::dispose() { - return new SwParagraphNumTabPage(pParent, *rSet); + m_pOutlineStartBX.clear(); + m_pOutlineLvLB.clear(); + m_pNumberStyleBX.clear(); + m_pNumberStyleLB.clear(); + m_pEditNumStyleBtn.clear(); + m_pNewStartCB.clear(); + m_pNewStartBX.clear(); + m_pNewStartNumberCB.clear(); + m_pNewStartNF.clear(); + m_pCountParaFram.clear(); + m_pCountParaCB.clear(); + m_pRestartParaCountCB.clear(); + m_pRestartBX.clear(); + m_pRestartNF.clear(); + SfxTabPage::dispose(); } -bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet ) +VclPtr<SfxTabPage> SwParagraphNumTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rSet ) +{ + return VclPtr<SfxTabPage>( new SwParagraphNumTabPage(pParent, *rSet), + SAL_NO_ACQUIRE ); +} + +bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet ) { if( m_pOutlineLvLB->IsValueChangedFromSaved()) { diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index b5fb89873386..3757b44f846b 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -124,9 +124,25 @@ SwCondCollPage::SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet) SwCondCollPage::~SwCondCollPage() { + disposeOnce(); +} + +void SwCondCollPage::dispose() +{ for(sal_Int32 i = 0; i < m_pFilterLB->GetEntryCount(); ++i) delete static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(i)); + m_pConditionCB.clear(); + m_pContextFT.clear(); + m_pUsedFT.clear(); + m_pTbLinks.clear(); + m_pStyleFT.clear(); + m_pStyleLB.clear(); + m_pFilterLB.clear(); + m_pRemovePB.clear(); + m_pAssignPB.clear(); + + SfxTabPage::dispose(); } SfxTabPage::sfxpg SwCondCollPage::DeactivatePage(SfxItemSet * _pSet) @@ -137,9 +153,10 @@ SfxTabPage::sfxpg SwCondCollPage::DeactivatePage(SfxItemSet * _pSet) return LEAVE_PAGE; } -SfxTabPage* SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwCondCollPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwCondCollPage(pParent, *rSet), + SAL_NO_ACQUIRE); } bool SwCondCollPage::FillItemSet(SfxItemSet *rSet) diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 37da1bffff9a..13464804fa21 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -45,16 +45,16 @@ using namespace ::com::sun::star::beans; class SwTestAccountSettingsDialog : public SfxModalDialog { - VclMultiLineEdit* m_pErrorsED; + VclPtr<VclMultiLineEdit> m_pErrorsED; - PushButton* m_pStopPB; + VclPtr<PushButton> m_pStopPB; - FixedText* m_pEstablish; - FixedText* m_pFind; - FixedText* m_pResult1; - FixedText* m_pResult2; - FixedImage* m_pImage1; - FixedImage* m_pImage2; + VclPtr<FixedText> m_pEstablish; + VclPtr<FixedText> m_pFind; + VclPtr<FixedText> m_pResult1; + VclPtr<FixedText> m_pResult2; + VclPtr<FixedImage> m_pImage1; + VclPtr<FixedImage> m_pImage2; Image m_aCompletedImg; Image m_aFailedImg; @@ -62,7 +62,7 @@ class SwTestAccountSettingsDialog : public SfxModalDialog OUString m_sFailed; OUString m_sErrorServer; - SwMailConfigPage* m_pParent; + VclPtr<SwMailConfigPage> m_pParent; bool m_bStop; @@ -71,35 +71,37 @@ class SwTestAccountSettingsDialog : public SfxModalDialog DECL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*); public: SwTestAccountSettingsDialog(SwMailConfigPage* pParent); + virtual ~SwTestAccountSettingsDialog(); + virtual void dispose() SAL_OVERRIDE; }; class SwAuthenticationSettingsDialog : public SfxModalDialog { - CheckBox* m_pAuthenticationCB; - - RadioButton* m_pSeparateAuthenticationRB; - RadioButton* m_pSMTPAfterPOPRB; - - FixedText* m_pOutgoingServerFT; - FixedText* m_pUserNameFT; - Edit* m_pUserNameED; - FixedText* m_pOutPasswordFT; - Edit* m_pOutPasswordED; - - FixedText* m_pIncomingServerFT; - FixedText* m_pServerFT; - Edit* m_pServerED; - FixedText* m_pPortFT; - NumericField* m_pPortNF; - FixedText* m_pProtocolFT; - RadioButton* m_pPOP3RB; - RadioButton* m_pIMAPRB; - FixedText* m_pInUsernameFT; - Edit* m_pInUsernameED; - FixedText* m_pInPasswordFT; - Edit* m_pInPasswordED; - - OKButton* m_pOKPB; + VclPtr<CheckBox> m_pAuthenticationCB; + + VclPtr<RadioButton> m_pSeparateAuthenticationRB; + VclPtr<RadioButton> m_pSMTPAfterPOPRB; + + VclPtr<FixedText> m_pOutgoingServerFT; + VclPtr<FixedText> m_pUserNameFT; + VclPtr<Edit> m_pUserNameED; + VclPtr<FixedText> m_pOutPasswordFT; + VclPtr<Edit> m_pOutPasswordED; + + VclPtr<FixedText> m_pIncomingServerFT; + VclPtr<FixedText> m_pServerFT; + VclPtr<Edit> m_pServerED; + VclPtr<FixedText> m_pPortFT; + VclPtr<NumericField> m_pPortNF; + VclPtr<FixedText> m_pProtocolFT; + VclPtr<RadioButton> m_pPOP3RB; + VclPtr<RadioButton> m_pIMAPRB; + VclPtr<FixedText> m_pInUsernameFT; + VclPtr<Edit> m_pInUsernameED; + VclPtr<FixedText> m_pInPasswordFT; + VclPtr<Edit> m_pInPasswordED; + + VclPtr<OKButton> m_pOKPB; SwMailMergeConfigItem& rConfigItem; @@ -110,6 +112,7 @@ class SwAuthenticationSettingsDialog : public SfxModalDialog public: SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem); virtual ~SwAuthenticationSettingsDialog(); + virtual void dispose() SAL_OVERRIDE; }; SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet ) : @@ -135,12 +138,28 @@ SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet SwMailConfigPage::~SwMailConfigPage() { + disposeOnce(); +} + +void SwMailConfigPage::dispose() +{ delete m_pConfigItem; + m_pDisplayNameED.clear(); + m_pAddressED.clear(); + m_pReplyToCB.clear(); + m_pReplyToFT.clear(); + m_pReplyToED.clear(); + m_pServerED.clear(); + m_pPortNF.clear(); + m_pSecureCB.clear(); + m_pServerAuthenticationPB.clear(); + m_pTestPB.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwMailConfigPage(pParent, *rAttrSet); + return VclPtr<SwMailConfigPage>::Create(pParent, *rAttrSet); } bool SwMailConfigPage::FillItemSet( SfxItemSet* /*rSet*/ ) @@ -198,8 +217,8 @@ IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox) IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl) { - SwAuthenticationSettingsDialog aDlg(this, *m_pConfigItem); - aDlg.Execute(); + ScopedVclPtrInstance< SwAuthenticationSettingsDialog > aDlg(this, *m_pConfigItem); + aDlg->Execute(); return 0; } @@ -238,6 +257,25 @@ SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pPare Application::PostUserEvent( STATIC_LINK( this, SwTestAccountSettingsDialog, TestHdl ), this ); } +SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog() +{ + disposeOnce(); +} + +void SwTestAccountSettingsDialog::dispose() +{ + m_pErrorsED.clear(); + m_pStopPB.clear(); + m_pEstablish.clear(); + m_pFind.clear(); + m_pResult1.clear(); + m_pResult2.clear(); + m_pImage1.clear(); + m_pImage2.clear(); + m_pParent.clear(); + SfxModalDialog::dispose(); +} + IMPL_LINK_NOARG(SwTestAccountSettingsDialog, StopHdl) { m_bStop = true; @@ -414,6 +452,33 @@ SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog( SwAuthenticationSettingsDialog::~SwAuthenticationSettingsDialog() { + disposeOnce(); +} + +void SwAuthenticationSettingsDialog::dispose() +{ + m_pAuthenticationCB.clear(); + m_pSeparateAuthenticationRB.clear(); + m_pSMTPAfterPOPRB.clear(); + m_pOutgoingServerFT.clear(); + m_pUserNameFT.clear(); + m_pUserNameED.clear(); + m_pOutPasswordFT.clear(); + m_pOutPasswordED.clear(); + m_pIncomingServerFT.clear(); + m_pServerFT.clear(); + m_pServerED.clear(); + m_pPortFT.clear(); + m_pPortNF.clear(); + m_pProtocolFT.clear(); + m_pPOP3RB.clear(); + m_pIMAPRB.clear(); + m_pInUsernameFT.clear(); + m_pInUsernameED.clear(); + m_pInPasswordFT.clear(); + m_pInPasswordED.clear(); + m_pOKPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAuthenticationSettingsDialog, OKHdl_Impl) diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index daa523e1b87f..f60ab8839d86 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -128,7 +128,17 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt SwCompatibilityOptPage::~SwCompatibilityOptPage() { + disposeOnce(); +} + +void SwCompatibilityOptPage::dispose() +{ delete m_pImpl; + m_pMain.clear(); + m_pFormattingLB.clear(); + m_pOptionsLB.clear(); + m_pDefaultPB.clear(); + SfxTabPage::dispose(); } sal_uLong convertBools2Ulong_Impl @@ -309,9 +319,9 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl) IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl) { - MessageDialog aQuery(this, "QueryDefaultCompatDialog", - "modules/swriter/ui/querydefaultcompatdialog.ui"); - if (aQuery.Execute() == RET_YES) + ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDefaultCompatDialog", + "modules/swriter/ui/querydefaultcompatdialog.ui"); + if (aQuery->Execute() == RET_YES) { for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin(); pItem != m_pImpl->m_aList.end(); ++pItem ) @@ -400,9 +410,9 @@ void SwCompatibilityOptPage::WriteOptions() pItem->m_bExpandWordSpace ); } -SfxTabPage* SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return new SwCompatibilityOptPage( pParent, *rAttrSet ); + return VclPtr<SwCompatibilityOptPage>::Create( pParent, *rAttrSet ); } bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* ) diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 05adb529f089..0ce66ad8b874 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -125,10 +125,34 @@ SwLoadOptPage::SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet) m_pShowStandardizedPageCount->SetClickHdl(aLink); } -SfxTabPage* SwLoadOptPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +SwLoadOptPage::~SwLoadOptPage() { - return new SwLoadOptPage(pParent, *rAttrSet ); + disposeOnce(); +} + +void SwLoadOptPage::dispose() +{ + m_pAlwaysRB.clear(); + m_pRequestRB.clear(); + m_pNeverRB.clear(); + m_pAutoUpdateFields.clear(); + m_pAutoUpdateCharts.clear(); + m_pMetricLB.clear(); + m_pTabFT.clear(); + m_pTabMF.clear(); + m_pUseSquaredPageMode.clear(); + m_pUseCharUnit.clear(); + m_pWordCountED.clear(); + m_pShowStandardizedPageCount.clear(); + m_pStandardizedPageSizeNF.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwLoadOptPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) +{ + return VclPtr<SwLoadOptPage>::Create(pParent, *rAttrSet ); } IMPL_LINK_NOARG(SwLoadOptPage, StandardizedPageCountCheckHdl) @@ -517,17 +541,41 @@ SwCaptionOptPage::SwCaptionOptPage( vcl::Window* pParent, const SfxItemSet& rSet SwCaptionOptPage::~SwCaptionOptPage() { + disposeOnce(); +} + +void SwCaptionOptPage::dispose() +{ DelUserData(); delete pMgr; + m_pCheckLB.clear(); + m_pLbCaptionOrder.clear(); + m_pPreview.clear(); + m_pSettingsGroup.clear(); + m_pCategoryBox.clear(); + m_pFormatText.clear(); + m_pFormatBox.clear(); + m_pNumberingSeparatorFT.clear(); + m_pNumberingSeparatorED.clear(); + m_pTextText.clear(); + m_pTextEdit.clear(); + m_pPosBox.clear(); + m_pNumCapt.clear(); + m_pLbLevel.clear(); + m_pEdDelim.clear(); + m_pCategory.clear(); + m_pCharStyleLB.clear(); + m_pApplyBorderCB.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwCaptionOptPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwCaptionOptPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return new SwCaptionOptPage(pParent, *rAttrSet ); + return VclPtr<SwCaptionOptPage>::Create( pParent, *rAttrSet ); } -bool SwCaptionOptPage::FillItemSet( SfxItemSet* ) +bool SwCaptionOptPage::FillItemSet( SfxItemSet* ) { bool bRet = false; SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 28533ce50e0f..8a595b87285f 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -156,12 +156,38 @@ SwContentOptPage::SwContentOptPage( vcl::Window* pParent, SwContentOptPage::~SwContentOptPage() { + disposeOnce(); } -SfxTabPage* SwContentOptPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +void SwContentOptPage::dispose() { - return new SwContentOptPage(pParent, *rAttrSet); + m_pCrossCB.clear(); + m_pHScrollBox.clear(); + m_pVScrollBox.clear(); + m_pAnyRulerCB.clear(); + m_pHRulerCBox.clear(); + m_pHMetric.clear(); + m_pVRulerCBox.clear(); + m_pVRulerRightCBox.clear(); + m_pVMetric.clear(); + m_pSmoothCBox.clear(); + m_pGrfCB.clear(); + m_pTblCB.clear(); + m_pDrwCB.clear(); + m_pFldNameCB.clear(); + m_pPostItCB.clear(); + m_pSettingsFrame.clear(); + m_pSettingsLabel.clear(); + m_pMetricLabel.clear(); + m_pMetricLB.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwContentOptPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) +{ + return VclPtr<SwContentOptPage>::Create(pParent, *rAttrSet); } static void lcl_SelectMetricLB(ListBox* rMetric, sal_uInt16 nSID, const SfxItemSet& rSet) @@ -352,6 +378,36 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(vcl::Window* pParent, m_pProspectCB_RTL->Show(aCTLOptions.IsCTLFontEnabled()); } +SwAddPrinterTabPage::~SwAddPrinterTabPage() +{ + disposeOnce(); +} + +void SwAddPrinterTabPage::dispose() +{ + m_pGrfCB.clear(); + m_pCtrlFldCB.clear(); + m_pBackgroundCB.clear(); + m_pBlackFontCB.clear(); + m_pPrintHiddenTextCB.clear(); + m_pPrintTextPlaceholderCB.clear(); + m_pPagesFrame.clear(); + m_pLeftPageCB.clear(); + m_pRightPageCB.clear(); + m_pProspectCB.clear(); + m_pProspectCB_RTL.clear(); + m_pCommentsFrame.clear(); + m_pNoRB.clear(); + m_pOnlyRB.clear(); + m_pEndRB.clear(); + m_pEndPageRB.clear(); + m_pInMarginsRB.clear(); + m_pPrintEmptyPagesCB.clear(); + m_pPaperFromSetupCB.clear(); + m_pFaxLB.clear(); + SfxTabPage::dispose(); +} + void SwAddPrinterTabPage::SetPreview(bool bPrev) { bPreview = bPrev; @@ -359,10 +415,11 @@ void SwAddPrinterTabPage::SetPreview(bool bPrev) m_pPagesFrame->Enable(!bPreview); } -SfxTabPage* SwAddPrinterTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwAddPrinterTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwAddPrinterTabPage( pParent, *rAttrSet ) ); + return VclPtr<SfxTabPage>(new SwAddPrinterTabPage( pParent, *rAttrSet ), + SAL_NO_ACQUIRE); } bool SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet ) @@ -573,17 +630,35 @@ SwStdFontTabPage::SwStdFontTabPage( vcl::Window* pParent, SwStdFontTabPage::~SwStdFontTabPage() { - delete pFontList; - if (bDeletePrinter) - { - delete pPrt; - } + disposeOnce(); } -SfxTabPage* SwStdFontTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +void SwStdFontTabPage::dispose() { - return new SwStdFontTabPage(pParent, *rAttrSet); + delete pFontList; + if (bDeletePrinter) + pPrt.disposeAndClear(); + pLabelFT.clear(); + pStandardBox.clear(); + pStandardHeightLB.clear(); + pTitleBox.clear(); + pTitleHeightLB.clear(); + pListBox.clear(); + pListHeightLB.clear(); + pLabelBox.clear(); + pLabelHeightLB.clear(); + pIdxBox.clear(); + pIndexHeightLB.clear(); + pDocOnlyCB.clear(); + pStandardPB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwStdFontTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>(new SwStdFontTabPage(pParent, *rAttrSet), + SAL_NO_ACQUIRE); } static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType, @@ -758,7 +833,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet) if (bDeletePrinter) { - delete pPrt; + pPrt.disposeAndClear(); } if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_PRINTER, false, &pItem)) @@ -771,7 +846,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet) SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - pPrt = new SfxPrinter(pPrinterSet); + pPrt = VclPtr<SfxPrinter>::Create(pPrinterSet); } delete pFontList; pFontList = new FontList( pPrt ); @@ -1082,12 +1157,33 @@ SwTableOptionsTabPage::SwTableOptionsTabPage( vcl::Window* pParent, const SfxIte SwTableOptionsTabPage::~SwTableOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwTableOptionsTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +void SwTableOptionsTabPage::dispose() { - return new SwTableOptionsTabPage(pParent, *rAttrSet ); + pHeaderCB.clear(); + pRepeatHeaderCB.clear(); + pDontSplitCB.clear(); + pBorderCB.clear(); + pNumFormattingCB.clear(); + pNumFmtFormattingCB.clear(); + pNumAlignmentCB.clear(); + pRowMoveMF.clear(); + pColMoveMF.clear(); + pRowInsertMF.clear(); + pColInsertMF.clear(); + pFixRB.clear(); + pFixPropRB.clear(); + pVarRB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwTableOptionsTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>( new SwTableOptionsTabPage(pParent, *rAttrSet ), + SAL_NO_ACQUIRE ); } bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -1318,11 +1414,36 @@ SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( vcl::Window* pParent, SwShdwCrsrOptionsTabPage::~SwShdwCrsrOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +void SwShdwCrsrOptionsTabPage::dispose() { - return new SwShdwCrsrOptionsTabPage( pParent, *rSet ); + m_pParaCB.clear(); + m_pSHyphCB.clear(); + m_pSpacesCB.clear(); + m_pHSpacesCB.clear(); + m_pTabCB.clear(); + m_pBreakCB.clear(); + m_pCharHiddenCB.clear(); + m_pFldHiddenCB.clear(); + m_pFldHiddenParaCB.clear(); + m_pDirectCursorFrame.clear(); + m_pOnOffCB.clear(); + m_pFillMarginRB.clear(); + m_pFillIndentRB.clear(); + m_pFillTabRB.clear(); + m_pFillSpaceRB.clear(); + m_pCursorProtFrame.clear(); + m_pCrsrInProtCB.clear(); + m_pIgnoreProtCB.clear(); + m_pMathBaselineAlignmentCB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +{ + return VclPtr<SfxTabPage>(new SwShdwCrsrOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwShdwCrsrOptionsTabPage::PageCreated( const SfxAllItemSet& aSet ) @@ -1659,7 +1780,7 @@ namespace } SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, - const SfxItemSet& rSet ) + const SfxItemSet& rSet ) : SfxTabPage(pParent, "OptRedLinePage", "modules/swriter/ui/optredlinepage.ui" , &rSet) , sNone(SW_RESSTR(SW_STR_NONE)) @@ -1731,11 +1852,29 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet) +void SwRedlineOptionsTabPage::dispose() { - return new SwRedlineOptionsTabPage( pParent, *rSet ); + pInsertLB.clear(); + pInsertColorLB.clear(); + pInsertedPreviewWN.clear(); + pDeletedLB.clear(); + pDeletedColorLB.clear(); + pDeletedPreviewWN.clear(); + pChangedLB.clear(); + pChangedColorLB.clear(); + pChangedPreviewWN.clear(); + pMarkPosLB.clear(); + pMarkColorLB.clear(); + pMarkPreviewWN.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet) +{ + return VclPtr<SfxTabPage>( new SwRedlineOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE ); } bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -2232,11 +2371,24 @@ SwCompareOptionsTabPage::SwCompareOptionsTabPage( vcl::Window* pParent, const S SwCompareOptionsTabPage::~SwCompareOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +void SwCompareOptionsTabPage::dispose() { - return new SwCompareOptionsTabPage( pParent, *rAttrSet ); + m_pAutoRB.clear(); + m_pWordRB.clear(); + m_pCharRB.clear(); + m_pRsidCB.clear(); + m_pIgnoreCB.clear(); + m_pLenNF.clear(); + m_pStoreRsidCB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>(new SwCompareOptionsTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE); } bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -2367,10 +2519,30 @@ SwTestTabPage::SwTestTabPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) } -SfxTabPage* SwTestTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +SwTestTabPage::~SwTestTabPage() +{ + disposeOnce(); +} + +void SwTestTabPage::dispose() +{ + m_pTest1CBox.clear(); + m_pTest2CBox.clear(); + m_pTest3CBox.clear(); + m_pTest4CBox.clear(); + m_pTest5CBox.clear(); + m_pTest6CBox.clear(); + m_pTest7CBox.clear(); + m_pTest8CBox.clear(); + m_pTest9CBox.clear(); + m_pTest10CBox.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwTestTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return new SwTestTabPage(pParent, *rAttrSet); + return VclPtr<SwTestTabPage>::Create(pParent, *rAttrSet); } bool SwTestTabPage::FillItemSet( SfxItemSet* rCoreSet ) diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 63bcbca4c579..e69a4ead6fb0 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -199,7 +199,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) Size aSize = pHeaderTreeContainer->LogicToPixel(Size(182 , 102), MAP_APPFONT); pHeaderTreeContainer->set_width_request(aSize.Width()); pHeaderTreeContainer->set_height_request(aSize.Height()); - m_pListLB = new SwAddrSourceLB(*pHeaderTreeContainer); + m_pListLB = VclPtr<SwAddrSourceLB>::Create(*pHeaderTreeContainer); m_pListLB->InsertHeaderEntry(m_sName + "\t" + m_sTable); m_pListLB->setColSizes(); @@ -265,6 +265,11 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) SwAddressListDialog::~SwAddressListDialog() { + disposeOnce(); +} + +void SwAddressListDialog::dispose() +{ SvTreeListEntry* pEntry = m_pListLB->First(); while(pEntry) { @@ -272,7 +277,16 @@ SwAddressListDialog::~SwAddressListDialog() delete pUserData; pEntry = m_pListLB->Next( pEntry ); } - delete m_pListLB; + m_pListLB.disposeAndClear(); + m_pAddressPage.clear(); + m_pDescriptionFI.clear(); + m_pLoadListPB.clear(); + m_pCreateListPB.clear(); + m_pFilterPB.clear(); + m_pEditPB.clear(); + m_pTablePB.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl) @@ -344,8 +358,9 @@ IMPL_LINK_NOARG(SwAddressListDialog, LoadHdl_Impl) IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton) { OUString sInputURL; - boost::scoped_ptr<SwCreateAddressListDialog> pDlg( - new SwCreateAddressListDialog( + VclPtr<SwCreateAddressListDialog> pDlg( + VclPtr<SwCreateAddressListDialog>::Create( + pButton, sInputURL, m_pAddressPage->GetWizard()->GetConfigItem())); @@ -443,8 +458,9 @@ IMPL_LINK(SwAddressListDialog, EditHdl_Impl, PushButton*, pButton) pUserData->xColumnsSupplier.clear(); pUserData->xConnection.clear(); // will automatically close if it was the las reference - boost::scoped_ptr<SwCreateAddressListDialog> pDlg( - new SwCreateAddressListDialog( + VclPtr<SwCreateAddressListDialog> pDlg( + VclPtr<SwCreateAddressListDialog>::Create( + pButton, pUserData->sURL, m_pAddressPage->GetWizard()->GetConfigItem())); @@ -562,7 +578,7 @@ void SwAddressListDialog::DetectTablesAndQueries( if(nTables > 1 && bWidthDialog) { //now call the table select dialog - if more than one table exists - boost::scoped_ptr<SwSelectDBTableDialog> pDlg(new SwSelectDBTableDialog(this, pUserData->xConnection)); + VclPtrInstance<SwSelectDBTableDialog> pDlg(this, pUserData->xConnection); const OUString sTable = SvTabListBox::GetEntryText(pSelect, ITEMID_TABLE - 1); if(!sTable.isEmpty()) pDlg->SetSelectedTable(sTable, pUserData->nCommandType == CommandType::TABLE); diff --git a/sw/source/ui/dbui/addresslistdialog.hxx b/sw/source/ui/dbui/addresslistdialog.hxx index 50812efef486..708876448579 100644 --- a/sw/source/ui/dbui/addresslistdialog.hxx +++ b/sw/source/ui/dbui/addresslistdialog.hxx @@ -46,17 +46,17 @@ class SwAddrSourceLB; class SwAddressListDialog : public SfxModalDialog { - FixedText* m_pDescriptionFI; + VclPtr<FixedText> m_pDescriptionFI; - SwAddrSourceLB* m_pListLB; + VclPtr<SwAddrSourceLB> m_pListLB; - PushButton* m_pLoadListPB; - PushButton* m_pCreateListPB; - PushButton* m_pFilterPB; - PushButton* m_pEditPB; - PushButton* m_pTablePB; + VclPtr<PushButton> m_pLoadListPB; + VclPtr<PushButton> m_pCreateListPB; + VclPtr<PushButton> m_pFilterPB; + VclPtr<PushButton> m_pEditPB; + VclPtr<PushButton> m_pTablePB; - OKButton* m_pOK; + VclPtr<OKButton> m_pOK; OUString m_sName; OUString m_sTable; @@ -66,7 +66,7 @@ class SwAddressListDialog : public SfxModalDialog bool m_bInSelectHdl; - SwMailMergeAddressBlockPage* m_pAddressPage; + VclPtr<SwMailMergeAddressBlockPage> m_pAddressPage; ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext> m_xDBContext; @@ -87,6 +87,7 @@ class SwAddressListDialog : public SfxModalDialog public: SwAddressListDialog(SwMailMergeAddressBlockPage* pParent); virtual ~SwAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> GetSource(); diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 347ce0a4a5dc..1d8a63103802 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -46,11 +46,11 @@ using namespace ::com::sun::star::ui::dialogs; class SwAddressControl_Impl : public Control { - ScrollBar *m_pScrollBar; - Window *m_pWindow; + VclPtr<ScrollBar> m_pScrollBar; + VclPtr<Window> m_pWindow; - ::std::vector<FixedText*> m_aFixedTexts; - ::std::vector<Edit*> m_aEdits; + ::std::vector<VclPtr<FixedText> > m_aFixedTexts; + ::std::vector<VclPtr<Edit> > m_aEdits; SwCSVData* m_pData; Size m_aWinOutputSize; @@ -74,6 +74,7 @@ class SwAddressControl_Impl : public Control public: SwAddressControl_Impl(vcl::Window* pParent , WinBits nBits ); virtual ~SwAddressControl_Impl(); + virtual void dispose() SAL_OVERRIDE; void SetData(SwCSVData& rDBData); @@ -85,8 +86,8 @@ public: SwAddressControl_Impl::SwAddressControl_Impl(vcl::Window* pParent, WinBits nBits ) : Control(pParent, nBits), - m_pScrollBar(new ScrollBar(this)), - m_pWindow(new vcl::Window(this, WB_DIALOGCONTROL)), + m_pScrollBar(VclPtr<ScrollBar>::Create(this)), + m_pWindow(VclPtr<vcl::Window>::Create(this, WB_DIALOGCONTROL)), m_pData(0), m_nLineHeight(0), m_nCurrentDataSet(0), @@ -113,14 +114,20 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressControlImpl(v SwAddressControl_Impl::~SwAddressControl_Impl() { - ::std::vector<FixedText*>::iterator aTextIter; - for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) - delete *aTextIter; - ::std::vector<Edit*>::iterator aEditIter; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) - delete *aEditIter; - delete m_pScrollBar; - delete m_pWindow; + disposeOnce(); +} + +void SwAddressControl_Impl::dispose() +{ + for(auto aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) + aTextIter->disposeAndClear(); + m_aFixedTexts.clear(); + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) + aEditIter->disposeAndClear(); + m_aEdits.clear(); + m_pScrollBar.clear(); + m_pWindow.clear(); + Control::dispose(); } void SwAddressControl_Impl::SetData(SwCSVData& rDBData) @@ -129,13 +136,11 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData) //when the address data is updated then remove the controls an build again if(m_aFixedTexts.size()) { - ::std::vector<FixedText*>::iterator aTextIter; - for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) - delete *aTextIter; - ::std::vector<Edit*>::iterator aEditIter; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) - delete *aEditIter; + for(auto aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) + aTextIter->disposeAndClear(); m_aFixedTexts.clear(); + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) + aEditIter->disposeAndClear(); m_aEdits.clear(); m_bNoDataSet = true; } @@ -176,8 +181,8 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData) aHeaderIter != m_pData->aDBColumnHeaders.end(); ++aHeaderIter, nEDYPos += m_nLineHeight, nFTYPos += m_nLineHeight, nLines++) { - FixedText* pNewFT = new FixedText(m_pWindow, WB_RIGHT); - Edit* pNewED = new Edit(m_pWindow, WB_BORDER); + VclPtr<FixedText> pNewFT = VclPtr<FixedText>::Create(m_pWindow, WB_RIGHT); + VclPtr<Edit> pNewED = VclPtr<Edit>::Create(m_pWindow, WB_BORDER); //set nLines a position identifier - used in the ModifyHdl pNewED->SetData(reinterpret_cast<void*>(nLines)); pNewED->SetGetFocusHdl(aFocusLink); @@ -244,9 +249,8 @@ void SwAddressControl_Impl::SetCurrentDataSet(sal_uInt32 nSet) OSL_ENSURE(m_pData->aDBData.size() > m_nCurrentDataSet, "wrong data set index"); if(m_pData->aDBData.size() > m_nCurrentDataSet) { - ::std::vector<Edit*>::iterator aEditIter; sal_uInt32 nIndex = 0; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter, ++nIndex) + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter, ++nIndex) { OSL_ENSURE(nIndex < m_pData->aDBData[m_nCurrentDataSet].size(), "number of columns doesn't match number of Edits"); @@ -380,8 +384,7 @@ void SwAddressControl_Impl::Resize() { long nNewEditSize = aSize.Width() - (*m_aEdits.begin())->GetPosPixel().X() - nScrollBarWidth - 6; - ::std::vector<Edit*>::iterator aEditIter; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) { (*aEditIter)->SetSizePixel(Size(nNewEditSize, (*aEditIter)->GetSizePixel().Height())); } @@ -495,8 +498,25 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( SwCreateAddressListDialog::~SwCreateAddressListDialog() { + disposeOnce(); +} + +void SwCreateAddressListDialog::dispose() +{ delete m_pCSVData; - delete m_pFindDlg; + m_pAddressControl.clear(); + m_pNewPB.clear(); + m_pDeletePB.clear(); + m_pFindPB.clear(); + m_pCustomizePB.clear(); + m_pStartPB.clear(); + m_pPrevPB.clear(); + m_pSetNoNF.clear(); + m_pNextPB.clear(); + m_pEndPB.clear(); + m_pOK.clear(); + m_pFindDlg.disposeAndClear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwCreateAddressListDialog, NewHdl_Impl) @@ -541,7 +561,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, FindHdl_Impl) { if(!m_pFindDlg) { - m_pFindDlg = new SwFindEntryDialog(this); + m_pFindDlg = VclPtr<SwFindEntryDialog>::Create(this); ListBox& rColumnBox = m_pFindDlg->GetFieldsListBox(); ::std::vector< OUString >::iterator aHeaderIter; for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin(); @@ -558,7 +578,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, FindHdl_Impl) IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwCustomizeAddressListDialog> pDlg(new SwCustomizeAddressListDialog(pButton, *m_pCSVData)); + VclPtrInstance< SwCustomizeAddressListDialog > pDlg(pButton, *m_pCSVData); if(RET_OK == pDlg->Execute()) { delete m_pCSVData; @@ -751,6 +771,23 @@ SwFindEntryDialog::SwFindEntryDialog(SwCreateAddressListDialog* pParent) m_pCancel->SetClickHdl(LINK(this, SwFindEntryDialog, CloseHdl_Impl)); } +SwFindEntryDialog::~SwFindEntryDialog() +{ + disposeOnce(); +} + +void SwFindEntryDialog::dispose() +{ + m_pFindED.clear(); + m_pFindOnlyCB.clear(); + m_pFindOnlyLB.clear(); + m_pFindPB.clear(); + m_pCancel.clear(); + m_pParent.clear(); + ModelessDialog::dispose(); +} + + IMPL_LINK_NOARG(SwFindEntryDialog, FindHdl_Impl) { sal_Int32 nColumn = -1; diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx index 393c5a79b71e..ac6ed41cfab2 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.hxx +++ b/sw/source/ui/dbui/createaddresslistdialog.hxx @@ -40,27 +40,27 @@ struct SwCSVData class SwFindEntryDialog; class SwCreateAddressListDialog : public SfxModalDialog { - SwAddressControl_Impl* m_pAddressControl; + VclPtr<SwAddressControl_Impl> m_pAddressControl; - PushButton *m_pNewPB; - PushButton *m_pDeletePB; - PushButton *m_pFindPB; - PushButton *m_pCustomizePB; + VclPtr<PushButton> m_pNewPB; + VclPtr<PushButton> m_pDeletePB; + VclPtr<PushButton> m_pFindPB; + VclPtr<PushButton> m_pCustomizePB; - PushButton *m_pStartPB; - PushButton *m_pPrevPB; - NumericField *m_pSetNoNF; - PushButton *m_pNextPB; - PushButton *m_pEndPB; + VclPtr<PushButton> m_pStartPB; + VclPtr<PushButton> m_pPrevPB; + VclPtr<NumericField> m_pSetNoNF; + VclPtr<PushButton> m_pNextPB; + VclPtr<PushButton> m_pEndPB; - OKButton *m_pOK; + VclPtr<OKButton> m_pOK; OUString m_sAddressListFilterName; OUString m_sURL; SwCSVData* m_pCSVData; - SwFindEntryDialog* m_pFindDlg; + VclPtr<SwFindEntryDialog> m_pFindDlg; DECL_LINK(NewHdl_Impl, void *); DECL_LINK(DeleteHdl_Impl, void *); @@ -76,6 +76,7 @@ public: SwCreateAddressListDialog( vcl::Window* pParent, const OUString& rURL, SwMailMergeConfigItem& rConfig); virtual ~SwCreateAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; const OUString& GetURL() const { return m_sURL; } void Find( const OUString& rSearch, sal_Int32 nColumn); @@ -83,14 +84,14 @@ public: class SwFindEntryDialog : public ModelessDialog { - Edit* m_pFindED; - CheckBox* m_pFindOnlyCB; - ListBox* m_pFindOnlyLB; + VclPtr<Edit> m_pFindED; + VclPtr<CheckBox> m_pFindOnlyCB; + VclPtr<ListBox> m_pFindOnlyLB; - PushButton* m_pFindPB; - CancelButton* m_pCancel; + VclPtr<PushButton> m_pFindPB; + VclPtr<CancelButton> m_pCancel; - SwCreateAddressListDialog* m_pParent; + VclPtr<SwCreateAddressListDialog> m_pParent; DECL_LINK(FindHdl_Impl, void *); DECL_LINK(FindEnableHdl_Impl, void *); @@ -98,6 +99,8 @@ class SwFindEntryDialog : public ModelessDialog public: SwFindEntryDialog(SwCreateAddressListDialog* pParent); + virtual ~SwFindEntryDialog(); + virtual void dispose() SAL_OVERRIDE; ListBox& GetFieldsListBox() { diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx index c812fcd37a1a..7ade01841ee4 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx @@ -24,7 +24,6 @@ #include <vcl/msgbox.hxx> #include <dbui.hrc> #include <helpid.h> -#include <boost/scoped_ptr.hpp> SwCustomizeAddressListDialog::SwCustomizeAddressListDialog( vcl::Window* pParent, const SwCSVData& rOldData) @@ -61,8 +60,21 @@ SwCustomizeAddressListDialog::SwCustomizeAddressListDialog( SwCustomizeAddressListDialog::~SwCustomizeAddressListDialog() { + disposeOnce(); } +void SwCustomizeAddressListDialog::dispose() +{ + m_pFieldsLB.clear(); + m_pAddPB.clear(); + m_pDeletePB.clear(); + m_pRenamePB.clear(); + m_pUpPB.clear(); + m_pDownPB.clear(); + SfxModalDialog::dispose(); +} + + IMPL_LINK_NOARG(SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl) { UpdateButtons(); @@ -76,11 +88,11 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) if(nPos == LISTBOX_ENTRY_NOTFOUND) nPos = 0; - boost::scoped_ptr<SwAddRenameEntryDialog> pDlg; + ScopedVclPtr<SwAddRenameEntryDialog> pDlg; if (bRename) - pDlg.reset(new SwRenameEntryDialog(pButton, m_pNewData->aDBColumnHeaders)); + pDlg.reset(VclPtr<SwRenameEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders)); else - pDlg.reset(new SwAddEntryDialog(pButton, m_pNewData->aDBColumnHeaders)); + pDlg.reset(VclPtr<SwAddEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders)); if(bRename) { OUString aTemp = m_pFieldsLB->GetEntry(nPos); @@ -111,7 +123,6 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) m_pFieldsLB->InsertEntry(sNew, nPos); m_pFieldsLB->SelectEntryPos(nPos); } - pDlg.reset(); UpdateButtons(); return 0; } @@ -184,6 +195,18 @@ SwAddRenameEntryDialog::SwAddRenameEntryDialog( ModifyHdl_Impl(m_pFieldNameED); } +SwAddRenameEntryDialog::~SwAddRenameEntryDialog() +{ + disposeOnce(); +} + +void SwAddRenameEntryDialog::dispose() +{ + m_pFieldNameED.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); +} + IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit*, pEdit) { OUString sEntry = pEdit->GetText(); diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx index e0592085047f..e943f657b3f3 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx @@ -29,14 +29,14 @@ struct SwCSVData; class SwCustomizeAddressListDialog : public SfxModalDialog { - ListBox* m_pFieldsLB; + VclPtr<ListBox> m_pFieldsLB; - PushButton* m_pAddPB; - PushButton* m_pDeletePB; - PushButton* m_pRenamePB; + VclPtr<PushButton> m_pAddPB; + VclPtr<PushButton> m_pDeletePB; + VclPtr<PushButton> m_pRenamePB; - PushButton* m_pUpPB; - PushButton* m_pDownPB; + VclPtr<PushButton> m_pUpPB; + VclPtr<PushButton> m_pDownPB; SwCSVData* m_pNewData; @@ -49,20 +49,24 @@ class SwCustomizeAddressListDialog : public SfxModalDialog public: SwCustomizeAddressListDialog(vcl::Window* pParent, const SwCSVData& rOldData); virtual ~SwCustomizeAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; SwCSVData* GetNewData() { return m_pNewData;} }; class SwAddRenameEntryDialog : public SfxModalDialog { - Edit* m_pFieldNameED; - OKButton* m_pOK; + VclPtr<Edit> m_pFieldNameED; + VclPtr<OKButton> m_pOK; const std::vector< OUString >& m_rCSVHeader; DECL_LINK(ModifyHdl_Impl, Edit*); protected: SwAddRenameEntryDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, const std::vector< OUString >& rCSVHeader); + virtual ~SwAddRenameEntryDialog(); + virtual void dispose() SAL_OVERRIDE; + public: void SetFieldName(const OUString& rName) {m_pFieldNameED->SetText(rName);} OUString GetFieldName() const {return m_pFieldNameED->GetText();}; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 29aa77145fdb..43c1e656c188 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -413,10 +413,41 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView, SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot() { + disposeOnce(); +} + +void SwInsertDBColAutoPilot::dispose() +{ delete pTblSet; delete pRep; delete pTAutoFmt; + m_pRbAsTable.clear(); + m_pRbAsField.clear(); + m_pRbAsText.clear(); + m_pHeadFrame.clear(); + m_pLbTblDbColumn.clear(); + m_pLbTxtDbColumn.clear(); + m_pFormatFrame.clear(); + m_pRbDbFmtFromDb.clear(); + m_pRbDbFmtFromUsr.clear(); + m_pLbDbFmtFromUsr.clear(); + m_pIbDbcolToEdit.clear(); + m_pEdDbText.clear(); + m_pFtDbParaColl.clear(); + m_pLbDbParaColl.clear(); + m_pIbDbcolAllTo.clear(); + m_pIbDbcolOneTo.clear(); + m_pIbDbcolOneFrom.clear(); + m_pIbDbcolAllFrom.clear(); + m_pFtTableCol.clear(); + m_pLbTableCol.clear(); + m_pCbTableHeadon.clear(); + m_pRbHeadlColnms.clear(); + m_pRbHeadlEmpty.clear(); + m_pPbTblFormat.clear(); + m_pPbTblAutofmt.clear(); + SfxModalDialog::dispose(); } IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, Button*, pButton ) @@ -768,9 +799,9 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox ) ListBox* pGetBox = pBox == m_pLbDbFmtFromUsr ? ( m_pRbAsTable->IsChecked() ? ( 0 == m_pLbTableCol->GetEntryData( 0 ) - ? m_pLbTblDbColumn - : m_pLbTableCol ) - : m_pLbTxtDbColumn ) + ? m_pLbTblDbColumn.get() + : m_pLbTableCol.get() ) + : m_pLbTxtDbColumn.get() ) : pBox; SwInsDBColumn aSrch( pGetBox->GetSelectEntry(), 0 ); @@ -818,7 +849,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox ) // to know later on, what ListBox was the "active", a Flag // is remembered in the 1st entry - void* pPtr = pBox == m_pLbTableCol ? m_pLbTableCol : 0; + void* pPtr = pBox == m_pLbTableCol ? m_pLbTableCol.get() : 0; m_pLbTableCol->SetEntryData( 0, pPtr ); } return 0; diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx index 4eb019abf21e..fd9e2eb34f5c 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx @@ -81,11 +81,19 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(vcl::Window* pParent, uno::Sequen SwDBTablePreviewDialog::~SwDBTablePreviewDialog() { + disposeOnce(); +} + +void SwDBTablePreviewDialog::dispose() +{ if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); m_xFrame->dispose(); } + m_pDescriptionFI.clear(); + m_pBeamerWIN.clear(); + SfxModalDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.hxx b/sw/source/ui/dbui/dbtablepreviewdialog.hxx index e99b7f457525..bae176de7b74 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.hxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.hxx @@ -31,14 +31,15 @@ namespace com{ namespace sun{ namespace star{ class SwDBTablePreviewDialog : public SfxModalDialog { - FixedText* m_pDescriptionFI; - vcl::Window* m_pBeamerWIN; + VclPtr<FixedText> m_pDescriptionFI; + VclPtr<vcl::Window> m_pBeamerWIN; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xFrame; public: SwDBTablePreviewDialog(vcl::Window* pParent, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rValues ); virtual ~SwDBTablePreviewDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx index 9a577c41edb1..068b08ffd54f 100644 --- a/sw/source/ui/dbui/mailmergewizard.cxx +++ b/sw/source/ui/dbui/mailmergewizard.cxx @@ -101,19 +101,19 @@ SwMailMergeWizard::~SwMailMergeWizard() { } -OWizardPage* SwMailMergeWizard::createPage(WizardState _nState) +VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState) { - OWizardPage* pRet = 0; + VclPtr<OWizardPage> pRet; switch(_nState) { - case MM_DOCUMENTSELECTPAGE : pRet = new SwMailMergeDocSelectPage(this); break; - case MM_OUTPUTTYPETPAGE : pRet = new SwMailMergeOutputTypePage(this); break; - case MM_ADDRESSBLOCKPAGE : pRet = new SwMailMergeAddressBlockPage(this); break; - case MM_GREETINGSPAGE : pRet = new SwMailMergeGreetingsPage(this); break; - case MM_LAYOUTPAGE : pRet = new SwMailMergeLayoutPage(this); break; - case MM_PREPAREMERGEPAGE : pRet = new SwMailMergePrepareMergePage(this); break; - case MM_MERGEPAGE : pRet = new SwMailMergeMergePage(this); break; - case MM_OUTPUTPAGE : pRet = new SwMailMergeOutputPage(this); break; + case MM_DOCUMENTSELECTPAGE : pRet = VclPtr<SwMailMergeDocSelectPage>::Create(this); break; + case MM_OUTPUTTYPETPAGE : pRet = VclPtr<SwMailMergeOutputTypePage>::Create(this); break; + case MM_ADDRESSBLOCKPAGE : pRet = VclPtr<SwMailMergeAddressBlockPage>::Create(this); break; + case MM_GREETINGSPAGE : pRet = VclPtr<SwMailMergeGreetingsPage>::Create(this); break; + case MM_LAYOUTPAGE : pRet = VclPtr<SwMailMergeLayoutPage>::Create(this); break; + case MM_PREPAREMERGEPAGE : pRet = VclPtr<SwMailMergePrepareMergePage>::Create(this); break; + case MM_MERGEPAGE : pRet = VclPtr<SwMailMergeMergePage>::Create(this); break; + case MM_OUTPUTPAGE : pRet = VclPtr<SwMailMergeOutputPage>::Create(this); break; } OSL_ENSURE(pRet, "no page created in ::createPage"); return pRet; diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 44d7ff52b384..37a06cc86276 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -93,6 +93,32 @@ SwMailMergeAddressBlockPage::SwMailMergeAddressBlockPage( SwMailMergeWizard* _pP m_pNextSetIB->SetClickHdl(aLink); } +SwMailMergeAddressBlockPage::~SwMailMergeAddressBlockPage() +{ + disposeOnce(); +} + +void SwMailMergeAddressBlockPage::dispose() +{ + m_pAddressListPB.clear(); + m_pCurrentAddressFI.clear(); + m_pStep2.clear(); + m_pStep3.clear(); + m_pStep4.clear(); + m_pSettingsFI.clear(); + m_pAddressCB.clear(); + m_pSettingsWIN.clear(); + m_pSettingsPB.clear(); + m_pHideEmptyParagraphsCB.clear(); + m_pAssignPB.clear(); + m_pPreviewWIN.clear(); + m_pDocumentIndexFI.clear(); + m_pPrevSetIB.clear(); + m_pNextSetIB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + bool SwMailMergeAddressBlockPage::canAdvance() const { return m_pWizard->GetConfigItem().GetResultSet().is(); @@ -137,7 +163,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl) { try { - boost::scoped_ptr<SwAddressListDialog> xAddrDialog(new SwAddressListDialog(this)); + VclPtrInstance< SwAddressListDialog > xAddrDialog(this); if(RET_OK == xAddrDialog->Execute()) { SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem(); @@ -163,8 +189,8 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl) IMPL_LINK(SwMailMergeAddressBlockPage, SettingsHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwSelectAddressBlockDialog> pDlg( - new SwSelectAddressBlockDialog(pButton, m_pWizard->GetConfigItem())); + VclPtr<SwSelectAddressBlockDialog> pDlg( + VclPtr<SwSelectAddressBlockDialog>::Create(pButton, m_pWizard->GetConfigItem())); SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem(); pDlg->SetAddressBlocks(rConfig.GetAddressBlocks(), m_pSettingsWIN->GetSelectedAddress()); pDlg->SetSettings(rConfig.IsIncludeCountry(), rConfig.GetExcludeCountry()); @@ -193,8 +219,8 @@ IMPL_LINK(SwMailMergeAddressBlockPage, AssignHdl_Impl, PushButton*, pButton) SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem(); const sal_uInt16 nSel = m_pSettingsWIN->GetSelectedAddress(); const uno::Sequence< OUString> aBlocks = rConfigItem.GetAddressBlocks(); - boost::scoped_ptr<SwAssignFieldsDialog> pDlg( - new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), aBlocks[nSel], true)); + VclPtr<SwAssignFieldsDialog> pDlg( + VclPtr<SwAssignFieldsDialog>::Create(pButton, m_pWizard->GetConfigItem(), aBlocks[nSel], true)); if(RET_OK == pDlg->Execute()) { //preview update @@ -330,6 +356,20 @@ SwSelectAddressBlockDialog::SwSelectAddressBlockDialog( SwSelectAddressBlockDialog::~SwSelectAddressBlockDialog() { + disposeOnce(); +} + +void SwSelectAddressBlockDialog::dispose() +{ + m_pPreview.clear(); + m_pNewPB.clear(); + m_pCustomizePB.clear(); + m_pDeletePB.clear(); + m_pNeverRB.clear(); + m_pAlwaysRB.clear(); + m_pDependentRB.clear(); + m_pCountryED.clear(); + SfxModalDialog::dispose(); } void SwSelectAddressBlockDialog::SetAddressBlocks(const uno::Sequence< OUString>& rBlocks, @@ -413,8 +453,8 @@ IMPL_LINK(SwSelectAddressBlockDialog, NewCustomizeHdl_Impl, PushButton*, pButton SwCustomizeAddressBlockDialog::DialogType nType = bCustomize ? SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT : SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW; - boost::scoped_ptr<SwCustomizeAddressBlockDialog> pDlg( - new SwCustomizeAddressBlockDialog(pButton,m_rConfig,nType)); + VclPtr<SwCustomizeAddressBlockDialog> pDlg( + VclPtr<SwCustomizeAddressBlockDialog>::Create(pButton,m_rConfig,nType)); if(bCustomize) { pDlg->SetAddress(m_aAddressBlocks[m_pPreview->GetSelectedAddress()]); @@ -533,6 +573,26 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( SwCustomizeAddressBlockDialog::~SwCustomizeAddressBlockDialog() { + disposeOnce(); +} + +void SwCustomizeAddressBlockDialog::dispose() +{ + m_pAddressElementsFT.clear(); + m_pAddressElementsLB.clear(); + m_pInsertFieldIB.clear(); + m_pRemoveFieldIB.clear(); + m_pDragFT.clear(); + m_pDragED.clear(); + m_pUpIB.clear(); + m_pLeftIB.clear(); + m_pRightIB.clear(); + m_pDownIB.clear(); + m_pFieldFT.clear(); + m_pFieldCB.clear(); + m_pPreviewWIN.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, OKHdl_Impl) @@ -746,13 +806,13 @@ OUString SwCustomizeAddressBlockDialog::GetAddress() class SwAssignFieldsControl : public Control { friend class SwAssignFieldsDialog; - ScrollBar m_aVScroll; - HeaderBar m_aHeaderHB; - Window m_aWindow; + VclPtr<ScrollBar> m_aVScroll; + VclPtr<HeaderBar> m_aHeaderHB; + VclPtr<Window> m_aWindow; - ::std::vector<FixedText*> m_aFieldNames; - ::std::vector<ListBox*> m_aMatches; - ::std::vector<FixedText*> m_aPreviews; + ::std::vector<VclPtr<FixedText> > m_aFieldNames; + ::std::vector<VclPtr<ListBox> > m_aMatches; + ::std::vector<VclPtr<FixedText> > m_aPreviews; SwMailMergeConfigItem* m_rConfigItem; @@ -773,6 +833,7 @@ class SwAssignFieldsControl : public Control public: SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits); virtual ~SwAssignFieldsControl(); + virtual void dispose() SAL_OVERRIDE; void Init(SwMailMergeConfigItem& rConfigItem); void SetModifyHdl(const Link& rModifyHdl) @@ -791,23 +852,23 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAssignFieldsControl( SwAssignFieldsControl::SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits) : Control(pParent, nBits | WB_DIALOGCONTROL | WB_TABSTOP | WB_DIALOGCONTROL), - m_aVScroll(this), - m_aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER), - m_aWindow(this, WB_BORDER | WB_DIALOGCONTROL), + m_aVScroll(VclPtr<ScrollBar>::Create(this)), + m_aHeaderHB(VclPtr<HeaderBar>::Create(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER)), + m_aWindow(VclPtr<vcl::Window>::Create(this, WB_BORDER | WB_DIALOGCONTROL)), m_rConfigItem(NULL), m_nLBStartTopPos(0), m_nYOffset(0), m_nFirstYPos(0) { - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); Size aOutputSize(GetOutputSize()); - m_aVScroll.Show(); - m_aHeaderHB.SetSizePixel( + m_aVScroll->Show(); + m_aHeaderHB->SetSizePixel( Size(aOutputSize.Width(), nHBHeight)); - m_aHeaderHB.Show(); - m_aWindow.SetPosPixel(Point( 0, nHBHeight) ); - m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); - m_aWindow.Show(); + m_aHeaderHB->Show(); + m_aWindow->SetPosPixel(Point( 0, nHBHeight) ); + m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aWindow->Show(); } Size SwAssignFieldsControl::GetOptimalSize() const @@ -819,7 +880,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) { m_rConfigItem = &rConfigItem; Size aOutputSize(GetOutputSize()); - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); //get the name of the default headers const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders(); @@ -845,9 +906,9 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) for(sal_uInt32 i = 0; i < rHeaders.Count(); ++i) { const OUString rHeader = rHeaders.GetString( i ); - FixedText* pNewText = new FixedText(&m_aWindow, WB_VCENTER); + VclPtr<FixedText> pNewText = VclPtr<FixedText>::Create(m_aWindow.get(), WB_VCENTER); pNewText->SetText("<" + rHeader + ">"); - ListBox* pNewLB = new ListBox(&m_aWindow, WB_DROPDOWN | WB_VCENTER | WB_TABSTOP); + VclPtr<ListBox> pNewLB = VclPtr<ListBox>::Create(m_aWindow.get(), WB_DROPDOWN | WB_VCENTER | WB_TABSTOP); pNewText->set_mnemonic_widget(pNewLB); pNewLB->InsertEntry(SW_RESSTR(SW_STR_NONE)); pNewLB->SelectEntryPos(0); @@ -861,7 +922,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField) pNewLB->InsertEntry(pFields[nField]); - FixedText* pNewPreview = new FixedText(&m_aWindow, WB_VCENTER); + VclPtr<FixedText> pNewPreview = VclPtr<FixedText>::Create(m_aWindow.get(), WB_VCENTER); pNewText->SetSizePixel(Size(nControlWidth - 6, nControlHeight)); pNewLB->SetSizePixel(Size(nControlWidth - 6, nControlHeight)); pNewPreview->SetSizePixel(Size(aOutputSize.Width() - 2 * nControlWidth, nControlHeight)); @@ -911,26 +972,38 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) pNewPreview->Show(); pNewPreview->SetPosPixel(Point(2 * nControlWidth + 6, nMove)); } - m_aVScroll.SetRange(Range(0, rHeaders.Count())); - m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); - m_aVScroll.EnableDrag(); - m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize()); - m_aVScroll.SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl)); + m_aVScroll->SetRange(Range(0, rHeaders.Count())); + m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); + m_aVScroll->EnableDrag(); + m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize()); + m_aVScroll->SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl)); - m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight)); - m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight)); + m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); } SwAssignFieldsControl::~SwAssignFieldsControl() { - ::std::vector<FixedText*>::iterator aFIIter; - for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) - delete *aFIIter; - ::std::vector<ListBox*>::iterator aLBIter; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) - delete *aLBIter; - for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) - delete *aFIIter; + disposeOnce(); +} + +void SwAssignFieldsControl::dispose() +{ + for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) + aFIIter->disposeAndClear(); + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) + aLBIter->disposeAndClear(); + for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) + aFIIter->disposeAndClear(); + + m_aFieldNames.clear(); + m_aMatches.clear(); + m_aPreviews.clear(); + + m_aVScroll.disposeAndClear(); + m_aHeaderHB.disposeAndClear(); + m_aWindow.disposeAndClear(); + Control::dispose(); } void SwAssignFieldsControl::Resize() @@ -938,22 +1011,22 @@ void SwAssignFieldsControl::Resize() Window::Resize(); Size aOutputSize = GetOutputSize(); - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); - m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); - m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight)); - m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight)); + m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); if(m_nYOffset) - m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); - m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize()); - m_aVScroll.DoScroll(0); + m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); + m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize()); + m_aVScroll->DoScroll(0); sal_Int32 nColWidth = aOutputSize.Width() / 3; - m_aHeaderHB.SetSizePixel(Size(aOutputSize.Width(), nHBHeight)); - m_aHeaderHB.SetItemSize(1, nColWidth); - m_aHeaderHB.SetItemSize(2, nColWidth); - m_aHeaderHB.SetItemSize(3, nColWidth); + m_aHeaderHB->SetSizePixel(Size(aOutputSize.Width(), nHBHeight)); + m_aHeaderHB->SetItemSize(1, nColWidth); + m_aHeaderHB->SetItemSize(2, nColWidth); + m_aHeaderHB->SetItemSize(3, nColWidth); if (m_aFieldNames.empty() || m_aMatches.empty()) return; @@ -961,16 +1034,14 @@ void SwAssignFieldsControl::Resize() long nControlHeight = std::max(m_aFieldNames[0]->get_preferred_size().Height(), m_aMatches[0]->get_preferred_size().Height()); - ::std::vector<FixedText*>::iterator aFIIter; - for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) + for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) (*aFIIter)->SetSizePixel(Size(nColWidth - 6, nControlHeight)); - ::std::vector<ListBox*>::iterator aLBIter; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) { long nPosY = (*aLBIter)->GetPosPixel().Y(); (*aLBIter)->SetPosSizePixel(Point(nColWidth, nPosY), Size(nColWidth - 6, nControlHeight)); } - for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) + for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) { long nPosY = (*aFIIter)->GetPosPixel().Y(); (*aFIIter)->SetPosSizePixel(Point(2 * nColWidth + 6, nPosY), Size(nColWidth, nControlHeight)); @@ -988,7 +1059,7 @@ void SwAssignFieldsControl::Command( const CommandEvent& rCEvt ) const CommandWheelData* pWheelData = rCEvt.GetWheelData(); if(pWheelData && !pWheelData->IsHorz() && CommandWheelMode::ZOOM != pWheelData->GetMode()) { - HandleScrollCommand( rCEvt, 0, &m_aVScroll ); + HandleScrollCommand( rCEvt, 0, m_aVScroll.get() ); } } break; @@ -1014,15 +1085,15 @@ bool SwAssignFieldsControl::PreNotify( NotifyEvent& rNEvt ) void SwAssignFieldsControl::MakeVisible( sal_Int32 nIndex ) { - long nThumb = m_aVScroll.GetThumbPos(); - long nPage = m_aVScroll.GetPageSize(); + long nThumb = m_aVScroll->GetThumbPos(); + long nPage = m_aVScroll->GetPageSize(); if(nThumb > nIndex) - m_aVScroll.SetThumbPos( nIndex ); + m_aVScroll->SetThumbPos( nIndex ); else if( (nThumb + nPage) < nIndex) - m_aVScroll.SetThumbPos( nIndex - nPage ); + m_aVScroll->SetThumbPos( nIndex - nPage ); else return; - ScrollHdl_Impl( &m_aVScroll ); + ScrollHdl_Impl( m_aVScroll.get() ); } IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll) @@ -1035,14 +1106,11 @@ IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll) long nMove = m_nFirstYPos - (*m_aMatches.begin())->GetPosPixel().Y() - (nThumb * m_nYOffset); SetUpdateMode(false); - long nIndex; - ::std::vector<FixedText*>::iterator aFIIter; - for(nIndex = 0, aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter, ++nIndex) + for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) lcl_Move(*aFIIter, nMove); - ::std::vector<ListBox*>::iterator aLBIter; - for(nIndex = 0, aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) lcl_Move(*aLBIter, nMove); - for(nIndex = 0, aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter, ++nIndex) + for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) lcl_Move(*aFIIter, nMove); SetUpdateMode(true); @@ -1071,9 +1139,8 @@ IMPL_LINK(SwAssignFieldsControl, MatchHdl_Impl, ListBox*, pBox) } } } - ::std::vector<ListBox*>::iterator aLBIter; sal_Int32 nIndex = 0; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) { if(*aLBIter == pBox) { @@ -1090,8 +1157,7 @@ IMPL_LINK(SwAssignFieldsControl, GotFocusHdl_Impl, ListBox*, pBox) if(0 != (GETFOCUS_TAB & pBox->GetGetFocusFlags())) { sal_Int32 nIndex = 0; - ::std::vector<ListBox*>::iterator aLBIter; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) { if(*aLBIter == pBox) { @@ -1132,13 +1198,13 @@ SwAssignFieldsDialog::SwAssignFieldsDialog( sAddressElement = SW_RESSTR(ST_SALUTATIONELEMENT); } - Size aOutputSize(m_pFieldsControl->m_aHeaderHB.GetSizePixel()); + Size aOutputSize(m_pFieldsControl->m_aHeaderHB->GetSizePixel()); sal_Int32 nFirstWidth; sal_Int32 nSecondWidth = nFirstWidth = aOutputSize.Width() / 3; const HeaderBarItemBits nHeadBits = HeaderBarItemBits::VCENTER | HeaderBarItemBits::FIXED| HeaderBarItemBits::FIXEDPOS; - m_pFieldsControl->m_aHeaderHB.InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HeaderBarItemBits::LEFT); - m_pFieldsControl->m_aHeaderHB.InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT); - m_pFieldsControl->m_aHeaderHB.InsertItem( 3, sPreview, + m_pFieldsControl->m_aHeaderHB->InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HeaderBarItemBits::LEFT); + m_pFieldsControl->m_aHeaderHB->InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT); + m_pFieldsControl->m_aHeaderHB->InsertItem( 3, sPreview, aOutputSize.Width() - nFirstWidth - nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT); m_pFieldsControl->SetModifyHdl(LINK(this, SwAssignFieldsDialog, AssignmentModifyHdl_Impl )); @@ -1150,6 +1216,17 @@ SwAssignFieldsDialog::SwAssignFieldsDialog( SwAssignFieldsDialog::~SwAssignFieldsDialog() { + disposeOnce(); +} + +void SwAssignFieldsDialog::dispose() +{ + m_pMatchingFI.clear(); + m_pFieldsControl.clear(); + m_pPreviewFI.clear(); + m_pPreviewWIN.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } uno::Sequence< OUString > SwAssignFieldsDialog::CreateAssignments() @@ -1157,9 +1234,8 @@ uno::Sequence< OUString > SwAssignFieldsDialog::CreateAssignments() uno::Sequence< OUString > aAssignments( m_rConfigItem.GetDefaultAddressHeaders().Count()); OUString* pAssignments = aAssignments.getArray(); - ::std::vector<ListBox*>::iterator aLBIter; sal_Int32 nIndex = 0; - for(aLBIter = m_pFieldsControl->m_aMatches.begin(); + for(auto aLBIter = m_pFieldsControl->m_aMatches.begin(); aLBIter != m_pFieldsControl->m_aMatches.end(); ++aLBIter, ++nIndex) { @@ -1202,6 +1278,18 @@ DDListBox::DDListBox(vcl::Window* pParent, WinBits nStyle) } +DDListBox::~DDListBox() +{ + disposeOnce(); +} + +void DDListBox::dispose() +{ + m_pParentDialog.clear(); + SvTreeListBox::dispose(); +} + + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeDDListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap) { WinBits nWinStyle = WB_TABSTOP; @@ -1246,6 +1334,19 @@ AddressMultiLineEdit::AddressMultiLineEdit(vcl::Window* pParent, WinBits nBits) EnableFocusSelectionHide(false); } +AddressMultiLineEdit::~AddressMultiLineEdit() +{ + disposeOnce(); +} + +void AddressMultiLineEdit::dispose() +{ + EndListening(*GetTextEngine()); + m_pParentDialog.clear(); + VclMultiLineEdit::dispose(); +} + + Size AddressMultiLineEdit::GetOptimalSize() const { return LogicToPixel(Size(160, 60), MAP_APPFONT); @@ -1265,11 +1366,6 @@ void AddressMultiLineEdit::SetAddressDialog(SwCustomizeAddressBlockDialog *pPare m_pParentDialog = pParent; } -AddressMultiLineEdit::~AddressMultiLineEdit() -{ - EndListening(*GetTextEngine()); -} - void AddressMultiLineEdit::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { if (m_aSelectionLink.IsSet() && dynamic_cast<const TextHint*>(&rHint)) diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx index 6824bed6f897..2f93a750f1b1 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.hxx +++ b/sw/source/ui/dbui/mmaddressblockpage.hxx @@ -37,31 +37,31 @@ class SwMailMergeConfigItem; class SwMailMergeAddressBlockPage : public svt::OWizardPage { - PushButton* m_pAddressListPB; - FixedText* m_pCurrentAddressFI; + VclPtr<PushButton> m_pAddressListPB; + VclPtr<FixedText> m_pCurrentAddressFI; - VclContainer* m_pStep2; - VclContainer* m_pStep3; - VclContainer* m_pStep4; + VclPtr<VclContainer> m_pStep2; + VclPtr<VclContainer> m_pStep3; + VclPtr<VclContainer> m_pStep4; - FixedText* m_pSettingsFI; - CheckBox* m_pAddressCB; - SwAddressPreview* m_pSettingsWIN; - PushButton* m_pSettingsPB; - CheckBox* m_pHideEmptyParagraphsCB; + VclPtr<FixedText> m_pSettingsFI; + VclPtr<CheckBox> m_pAddressCB; + VclPtr<SwAddressPreview> m_pSettingsWIN; + VclPtr<PushButton> m_pSettingsPB; + VclPtr<CheckBox> m_pHideEmptyParagraphsCB; - PushButton* m_pAssignPB; + VclPtr<PushButton> m_pAssignPB; - SwAddressPreview* m_pPreviewWIN; - FixedText* m_pDocumentIndexFI; - PushButton* m_pPrevSetIB; - PushButton* m_pNextSetIB; + VclPtr<SwAddressPreview> m_pPreviewWIN; + VclPtr<FixedText> m_pDocumentIndexFI; + VclPtr<PushButton> m_pPrevSetIB; + VclPtr<PushButton> m_pNextSetIB; OUString m_sDocument; OUString m_sCurrentAddress; OUString m_sChangeAddress; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(AddressListHdl_Impl, void *); DECL_LINK(SettingsHdl_Impl, PushButton*); @@ -79,20 +79,22 @@ class SwMailMergeAddressBlockPage : public svt::OWizardPage public: SwMailMergeAddressBlockPage(SwMailMergeWizard* _pParent); + virtual ~SwMailMergeAddressBlockPage(); + virtual void dispose() SAL_OVERRIDE; SwMailMergeWizard* GetWizard() { return m_pWizard; } }; class SwSelectAddressBlockDialog : public SfxModalDialog { - SwAddressPreview* m_pPreview; - PushButton* m_pNewPB; - PushButton* m_pCustomizePB; - PushButton* m_pDeletePB; + VclPtr<SwAddressPreview> m_pPreview; + VclPtr<PushButton> m_pNewPB; + VclPtr<PushButton> m_pCustomizePB; + VclPtr<PushButton> m_pDeletePB; - RadioButton* m_pNeverRB; - RadioButton* m_pAlwaysRB; - RadioButton* m_pDependentRB; - Edit* m_pCountryED; + VclPtr<RadioButton> m_pNeverRB; + VclPtr<RadioButton> m_pAlwaysRB; + VclPtr<RadioButton> m_pDependentRB; + VclPtr<Edit> m_pCountryED; com::sun::star::uno::Sequence< OUString> m_aAddressBlocks; SwMailMergeConfigItem& m_rConfig; @@ -106,6 +108,7 @@ class SwSelectAddressBlockDialog : public SfxModalDialog public: SwSelectAddressBlockDialog(vcl::Window* pParent, SwMailMergeConfigItem& rConfig); virtual ~SwSelectAddressBlockDialog(); + virtual void dispose() SAL_OVERRIDE; void SetAddressBlocks(const com::sun::star::uno::Sequence< OUString>& rBlocks, sal_uInt16 nSelected); @@ -119,9 +122,11 @@ public: class SwCustomizeAddressBlockDialog; class DDListBox : public SvTreeListBox { - SwCustomizeAddressBlockDialog* m_pParentDialog; + VclPtr<SwCustomizeAddressBlockDialog> m_pParentDialog; public: DDListBox(vcl::Window* pParent, const WinBits nStyle); + virtual ~DDListBox(); + virtual void dispose() SAL_OVERRIDE; void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent); @@ -136,7 +141,7 @@ public: class AddressMultiLineEdit : public VclMultiLineEdit, public SfxListener { Link m_aSelectionLink; - SwCustomizeAddressBlockDialog* m_pParentDialog; + VclPtr<SwCustomizeAddressBlockDialog> m_pParentDialog; using VclMultiLineEdit::Notify; @@ -147,6 +152,7 @@ protected: public: AddressMultiLineEdit(vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER); virtual ~AddressMultiLineEdit(); + virtual void dispose() SAL_OVERRIDE; void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent); @@ -183,26 +189,26 @@ public: GREETING_MALE }; private: - FixedText* m_pAddressElementsFT; - DDListBox* m_pAddressElementsLB; + VclPtr<FixedText> m_pAddressElementsFT; + VclPtr<DDListBox> m_pAddressElementsLB; - PushButton* m_pInsertFieldIB; - PushButton* m_pRemoveFieldIB; + VclPtr<PushButton> m_pInsertFieldIB; + VclPtr<PushButton> m_pRemoveFieldIB; - FixedText* m_pDragFT; - AddressMultiLineEdit* m_pDragED; - PushButton* m_pUpIB; - PushButton* m_pLeftIB; - PushButton* m_pRightIB; - PushButton* m_pDownIB; + VclPtr<FixedText> m_pDragFT; + VclPtr<AddressMultiLineEdit> m_pDragED; + VclPtr<PushButton> m_pUpIB; + VclPtr<PushButton> m_pLeftIB; + VclPtr<PushButton> m_pRightIB; + VclPtr<PushButton> m_pDownIB; - FixedText* m_pFieldFT; - ComboBox* m_pFieldCB; + VclPtr<FixedText> m_pFieldFT; + VclPtr<ComboBox> m_pFieldCB; TextFilter m_aTextFilter; - SwAddressPreview* m_pPreviewWIN; + VclPtr<SwAddressPreview> m_pPreviewWIN; - OKButton* m_pOK; + VclPtr<OKButton> m_pOK; ::std::vector<OUString> m_aSalutations; ::std::vector<OUString> m_aPunctuations; @@ -228,6 +234,7 @@ private: public: SwCustomizeAddressBlockDialog(vcl::Window* pParent, SwMailMergeConfigItem& rConfig, DialogType); virtual ~SwCustomizeAddressBlockDialog(); + virtual void dispose() SAL_OVERRIDE; void SetAddress(const OUString& rAddress); OUString GetAddress(); @@ -236,14 +243,13 @@ public: class SwAssignFieldsControl; class SwAssignFieldsDialog : public SfxModalDialog { - FixedText *m_pMatchingFI; - SwAssignFieldsControl *m_pFieldsControl; + VclPtr<FixedText> m_pMatchingFI; + VclPtr<SwAssignFieldsControl> m_pFieldsControl; - FixedText *m_pPreviewFI; - SwAddressPreview *m_pPreviewWIN; + VclPtr<FixedText> m_pPreviewFI; + VclPtr<SwAddressPreview> m_pPreviewWIN; - - OKButton *m_pOK; + VclPtr<OKButton> m_pOK; OUString m_sNone; OUString m_rPreviewString; @@ -260,6 +266,7 @@ public: const OUString& rPreview, bool bIsAddressBlock); virtual ~SwAssignFieldsDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index 85440c6a4833..50fe45c17446 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -92,6 +92,21 @@ SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pParent) SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage() { + disposeOnce(); +} + +void SwMailMergeDocSelectPage::dispose() +{ + m_pCurrentDocRB.clear(); + m_pNewDocRB.clear(); + m_pLoadDocRB.clear(); + m_pLoadTemplateRB.clear(); + m_pRecentDocRB.clear(); + m_pBrowseDocPB.clear(); + m_pBrowseTemplatePB.clear(); + m_pRecentDocLB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); } IMPL_LINK(SwMailMergeDocSelectPage, DocSelectHdl, RadioButton*, pButton) @@ -111,7 +126,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton) if(bTemplate) { m_pLoadTemplateRB->Check(); - boost::scoped_ptr<SfxNewFileDialog> pNewFileDlg(new SfxNewFileDialog(this, 0)); + VclPtrInstance< SfxNewFileDialog > pNewFileDlg(this, 0); sal_uInt16 nRet = pNewFileDlg->Execute(); if(RET_TEMPLATE_LOAD == nRet) bTemplate = false; diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx index b2e241270faf..931fc4dbfce4 100644 --- a/sw/source/ui/dbui/mmdocselectpage.hxx +++ b/sw/source/ui/dbui/mmdocselectpage.hxx @@ -28,21 +28,21 @@ class SwMailMergeWizard; class SwMailMergeDocSelectPage : public svt::OWizardPage { - RadioButton* m_pCurrentDocRB; - RadioButton* m_pNewDocRB; - RadioButton* m_pLoadDocRB; - RadioButton* m_pLoadTemplateRB; - RadioButton* m_pRecentDocRB; + VclPtr<RadioButton> m_pCurrentDocRB; + VclPtr<RadioButton> m_pNewDocRB; + VclPtr<RadioButton> m_pLoadDocRB; + VclPtr<RadioButton> m_pLoadTemplateRB; + VclPtr<RadioButton> m_pRecentDocRB; - PushButton* m_pBrowseDocPB; - PushButton* m_pBrowseTemplatePB; + VclPtr<PushButton> m_pBrowseDocPB; + VclPtr<PushButton> m_pBrowseTemplatePB; - ListBox* m_pRecentDocLB; + VclPtr<ListBox> m_pRecentDocLB; OUString m_sLoadFileName; OUString m_sLoadTemplateName; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(DocSelectHdl, RadioButton*); DECL_LINK(FileSelectHdl, PushButton*); @@ -52,6 +52,7 @@ class SwMailMergeDocSelectPage : public svt::OWizardPage public: SwMailMergeDocSelectPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeDocSelectPage(); + virtual void dispose() SAL_OVERRIDE; }; diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx index 7355613e3ad2..717b1e1be2a3 100644 --- a/sw/source/ui/dbui/mmgreetingspage.cxx +++ b/sw/source/ui/dbui/mmgreetingspage.cxx @@ -106,8 +106,8 @@ IMPL_LINK_NOARG(SwGreetingsHandler, IndividualHdl_Impl) IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwCustomizeAddressBlockDialog> pDlg( - new SwCustomizeAddressBlockDialog(pButton, m_pWizard->GetConfigItem(), + VclPtr<SwCustomizeAddressBlockDialog> pDlg( + VclPtr<SwCustomizeAddressBlockDialog>::Create(pButton, m_pWizard->GetConfigItem(), pButton == m_pMalePB ? SwCustomizeAddressBlockDialog::GREETING_MALE : SwCustomizeAddressBlockDialog::GREETING_FEMALE )); @@ -133,8 +133,8 @@ void SwGreetingsHandler::UpdatePreview() IMPL_LINK(SwMailMergeGreetingsPage, AssignHdl_Impl, PushButton*, pButton) { const OUString sPreview(m_pFemaleLB->GetSelectEntry() + "\n" + m_pMaleLB->GetSelectEntry()); - boost::scoped_ptr<SwAssignFieldsDialog> pDlg( - new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), sPreview, false)); + VclPtr<SwAssignFieldsDialog> pDlg( + VclPtr<SwAssignFieldsDialog>::Create(pButton, m_pWizard->GetConfigItem(), sPreview, false)); if(RET_OK == pDlg->Execute()) { UpdatePreview(); @@ -292,6 +292,18 @@ SwMailMergeGreetingsPage::SwMailMergeGreetingsPage(SwMailMergeWizard* _pParent) SwMailMergeGreetingsPage::~SwMailMergeGreetingsPage() { + disposeOnce(); +} + +void SwMailMergeGreetingsPage::dispose() +{ + m_pPreviewFI.clear(); + m_pPreviewWIN.clear(); + m_pAssignPB.clear(); + m_pDocumentIndexFI.clear(); + m_pPrevSetIB.clear(); + m_pNextSetIB.clear(); + svt::OWizardPage::dispose(); } void SwMailMergeGreetingsPage::ActivatePage() @@ -472,6 +484,15 @@ SwMailBodyDialog::SwMailBodyDialog(vcl::Window* pParent, SwMailMergeWizard* _pWi SwMailBodyDialog::~SwMailBodyDialog() { + disposeOnce(); +} + +void SwMailBodyDialog::dispose() +{ + m_pBodyFT.clear(); + m_pBodyMLE.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } IMPL_LINK(SwMailBodyDialog, ContainsHdl_Impl, CheckBox*, pBox) diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx index d74b54224df9..d351191b6121 100644 --- a/sw/source/ui/dbui/mmgreetingspage.hxx +++ b/sw/source/ui/dbui/mmgreetingspage.hxx @@ -33,30 +33,30 @@ class SwMailMergeWizard; class SwGreetingsHandler { protected: - CheckBox* m_pGreetingLineCB; + VclPtr<CheckBox> m_pGreetingLineCB; - CheckBox* m_pPersonalizedCB; + VclPtr<CheckBox> m_pPersonalizedCB; - FixedText* m_pFemaleFT; - ListBox* m_pFemaleLB; - PushButton* m_pFemalePB; + VclPtr<FixedText> m_pFemaleFT; + VclPtr<ListBox> m_pFemaleLB; + VclPtr<PushButton> m_pFemalePB; - FixedText* m_pMaleFT; - ListBox* m_pMaleLB; - PushButton* m_pMalePB; + VclPtr<FixedText> m_pMaleFT; + VclPtr<ListBox> m_pMaleLB; + VclPtr<PushButton> m_pMalePB; - FixedText* m_pFemaleFI; - FixedText* m_pFemaleColumnFT; - ListBox* m_pFemaleColumnLB; - FixedText* m_pFemaleFieldFT; - ComboBox* m_pFemaleFieldCB; + VclPtr<FixedText> m_pFemaleFI; + VclPtr<FixedText> m_pFemaleColumnFT; + VclPtr<ListBox> m_pFemaleColumnLB; + VclPtr<FixedText> m_pFemaleFieldFT; + VclPtr<ComboBox> m_pFemaleFieldCB; - FixedText* m_pNeutralFT; - ComboBox* m_pNeutralCB; + VclPtr<FixedText> m_pNeutralFT; + VclPtr<ComboBox> m_pNeutralCB; bool m_bIsTabPage; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; ~SwGreetingsHandler() {} @@ -70,12 +70,12 @@ protected: class SwMailMergeGreetingsPage : public svt::OWizardPage, public SwGreetingsHandler { - FixedText* m_pPreviewFI; - SwAddressPreview* m_pPreviewWIN; - PushButton* m_pAssignPB; - FixedText* m_pDocumentIndexFI; - PushButton* m_pPrevSetIB; - PushButton* m_pNextSetIB; + VclPtr<FixedText> m_pPreviewFI; + VclPtr<SwAddressPreview> m_pPreviewWIN; + VclPtr<PushButton> m_pAssignPB; + VclPtr<FixedText> m_pDocumentIndexFI; + VclPtr<PushButton> m_pPrevSetIB; + VclPtr<PushButton> m_pNextSetIB; OUString m_sDocument; @@ -90,21 +90,23 @@ class SwMailMergeGreetingsPage : public svt::OWizardPage, public: SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeGreetingsPage(); + virtual void dispose() SAL_OVERRIDE; }; class SwMailBodyDialog : public SfxModalDialog, public SwGreetingsHandler { - FixedText *m_pBodyFT; - VclMultiLineEdit *m_pBodyMLE; + VclPtr<FixedText> m_pBodyFT; + VclPtr<VclMultiLineEdit> m_pBodyMLE; - OKButton *m_pOK; + VclPtr<OKButton> m_pOK; DECL_LINK(ContainsHdl_Impl, CheckBox*); DECL_LINK(OKHdl, void *); public: SwMailBodyDialog(vcl::Window* pParent, SwMailMergeWizard* pWizard); virtual ~SwMailBodyDialog(); + virtual void dispose() SAL_OVERRIDE; void SetBody(const OUString& rBody ) {m_pBodyMLE->SetText(rBody);} OUString GetBody() const {return m_pBodyMLE->GetText();} diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index a89ed65b32c5..e00f986e5ef0 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -155,9 +155,25 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) : SwMailMergeLayoutPage::~SwMailMergeLayoutPage() { + disposeOnce(); +} + +void SwMailMergeLayoutPage::dispose() +{ delete m_pExampleFrame; File::remove( m_sExampleURL ); - + m_pPosition.clear(); + m_pAlignToBodyCB.clear(); + m_pLeftFT.clear(); + m_pLeftMF.clear(); + m_pTopMF.clear(); + m_pGreetingLine.clear(); + m_pUpPB.clear(); + m_pDownPB.clear(); + m_pExampleContainerWIN.clear(); + m_pZoomLB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); } void SwMailMergeLayoutPage::ActivatePage() diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx index c770705dccc5..5b9f9a8c3cc1 100644 --- a/sw/source/ui/dbui/mmlayoutpage.hxx +++ b/sw/source/ui/dbui/mmlayoutpage.hxx @@ -38,20 +38,20 @@ namespace com{ namespace sun{ namespace star{ namespace beans{ class XPropertySe class SwMailMergeLayoutPage : public svt::OWizardPage { - VclContainer* m_pPosition; + VclPtr<VclContainer> m_pPosition; - CheckBox* m_pAlignToBodyCB; - FixedText* m_pLeftFT; - MetricField* m_pLeftMF; - MetricField* m_pTopMF; + VclPtr<CheckBox> m_pAlignToBodyCB; + VclPtr<FixedText> m_pLeftFT; + VclPtr<MetricField> m_pLeftMF; + VclPtr<MetricField> m_pTopMF; - VclContainer* m_pGreetingLine; - PushButton* m_pUpPB; - PushButton* m_pDownPB; + VclPtr<VclContainer> m_pGreetingLine; + VclPtr<PushButton> m_pUpPB; + VclPtr<PushButton> m_pDownPB; - vcl::Window* m_pExampleContainerWIN; + VclPtr<vcl::Window> m_pExampleContainerWIN; - ListBox* m_pZoomLB; + VclPtr<ListBox> m_pZoomLB; SwOneExampleFrame* m_pExampleFrame; SwWrtShell* m_pExampleWrtShell; @@ -61,7 +61,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage bool m_bIsGreetingInserted; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xViewProperties; @@ -84,6 +84,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage public: SwMailMergeLayoutPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeLayoutPage(); + virtual void dispose() SAL_OVERRIDE; static SwFrmFmt* InsertAddressAndGreeting(SwView* pView, SwMailMergeConfigItem& rConfigItem, diff --git a/sw/source/ui/dbui/mmmergepage.cxx b/sw/source/ui/dbui/mmmergepage.cxx index f0fbebcaf046..98233636a574 100644 --- a/sw/source/ui/dbui/mmmergepage.cxx +++ b/sw/source/ui/dbui/mmmergepage.cxx @@ -50,6 +50,25 @@ SwMailMergeMergePage::SwMailMergeMergePage(SwMailMergeWizard* _pParent) } +SwMailMergeMergePage::~SwMailMergeMergePage() +{ + disposeOnce(); +} + +void SwMailMergeMergePage::dispose() +{ + m_pEditFI.clear(); + m_pEditPB.clear(); + m_pFindED.clear(); + m_pFindPB.clear(); + m_pWholeWordsCB.clear(); + m_pBackwardsCB.clear(); + m_pMatchCaseCB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + + IMPL_LINK_NOARG(SwMailMergeMergePage, EditDocumentHdl_Impl) { m_pWizard->SetRestartPage(MM_MERGEPAGE); diff --git a/sw/source/ui/dbui/mmmergepage.hxx b/sw/source/ui/dbui/mmmergepage.hxx index b415586acc7d..2ff8187eff10 100644 --- a/sw/source/ui/dbui/mmmergepage.hxx +++ b/sw/source/ui/dbui/mmmergepage.hxx @@ -29,17 +29,17 @@ class SwMailMergeWizard; class SwMailMergeMergePage : public svt::OWizardPage { - FixedText* m_pEditFI; - PushButton* m_pEditPB; + VclPtr<FixedText> m_pEditFI; + VclPtr<PushButton> m_pEditPB; - ReturnActionEdit* m_pFindED; - PushButton* m_pFindPB; + VclPtr<ReturnActionEdit> m_pFindED; + VclPtr<PushButton> m_pFindPB; - CheckBox* m_pWholeWordsCB; - CheckBox* m_pBackwardsCB; - CheckBox* m_pMatchCaseCB; + VclPtr<CheckBox> m_pWholeWordsCB; + VclPtr<CheckBox> m_pBackwardsCB; + VclPtr<CheckBox> m_pMatchCaseCB; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(EditDocumentHdl_Impl, void *); DECL_LINK(FindHdl_Impl, void *); @@ -47,6 +47,8 @@ class SwMailMergeMergePage : public svt::OWizardPage public: SwMailMergeMergePage( SwMailMergeWizard* _pParent); + virtual ~SwMailMergeMergePage(); + virtual void dispose() SAL_OVERRIDE; }; diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 586303caa0e1..6c92c26f8b8c 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -194,8 +194,8 @@ IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, Edit*, pEdit) class SwCopyToDialog : public SfxModalDialog { - Edit* m_pCCED; - Edit* m_pBCCED; + VclPtr<Edit> m_pCCED; + VclPtr<Edit> m_pBCCED; public: SwCopyToDialog(vcl::Window* pParent) @@ -205,6 +205,13 @@ public: get(m_pCCED, "cc"); get(m_pBCCED, "bcc"); } + virtual ~SwCopyToDialog() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE + { + m_pCCED.clear(); + m_pBCCED.clear(); + SfxModalDialog::dispose(); + } OUString GetCC() {return m_pCCED->GetText();} void SetCC(const OUString& rSet) {m_pCCED->SetText(rSet);} @@ -300,7 +307,44 @@ SwMailMergeOutputPage::SwMailMergeOutputPage(SwMailMergeWizard* _pParent) SwMailMergeOutputPage::~SwMailMergeOutputPage() { - delete m_pTempPrinter; + disposeOnce(); +} + +void SwMailMergeOutputPage::dispose() +{ + m_pTempPrinter.disposeAndClear(); + m_pSaveStartDocRB.clear(); + m_pSaveMergedDocRB.clear(); + m_pPrintRB.clear(); + m_pSendMailRB.clear(); + m_pSeparator.clear(); + m_pSaveStartDocPB.clear(); + m_pSaveAsOneRB.clear(); + m_pSaveIndividualRB.clear(); + m_pPrintAllRB.clear(); + m_pSendAllRB.clear(); + m_pFromRB.clear(); + m_pFromNF.clear(); + m_pToFT.clear(); + m_pToNF.clear(); + m_pSaveNowPB.clear(); + m_pPrinterFT.clear(); + m_pPrinterLB.clear(); + m_pPrinterSettingsPB.clear(); + m_pPrintNowPB.clear(); + m_pMailToFT.clear(); + m_pMailToLB.clear(); + m_pCopyToPB.clear(); + m_pSubjectFT.clear(); + m_pSubjectED.clear(); + m_pSendAsFT.clear(); + m_pSendAsLB.clear(); + m_pAttachmentGroup.clear(); + m_pAttachmentED.clear(); + m_pSendAsPB.clear(); + m_pSendDocumentsPB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); } void SwMailMergeOutputPage::ActivatePage() @@ -479,7 +523,7 @@ IMPL_LINK(SwMailMergeOutputPage, OutputTypeHdl_Impl, RadioButton*, pButton) SendTypeHdl_Impl(m_pSendAsLB); } } - m_pFromRB->GetClickHdl().Call(m_pFromRB->IsChecked() ? m_pFromRB : 0); + m_pFromRB->GetClickHdl().Call(m_pFromRB->IsChecked() ? m_pFromRB.get() : 0); SetUpdateMode(false); return 0; @@ -496,7 +540,7 @@ IMPL_LINK(SwMailMergeOutputPage, DocumentSelectionHdl_Impl, RadioButton*, pButto IMPL_LINK(SwMailMergeOutputPage, CopyToHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwCopyToDialog> pDlg(new SwCopyToDialog(pButton)); + ScopedVclPtrInstance< SwCopyToDialog > pDlg(pButton); pDlg->SetCC(m_sCC ); pDlg->SetBCC(m_sBCC); if(RET_OK == pDlg->Execute()) @@ -689,12 +733,12 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) } SwView* pSourceView = rConfigItem.GetSourceView(); - PrintMonitor aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE); - aSaveMonitor.m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22)); - aSaveMonitor.SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl)); - aSaveMonitor.m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) ); + ScopedVclPtrInstance< PrintMonitor > aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE); + aSaveMonitor->m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22)); + aSaveMonitor->SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl)); + aSaveMonitor->m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) ); m_bCancelSaving = false; - aSaveMonitor.Show(); + aSaveMonitor->Show(); m_pWizard->enableButtons(WZB_CANCEL, false); for(sal_uInt32 nDoc = nBegin; nDoc < nEnd && !m_bCancelSaving; ++nDoc) @@ -707,7 +751,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) sPath += "." + sExtension; } OUString sStat = OUString(SW_RES(STR_STATSTR_LETTER)) + " " + OUString::number( nDoc ); - aSaveMonitor.m_pPrintInfo->SetText(sStat); + aSaveMonitor->m_pPrintInfo->SetText(sStat); //now extract a document from the target document // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here @@ -755,9 +799,9 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) if(bFailed) { - SwSaveWarningBox_Impl aWarning( pButton, sOutPath ); - if(RET_OK == aWarning.Execute()) - sOutPath = aWarning.GetFileName(); + ScopedVclPtrInstance< SwSaveWarningBox_Impl > aWarning( pButton, sOutPath ); + if(RET_OK == aWarning->Execute()) + sOutPath = aWarning->GetFileName(); else { xTempDocShell->DoClose(); @@ -794,23 +838,23 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) if ((pDocumentPrinter->GetName() == pInfo->GetPrinterName()) && (pDocumentPrinter->GetDriverName() == pInfo->GetDriver())) { - m_pTempPrinter = new Printer(pDocumentPrinter->GetJobSetup()); + m_pTempPrinter = VclPtr<Printer>::Create(pDocumentPrinter->GetJobSetup()); } else - m_pTempPrinter = new Printer( *pInfo ); + m_pTempPrinter = VclPtr<Printer>::Create( *pInfo ); } else { if( (m_pTempPrinter->GetName() != pInfo->GetPrinterName()) || (m_pTempPrinter->GetDriverName() != pInfo->GetDriver()) ) { - delete m_pTempPrinter; - m_pTempPrinter = new Printer( *pInfo ); + m_pTempPrinter.disposeAndClear(); + m_pTempPrinter = VclPtr<Printer>::Create( *pInfo ); } } } else if( ! m_pTempPrinter ) - m_pTempPrinter = new Printer(); + m_pTempPrinter = VclPtr<Printer>::Create(); m_pPrinterSettingsPB->Enable( m_pTempPrinter->HasSupport( SUPPORT_SETUPDIALOG ) ); } @@ -916,7 +960,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendTypeHdl_Impl, ListBox*, pBox) IMPL_LINK(SwMailMergeOutputPage, SendAsHdl_Impl, PushButton*, pButton) { - SwMailBodyDialog* pDlg = new SwMailBodyDialog(pButton, m_pWizard); + VclPtr<SwMailBodyDialog> pDlg = VclPtr<SwMailBodyDialog>::Create(pButton, m_pWizard); pDlg->SetBody(m_sBody); if(RET_OK == pDlg->Execute()) { @@ -939,12 +983,12 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(rConfigItem.GetMailServer().isEmpty() || !SwMailMergeHelper::CheckMailAddress(rConfigItem.GetMailAddress()) ) { - QueryBox aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail); - sal_uInt16 nRet = aQuery.Execute(); + ScopedVclPtrInstance< QueryBox > aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail); + sal_uInt16 nRet = aQuery->Execute(); if(RET_YES == nRet ) { SfxAllItemSet aSet(pTargetView->GetPool()); - boost::scoped_ptr<SwMailConfigDlg> pDlg(new SwMailConfigDlg(pButton, aSet)); + ScopedVclPtrInstance< SwMailConfigDlg > pDlg(pButton, aSet); nRet = pDlg->Execute(); } @@ -1033,26 +1077,26 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(m_pSubjectED->GetText().isEmpty()) { - SwSendQueryBox_Impl aQuery(pButton, "SubjectDialog", - "modules/swriter/ui/subjectdialog.ui"); - aQuery.SetIsEmptyTextAllowed(true); - aQuery.SetValue(m_sNoSubjectST); - if(RET_OK == aQuery.Execute()) + ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "SubjectDialog", + "modules/swriter/ui/subjectdialog.ui"); + aQuery->SetIsEmptyTextAllowed(true); + aQuery->SetValue(m_sNoSubjectST); + if(RET_OK == aQuery->Execute()) { - if(aQuery.GetValue() != m_sNoSubjectST) - m_pSubjectED->SetText(aQuery.GetValue()); + if(aQuery->GetValue() != m_sNoSubjectST) + m_pSubjectED->SetText(aQuery->GetValue()); } else return 0; } if(!bAsBody && m_pAttachmentED->GetText().isEmpty()) { - SwSendQueryBox_Impl aQuery(pButton, "AttachNameDialog", - "modules/swriter/ui/attachnamedialog.ui"); - aQuery.SetIsEmptyTextAllowed(false); - if(RET_OK == aQuery.Execute()) + ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "AttachNameDialog", + "modules/swriter/ui/attachnamedialog.ui"); + aQuery->SetIsEmptyTextAllowed(false); + if(RET_OK == aQuery->Execute()) { - OUString sAttach(aQuery.GetValue()); + OUString sAttach(aQuery->GetValue()); sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if (2 > nTokenCount) { @@ -1101,7 +1145,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) xStore->storeToURL( sTargetTempURL, aValues ); //create the send dialog - SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); + VclPtr<SwSendMailDialog> pDlg = VclPtr<SwSendMailDialog>::Create( pButton, rConfigItem ); pDlg->SetDocumentCount( nEnd ); pDlg->ShowDialog(); //help to force painting the dialog diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx index a31ddeaa3564..470a72e04689 100644 --- a/sw/source/ui/dbui/mmoutputpage.hxx +++ b/sw/source/ui/dbui/mmoutputpage.hxx @@ -45,42 +45,42 @@ namespace com{ namespace sun{ namespace star{ class SwMailMergeOutputPage : public svt::OWizardPage { - RadioButton* m_pSaveStartDocRB; - RadioButton* m_pSaveMergedDocRB; - RadioButton* m_pPrintRB; - RadioButton* m_pSendMailRB; + VclPtr<RadioButton> m_pSaveStartDocRB; + VclPtr<RadioButton> m_pSaveMergedDocRB; + VclPtr<RadioButton> m_pPrintRB; + VclPtr<RadioButton> m_pSendMailRB; - VclFrame* m_pSeparator; + VclPtr<VclFrame> m_pSeparator; - PushButton* m_pSaveStartDocPB; + VclPtr<PushButton> m_pSaveStartDocPB; - RadioButton* m_pSaveAsOneRB; - RadioButton* m_pSaveIndividualRB; - RadioButton* m_pPrintAllRB; //has to be here for tab control reasons - RadioButton* m_pSendAllRB; //has to be here for tab control reasons + VclPtr<RadioButton> m_pSaveAsOneRB; + VclPtr<RadioButton> m_pSaveIndividualRB; + VclPtr<RadioButton> m_pPrintAllRB; //has to be here for tab control reasons + VclPtr<RadioButton> m_pSendAllRB; //has to be here for tab control reasons //this group is used in save and print - RadioButton* m_pFromRB; - NumericField* m_pFromNF; - FixedText* m_pToFT; - NumericField* m_pToNF; - PushButton* m_pSaveNowPB; - - FixedText* m_pPrinterFT; - ListBox* m_pPrinterLB; - PushButton* m_pPrinterSettingsPB; - PushButton* m_pPrintNowPB; - - FixedText* m_pMailToFT; - ListBox* m_pMailToLB; - PushButton* m_pCopyToPB; - FixedText* m_pSubjectFT; - Edit* m_pSubjectED; - FixedText* m_pSendAsFT; - ListBox* m_pSendAsLB; - VclContainer* m_pAttachmentGroup; - Edit* m_pAttachmentED; - PushButton* m_pSendAsPB; - PushButton* m_pSendDocumentsPB; + VclPtr<RadioButton> m_pFromRB; + VclPtr<NumericField> m_pFromNF; + VclPtr<FixedText> m_pToFT; + VclPtr<NumericField> m_pToNF; + VclPtr<PushButton> m_pSaveNowPB; + + VclPtr<FixedText> m_pPrinterFT; + VclPtr<ListBox> m_pPrinterLB; + VclPtr<PushButton> m_pPrinterSettingsPB; + VclPtr<PushButton> m_pPrintNowPB; + + VclPtr<FixedText> m_pMailToFT; + VclPtr<ListBox> m_pMailToLB; + VclPtr<PushButton> m_pCopyToPB; + VclPtr<FixedText> m_pSubjectFT; + VclPtr<Edit> m_pSubjectED; + VclPtr<FixedText> m_pSendAsFT; + VclPtr<ListBox> m_pSendAsLB; + VclPtr<VclContainer> m_pAttachmentGroup; + VclPtr<Edit> m_pAttachmentED; + VclPtr<PushButton> m_pSendAsPB; + VclPtr<PushButton> m_pSendDocumentsPB; //some FixedLine labels OUString m_sSaveStartST; @@ -97,10 +97,10 @@ class SwMailMergeOutputPage : public svt::OWizardPage bool m_bCancelSaving; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; //some dialog data - Printer* m_pTempPrinter; + VclPtr<Printer> m_pTempPrinter; OUString m_sCC; OUString m_sBCC; @@ -126,6 +126,7 @@ protected: public: SwMailMergeOutputPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeOutputPage(); + virtual void dispose() SAL_OVERRIDE; }; @@ -146,17 +147,17 @@ struct SwSendMailDialog_Impl; class SwMailMergeConfigItem; class SwSendMailDialog : public ModelessDialog //SfxModalDialog { - FixedText *m_pTransferStatus; - FixedText *m_pPaused; - ProgressBar *m_pProgressBar; - FixedText *m_pErrorStatus; + VclPtr<FixedText> m_pTransferStatus; + VclPtr<FixedText> m_pPaused; + VclPtr<ProgressBar> m_pProgressBar; + VclPtr<FixedText> m_pErrorStatus; - SvSimpleTableContainer *m_pContainer; - HeaderBar *m_pStatusHB; - SvSimpleTable *m_pStatus; + VclPtr<SvSimpleTableContainer> m_pContainer; + VclPtr<HeaderBar> m_pStatusHB; + VclPtr<SvSimpleTable> m_pStatus; - PushButton *m_pStop; - PushButton *m_pClose; + VclPtr<PushButton> m_pStop; + VclPtr<PushButton> m_pClose; OUString m_sContinue; OUString m_sStop; @@ -192,6 +193,7 @@ class SwSendMailDialog : public ModelessDialog //SfxModalDialog public: SwSendMailDialog( vcl::Window* pParent, SwMailMergeConfigItem& ); virtual ~SwSendMailDialog(); + virtual void dispose() SAL_OVERRIDE; void AddDocument( SwMailDescriptor& rDesc ); void SetDocumentCount( sal_Int32 nAllDocuments ); diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index a1dc8affad88..e15e757421e7 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -48,6 +48,22 @@ SwMailMergeOutputTypePage::SwMailMergeOutputTypePage(SwMailMergeWizard* pParent) } +SwMailMergeOutputTypePage::~SwMailMergeOutputTypePage() +{ + disposeOnce(); +} + +void SwMailMergeOutputTypePage::dispose() +{ + m_pLetterRB.clear(); + m_pMailRB.clear(); + m_pLetterHint.clear(); + m_pMailHint.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + + IMPL_LINK_NOARG(SwMailMergeOutputTypePage, TypeHdl_Impl) { bool bLetter = m_pLetterRB->IsChecked(); @@ -123,7 +139,7 @@ const SwMailDescriptor* SwSendMailDialog_Impl::GetNextDescriptor() using namespace ::com::sun::star; class SwMailDispatcherListener_Impl : public IMailDispatcherListener { - SwSendMailDialog* m_pSendMailDialog; + VclPtr<SwSendMailDialog> m_pSendMailDialog; public: SwMailDispatcherListener_Impl(SwSendMailDialog& rParentDlg); @@ -208,9 +224,15 @@ void SwMailDispatcherListener_Impl::DeleteAttachments( uno::Reference< mail::XMa class SwSendWarningBox_Impl : public MessageDialog { - VclMultiLineEdit *m_pDetailED; + VclPtr<VclMultiLineEdit> m_pDetailED; public: SwSendWarningBox_Impl(vcl::Window* pParent, const OUString& rDetails); + virtual ~SwSendWarningBox_Impl() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE + { + m_pDetailED.clear(); + MessageDialog::dispose(); + } }; SwSendWarningBox_Impl::SwSendWarningBox_Impl(vcl::Window* pParent, const OUString& rDetails) @@ -253,7 +275,7 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, SwMailMergeConfigItem& Size aSize = m_pContainer->LogicToPixel(Size(226, 80), MAP_APPFONT); m_pContainer->set_width_request(aSize.Width()); m_pContainer->set_height_request(aSize.Height()); - m_pStatus = new SvSimpleTable(*m_pContainer); + m_pStatus = VclPtr<SvSimpleTable>::Create(*m_pContainer); m_pStatusHB = &(m_pStatus->GetTheHeaderBar()); m_nStatusHeight = m_pContainer->get_height_request(); @@ -283,6 +305,11 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, SwMailMergeConfigItem& SwSendMailDialog::~SwSendMailDialog() { + disposeOnce(); +} + +void SwSendMailDialog::dispose() +{ if(m_pImpl->xMailDispatcher.is()) { try @@ -306,8 +333,17 @@ SwSendMailDialog::~SwSendMailDialog() { } } - delete m_pStatus; delete m_pImpl; + m_pStatus.disposeAndClear(); + m_pTransferStatus.clear(); + m_pPaused.clear(); + m_pProgressBar.clear(); + m_pErrorStatus.clear(); + m_pContainer.clear(); + m_pStatusHB.clear(); + m_pStop.clear(); + m_pClose.clear(); + ModelessDialog::dispose(); } void SwSendMailDialog::AddDocument( SwMailDescriptor& rDesc ) @@ -375,7 +411,7 @@ IMPL_STATIC_LINK( SwSendMailDialog, RemoveThis, Timer*, pTimer ) (!pThis->m_pImpl->xMailDispatcher.is() || !pThis->m_pImpl->xMailDispatcher->isRunning())) { - delete pThis; + pThis->disposeOnce(); } else { @@ -546,7 +582,7 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessag if (pError) { - boost::scoped_ptr<SwSendWarningBox_Impl> pDlg(new SwSendWarningBox_Impl(0, *pError)); + VclPtrInstance< SwSendWarningBox_Impl > pDlg(nullptr, *pError); pDlg->Execute(); } } diff --git a/sw/source/ui/dbui/mmoutputtypepage.hxx b/sw/source/ui/dbui/mmoutputtypepage.hxx index 81769f2b6863..9c967c05f7fb 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.hxx +++ b/sw/source/ui/dbui/mmoutputtypepage.hxx @@ -27,18 +27,20 @@ class SwMailMergeWizard; class SwMailMergeOutputTypePage : public svt::OWizardPage { - RadioButton* m_pLetterRB; - RadioButton* m_pMailRB; + VclPtr<RadioButton> m_pLetterRB; + VclPtr<RadioButton> m_pMailRB; - FixedText* m_pLetterHint; - FixedText* m_pMailHint; + VclPtr<FixedText> m_pLetterHint; + VclPtr<FixedText> m_pMailHint; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(TypeHdl_Impl, void *); public: SwMailMergeOutputTypePage( SwMailMergeWizard* _pParent); + virtual ~SwMailMergeOutputTypePage(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/mmpreparemergepage.cxx b/sw/source/ui/dbui/mmpreparemergepage.cxx index 272ae0f6cb8e..702b26b156b1 100644 --- a/sw/source/ui/dbui/mmpreparemergepage.cxx +++ b/sw/source/ui/dbui/mmpreparemergepage.cxx @@ -58,6 +58,24 @@ SwMailMergePrepareMergePage::SwMailMergePrepareMergePage( SwMailMergeWizard* _pP aMoveLink.Call(m_pRecordED); } +SwMailMergePrepareMergePage::~SwMailMergePrepareMergePage() +{ + disposeOnce(); +} + +void SwMailMergePrepareMergePage::dispose() +{ + m_pFirstPB.clear(); + m_pPrevPB.clear(); + m_pRecordED.clear(); + m_pNextPB.clear(); + m_pLastPB.clear(); + m_pExcludeCB.clear(); + m_pEditPB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + IMPL_LINK_NOARG(SwMailMergePrepareMergePage, EditDocumentHdl_Impl) { m_pWizard->SetRestartPage(MM_PREPAREMERGEPAGE); diff --git a/sw/source/ui/dbui/mmpreparemergepage.hxx b/sw/source/ui/dbui/mmpreparemergepage.hxx index bdaef54ae3ff..8bfdfbe94158 100644 --- a/sw/source/ui/dbui/mmpreparemergepage.hxx +++ b/sw/source/ui/dbui/mmpreparemergepage.hxx @@ -29,16 +29,16 @@ class SwMailMergeWizard; class SwMailMergePrepareMergePage : public svt::OWizardPage { - PushButton* m_pFirstPB; - PushButton* m_pPrevPB; - NumericField* m_pRecordED; - PushButton* m_pNextPB; - PushButton* m_pLastPB; - CheckBox* m_pExcludeCB; + VclPtr<PushButton> m_pFirstPB; + VclPtr<PushButton> m_pPrevPB; + VclPtr<NumericField> m_pRecordED; + VclPtr<PushButton> m_pNextPB; + VclPtr<PushButton> m_pLastPB; + VclPtr<CheckBox> m_pExcludeCB; - PushButton* m_pEditPB; + VclPtr<PushButton> m_pEditPB; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(EditDocumentHdl_Impl, void *); DECL_LINK(ExcludeHdl_Impl, CheckBox*); @@ -49,6 +49,8 @@ class SwMailMergePrepareMergePage : public svt::OWizardPage public: SwMailMergePrepareMergePage( SwMailMergeWizard* _pParent); + virtual ~SwMailMergePrepareMergePage(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx index 1386638a4e20..1db947e9f3d4 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.cxx +++ b/sw/source/ui/dbui/selectdbtabledialog.cxx @@ -105,7 +105,7 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(vcl::Window* pParent, Size aSize = pHeaderTreeContainer->LogicToPixel(Size(238 , 50), MAP_APPFONT); pHeaderTreeContainer->set_width_request(aSize.Width()); pHeaderTreeContainer->set_height_request(aSize.Height()); - m_pTable = new SwAddressTable(*pHeaderTreeContainer); + m_pTable = VclPtr<SwAddressTable>::Create(*pHeaderTreeContainer); long aStaticTabs[]= { 2, 0, 0 }; m_pTable->SetTabs( aStaticTabs ); m_pTable->InsertHeaderItem(1, m_sName, HeaderBarItemBits::LEFT | HeaderBarItemBits::VCENTER); @@ -147,7 +147,14 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(vcl::Window* pParent, SwSelectDBTableDialog::~SwSelectDBTableDialog() { - delete m_pTable; + disposeOnce(); +} + +void SwSelectDBTableDialog::dispose() +{ + m_pTable.disposeAndClear(); + m_pPreviewPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton) @@ -180,7 +187,7 @@ IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton) pProperties[4].Name = "ShowTreeViewButton"; pProperties[4].Value <<= sal_False; - boost::scoped_ptr<SwDBTablePreviewDialog> pDlg(new SwDBTablePreviewDialog(pButton, aProperties)); + VclPtrInstance< SwDBTablePreviewDialog > pDlg(pButton, aProperties); pDlg->Execute(); } diff --git a/sw/source/ui/dbui/selectdbtabledialog.hxx b/sw/source/ui/dbui/selectdbtabledialog.hxx index 729675e831b9..b02b74b2cb72 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.hxx +++ b/sw/source/ui/dbui/selectdbtabledialog.hxx @@ -35,8 +35,8 @@ class SwAddressTable; class SwSelectDBTableDialog : public SfxModalDialog { - SwAddressTable* m_pTable; - PushButton* m_pPreviewPB; + VclPtr<SwAddressTable> m_pTable; + VclPtr<PushButton> m_pPreviewPB; OUString m_sName; OUString m_sType; @@ -50,6 +50,7 @@ public: SwSelectDBTableDialog(vcl::Window* pParent, const css::uno::Reference<css::sdbc::XConnection>& xConnection); virtual ~SwSelectDBTableDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetSelectedTable(bool& bIsTable); void SetSelectedTable(const OUString& rTable, bool bIsTable); diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx index f33577268b82..a5de42b69a6c 100644 --- a/sw/source/ui/dialog/abstract.cxx +++ b/sw/source/ui/dialog/abstract.cxx @@ -31,6 +31,18 @@ SwInsertAbstractDlg::SwInsertAbstractDlg(vcl::Window* pParent) get(m_pParaNF, "paras"); } +SwInsertAbstractDlg::~SwInsertAbstractDlg() +{ + disposeOnce(); +} + +void SwInsertAbstractDlg::dispose() +{ + m_pLevelNF.clear(); + m_pParaNF.clear(); + SfxModalDialog::dispose(); +} + sal_uInt8 SwInsertAbstractDlg::GetLevel() const { return static_cast<sal_uInt8>(m_pLevelNF->GetValue() - 1); diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 93c3c7793e6e..68409fd8e9ec 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -174,14 +174,14 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, { bool bDelPrinter = false; - SfxPrinter* pPrt = pDoc ? pDoc->getIDocumentDeviceAccess().getPrinter(false) : 0; + VclPtr<SfxPrinter> pPrt = pDoc ? pDoc->getIDocumentDeviceAccess().getPrinter(false) : 0; if( !pPrt ) { SfxItemSet* pSet = new SfxItemSet( rDocSh.GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - pPrt = new SfxPrinter( pSet ); + pPrt = VclPtr<SfxPrinter>::Create( pSet ); bDelPrinter = true; } @@ -211,7 +211,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, m_pFontLB->SelectEntry( aOpt.GetFontName() ); if( bDelPrinter ) - delete pPrt; + pPrt.disposeAndClear(); } } @@ -242,8 +242,23 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, SwAsciiFilterDlg::~SwAsciiFilterDlg() { + disposeOnce(); } +void SwAsciiFilterDlg::dispose() +{ + m_pCharSetLB.clear(); + m_pFontFT.clear(); + m_pFontLB.clear(); + m_pLanguageFT.clear(); + m_pLanguageLB.clear(); + m_pCRLF_RB.clear(); + m_pCR_RB.clear(); + m_pLF_RB.clear(); + SfxModalDialog::dispose(); +} + + void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) { sal_uLong nCCode = m_pCharSetLB->GetSelectTextEncoding(); diff --git a/sw/source/ui/dialog/docstdlg.cxx b/sw/source/ui/dialog/docstdlg.cxx index 48ae2aa587d1..de1d3d6abcd8 100644 --- a/sw/source/ui/dialog/docstdlg.cxx +++ b/sw/source/ui/dialog/docstdlg.cxx @@ -36,9 +36,9 @@ #include <unotools/localedatawrapper.hxx> #include <vcl/settings.hxx> -SfxTabPage * SwDocStatPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwDocStatPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwDocStatPage(pParent, *rSet); + return VclPtr<SwDocStatPage>::Create(pParent, *rSet); } SwDocStatPage::SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet) @@ -73,8 +73,25 @@ SwDocStatPage::SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet) } - SwDocStatPage::~SwDocStatPage() +SwDocStatPage::~SwDocStatPage() { + disposeOnce(); +} + +void SwDocStatPage::dispose() +{ + m_pPageNo.clear(); + m_pTableNo.clear(); + m_pGrfNo.clear(); + m_pOLENo.clear(); + m_pParaNo.clear(); + m_pWordNo.clear(); + m_pCharNo.clear(); + m_pCharExclSpacesNo.clear(); + m_pLineLbl.clear(); + m_pLineNo.clear(); + m_pUpdatePB.clear(); + SfxTabPage::dispose(); } // Description: fill ItemSet when changed diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index a64cb0820089..ebc76da20d73 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -595,7 +595,7 @@ void AbstractSwWordCountFloatDlg_Impl::SetCounts(const SwDocStat &rCurrCnt, cons AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl() { - delete pDlg; + pDlg.disposeAndClear(); } void AbstractMailMergeWizard_Impl::StartExecuteModal( const Link& rEndDialogHdl ) @@ -643,7 +643,7 @@ sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const AbstractSwInsertAbstractDlg * SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(vcl::Window* pParent) { - SwInsertAbstractDlg* pDlg = new SwInsertAbstractDlg( pParent); + VclPtr<SwInsertAbstractDlg> pDlg = VclPtr<SwInsertAbstractDlg>::Create( pParent); return new AbstractSwInsertAbstractDlg_Impl(pDlg); } @@ -657,16 +657,16 @@ SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSfxDialog( vcl::Window* p switch ( nResId ) { case RC_DLG_ADDR : - pDlg = new SwAddrDlg( pParent, rSet ); + pDlg = VclPtr<SwAddrDlg>::Create( pParent, rSet ); break; case DLG_SWDROPCAPS : - pDlg = new SwDropCapsDlg( pParent, rSet ); + pDlg = VclPtr<SwDropCapsDlg>::Create( pParent, rSet ); break; case RC_SWDLG_BACKGROUND : - pDlg = new SwBackgroundDlg( pParent, rSet ); + pDlg = VclPtr<SwBackgroundDlg>::Create( pParent, rSet ); break; case RC_DLG_SWNUMFMTDLG : - pDlg = new SwNumFmtDlg( pParent, rSet ); + pDlg = VclPtr<SwNumFmtDlg>::Create( pParent, rSet ); break; default: break; @@ -681,7 +681,7 @@ AbstractSwAsciiFilterDlg* SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg( SwDocShell& rDocSh, SvStream* pStream ) { - SwAsciiFilterDlg* pDlg = new SwAsciiFilterDlg( pParent, rDocSh, pStream ); + VclPtr<SwAsciiFilterDlg> pDlg = VclPtr<SwAsciiFilterDlg>::Create( pParent, rDocSh, pStream ); return new AbstractSwAsciiFilterDlg_Impl( pDlg ); } @@ -694,7 +694,7 @@ VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( vcl: switch ( nResId ) { case DLG_INSERT_BOOKMARK : - pDlg = new SwInsertBookmarkDlg( pParent, rSh, rReq ); + pDlg = VclPtr<SwInsertBookmarkDlg>::Create( pParent, rSh, rReq ); break; default: @@ -709,44 +709,43 @@ VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( vcl: AbstractSwBreakDlg * SwAbstractDialogFactory_Impl::CreateSwBreakDlg(vcl::Window *pParent, SwWrtShell &rSh) { - SwBreakDlg* pDlg = new SwBreakDlg(pParent, rSh); + VclPtr<SwBreakDlg> pDlg = VclPtr<SwBreakDlg>::Create(pParent, rSh); return new AbstractSwBreakDlg_Impl(pDlg); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg(SwView& rVw) { - Dialog* pDlg = new SwChangeDBDlg(rVw); + VclPtr<Dialog> pDlg = VclPtr<SwChangeDBDlg>::Create(rVw); return new VclAbstractDialog_Impl(pDlg); } SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwCharDlg(vcl::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, sal_uInt8 nDialogMode, const OUString* pFmtStr) { - - SfxTabDialog* pDlg = new SwCharDlg(pParent, pVw, rCoreSet, nDialogMode, pFmtStr); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwCharDlg>::Create(pParent, pVw, rCoreSet, nDialogMode, pFmtStr); return new AbstractTabDialog_Impl(pDlg); } AbstractSwConvertTableDlg* SwAbstractDialogFactory_Impl::CreateSwConvertTableDlg(SwView& rView, bool bToTable) { - SwConvertTableDlg* pDlg = new SwConvertTableDlg(rView, bToTable); + VclPtr<SwConvertTableDlg> pDlg = VclPtr<SwConvertTableDlg>::Create(rView, bToTable); return new AbstractSwConvertTableDlg_Impl(pDlg); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV,int nResId) { - Dialog* pDlg=NULL; + VclPtr<Dialog> pDlg; switch ( nResId ) { case DLG_CAPTION : - pDlg = new SwCaptionDialog( pParent, rV ); + pDlg = VclPtr<SwCaptionDialog>::Create( pParent, rV ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new VclAbstractDialog_Impl( pDlg ); return 0; } @@ -756,20 +755,20 @@ AbstractSwInsertDBColAutoPilot* SwAbstractDialogFactory_Impl::CreateSwInsertDBCo uno::Reference<sdbcx::XColumnsSupplier> xColSupp, const SwDBData& rData) { - SwInsertDBColAutoPilot* pDlg = new SwInsertDBColAutoPilot( rView, rxSource, xColSupp, rData ); + VclPtr<SwInsertDBColAutoPilot> pDlg = VclPtr<SwInsertDBColAutoPilot>::Create( rView, rxSource, xColSupp, rData ); return new AbstractSwInsertDBColAutoPilot_Impl( pDlg ); } SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) { - SfxTabDialog* pDlg = new SwFootNoteOptionDlg( pParent, rSh ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwFootNoteOptionDlg>::Create( pParent, rSh ); return new AbstractTabDialog_Impl( pDlg ); } AbstractDropDownFieldDialog * SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bNextButton) { - sw::DropDownFieldDialog* pDlg = new sw::DropDownFieldDialog(pParent, rSh, pField, bNextButton); + VclPtr<sw::DropDownFieldDialog> pDlg = VclPtr<sw::DropDownFieldDialog>::Create(pParent, rSh, pField, bNextButton); return new AbstractDropDownFieldDialog_Impl( pDlg ); } @@ -777,14 +776,14 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( vcl::Window SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) { - SfxTabDialog* pDlg = new SwEnvDlg( pParent, rSet, pWrtSh,pPrt, bInsert ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwEnvDlg>::Create( pParent, rSet, pWrtSh,pPrt, bInsert ); return new AbstractTabDialog_Impl( pDlg ); } AbstractSwLabDlg* SwAbstractDialogFactory_Impl::CreateSwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwDBManager* pDBManager, bool bLabel) { - SwLabDlg* pDlg = new SwLabDlg(pParent, rSet, pDBManager, bLabel); + VclPtr<SwLabDlg> pDlg = VclPtr<SwLabDlg>::Create(pParent, rSet, pDBManager, bLabel); return new AbstractSwLabDlg_Impl(pDlg); } @@ -800,120 +799,120 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwParaDlg ( vcl::Windo bool bDraw , const OString& sDefPage) { - SfxTabDialog* pDlg = new SwParaDlg( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, sDefPage ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwParaDlg>::Create( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, sDefPage ); return new AbstractTabDialog_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclAbstractDialog ( vcl::Window *pParent, SwWrtShell &rSh, int nResId ) { - Dialog* pDlg=NULL; + VclPtr<Dialog> pDlg; switch ( nResId ) { case DLG_ROW_HEIGHT : - pDlg = new SwTableHeightDlg( pParent, rSh); + pDlg = VclPtr<SwTableHeightDlg>::Create( pParent, rSh); break; case DLG_SORTING : - pDlg = new SwSortDlg( pParent, rSh); + pDlg = VclPtr<SwSortDlg>::Create( pParent, rSh); break; case DLG_COLUMN : - pDlg = new SwColumnDlg( pParent, rSh ); + pDlg = VclPtr<SwColumnDlg>::Create( pParent, rSh ); break; case DLG_EDIT_AUTHMARK : - pDlg = new SwAuthMarkModalDlg( pParent, rSh ); + pDlg = VclPtr<SwAuthMarkModalDlg>::Create( pParent, rSh ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new VclAbstractDialog_Impl( pDlg ); return 0; } AbstractSplitTableDialog * SwAbstractDialogFactory_Impl::CreateSplitTblDialog ( vcl::Window *pParent, SwWrtShell &rSh ) { - return new AbstractSplitTableDialog_Impl( new SwSplitTblDlg( pParent, rSh) ); + return new AbstractSplitTableDialog_Impl( VclPtr<SwSplitTblDlg>::Create( pParent, rSh) ); } AbstractSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShortName) { - SwSelGlossaryDlg* pDlg = new SwSelGlossaryDlg(pParent, rShortName); + VclPtr<SwSelGlossaryDlg> pDlg = VclPtr<SwSelGlossaryDlg>::Create(pParent, rShortName); return new AbstractSwSelGlossaryDlg_Impl(pDlg); } AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(vcl::Window* pParent, SwWrtShell* pShell, bool bSetAutoFmt, const SwTableAutoFmt* pSelFmt) { - SwAutoFormatDlg* pDlg = new SwAutoFormatDlg(pParent, pShell, bSetAutoFmt, pSelFmt); + VclPtr<SwAutoFormatDlg> pDlg = VclPtr<SwAutoFormatDlg>::Create(pParent, pShell, bSetAutoFmt, pSelFmt); return new AbstractSwAutoFormatDlg_Impl(pDlg); } SfxAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg(vcl::Window* pParent, SfxItemSet& rSet, sal_uInt16 nType, int nResId ) { - SfxModalDialog* pDlg=NULL; + VclPtr<SfxModalDialog> pDlg; switch ( nResId ) { case RC_DLG_SWBORDERDLG : - pDlg = new SwBorderDlg( pParent, rSet, nType ); + pDlg = VclPtr<SwBorderDlg>::Create( pParent, rSet, nType ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new SwAbstractSfxDialog_Impl( pDlg ); return 0; } SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( vcl::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, bool bDrawMode, int nResId ) { - SfxModalDialog* pDlg=NULL; + VclPtr<SfxModalDialog> pDlg; switch ( nResId ) { case RC_DLG_SWWRAPDLG : - pDlg = new SwWrapDlg( pParent, rSet, pSh, bDrawMode ); + pDlg = VclPtr<SwWrapDlg>::Create( pParent, rSet, pSh, bDrawMode ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new SwAbstractSfxDialog_Impl( pDlg ); return 0; } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rFnc) { - Dialog* pDlg = new SwTableWidthDlg(pParent, rFnc); + VclPtr<Dialog> pDlg = VclPtr<SwTableWidthDlg>::Create(pParent, rFnc); return new VclAbstractDialog_Impl( pDlg ); } SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTableTabDlg(vcl::Window* pParent, SfxItemPool& Pool, const SfxItemSet* pItemSet, SwWrtShell* pSh) { - SfxTabDialog* pDlg = new SwTableTabDlg(pParent, Pool, pItemSet, pSh); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwTableTabDlg>::Create(pParent, Pool, pItemSet, pSh); return new AbstractTabDialog_Impl(pDlg); } AbstractSwFldDlg * SwAbstractDialogFactory_Impl::CreateSwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent) { - SwFldDlg* pDlg = new SwFldDlg(pB, pCW, pParent); + VclPtr<SwFldDlg> pDlg = VclPtr<SwFldDlg>::Create(pB, pCW, pParent); return new AbstractSwFldDlg_Impl(pDlg); } SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& rVw, int nResId ) { - SfxModalDialog* pDlg=NULL; + VclPtr<SfxModalDialog> pDlg; switch ( nResId ) { case RC_DLG_SWFLDEDITDLG : - pDlg = new SwFldEditDlg( rVw ); + pDlg = VclPtr<SwFldEditDlg>::Create( rVw ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new SwAbstractSfxDialog_Impl( pDlg ); return 0; } @@ -922,19 +921,19 @@ AbstractSwRenameXNamedDlg * SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDl ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess) { - SwRenameXNamedDlg* pDlg = new SwRenameXNamedDlg( pParent,xNamed, xNameAccess); + VclPtr<SwRenameXNamedDlg> pDlg = VclPtr<SwRenameXNamedDlg>::Create( pParent,xNamed, xNameAccess); return new AbstractSwRenameXNamedDlg_Impl( pDlg ); } AbstractSwModalRedlineAcceptDlg * SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg(vcl::Window *pParent) { - SwModalRedlineAcceptDlg* pDlg = new SwModalRedlineAcceptDlg( pParent ); + VclPtr<SwModalRedlineAcceptDlg> pDlg = VclPtr<SwModalRedlineAcceptDlg>::Create( pParent ); return new AbstractSwModalRedlineAcceptDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateTblMergeDialog(vcl::Window* pParent, bool& rWithPrev) { - Dialog* pDlg = new SwMergeTblDlg( pParent, rWithPrev ); + VclPtr<Dialog> pDlg = VclPtr<SwMergeTblDlg>::Create( pParent, rWithPrev ); return new VclAbstractDialog_Impl( pDlg ); } @@ -946,7 +945,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateFrmTabDialog(const OUS const OString& sDefPage, const OUString* pFmtStr ) { - SfxTabDialog* pDlg = new SwFrmDlg(pFrame, pParent, rCoreSet, bNewFrm, rDialogType, bFmt, sDefPage, pFmtStr); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwFrmDlg>::Create(pFrame, pParent, rCoreSet, bNewFrm, rDialogType, bFmt, sDefPage, pFmtStr); return new AbstractTabDialog_Impl(pDlg); } @@ -958,7 +957,7 @@ SfxAbstractApplyTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( SwWrtShell* pActShell, bool bNew ) { - SfxTabDialog* pDlg = new SwTemplateDlg( pParent, rBase, nRegion, sPage, pActShell, bNew ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwTemplateDlg>::Create( pParent, rBase, nRegion, sPage, pActShell, bNew ); return new AbstractApplyTabDialog_Impl( pDlg ); } @@ -966,46 +965,46 @@ AbstractGlossaryDlg* SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxViewFram SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell) { - SwGlossaryDlg* pDlg = new SwGlossaryDlg(pViewFrame, pGlosHdl, pWrtShell); + VclPtr<SwGlossaryDlg> pDlg = VclPtr<SwGlossaryDlg>::Create(pViewFrame, pGlosHdl, pWrtShell); return new AbstractGlossaryDlg_Impl( pDlg ); } AbstractFldInputDlg* SwAbstractDialogFactory_Impl::CreateFldInputDlg(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bNextButton) { - SwFldInputDlg* pDlg = new SwFldInputDlg( pParent, rSh, pField, bNextButton ); + VclPtr<SwFldInputDlg> pDlg = VclPtr<SwFldInputDlg>::Create( pParent, rSh, pField, bNextButton ); return new AbstractFldInputDlg_Impl( pDlg ); } AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( vcl::Window * pParent, SwWrtShell &rSh, bool bEd ) { - SwInsFootNoteDlg* pDlg = new SwInsFootNoteDlg(pParent, rSh, bEd); + VclPtr<SwInsFootNoteDlg> pDlg = VclPtr<SwInsFootNoteDlg>::Create(pParent, rSh, bEd); return new AbstractInsFootNoteDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateTitlePageDlg ( vcl::Window *pParent ) { - Dialog* pDlg = new SwTitlePageDlg( pParent ); + VclPtr<Dialog> pDlg = VclPtr<SwTitlePageDlg>::Create( pParent ); return new VclAbstractDialog_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog(SwView& rView) { - Dialog* pDlg = new SwLineNumberingDlg( &rView ); + VclPtr<Dialog> pDlg = VclPtr<SwLineNumberingDlg>::Create( &rView ); return new VclAbstractDialog_Impl( pDlg ); } AbstractInsTableDlg * SwAbstractDialogFactory_Impl::CreateInsTableDlg(SwView& rView) { - SwInsTableDlg* pDlg = new SwInsTableDlg(rView); + VclPtr<SwInsTableDlg> pDlg = VclPtr<SwInsTableDlg>::Create(rView); return new AbstractInsTableDlg_Impl( pDlg ); } AbstractJavaEditDialog * SwAbstractDialogFactory_Impl::CreateJavaEditDialog( vcl::Window* pParent, SwWrtShell* pWrtSh) { - SwJavaEditDialog* pDlg = new SwJavaEditDialog(pParent, pWrtSh); + VclPtr<SwJavaEditDialog> pDlg = VclPtr<SwJavaEditDialog>::Create(pParent, pWrtSh); return new AbstractJavaEditDialog_Impl( pDlg ); } @@ -1017,35 +1016,35 @@ AbstractMailMergeDlg * SwAbstractDialogFactory_Impl::CreateMailMergeDlg( int nRe const uno::Reference< sdbc::XConnection>& xConnection, uno::Sequence< uno::Any >* pSelection ) { - SwMailMergeDlg* pDlg=NULL; + VclPtr<SwMailMergeDlg> pDlg; switch ( nResId ) { case DLG_MAILMERGE : - pDlg = new SwMailMergeDlg( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection ); + pDlg = VclPtr<SwMailMergeDlg>::Create( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new AbstractMailMergeDlg_Impl( pDlg ); return 0; } AbstractMailMergeCreateFromDlg * SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg(vcl::Window* pParent) { - SwMailMergeCreateFromDlg* pDlg = new SwMailMergeCreateFromDlg(pParent); + VclPtr<SwMailMergeCreateFromDlg> pDlg = VclPtr<SwMailMergeCreateFromDlg>::Create(pParent); return new AbstractMailMergeCreateFromDlg_Impl(pDlg); } AbstractMailMergeFieldConnectionsDlg * SwAbstractDialogFactory_Impl::CreateMailMergeFieldConnectionsDlg(vcl::Window* pParent) { - SwMailMergeFieldConnectionsDlg* pDlg = new SwMailMergeFieldConnectionsDlg( pParent ); + VclPtr<SwMailMergeFieldConnectionsDlg> pDlg = VclPtr<SwMailMergeFieldConnectionsDlg>::Create( pParent ); return new AbstractMailMergeFieldConnectionsDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg(vcl::Window* pParent, SwTOXMgr &rTOXMgr) { - Dialog* pDlg = new SwMultiTOXMarkDlg(pParent, rTOXMgr); + VclPtr<Dialog> pDlg = VclPtr<SwMultiTOXMarkDlg>::Create(pParent, rTOXMgr); return new VclAbstractDialog_Impl(pDlg); } @@ -1054,20 +1053,20 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTabDialog( int nResI const SfxItemSet* pSwItemSet, SwWrtShell & rWrtSh ) { - SfxTabDialog* pDlg=NULL; + VclPtr<SfxTabDialog> pDlg; switch ( nResId ) { case DLG_SVXTEST_NUM_BULLET : - pDlg = new SwSvxNumBulletTabDialog( pParent, pSwItemSet, rWrtSh ); + pDlg = VclPtr<SwSvxNumBulletTabDialog>::Create( pParent, pSwItemSet, rWrtSh ); break; case DLG_TAB_OUTLINE : - pDlg = new SwOutlineTabDialog( pParent, pSwItemSet, rWrtSh ); + pDlg = VclPtr<SwOutlineTabDialog>::Create( pParent, pSwItemSet, rWrtSh ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new AbstractTabDialog_Impl( pDlg ); return 0; } @@ -1078,20 +1077,20 @@ AbstractMultiTOXTabDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXTabDialo SwTOXBase* pCurTOX, sal_uInt16 nToxType, bool bGlobal) { - SwMultiTOXTabDialog* pDlg = new SwMultiTOXTabDialog( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal ); + VclPtr<SwMultiTOXTabDialog> pDlg = VclPtr<SwMultiTOXTabDialog>::Create( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal ); return new AbstractMultiTOXTabDialog_Impl( pDlg ); } AbstractEditRegionDlg * SwAbstractDialogFactory_Impl::CreateEditRegionDlg(vcl::Window* pParent, SwWrtShell& rWrtSh) { - SwEditRegionDlg* pDlg = new SwEditRegionDlg( pParent, rWrtSh ); + VclPtr<SwEditRegionDlg> pDlg = VclPtr<SwEditRegionDlg>::Create( pParent, rWrtSh ); return new AbstractEditRegionDlg_Impl( pDlg ); } AbstractInsertSectionTabDialog * SwAbstractDialogFactory_Impl::CreateInsertSectionTabDialog( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) { - SwInsertSectionTabDialog* pDlg = new SwInsertSectionTabDialog(pParent, rSet, rSh); + VclPtr<SwInsertSectionTabDialog> pDlg = VclPtr<SwInsertSectionTabDialog>::Create(pParent, rSet, rSh); return new AbstractInsertSectionTabDialog_Impl(pDlg); } @@ -1102,7 +1101,7 @@ AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateIndexMarkFloatDlg( SfxChildWinInfo* pInfo, bool bNew ) { - SwIndexMarkFloatDlg* pDlg = new SwIndexMarkFloatDlg(pBindings, pChild, pParent, pInfo, bNew); + VclPtr<SwIndexMarkFloatDlg> pDlg = VclPtr<SwIndexMarkFloatDlg>::Create(pBindings, pChild, pParent, pInfo, bNew); return new AbstractIndexMarkFloatDlg_Impl(pDlg); } @@ -1113,7 +1112,7 @@ AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDlg( SfxChildWinInfo* pInfo, bool bNew) { - SwAuthMarkFloatDlg* pDlg = new SwAuthMarkFloatDlg( pBindings, pChild, pParent, pInfo, bNew ); + VclPtr<SwAuthMarkFloatDlg> pDlg = VclPtr<SwAuthMarkFloatDlg>::Create( pBindings, pChild, pParent, pInfo, bNew ); return new AbstractAuthMarkFloatDlg_Impl( pDlg ); } @@ -1123,21 +1122,21 @@ AbstractSwWordCountFloatDlg * SwAbstractDialogFactory_Impl::CreateSwWordCountDia vcl::Window *pParent, SfxChildWinInfo* pInfo) { - SwWordCountFloatDlg* pDlg = new SwWordCountFloatDlg( pBindings, pChild, pParent, pInfo ); + VclPtr<SwWordCountFloatDlg> pDlg = VclPtr<SwWordCountFloatDlg>::Create( pBindings, pChild, pParent, pInfo ); return new AbstractSwWordCountFloatDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg( vcl::Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ) { - Dialog* pDlg = new SwIndexMarkModalDlg( pParent, rSh, pCurTOXMark ); + VclPtr<Dialog> pDlg = VclPtr<SwIndexMarkModalDlg>::Create( pParent, rSh, pCurTOXMark ); return new VclAbstractDialog_Impl( pDlg ); } AbstractMailMergeWizard* SwAbstractDialogFactory_Impl::CreateMailMergeWizard( SwView& rView, SwMailMergeConfigItem& rConfigItem) { - return new AbstractMailMergeWizard_Impl( new SwMailMergeWizard(rView, rConfigItem)); + return new AbstractMailMergeWizard_Impl( VclPtr<SwMailMergeWizard>::Create(rView, rConfigItem)); } GlossaryGetCurrGroup SwAbstractDialogFactory_Impl::GetGlossaryCurrGroupFunc() diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 9e6ff470c404..4ec9fa68ad33 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -48,7 +48,7 @@ class DropDownFieldDialog; #define DECL_ABSTDLG_BASE(Class,DialogClass) \ protected: \ - DialogClass* pDlg; \ + ScopedVclPtr<DialogClass> pDlg; \ public: \ Class( DialogClass* p) \ : pDlg(p) \ @@ -59,7 +59,6 @@ public: \ #define IMPL_ABSTDLG_BASE(Class) \ Class::~Class() \ { \ - delete pDlg; \ } \ short Class::Execute() \ { \ @@ -350,7 +349,7 @@ class AbstractAuthMarkFloatDlg_Impl : public AbstractMarkFloatDlg class SwMailMergeWizard; class AbstractMailMergeWizard_Impl : public AbstractMailMergeWizard { - SwMailMergeWizard* pDlg; + VclPtr<SwMailMergeWizard> pDlg; Link aEndDlgHdl; DECL_LINK( EndDialogHdl, SwMailMergeWizard* ); diff --git a/sw/source/ui/dialog/swmessdialog.cxx b/sw/source/ui/dialog/swmessdialog.cxx index 2e085f464686..79aba4459af6 100644 --- a/sw/source/ui/dialog/swmessdialog.cxx +++ b/sw/source/ui/dialog/swmessdialog.cxx @@ -30,4 +30,19 @@ SwMessageAndEditDialog::SwMessageAndEditDialog(vcl::Window* pParent, const OUStr get(m_pEdit, "edit"); } +SwMessageAndEditDialog::~SwMessageAndEditDialog() +{ + disposeOnce(); +} + +void SwMessageAndEditDialog::dispose() +{ + m_pOKPB.clear(); + m_pImageIM.clear(); + m_pPrimaryMessage.clear(); + m_pSecondaryMessage.clear(); + m_pEdit.clear(); + ModalDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx index f90812fa4681..dbbac541e03a 100644 --- a/sw/source/ui/dialog/swuiexp.cxx +++ b/sw/source/ui/dialog/swuiexp.cxx @@ -18,7 +18,32 @@ */ #include "swdlgfact.hxx" + +#include "abstract.hxx" +#include "ascfldlg.hxx" +#include "break.hxx" +#include "convert.hxx" #include "dialmgr.hxx" +#include "dbinsdlg.hxx" +#include "DropDownFieldDialog.hxx" +#include "fldtdlg.hxx" +#include "glossary.hxx" +#include "inpdlg.hxx" +#include "insfnote.hxx" +#include "instable.hxx" +#include "javaedit.hxx" +#include "label.hxx" +#include "mailmrge.hxx" +#include "mailmergewizard.hxx" +#include "regionsw.hxx" +#include "selglos.hxx" +#include "splittbl.hxx" +#include "tautofmt.hxx" +#include "swmodalredlineacceptdlg.hxx" +#include "swrenamexnameddlg.hxx" +#include "swuiidxmrk.hxx" +#include "swuicnttab.hxx" +#include "wordcountdialog.hxx" #include <swuiexp.hxx> namespace swui diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index a0b3ac501966..41fbe2b8d3b9 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -404,11 +404,11 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox) if (!pRepr->GetTempPasswd().getLength() && pRepr->GetSectionData().GetPassword().getLength()) { - SfxPasswordDialog aPasswdDlg(this); + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this); bRet = false; - if (aPasswdDlg.Execute()) + if (aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); ::com::sun::star::uno::Sequence <sal_Int8 > aNewPasswd; SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if (SvPasswordHelper::CompareHashPassword( @@ -516,6 +516,11 @@ sal_uInt16 SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt ) SwEditRegionDlg::~SwEditRegionDlg( ) { + disposeOnce(); +} + +void SwEditRegionDlg::dispose() +{ SvTreeListEntry* pEntry = m_pTree->First(); while( pEntry ) { @@ -524,6 +529,29 @@ SwEditRegionDlg::~SwEditRegionDlg( ) } delete m_pDocInserter; + m_pCurName.clear(); + m_pTree.clear(); + m_pFileCB.clear(); + m_pDDECB.clear(); + m_pDDEFrame.clear(); + m_pFileNameFT.clear(); + m_pDDECommandFT.clear(); + m_pFileNameED.clear(); + m_pFilePB.clear(); + m_pSubRegionFT.clear(); + m_pSubRegionED.clear(); + m_pProtectCB.clear(); + m_pPasswdCB.clear(); + m_pPasswdPB.clear(); + m_pHideCB.clear(); + m_pConditionFT.clear(); + m_pConditionED.clear(); + m_pEditInReadonlyCB.clear(); + m_pOK.clear(); + m_pOptionsPB.clear(); + m_pDismiss.clear(); + m_pOldDefDlgParent.clear(); + SfxModalDialog::dispose(); } void SwEditRegionDlg::SelectSection(const OUString& rSectionName) @@ -1053,10 +1081,10 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl) aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth)); aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); - SwSectionPropertyTabDialog aTabDlg(this, aSet, rSh); - if(RET_OK == aTabDlg.Execute()) + ScopedVclPtrInstance< SwSectionPropertyTabDialog > aTabDlg(this, aSet, rSh); + if(RET_OK == aTabDlg->Execute()) { - const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet(); + const SfxItemSet* pOutSet = aTabDlg->GetOutputItemSet(); if( pOutSet && pOutSet->Count() ) { const SfxPoolItem *pColItem, *pBrushItem, @@ -1232,12 +1260,12 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox ) { if(!pRepr->GetTempPasswd().getLength() || bChange) { - SfxPasswordDialog aPasswdDlg(this); - aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); - if(RET_OK == aPasswdDlg.Execute()) + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this); + aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM); + if(RET_OK == aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); - if( aPasswdDlg.GetConfirm() == sNewPasswd ) + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); + if( aPasswdDlg->GetConfirm() == sNewPasswd ) { SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd ); } @@ -1533,7 +1561,30 @@ SwInsertSectionTabPage::SwInsertSectionTabPage( SwInsertSectionTabPage::~SwInsertSectionTabPage() { + disposeOnce(); +} + +void SwInsertSectionTabPage::dispose() +{ delete m_pDocInserter; + m_pCurName.clear(); + m_pFileCB.clear(); + m_pDDECB.clear(); + m_pDDECommandFT.clear(); + m_pFileNameFT.clear(); + m_pFileNameED.clear(); + m_pFilePB.clear(); + m_pSubRegionFT.clear(); + m_pSubRegionED.clear(); + m_pProtectCB.clear(); + m_pPasswdCB.clear(); + m_pPasswdPB.clear(); + m_pHideCB.clear(); + m_pConditionFT.clear(); + m_pConditionED.clear(); + m_pEditInReadonlyCB.clear(); + m_pOldDefDlgParent.clear(); + SfxTabPage::dispose(); } void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) @@ -1635,10 +1686,10 @@ void SwInsertSectionTabPage::Reset( const SfxItemSet* ) { } -SfxTabPage* SwInsertSectionTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwInsertSectionTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwInsertSectionTabPage(pParent, *rAttrSet); + return VclPtr<SwInsertSectionTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK( SwInsertSectionTabPage, ChangeHideHdl, CheckBox *, pBox ) @@ -1670,12 +1721,12 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton ) { if(!m_aNewPasswd.getLength() || bChange) { - SfxPasswordDialog aPasswdDlg(this); - aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); - if(RET_OK == aPasswdDlg.Execute()) + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this); + aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM); + if(RET_OK == aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); - if( aPasswdDlg.GetConfirm() == sNewPasswd ) + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); + if( aPasswdDlg->GetConfirm() == sNewPasswd ) { SvPasswordHelper::GetHashPassword( m_aNewPasswd, sNewPasswd ); } @@ -1835,6 +1886,32 @@ SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( vcl::Window *pParent, SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage() { + disposeOnce(); +} + +void SwSectionFtnEndTabPage::dispose() +{ + pFtnNtAtTextEndCB.clear(); + pFtnNtNumCB.clear(); + pFtnOffsetLbl.clear(); + pFtnOffsetFld.clear(); + pFtnNtNumFmtCB.clear(); + pFtnPrefixFT.clear(); + pFtnPrefixED.clear(); + pFtnNumViewBox.clear(); + pFtnSuffixFT.clear(); + pFtnSuffixED.clear(); + pEndNtAtTextEndCB.clear(); + pEndNtNumCB.clear(); + pEndOffsetLbl.clear(); + pEndOffsetFld.clear(); + pEndNtNumFmtCB.clear(); + pEndPrefixFT.clear(); + pEndPrefixED.clear(); + pEndNumViewBox.clear(); + pEndSuffixFT.clear(); + pEndSuffixED.clear(); + SfxTabPage::dispose(); } bool SwSectionFtnEndTabPage::FillItemSet( SfxItemSet* rSet ) @@ -1975,10 +2052,10 @@ void SwSectionFtnEndTabPage::Reset( const SfxItemSet* rSet ) RES_END_AT_TXTEND, false ))); } -SfxTabPage* SwSectionFtnEndTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwSectionFtnEndTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwSectionFtnEndTabPage(pParent, *rAttrSet); + return VclPtr<SwSectionFtnEndTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK( SwSectionFtnEndTabPage, FootEndHdl, CheckBox *, pBox ) @@ -2096,6 +2173,15 @@ SwSectionIndentTabPage::SwSectionIndentTabPage(vcl::Window *pParent, const SfxIt SwSectionIndentTabPage::~SwSectionIndentTabPage() { + disposeOnce(); +} + +void SwSectionIndentTabPage::dispose() +{ + m_pBeforeMF.clear(); + m_pAfterMF.clear(); + m_pPreviewWin.clear(); + SfxTabPage::dispose(); } bool SwSectionIndentTabPage::FillItemSet( SfxItemSet* rSet) @@ -2137,9 +2223,9 @@ void SwSectionIndentTabPage::Reset( const SfxItemSet* rSet) IndentModifyHdl(0); } -SfxTabPage* SwSectionIndentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwSectionIndentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwSectionIndentTabPage(pParent, *rAttrSet); + return VclPtr<SwSectionIndentTabPage>::Create(pParent, *rAttrSet); } void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh) diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index 2a7392eee793..471309e2e92b 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -46,7 +46,26 @@ IMPL_LINK_NOARG(SwWordCountFloatDlg, CloseHdl) SwWordCountFloatDlg::~SwWordCountFloatDlg() { + disposeOnce(); +} + +void SwWordCountFloatDlg::dispose() +{ SwViewShell::SetCareWin( 0 ); + m_pCurrentWordFT.clear(); + m_pCurrentCharacterFT.clear(); + m_pCurrentCharacterExcludingSpacesFT.clear(); + m_pCurrentCjkcharsFT.clear(); + m_pCurrentStandardizedPagesFT.clear(); + m_pDocWordFT.clear(); + m_pDocCharacterFT.clear(); + m_pDocCharacterExcludingSpacesFT.clear(); + m_pDocCjkcharsFT.clear(); + m_pDocStandardizedPagesFT.clear(); + m_pCjkcharsLabelFT.clear(); + m_pStandardizedPagesLabelFT.clear(); + m_pClosePB.clear(); + SfxModelessDialog::dispose(); } namespace diff --git a/sw/source/ui/dochdl/selglos.cxx b/sw/source/ui/dochdl/selglos.cxx index 5cdc698f750d..2cde14cea56d 100644 --- a/sw/source/ui/dochdl/selglos.cxx +++ b/sw/source/ui/dochdl/selglos.cxx @@ -35,6 +35,17 @@ SwSelGlossaryDlg::SwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShort m_pGlosBox->SetDoubleClickHdl(LINK(this, SwSelGlossaryDlg, DoubleClickHdl)); } +SwSelGlossaryDlg::~SwSelGlossaryDlg() +{ + disposeOnce(); +} + +void SwSelGlossaryDlg::dispose() +{ + m_pGlosBox.clear(); + ModalDialog::dispose(); +} + IMPL_LINK(SwSelGlossaryDlg, DoubleClickHdl, ListBox*, /*pBox*/) { EndDialog(RET_OK); diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 2e9ea372b3e7..0fa73fb0171d 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -197,6 +197,27 @@ SwEnvFmtPage::SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet) } +SwEnvFmtPage::~SwEnvFmtPage() +{ + disposeOnce(); +} + +void SwEnvFmtPage::dispose() +{ + m_pAddrLeftField.clear(); + m_pAddrTopField.clear(); + m_pAddrEditButton.clear(); + m_pSendLeftField.clear(); + m_pSendTopField.clear(); + m_pSendEditButton.clear(); + m_pSizeFormatBox.clear(); + m_pSizeWidthField.clear(); + m_pSizeHeightField.clear(); + m_pPreview.clear(); + SfxTabPage::dispose(); +} + + IMPL_LINK_INLINE_START( SwEnvFmtPage, ModifyHdl, Edit *, pEdit ) { long lWVal = static_cast< long >(GetFldVal(*m_pSizeWidthField )); @@ -298,7 +319,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton ) ::PrepareBoxInfo( aTmpSet, *pSh ); const OUString sFmtStr = pColl->GetName(); - boost::scoped_ptr<SwParaDlg> pDlg(new SwParaDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr)); + VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr); if ( pDlg->Execute() == RET_OK ) { @@ -440,9 +461,9 @@ void SwEnvFmtPage::SetMinMax() m_pSizeHeightField->Reformat(); } -SfxTabPage* SwEnvFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwEnvFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwEnvFmtPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwEnvFmtPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwEnvFmtPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx index 73cb44d3647d..744f576dd9c7 100644 --- a/sw/source/ui/envelp/envfmt.hxx +++ b/sw/source/ui/envelp/envfmt.hxx @@ -30,21 +30,19 @@ class SwTxtFmtColl; class SwEnvFmtPage : public SfxTabPage { - MetricField* m_pAddrLeftField; - MetricField* m_pAddrTopField; - MenuButton* m_pAddrEditButton; - MetricField* m_pSendLeftField; - MetricField* m_pSendTopField; - MenuButton* m_pSendEditButton; - ListBox* m_pSizeFormatBox; - MetricField* m_pSizeWidthField; - MetricField* m_pSizeHeightField; - SwEnvPreview* m_pPreview; + VclPtr<MetricField> m_pAddrLeftField; + VclPtr<MetricField> m_pAddrTopField; + VclPtr<MenuButton> m_pAddrEditButton; + VclPtr<MetricField> m_pSendLeftField; + VclPtr<MetricField> m_pSendTopField; + VclPtr<MenuButton> m_pSendEditButton; + VclPtr<ListBox> m_pSizeFormatBox; + VclPtr<MetricField> m_pSizeWidthField; + VclPtr<MetricField> m_pSizeHeightField; + VclPtr<SwEnvPreview> m_pPreview; std::vector<sal_uInt16> aIDs; - SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); - DECL_LINK( ModifyHdl, Edit * ); DECL_LINK( EditHdl, MenuButton * ); DECL_LINK(FormatHdl, void *); @@ -59,8 +57,11 @@ class SwEnvFmtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwEnvFmtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index 575d865fb74f..d0fcedae9073 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -153,8 +153,14 @@ SwEnvDlg::SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwEnvDlg::~SwEnvDlg() { + disposeOnce(); +} + +void SwEnvDlg::dispose() +{ delete pAddresseeSet; delete pSenderSet; + SfxTabDialog::dispose(); } void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) @@ -229,6 +235,20 @@ SwEnvPage::SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet) SwEnvPage::~SwEnvPage() { + disposeOnce(); +} + +void SwEnvPage::dispose() +{ + m_pAddrEdit.clear(); + m_pDatabaseLB.clear(); + m_pTableLB.clear(); + m_pDBFieldLB.clear(); + m_pInsertBT.clear(); + m_pSenderBox.clear(); + m_pSenderEdit.clear(); + m_pPreview.clear(); + SfxTabPage::dispose(); } IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox ) @@ -303,9 +323,9 @@ void SwEnvPage::InitDatabaseBox() } } -SfxTabPage* SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwEnvPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwEnvPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwEnvPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx index 309ccc356e27..10b3a0d323de 100644 --- a/sw/source/ui/envelp/envprt.cxx +++ b/sw/source/ui/envelp/envprt.cxx @@ -67,6 +67,23 @@ SwEnvPrtPage::SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet) m_aIds[ENV_VER_RGHT] = m_pAlignBox->GetItemId("vertright"); } +SwEnvPrtPage::~SwEnvPrtPage() +{ + disposeOnce(); +} + +void SwEnvPrtPage::dispose() +{ + m_pAlignBox.clear(); + m_pTopButton.clear(); + m_pBottomButton.clear(); + m_pRightField.clear(); + m_pDownField.clear(); + m_pPrinterInfo.clear(); + m_pPrtSetup.clear(); + SfxTabPage::dispose(); +} + IMPL_LINK_NOARG(SwEnvPrtPage, ClickHdl) { if (m_pBottomButton->IsChecked()) @@ -99,7 +116,7 @@ IMPL_LINK( SwEnvPrtPage, ButtonHdl, Button *, pBtn ) // Call printer setup if (pPrt) { - boost::scoped_ptr<PrinterSetupDialog> pDlg(new PrinterSetupDialog(this)); + VclPtrInstance< PrinterSetupDialog > pDlg(this); pDlg->SetPrinter(pPrt); pDlg->Execute(); pDlg.reset(); @@ -127,9 +144,9 @@ IMPL_LINK_NOARG(SwEnvPrtPage, AlignHdl) return 0; } -SfxTabPage* SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwEnvPrtPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwEnvPrtPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwEnvPrtPage::ActivatePage(const SfxItemSet&) diff --git a/sw/source/ui/envelp/envprt.hxx b/sw/source/ui/envelp/envprt.hxx index 2c947d53c3a1..a71c96b3a9e6 100644 --- a/sw/source/ui/envelp/envprt.hxx +++ b/sw/source/ui/envelp/envprt.hxx @@ -35,19 +35,17 @@ class SwEnvDlg; class SwEnvPrtPage : public SfxTabPage { - ToolBox* m_pAlignBox; - RadioButton* m_pTopButton; - RadioButton* m_pBottomButton; - MetricField* m_pRightField; - MetricField* m_pDownField; - FixedText* m_pPrinterInfo; - PushButton* m_pPrtSetup; + VclPtr<ToolBox> m_pAlignBox; + VclPtr<RadioButton> m_pTopButton; + VclPtr<RadioButton> m_pBottomButton; + VclPtr<MetricField> m_pRightField; + VclPtr<MetricField> m_pDownField; + VclPtr<FixedText> m_pPrinterInfo; + VclPtr<PushButton> m_pPrtSetup; sal_uInt16 m_aIds[ENV_VER_RGHT-ENV_HOR_LEFT+1]; - Printer* pPrt; - - SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); + VclPtr<Printer> pPrt; DECL_LINK(ClickHdl, void *); DECL_LINK(AlignHdl, void *); @@ -59,8 +57,11 @@ class SwEnvPrtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwEnvPrtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 426816ec8e3c..8cf472141a12 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -170,7 +170,14 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwLabDlg::~SwLabDlg() { + disposeOnce(); +} + +void SwLabDlg::dispose() +{ delete pRecs; + pPrtPage.clear(); + SfxTabDialog::dispose(); } void SwLabDlg::GetLabItem(SwLabItem &rItem) @@ -286,6 +293,29 @@ SwLabPage::SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet) m_pMakeBox->GetSelectHdl().Call(m_pMakeBox); } +SwLabPage::~SwLabPage() +{ + disposeOnce(); +} + +void SwLabPage::dispose() +{ + m_pAddressFrame.clear(); + m_pAddrBox.clear(); + m_pWritingEdit.clear(); + m_pDatabaseLB.clear(); + m_pTableLB.clear(); + m_pInsertBT.clear(); + m_pDBFieldLB.clear(); + m_pContButton.clear(); + m_pSheetButton.clear(); + m_pMakeBox.clear(); + m_pTypeBox.clear(); + m_pHiddenSortTypeBox.clear(); + m_pFormatInfo.clear(); + SfxTabPage::dispose(); +} + void SwLabPage::SetToBusinessCard() { SetHelpId(HID_BUSINESS_FMT_PAGE); @@ -406,24 +436,24 @@ IMPL_LINK_NOARG_INLINE_END(SwLabPage, TypeHdl) void SwLabPage::DisplayFormat() { - MetricField aField(this, WinBits(0)); + ScopedVclPtrInstance< MetricField > aField(this, WinBits(0)); FieldUnit aMetric = ::GetDfltMetric(false); - SetMetric(aField, aMetric); - aField.SetDecimalDigits(2); - aField.SetMin (0); - aField.SetMax (LONG_MAX); + SetMetric(*aField.get(), aMetric); + aField->SetDecimalDigits(2); + aField->SetMin (0); + aField->SetMax (LONG_MAX); SwLabRec* pRec = GetSelectedEntryPos(); aItem.aLstType = pRec->aType; - SETFLDVAL(aField, pRec->lWidth); - aField.Reformat(); - const OUString aWString = aField.GetText(); + SETFLDVAL(*aField.get(), pRec->lWidth); + aField->Reformat(); + const OUString aWString = aField->GetText(); - SETFLDVAL(aField, pRec->lHeight); - aField.Reformat(); + SETFLDVAL(*aField.get(), pRec->lHeight); + aField->Reformat(); OUString aText = pRec->aType + ": " + aWString + - " x " + aField.GetText() + + " x " + aField->GetText() + " (" + OUString::number( pRec->nCols ) + " x " + OUString::number( pRec->nRows ) + ")"; m_pFormatInfo->SetText(aText); @@ -458,9 +488,9 @@ void SwLabPage::InitDatabaseBox() } } -SfxTabPage* SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwLabPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwLabPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwLabPage::ActivatePage(const SfxItemSet& rSet) @@ -586,17 +616,26 @@ SwVisitingCardPage::SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& r SwVisitingCardPage::~SwVisitingCardPage() { + disposeOnce(); +} + +void SwVisitingCardPage::dispose() +{ for(sal_Int32 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); ++i) delete static_cast<OUString*>(m_pAutoTextGroupLB->GetEntryData( i )); m_xAutoText = 0; ClearUserData(); delete pExampleFrame; + m_pAutoTextLB.clear(); + m_pAutoTextGroupLB.clear(); + m_pExampleWIN.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwVisitingCardPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwVisitingCardPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet) @@ -727,9 +766,37 @@ SwPrivateDataPage::SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSe SetExchangeSupport(); } -SfxTabPage* SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +SwPrivateDataPage::~SwPrivateDataPage() { - return new SwPrivateDataPage(pParent, *rSet); + disposeOnce(); +} + +void SwPrivateDataPage::dispose() +{ + m_pFirstNameED.clear(); + m_pNameED.clear(); + m_pShortCutED.clear(); + m_pFirstName2ED.clear(); + m_pName2ED.clear(); + m_pShortCut2ED.clear(); + m_pStreetED.clear(); + m_pZipED.clear(); + m_pCityED.clear(); + m_pCountryED.clear(); + m_pStateED.clear(); + m_pTitleED.clear(); + m_pProfessionED.clear(); + m_pPhoneED.clear(); + m_pMobilePhoneED.clear(); + m_pFaxED.clear(); + m_pHomePageED.clear(); + m_pMailED.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +{ + return VclPtr<SfxTabPage>(new SwPrivateDataPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet) @@ -815,9 +882,34 @@ SwBusinessDataPage::SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& r SetExchangeSupport(); } -SfxTabPage* SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +SwBusinessDataPage::~SwBusinessDataPage() +{ + disposeOnce(); +} + +void SwBusinessDataPage::dispose() +{ + m_pCompanyED.clear(); + m_pCompanyExtED.clear(); + m_pSloganED.clear(); + m_pStreetED.clear(); + m_pZipED.clear(); + m_pCityED.clear(); + m_pCountryED.clear(); + m_pStateED.clear(); + m_pPositionED.clear(); + m_pPhoneED.clear(); + m_pMobilePhoneED.clear(); + m_pFaxED.clear(); + m_pHomePageED.clear(); + m_pMailED.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwBusinessDataPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwBusinessDataPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 9e9a216f5848..646da3d044b4 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -353,8 +353,29 @@ SwLabFmtPage::SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet) SwLabFmtPage::~SwLabFmtPage() { + disposeOnce(); } +void SwLabFmtPage::dispose() +{ + m_pMakeFI.clear(); + m_pTypeFI.clear(); + m_pPreview.clear(); + m_pHDistField.clear(); + m_pVDistField.clear(); + m_pWidthField.clear(); + m_pHeightField.clear(); + m_pLeftField.clear(); + m_pUpperField.clear(); + m_pColsField.clear(); + m_pRowsField.clear(); + m_pPWidthField.clear(); + m_pPHeightField.clear(); + m_pSavePB.clear(); + SfxTabPage::dispose(); +} + + // Modify-handler of MetricFields. start preview timer IMPL_LINK_NOARG_INLINE_START(SwLabFmtPage, ModifyHdl) { @@ -464,9 +485,9 @@ void SwLabFmtPage::ChangeMinMax() m_pPHeightField->Reformat(); } -SfxTabPage* SwLabFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwLabFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwLabFmtPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwLabFmtPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwLabFmtPage::ActivatePage(const SfxItemSet& rSet) @@ -558,7 +579,7 @@ IMPL_LINK_NOARG(SwLabFmtPage, SaveHdl) aRec.lPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField )); aRec.lPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField)); aRec.bCont = aItem.bCont; - boost::scoped_ptr<SwSaveLabelDlg> pSaveDlg(new SwSaveLabelDlg(this, aRec)); + ScopedVclPtrInstance< SwSaveLabelDlg > pSaveDlg(this, aRec); pSaveDlg->SetLabel(aItem.aLstMake, aItem.aLstType); pSaveDlg->Execute(); if(pSaveDlg->GetLabel(aItem)) @@ -600,6 +621,20 @@ SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) } } +SwSaveLabelDlg::~SwSaveLabelDlg() +{ + disposeOnce(); +} + +void SwSaveLabelDlg::dispose() +{ + m_pMakeCB.clear(); + m_pTypeED.clear(); + m_pOKPB.clear(); + pLabPage.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) { SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig(); @@ -614,15 +649,15 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) return 0; } - MessageDialog aQuery(this, "QuerySaveLabelDialog", - "modules/swriter/ui/querysavelabeldialog.ui"); + ScopedVclPtrInstance<MessageDialog> aQuery(this, "QuerySaveLabelDialog", + "modules/swriter/ui/querysavelabeldialog.ui"); - aQuery.set_primary_text(aQuery.get_primary_text(). + aQuery->set_primary_text(aQuery->get_primary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - aQuery.set_secondary_text(aQuery.get_secondary_text(). + aQuery->set_secondary_text(aQuery->get_secondary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - if (RET_YES != aQuery.Execute()) + if (RET_YES != aQuery->Execute()) return 0; } rLabRec.aType = sType; diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx index a50d525ebcce..d35833a7122b 100644 --- a/sw/source/ui/envelp/labfmt.hxx +++ b/sw/source/ui/envelp/labfmt.hxx @@ -69,29 +69,26 @@ public: class SwLabFmtPage : public SfxTabPage { - FixedText* m_pMakeFI; - FixedText* m_pTypeFI; - SwLabPreview* m_pPreview; - MetricField* m_pHDistField; - MetricField* m_pVDistField; - MetricField* m_pWidthField; - MetricField* m_pHeightField; - MetricField* m_pLeftField; - MetricField* m_pUpperField; - NumericField* m_pColsField; - NumericField* m_pRowsField; - MetricField* m_pPWidthField; - MetricField* m_pPHeightField; - PushButton* m_pSavePB; + VclPtr<FixedText> m_pMakeFI; + VclPtr<FixedText> m_pTypeFI; + VclPtr<SwLabPreview> m_pPreview; + VclPtr<MetricField> m_pHDistField; + VclPtr<MetricField> m_pVDistField; + VclPtr<MetricField> m_pWidthField; + VclPtr<MetricField> m_pHeightField; + VclPtr<MetricField> m_pLeftField; + VclPtr<MetricField> m_pUpperField; + VclPtr<NumericField> m_pColsField; + VclPtr<NumericField> m_pRowsField; + VclPtr<MetricField> m_pPWidthField; + VclPtr<MetricField> m_pPHeightField; + VclPtr<PushButton> m_pSavePB; Idle aPreviewIdle; bool bModified; SwLabItem aItem; - SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); - virtual ~SwLabFmtPage(); - DECL_LINK(ModifyHdl, void *); DECL_LINK(PreviewHdl, void *); DECL_LINK( LoseFocusHdl, Control * ); @@ -103,8 +100,11 @@ class SwLabFmtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwLabFmtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -117,12 +117,12 @@ public: class SwSaveLabelDlg : public ModalDialog { - ComboBox* m_pMakeCB; - Edit* m_pTypeED; - OKButton* m_pOKPB; + VclPtr<ComboBox> m_pMakeCB; + VclPtr<Edit> m_pTypeED; + VclPtr<OKButton> m_pOKPB; bool bSuccess; - SwLabFmtPage* pLabPage; + VclPtr<SwLabFmtPage> pLabPage; SwLabRec& rLabRec; DECL_LINK(OkHdl, void *); @@ -130,6 +130,8 @@ class SwSaveLabelDlg : public ModalDialog public: SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec); + virtual ~SwSaveLabelDlg(); + virtual void dispose() SAL_OVERRIDE; void SetLabel(const OUString& rMake, const OUString& rType) { diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index 5574fce5de49..9443dfcb9622 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -62,7 +62,22 @@ SwLabPrtPage::SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet) SwLabPrtPage::~SwLabPrtPage() { - delete pPrinter; + disposeOnce(); +} + +void SwLabPrtPage::dispose() +{ + pPrinter.disposeAndClear(); + m_pPageButton.clear(); + m_pSingleButton.clear(); + m_pSingleGrid.clear(); + m_pPrinterFrame.clear(); + m_pColField.clear(); + m_pRowField.clear(); + m_pSynchronCB.clear(); + m_pPrinterInfo.clear(); + m_pPrtSetup.clear(); + SfxTabPage::dispose(); } IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) @@ -73,7 +88,7 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) if (!pPrinter) pPrinter = new Printer; - boost::scoped_ptr<PrinterSetupDialog> pDlg(new PrinterSetupDialog(this)); + VclPtrInstance< PrinterSetupDialog > pDlg(this); pDlg->SetPrinter(pPrinter); pDlg->Execute(); pDlg.reset(); @@ -93,9 +108,9 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) return 0; } -SfxTabPage* SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwLabPrtPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwLabPrtPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwLabPrtPage::ActivatePage( const SfxItemSet& rSet ) diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx index c011687f6cd7..45b5decffb5e 100644 --- a/sw/source/ui/envelp/labprt.hxx +++ b/sw/source/ui/envelp/labprt.hxx @@ -31,21 +31,18 @@ class SwLabItem; class SwLabPrtPage : public SfxTabPage { - Printer* pPrinter; // for the shaft setting - unfortunately + VclPtr<Printer> pPrinter; // for the shaft setting - unfortunately - RadioButton* m_pPageButton; - RadioButton* m_pSingleButton; - VclContainer* m_pSingleGrid; - VclContainer* m_pPrinterFrame; - NumericField* m_pColField; - NumericField* m_pRowField; - CheckBox* m_pSynchronCB; + VclPtr<RadioButton> m_pPageButton; + VclPtr<RadioButton> m_pSingleButton; + VclPtr<VclContainer> m_pSingleGrid; + VclPtr<VclContainer> m_pPrinterFrame; + VclPtr<NumericField> m_pColField; + VclPtr<NumericField> m_pRowField; + VclPtr<CheckBox> m_pSynchronCB; - FixedText* m_pPrinterInfo; - PushButton* m_pPrtSetup; - - SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); - virtual ~SwLabPrtPage(); + VclPtr<FixedText> m_pPrinterInfo; + VclPtr<PushButton> m_pPrtSetup; DECL_LINK( CountHdl, Button * ); @@ -55,8 +52,11 @@ class SwLabPrtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwLabPrtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index dac471ea8bc3..25397c3f66ef 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -389,6 +389,11 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, SwMailMergeDlg::~SwMailMergeDlg() { + disposeOnce(); +} + +void SwMailMergeDlg::dispose() +{ if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); @@ -401,6 +406,39 @@ SwMailMergeDlg::~SwMailMergeDlg() delete pData; } delete pImpl; + m_pBeamerWin.clear(); + m_pAllRB.clear(); + m_pMarkedRB.clear(); + m_pFromRB.clear(); + m_pFromNF.clear(); + m_pToNF.clear(); + m_pPrinterRB.clear(); + m_pMailingRB.clear(); + m_pFileRB.clear(); + m_pSingleJobsCB.clear(); + m_pSaveMergedDocumentFT.clear(); + m_pSaveSingleDocRB.clear(); + m_pSaveIndividualRB.clear(); + m_pGenerateFromDataBaseCB.clear(); + m_pColumnFT.clear(); + m_pColumnLB.clear(); + m_pPathFT.clear(); + m_pPathED.clear(); + m_pPathPB.clear(); + m_pFilterFT.clear(); + m_pFilterLB.clear(); + m_pAddressFldLB.clear(); + m_pSubjectFT.clear(); + m_pSubjectED.clear(); + m_pFormatFT.clear(); + m_pAttachFT.clear(); + m_pAttachED.clear(); + m_pAttachPB.clear(); + m_pFormatHtmlCB.clear(); + m_pFormatRtfCB.clear(); + m_pFormatSwCB.clear(); + m_pOkBTN.clear(); + SvxStandardDialog::dispose(); } void SwMailMergeDlg::Apply() @@ -633,6 +671,17 @@ SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(vcl::Window* pParent) get(m_pThisDocRB, "document"); } +SwMailMergeCreateFromDlg::~SwMailMergeCreateFromDlg() +{ + disposeOnce(); +} + +void SwMailMergeCreateFromDlg::dispose() +{ + m_pThisDocRB.clear(); + ModalDialog::dispose(); +} + SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pParent) : ModalDialog(pParent, "MergeConnectDialog", "modules/swriter/ui/mergeconnectdialog.ui") @@ -640,4 +689,15 @@ SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pPar get(m_pUseExistingRB, "existing"); } +SwMailMergeFieldConnectionsDlg::~SwMailMergeFieldConnectionsDlg() +{ + disposeOnce(); +} + +void SwMailMergeFieldConnectionsDlg::dispose() +{ + m_pUseExistingRB.clear(); + ModalDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index 0aa045936d7e..d69af8dd5ee1 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -29,26 +29,24 @@ class SwLabPage : public SfxTabPage OUString sActDBName; SwLabItem aItem; - VclContainer* m_pAddressFrame; - - CheckBox* m_pAddrBox; - VclMultiLineEdit* m_pWritingEdit; - ListBox* m_pDatabaseLB; - ListBox* m_pTableLB; - PushButton* m_pInsertBT; - ListBox* m_pDBFieldLB; - - RadioButton* m_pContButton; - RadioButton* m_pSheetButton; - ListBox* m_pMakeBox; - ListBox* m_pTypeBox; - ListBox* m_pHiddenSortTypeBox; - FixedText* m_pFormatInfo; + VclPtr<VclContainer> m_pAddressFrame; + + VclPtr<CheckBox> m_pAddrBox; + VclPtr<VclMultiLineEdit> m_pWritingEdit; + VclPtr<ListBox> m_pDatabaseLB; + VclPtr<ListBox> m_pTableLB; + VclPtr<PushButton> m_pInsertBT; + VclPtr<ListBox> m_pDBFieldLB; + + VclPtr<RadioButton> m_pContButton; + VclPtr<RadioButton> m_pSheetButton; + VclPtr<ListBox> m_pMakeBox; + VclPtr<ListBox> m_pTypeBox; + VclPtr<ListBox> m_pHiddenSortTypeBox; + VclPtr<FixedText> m_pFormatInfo; bool m_bLabel; - SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet); - DECL_LINK(AddrHdl, void *); DECL_LINK( DatabaseHdl, ListBox *pListBox ); DECL_LINK(FieldHdl, void *); @@ -63,8 +61,12 @@ class SwLabPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet); - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + virtual ~SwLabPage(); + virtual void dispose() SAL_OVERRIDE; + + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -84,9 +86,9 @@ public: class SwOneExampleFrame; class SwVisitingCardPage : public SfxTabPage { - SvTreeListBox* m_pAutoTextLB; - ListBox* m_pAutoTextGroupLB; - vcl::Window* m_pExampleWIN; + VclPtr<SvTreeListBox> m_pAutoTextLB; + VclPtr<ListBox> m_pAutoTextGroupLB; + VclPtr<vcl::Window> m_pExampleWIN; OUString sTempURL; @@ -108,15 +110,16 @@ class SwVisitingCardPage : public SfxTabPage const OUString* pNames, const OUString* pValues ); - SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwVisitingCardPage(); + virtual void dispose() SAL_OVERRIDE; using TabPage::ActivatePage; using TabPage::DeactivatePage; public: + SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet); - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -126,35 +129,36 @@ public: class SwPrivateDataPage : public SfxTabPage { - Edit* m_pFirstNameED; - Edit* m_pNameED; - Edit* m_pShortCutED; - - Edit* m_pFirstName2ED; - Edit* m_pName2ED; - Edit* m_pShortCut2ED; - - Edit* m_pStreetED; - Edit* m_pZipED; - Edit* m_pCityED; - Edit* m_pCountryED; - Edit* m_pStateED; - Edit* m_pTitleED; - Edit* m_pProfessionED; - Edit* m_pPhoneED; - Edit* m_pMobilePhoneED; - Edit* m_pFaxED; - Edit* m_pHomePageED; - Edit* m_pMailED; - - SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + VclPtr<Edit> m_pFirstNameED; + VclPtr<Edit> m_pNameED; + VclPtr<Edit> m_pShortCutED; + + VclPtr<Edit> m_pFirstName2ED; + VclPtr<Edit> m_pName2ED; + VclPtr<Edit> m_pShortCut2ED; + + VclPtr<Edit> m_pStreetED; + VclPtr<Edit> m_pZipED; + VclPtr<Edit> m_pCityED; + VclPtr<Edit> m_pCountryED; + VclPtr<Edit> m_pStateED; + VclPtr<Edit> m_pTitleED; + VclPtr<Edit> m_pProfessionED; + VclPtr<Edit> m_pPhoneED; + VclPtr<Edit> m_pMobilePhoneED; + VclPtr<Edit> m_pFaxED; + VclPtr<Edit> m_pHomePageED; + VclPtr<Edit> m_pMailED; using TabPage::ActivatePage; using TabPage::DeactivatePage; public: + SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwPrivateDataPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -164,33 +168,34 @@ public: class SwBusinessDataPage : public SfxTabPage { - Edit* m_pCompanyED; - Edit* m_pCompanyExtED; - Edit* m_pSloganED; + VclPtr<Edit> m_pCompanyED; + VclPtr<Edit> m_pCompanyExtED; + VclPtr<Edit> m_pSloganED; - Edit* m_pStreetED; - Edit* m_pZipED; - Edit* m_pCityED; - Edit* m_pCountryED; - Edit* m_pStateED; + VclPtr<Edit> m_pStreetED; + VclPtr<Edit> m_pZipED; + VclPtr<Edit> m_pCityED; + VclPtr<Edit> m_pCountryED; + VclPtr<Edit> m_pStateED; - Edit* m_pPositionED; + VclPtr<Edit> m_pPositionED; - Edit* m_pPhoneED; - Edit* m_pMobilePhoneED; - Edit* m_pFaxED; + VclPtr<Edit> m_pPhoneED; + VclPtr<Edit> m_pMobilePhoneED; + VclPtr<Edit> m_pFaxED; - Edit* m_pHomePageED; - Edit* m_pMailED; - - SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + VclPtr<Edit> m_pHomePageED; + VclPtr<Edit> m_pMailED; using TabPage::ActivatePage; using TabPage::DeactivatePage; public: + SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwBusinessDataPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx index fce5029d6e32..12ebb825233a 100644 --- a/sw/source/ui/fldui/DropDownFieldDialog.cxx +++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx @@ -71,6 +71,20 @@ sw::DropDownFieldDialog::DropDownFieldDialog(vcl::Window *pParent, SwWrtShell &r m_pListItemsLB->GrabFocus(); } +sw::DropDownFieldDialog::~DropDownFieldDialog() +{ + disposeOnce(); +} + +void sw::DropDownFieldDialog::dispose() +{ + m_pListItemsLB.clear(); + m_pOKPB.clear(); + m_pNextPB.clear(); + m_pEditPB.clear(); + SvxStandardDialog::dispose(); +} + void sw::DropDownFieldDialog::Apply() { if(pDropField) diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index d5a171d3b0af..b94c049dd59f 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -164,8 +164,20 @@ SvTreeListEntry* SwChangeDBDlg::Insert(const OUString& rDBName) // destroy dialog SwChangeDBDlg::~SwChangeDBDlg() { + disposeOnce(); +} + +void SwChangeDBDlg::dispose() +{ delete pMgr; + m_pUsedDBTLB.clear(); + m_pAvailDBTLB.clear(); + m_pAddDBPB.clear(); + m_pDocDBNameFT.clear(); + m_pDefineBT.clear(); + SvxStandardDialog::dispose(); } + // close void SwChangeDBDlg::Apply() { diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index a2af66a9d61a..edde37524594 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -74,6 +74,24 @@ SwFldDBPage::SwFldDBPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) SwFldDBPage::~SwFldDBPage() { + disposeOnce(); +} + +void SwFldDBPage::dispose() +{ + m_pTypeLB.clear(); + m_pDatabaseTLB.clear(); + m_pAddDBPB.clear(); + m_pCondition.clear(); + m_pConditionED.clear(); + m_pValue.clear(); + m_pValueED.clear(); + m_pDBFormatRB.clear(); + m_pNewFormatRB.clear(); + m_pNumFormatLB.clear(); + m_pFormatLB.clear(); + m_pFormat.clear(); + SwFldPage::dispose(); } // initialise TabPage @@ -246,10 +264,10 @@ bool SwFldDBPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldDBPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldDBPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldDBPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldDBPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldDBPage::GetGroup() diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx index 6163cb9566d3..bb18eb27fe82 100644 --- a/sw/source/ui/fldui/flddb.hxx +++ b/sw/source/ui/fldui/flddb.hxx @@ -32,20 +32,20 @@ class SwFldDBPage : public SwFldPage { - ListBox* m_pTypeLB; - SwDBTreeList* m_pDatabaseTLB; + VclPtr<ListBox> m_pTypeLB; + VclPtr<SwDBTreeList> m_pDatabaseTLB; - PushButton* m_pAddDBPB; + VclPtr<PushButton> m_pAddDBPB; - VclContainer* m_pCondition; - ConditionEdit* m_pConditionED; - VclContainer* m_pValue; - Edit* m_pValueED; - RadioButton* m_pDBFormatRB; - RadioButton* m_pNewFormatRB; - NumFormatListBox* m_pNumFormatLB; - ListBox* m_pFormatLB; - VclContainer* m_pFormat; + VclPtr<VclContainer> m_pCondition; + VclPtr<ConditionEdit> m_pConditionED; + VclPtr<VclContainer> m_pValue; + VclPtr<Edit> m_pValueED; + VclPtr<RadioButton> m_pDBFormatRB; + VclPtr<RadioButton> m_pNewFormatRB; + VclPtr<NumFormatListBox> m_pNumFormatLB; + VclPtr<ListBox> m_pFormatLB; + VclPtr<VclContainer> m_pFormat; OUString m_sOldDBName; OUString m_sOldTableName; @@ -71,8 +71,9 @@ public: SwFldDBPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldDBPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index 1655f570b768..8814ceb3c3f9 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -89,6 +89,18 @@ SwFldDokInfPage::SwFldDokInfPage(vcl::Window* pParent, const SfxItemSet& rCoreSe SwFldDokInfPage::~SwFldDokInfPage() { + disposeOnce(); +} + +void SwFldDokInfPage::dispose() +{ + m_pTypeTLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pFixedCB.clear(); + SwFldPage::dispose(); } void SwFldDokInfPage::Reset(const SfxItemSet* ) @@ -450,10 +462,10 @@ bool SwFldDokInfPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldDokInfPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldDokInfPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldDokInfPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldDokInfPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldDokInfPage::GetGroup() diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx index 596d3bc2d3b7..fc9452075b4a 100644 --- a/sw/source/ui/fldui/flddinf.hxx +++ b/sw/source/ui/fldui/flddinf.hxx @@ -36,12 +36,12 @@ namespace com{namespace sun{ namespace star{ namespace beans{ class SwFldDokInfPage : public SwFldPage { - SvTreeListBox* m_pTypeTLB; - VclContainer* m_pSelection; - ListBox* m_pSelectionLB; - VclContainer* m_pFormat; - NumFormatListBox* m_pFormatLB; - CheckBox* m_pFixedCB; + VclPtr<SvTreeListBox> m_pTypeTLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<ListBox> m_pSelectionLB; + VclPtr<VclContainer> m_pFormat; + VclPtr<NumFormatListBox> m_pFormatLB; + VclPtr<CheckBox> m_pFixedCB; SvTreeListEntry* pSelEntry; com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > xCustomPropertySet; @@ -62,8 +62,9 @@ public: SwFldDokInfPage(vcl::Window* pWindow, const SfxItemSet& rSet); virtual ~SwFldDokInfPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx index ea3ec74a5bb9..f8dc98f74e6a 100644 --- a/sw/source/ui/fldui/flddok.cxx +++ b/sw/source/ui/fldui/flddok.cxx @@ -80,8 +80,29 @@ SwFldDokPage::SwFldDokPage(vcl::Window* pParent, const SfxItemSet& rCoreSet ) SwFldDokPage::~SwFldDokPage() { + disposeOnce(); } +void SwFldDokPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pValueFT.clear(); + m_pValueED.clear(); + m_pLevelFT.clear(); + m_pLevelED.clear(); + m_pDateFT.clear(); + m_pTimeFT.clear(); + m_pDateOffsetED.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pNumFormatLB.clear(); + m_pFixedCB.clear(); + SwFldPage::dispose(); +} + + void SwFldDokPage::Reset(const SfxItemSet* ) { SavePos(m_pTypeLB); @@ -632,10 +653,10 @@ bool SwFldDokPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldDokPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldDokPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldDokPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldDokPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldDokPage::GetGroup() diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx index 4e8abc27e2b0..3beb6a7c0a1b 100644 --- a/sw/source/ui/fldui/flddok.hxx +++ b/sw/source/ui/fldui/flddok.hxx @@ -32,20 +32,20 @@ class SwFldDokPage : public SwFldPage { - ListBox* m_pTypeLB; - VclContainer* m_pSelection; - ListBox* m_pSelectionLB; - FixedText* m_pValueFT; - Edit* m_pValueED; - FixedText* m_pLevelFT; - NumericField* m_pLevelED; - FixedText* m_pDateFT; - FixedText* m_pTimeFT; - NumericField* m_pDateOffsetED; - VclContainer* m_pFormat; - ListBox* m_pFormatLB; - NumFormatListBox* m_pNumFormatLB; - CheckBox* m_pFixedCB; + VclPtr<ListBox> m_pTypeLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<ListBox> m_pSelectionLB; + VclPtr<FixedText> m_pValueFT; + VclPtr<Edit> m_pValueED; + VclPtr<FixedText> m_pLevelFT; + VclPtr<NumericField> m_pLevelED; + VclPtr<FixedText> m_pDateFT; + VclPtr<FixedText> m_pTimeFT; + VclPtr<NumericField> m_pDateOffsetED; + VclPtr<VclContainer> m_pFormat; + VclPtr<ListBox> m_pFormatLB; + VclPtr<NumFormatListBox> m_pNumFormatLB; + VclPtr<CheckBox> m_pFixedCB; sal_Int32 nOldSel; sal_uLong nOldFormat; @@ -64,8 +64,9 @@ public: SwFldDokPage(vcl::Window* pWindow, const SfxItemSet& rSet); virtual ~SwFldDokPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index 32dd26eebaff..1b7906b02368 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -124,7 +124,7 @@ SwFldEditDlg::SwFldEditDlg(SwView& rVw) // initialise controls void SwFldEditDlg::Init() { - SwFldPage* pTabPage = static_cast<SwFldPage*>(GetTabPage()); + VclPtr<SwFldPage> pTabPage = static_cast<SwFldPage*>(GetTabPage()); if( pTabPage ) { @@ -159,10 +159,10 @@ void SwFldEditDlg::Init() !pSh->HasReadonlySel() ); } -SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) +VclPtr<SfxTabPage> SwFldEditDlg::CreatePage(sal_uInt16 nGroup) { // create TabPage - SfxTabPage* pTabPage = 0; + VclPtr<SfxTabPage> pTabPage; switch (nGroup) { @@ -193,7 +193,7 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) } case GRP_DB: pTabPage = SwFldDBPage::Create(get_content_area(), 0); - static_cast<SwFldDBPage*>(pTabPage)->SetWrtShell(*pSh); + static_cast<SwFldDBPage*>(pTabPage.get())->SetWrtShell(*pSh); break; case GRP_VAR: pTabPage = SwFldVarPage::Create(get_content_area(), 0); @@ -205,7 +205,7 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) if (pTabPage) { - static_cast<SwFldPage*>(pTabPage)->SetWrtShell(pSh); + static_cast<SwFldPage*>(pTabPage.get())->SetWrtShell(pSh); SetTabPage(pTabPage); } @@ -214,8 +214,17 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) SwFldEditDlg::~SwFldEditDlg() { + disposeOnce(); +} + +void SwFldEditDlg::dispose() +{ SwViewShell::SetCareWin(NULL); pSh->EnterStdMode(); + m_pPrevBT.clear(); + m_pNextBT.clear(); + m_pAddressBT.clear(); + SfxSingleTabDialog::dispose(); } void SwFldEditDlg::EnableInsert(bool bEnable) @@ -235,12 +244,9 @@ IMPL_LINK_NOARG(SwFldEditDlg, OKHdl) { if (GetOKButton()->IsEnabled()) { - SfxTabPage* pTabPage = GetTabPage(); + VclPtr<SfxTabPage> pTabPage = GetTabPage(); if (pTabPage) - { pTabPage->FillItemSet(0); - - } EndDialog( RET_OK ); } @@ -261,7 +267,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton ) pSh->EnterStdMode(); SwFieldType *pOldTyp = 0; - SwFldPage* pTabPage = static_cast<SwFldPage*>(GetTabPage()); + VclPtr<SwFldPage> pTabPage = static_cast<SwFldPage*>(GetTabPage()); //#112462# FillItemSet may delete the current field //that's why it has to be called before accessing the current field @@ -281,7 +287,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton ) sal_uInt16 nGroup = rMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType()); if (nGroup != pTabPage->GetGroup()) - pTabPage = static_cast<SwFldPage*>(CreatePage(nGroup)); + pTabPage = static_cast<SwFldPage*>(CreatePage(nGroup).get()); pTabPage->EditNewField(); diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index b190d69c67bd..f079e8787d90 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -91,6 +91,37 @@ SwFldFuncPage::SwFldFuncPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) SwFldFuncPage::~SwFldFuncPage() { + disposeOnce(); +} + +void SwFldFuncPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelectionLB.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pNameFT.clear(); + m_pNameED.clear(); + m_pValueGroup.clear(); + m_pValueFT.clear(); + m_pValueED.clear(); + m_pCond1FT.clear(); + m_pCond1ED.clear(); + m_pCond2FT.clear(); + m_pCond2ED.clear(); + m_pMacroBT.clear(); + m_pListGroup.clear(); + m_pListItemFT.clear(); + m_pListItemED.clear(); + m_pListAddPB.clear(); + m_pListItemsFT.clear(); + m_pListItemsLB.clear(); + m_pListRemovePB.clear(); + m_pListUpPB.clear(); + m_pListDownPB.clear(); + m_pListNameFT.clear(); + m_pListNameED.clear(); + SwFldPage::dispose(); } void SwFldFuncPage::Reset(const SfxItemSet* ) @@ -597,10 +628,10 @@ OUString SwFldFuncPage::TurnMacroString(const OUString &rMacro) return rMacro; } -SfxTabPage* SwFldFuncPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldFuncPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldFuncPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldFuncPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldFuncPage::GetGroup() diff --git a/sw/source/ui/fldui/fldfunc.hxx b/sw/source/ui/fldui/fldfunc.hxx index fb8cfa906969..fefc9db21ac4 100644 --- a/sw/source/ui/fldui/fldfunc.hxx +++ b/sw/source/ui/fldui/fldfunc.hxx @@ -32,33 +32,33 @@ class SwFldFuncPage : public SwFldPage { - ListBox* m_pTypeLB; - ListBox* m_pSelectionLB; - VclContainer* m_pFormat; - ListBox* m_pFormatLB; - FixedText* m_pNameFT; - ConditionEdit* m_pNameED; - VclContainer* m_pValueGroup; - FixedText* m_pValueFT; - Edit* m_pValueED; - FixedText* m_pCond1FT; - ConditionEdit* m_pCond1ED; - FixedText* m_pCond2FT; - ConditionEdit* m_pCond2ED; - PushButton* m_pMacroBT; + VclPtr<ListBox> m_pTypeLB; + VclPtr<ListBox> m_pSelectionLB; + VclPtr<VclContainer> m_pFormat; + VclPtr<ListBox> m_pFormatLB; + VclPtr<FixedText> m_pNameFT; + VclPtr<ConditionEdit> m_pNameED; + VclPtr<VclContainer> m_pValueGroup; + VclPtr<FixedText> m_pValueFT; + VclPtr<Edit> m_pValueED; + VclPtr<FixedText> m_pCond1FT; + VclPtr<ConditionEdit> m_pCond1ED; + VclPtr<FixedText> m_pCond2FT; + VclPtr<ConditionEdit> m_pCond2ED; + VclPtr<PushButton> m_pMacroBT; //controls of "Input list" - VclContainer* m_pListGroup; - FixedText* m_pListItemFT; - ReturnActionEdit* m_pListItemED; - PushButton* m_pListAddPB; - FixedText* m_pListItemsFT; - ListBox* m_pListItemsLB; - PushButton* m_pListRemovePB; - PushButton* m_pListUpPB; - PushButton* m_pListDownPB; - FixedText* m_pListNameFT; - Edit* m_pListNameED; + VclPtr<VclContainer> m_pListGroup; + VclPtr<FixedText> m_pListItemFT; + VclPtr<ReturnActionEdit> m_pListItemED; + VclPtr<PushButton> m_pListAddPB; + VclPtr<FixedText> m_pListItemsFT; + VclPtr<ListBox> m_pListItemsLB; + VclPtr<PushButton> m_pListRemovePB; + VclPtr<PushButton> m_pListUpPB; + VclPtr<PushButton> m_pListDownPB; + VclPtr<FixedText> m_pListNameFT; + VclPtr<Edit> m_pListNameED; OUString m_sOldValueFT; OUString m_sOldNameFT; @@ -86,8 +86,9 @@ public: SwFldFuncPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldFuncPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 247dda169e18..f704afcf1bd3 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -107,6 +107,21 @@ SwFldRefPage::SwFldRefPage(vcl::Window* pParent, const SfxItemSet& rCoreSet ) SwFldRefPage::~SwFldRefPage() { + disposeOnce(); +} + +void SwFldRefPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pSelectionToolTipLB.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pNameFT.clear(); + m_pNameED.clear(); + m_pValueED.clear(); + SwFldPage::dispose(); } // #i83479# @@ -935,10 +950,10 @@ bool SwFldRefPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldRefPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldRefPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldRefPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldRefPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldRefPage::GetGroup() diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx index 27e5ab4fb22e..24c540f181f7 100644 --- a/sw/source/ui/fldui/fldref.hxx +++ b/sw/source/ui/fldui/fldref.hxx @@ -34,16 +34,16 @@ class SwTxtNode; class SwFldRefPage : public SwFldPage { - ListBox* m_pTypeLB; - VclContainer* m_pSelection; - ListBox* m_pSelectionLB; + VclPtr<ListBox> m_pTypeLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<ListBox> m_pSelectionLB; // #i83479# - SwFldRefTreeListBox* m_pSelectionToolTipLB; - VclContainer* m_pFormat; - ListBox* m_pFormatLB; - FixedText* m_pNameFT; - Edit* m_pNameED; - Edit* m_pValueED; + VclPtr<SwFldRefTreeListBox> m_pSelectionToolTipLB; + VclPtr<VclContainer> m_pFormat; + VclPtr<ListBox> m_pFormatLB; + VclPtr<FixedText> m_pNameFT; + VclPtr<Edit> m_pNameED; + VclPtr<Edit> m_pValueED; OUString sBookmarkTxt; OUString sFootnoteTxt; OUString sEndnoteTxt; @@ -77,8 +77,9 @@ public: SwFldRefPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldRefPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index a72e4c99662e..27c60f81e1f9 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -87,6 +87,28 @@ SwFldVarPage::SwFldVarPage(vcl::Window* pParent, const SfxItemSet& rCoreSet ) SwFldVarPage::~SwFldVarPage() { + disposeOnce(); +} + +void SwFldVarPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pNameFT.clear(); + m_pNameED.clear(); + m_pValueFT.clear(); + m_pValueED.clear(); + m_pFormat.clear(); + m_pNumFormatLB.clear(); + m_pFormatLB.clear(); + m_pChapterFrame.clear(); + m_pChapterLevelLB.clear(); + m_pInvisibleCB.clear(); + m_pSeparatorFT.clear(); + m_pSeparatorED.clear(); + m_pNewDelTBX.clear(); + SwFldPage::dispose(); } void SwFldVarPage::Reset(const SfxItemSet* ) @@ -1225,10 +1247,10 @@ bool SwFldVarPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldVarPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldVarPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldVarPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldVarPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldVarPage::GetGroup() diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx index 9d1a37f0a5a9..a37aa5809fda 100644 --- a/sw/source/ui/fldui/fldvar.hxx +++ b/sw/source/ui/fldui/fldvar.hxx @@ -51,22 +51,22 @@ class SwFldVarPage : public SwFldPage { friend class SelectionListBox; - ListBox* m_pTypeLB; - VclContainer* m_pSelection; - SelectionListBox* m_pSelectionLB; - FixedText* m_pNameFT; - Edit* m_pNameED; - FixedText* m_pValueFT; - ConditionEdit* m_pValueED; - VclContainer* m_pFormat; - NumFormatListBox* m_pNumFormatLB; - ListBox* m_pFormatLB; - VclContainer* m_pChapterFrame; - ListBox* m_pChapterLevelLB; - CheckBox* m_pInvisibleCB; - FixedText* m_pSeparatorFT; - Edit* m_pSeparatorED; - ToolBox* m_pNewDelTBX; + VclPtr<ListBox> m_pTypeLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<SelectionListBox> m_pSelectionLB; + VclPtr<FixedText> m_pNameFT; + VclPtr<Edit> m_pNameED; + VclPtr<FixedText> m_pValueFT; + VclPtr<ConditionEdit> m_pValueED; + VclPtr<VclContainer> m_pFormat; + VclPtr<NumFormatListBox> m_pNumFormatLB; + VclPtr<ListBox> m_pFormatLB; + VclPtr<VclContainer> m_pChapterFrame; + VclPtr<ListBox> m_pChapterLevelLB; + VclPtr<CheckBox> m_pInvisibleCB; + VclPtr<FixedText> m_pSeparatorFT; + VclPtr<Edit> m_pSeparatorED; + VclPtr<ToolBox> m_pNewDelTBX; sal_uInt16 m_nApplyId; sal_uInt16 m_nDeleteId; @@ -93,8 +93,9 @@ public: SwFldVarPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldVarPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index 3346d84d9615..1da4ca51f107 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -106,6 +106,20 @@ SwFldInputDlg::SwFldInputDlg( vcl::Window *pParent, SwWrtShell &rS, m_pEditED->SetText(convertLineEnd(aStr, GetSystemLineEnd())); } +SwFldInputDlg::~SwFldInputDlg() +{ + disposeOnce(); +} + +void SwFldInputDlg::dispose() +{ + m_pLabelED.clear(); + m_pEditED.clear(); + m_pOKBT.clear(); + m_pNextBT.clear(); + SvxStandardDialog::dispose(); +} + void SwFldInputDlg::StateChanged( StateChangedType nType ) { if ( nType == StateChangedType::INITSHOW ) diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index 8bf330418207..7df369a9526c 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -88,10 +88,26 @@ SwJavaEditDialog::SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh) : SwJavaEditDialog::~SwJavaEditDialog() { + disposeOnce(); +} + +void SwJavaEditDialog::dispose() +{ pSh->EnterStdMode(); delete pMgr; delete pFileDlg; Application::SetDefDialogParent( pOldDefDlgParent ); + m_pTypeED.clear(); + m_pUrlRB.clear(); + m_pEditRB.clear(); + m_pUrlPB.clear(); + m_pUrlED.clear(); + m_pEditED.clear(); + m_pOKBtn.clear(); + m_pPrevBtn.clear(); + m_pNextBtn.clear(); + pOldDefDlgParent.clear(); + SvxStandardDialog::dispose(); } IMPL_LINK_NOARG_INLINE_START(SwJavaEditDialog, PrevHdl) diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 0fef7a5499cb..11dccd075cc9 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -540,15 +540,15 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); // collect character styles - ListBox rCharFmtLB(this); - rCharFmtLB.Clear(); - rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + ScopedVclPtrInstance< ListBox > rCharFmtLB(this); + rCharFmtLB->Clear(); + rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell(); - ::FillCharStyleListBox(rCharFmtLB, pDocShell); + ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++) - aList.push_back( rCharFmtLB.GetEntry(j) ); + for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++) + aList.push_back( rCharFmtLB->GetEntry(j) ); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell)); diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index c34899cb2361..0d645d34da9d 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -161,7 +161,7 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) assert(pColPgSet); // create TabPage - pTabPage = static_cast<SwColumnPage*>( SwColumnPage::Create(get_content_area(), pColPgSet) ); + pTabPage = static_cast<SwColumnPage*>( SwColumnPage::Create(get_content_area(), pColPgSet).get() ); pTabPage->get<vcl::Window>("applytoft")->Show(); pTabPage->get(m_pApplyToLB, "applytolb"); m_pApplyToLB->Show(); @@ -214,10 +214,17 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) SwColumnDlg::~SwColumnDlg() { - delete pTabPage; + disposeOnce(); +} + +void SwColumnDlg::dispose() +{ + pTabPage.disposeAndClear(); delete pPageSet; delete pSectionSet; delete pSelectionSet; + m_pApplyToLB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK(SwColumnDlg, ObjectHdl, ListBox*, pBox) @@ -542,7 +549,36 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) SwColumnPage::~SwColumnPage() { + disposeOnce(); +} + +void SwColumnPage::dispose() +{ delete pColMgr; + m_pCLNrEdt.clear(); + m_pDefaultVS.clear(); + m_pBalanceColsCB.clear(); + m_pBtnBack.clear(); + m_pLbl1.clear(); + m_pLbl2.clear(); + m_pLbl3.clear(); + m_pBtnNext.clear(); + m_pAutoWidthBox.clear(); + m_pLineTypeLbl.clear(); + m_pLineTypeDLB.clear(); + m_pLineWidthLbl.clear(); + m_pLineWidthEdit.clear(); + m_pLineColorLbl.clear(); + m_pLineColorDLB.clear(); + m_pLineHeightLbl.clear(); + m_pLineHeightEdit.clear(); + m_pLinePosLbl.clear(); + m_pLinePosDLB.clear(); + m_pTextDirectionFT.clear(); + m_pTextDirectionLB.clear(); + m_pPgeExampleWN.clear(); + m_pFrmExampleWN.clear(); + SfxTabPage::dispose(); } void SwColumnPage::SetPageWidth(long nPageWidth) @@ -621,10 +657,11 @@ void SwColumnPage::Reset(const SfxItemSet *rSet) } // create TabPage -SfxTabPage* SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwColumnPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwColumnPage(pParent, *rSet), SAL_NO_ACQUIRE); } + // stuff attributes into the Set when OK bool SwColumnPage::FillItemSet(SfxItemSet *rSet) { diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 81dfcf9c75d1..719af75fdca5 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -51,14 +51,14 @@ using namespace ::com::sun::star; class SwSequenceOptionDialog : public SvxStandardDialog { - ListBox* m_pLbLevel; - Edit* m_pEdDelim; + VclPtr<ListBox> m_pLbLevel; + VclPtr<Edit> m_pEdDelim; - ListBox* m_pLbCharStyle; - CheckBox* m_pApplyBorderAndShadowCB; + VclPtr<ListBox> m_pLbCharStyle; + VclPtr<CheckBox> m_pApplyBorderAndShadowCB; //#i61007# order of captions - ListBox* m_pLbCaptionOrder; + VclPtr<ListBox> m_pLbCaptionOrder; SwView& rView; OUString aFldTypeName; @@ -67,6 +67,7 @@ public: SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV, const OUString& rSeqFldType ); virtual ~SwSequenceOptionDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void Apply() SAL_OVERRIDE; bool IsApplyBorderAndShadow() { return m_pApplyBorderAndShadowCB->IsChecked(); } @@ -283,18 +284,18 @@ IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton ) { OUString sFldTypeName = m_pCategoryBox->GetText(); if(sFldTypeName == m_sNone) - sFldTypeName = OUString(); - SwSequenceOptionDialog aDlg( pButton, rView, sFldTypeName ); - aDlg.SetApplyBorderAndShadow(bCopyAttributes); - aDlg.SetCharacterStyle( sCharacterStyle ); - aDlg.SetOrderNumberingFirst( bOrderNumberingFirst ); - aDlg.Execute(); - bCopyAttributes = aDlg.IsApplyBorderAndShadow(); - sCharacterStyle = aDlg.GetCharacterStyle(); + sFldTypeName.clear(); + ScopedVclPtrInstance< SwSequenceOptionDialog > aDlg( pButton, rView, sFldTypeName ); + aDlg->SetApplyBorderAndShadow(bCopyAttributes); + aDlg->SetCharacterStyle( sCharacterStyle ); + aDlg->SetOrderNumberingFirst( bOrderNumberingFirst ); + aDlg->Execute(); + bCopyAttributes = aDlg->IsApplyBorderAndShadow(); + sCharacterStyle = aDlg->GetCharacterStyle(); //#i61007# order of captions - if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() ) + if( bOrderNumberingFirst != aDlg->IsOrderNumberingFirst() ) { - bOrderNumberingFirst = aDlg.IsOrderNumberingFirst(); + bOrderNumberingFirst = aDlg->IsOrderNumberingFirst(); SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst); ApplyCaptionOrder(); } @@ -338,8 +339,8 @@ IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl) IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl) { SfxItemSet aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() ); - SwCaptionOptDlg aDlg( this, aSet ); - aDlg.Execute(); + ScopedVclPtrInstance< SwCaptionOptDlg > aDlg( this, aSet ); + aDlg->Execute(); return 0; } @@ -411,7 +412,27 @@ void SwCaptionDialog::DrawSample() SwCaptionDialog::~SwCaptionDialog() { + disposeOnce(); +} + +void SwCaptionDialog::dispose() +{ delete pMgr; + m_pTextEdit.clear(); + m_pCategoryBox.clear(); + m_pFormatText.clear(); + m_pFormatBox.clear(); + m_pNumberingSeparatorFT.clear(); + m_pNumberingSeparatorED.clear(); + m_pSepText.clear(); + m_pSepEdit.clear(); + m_pPosText.clear(); + m_pPosBox.clear(); + m_pOKButton.clear(); + m_pAutoCaptionButton.clear(); + m_pOptionButton.clear(); + m_pPreview.clear(); + SvxStandardDialog::dispose(); } SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV, @@ -455,8 +476,20 @@ SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV SwSequenceOptionDialog::~SwSequenceOptionDialog() { + disposeOnce(); } +void SwSequenceOptionDialog::dispose() +{ + m_pLbLevel.clear(); + m_pEdDelim.clear(); + m_pLbCharStyle.clear(); + m_pApplyBorderAndShadowCB.clear(); + m_pLbCaptionOrder.clear(); + SvxStandardDialog::dispose(); +} + + void SwSequenceOptionDialog::Apply() { SwWrtShell &rSh = rView.GetWrtShell(); diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 14f03807a490..aa7f9d67f1b7 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -712,6 +712,49 @@ SwFrmPage::SwFrmPage(vcl::Window *pParent, const SfxItemSet &rSet) m_pAutoHeightCB->SetClickHdl( LINK( this, SwFrmPage, AutoHeightClickHdl ) ); } +SwFrmPage::~SwFrmPage() +{ + disposeOnce(); +} + +void SwFrmPage::dispose() +{ + m_pWidthFT.clear(); + m_pWidthAutoFT.clear(); + m_pRelWidthCB.clear(); + m_pRelWidthRelationLB.clear(); + m_pAutoWidthCB.clear(); + m_pHeightFT.clear(); + m_pHeightAutoFT.clear(); + m_pRelHeightCB.clear(); + m_pRelHeightRelationLB.clear(); + m_pAutoHeightCB.clear(); + m_pFixedRatioCB.clear(); + m_pRealSizeBT.clear(); + m_pAnchorFrame.clear(); + m_pAnchorAtPageRB.clear(); + m_pAnchorAtParaRB.clear(); + m_pAnchorAtCharRB.clear(); + m_pAnchorAsCharRB.clear(); + m_pAnchorAtFrameRB.clear(); + m_pHorizontalFT.clear(); + m_pHorizontalDLB.clear(); + m_pAtHorzPosFT.clear(); + m_pAtHorzPosED.clear(); + m_pHoriRelationFT.clear(); + m_pHoriRelationLB.clear(); + m_pMirrorPagesCB.clear(); + m_pVerticalFT.clear(); + m_pVerticalDLB.clear(); + m_pAtVertPosFT.clear(); + m_pAtVertPosED.clear(); + m_pVertRelationFT.clear(); + m_pVertRelationLB.clear(); + m_pFollowTextFlowCB.clear(); + m_pExampleWN.clear(); + SfxTabPage::dispose(); +} + namespace { struct FrmMaps @@ -815,13 +858,9 @@ void SwFrmPage::setOptimalRelWidth() m_pHoriRelationLB->Clear(); } -SwFrmPage::~SwFrmPage() +VclPtr<SfxTabPage> SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { -} - -SfxTabPage* SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) -{ - return new SwFrmPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwFrmPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwFrmPage::EnableGraficMode() @@ -2364,12 +2403,27 @@ SwGrfExtPage::SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet) SwGrfExtPage::~SwGrfExtPage() { + disposeOnce(); +} + +void SwGrfExtPage::dispose() +{ delete pGrfDlg; + m_pMirror.clear(); + m_pMirrorVertBox.clear(); + m_pMirrorHorzBox.clear(); + m_pAllPagesRB.clear(); + m_pLeftPagesRB.clear(); + m_pRightPagesRB.clear(); + m_pBmpWin.clear(); + m_pConnectED.clear(); + m_pBrowseBT.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) +VclPtr<SfxTabPage> SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) { - return new SwGrfExtPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwGrfExtPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwGrfExtPage::Reset(const SfxItemSet *rSet) @@ -2702,6 +2756,18 @@ SwFrmURLPage::SwFrmURLPage( vcl::Window *pParent, const SfxItemSet &rSet ) : SwFrmURLPage::~SwFrmURLPage() { + disposeOnce(); +} + +void SwFrmURLPage::dispose() +{ + pURLED.clear(); + pSearchPB.clear(); + pNameED.clear(); + pFrameCB.clear(); + pServerCB.clear(); + pClientCB.clear(); + SfxTabPage::dispose(); } void SwFrmURLPage::Reset( const SfxItemSet *rSet ) @@ -2781,9 +2847,9 @@ bool SwFrmURLPage::FillItemSet(SfxItemSet *rSet) return bModified; } -SfxTabPage* SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwFrmURLPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwFrmURLPage( pParent, *rSet ), SAL_NO_ACQUIRE); } IMPL_LINK_NOARG(SwFrmURLPage, InsertFileHdl) @@ -2844,11 +2910,38 @@ SwFrmAddPage::SwFrmAddPage(vcl::Window *pParent, const SfxItemSet &rSet) SwFrmAddPage::~SwFrmAddPage() { + disposeOnce(); } -SfxTabPage* SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwFrmAddPage::dispose() +{ + pNameFrame.clear(); + pNameFT.clear(); + pNameED.clear(); + pAltNameFT.clear(); + pAltNameED.clear(); + pPrevFT.clear(); + pPrevLB.clear(); + pNextFT.clear(); + pNextLB.clear(); + pProtectFrame.clear(); + pProtectContentCB.clear(); + pProtectFrameCB.clear(); + pProtectSizeCB.clear(); + m_pContentAlignFrame.clear(); + m_pVertAlignLB.clear(); + pPropertiesFrame.clear(); + pEditInReadonlyCB.clear(); + pPrintFrameCB.clear(); + pTextFlowFT.clear(); + pTextFlowLB.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwFrmAddPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwFrmAddPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwFrmAddPage::Reset(const SfxItemSet *rSet ) diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index 6987ce803555..49cba0337bcf 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -57,7 +57,7 @@ SwWrapDlg::SwWrapDlg(vcl::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, bo { // create TabPage - SwWrapTabPage* pNewPage = static_cast<SwWrapTabPage*>( SwWrapTabPage::Create(get_content_area(), &rSet) ); + VclPtr<SwWrapTabPage> pNewPage = static_cast<SwWrapTabPage*>( SwWrapTabPage::Create(get_content_area(), &rSet).get() ); pNewPage->SetFormatUsed(false, bDrawMode); pNewPage->SetShell(pWrtShell); SetTabPage(pNewPage); @@ -133,11 +133,31 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet) SwWrapTabPage::~SwWrapTabPage() { + disposeOnce(); } -SfxTabPage* SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwWrapTabPage::dispose() { - return new SwWrapTabPage(pParent, *rSet); + m_pNoWrapRB.clear(); + m_pWrapLeftRB.clear(); + m_pWrapRightRB.clear(); + m_pWrapParallelRB.clear(); + m_pWrapThroughRB.clear(); + m_pIdealWrapRB.clear(); + m_pLeftMarginED.clear(); + m_pRightMarginED.clear(); + m_pTopMarginED.clear(); + m_pBottomMarginED.clear(); + m_pWrapAnchorOnlyCB.clear(); + m_pWrapTransparentCB.clear(); + m_pWrapOutlineCB.clear(); + m_pWrapOutsideCB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +{ + return VclPtr<SfxTabPage>(new SwWrapTabPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwWrapTabPage::Reset(const SfxItemSet *rSet) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 9b1a47f9a2ed..df015f1749d5 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -140,8 +140,8 @@ typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base; class SwEntryBrowseBox : public SwEntryBrowseBox_Base { - Edit aCellEdit; - ::svt::CheckBoxControl aCellCheckBox; + VclPtr<Edit> aCellEdit; + VclPtr<::svt::CheckBoxControl> aCellCheckBox; OUString sSearch; OUString sAlternative; @@ -174,6 +174,8 @@ protected: public: SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pBuilder); + virtual ~SwEntryBrowseBox(); + virtual void dispose() SAL_OVERRIDE; void ReadEntries(SvStream& rInStr); void WriteEntries(SvStream& rOutStr); @@ -186,9 +188,9 @@ public: class SwAutoMarkDlg_Impl : public ModalDialog { - OKButton* m_pOKPB; + VclPtr<OKButton> m_pOKPB; - SwEntryBrowseBox* m_pEntriesBB; + VclPtr<SwEntryBrowseBox> m_pEntriesBB; OUString sAutoMarkURL; @@ -199,6 +201,7 @@ public: SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAutoMarkURL, bool bCreate); virtual ~SwAutoMarkDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; }; @@ -319,6 +322,11 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(vcl::Window* pParent, const SfxItemSet& SwMultiTOXTabDialog::~SwMultiTOXTabDialog() { + disposeOnce(); +} + +void SwMultiTOXTabDialog::dispose() +{ SW_MOD()->GetModuleConfig()->SetShowIndexPreview(m_pShowExampleCB->IsChecked()); // fdo#38515 Avoid setting focus on deleted controls in the destructors @@ -336,6 +344,9 @@ SwMultiTOXTabDialog::~SwMultiTOXTabDialog() delete[] pDescArr; delete pMgr; delete pExampleFrame; + m_pExampleContainerWIN.clear(); + m_pShowExampleCB.clear(); + SfxTabDialog::dispose(); } void SwMultiTOXTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) @@ -479,8 +490,8 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl ) OUString sInfo(SW_RESSTR(STR_FILE_NOT_FOUND)); sInfo = sInfo.replaceFirst( "%1", sTemplate ); sInfo = sInfo.replaceFirst( "%2", aOpt.GetTemplatePath() ); - InfoBox aInfo(GetParent(), sInfo); - aInfo.Execute(); + ScopedVclPtrInstance< InfoBox > aInfo(GetParent(), sInfo); + aInfo->Execute(); } else { @@ -500,7 +511,7 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl ) && pExampleFrame && pExampleFrame->IsServiceAvailable(); m_pExampleContainerWIN->Show( bSetViewWindow ); - SetViewWindow( bSetViewWindow ? m_pExampleContainerWIN : 0 ); + SetViewWindow( bSetViewWindow ? m_pExampleContainerWIN.get() : 0 ); setOptimalLayoutSize(); @@ -617,11 +628,11 @@ void SwIndexTreeLB::setColSizes() class SwAddStylesDlg_Impl : public SfxModalDialog { - OKButton* m_pOk; + VclPtr<OKButton> m_pOk; - SwIndexTreeLB* m_pHeaderTree; - PushButton* m_pLeftPB; - PushButton* m_pRightPB; + VclPtr<SwIndexTreeLB> m_pHeaderTree; + VclPtr<PushButton> m_pLeftPB; + VclPtr<PushButton> m_pRightPB; OUString* pStyleArr; @@ -632,6 +643,7 @@ class SwAddStylesDlg_Impl : public SfxModalDialog public: SwAddStylesDlg_Impl(vcl::Window* pParent, SwWrtShell& rWrtSh, OUString rStringArr[]); virtual ~SwAddStylesDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; }; SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, @@ -648,7 +660,7 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, Size aSize = pHeaderTreeContainer->LogicToPixel(Size(273, 164), MAP_APPFONT); pHeaderTreeContainer->set_width_request(aSize.Width()); pHeaderTreeContainer->set_height_request(aSize.Height()); - m_pHeaderTree = new SwIndexTreeLB(*pHeaderTreeContainer); + m_pHeaderTree = VclPtr<SwIndexTreeLB>::Create(*pHeaderTreeContainer); m_pOk->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl)); m_pLeftPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl)); @@ -706,7 +718,16 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl() { - delete m_pHeaderTree; + disposeOnce(); +} + +void SwAddStylesDlg_Impl::dispose() +{ + m_pHeaderTree.disposeAndClear(); + m_pOk.clear(); + m_pLeftPB.clear(); + m_pRightPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl) @@ -881,8 +902,55 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& r SwTOXSelectTabPage::~SwTOXSelectTabPage() { + disposeOnce(); +} + +void SwTOXSelectTabPage::dispose() +{ delete pIndexRes; delete pIndexEntryWrapper; + m_pTitleED.clear(); + m_pTypeFT.clear(); + m_pTypeLB.clear(); + m_pReadOnlyCB.clear(); + m_pAreaFrame.clear(); + m_pAreaLB.clear(); + m_pLevelFT.clear(); + m_pLevelNF.clear(); + m_pCreateFrame.clear(); + m_pFromHeadingsCB.clear(); + m_pAddStylesCB.clear(); + m_pAddStylesPB.clear(); + m_pFromTablesCB.clear(); + m_pFromFramesCB.clear(); + m_pFromGraphicsCB.clear(); + m_pFromOLECB.clear(); + m_pLevelFromChapterCB.clear(); + m_pFromCaptionsRB.clear(); + m_pFromObjectNamesRB.clear(); + m_pCaptionSequenceFT.clear(); + m_pCaptionSequenceLB.clear(); + m_pDisplayTypeFT.clear(); + m_pDisplayTypeLB.clear(); + m_pTOXMarksCB.clear(); + m_pIdxOptionsFrame.clear(); + m_pCollectSameCB.clear(); + m_pUseFFCB.clear(); + m_pUseDashCB.clear(); + m_pCaseSensitiveCB.clear(); + m_pInitialCapsCB.clear(); + m_pKeyAsEntryCB.clear(); + m_pFromFileCB.clear(); + m_pAutoMarkPB.clear(); + m_pFromObjCLB.clear(); + m_pFromObjFrame.clear(); + m_pSequenceCB.clear(); + m_pBracketLB.clear(); + m_pAuthorityFrame.clear(); + m_pSortFrame.clear(); + m_pLanguageLB.clear(); + m_pSortAlgorithmLB.clear(); + SfxTabPage::dispose(); } void SwTOXSelectTabPage::SetWrtShell(SwWrtShell& rSh) @@ -1245,9 +1313,9 @@ SfxTabPage::sfxpg SwTOXSelectTabPage::DeactivatePage( SfxItemSet* _pSet ) return LEAVE_PAGE; } -SfxTabPage* SwTOXSelectTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTOXSelectTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwTOXSelectTabPage(pParent, *rAttrSet); + return VclPtr<SwTOXSelectTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, ListBox*, pBox) @@ -1410,11 +1478,11 @@ IMPL_LINK(SwTOXSelectTabPage, LanguageHdl, ListBox*, pBox) IMPL_LINK(SwTOXSelectTabPage, AddStylesHdl, PushButton*, pButton) { - boost::scoped_ptr<SwAddStylesDlg_Impl> pDlg(new SwAddStylesDlg_Impl(pButton, - static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(), - aStyleArr)); + ScopedVclPtrInstance<SwAddStylesDlg_Impl> pDlg( + pButton, static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(), + aStyleArr); pDlg->Execute(); - pDlg.reset(); + pDlg.disposeAndClear(); ModifyHdl(0); return 0; } @@ -1446,8 +1514,8 @@ IMPL_LINK(SwTOXSelectTabPage, MenuExecuteHdl, Menu*, pMenu) return 0; } - boost::scoped_ptr<SwAutoMarkDlg_Impl> pAutoMarkDlg(new SwAutoMarkDlg_Impl( - m_pAutoMarkPB, sAutoMarkURL, bNew )); + VclPtrInstance<SwAutoMarkDlg_Impl> pAutoMarkDlg( + m_pAutoMarkPB, sAutoMarkURL, bNew ); if( RET_OK != pAutoMarkDlg->Execute() && bNew ) sAutoMarkURL = sSaveAutoMarkURL; @@ -1460,7 +1528,7 @@ class SwTOXEdit : public Edit SwFormToken aFormToken; Link aPrevNextControlLink; bool bNextControl; - SwTokenWindow* m_pParent; + VclPtr<SwTokenWindow> m_pParent; public: SwTOXEdit( vcl::Window* pParent, SwTokenWindow* pTokenWin, const SwFormToken& aToken) @@ -1470,6 +1538,8 @@ public: m_pParent( pTokenWin ) { } + virtual ~SwTOXEdit() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); Edit::dispose(); } virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; @@ -1545,7 +1615,7 @@ class SwTOXButton : public PushButton SwFormToken aFormToken; Link aPrevNextControlLink; bool bNextControl; - SwTokenWindow* m_pParent; + VclPtr<SwTokenWindow> m_pParent; public: SwTOXButton( vcl::Window* pParent, SwTokenWindow* pTokenWin, const SwFormToken& rToken) @@ -1555,6 +1625,8 @@ public: m_pParent(pTokenWin) { } + virtual ~SwTOXButton() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); PushButton::dispose(); } virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; @@ -1675,6 +1747,17 @@ SwIdxTreeListBox::SwIdxTreeListBox(vcl::Window* pPar, WinBits nStyle) { } +SwIdxTreeListBox::~SwIdxTreeListBox() +{ + disposeOnce(); +} + +void SwIdxTreeListBox::dispose() +{ + pParent.clear(); + SvTreeListBox::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwIdxTreeListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap) { WinBits nWinStyle = WB_TABSTOP; @@ -1873,6 +1956,63 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(vcl::Window* pParent, const SfxItemSet& rAt m_pSecondKeyLB->SelectEntryPos(0); m_pThirdKeyLB->SelectEntryPos(0); } + +SwTOXEntryTabPage::~SwTOXEntryTabPage() +{ + disposeOnce(); +} + +void SwTOXEntryTabPage::dispose() +{ + m_pLevelFT.clear(); + m_pLevelLB.clear(); + m_pTokenWIN.clear(); + m_pAllLevelsPB.clear(); + m_pEntryNoPB.clear(); + m_pEntryPB.clear(); + m_pTabPB.clear(); + m_pChapterInfoPB.clear(); + m_pPageNoPB.clear(); + m_pHyperLinkPB.clear(); + m_pAuthFieldsLB.clear(); + m_pAuthInsertPB.clear(); + m_pAuthRemovePB.clear(); + m_pCharStyleLB.clear(); + m_pEditStylePB.clear(); + m_pChapterEntryFT.clear(); + m_pChapterEntryLB.clear(); + m_pNumberFormatFT.clear(); + m_pNumberFormatLB.clear(); + m_pEntryOutlineLevelFT.clear(); + m_pEntryOutlineLevelNF.clear(); + m_pFillCharFT.clear(); + m_pFillCharCB.clear(); + m_pTabPosFT.clear(); + m_pTabPosMF.clear(); + m_pAutoRightCB.clear(); + m_pFormatFrame.clear(); + m_pMainEntryStyleFT.clear(); + m_pMainEntryStyleLB.clear(); + m_pAlphaDelimCB.clear(); + m_pCommaSeparatedCB.clear(); + m_pRelToStyleCB.clear(); + m_pSortingFrame.clear(); + m_pSortDocPosRB.clear(); + m_pSortContentRB.clear(); + m_pSortKeyFrame.clear(); + m_pFirstKeyLB.clear(); + m_pFirstSortUpRB.clear(); + m_pFirstSortDownRB.clear(); + m_pSecondKeyLB.clear(); + m_pSecondSortUpRB.clear(); + m_pSecondSortDownRB.clear(); + m_pThirdKeyLB.clear(); + m_pThirdSortUpRB.clear(); + m_pThirdSortDownRB.clear(); + SfxTabPage::dispose(); +} + + // pVoid is used as signal to change all levels of the example IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid) { @@ -1890,10 +2030,6 @@ IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid) return 0; } -SwTOXEntryTabPage::~SwTOXEntryTabPage() -{ -} - bool SwTOXEntryTabPage::FillItemSet( SfxItemSet* ) { // nothing to do @@ -2074,9 +2210,9 @@ SfxTabPage::sfxpg SwTOXEntryTabPage::DeactivatePage( SfxItemSet* /*pSet*/) return LEAVE_PAGE; } -SfxTabPage* SwTOXEntryTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTOXEntryTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwTOXEntryTabPage(pParent, *rAttrSet); + return VclPtr<SwTOXEntryTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK(SwTOXEntryTabPage, EditStyleHdl, PushButton*, pBtn) @@ -2624,13 +2760,26 @@ void SwTokenWindow::setAllocation(const Size &rAllocation) SwTokenWindow::~SwTokenWindow() { + disposeOnce(); +} + +void SwTokenWindow::dispose() +{ for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it) { - Control* pControl = (*it); + VclPtr<Control> pControl = (*it); pControl->SetGetFocusHdl( Link() ); pControl->SetLoseFocusHdl( Link() ); - delete pControl; + pControl.disposeAndClear(); } + aControlList.clear(); + disposeBuilder(); + m_pLeftScrollWin.clear(); + m_pCtrlParentWin.clear(); + m_pRightScrollWin.clear(); + pActiveCtrl.clear(); + m_pParent.clear(); + VclHBox::dispose(); } void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL) @@ -2640,10 +2789,11 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL) if(pForm) { - //apply current level settings to the form for (ctrl_iterator iter = aControlList.begin(); iter != aControlList.end(); ++iter) - delete (*iter); - + iter->disposeAndClear(); + //apply current level settings to the form + for (auto it = aControlList.begin(); it != aControlList.end(); ++it) + it->disposeAndClear(); aControlList.clear(); } @@ -2725,9 +2875,9 @@ void SwTokenWindow::SetActiveControl(Control* pSet) //it must be a SwTOXEdit const SwFormToken* pFToken; if( WINDOW_EDIT == pActiveCtrl->GetType() ) - pFToken = &static_cast<SwTOXEdit*>(pActiveCtrl)->GetFormToken(); + pFToken = &static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetFormToken(); else - pFToken = &static_cast<SwTOXButton*>(pActiveCtrl)->GetFormToken(); + pFToken = &static_cast<SwTOXButton*>(pActiveCtrl.get())->GetFormToken(); SwFormToken aTemp( *pFToken ); aButtonSelectedHdl.Call( &aTemp ); @@ -2752,7 +2902,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& if(TOKEN_TEXT == rToken.eTokenType) { - SwTOXEdit* pEdit = new SwTOXEdit(m_pCtrlParentWin, this, rToken); + VclPtr<SwTOXEdit> pEdit = VclPtr<SwTOXEdit>::Create(m_pCtrlParentWin, this, rToken); pEdit->SetPosPixel(aControlPos); aControlList.push_back(pEdit); @@ -2781,7 +2931,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& } else { - SwTOXButton* pButton = new SwTOXButton(m_pCtrlParentWin, this, rToken); + VclPtr<SwTOXButton> pButton = VclPtr<SwTOXButton>::Create(m_pCtrlParentWin, this, rToken); pButton->SetPosPixel(aControlPos); aControlList.push_back(pButton); @@ -2948,18 +3098,18 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken& { ++iterActive; - Selection aSel = static_cast<SwTOXEdit*>(pActiveCtrl)->GetSelection(); + Selection aSel = static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetSelection(); aSel.Justify(); - const OUString sEditText = static_cast<SwTOXEdit*>(pActiveCtrl)->GetText(); + const OUString sEditText = static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetText(); const OUString sLeft = sEditText.copy( 0, aSel.A() ); const OUString sRight = sEditText.copy( aSel.B() ); - static_cast<SwTOXEdit*>(pActiveCtrl)->SetText(sLeft); - static_cast<SwTOXEdit*>(pActiveCtrl)->AdjustSize(); + static_cast<SwTOXEdit*>(pActiveCtrl.get())->SetText(sLeft); + static_cast<SwTOXEdit*>(pActiveCtrl.get())->AdjustSize(); SwFormToken aTmpToken(TOKEN_TEXT); - SwTOXEdit* pEdit = new SwTOXEdit(m_pCtrlParentWin, this, aTmpToken); + VclPtr<SwTOXEdit> pEdit = VclPtr<SwTOXEdit>::Create(m_pCtrlParentWin, this, aTmpToken); iterActive = aControlList.insert(iterActive, pEdit); @@ -2987,11 +3137,11 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken& { iterActive = aControlList.erase(iterActive); pActiveCtrl->Hide(); - delete pActiveCtrl; + pActiveCtrl.disposeAndClear(); } //now the new button - SwTOXButton* pButton = new SwTOXButton(m_pCtrlParentWin, this, aToInsertToken); + VclPtr<SwTOXButton> pButton = VclPtr<SwTOXButton>::Create(m_pCtrlParentWin, this, aToInsertToken); aControlList.insert(iterActive, pButton); @@ -3040,19 +3190,19 @@ void SwTokenWindow::RemoveControl(SwTOXButton* pDel, bool bInternalCall ) ctrl_iterator itLeft = it, itRight = it; --itLeft; ++itRight; - Control *pLeftEdit = *itLeft; - Control *pRightEdit = *itRight; + VclPtr<Control> pLeftEdit = *itLeft; + VclPtr<Control> pRightEdit = *itRight; - static_cast<SwTOXEdit*>(pLeftEdit)->SetText(static_cast<SwTOXEdit*>(pLeftEdit)->GetText() + - static_cast<SwTOXEdit*>(pRightEdit)->GetText()); - static_cast<SwTOXEdit*>(pLeftEdit)->AdjustSize(); + static_cast<SwTOXEdit*>(pLeftEdit.get())->SetText(static_cast<SwTOXEdit*>(pLeftEdit.get())->GetText() + + static_cast<SwTOXEdit*>(pRightEdit.get())->GetText()); + static_cast<SwTOXEdit*>(pLeftEdit.get())->AdjustSize(); aControlList.erase(itRight); - delete pRightEdit; + pRightEdit.disposeAndClear(); aControlList.erase(it); pActiveCtrl->Hide(); - delete pActiveCtrl; + pActiveCtrl.disposeAndClear(); SetActiveControl(pLeftEdit); AdjustPositions(); @@ -3505,7 +3655,18 @@ SwTOXStylesTabPage::SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& r SwTOXStylesTabPage::~SwTOXStylesTabPage() { + disposeOnce(); +} + +void SwTOXStylesTabPage::dispose() +{ delete m_pCurrentForm; + m_pLevelLB.clear(); + m_pAssignBT.clear(); + m_pParaLayLB.clear(); + m_pStdBT.clear(); + m_pEditStyleBT.clear(); + SfxTabPage::dispose(); } bool SwTOXStylesTabPage::FillItemSet( SfxItemSet* ) @@ -3590,10 +3751,10 @@ SfxTabPage::sfxpg SwTOXStylesTabPage::DeactivatePage( SfxItemSet* /*pSet*/ ) return LEAVE_PAGE; } -SfxTabPage* SwTOXStylesTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTOXStylesTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwTOXStylesTabPage(pParent, *rAttrSet); + return VclPtr<SwTOXStylesTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK( SwTOXStylesTabPage, EditStyleHdl, Button *, pBtn ) @@ -3705,8 +3866,8 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB BrowserMode::VLINES | BrowserMode::AUTO_VSCROLL| BrowserMode::HIDECURSOR ) - , aCellEdit(&GetDataWindow(), 0) - , aCellCheckBox(&GetDataWindow()) + , aCellEdit(VclPtr<Edit>::Create(&GetDataWindow(), 0)) + , aCellCheckBox(new ::svt::CheckBoxControl(&GetDataWindow())) , nCurrentRow(0) , bModified(false) { @@ -3720,9 +3881,9 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB sYes = pBuilder->get<vcl::Window>("yes")->GetText(); sNo = pBuilder->get<vcl::Window>("no")->GetText(); - aCellCheckBox.GetBox().EnableTriState(false); - xController = new ::svt::EditCellController(&aCellEdit); - xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox); + aCellCheckBox->GetBox().EnableTriState(false); + xController = new ::svt::EditCellController(aCellEdit.get()); + xCheckController = new ::svt::CheckBoxCellController(aCellCheckBox.get()); // HACK: BrowseBox doesn't invalidate its children, how it should be. // That's why WB_CLIPCHILDREN is reset in order to enforce the @@ -3753,6 +3914,18 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB HeaderBarItemBits::STDSTYLE, HEADERBAR_APPEND ); } +SwEntryBrowseBox::~SwEntryBrowseBox() +{ + disposeOnce(); +} + +void SwEntryBrowseBox::dispose() +{ + aCellEdit.disposeAndClear(); + aCellCheckBox.disposeAndClear(); + SwEntryBrowseBox_Base::dispose(); +} + void SwEntryBrowseBox::Resize() { SwEntryBrowseBox_Base::Resize(); @@ -4018,7 +4191,7 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAu , bCreateMode(bCreate) { get(m_pOKPB, "ok"); - m_pEntriesBB = new SwEntryBrowseBox(get<VclContainer>("area"), this); + m_pEntriesBB = VclPtr<SwEntryBrowseBox>::Create(get<VclContainer>("area"), this); m_pEntriesBB->set_expand(true); m_pEntriesBB->Show(); m_pOKPB->SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl)); @@ -4042,7 +4215,14 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAu SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl() { - delete m_pEntriesBB; + disposeOnce(); +} + +void SwAutoMarkDlg_Impl::dispose() +{ + m_pEntriesBB.disposeAndClear(); + m_pOKPB.clear(); + ModalDialog::dispose(); } IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl) diff --git a/sw/source/ui/index/multmrk.cxx b/sw/source/ui/index/multmrk.cxx index 7fe0e656888e..51cffaccac1b 100644 --- a/sw/source/ui/index/multmrk.cxx +++ b/sw/source/ui/index/multmrk.cxx @@ -61,6 +61,17 @@ void SwMultiTOXMarkDlg::Apply() rMgr.SetCurTOXMark(nPos); } -SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg() {} +SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg() +{ + disposeOnce(); +} + +void SwMultiTOXMarkDlg::dispose() +{ + m_pTextFT.clear(); + m_pTOXLB.clear(); + SvxStandardDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 526dbb42e606..cb68df271d9b 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -546,8 +546,8 @@ void SwIndexMarkPane::UpdateKeyBoxes() class SwNewUserIdxDlg : public ModalDialog { - OKButton* m_pOKPB; - Edit* m_pNameED; + VclPtr<OKButton> m_pOKPB; + VclPtr<Edit> m_pNameED; SwIndexMarkPane* m_pDlg; @@ -565,6 +565,13 @@ class SwNewUserIdxDlg : public ModalDialog m_pOKPB->Enable(false); m_pNameED->GrabFocus(); } + virtual ~SwNewUserIdxDlg() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE + { + m_pOKPB.clear(); + m_pNameED.clear(); + ModalDialog::dispose(); + } OUString GetName(){return m_pNameED->GetText();} }; @@ -577,7 +584,7 @@ IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, Edit*, pEdit) IMPL_LINK_NOARG(SwIndexMarkPane, NewUserIdxHdl) { - boost::scoped_ptr<SwNewUserIdxDlg> pDlg(new SwNewUserIdxDlg(this)); + ScopedVclPtrInstance< SwNewUserIdxDlg > pDlg(this); if(RET_OK == pDlg->Execute()) { OUString sNewName(pDlg->GetName()); @@ -982,12 +989,12 @@ void SwIndexMarkModalDlg::Apply() class SwCreateAuthEntryDlg_Impl : public ModalDialog { - FixedText* pFixedTexts[AUTH_FIELD_END]; - ListBox* pTypeListBox; - ComboBox* pIdentifierBox; - Edit* pEdits[AUTH_FIELD_END]; + VclPtr<FixedText> pFixedTexts[AUTH_FIELD_END]; + VclPtr<ListBox> pTypeListBox; + VclPtr<ComboBox> pIdentifierBox; + VclPtr<Edit> pEdits[AUTH_FIELD_END]; - OKButton* m_pOKBT; + VclPtr<OKButton> m_pOKBT; Link aShortNameCheckLink; @@ -1007,6 +1014,7 @@ public: bool bNewEntry, bool bCreate); virtual ~SwCreateAuthEntryDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; OUString GetEntryText(ToxAuthorityField eField) const; @@ -1200,8 +1208,8 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl) bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i); if(bDifferent) { - MessageDialog aQuery(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if(RET_YES != aQuery.Execute()) + ScopedVclPtrInstance< MessageDialog > aQuery(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + if(RET_YES != aQuery->Execute()) return 0; } } @@ -1240,14 +1248,14 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton) OUString sOldId = m_sCreatedEntry[0]; for(int i = 0; i < AUTH_FIELD_END; i++) m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i]; - SwCreateAuthEntryDlg_Impl aDlg(pButton, + ScopedVclPtrInstance<SwCreateAuthEntryDlg_Impl> aDlg(pButton, bCreate ? m_sCreatedEntry : m_sFields, *pSh, bNewEntry, bCreate); if(bNewEntry) { - aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl)); + aDlg->SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl)); } - if(RET_OK == aDlg.Execute()) + if(RET_OK == aDlg->Execute()) { if(bCreate && !sOldId.isEmpty()) { @@ -1255,7 +1263,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton) } for(int i = 0; i < AUTH_FIELD_END; i++) { - m_sFields[i] = aDlg.GetEntryText((ToxAuthorityField)i); + m_sFields[i] = aDlg->GetEntryText((ToxAuthorityField)i); m_sCreatedEntry[i] = m_sFields[i]; } if(bNewEntry && !m_pFromDocContentRB->IsChecked()) @@ -1438,7 +1446,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, { const TextInfo aCurInfo = aTextInfoArr[nIndex]; - pFixedTexts[nIndex] = new FixedText(bLeft ? pLeft : pRight, WB_VCENTER); + pFixedTexts[nIndex] = VclPtr<FixedText>::Create(bLeft ? pLeft : pRight, WB_VCENTER); pFixedTexts[nIndex]->set_grid_left_attach(0); pFixedTexts[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); @@ -1447,7 +1455,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, pEdits[nIndex] = 0; if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField ) { - pTypeListBox = new ListBox(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER); + pTypeListBox = VclPtr<ListBox>::Create(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER); for(int j = 0; j < AUTH_TYPE_END; j++) pTypeListBox->InsertEntry(SW_RESSTR(STR_AUTH_TYPE_START + j)); if(!pFields[aCurInfo.nToxField].isEmpty()) @@ -1464,7 +1472,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, } else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode) { - pIdentifierBox = new ComboBox(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER); + pIdentifierBox = VclPtr<ComboBox>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER); pIdentifierBox->SetSelectHdl(LINK(this, SwCreateAuthEntryDlg_Impl, IdentifierHdl)); @@ -1488,7 +1496,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, } else { - pEdits[nIndex] = new Edit(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER); + pEdits[nIndex] = VclPtr<Edit>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER); pEdits[nIndex]->SetWidthInChars(14); pEdits[nIndex]->set_grid_left_attach(1); pEdits[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); @@ -1519,13 +1527,20 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl() { + disposeOnce(); +} + +void SwCreateAuthEntryDlg_Impl::dispose() +{ for(int i = 0; i < AUTH_FIELD_END; i++) { - delete pFixedTexts[i]; - delete pEdits[i]; + pFixedTexts[i].disposeAndClear(); + pEdits[i].disposeAndClear(); } - delete pTypeListBox; - delete pIdentifierBox; + pTypeListBox.disposeAndClear(); + pIdentifierBox.disposeAndClear(); + m_pOKBT.clear(); + ModalDialog::dispose(); } OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 59576289d831..5eaf63a98ddb 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -147,6 +147,15 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg( vcl::Window *pParent, SwWrtShell &rS, SwInsertBookmarkDlg::~SwInsertBookmarkDlg() { + disposeOnce(); +} + +void SwInsertBookmarkDlg::dispose() +{ + m_pBookmarkBox.clear(); + m_pOkBtn.clear(); + m_pDeleteBtn.clear(); + SvxStandardDialog::dispose(); } BookmarkCombo::BookmarkCombo(vcl::Window* pWin, WinBits nStyle) diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index 15cfb9493333..04467a339ca4 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -117,6 +117,33 @@ SwEndNoteOptionPage::SwEndNoteOptionPage(vcl::Window *pParent, bool bEN, get(m_pFtnCharTextTemplBox, "charstylelb"); } +SwEndNoteOptionPage::~SwEndNoteOptionPage() +{ + disposeOnce(); +} + +void SwEndNoteOptionPage::dispose() +{ + m_pNumViewBox.clear(); + m_pOffsetLbl.clear(); + m_pOffsetFld.clear(); + m_pNumCountBox.clear(); + m_pPrefixED.clear(); + m_pSuffixED.clear(); + m_pPosFT.clear(); + m_pPosPageBox.clear(); + m_pPosChapterBox.clear(); + m_pStylesContainer.clear(); + m_pParaTemplBox.clear(); + m_pPageTemplLbl.clear(); + m_pPageTemplBox.clear(); + m_pFtnCharAnchorTemplBox.clear(); + m_pFtnCharTextTemplBox.clear(); + m_pContEdit.clear(); + m_pContFromEdit.clear(); + SfxTabPage::dispose(); +} + void SwEndNoteOptionPage::Reset( const SfxItemSet* ) { boost::scoped_ptr<SwEndNoteInfo> pInf(bEndNote ? new SwEndNoteInfo( pSh->GetEndNoteInfo() ) @@ -219,13 +246,9 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet* ) m_pPageTemplBox->SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName()); } -SwEndNoteOptionPage::~SwEndNoteOptionPage() -{ -} - -SfxTabPage *SwEndNoteOptionPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) +VclPtr<SfxTabPage> SwEndNoteOptionPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) { - return new SwEndNoteOptionPage( pParent, true, *rSet ); + return VclPtr<SwEndNoteOptionPage>::Create( pParent, true, *rSet ); } // Different kinds of numbering; because the Listbox has varying numbers of @@ -399,9 +422,9 @@ SwFootNoteOptionPage::~SwFootNoteOptionPage() { } -SfxTabPage *SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet ) +VclPtr<SfxTabPage> SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet ) { - return new SwFootNoteOptionPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwFootNoteOptionPage( pParent, *rSet ), SAL_NO_ACQUIRE); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 11a3666236bb..7f86ef083348 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -112,6 +112,18 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(vcl::Window * pParent, SwGlossaryGroupDlg::~SwGlossaryGroupDlg() { + disposeOnce(); +} + +void SwGlossaryGroupDlg::dispose() +{ + m_pNameED.clear(); + m_pPathLB.clear(); + m_pGroupTLB.clear(); + m_pNewPB.clear(); + m_pDelPB.clear(); + m_pRenamePB.clear(); + SvxStandardDialog::dispose(); } void SwGlossaryGroupDlg::Apply() @@ -139,8 +151,8 @@ void SwGlossaryGroupDlg::Apply() const OUString sMsg(SW_RESSTR(STR_QUERY_DELETE_GROUP1) + sTitle + SW_RESSTR(STR_QUERY_DELETE_GROUP2)); - QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg ); - if(RET_YES == aQuery.Execute()) + ScopedVclPtrInstance< QueryBox > aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg ); + if(RET_YES == aQuery->Execute()) pGlosHdl->DelGroup( sDelGroup ); } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 858fd69bdd3a..3664343de66a 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -115,12 +115,12 @@ struct GroupUserData // dialog for new block name class SwNewGlosNameDlg : public ModalDialog { - Edit* m_pNewName; - TextFilter m_aNoSpaceFilter; - Edit* m_pNewShort; - OKButton* m_pOk; - Edit* m_pOldName; - Edit* m_pOldShort; + VclPtr<Edit> m_pNewName; + TextFilter m_aNoSpaceFilter; + VclPtr<Edit> m_pNewShort; + VclPtr<OKButton> m_pOk; + VclPtr<Edit> m_pOldName; + VclPtr<Edit> m_pOldShort; protected: DECL_LINK( Modify, Edit * ); @@ -130,6 +130,8 @@ public: SwNewGlosNameDlg( vcl::Window* pParent, const OUString& rOldName, const OUString& rOldShort ); + virtual ~SwNewGlosNameDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetNewName() const { return m_pNewName->GetText(); } OUString GetNewShort() const { return m_pNewShort->GetText(); } @@ -156,6 +158,21 @@ SwNewGlosNameDlg::SwNewGlosNameDlg(vcl::Window* pParent, m_pNewName->GrabFocus(); } +SwNewGlosNameDlg::~SwNewGlosNameDlg() +{ + disposeOnce(); +} + +void SwNewGlosNameDlg::dispose() +{ + m_pNewName.clear(); + m_pNewShort.clear(); + m_pOk.clear(); + m_pOldName.clear(); + m_pOldShort.clear(); + ModalDialog::dispose(); +} + // query / set currently set group OUString SwGlossaryDlg::GetCurrGroup() { @@ -232,8 +249,26 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryDlg::~SwGlossaryDlg() { + disposeOnce(); +} + +void SwGlossaryDlg::dispose() +{ m_pCategoryBox->Clear(); delete pExampleFrame; + m_pInsertTipCB.clear(); + m_pNameED.clear(); + m_pShortNameLbl.clear(); + m_pShortNameEdit.clear(); + m_pCategoryBox.clear(); + m_pFileRelCB.clear(); + m_pNetRelCB.clear(); + m_pExampleWIN.clear(); + m_pInsertBtn.clear(); + m_pEditBtn.clear(); + m_pBibBtn.clear(); + m_pPathBtn.clear(); + SvxStandardDialog::dispose(); } // select new group @@ -468,8 +503,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) else if (sItemIdent == "rename") { m_pShortNameEdit->SetText(pGlossaryHdl->GetGlossaryShortName(m_pNameED->GetText())); - boost::scoped_ptr<SwNewGlosNameDlg> pNewNameDlg(new SwNewGlosNameDlg(this, m_pNameED->GetText(), - m_pShortNameEdit->GetText() )); + ScopedVclPtrInstance<SwNewGlosNameDlg> pNewNameDlg(this, m_pNameED->GetText(), + m_pShortNameEdit->GetText()); if( RET_OK == pNewNameDlg->Execute() && pGlossaryHdl->Rename( m_pShortNameEdit->GetText(), pNewNameDlg->GetNewShort(), @@ -488,8 +523,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) } else if (sItemIdent == "delete") { - MessageDialog aQuery(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if (RET_YES == aQuery.Execute()) + ScopedVclPtrInstance< MessageDialog > aQuery(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + if (RET_YES == aQuery->Execute()) { const OUString aShortName(m_pShortNameEdit->GetText()); const OUString aTitle(m_pNameED->GetText()); @@ -616,7 +651,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) if(bIsWritable) { - boost::scoped_ptr<SwGlossaryGroupDlg> pDlg(new SwGlossaryGroupDlg( this, pGloss->GetPathArray(), pGlossaryHdl )); + ScopedVclPtrInstance< SwGlossaryGroupDlg > pDlg( this, pGloss->GetPathArray(), pGlossaryHdl ); if ( RET_OK == pDlg->Execute() ) { Init(); @@ -646,9 +681,9 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) } else { - MessageDialog aBox(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + ScopedVclPtrInstance< MessageDialog > aBox(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if(RET_YES == aBox.Execute()) + if(RET_YES == aBox->Execute()) PathHdl(m_pPathBtn); } } diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx index f9808c4dc040..31b5f8a920d0 100644 --- a/sw/source/ui/misc/impfnote.hxx +++ b/sw/source/ui/misc/impfnote.hxx @@ -30,27 +30,27 @@ class SwWrtShell; class SwEndNoteOptionPage : public SfxTabPage { - SwNumberingTypeListBox* m_pNumViewBox; - FixedText* m_pOffsetLbl; - NumericField* m_pOffsetFld; - ListBox* m_pNumCountBox; - Edit* m_pPrefixED; - Edit* m_pSuffixED; - FixedText* m_pPosFT; - RadioButton* m_pPosPageBox; - RadioButton* m_pPosChapterBox; + VclPtr<SwNumberingTypeListBox> m_pNumViewBox; + VclPtr<FixedText> m_pOffsetLbl; + VclPtr<NumericField> m_pOffsetFld; + VclPtr<ListBox> m_pNumCountBox; + VclPtr<Edit> m_pPrefixED; + VclPtr<Edit> m_pSuffixED; + VclPtr<FixedText> m_pPosFT; + VclPtr<RadioButton> m_pPosPageBox; + VclPtr<RadioButton> m_pPosChapterBox; - VclContainer *m_pStylesContainer; + VclPtr<VclContainer> m_pStylesContainer; - ListBox* m_pParaTemplBox; - FixedText* m_pPageTemplLbl; - ListBox* m_pPageTemplBox; + VclPtr<ListBox> m_pParaTemplBox; + VclPtr<FixedText> m_pPageTemplLbl; + VclPtr<ListBox> m_pPageTemplBox; - ListBox* m_pFtnCharAnchorTemplBox; - ListBox* m_pFtnCharTextTemplBox; + VclPtr<ListBox> m_pFtnCharAnchorTemplBox; + VclPtr<ListBox> m_pFtnCharTextTemplBox; - Edit* m_pContEdit; - Edit* m_pContFromEdit; + VclPtr<Edit> m_pContEdit; + VclPtr<Edit> m_pContFromEdit; OUString aNumDoc; OUString aNumPage; @@ -70,8 +70,9 @@ public: SwEndNoteOptionPage( vcl::Window *pParent, bool bEndNote, const SfxItemSet &rSet ); virtual ~SwEndNoteOptionPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; @@ -84,7 +85,7 @@ class SwFootNoteOptionPage : public SwEndNoteOptionPage virtual ~SwFootNoteOptionPage(); public: - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); }; #endif diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index fb45db53321d..0824f3de8fd3 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -204,10 +204,27 @@ SwInsFootNoteDlg::SwInsFootNoteDlg(vcl::Window *pParent, SwWrtShell &rShell, boo SwInsFootNoteDlg::~SwInsFootNoteDlg() { + disposeOnce(); +} + +void SwInsFootNoteDlg::dispose() +{ SwViewShell::SetCareWin(0); if (bEdit) rSh.ResetSelect(0, false); + + m_pNumberFrame.clear(); + m_pNumberAutoBtn.clear(); + m_pNumberCharBtn.clear(); + m_pNumberCharEdit.clear(); + m_pNumberExtChar.clear(); + m_pFtnBtn.clear(); + m_pEndNoteBtn.clear(); + m_pOkBtn.clear(); + m_pPrevBT.clear(); + m_pNextBT.clear(); + SvxStandardDialog::dispose(); } void SwInsFootNoteDlg::Init() diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index db98b1ce87b1..b14903c9e170 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -169,8 +169,30 @@ SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw) SwLineNumberingDlg::~SwLineNumberingDlg() { + disposeOnce(); } +void SwLineNumberingDlg::dispose() +{ + m_pBodyContent.clear(); + m_pDivIntervalFT.clear(); + m_pDivIntervalNF.clear(); + m_pDivRowsFT.clear(); + m_pNumIntervalNF.clear(); + m_pCharStyleLB.clear(); + m_pFormatLB.clear(); + m_pPosLB.clear(); + m_pOffsetMF.clear(); + m_pDivisorED.clear(); + m_pCountEmptyLinesCB.clear(); + m_pCountFrameLinesCB.clear(); + m_pRestartEachPageCB.clear(); + m_pNumberingOnCB.clear(); + m_pNumberingOnFooterHeader.clear(); + SfxModalDialog::dispose(); +} + + IMPL_LINK_NOARG(SwLineNumberingDlg, OKHdl) { SwLineNumberInfo aInf(pSh->GetLineNumberInfo()); diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index cd9c26626de3..50047f254f4f 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -163,7 +163,37 @@ SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent, SwNumPositionTabPage::~SwNumPositionTabPage() { + disposeOnce(); +} + +void SwNumPositionTabPage::dispose() +{ delete pActNum; + m_pLevelLB.clear(); + m_pPositionFrame.clear(); + m_pDistBorderFT.clear(); + m_pDistBorderMF.clear(); + m_pRelativeCB.clear(); + m_pIndentFT.clear(); + m_pIndentMF.clear(); + m_pDistNumFT.clear(); + m_pDistNumMF.clear(); + m_pAlignFT.clear(); + m_pAlignLB.clear(); + m_pLabelFollowedByFT.clear(); + m_pLabelFollowedByLB.clear(); + m_pListtabFT.clear(); + m_pListtabMF.clear(); + m_pAlign2FT.clear(); + m_pAlign2LB.clear(); + m_pAlignedAtFT.clear(); + m_pAlignedAtMF.clear(); + m_pIndentAtFT.clear(); + m_pIndentAtMF.clear(); + m_pStandardPB.clear(); + m_pPreviewWIN.clear(); + pOutlineDlg.clear(); + SfxTabPage::dispose(); } void SwNumPositionTabPage::InitControls() @@ -175,9 +205,9 @@ void SwNumPositionTabPage::InitControls() USHRT_MAX != nActNumLvl; m_pDistBorderMF->Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg != 0 ) ); + ( bSingleSelection || bRelative || pOutlineDlg.get() != 0 ) ); m_pDistBorderFT->Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg != 0 ) ); + ( bSingleSelection || bRelative || pOutlineDlg.get() != 0 ) ); bool bSetDistEmpty = false; bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive; @@ -512,10 +542,10 @@ void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode() m_pIndentAtMF->Show( bLabelAlignmentPosAndSpaceModeActive ); } -SfxTabPage* SwNumPositionTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwNumPositionTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwNumPositionTabPage(pParent, *rAttrSet); + return VclPtr<SwNumPositionTabPage>::Create(pParent, *rAttrSet); } void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh) @@ -960,15 +990,15 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); // collect char styles - ListBox rCharFmtLB(this); - rCharFmtLB.Clear(); - rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + ScopedVclPtrInstance< ListBox > rCharFmtLB(this); + rCharFmtLB->Clear(); + rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - ::FillCharStyleListBox(rCharFmtLB, pDocShell); + ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++) - aList.push_back( rCharFmtLB.GetEntry(j) ); + for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++) + aList.push_back( rCharFmtLB->GetEntry(j) ); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index c9ef5a1d1631..c66b86947e80 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -60,9 +60,9 @@ using namespace ::com::sun::star; class SwNumNamesDlg : public ModalDialog { - Edit* m_pFormEdit; - ListBox* m_pFormBox; - OKButton* m_pOKBtn; + VclPtr<Edit> m_pFormEdit; + VclPtr<ListBox> m_pFormBox; + VclPtr<OKButton> m_pOKBtn; DECL_LINK( ModifyHdl, Edit * ); DECL_LINK( SelectHdl, ListBox * ); @@ -70,11 +70,27 @@ class SwNumNamesDlg : public ModalDialog public: SwNumNamesDlg(vcl::Window *pParent); + virtual ~SwNumNamesDlg(); + virtual void dispose() SAL_OVERRIDE; void SetUserNames(const OUString *pList[]); OUString GetName() const { return m_pFormEdit->GetText(); } sal_Int32 GetCurEntryPos() const { return m_pFormBox->GetSelectEntryPos(); } }; +SwNumNamesDlg::~SwNumNamesDlg() +{ + disposeOnce(); +} + +void SwNumNamesDlg::dispose() +{ + m_pFormEdit.clear(); + m_pFormBox.clear(); + m_pOKBtn.clear(); + ModalDialog::dispose(); +} + + // remember selected entry IMPL_LINK_INLINE_START( SwNumNamesDlg, SelectHdl, ListBox *, pBox ) { @@ -193,7 +209,13 @@ SwOutlineTabDialog::SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* p SwOutlineTabDialog::~SwOutlineTabDialog() { + disposeOnce(); +} + +void SwOutlineTabDialog::dispose() +{ delete pNumRule; + SfxTabDialog::dispose(); } void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) @@ -265,7 +287,7 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu ) nLevelNo = 9; else if (sIdent == "saveas") { - boost::scoped_ptr<SwNumNamesDlg> pDlg(new SwNumNamesDlg(this)); + VclPtrInstance< SwNumNamesDlg > pDlg(this); const OUString *aStrArr[SwChapterNumRules::nMaxRules]; for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i) { @@ -740,8 +762,25 @@ IMPL_LINK_NOARG(SwOutlineSettingsTabPage, CharFmtHdl) SwOutlineSettingsTabPage::~SwOutlineSettingsTabPage() { + disposeOnce(); } +void SwOutlineSettingsTabPage::dispose() +{ + m_pLevelLB.clear(); + m_pCollBox.clear(); + m_pNumberBox.clear(); + m_pCharFmtLB.clear(); + m_pAllLevelFT.clear(); + m_pAllLevelNF.clear(); + m_pPrefixED.clear(); + m_pSuffixED.clear(); + m_pStartEdit.clear(); + m_pPreviewWIN.clear(); + SfxTabPage::dispose(); +} + + void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell) { pSh = pShell; @@ -826,10 +865,10 @@ void SwOutlineSettingsTabPage::Reset( const SfxItemSet* rSet ) ActivatePage(*rSet); } -SfxTabPage* SwOutlineSettingsTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwOutlineSettingsTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwOutlineSettingsTabPage(pParent, *rAttrSet); + return VclPtr<SwOutlineSettingsTabPage>::Create(pParent, *rAttrSet); } void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType) @@ -892,7 +931,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ ) { const Size aSize(PixelToLogic(GetOutputSizePixel())); - boost::scoped_ptr<VirtualDevice> pVDev(new VirtualDevice(*this)); + ScopedVclPtrInstance< VirtualDevice > pVDev(*this); pVDev->SetMapMode(GetMapMode()); pVDev->SetOutputSize( aSize ); diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index 809b09007fa9..bd8b00829e65 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -135,11 +135,27 @@ SwFootNotePage::SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet) SwFootNotePage::~SwFootNotePage() { + disposeOnce(); } -SfxTabPage* SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwFootNotePage::dispose() { - return new SwFootNotePage(pParent, *rSet); + m_pMaxHeightPageBtn.clear(); + m_pMaxHeightBtn.clear(); + m_pMaxHeightEdit.clear(); + m_pDistEdit.clear(); + m_pLinePosBox.clear(); + m_pLineTypeBox.clear(); + m_pLineWidthEdit.clear(); + m_pLineColorBox.clear(); + m_pLineLengthEdit.clear(); + m_pLineDistEdit.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +{ + return VclPtr<SfxTabPage>(new SwFootNotePage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwFootNotePage::Reset(const SfxItemSet *rSet) diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index d4908da737a6..100a2c4d8d67 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -151,14 +151,41 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : SwTextGridPage::~SwTextGridPage() { + disposeOnce(); } -SfxTabPage *SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwTextGridPage::dispose() { - return new SwTextGridPage(pParent, *rSet); + m_pNoGridRB.clear(); + m_pLinesGridRB.clear(); + m_pCharsGridRB.clear(); + m_pSnapToCharsCB.clear(); + m_pExampleWN.clear(); + m_pLayoutFL.clear(); + m_pLinesPerPageNF.clear(); + m_pLinesRangeFT.clear(); + m_pTextSizeMF.clear(); + m_pCharsPerLineFT.clear(); + m_pCharsPerLineNF.clear(); + m_pCharsRangeFT.clear(); + m_pCharWidthFT.clear(); + m_pCharWidthMF.clear(); + m_pRubySizeFT.clear(); + m_pRubySizeMF.clear(); + m_pRubyBelowCB.clear(); + m_pDisplayFL.clear(); + m_pDisplayCB.clear(); + m_pPrintCB.clear(); + m_pColorLB.clear(); + SfxTabPage::dispose(); } -bool SwTextGridPage::FillItemSet(SfxItemSet *rSet) +VclPtr<SfxTabPage> SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +{ + return VclPtr<SfxTabPage>(new SwTextGridPage(pParent, *rSet), SAL_NO_ACQUIRE); +} + +bool SwTextGridPage::FillItemSet(SfxItemSet *rSet) { bool bRet = false; if(m_pNoGridRB->IsValueChangedFromSaved() || @@ -460,7 +487,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField) IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton) { - bool bEnable = m_pNoGridRB != pButton; + bool bEnable = m_pNoGridRB.get() != pButton; m_pLayoutFL->Enable(bEnable); m_pDisplayFL->Enable(bEnable); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 3c58114764b1..bb7bcd01222f 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -250,10 +250,41 @@ SwSortDlg::SwSortDlg(vcl::Window* pParent, SwWrtShell &rShell) SwSortDlg::~SwSortDlg() { + disposeOnce(); +} + +void SwSortDlg::dispose() +{ ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB1); ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB2); ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB3); delete pColRes; + m_pColLbl.clear(); + m_pTypLbl.clear(); + m_pKeyCB1.clear(); + m_pColEdt1.clear(); + m_pTypDLB1.clear(); + m_pSortUp1RB.clear(); + m_pSortDn1RB.clear(); + m_pKeyCB2.clear(); + m_pColEdt2.clear(); + m_pTypDLB2.clear(); + m_pSortUp2RB.clear(); + m_pSortDn2RB.clear(); + m_pKeyCB3.clear(); + m_pColEdt3.clear(); + m_pTypDLB3.clear(); + m_pSortUp3RB.clear(); + m_pSortDn3RB.clear(); + m_pColumnRB.clear(); + m_pRowRB.clear(); + m_pDelimTabRB.clear(); + m_pDelimFreeRB.clear(); + m_pDelimEdt.clear(); + m_pDelimPB.clear(); + m_pLangLB.clear(); + m_pCaseCB.clear(); + SvxStandardDialog::dispose(); } sal_Unicode SwSortDlg::GetDelimChar() const @@ -381,7 +412,7 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl) IMPL_LINK( SwSortDlg, CheckHdl, void *, pControl ) { - if( pControl == m_pRowRB) + if( pControl == m_pRowRB.get()) { m_pColLbl->SetText(aColTxt); m_pColEdt1->SetMax(nY); @@ -392,7 +423,7 @@ IMPL_LINK( SwSortDlg, CheckHdl, void *, pControl ) m_pColEdt2->SetAccessibleName(aColTxt); m_pColEdt3->SetAccessibleName(aColTxt); } - else if( pControl == m_pColumnRB) + else if( pControl == m_pColumnRB.get()) { m_pColLbl->SetText(aRowTxt); m_pColEdt1->SetMax(nX); diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx index 153bbc1a27f7..252e264f4b58 100644 --- a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx +++ b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx @@ -55,10 +55,16 @@ SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(vcl::Window *pParent) SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg() { + disposeOnce(); +} + +void SwModalRedlineAcceptDlg::dispose() +{ AcceptAll(false); // refuse everything remaining pImplDlg->FillInfo(GetExtraData()); delete pImplDlg; + SfxModalDialog::dispose(); } void SwModalRedlineAcceptDlg::Activate() diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 2dbd5ec742c6..5f888f3f7497 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -270,7 +270,25 @@ IMPL_LINK_NOARG(SwTitlePageDlg, StartPageHdl) SwTitlePageDlg::~SwTitlePageDlg() { + disposeOnce(); +} + +void SwTitlePageDlg::dispose() +{ delete mpPageFmtDesc; + m_pUseExistingPagesRB.clear(); + m_pPageCountNF.clear(); + m_pDocumentStartRB.clear(); + m_pPageStartRB.clear(); + m_pPageStartNF.clear(); + m_pRestartNumberingCB.clear(); + m_pRestartNumberingNF.clear(); + m_pSetPageNumberCB.clear(); + m_pSetPageNumberNF.clear(); + m_pPagePropertiesLB.clear(); + m_pPagePropertiesPB.clear(); + m_pOkPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl) diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx index 751b5a4c029d..50ffa471b6f3 100644 --- a/sw/source/ui/table/colwd.cxx +++ b/sw/source/ui/table/colwd.cxx @@ -66,6 +66,18 @@ SwTableWidthDlg::SwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rTableFnc ) LoseFocusHdl(); } +SwTableWidthDlg::~SwTableWidthDlg() +{ + disposeOnce(); +} + +void SwTableWidthDlg::dispose() +{ + m_pColNF.clear(); + m_pWidthMF.clear(); + SvxStandardDialog::dispose(); +} + void SwTableWidthDlg::Apply() { rFnc.InitTabCols(); diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index cb31042c14de..63fb7aa83277 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -174,7 +174,27 @@ SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable ) SwConvertTableDlg:: ~SwConvertTableDlg() { + disposeOnce(); +} + +void SwConvertTableDlg::dispose() +{ delete pTAutoFmt; + mpTabBtn.clear(); + mpSemiBtn.clear(); + mpParaBtn.clear(); + mpOtherBtn.clear(); + mpOtherEd.clear(); + mpKeepColumn.clear(); + mpOptions.clear(); + mpHeaderCB.clear(); + mpRepeatHeaderCB.clear(); + mpRepeatRows.clear(); + mpRepeatHeaderNF.clear(); + mpDontSplitCB.clear(); + mpBorderCB.clear(); + mpAutoFmtBtn.clear(); + SfxModalDialog::dispose(); } IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton ) diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 56e6c02f36c7..e67319432c11 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -137,7 +137,24 @@ IMPL_LINK_NOARG(SwInsTableDlg, OKHdl) SwInsTableDlg::~SwInsTableDlg() { + disposeOnce(); +} + +void SwInsTableDlg::dispose() +{ delete pTAutoFmt; + m_pNameEdit.clear(); + m_pColNF.clear(); + m_pRowNF.clear(); + m_pHeaderCB.clear(); + m_pRepeatHeaderCB.clear(); + m_pRepeatHeaderNF.clear(); + m_pRepeatGroup.clear(); + m_pDontSplitCB.clear(); + m_pBorderCB.clear(); + m_pInsertBtn.clear(); + m_pAutoFmtBtn.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit ) diff --git a/sw/source/ui/table/mergetbl.cxx b/sw/source/ui/table/mergetbl.cxx index 6c1dd9449336..1206a8b04842 100644 --- a/sw/source/ui/table/mergetbl.cxx +++ b/sw/source/ui/table/mergetbl.cxx @@ -28,6 +28,18 @@ SwMergeTblDlg::SwMergeTblDlg( vcl::Window *pParent, bool& rWithPrev ) m_pMergePrevRB->Check(); } +SwMergeTblDlg::~SwMergeTblDlg() +{ + disposeOnce(); +} + +void SwMergeTblDlg::dispose() +{ + m_pMergePrevRB.clear(); + SvxStandardDialog::dispose(); +} + + void SwMergeTblDlg::Apply() { m_rMergePrev = m_pMergePrevRB->IsChecked(); diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx index f745f3f9356d..6c8bdb49b0c0 100644 --- a/sw/source/ui/table/rowht.cxx +++ b/sw/source/ui/table/rowht.cxx @@ -75,4 +75,16 @@ SwTableHeightDlg::SwTableHeightDlg(vcl::Window *pParent, SwWrtShell &rS) } } +SwTableHeightDlg::~SwTableHeightDlg() +{ + disposeOnce(); +} + +void SwTableHeightDlg::dispose() +{ + m_pHeightEdit.clear(); + m_pAutoHeightCB.clear(); + SvxStandardDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx index d6d7b62ca16b..c1d00489c519 100644 --- a/sw/source/ui/table/splittbl.cxx +++ b/sw/source/ui/table/splittbl.cxx @@ -33,6 +33,20 @@ SwSplitTblDlg::SwSplitTblDlg( vcl::Window *pParent, SwWrtShell &rSh ) get(mpBorderCopyRB, "noheading"); } +SwSplitTblDlg::~SwSplitTblDlg() +{ + disposeOnce(); +} + +void SwSplitTblDlg::dispose() +{ + mpCntntCopyRB.clear(); + mpBoxAttrCopyWithParaRB.clear(); + mpBoxAttrCopyNoParaRB.clear(); + mpBorderCopyRB.clear(); + SvxStandardDialog::dispose(); +} + void SwSplitTblDlg::Apply() { m_nSplit = HEADLINE_CNTNTCOPY; diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 5e9d71114e67..e6636d1b2c5b 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -105,6 +105,32 @@ SwFormatTablePage::SwFormatTablePage(vcl::Window* pParent, const SfxItemSet& rSe Init(); } +SwFormatTablePage::~SwFormatTablePage() +{ + disposeOnce(); +} + +void SwFormatTablePage::dispose() +{ + m_pNameED.clear(); + m_pWidthFT.clear(); + m_pRelWidthCB.clear(); + m_pFullBtn.clear(); + m_pLeftBtn.clear(); + m_pFromLeftBtn.clear(); + m_pRightBtn.clear(); + m_pCenterBtn.clear(); + m_pFreeBtn.clear(); + m_pLeftFT.clear(); + m_pRightFT.clear(); + m_pTopFT.clear(); + m_pTopMF.clear(); + m_pBottomFT.clear(); + m_pBottomMF.clear(); + m_pTextDirectionLB.clear(); + SfxTabPage::dispose(); +} + void SwFormatTablePage::Init() { m_aLeftMF.SetMetricFieldMin(-999999); @@ -370,10 +396,10 @@ void SwFormatTablePage::ModifyHdl(const Edit * pEdit) bModified = true; } -SfxTabPage* SwFormatTablePage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwFormatTablePage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwFormatTablePage( pParent, *rAttrSet ); + return VclPtr<SwFormatTablePage>::Create( pParent, *rAttrSet ); } bool SwFormatTablePage::FillItemSet( SfxItemSet* rCoreSet ) @@ -749,15 +775,28 @@ SwTableColumnPage::SwTableColumnPage(vcl::Window* pParent, const SfxItemSet& rSe && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON)); } -//Description: Page column configuration - SwTableColumnPage::~SwTableColumnPage() +SwTableColumnPage::~SwTableColumnPage() { + disposeOnce(); } -SfxTabPage* SwTableColumnPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +void SwTableColumnPage::dispose() { - return new SwTableColumnPage( pParent, *rAttrSet ); + m_pModifyTableCB.clear(); + m_pProportionalCB.clear(); + m_pSpaceFT.clear(); + m_pSpaceED.clear(); + m_pUpBtn.clear(); + m_pDownBtn.clear(); + for (auto p : m_pTextArr) + p.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwTableColumnPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) +{ + return VclPtr<SwTableColumnPage>::Create( pParent, *rAttrSet ); } void SwTableColumnPage::Reset( const SfxItemSet* ) @@ -832,7 +871,7 @@ void SwTableColumnPage::Init(bool bWeb) IMPL_LINK( SwTableColumnPage, AutoClickHdl, void *, pControl ) { //move display window - if(pControl == m_pDownBtn) + if(pControl == m_pDownBtn.get()) { if(aValueTbl[0] > 0) { @@ -840,7 +879,7 @@ IMPL_LINK( SwTableColumnPage, AutoClickHdl, void *, pControl ) aValueTbl[i] -= 1; } } - if (pControl == m_pUpBtn) + if (pControl == m_pUpBtn.get()) { if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 ) { @@ -1307,14 +1346,37 @@ SwTextFlowPage::SwTextFlowPage(vcl::Window* pParent, const SfxItemSet& rSet) HeadLineCBClickHdl(); } - SwTextFlowPage::~SwTextFlowPage() +SwTextFlowPage::~SwTextFlowPage() +{ + disposeOnce(); +} + +void SwTextFlowPage::dispose() { + m_pPgBrkCB.clear(); + m_pPgBrkRB.clear(); + m_pColBrkRB.clear(); + m_pPgBrkBeforeRB.clear(); + m_pPgBrkAfterRB.clear(); + m_pPageCollCB.clear(); + m_pPageCollLB.clear(); + m_pPageNoFT.clear(); + m_pPageNoNF.clear(); + m_pSplitCB.clear(); + m_pSplitRowCB.clear(); + m_pKeepCB.clear(); + m_pHeadLineCB.clear(); + m_pRepeatHeaderNF.clear(); + m_pRepeatHeaderCombo.clear(); + m_pTextDirectionLB.clear(); + m_pVertOrientLB.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwTextFlowPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTextFlowPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwTextFlowPage(pParent, *rAttrSet); + return VclPtr<SfxTabPage>(new SwTextFlowPage(pParent, *rAttrSet), SAL_NO_ACQUIRE); } bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet ) diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 8a8c02aa56f0..36a0cccf0061 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -49,6 +49,7 @@ class AutoFmtPreview : public vcl::Window public: AutoFmtPreview(vcl::Window* pParent, WinBits nStyle); virtual ~AutoFmtPreview(); + virtual void dispose() SAL_OVERRIDE; void NotifyChange( const SwTableAutoFmt& rNewData ); @@ -60,7 +61,7 @@ protected: private: SwTableAutoFmt aCurData; - VirtualDevice aVD; + ScopedVclPtr<VirtualDevice> aVD; SvtScriptedTextHelper aScriptedText; svx::frame::Array maArray; /// Implementation to draw the frame borders. bool bFitWidth; @@ -105,11 +106,12 @@ public: const OUString& rEditTitle, const OUString& rDefault ); virtual ~SwStringInputDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetInputString() const; private: - Edit* m_pEdInput; // Edit obtains the focus. + VclPtr<Edit> m_pEdInput; // Edit obtains the focus. }; SwStringInputDlg::SwStringInputDlg(vcl::Window* pParent, const OUString& rTitle, @@ -130,6 +132,13 @@ OUString SwStringInputDlg::GetInputString() const SwStringInputDlg::~SwStringInputDlg() { + disposeOnce(); +} + +void SwStringInputDlg::dispose() +{ + m_pEdInput.clear(); + ModalDialog::dispose(); } // AutoFormat-Dialogue: @@ -174,9 +183,28 @@ SwAutoFormatDlg::SwAutoFormatDlg( vcl::Window* pParent, SwWrtShell* pWrtShell, SwAutoFormatDlg::~SwAutoFormatDlg() { + disposeOnce(); +} + +void SwAutoFormatDlg::dispose() +{ if (bCoreDataChanged) pTableTbl->Save(); delete pTableTbl; + m_pLbFormat.clear(); + m_pFormatting.clear(); + m_pBtnNumFormat.clear(); + m_pBtnBorder.clear(); + m_pBtnFont.clear(); + m_pBtnPattern.clear(); + m_pBtnAlignment.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + m_pBtnAdd.clear(); + m_pBtnRemove.clear(); + m_pBtnRename.clear(); + m_pWndPreview.clear(); + SfxModalDialog::dispose(); } void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt ) @@ -287,10 +315,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl) bool bOk = false, bFmtInserted = false; while( !bOk ) { - boost::scoped_ptr<SwStringInputDlg> pDlg(new SwStringInputDlg( this, - aStrTitle, - aStrLabel, - OUString() )); + VclPtrInstance<SwStringInputDlg> pDlg( this, aStrTitle, + aStrLabel, OUString() ); if( RET_OK == pDlg->Execute() ) { const OUString aFormatName( pDlg->GetInputString() ); @@ -349,8 +375,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl) aMessage += m_pLbFormat->GetSelectEntry(); aMessage += "\n"; - boost::scoped_ptr<MessBox> pBox(new MessBox( this, WinBits( WB_OK_CANCEL ), - aStrDelTitle, aMessage)); + VclPtrInstance<MessBox> pBox( this, WinBits( WB_OK_CANCEL ), + aStrDelTitle, aMessage ); if ( pBox->Execute() == RET_OK ) { @@ -384,10 +410,9 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) bool bOk = false; while( !bOk ) { - boost::scoped_ptr<SwStringInputDlg> pDlg(new SwStringInputDlg( this, - aStrRenameTitle, - m_pLbFormat->GetSelectEntry(), - OUString() )); + VclPtrInstance<SwStringInputDlg> pDlg( this, aStrRenameTitle, + m_pLbFormat->GetSelectEntry(), + OUString() ); if( pDlg->Execute() == RET_OK ) { bool bFmtRenamed = false; @@ -489,8 +514,8 @@ IMPL_LINK_NOARG_INLINE_END(SwAutoFormatDlg, OkHdl) AutoFmtPreview::AutoFmtPreview(vcl::Window* pParent, WinBits nStyle) : Window ( pParent, nStyle ), aCurData ( OUString() ), - aVD ( *this ), - aScriptedText ( aVD ), + aVD ( VclPtr<VirtualDevice>::Create(*this) ), + aScriptedText ( *aVD.get() ), bFitWidth ( false ), mbRTL ( false ), aStrJan ( SW_RES( STR_JAN ) ), @@ -537,7 +562,13 @@ void AutoFmtPreview::DetectRTL(SwWrtShell* pWrtShell) AutoFmtPreview::~AutoFmtPreview() { + disposeOnce(); +} + +void AutoFmtPreview::dispose() +{ delete pNumFmt; + vcl::Window::dispose(); } static void lcl_SetFontProperties( @@ -762,11 +793,11 @@ void AutoFmtPreview::DrawBackground() { SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() ); - aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); - aVD.SetLineColor(); - aVD.SetFillColor( aBrushItem.GetColor() ); - aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) ); - aVD.Pop(); + aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); + aVD->SetLineColor(); + aVD->SetFillColor( aBrushItem.GetColor() ); + aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) ); + aVD->Pop(); } } } @@ -782,7 +813,7 @@ void AutoFmtPreview::PaintCells() // 3) border if ( aCurData.IsFrame() ) - maArray.DrawArray( aVD ); + maArray.DrawArray( *aVD.get() ); } void AutoFmtPreview::Init() @@ -851,9 +882,9 @@ void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData ) void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ ) { - sal_uInt32 nOldDrawMode = aVD.GetDrawMode(); + sal_uInt32 nOldDrawMode = aVD->GetDrawMode(); if( GetSettings().GetStyleSettings().GetHighContrastMode() ) - aVD.SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); + aVD->SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); Bitmap thePreview; Point aCenterPos; @@ -861,36 +892,36 @@ void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ ) Color oldColor; vcl::Font aFont; - aFont = aVD.GetFont(); + aFont = aVD->GetFont(); aFont.SetTransparent( true ); - aVD.SetFont ( aFont ); - aVD.SetLineColor (); + aVD->SetFont ( aFont ); + aVD->SetLineColor (); const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor(); - aVD.SetBackground ( Wallpaper(rWinColor) ); - aVD.SetFillColor ( rWinColor ); - aVD.SetOutputSizePixel ( aPrvSize ); + aVD->SetBackground ( Wallpaper(rWinColor) ); + aVD->SetFillColor ( rWinColor ); + aVD->SetOutputSizePixel ( aPrvSize ); // Draw cells on virtual device // and save the result PaintCells(); - thePreview = aVD.GetBitmap( Point(0,0), aPrvSize ); + thePreview = aVD->GetBitmap( Point(0,0), aPrvSize ); // Draw the Frame and center the preview: // (virtual Device for window output) - aVD.SetOutputSizePixel( theWndSize ); - oldColor = aVD.GetLineColor(); - aVD.SetLineColor(); - aVD.DrawRect( Rectangle( Point(0,0), theWndSize ) ); + aVD->SetOutputSizePixel( theWndSize ); + oldColor = aVD->GetLineColor(); + aVD->SetLineColor(); + aVD->DrawRect( Rectangle( Point(0,0), theWndSize ) ); SetLineColor( oldColor ); aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2, (theWndSize.Height() - aPrvSize.Height()) / 2 ); - aVD.DrawBitmap( aCenterPos, thePreview ); + aVD->DrawBitmap( aCenterPos, thePreview ); // Output in the preview window: - DrawBitmap( Point(0,0), aVD.GetBitmap( Point(0,0), theWndSize ) ); + DrawBitmap( Point(0,0), aVD->GetBitmap( Point(0,0), theWndSize ) ); - aVD.SetDrawMode( nOldDrawMode ); + aVD->SetDrawMode( nOldDrawMode ); } void AutoFmtPreview::Paint( const Rectangle& rRect ) diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 15902b8a076a..f2ebdb3a6df5 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -74,6 +74,18 @@ SwRenameXNamedDlg::SwRenameXNamedDlg( vcl::Window* pWin, m_pOk->Enable(false); } +SwRenameXNamedDlg::~SwRenameXNamedDlg() +{ + disposeOnce(); +} + +void SwRenameXNamedDlg::dispose() +{ + m_pNewNameED.clear(); + m_pOk.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(SwRenameXNamedDlg, OkHdl) { try diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index db3aeb30865d..4d4af5cf1b2a 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -418,9 +418,9 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB); } -SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) +VclPtr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) { - SfxTabPage* pRet = NULL; + VclPtr<SfxTabPage> pRet; SfxAllItemSet aSet(*(rSet.GetPool())); switch( nId ) { diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 1ef8a1fd1025..706015d73dbd 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -133,10 +133,10 @@ using namespace ::com::sun::star; using namespace ::sfx2; // create DocInfo (virtual) -SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog( +VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet) { - SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog(pParent, rSet); + VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(pParent, rSet); //only with statistics, when this document is being shown, not //from within the Doc-Manager SwDocShell* pDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current()); @@ -500,8 +500,8 @@ void SwDocShell::Execute(SfxRequest& rReq) if ( aFileName.isEmpty() ) { SvtPathOptions aPathOpt; - boost::scoped_ptr<SfxNewFileDialog> pNewFileDlg( - new SfxNewFileDialog(&GetView()->GetViewFrame()->GetWindow(), SFXWB_LOAD_TEMPLATE)); + ScopedVclPtr<SfxNewFileDialog> pNewFileDlg( + VclPtr<SfxNewFileDialog>::Create(&GetView()->GetViewFrame()->GetWindow(), SFXWB_LOAD_TEMPLATE)); pNewFileDlg->SetTemplateFlags(nFlags); nRet = pNewFileDlg->Execute(); @@ -608,10 +608,10 @@ void SwDocShell::Execute(SfxRequest& rReq) const SfxFilter* pFlt = GetMedium()->GetFilter(); if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData()) { - MessageDialog aQuery(&pViewFrm->GetWindow(), - "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui"); + ScopedVclPtrInstance<MessageDialog> aQuery(&pViewFrm->GetWindow(), + "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui"); - if(RET_YES == aQuery.Execute()) + if(RET_YES == aQuery->Execute()) bLocalHasName = false; else break; @@ -648,7 +648,7 @@ void SwDocShell::Execute(SfxRequest& rReq) { SfxPrinter* pTemp = GetDoc()->getIDocumentDeviceAccess().getPrinter( false ); if(pTemp) - pSavePrinter = new SfxPrinter(*pTemp); + pSavePrinter = VclPtr<SfxPrinter>::Create(*pTemp); bSetModified = IsModified() || pSrcView->IsModified(); if(pSrcView->IsModified()||pSrcView->HasSourceSaved()) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index e110b0d75ed3..28e1d2c00948 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -356,8 +356,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) { case SID_STYLE_NEW_BY_EXAMPLE: { - boost::scoped_ptr<SfxNewStyleDlg> pDlg(new SfxNewStyleDlg( 0, - *GetStyleSheetPool())); + VclPtrInstance<SfxNewStyleDlg> pDlg( nullptr, *GetStyleSheetPool()); if(RET_OK == pDlg->Execute()) { aParam = pDlg->GetName(); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 2163096bce98..299eee2ffd00 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -945,17 +945,17 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, bool bPageStylesWithHeaderFooter = false; vcl::Window *pSourceWindow = 0; - CancelableDialog *pProgressDlg = 0; + VclPtr<CancelableDialog> pProgressDlg; if (!IsMergeSilent()) { pSourceWindow = &pSourceShell->GetView().GetEditWin(); if( ! pParent ) pParent = pSourceWindow; if( bMergeShell ) - pProgressDlg = new CreateMonitor( pParent, pParent != pSourceWindow ); + pProgressDlg = VclPtr<CreateMonitor>::Create( pParent, pParent != pSourceWindow ); else { - pProgressDlg = new PrintMonitor( pParent, pParent != pSourceWindow, PrintMonitor::MONITOR_TYPE_PRINT ); - static_cast<PrintMonitor*>( pProgressDlg )->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22)); + pProgressDlg = VclPtr<PrintMonitor>::Create( pParent, pParent != pSourceWindow, PrintMonitor::MONITOR_TYPE_PRINT ); + static_cast<PrintMonitor*>( pProgressDlg.get() )->SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22)); } pProgressDlg->SetCancelHdl( LINK(this, SwDBManager, PrtCancelHdl) ); pProgressDlg->Show(); @@ -1030,7 +1030,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, int targetDocPageCount = 0; if( !IsMergeSilent() && bMergeShell && lcl_getCountFromResultSet( nDocCount, pImpl->pMergeData->xResultSet ) ) - static_cast<CreateMonitor*>( pProgressDlg )->SetTotalCount( nDocCount ); + static_cast<CreateMonitor*>( pProgressDlg.get() )->SetTotalCount( nDocCount ); long nStartRow, nEndRow; bool bFreezedLayouts = false; @@ -1094,9 +1094,9 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, aTempFileURL.reset( new INetURLObject(aTempFile->GetURL())); if (!IsMergeSilent()) { if( bMergeShell ) - static_cast<CreateMonitor*>( pProgressDlg )->SetCurrentPosition( nDocNo ); + static_cast<CreateMonitor*>( pProgressDlg.get() )->SetCurrentPosition( nDocNo ); else { - PrintMonitor *pPrintMonDlg = static_cast<PrintMonitor*>( pProgressDlg ); + PrintMonitor *pPrintMonDlg = static_cast<PrintMonitor*>( pProgressDlg.get() ); pPrintMonDlg->m_pPrinter->SetText( createTempFile ? aTempFileURL->GetBase() : OUString( pSourceDocSh->GetTitle( 22 ))); OUString sStat(SW_RES(STR_STATSTR_LETTER)); // Brief sStat += " "; @@ -1411,7 +1411,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::mem_fun(&SwRootFrm::AllCheckPageDescs)); } - DELETEZ( pProgressDlg ); + pProgressDlg.disposeAndClear(); // save the single output document if (bMergeShell) diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx index 64bcf9c87ae8..e2dea59c31d3 100644 --- a/sw/source/uibase/dbui/dbtree.cxx +++ b/sw/source/uibase/dbui/dbtree.cxx @@ -186,7 +186,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwDBTreeList(vcl::Wind OString sBorder = VclBuilder::extractCustomProperty(rMap); if (!sBorder.isEmpty()) nStyle |= WB_BORDER; - return new SwDBTreeList(pParent, nStyle); + return VclPtr<SwDBTreeList>::Create(pParent, nStyle); } Size SwDBTreeList::GetOptimalSize() const @@ -196,7 +196,13 @@ Size SwDBTreeList::GetOptimalSize() const SwDBTreeList::~SwDBTreeList() { + disposeOnce(); +} + +void SwDBTreeList::dispose() +{ delete pImpl; + SvTreeListBox::dispose(); } void SwDBTreeList::InitTreeList() diff --git a/sw/source/uibase/dbui/dbui.cxx b/sw/source/uibase/dbui/dbui.cxx index fd94b2818d49..8e44685b868f 100644 --- a/sw/source/uibase/dbui/dbui.cxx +++ b/sw/source/uibase/dbui/dbui.cxx @@ -42,6 +42,21 @@ PrintMonitor::PrintMonitor(vcl::Window *pParent, bool modal, PrintMonitorType eT m_pPrinting->Show(); } +PrintMonitor::~PrintMonitor() +{ + disposeOnce(); +} + +void PrintMonitor::dispose() +{ + m_pDocName.clear(); + m_pPrinting.clear(); + m_pPrinter.clear(); + m_pPrintInfo.clear(); + + CancelableDialog::dispose(); +} + // Progress Indicator for Creation of personalized Mail Merge documents: CreateMonitor::CreateMonitor( vcl::Window *pParent, bool modal ) : CancelableDialog(pParent, modal, "MMCreatingDialog", @@ -57,6 +72,19 @@ CreateMonitor::CreateMonitor( vcl::Window *pParent, bool modal ) m_pCounting->SetText("..."); } +CreateMonitor::~CreateMonitor() +{ + disposeOnce(); +} + +void CreateMonitor::dispose() +{ + m_pCancelButton.clear(); + m_pCounting.clear(); + + CancelableDialog::dispose(); +} + void CreateMonitor::UpdateCountingText() { OUString sText(m_sCountingPattern); @@ -88,7 +116,15 @@ CancelableDialog::CancelableDialog( vcl::Window *pParent, bool modal, CancelableDialog::~CancelableDialog() { + disposeOnce(); +} + +void CancelableDialog::dispose() +{ EndDialog( 0 ); + m_pCancelButton.clear(); + + Dialog::dispose(); } void CancelableDialog::SetCancelHdl( const Link& rLink ) diff --git a/sw/source/uibase/dbui/mailmergechildwindow.cxx b/sw/source/uibase/dbui/mailmergechildwindow.cxx index e43731b1e399..ad16a82acf59 100644 --- a/sw/source/uibase/dbui/mailmergechildwindow.cxx +++ b/sw/source/uibase/dbui/mailmergechildwindow.cxx @@ -43,7 +43,7 @@ SwMailMergeChildWindow::SwMailMergeChildWindow( vcl::Window* _pParent, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - pWindow = new SwMailMergeChildWin( pBindings, this, _pParent); + pWindow = VclPtr<SwMailMergeChildWin>::Create( pBindings, this, _pParent); if (!pInfo->aSize.Width() || !pInfo->aSize.Height()) { @@ -59,7 +59,7 @@ SwMailMergeChildWindow::SwMailMergeChildWindow( vcl::Window* _pParent, pInfo->aSize = pWindow->GetSizePixel(); } - static_cast<SwMailMergeChildWin *>(pWindow)->Initialize(pInfo); + static_cast<SwMailMergeChildWin *>(pWindow.get())->Initialize(pInfo); pWindow->Show(); } @@ -73,6 +73,17 @@ SwMailMergeChildWin::SwMailMergeChildWin(SfxBindings* _pBindings, m_pBackTB->SetButtonType( ButtonType::SYMBOLTEXT ); } +SwMailMergeChildWin::~SwMailMergeChildWin() +{ + disposeOnce(); +} + +void SwMailMergeChildWin::dispose() +{ + m_pBackTB.clear(); + SfxFloatingWindow::dispose(); +} + IMPL_LINK_NOARG(SwMailMergeChildWin, BackHdl) { GetBindings().GetDispatcher()->Execute(FN_MAILMERGE_WIZARD, SfxCallMode::ASYNCHRON); diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index 4e3d3870caf3..8f7baa658f91 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -187,14 +187,25 @@ struct SwAddressPreview_Impl SwAddressPreview::SwAddressPreview(vcl::Window* pParent, WinBits nStyle) : Window( pParent, nStyle ) - , aVScrollBar(this, WB_VSCROLL) + , aVScrollBar(VclPtr<ScrollBar>::Create(this, WB_VSCROLL)) , pImpl(new SwAddressPreview_Impl()) { - aVScrollBar.SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl)); + aVScrollBar->SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl)); positionScrollBar(); Show(); } +SwAddressPreview::~SwAddressPreview() +{ + disposeOnce(); +} + +void SwAddressPreview::dispose() +{ + aVScrollBar.disposeAndClear(); + vcl::Window::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressPreview(vcl::Window *pParent, VclBuilder::stringmap &rMap) { WinBits nWinStyle = WB_TABSTOP; @@ -207,10 +218,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressPreview(vcl:: void SwAddressPreview::positionScrollBar() { Size aSize(GetOutputSizePixel()); - Size aScrollSize(aVScrollBar.get_preferred_size().Width(), aSize.Height()); - aVScrollBar.SetSizePixel(aScrollSize); + Size aScrollSize(aVScrollBar->get_preferred_size().Width(), aSize.Height()); + aVScrollBar->SetSizePixel(aScrollSize); Point aSrollPos(aSize.Width() - aScrollSize.Width(), 0); - aVScrollBar.SetPosPixel(aSrollPos); + aVScrollBar->SetPosPixel(aSrollPos); } void SwAddressPreview::Resize() @@ -235,7 +246,7 @@ void SwAddressPreview::SetAddress(const OUString& rAddress) { pImpl->aAddresses.clear(); pImpl->aAddresses.push_back(rAddress); - aVScrollBar.Show(false); + aVScrollBar->Show(false); Invalidate(); } @@ -251,9 +262,9 @@ void SwAddressPreview::SelectAddress(sal_uInt16 nSelect) pImpl->nSelectedAddress = nSelect; // now make it visible.. sal_uInt16 nSelectRow = nSelect / pImpl->nColumns; - sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos(); + sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar->GetThumbPos(); if( (nSelectRow < nStartRow) || (nSelectRow >= (nStartRow + pImpl->nRows) )) - aVScrollBar.SetThumbPos( nSelectRow ); + aVScrollBar->SetThumbPos( nSelectRow ); } void SwAddressPreview::Clear() @@ -294,13 +305,13 @@ void SwAddressPreview::UpdateScrollBar() { if(pImpl->nColumns) { - aVScrollBar.SetVisibleSize(pImpl->nRows); + aVScrollBar->SetVisibleSize(pImpl->nRows); sal_uInt16 nResultingRows = (sal_uInt16)(pImpl->aAddresses.size() + pImpl->nColumns - 1) / pImpl->nColumns; ++nResultingRows; - aVScrollBar.Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows); - aVScrollBar.SetRange(Range(0, nResultingRows)); - if(aVScrollBar.GetThumbPos() > nResultingRows) - aVScrollBar.SetThumbPos(nResultingRows); + aVScrollBar->Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows); + aVScrollBar->SetRange(Range(0, nResultingRows)); + if(aVScrollBar->GetThumbPos() > nResultingRows) + aVScrollBar->SetThumbPos(nResultingRows); } } @@ -318,10 +329,10 @@ void SwAddressPreview::Paint(const Rectangle&) Size aSize = GetOutputSizePixel(); sal_uInt16 nStartRow = 0; - if(aVScrollBar.IsVisible()) + if(aVScrollBar->IsVisible()) { - aSize.Width() -= aVScrollBar.GetSizePixel().Width(); - nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos(); + aSize.Width() -= aVScrollBar->GetSizePixel().Width(); + nStartRow = (sal_uInt16)aVScrollBar->GetThumbPos(); } Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows ); aPartSize.Width() -= 2; @@ -358,9 +369,9 @@ void SwAddressPreview::MouseButtonDown( const MouseEvent& rMEvt ) Size aSize(GetOutputSizePixel()); Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows ); sal_uInt32 nRow = rMousePos.Y() / aPartSize.Height() ; - if(aVScrollBar.IsVisible()) + if(aVScrollBar->IsVisible()) { - nRow += (sal_uInt16)aVScrollBar.GetThumbPos(); + nRow += (sal_uInt16)aVScrollBar->GetThumbPos(); } sal_uInt32 nCol = rMousePos.X() / aPartSize.Width(); sal_uInt32 nSelect = nRow * pImpl->nColumns + nCol; @@ -615,7 +626,7 @@ OUString SwAuthenticator::getPassword( ) throw (RuntimeException, std::exceptio if(!m_aUserName.isEmpty() && m_aPassword.isEmpty() && m_pParentWindow) { SfxPasswordDialog* pPasswdDlg = - new SfxPasswordDialog( m_pParentWindow ); + VclPtr<SfxPasswordDialog>::Create( m_pParentWindow ); pPasswdDlg->SetMinLen( 0 ); if(RET_OK == pPasswdDlg->Execute()) m_aPassword = pPasswdDlg->GetPassword(); diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 2ba22e414c66..7a27619f4f86 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -388,8 +388,10 @@ namespace sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - MessageDialog aQueryBox( 0,"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox.Execute() == RET_YES) + ScopedVclPtrInstance< MessageDialog > aQueryBox( + nullptr, "QueryRotateIntoStandardOrientationDialog", + "modules/swriter/ui/queryrotateintostandarddialog.ui"); + if (aQueryBox->Execute() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx index fbbed6ba7b40..14c486369ca8 100644 --- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx +++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx @@ -58,7 +58,13 @@ AnnotationMenuButton::AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rS AnnotationMenuButton::~AnnotationMenuButton() { + disposeOnce(); +} + +void AnnotationMenuButton::dispose() +{ RemoveEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) ); + MenuButton::dispose(); } void AnnotationMenuButton::Select() diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.hxx b/sw/source/uibase/docvw/AnnotationMenuButton.hxx index 1bc2c13a56c1..9682bcf491fe 100644 --- a/sw/source/uibase/docvw/AnnotationMenuButton.hxx +++ b/sw/source/uibase/docvw/AnnotationMenuButton.hxx @@ -33,6 +33,7 @@ class AnnotationMenuButton : public MenuButton public: AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin ); virtual ~AnnotationMenuButton(); + virtual void dispose() SAL_OVERRIDE; // override MenuButton methods virtual void Select() SAL_OVERRIDE; diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 5cff22259e9b..2ea841068127 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -70,7 +70,13 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin, SwAnnotationWin::~SwAnnotationWin() { + disposeOnce(); +} + +void SwAnnotationWin::dispose() +{ delete mpButtonPopup; + sw::sidebarwindows::SwSidebarWin::dispose(); } void SwAnnotationWin::SetPostItText() @@ -207,7 +213,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing() return aCount - 1; } -MenuButton* SwAnnotationWin::CreateMenuButton() +VclPtr<MenuButton> SwAnnotationWin::CreateMenuButton() { mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON)); OUString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR ); @@ -215,7 +221,7 @@ MenuButton* SwAnnotationWin::CreateMenuButton() aRewriter.AddRule(UndoArg1,GetAuthor()); aText = aRewriter.Apply(aText); mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); - MenuButton* pMenuButton = new AnnotationMenuButton( *this ); + VclPtr<MenuButton> pMenuButton( new AnnotationMenuButton( *this ), SAL_NO_ACQUIRE ); pMenuButton->SetPopupMenu( mpButtonPopup ); pMenuButton->Show(); return pMenuButton; diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx index 7cd0e7f53319..e16809626414 100644 --- a/sw/source/uibase/docvw/FrameControlsManager.cxx +++ b/sw/source/uibase/docvw/FrameControlsManager.cxx @@ -34,6 +34,11 @@ SwFrameControlsManager::SwFrameControlsManager( const SwFrameControlsManager& rC { } +void SwFrameControlsManager::dispose() +{ + m_aControls.clear(); +} + const SwFrameControlsManager& SwFrameControlsManager::operator=( const SwFrameControlsManager& rCopy ) { m_pEditWin = rCopy.m_pEditWin; diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 43dc81dac543..61dcbd21964e 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -143,7 +143,7 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag SetMapMode( MapMode ( MAP_PIXEL ) ); // Create the line control - m_pLine = new SwDashedLine( GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor ); + m_pLine = VclPtr<SwDashedLine>::Create( GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor ); m_pLine->SetZOrder( this, WINDOW_ZORDER_BEFOR ); // Create and set the PopupMenu @@ -169,8 +169,14 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag SwHeaderFooterWin::~SwHeaderFooterWin( ) { + disposeOnce(); +} + +void SwHeaderFooterWin::dispose() +{ delete m_pPopupMenu; - delete m_pLine; + m_pLine.disposeAndClear(); + MenuButton::dispose(); } const SwPageFrm* SwHeaderFooterWin::GetPageFrame( ) diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 42027fbea9ed..d806eb332395 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -56,12 +56,14 @@ namespace class SwBreakDashedLine : public SwDashedLine { private: - SwPageBreakWin* m_pWin; + VclPtr<SwPageBreakWin> m_pWin; public: SwBreakDashedLine( vcl::Window* pParent, Color& ( *pColorFn )(), SwPageBreakWin* pWin ) : SwDashedLine( pParent, pColorFn ), m_pWin( pWin ) {}; + virtual ~SwBreakDashedLine() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_pWin.clear(); SwDashedLine::dispose(); } virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; }; @@ -103,7 +105,7 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm ) SetMapMode( MapMode ( MAP_PIXEL ) ); // Create the line control - m_pLine = new SwBreakDashedLine( GetEditWin(), &SwViewOption::GetPageBreakColor, this ); + m_pLine = VclPtr<SwBreakDashedLine>::Create( GetEditWin(), &SwViewOption::GetPageBreakColor, this ); // Create the popup menu m_pPopupMenu = new PopupMenu( SW_RES( MN_PAGEBREAK_BUTTON ) ); @@ -116,12 +118,21 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm ) SwPageBreakWin::~SwPageBreakWin( ) { + disposeOnce(); +} + +void SwPageBreakWin::dispose() +{ m_bDestroyed = true; m_aFadeTimer.Stop(); + m_pLine.disposeAndClear(); delete m_pPopupMenu; - delete m_pLine; + m_pPopupMenu = NULL; delete m_pMousePt; + m_pMousePt = NULL; + + MenuButton::dispose(); } void SwPageBreakWin::Paint( const Rectangle& ) diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 7b36acd7ccb3..09357e2b40b8 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -193,8 +193,7 @@ void SwPostItMgr::CheckForRemovedPostIts() mvPostItFlds.remove(*it); if (GetActiveSidebarWin() == p->pPostIt) SetActiveSidebarWin(0); - if (p->pPostIt) - delete p->pPostIt; + p->pPostIt.disposeAndClear(); delete p; bRemoved = true; } @@ -243,8 +242,8 @@ void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast ) SwSidebarItem* p = (*i); if (GetActiveSidebarWin() == p->pPostIt) SetActiveSidebarWin(0); + p->pPostIt.disposeAndClear(); mvPostItFlds.erase(i); - delete p->pPostIt; delete p; break; } @@ -1178,8 +1177,7 @@ void SwPostItMgr::RemoveSidebarWin() for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i) { EndListening( *(const_cast<SfxBroadcaster*>((*i)->GetBroadCaster())) ); - if ((*i)->pPostIt) - delete (*i)->pPostIt; + (*i)->pPostIt.disposeAndClear(); delete (*i); } mvPostItFlds.clear(); @@ -1498,7 +1496,7 @@ sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItFie for(const_iterator i = mvPostItFlds.begin(); i != mvPostItFlds.end() ; ++i) { if ( (*i)->GetFmtFld().GetField() == pFld ) - return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt); + return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt.get()); } return NULL; } @@ -2031,13 +2029,13 @@ void SwPostItMgr::AssureStdModeAtShell() bool SwPostItMgr::HasActiveSidebarWin() const { - return mpActivePostIt != 0; + return mpActivePostIt != nullptr; } bool SwPostItMgr::HasActiveAnnotationWin() const { return HasActiveSidebarWin() && - dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt) != 0; + dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt.get()) != 0; } void SwPostItMgr::GrabFocusOnActiveSidebarWin() diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 88f5316b9ad9..fcb3eb65e4c7 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -70,7 +70,13 @@ SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin, SidebarTxtControl::~SidebarTxtControl() { + disposeOnce(); +} + +void SidebarTxtControl::dispose() +{ RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) ); + Control::dispose(); } OutlinerView* SidebarTxtControl::GetTextView() const diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx index f14502031f98..4bd1fe89b7d8 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.hxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx @@ -58,6 +58,7 @@ class SidebarTxtControl : public Control SwView& rDocView, SwPostItMgr& rPostItMgr ); virtual ~SidebarTxtControl(); + virtual void dispose() SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 93b3cae87068..d9485d76dda2 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -137,6 +137,14 @@ SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin, SwSidebarWin::~SwSidebarWin() { + disposeOnce(); +} + +void SwSidebarWin::dispose() +{ + if (IsDisposed()) + return; + mrMgr.DisconnectSidebarWinFromFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm), *this ); @@ -148,9 +156,8 @@ SwSidebarWin::~SwSidebarWin() { mpOutlinerView->SetWindow( 0 ); } - delete mpSidebarTxtControl; - mpSidebarTxtControl = 0; } + mpSidebarTxtControl.disposeAndClear(); if ( mpOutlinerView ) { @@ -167,23 +174,20 @@ SwSidebarWin::~SwSidebarWin() if (mpMetadataAuthor) { mpMetadataAuthor->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) ); - delete mpMetadataAuthor; - mpMetadataAuthor = 0; } + mpMetadataAuthor.disposeAndClear(); if (mpMetadataDate) { mpMetadataDate->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) ); - delete mpMetadataDate; - mpMetadataDate = 0; } + mpMetadataDate.disposeAndClear(); if (mpVScrollbar) { mpVScrollbar->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) ); - delete mpVScrollbar; - mpVScrollbar = 0; } + mpVScrollbar.disposeAndClear(); RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) ); @@ -196,11 +200,12 @@ SwSidebarWin::~SwSidebarWin() delete mpTextRangeOverlay; mpTextRangeOverlay = NULL; - delete mpMenuButton; - mpMenuButton = 0; + mpMenuButton.disposeAndClear(); if (mnEventId) Application::RemoveUserEvent( mnEventId ); + + vcl::Window::dispose(); } void SwSidebarWin::Paint( const Rectangle& rRect) @@ -351,13 +356,13 @@ void SwSidebarWin::InitControls() AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) ); // actual window which holds the user text - mpSidebarTxtControl = new SidebarTxtControl( *this, + mpSidebarTxtControl = VclPtr<SidebarTxtControl>::Create( *this, WB_NODIALOGCONTROL, mrView, mrMgr ); mpSidebarTxtControl->SetPointer(Pointer(POINTER_TEXT)); // window controls for author and date - mpMetadataAuthor = new Edit( this, 0 ); + mpMetadataAuthor = VclPtr<Edit>::Create( this, 0 ); mpMetadataAuthor->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) ); mpMetadataAuthor->EnableRTL(AllSettings::GetLayoutRTL()); mpMetadataAuthor->SetReadOnly(); @@ -376,7 +381,7 @@ void SwSidebarWin::InitControls() mpMetadataAuthor->SetSettings(aSettings); } - mpMetadataDate = new Edit( this, 0 ); + mpMetadataDate = VclPtr<Edit>::Create( this, 0 ); mpMetadataDate->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_DATE_NAME ) ); mpMetadataDate->EnableRTL(AllSettings::GetLayoutRTL()); mpMetadataDate->SetReadOnly(); @@ -410,7 +415,7 @@ void SwSidebarWin::InitControls() mpOutlinerView->SetAttribs(DefaultItem()); //create Scrollbars - mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); + mpVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); mpVScrollbar->EnableNativeWidget(false); mpVScrollbar->EnableRTL( false ); mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl)); @@ -1370,7 +1375,7 @@ void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayo bool SwSidebarWin::HasScrollbar() const { - return mpVScrollbar != 0; + return mpVScrollbar != nullptr; } bool SwSidebarWin::IsScrollbarVisible() const diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 22b968a1b4e3..71042f0aa7aa 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4968,17 +4968,36 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView &rMyView): SwEditWin::~SwEditWin() { + disposeOnce(); +} + +void SwEditWin::dispose() +{ m_aKeyInputTimer.Stop(); + delete m_pShadCrsr; + m_pShadCrsr = NULL; + delete m_pRowColumnSelectionStart; + m_pRowColumnSelectionStart = NULL; + if( m_pQuickHlpData->m_bIsDisplayed && m_rView.GetWrtShellPtr() ) m_pQuickHlpData->Stop( m_rView.GetWrtShell() ); g_bExecuteDrag = false; delete m_pApplyTempl; + m_pApplyTempl = NULL; + m_rView.SetDrawFuncPtr(NULL); delete m_pUserMarker; + m_pUserMarker = NULL; + delete m_pAnchorMarker; + m_pAnchorMarker = NULL; + + m_aFrameControlsManager.dispose(); + + vcl::Window::dispose(); } /** @@ -5061,9 +5080,10 @@ void SwEditWin::GetFocus() void SwEditWin::LoseFocus() { - m_rView.GetWrtShell().InvalidateAccessibleFocus(); + if (m_rView.GetWrtShellPtr()) + m_rView.GetWrtShell().InvalidateAccessibleFocus(); Window::LoseFocus(); - if( m_pQuickHlpData->m_bIsDisplayed ) + if( m_pQuickHlpData && m_pQuickHlpData->m_bIsDisplayed ) m_pQuickHlpData->Stop( m_rView.GetWrtShell() ); } diff --git a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx index 75ab9e95312b..2c037ffaf4bb 100644 --- a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx +++ b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx @@ -48,7 +48,7 @@ namespace { } }; - typedef ::std::map < SidebarWinKey, sw::sidebarwindows::SwSidebarWin*, SidebarWinOrder > SidebarWinContainer; + typedef ::std::map < SidebarWinKey, VclPtr<sw::sidebarwindows::SwSidebarWin>, SidebarWinOrder > SidebarWinContainer; struct FrmKey { diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index c4042d812873..5d2dac64c01f 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -268,7 +268,12 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ) n->addPropertiesChangeListener(s, listener_.get()); } - SwSrcEditWindow::~SwSrcEditWindow() +SwSrcEditWindow::~SwSrcEditWindow() +{ + disposeOnce(); +} + +void SwSrcEditWindow::dispose() { css::uno::Reference< css::beans::XMultiPropertySet > n; { @@ -284,13 +289,13 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ) EndListening( *pTextEngine ); pTextEngine->RemoveView( pTextView ); - delete pHScrollbar; - delete pVScrollbar; - delete pTextView; delete pTextEngine; } - delete pOutWin; + pHScrollbar.disposeAndClear(); + pVScrollbar.disposeAndClear(); + pOutWin.disposeAndClear(); + vcl::Window::dispose(); } void SwSrcEditWindow::DataChanged( const DataChangedEvent& rDCEvt ) @@ -482,18 +487,18 @@ void TextViewOutWin::Paint( const Rectangle& rRect ) void SwSrcEditWindow::CreateTextEngine() { const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor(); - pOutWin = new TextViewOutWin(this, 0); + pOutWin = VclPtr<TextViewOutWin>::Create(this, 0); pOutWin->SetBackground(Wallpaper(rCol)); pOutWin->SetPointer(Pointer(POINTER_TEXT)); pOutWin->Show(); // create Scrollbars - pHScrollbar = new ScrollBar(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG); + pHScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG); pHScrollbar->EnableRTL( false ); // --- RTL --- no mirroring for scrollbars pHScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl)); pHScrollbar->Show(); - pVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); + pVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); pVScrollbar->EnableRTL( false ); // --- RTL --- no mirroring for scrollbars pVScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl)); pHScrollbar->EnableDrag(); diff --git a/sw/source/uibase/envelp/syncbtn.cxx b/sw/source/uibase/envelp/syncbtn.cxx index a6b73da14126..e75751de5a31 100644 --- a/sw/source/uibase/envelp/syncbtn.cxx +++ b/sw/source/uibase/envelp/syncbtn.cxx @@ -37,7 +37,7 @@ SwSyncChildWin::SwSyncChildWin( vcl::Window* _pParent, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - pWindow = new SwSyncBtnDlg( pBindings, this, _pParent); + pWindow = VclPtr<SwSyncBtnDlg>::Create( pBindings, this, _pParent); if (!pInfo->aSize.Width() || !pInfo->aSize.Height()) { @@ -53,7 +53,7 @@ SwSyncChildWin::SwSyncChildWin( vcl::Window* _pParent, pInfo->aSize = pWindow->GetSizePixel(); } - static_cast<SwSyncBtnDlg *>(pWindow)->Initialize(pInfo); + static_cast<SwSyncBtnDlg *>(pWindow.get())->Initialize(pInfo); pWindow->Show(); } @@ -68,6 +68,17 @@ SwSyncBtnDlg::SwSyncBtnDlg( SfxBindings* _pBindings, Show(); } +SwSyncBtnDlg::~SwSyncBtnDlg() +{ + disposeOnce(); +} + +void SwSyncBtnDlg::dispose() +{ + m_pSyncBtn.clear(); + SfxFloatingWindow::dispose(); +} + IMPL_LINK_NOARG(SwSyncBtnDlg, BtnHdl) { SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SfxCallMode::ASYNCHRON); diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 89038314a97d..2c5df5343023 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -487,7 +487,13 @@ Size SwColumnOnlyExample::GetOptimalSize() const SwPageGridExample::~SwPageGridExample() { + disposeOnce(); +} + +void SwPageGridExample::dispose() +{ delete pGridItem; + SwPageExample::dispose(); } void SwPageGridExample::DrawPage( const Point& rOrg, diff --git a/sw/source/uibase/inc/DropDownFieldDialog.hxx b/sw/source/uibase/inc/DropDownFieldDialog.hxx index 19c42cf7dbfc..a7ef05f126f1 100644 --- a/sw/source/uibase/inc/DropDownFieldDialog.hxx +++ b/sw/source/uibase/inc/DropDownFieldDialog.hxx @@ -33,12 +33,12 @@ namespace sw { class DropDownFieldDialog : public SvxStandardDialog { - ListBox* m_pListItemsLB; + VclPtr<ListBox> m_pListItemsLB; - OKButton* m_pOKPB; - PushButton* m_pNextPB; + VclPtr<OKButton> m_pOKPB; + VclPtr<PushButton> m_pNextPB; - PushButton* m_pEditPB; + VclPtr<PushButton> m_pEditPB; SwWrtShell &rSh; SwDropDownField* pDropField; @@ -48,6 +48,8 @@ class DropDownFieldDialog : public SvxStandardDialog public: DropDownFieldDialog( vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bNextButton = false ); + virtual ~DropDownFieldDialog(); + virtual void dispose() SAL_OVERRIDE; }; } //namespace sw diff --git a/sw/source/uibase/inc/FrameControl.hxx b/sw/source/uibase/inc/FrameControl.hxx index 0235084c4160..936be2a1cbc8 100644 --- a/sw/source/uibase/inc/FrameControl.hxx +++ b/sw/source/uibase/inc/FrameControl.hxx @@ -17,7 +17,7 @@ class Point; */ class SwFrameControl { - SwEditWin* m_pEditWin; + VclPtr<SwEditWin> m_pEditWin; const SwFrm* m_pFrm; public: diff --git a/sw/source/uibase/inc/FrameControlsManager.hxx b/sw/source/uibase/inc/FrameControlsManager.hxx index 75585ea8fe0b..e87124b64be5 100644 --- a/sw/source/uibase/inc/FrameControlsManager.hxx +++ b/sw/source/uibase/inc/FrameControlsManager.hxx @@ -30,12 +30,13 @@ typedef std::map<const SwFrm*, SwFrameControlPtr> SwFrameControlPtrMap; class SwFrameControlsManager { private: - SwEditWin* m_pEditWin; + VclPtr<SwEditWin> m_pEditWin; std::map< FrameControlType, SwFrameControlPtrMap > m_aControls; public: SwFrameControlsManager( SwEditWin* pEditWin ); - ~SwFrameControlsManager( ); + ~SwFrameControlsManager(); + void dispose(); SwFrameControlsManager( const SwFrameControlsManager& rCopy ); const SwFrameControlsManager& operator=( const SwFrameControlsManager& rCopy ); diff --git a/sw/source/uibase/inc/HeaderFooterWin.hxx b/sw/source/uibase/inc/HeaderFooterWin.hxx index 6f151fd8ec69..32e30f5cc70b 100644 --- a/sw/source/uibase/inc/HeaderFooterWin.hxx +++ b/sw/source/uibase/inc/HeaderFooterWin.hxx @@ -20,10 +20,10 @@ */ class SwHeaderFooterWin : public MenuButton, public SwFrameControl { - OUString m_sLabel; + OUString m_sLabel; bool m_bIsHeader; PopupMenu* m_pPopupMenu; - vcl::Window* m_pLine; + VclPtr<vcl::Window> m_pLine; bool m_bIsAppearing; int m_nFadeRate; Timer m_aFadeTimer; @@ -31,6 +31,7 @@ class SwHeaderFooterWin : public MenuButton, public SwFrameControl public: SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm, bool bHeader ); virtual ~SwHeaderFooterWin( ); + virtual void dispose() SAL_OVERRIDE; void SetOffset( Point aOffset, long nXLineStart, long nXLineEnd ); diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx index ff28df16ca3f..d1b048fbc1a3 100644 --- a/sw/source/uibase/inc/PageBreakWin.hxx +++ b/sw/source/uibase/inc/PageBreakWin.hxx @@ -23,7 +23,7 @@ class SwPageFrm; class SwPageBreakWin : public MenuButton, public SwFrameControl { PopupMenu* m_pPopupMenu; - vcl::Window* m_pLine; + VclPtr<vcl::Window> m_pLine; bool m_bIsAppearing; int m_nFadeRate; int m_nDelayAppearing; ///< Before we show the control, let it transparent for a few timer ticks to avoid appearing with every mouse over. @@ -35,6 +35,7 @@ class SwPageBreakWin : public MenuButton, public SwFrameControl public: SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm ); virtual ~SwPageBreakWin( ); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Select( ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/abstract.hxx b/sw/source/uibase/inc/abstract.hxx index 92443efa9d9d..0c12d35e1812 100644 --- a/sw/source/uibase/inc/abstract.hxx +++ b/sw/source/uibase/inc/abstract.hxx @@ -25,13 +25,13 @@ class SwInsertAbstractDlg : public SfxModalDialog { - NumericField* m_pLevelNF; - NumericField* m_pParaNF; - -protected: + VclPtr<NumericField> m_pLevelNF; + VclPtr<NumericField> m_pParaNF; public: SwInsertAbstractDlg( vcl::Window* pParent ); + virtual ~SwInsertAbstractDlg(); + virtual void dispose() SAL_OVERRIDE; sal_uInt8 GetLevel() const; sal_uInt8 GetPara() const; diff --git a/sw/source/uibase/inc/ascfldlg.hxx b/sw/source/uibase/inc/ascfldlg.hxx index 827d5032bcbc..b7e693814c3c 100644 --- a/sw/source/uibase/inc/ascfldlg.hxx +++ b/sw/source/uibase/inc/ascfldlg.hxx @@ -32,14 +32,14 @@ class SwDocShell; class SwAsciiFilterDlg : public SfxModalDialog { - SvxTextEncodingBox* m_pCharSetLB; - FixedText* m_pFontFT; - ListBox* m_pFontLB; - FixedText* m_pLanguageFT; - SvxLanguageBox* m_pLanguageLB; - RadioButton* m_pCRLF_RB; - RadioButton* m_pCR_RB; - RadioButton* m_pLF_RB; + VclPtr<SvxTextEncodingBox> m_pCharSetLB; + VclPtr<FixedText> m_pFontFT; + VclPtr<ListBox> m_pFontLB; + VclPtr<FixedText> m_pLanguageFT; + VclPtr<SvxLanguageBox> m_pLanguageLB; + VclPtr<RadioButton> m_pCRLF_RB; + VclPtr<RadioButton> m_pCR_RB; + VclPtr<RadioButton> m_pLF_RB; bool m_bSaveLineStatus; DECL_LINK( CharSetSelHdl, SvxTextEncodingBox* ); @@ -53,6 +53,7 @@ public: SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, SvStream* pStream ); virtual ~SwAsciiFilterDlg(); + virtual void dispose() SAL_OVERRIDE; void FillOptions( SwAsciiOptions& rOptions ); }; diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx index d64a08e69a8f..1185317191d6 100644 --- a/sw/source/uibase/inc/bookmark.hxx +++ b/sw/source/uibase/inc/bookmark.hxx @@ -47,9 +47,9 @@ public: class SwInsertBookmarkDlg: public SvxStandardDialog { - BookmarkCombo* m_pBookmarkBox; - OKButton* m_pOkBtn; - PushButton* m_pDeleteBtn; + VclPtr<BookmarkCombo> m_pBookmarkBox; + VclPtr<OKButton> m_pOkBtn; + VclPtr<PushButton> m_pDeleteBtn; OUString sRemoveWarning; SwWrtShell &rSh; @@ -63,6 +63,7 @@ class SwInsertBookmarkDlg: public SvxStandardDialog public: SwInsertBookmarkDlg(vcl::Window *pParent, SwWrtShell &rSh, SfxRequest& rReq); virtual ~SwInsertBookmarkDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/break.hxx b/sw/source/uibase/inc/break.hxx index 55610b7dbe8c..85ce67b0ce26 100644 --- a/sw/source/uibase/inc/break.hxx +++ b/sw/source/uibase/inc/break.hxx @@ -37,13 +37,13 @@ class SwWrtShell; class SwBreakDlg: public SvxStandardDialog { SwWrtShell &rSh; - RadioButton* m_pLineBtn; - RadioButton* m_pColumnBtn; - RadioButton* m_pPageBtn; - FixedText* m_pPageCollText; - ListBox* m_pPageCollBox; - CheckBox* m_pPageNumBox; - NumericField* m_pPageNumEdit; + VclPtr<RadioButton> m_pLineBtn; + VclPtr<RadioButton> m_pColumnBtn; + VclPtr<RadioButton> m_pPageBtn; + VclPtr<FixedText> m_pPageCollText; + VclPtr<ListBox> m_pPageCollBox; + VclPtr<CheckBox> m_pPageNumBox; + VclPtr<NumericField> m_pPageNumEdit; OUString aTemplate; sal_uInt16 nKind; @@ -64,6 +64,7 @@ protected: public: SwBreakDlg( vcl::Window *pParent, SwWrtShell &rSh ); virtual ~SwBreakDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetTemplateName() { return aTemplate; } sal_uInt16 GetKind() { return nKind; } diff --git a/sw/source/uibase/inc/changedb.hxx b/sw/source/uibase/inc/changedb.hxx index 128d7aa8338d..c10948bab9c2 100644 --- a/sw/source/uibase/inc/changedb.hxx +++ b/sw/source/uibase/inc/changedb.hxx @@ -35,11 +35,11 @@ struct SwDBData; // exchange database at fields class SwChangeDBDlg: public SvxStandardDialog { - SvTreeListBox* m_pUsedDBTLB; - SwDBTreeList* m_pAvailDBTLB; - PushButton* m_pAddDBPB; - FixedText* m_pDocDBNameFT; - PushButton* m_pDefineBT; + VclPtr<SvTreeListBox> m_pUsedDBTLB; + VclPtr<SwDBTreeList> m_pAvailDBTLB; + VclPtr<PushButton> m_pAddDBPB; + VclPtr<FixedText> m_pDocDBNameFT; + VclPtr<PushButton> m_pDefineBT; ImageList aImageList; @@ -59,6 +59,7 @@ class SwChangeDBDlg: public SvxStandardDialog public: SwChangeDBDlg(SwView& rVw); virtual ~SwChangeDBDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/chrdlg.hxx b/sw/source/uibase/inc/chrdlg.hxx index 7c0520ade242..ff6f91b3a516 100644 --- a/sw/source/uibase/inc/chrdlg.hxx +++ b/sw/source/uibase/inc/chrdlg.hxx @@ -59,17 +59,17 @@ public: class SwCharURLPage : public SfxTabPage { - Edit* m_pURLED; - FixedText* m_pTextFT; - Edit* m_pTextED; - Edit* m_pNameED; - ComboBox* m_pTargetFrmLB; - PushButton* m_pURLPB; - PushButton* m_pEventPB; - ListBox* m_pVisitedLB; - ListBox* m_pNotVisitedLB; - - VclContainer* m_pCharStyleContainer; + VclPtr<Edit> m_pURLED; + VclPtr<FixedText> m_pTextFT; + VclPtr<Edit> m_pTextED; + VclPtr<Edit> m_pNameED; + VclPtr<ComboBox> m_pTargetFrmLB; + VclPtr<PushButton> m_pURLPB; + VclPtr<PushButton> m_pEventPB; + VclPtr<ListBox> m_pVisitedLB; + VclPtr<ListBox> m_pNotVisitedLB; + + VclPtr<VclContainer> m_pCharStyleContainer; SvxMacroItem* pINetItem; bool bModified; @@ -82,8 +82,9 @@ public: const SfxItemSet& rSet ); virtual ~SwCharURLPage(); - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx index ce03ddce93b2..638b3c78ab2a 100644 --- a/sw/source/uibase/inc/colex.hxx +++ b/sw/source/uibase/inc/colex.hxx @@ -57,6 +57,7 @@ public: m_bVertical(false){} virtual ~SwPageGridExample(); + virtual void dispose() SAL_OVERRIDE; void UpdateExample( const SfxItemSet& rSet ); }; diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx index d5efa31c7e59..fda9458182d6 100644 --- a/sw/source/uibase/inc/column.hxx +++ b/sw/source/uibase/inc/column.hxx @@ -42,10 +42,10 @@ class SwColumnPage; class SwColumnDlg : public SfxModalDialog { - ListBox* m_pApplyToLB; + VclPtr<ListBox> m_pApplyToLB; SwWrtShell& rWrtShell; - SwColumnPage* pTabPage; + VclPtr<SwColumnPage> pTabPage; SfxItemSet* pPageSet; SfxItemSet* pSectionSet; SfxItemSet* pSelectionSet; @@ -66,6 +66,7 @@ class SwColumnDlg : public SfxModalDialog public: SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh); virtual ~SwColumnDlg(); + virtual void dispose() SAL_OVERRIDE; SwWrtShell& GetWrtShell() { return rWrtShell; } }; @@ -88,39 +89,39 @@ public: // column dialog now as TabPage class SwColumnPage : public SfxTabPage { - NumericField* m_pCLNrEdt; - ColumnValueSet* m_pDefaultVS; - CheckBox* m_pBalanceColsCB; + VclPtr<NumericField> m_pCLNrEdt; + VclPtr<ColumnValueSet> m_pDefaultVS; + VclPtr<CheckBox> m_pBalanceColsCB; - PushButton* m_pBtnBack; - FixedText* m_pLbl1; + VclPtr<PushButton> m_pBtnBack; + VclPtr<FixedText> m_pLbl1; PercentField aEd1; - FixedText* m_pLbl2; + VclPtr<FixedText> m_pLbl2; PercentField aEd2; - FixedText* m_pLbl3; + VclPtr<FixedText> m_pLbl3; PercentField aEd3; - PushButton* m_pBtnNext; + VclPtr<PushButton> m_pBtnNext; PercentField aDistEd1; PercentField aDistEd2; - CheckBox* m_pAutoWidthBox; - - FixedText* m_pLineTypeLbl; - LineListBox* m_pLineTypeDLB; - FixedText* m_pLineWidthLbl; - MetricField* m_pLineWidthEdit; - FixedText* m_pLineColorLbl; - ColorListBox* m_pLineColorDLB; - FixedText* m_pLineHeightLbl; - MetricField* m_pLineHeightEdit; - FixedText* m_pLinePosLbl; - ListBox* m_pLinePosDLB; - - FixedText* m_pTextDirectionFT; - ListBox* m_pTextDirectionLB; + VclPtr<CheckBox> m_pAutoWidthBox; + + VclPtr<FixedText> m_pLineTypeLbl; + VclPtr<LineListBox> m_pLineTypeDLB; + VclPtr<FixedText> m_pLineWidthLbl; + VclPtr<MetricField> m_pLineWidthEdit; + VclPtr<FixedText> m_pLineColorLbl; + VclPtr<ColorListBox> m_pLineColorDLB; + VclPtr<FixedText> m_pLineHeightLbl; + VclPtr<MetricField> m_pLineHeightEdit; + VclPtr<FixedText> m_pLinePosLbl; + VclPtr<ListBox> m_pLinePosDLB; + + VclPtr<FixedText> m_pTextDirectionFT; + VclPtr<ListBox> m_pTextDirectionLB; // Example - SwColExample* m_pPgeExampleWN; - SwColumnOnlyExample* m_pFrmExampleWN; + VclPtr<SwColExample> m_pPgeExampleWN; + VclPtr<SwColumnOnlyExample> m_pFrmExampleWN; SwColMgr* pColMgr; @@ -131,7 +132,7 @@ class SwColumnPage : public SfxTabPage sal_uInt16 nMinWidth; PercentField* pModifiedField; - std::map<MetricField*, PercentField*> m_aPercentFieldsMap; + std::map<VclPtr<MetricField>, PercentField*> m_aPercentFieldsMap; bool bFormat; bool bFrm; @@ -163,8 +164,6 @@ class SwColumnPage : public SfxTabPage virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE; - SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet); - void connectPercentField(PercentField &rWrap, const OString &rName); bool isLineNotNone() const; @@ -172,9 +171,11 @@ class SwColumnPage : public SfxTabPage static const sal_uInt16 aPageRg[]; public: + SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwColumnPage(); + 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() { return aPageRg; } virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 080572081d5a..ee23a095d861 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -144,6 +144,7 @@ protected: public: SwContentTree(vcl::Window* pParent, const ResId& rResId); virtual ~SwContentTree(); + virtual void dispose() SAL_OVERRIDE; OUString GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE; OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const SAL_OVERRIDE; SdrObject* GetDrawingObjectsByContent(const SwContent *pCnt); @@ -232,11 +233,11 @@ private: ImageList aEntryImages; SwWrtShell* pActiveShell; - SvTreeListEntry* pEmphasisEntry; // Drag'n Drop emphasis - SvTreeListEntry* pDDSource; // source for Drag'n Drop + SvTreeListEntry* pEmphasisEntry; // Drag'n Drop emphasis + SvTreeListEntry* pDDSource; // source for Drag'n Drop SwGlblDocContents* pSwGlblDocContents; // array with sorted content - vcl::Window* pDefParentWin; + VclPtr<vcl::Window> pDefParentWin; SwGlblDocContent* pDocContent; sfx2::DocumentInserter* pDocInserter; @@ -313,6 +314,7 @@ protected: public: SwGlobalTree(vcl::Window* pParent, const ResId& rResId); virtual ~SwGlobalTree(); + virtual void dispose() SAL_OVERRIDE; void TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox); void InsertRegion( const SwGlblDocContent* pCont, diff --git a/sw/source/uibase/inc/convert.hxx b/sw/source/uibase/inc/convert.hxx index 8b803bfee2db..1a52d8ba2c99 100644 --- a/sw/source/uibase/inc/convert.hxx +++ b/sw/source/uibase/inc/convert.hxx @@ -32,24 +32,24 @@ struct SwInsertTableOptions; class SwConvertTableDlg: public SfxModalDialog { - RadioButton* mpTabBtn; - RadioButton* mpSemiBtn; - RadioButton* mpParaBtn; - RadioButton* mpOtherBtn; - Edit* mpOtherEd; - CheckBox* mpKeepColumn; + VclPtr<RadioButton> mpTabBtn; + VclPtr<RadioButton> mpSemiBtn; + VclPtr<RadioButton> mpParaBtn; + VclPtr<RadioButton> mpOtherBtn; + VclPtr<Edit> mpOtherEd; + VclPtr<CheckBox> mpKeepColumn; - VclContainer* mpOptions; + VclPtr<VclContainer> mpOptions; - CheckBox* mpHeaderCB; - CheckBox* mpRepeatHeaderCB; + VclPtr<CheckBox> mpHeaderCB; + VclPtr<CheckBox> mpRepeatHeaderCB; - VclContainer* mpRepeatRows; - NumericField* mpRepeatHeaderNF; + VclPtr<VclContainer> mpRepeatRows; + VclPtr<NumericField> mpRepeatHeaderNF; - CheckBox* mpDontSplitCB; - CheckBox* mpBorderCB; - PushButton* mpAutoFmtBtn; + VclPtr<CheckBox> mpDontSplitCB; + VclPtr<CheckBox> mpBorderCB; + VclPtr<PushButton> mpAutoFmtBtn; OUString sConvertTextTable; SwTableAutoFmt* pTAutoFmt; @@ -63,6 +63,7 @@ class SwConvertTableDlg: public SfxModalDialog public: SwConvertTableDlg( SwView& rView, bool bToTable ); virtual ~SwConvertTableDlg(); + virtual void dispose() SAL_OVERRIDE; void GetValues( sal_Unicode& rDelim, SwInsertTableOptions& rInsTblOpts, diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx index 98ed59d65c0d..5f99c2025360 100644 --- a/sw/source/uibase/inc/cption.hxx +++ b/sw/source/uibase/inc/cption.hxx @@ -63,24 +63,24 @@ public: class SwCaptionDialog : public SvxStandardDialog { - Edit* m_pTextEdit; - ComboBox* m_pCategoryBox; + VclPtr<Edit> m_pTextEdit; + VclPtr<ComboBox> m_pCategoryBox; OUString m_sNone; TextFilterAutoConvert m_aTextFilter; - FixedText* m_pFormatText; - ListBox* m_pFormatBox; + VclPtr<FixedText> m_pFormatText; + VclPtr<ListBox> m_pFormatBox; //#i61007# order of captions - FixedText* m_pNumberingSeparatorFT; - Edit* m_pNumberingSeparatorED; - FixedText* m_pSepText; - Edit* m_pSepEdit; - FixedText* m_pPosText; - ListBox* m_pPosBox; - OKButton* m_pOKButton; - PushButton* m_pAutoCaptionButton; - PushButton* m_pOptionButton; - - SwCaptionPreview* m_pPreview; + VclPtr<FixedText> m_pNumberingSeparatorFT; + VclPtr<Edit> m_pNumberingSeparatorED; + VclPtr<FixedText> m_pSepText; + VclPtr<Edit> m_pSepEdit; + VclPtr<FixedText> m_pPosText; + VclPtr<ListBox> m_pPosBox; + VclPtr<OKButton> m_pOKButton; + VclPtr<PushButton> m_pAutoCaptionButton; + VclPtr<PushButton> m_pOptionButton; + + VclPtr<SwCaptionPreview> m_pPreview; SwView &rView; // search per active, avoid View SwFldMgr *pMgr; // pointer to save the include @@ -109,6 +109,7 @@ class SwCaptionDialog : public SvxStandardDialog public: SwCaptionDialog( vcl::Window *pParent, SwView &rV ); virtual ~SwCaptionDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx index e48f422fed9a..260a7fcc96e1 100644 --- a/sw/source/uibase/inc/dbinsdlg.hxx +++ b/sw/source/uibase/inc/dbinsdlg.hxx @@ -87,38 +87,38 @@ public: class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem { - RadioButton* m_pRbAsTable; - RadioButton* m_pRbAsField; - RadioButton* m_pRbAsText; + VclPtr<RadioButton> m_pRbAsTable; + VclPtr<RadioButton> m_pRbAsField; + VclPtr<RadioButton> m_pRbAsText; - VclFrame* m_pHeadFrame; + VclPtr<VclFrame> m_pHeadFrame; - ListBox* m_pLbTblDbColumn; - ListBox* m_pLbTxtDbColumn; + VclPtr<ListBox> m_pLbTblDbColumn; + VclPtr<ListBox> m_pLbTxtDbColumn; - VclFrame* m_pFormatFrame; - RadioButton* m_pRbDbFmtFromDb; - RadioButton* m_pRbDbFmtFromUsr; - NumFormatListBox* m_pLbDbFmtFromUsr; + VclPtr<VclFrame> m_pFormatFrame; + VclPtr<RadioButton> m_pRbDbFmtFromDb; + VclPtr<RadioButton> m_pRbDbFmtFromUsr; + VclPtr<NumFormatListBox> m_pLbDbFmtFromUsr; // Page Text/Field - PushButton* m_pIbDbcolToEdit; - VclMultiLineEdit* m_pEdDbText; - FixedText* m_pFtDbParaColl; - ListBox* m_pLbDbParaColl; + VclPtr<PushButton> m_pIbDbcolToEdit; + VclPtr<VclMultiLineEdit> m_pEdDbText; + VclPtr<FixedText> m_pFtDbParaColl; + VclPtr<ListBox> m_pLbDbParaColl; // Page Table - PushButton* m_pIbDbcolAllTo; - PushButton* m_pIbDbcolOneTo; - PushButton* m_pIbDbcolOneFrom; - PushButton* m_pIbDbcolAllFrom; - FixedText* m_pFtTableCol; - ListBox* m_pLbTableCol; - CheckBox* m_pCbTableHeadon; - RadioButton* m_pRbHeadlColnms; - RadioButton* m_pRbHeadlEmpty; - PushButton* m_pPbTblFormat; - PushButton* m_pPbTblAutofmt; + VclPtr<PushButton> m_pIbDbcolAllTo; + VclPtr<PushButton> m_pIbDbcolOneTo; + VclPtr<PushButton> m_pIbDbcolOneFrom; + VclPtr<PushButton> m_pIbDbcolAllFrom; + VclPtr<FixedText> m_pFtTableCol; + VclPtr<ListBox> m_pLbTableCol; + VclPtr<CheckBox> m_pCbTableHeadon; + VclPtr<RadioButton> m_pRbHeadlColnms; + VclPtr<RadioButton> m_pRbHeadlEmpty; + VclPtr<PushButton> m_pPbTblFormat; + VclPtr<PushButton> m_pPbTblAutofmt; SwInsDBColumns aDBColumns; const SwDBData aDBData; @@ -158,6 +158,7 @@ public: const SwDBData& rData ); virtual ~SwInsertDBColAutoPilot(); + virtual void dispose() SAL_OVERRIDE; void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection, ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource, diff --git a/sw/source/uibase/inc/dbtree.hxx b/sw/source/uibase/inc/dbtree.hxx index e41d911bf141..94179d40e062 100644 --- a/sw/source/uibase/inc/dbtree.hxx +++ b/sw/source/uibase/inc/dbtree.hxx @@ -54,6 +54,7 @@ class SW_DLLPUBLIC SwDBTreeList : public SvTreeListBox public: SwDBTreeList(vcl::Window* pParent, WinBits nStyle); virtual ~SwDBTreeList(); + virtual void dispose() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE; OUString GetDBName( OUString& rTableName, OUString& rColumnName, sal_Bool* pbIsTable = 0); diff --git a/sw/source/uibase/inc/dbui.hxx b/sw/source/uibase/inc/dbui.hxx index 0649bcb9ca6e..879da6302939 100644 --- a/sw/source/uibase/inc/dbui.hxx +++ b/sw/source/uibase/inc/dbui.hxx @@ -29,7 +29,7 @@ class SW_DLLPUBLIC CancelableDialog : public Dialog bool mbModal; protected: - CancelButton* m_pCancelButton; + VclPtr<CancelButton> m_pCancelButton; CancelableDialog( vcl::Window *pParent, bool modal, const OUString& rID, const OUString& rUIXMLDescription ); @@ -40,6 +40,8 @@ protected: public: virtual ~CancelableDialog(); + virtual void dispose() SAL_OVERRIDE; + void SetCancelHdl( const Link& rLink ); void Show(); }; @@ -53,18 +55,22 @@ public: MONITOR_TYPE_SAVE }; - FixedText* m_pDocName; - FixedText* m_pPrinting; - FixedText* m_pPrinter; - FixedText* m_pPrintInfo; + VclPtr<FixedText> m_pDocName; + VclPtr<FixedText> m_pPrinting; + VclPtr<FixedText> m_pPrinter; + VclPtr<FixedText> m_pPrintInfo; PrintMonitor( vcl::Window *pParent, bool modal, PrintMonitorType eType ); + virtual ~PrintMonitor(); + virtual void dispose() SAL_OVERRIDE; }; class CreateMonitor : public CancelableDialog { public: CreateMonitor( vcl::Window *pParent, bool modal ); + virtual ~CreateMonitor(); + virtual void dispose() SAL_OVERRIDE; void SetTotalCount( sal_Int32 nTotal ); void SetCurrentPosition( sal_Int32 nCurrent ); @@ -73,7 +79,7 @@ private: void UpdateCountingText(); private: - FixedText* m_pCounting; + VclPtr<FixedText> m_pCounting; OUString m_sCountingPattern; OUString m_sVariable_Total; diff --git a/sw/source/uibase/inc/docstdlg.hxx b/sw/source/uibase/inc/docstdlg.hxx index e02a80ea0369..ce769478e3b2 100644 --- a/sw/source/uibase/inc/docstdlg.hxx +++ b/sw/source/uibase/inc/docstdlg.hxx @@ -32,8 +32,9 @@ class SwDocStatPage: public SfxTabPage public: SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwDocStatPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); protected: virtual bool FillItemSet( SfxItemSet *rSet) SAL_OVERRIDE; @@ -42,18 +43,18 @@ protected: DECL_LINK(UpdateHdl, void *); private: - FixedText* m_pPageNo; - FixedText* m_pTableNo; - FixedText* m_pGrfNo; - FixedText* m_pOLENo; - FixedText* m_pParaNo; - FixedText* m_pWordNo; - FixedText* m_pCharNo; - FixedText* m_pCharExclSpacesNo; + VclPtr<FixedText> m_pPageNo; + VclPtr<FixedText> m_pTableNo; + VclPtr<FixedText> m_pGrfNo; + VclPtr<FixedText> m_pOLENo; + VclPtr<FixedText> m_pParaNo; + VclPtr<FixedText> m_pWordNo; + VclPtr<FixedText> m_pCharNo; + VclPtr<FixedText> m_pCharExclSpacesNo; - FixedText* m_pLineLbl; - FixedText* m_pLineNo; - PushButton* m_pUpdatePB; + VclPtr<FixedText> m_pLineLbl; + VclPtr<FixedText> m_pLineNo; + VclPtr<PushButton> m_pUpdatePB; SwDocStat aDocStat; diff --git a/sw/source/uibase/inc/drawbase.hxx b/sw/source/uibase/inc/drawbase.hxx index b6aa7ea849ce..42c3adada3d1 100644 --- a/sw/source/uibase/inc/drawbase.hxx +++ b/sw/source/uibase/inc/drawbase.hxx @@ -33,7 +33,7 @@ class SwDrawBase protected: SwView* m_pView; SwWrtShell* m_pSh; - SwEditWin* m_pWin; + VclPtr<SwEditWin> m_pWin; Point m_aStartPos; // position of BeginCreate Point m_aMDPos; // position of MouseButtonDown sal_uInt16 m_nSlotId; diff --git a/sw/source/uibase/inc/drpcps.hxx b/sw/source/uibase/inc/drpcps.hxx index f24a6051f4b3..c54fdf8c48a7 100644 --- a/sw/source/uibase/inc/drpcps.hxx +++ b/sw/source/uibase/inc/drpcps.hxx @@ -45,20 +45,20 @@ class SwDropCapsPict; class SwDropCapsPage : public SfxTabPage { friend class SwDropCapsPict; - CheckBox* m_pDropCapsBox; - CheckBox* m_pWholeWordCB; - FixedText* m_pSwitchText; - NumericField* m_pDropCapsField; - FixedText* m_pLinesText; - NumericField* m_pLinesField; - FixedText* m_pDistanceText; - MetricField* m_pDistanceField; - FixedText* m_pTextText; - Edit* m_pTextEdit; - FixedText* m_pTemplateText; - ListBox* m_pTemplateBox; - - SwDropCapsPict* m_pPict; + VclPtr<CheckBox> m_pDropCapsBox; + VclPtr<CheckBox> m_pWholeWordCB; + VclPtr<FixedText> m_pSwitchText; + VclPtr<NumericField> m_pDropCapsField; + VclPtr<FixedText> m_pLinesText; + VclPtr<NumericField> m_pLinesField; + VclPtr<FixedText> m_pDistanceText; + VclPtr<MetricField> m_pDistanceField; + VclPtr<FixedText> m_pTextText; + VclPtr<Edit> m_pTextEdit; + VclPtr<FixedText> m_pTemplateText; + VclPtr<ListBox> m_pTemplateBox; + + VclPtr<SwDropCapsPict> m_pPict; bool bModified; bool bFormat; @@ -66,9 +66,6 @@ friend class SwDropCapsPict; SwWrtShell &rSh; - SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet); - virtual ~SwDropCapsPage(); - virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE; void FillSet( SfxItemSet &rSet ); @@ -83,8 +80,11 @@ friend class SwDropCapsPict; static const sal_uInt16 aPageRg[]; public: + SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet); + virtual ~SwDropCapsPage(); + 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() { return aPageRg; } diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index ae961362af52..aaf06adaa854 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -296,6 +296,8 @@ public: SwEditWin(vcl::Window *pParent, SwView &); virtual ~SwEditWin(); + virtual void dispose() SAL_OVERRIDE; + /// @see OutputDevice::LogicInvalidate(). void LogicInvalidate(const Rectangle* pRectangle) SAL_OVERRIDE; /// Same as MouseButtonDown(), but coordinates are in logic unit. diff --git a/sw/source/uibase/inc/envlop.hxx b/sw/source/uibase/inc/envlop.hxx index 1cbd63545850..962dd8ca8dd1 100644 --- a/sw/source/uibase/inc/envlop.hxx +++ b/sw/source/uibase/inc/envlop.hxx @@ -62,7 +62,7 @@ friend class SwEnvPreview; SwEnvItem aEnvItem; SwWrtShell *pSh; - Printer *pPrinter; + VclPtr<Printer> pPrinter; SfxItemSet *pAddresseeSet; SfxItemSet *pSenderSet; sal_uInt16 m_nEnvPrintId; @@ -73,25 +73,23 @@ friend class SwEnvPreview; public: SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert); virtual ~SwEnvDlg(); + virtual void dispose() SAL_OVERRIDE; }; class SwEnvPage : public SfxTabPage { - VclMultiLineEdit* m_pAddrEdit; - ListBox* m_pDatabaseLB; - ListBox* m_pTableLB; - ListBox* m_pDBFieldLB; - PushButton* m_pInsertBT; - CheckBox* m_pSenderBox; - VclMultiLineEdit* m_pSenderEdit; - SwEnvPreview* m_pPreview; + VclPtr<VclMultiLineEdit> m_pAddrEdit; + VclPtr<ListBox> m_pDatabaseLB; + VclPtr<ListBox> m_pTableLB; + VclPtr<ListBox> m_pDBFieldLB; + VclPtr<PushButton> m_pInsertBT; + VclPtr<CheckBox> m_pSenderBox; + VclPtr<VclMultiLineEdit> m_pSenderEdit; + VclPtr<SwEnvPreview> m_pPreview; SwWrtShell* pSh; OUString sActDBName; - SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet); - virtual ~SwEnvPage(); - DECL_LINK( DatabaseHdl, ListBox * ); DECL_LINK(FieldHdl, void *); DECL_LINK(SenderHdl, void *); @@ -104,8 +102,11 @@ class SwEnvPage : public SfxTabPage using SfxTabPage::DeactivatePage; public: + SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwEnvPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/fldedt.hxx b/sw/source/uibase/inc/fldedt.hxx index 26dc320e0a04..626dc917c8fa 100644 --- a/sw/source/uibase/inc/fldedt.hxx +++ b/sw/source/uibase/inc/fldedt.hxx @@ -28,21 +28,22 @@ class SwFldMgr; class SwFldEditDlg : public SfxSingleTabDialog { SwWrtShell* pSh; - PushButton* m_pPrevBT; - PushButton* m_pNextBT; - PushButton* m_pAddressBT; + VclPtr<PushButton> m_pPrevBT; + VclPtr<PushButton> m_pNextBT; + VclPtr<PushButton> m_pAddressBT; DECL_LINK(AddressHdl, void *); DECL_LINK(NextPrevHdl, Button *pBt = 0); void Init(); - SfxTabPage* CreatePage(sal_uInt16 nGroup); + VclPtr<SfxTabPage> CreatePage(sal_uInt16 nGroup); void EnsureSelection(SwField *pCurFld, SwFldMgr &rMgr); public: SwFldEditDlg(SwView& rVw); virtual ~SwFldEditDlg(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK(OKHdl, void *); diff --git a/sw/source/uibase/inc/fldmgr.hxx b/sw/source/uibase/inc/fldmgr.hxx index e24f19d89303..57cfeda448c8 100644 --- a/sw/source/uibase/inc/fldmgr.hxx +++ b/sw/source/uibase/inc/fldmgr.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Any.h> #include <vector> +#include <vcl/vclptr.hxx> namespace com{namespace sun{namespace star{ namespace container{ @@ -75,7 +76,7 @@ struct SwInsertFld_Data ::com::sun::star::uno::Any aDBDataSource; ::com::sun::star::uno::Any aDBConnection; ::com::sun::star::uno::Any aDBColumn; - vcl::Window* pParent; // parent dialog used for SwWrtShell::StartInputFldDlg() + VclPtr<vcl::Window> pParent; // parent dialog used for SwWrtShell::StartInputFldDlg() SwInsertFld_Data(sal_uInt16 nType, sal_uInt16 nSub, const OUString& rPar1, const OUString& rPar2, sal_uLong nFmtId, SwWrtShell* pShell = NULL, sal_Unicode cSep = ' ', bool bIsAutoLanguage = true) : diff --git a/sw/source/uibase/inc/formedt.hxx b/sw/source/uibase/inc/formedt.hxx index 118869e93e74..32f6d8e7de8d 100644 --- a/sw/source/uibase/inc/formedt.hxx +++ b/sw/source/uibase/inc/formedt.hxx @@ -50,23 +50,23 @@ class SwIdxFormDlg : public SvxStandardDialog void UpdatePattern(); void Apply() SAL_OVERRIDE; - ListBox aEntryLB; - OKButton aOKBtn; - CancelButton aCancelBT; - FixedText aLevelFT; - Edit aEntryED; - PushButton aEntryBT; - PushButton aTabBT; - PushButton aPageBT; - PushButton aJumpBT; - FixedLine aEntryFL; - FixedText aLevelFT2; - ListBox aLevelLB; - FixedText aTemplateFT; - ListBox aParaLayLB; - PushButton aStdBT; - PushButton aAssignBT; - FixedLine aFormatFL; + VclPtr<ListBox> aEntryLB; + VclPtr<OKButton> aOKBtn; + VclPtr<CancelButton> aCancelBT; + VclPtr<FixedText> aLevelFT; + VclPtr<Edit> aEntryED; + VclPtr<PushButton> aEntryBT; + VclPtr<PushButton> aTabBT; + VclPtr<PushButton> aPageBT; + VclPtr<PushButton> aJumpBT; + VclPtr<FixedLine> aEntryFL; + VclPtr<FixedText> aLevelFT2; + VclPtr<ListBox> aLevelLB; + VclPtr<FixedText> aTemplateFT; + VclPtr<ListBox> aParaLayLB; + VclPtr<PushButton> aStdBT; + VclPtr<PushButton> aAssignBT; + VclPtr<FixedLine> aFormatFL; SwWrtShell &rSh; SwForm *pForm; @@ -76,6 +76,7 @@ class SwIdxFormDlg : public SvxStandardDialog public: SwIdxFormDlg( vcl::Window* pParent, SwWrtShell &rShell, const SwForm& rForm ); virtual ~SwIdxFormDlg(); + virtual void dispose() SAL_OVERRIDE; const SwForm& GetTOXForm(); }; diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx index 6d5ab8e198ee..88498685c99e 100644 --- a/sw/source/uibase/inc/frmpage.hxx +++ b/sw/source/uibase/inc/frmpage.hxx @@ -42,52 +42,52 @@ struct SwPosition; class SwFrmPage: public SfxTabPage { // size - FixedText* m_pWidthFT; - FixedText* m_pWidthAutoFT; - PercentField m_aWidthED; - CheckBox* m_pRelWidthCB; - ListBox* m_pRelWidthRelationLB; - CheckBox* m_pAutoWidthCB; - - FixedText* m_pHeightFT; - FixedText* m_pHeightAutoFT; - PercentField m_aHeightED; - CheckBox* m_pRelHeightCB; - ListBox* m_pRelHeightRelationLB; - CheckBox* m_pAutoHeightCB; - - CheckBox* m_pFixedRatioCB; - PushButton* m_pRealSizeBT; + VclPtr<FixedText> m_pWidthFT; + VclPtr<FixedText> m_pWidthAutoFT; + PercentField m_aWidthED; + VclPtr<CheckBox> m_pRelWidthCB; + VclPtr<ListBox> m_pRelWidthRelationLB; + VclPtr<CheckBox> m_pAutoWidthCB; + + VclPtr<FixedText> m_pHeightFT; + VclPtr<FixedText> m_pHeightAutoFT; + PercentField m_aHeightED; + VclPtr<CheckBox> m_pRelHeightCB; + VclPtr<ListBox> m_pRelHeightRelationLB; + VclPtr<CheckBox> m_pAutoHeightCB; + + VclPtr<CheckBox> m_pFixedRatioCB; + VclPtr<PushButton> m_pRealSizeBT; // anchor - VclContainer* m_pAnchorFrame; - RadioButton* m_pAnchorAtPageRB; - RadioButton* m_pAnchorAtParaRB; - RadioButton* m_pAnchorAtCharRB; - RadioButton* m_pAnchorAsCharRB; - RadioButton* m_pAnchorAtFrameRB; + VclPtr<VclContainer> m_pAnchorFrame; + VclPtr<RadioButton> m_pAnchorAtPageRB; + VclPtr<RadioButton> m_pAnchorAtParaRB; + VclPtr<RadioButton> m_pAnchorAtCharRB; + VclPtr<RadioButton> m_pAnchorAsCharRB; + VclPtr<RadioButton> m_pAnchorAtFrameRB; // position - FixedText* m_pHorizontalFT; - ListBox* m_pHorizontalDLB; - FixedText* m_pAtHorzPosFT; - MetricField* m_pAtHorzPosED; - FixedText* m_pHoriRelationFT; - ListBox* m_pHoriRelationLB; - - CheckBox* m_pMirrorPagesCB; - - FixedText* m_pVerticalFT; - ListBox* m_pVerticalDLB; - FixedText* m_pAtVertPosFT; - MetricField* m_pAtVertPosED; - FixedText* m_pVertRelationFT; - ListBox* m_pVertRelationLB; + VclPtr<FixedText> m_pHorizontalFT; + VclPtr<ListBox> m_pHorizontalDLB; + VclPtr<FixedText> m_pAtHorzPosFT; + VclPtr<MetricField> m_pAtHorzPosED; + VclPtr<FixedText> m_pHoriRelationFT; + VclPtr<ListBox> m_pHoriRelationLB; + + VclPtr<CheckBox> m_pMirrorPagesCB; + + VclPtr<FixedText> m_pVerticalFT; + VclPtr<ListBox> m_pVerticalDLB; + VclPtr<FixedText> m_pAtVertPosFT; + VclPtr<MetricField> m_pAtVertPosED; + VclPtr<FixedText> m_pVertRelationFT; + VclPtr<ListBox> m_pVertRelationLB; // #i18732# - check box for new option 'FollowTextFlow' - CheckBox* m_pFollowTextFlowCB; + VclPtr<CheckBox> m_pFollowTextFlowCB; // example - SvxSwFrameExample* m_pExampleWN; + VclPtr<SvxSwFrameExample> m_pExampleWN; //'string provider' SvxSwFramePosString aFramePosString; @@ -174,9 +174,6 @@ class SwFrmPage: public SfxTabPage void EnableGraficMode(); // hides auto check boxes and re-org controls for "Real Size" button - SwFrmPage(vcl::Window *pParent, const SfxItemSet &rSet); - virtual ~SwFrmPage(); - SwWrtShell *getFrmDlgParentShell(); using SfxTabPage::ActivatePage; @@ -185,8 +182,11 @@ class SwFrmPage: public SfxTabPage static const sal_uInt16 aPageRg[]; public: + SwFrmPage(vcl::Window *pParent, const SfxItemSet &rSet); + virtual ~SwFrmPage(); + 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() { return aPageRg; } virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; @@ -202,16 +202,16 @@ public: class SwGrfExtPage: public SfxTabPage { // mirror - VclContainer* m_pMirror; - CheckBox* m_pMirrorVertBox; - CheckBox* m_pMirrorHorzBox; - RadioButton* m_pAllPagesRB; - RadioButton* m_pLeftPagesRB; - RadioButton* m_pRightPagesRB; - BmpWindow* m_pBmpWin; + VclPtr<VclContainer> m_pMirror; + VclPtr<CheckBox> m_pMirrorVertBox; + VclPtr<CheckBox> m_pMirrorHorzBox; + VclPtr<RadioButton> m_pAllPagesRB; + VclPtr<RadioButton> m_pLeftPagesRB; + VclPtr<RadioButton> m_pRightPagesRB; + VclPtr<BmpWindow> m_pBmpWin; - Edit* m_pConnectED; - PushButton* m_pBrowseBT; + VclPtr<Edit> m_pConnectED; + VclPtr<PushButton> m_pBrowseBT; OUString aFilterName; OUString aGrfName, aNewGrfName; @@ -225,15 +225,16 @@ class SwGrfExtPage: public SfxTabPage DECL_LINK(BrowseHdl, void *); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; - SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwGrfExtPage(); + virtual void dispose() SAL_OVERRIDE; using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; public: + SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet); - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE; @@ -243,26 +244,26 @@ public: class SwFrmURLPage : public SfxTabPage { // hyperlink - Edit* pURLED; - PushButton* pSearchPB; - Edit* pNameED; - ComboBox* pFrameCB; + VclPtr<Edit> pURLED; + VclPtr<PushButton> pSearchPB; + VclPtr<Edit> pNameED; + VclPtr<ComboBox> pFrameCB; // image map - CheckBox* pServerCB; - CheckBox* pClientCB; + VclPtr<CheckBox> pServerCB; + VclPtr<CheckBox> pClientCB; DECL_LINK(InsertFileHdl, void *); - SwFrmURLPage(vcl::Window *pParent, const SfxItemSet &rSet); - virtual ~SwFrmURLPage(); - using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; public: + SwFrmURLPage(vcl::Window *pParent, const SfxItemSet &rSet); + virtual ~SwFrmURLPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE; @@ -270,29 +271,29 @@ public: class SwFrmAddPage : public SfxTabPage { - VclContainer* pNameFrame; - FixedText* pNameFT; - Edit* pNameED; - FixedText* pAltNameFT; - Edit* pAltNameED; - FixedText* pPrevFT; - ListBox* pPrevLB; - FixedText* pNextFT; - ListBox* pNextLB; - - VclContainer* pProtectFrame; - CheckBox* pProtectContentCB; - CheckBox* pProtectFrameCB; - CheckBox* pProtectSizeCB; - - VclContainer* m_pContentAlignFrame; - ListBox* m_pVertAlignLB; - - VclContainer* pPropertiesFrame; - CheckBox* pEditInReadonlyCB; - CheckBox* pPrintFrameCB; - FixedText* pTextFlowFT; - ListBox* pTextFlowLB; + VclPtr<VclContainer> pNameFrame; + VclPtr<FixedText> pNameFT; + VclPtr<Edit> pNameED; + VclPtr<FixedText> pAltNameFT; + VclPtr<Edit> pAltNameED; + VclPtr<FixedText> pPrevFT; + VclPtr<ListBox> pPrevLB; + VclPtr<FixedText> pNextFT; + VclPtr<ListBox> pNextLB; + + VclPtr<VclContainer> pProtectFrame; + VclPtr<CheckBox> pProtectContentCB; + VclPtr<CheckBox> pProtectFrameCB; + VclPtr<CheckBox> pProtectSizeCB; + + VclPtr<VclContainer> m_pContentAlignFrame; + VclPtr<ListBox> m_pVertAlignLB; + + VclPtr<VclContainer> pPropertiesFrame; + VclPtr<CheckBox> pEditInReadonlyCB; + VclPtr<CheckBox> pPrintFrameCB; + VclPtr<FixedText> pTextFlowFT; + VclPtr<ListBox> pTextFlowLB; SwWrtShell* pWrtSh; @@ -304,14 +305,14 @@ class SwFrmAddPage : public SfxTabPage DECL_LINK(EditModifyHdl, void *); DECL_LINK(ChainModifyHdl, ListBox*); - SwFrmAddPage(vcl::Window *pParent, const SfxItemSet &rSet); - virtual ~SwFrmAddPage(); - static const sal_uInt16 aAddPgRg[]; public: + SwFrmAddPage(vcl::Window *pParent, const SfxItemSet &rSet); + virtual ~SwFrmAddPage(); + 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() { return aAddPgRg; } virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/glosbib.hxx b/sw/source/uibase/inc/glosbib.hxx index 622b3cb20692..bcfe4a229eae 100644 --- a/sw/source/uibase/inc/glosbib.hxx +++ b/sw/source/uibase/inc/glosbib.hxx @@ -70,13 +70,13 @@ public: class SwGlossaryGroupDlg : public SvxStandardDialog { - FEdit* m_pNameED; - ListBox* m_pPathLB; - SwGlossaryGroupTLB* m_pGroupTLB; + VclPtr<FEdit> m_pNameED; + VclPtr<ListBox> m_pPathLB; + VclPtr<SwGlossaryGroupTLB> m_pGroupTLB; - PushButton* m_pNewPB; - PushButton* m_pDelPB; - PushButton* m_pRenamePB; + VclPtr<PushButton> m_pNewPB; + VclPtr<PushButton> m_pDelPB; + VclPtr<PushButton> m_pRenamePB; typedef std::vector< OUString> OUVector_t; OUVector_t m_RemovedArr; @@ -102,6 +102,7 @@ public: std::vector<OUString> const& rPathArr, SwGlossaryHdl *pGlosHdl); virtual ~SwGlossaryGroupDlg(); + virtual void dispose() SAL_OVERRIDE; const OUString& GetCreatedGroupName() const {return sCreatedGroup;} }; diff --git a/sw/source/uibase/inc/glossary.hxx b/sw/source/uibase/inc/glossary.hxx index 7fad065d8bb9..62ae7b46198e 100644 --- a/sw/source/uibase/inc/glossary.hxx +++ b/sw/source/uibase/inc/glossary.hxx @@ -88,19 +88,19 @@ class SwGlossaryDlg : public SvxStandardDialog friend class SwNewGlosNameDlg; friend class SwGlTreeListBox; - CheckBox* m_pInsertTipCB; - Edit* m_pNameED; - FixedText* m_pShortNameLbl; + VclPtr<CheckBox> m_pInsertTipCB; + VclPtr<Edit> m_pNameED; + VclPtr<FixedText> m_pShortNameLbl; TextFilter m_aNoSpaceFilter; - Edit* m_pShortNameEdit; - SwGlTreeListBox* m_pCategoryBox; - CheckBox* m_pFileRelCB; - CheckBox* m_pNetRelCB; - vcl::Window* m_pExampleWIN; - PushButton* m_pInsertBtn; - MenuButton* m_pEditBtn; - PushButton* m_pBibBtn; - PushButton* m_pPathBtn; + VclPtr<Edit> m_pShortNameEdit; + VclPtr<SwGlTreeListBox> m_pCategoryBox; + VclPtr<CheckBox> m_pFileRelCB; + VclPtr<CheckBox> m_pNetRelCB; + VclPtr<vcl::Window> m_pExampleWIN; + VclPtr<PushButton> m_pInsertBtn; + VclPtr<MenuButton> m_pEditBtn; + VclPtr<PushButton> m_pBibBtn; + VclPtr<PushButton> m_pPathBtn; OUString sReadonlyPath; @@ -149,6 +149,7 @@ class SwGlossaryDlg : public SvxStandardDialog public: SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell); virtual ~SwGlossaryDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetCurrGrpName() const; OUString GetCurrLongName() const { diff --git a/sw/source/uibase/inc/inpdlg.hxx b/sw/source/uibase/inc/inpdlg.hxx index bf42fa788cf6..260423a01ba4 100644 --- a/sw/source/uibase/inc/inpdlg.hxx +++ b/sw/source/uibase/inc/inpdlg.hxx @@ -42,17 +42,19 @@ class SwFldInputDlg: public SvxStandardDialog SwSetExpField* pSetFld; SwUserFieldType* pUsrType; - Edit* m_pLabelED; + VclPtr<Edit> m_pLabelED; - VclMultiLineEdit* m_pEditED; + VclPtr<VclMultiLineEdit> m_pEditED; - OKButton* m_pOKBT; - PushButton* m_pNextBT; + VclPtr<OKButton> m_pOKBT; + VclPtr<PushButton> m_pNextBT; DECL_LINK(NextHdl, void *); public: SwFldInputDlg( vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bNextButton = false ); + virtual ~SwFldInputDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx index f5a9e28d050b..fdb4a6f4fb69 100644 --- a/sw/source/uibase/inc/inputwin.hxx +++ b/sw/source/uibase/inc/inputwin.hxx @@ -47,8 +47,8 @@ class SwInputWindow : public ToolBox { friend class InputEdit; - Edit aPos; - InputEdit aEdit; + VclPtr<Edit> aPos; + VclPtr<InputEdit> aEdit; PopupMenu aPopMenu; SwFldMgr* pMgr; SwWrtShell* pWrtShell; @@ -82,6 +82,7 @@ protected: public: SwInputWindow( vcl::Window* pParent, SfxBindings* pBindings ); virtual ~SwInputWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; @@ -108,9 +109,9 @@ public: virtual ~SwInputChild(); SFX_DECL_CHILDWINDOW_WITHID( SwInputChild ); void SetFormula( const OUString& rFormula, bool bDelSel = true ) - { static_cast<SwInputWindow*>(pWindow)->SetFormula( + { static_cast<SwInputWindow*>(pWindow.get())->SetFormula( rFormula, bDelSel ); } - const SwView* GetView() const{return static_cast<SwInputWindow*>(pWindow)->GetView();} + const SwView* GetView() const{return static_cast<SwInputWindow*>(pWindow.get())->GetView();} }; diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx index 39747588a997..8fee498f4022 100644 --- a/sw/source/uibase/inc/insfnote.hxx +++ b/sw/source/uibase/inc/insfnote.hxx @@ -40,19 +40,19 @@ class SwInsFootNoteDlg: public SvxStandardDialog bool bExtCharAvailable; bool bEdit; - VclFrame* m_pNumberFrame; - RadioButton* m_pNumberAutoBtn; - RadioButton* m_pNumberCharBtn; - Edit* m_pNumberCharEdit; - PushButton* m_pNumberExtChar; + VclPtr<VclFrame> m_pNumberFrame; + VclPtr<RadioButton> m_pNumberAutoBtn; + VclPtr<RadioButton> m_pNumberCharBtn; + VclPtr<Edit> m_pNumberCharEdit; + VclPtr<PushButton> m_pNumberExtChar; // everything for the selection footnote/endnote - RadioButton* m_pFtnBtn; - RadioButton* m_pEndNoteBtn; + VclPtr<RadioButton> m_pFtnBtn; + VclPtr<RadioButton> m_pEndNoteBtn; - PushButton* m_pOkBtn; - PushButton* m_pPrevBT; - PushButton* m_pNextBT; + VclPtr<PushButton> m_pOkBtn; + VclPtr<PushButton> m_pPrevBT; + VclPtr<PushButton> m_pNextBT; DECL_LINK(NumberCharHdl, void *); DECL_LINK(NumberEditHdl, void *); @@ -67,6 +67,7 @@ class SwInsFootNoteDlg: public SvxStandardDialog public: SwInsFootNoteDlg(vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false); virtual ~SwInsFootNoteDlg(); + virtual void dispose() SAL_OVERRIDE; rtl_TextEncoding GetCharSet() { return eCharSet; } bool IsExtCharAvailable() { return bExtCharAvailable; } diff --git a/sw/source/uibase/inc/instable.hxx b/sw/source/uibase/inc/instable.hxx index d61de339f2b8..1e1178306d4c 100644 --- a/sw/source/uibase/inc/instable.hxx +++ b/sw/source/uibase/inc/instable.hxx @@ -34,22 +34,22 @@ struct SwInsertTableOptions; class SwInsTableDlg : public SfxModalDialog { - Edit* m_pNameEdit; + VclPtr<Edit> m_pNameEdit; TextFilter m_aTextFilter; - NumericField* m_pColNF; - NumericField* m_pRowNF; + VclPtr<NumericField> m_pColNF; + VclPtr<NumericField> m_pRowNF; - CheckBox* m_pHeaderCB; - CheckBox* m_pRepeatHeaderCB; - NumericField* m_pRepeatHeaderNF; - VclContainer* m_pRepeatGroup; + VclPtr<CheckBox> m_pHeaderCB; + VclPtr<CheckBox> m_pRepeatHeaderCB; + VclPtr<NumericField> m_pRepeatHeaderNF; + VclPtr<VclContainer> m_pRepeatGroup; - CheckBox* m_pDontSplitCB; - CheckBox* m_pBorderCB; + VclPtr<CheckBox> m_pDontSplitCB; + VclPtr<CheckBox> m_pBorderCB; - PushButton* m_pInsertBtn; - PushButton* m_pAutoFmtBtn; + VclPtr<PushButton> m_pInsertBtn; + VclPtr<PushButton> m_pAutoFmtBtn; SwWrtShell* pShell; SwTableAutoFmt* pTAutoFmt; @@ -66,6 +66,7 @@ class SwInsTableDlg : public SfxModalDialog public: SwInsTableDlg( SwView& rView ); virtual ~SwInsTableDlg(); + virtual void dispose() SAL_OVERRIDE; void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, SwInsertTableOptions& rInsTblOpts, OUString& rTableAutoFmtName, diff --git a/sw/source/uibase/inc/javaedit.hxx b/sw/source/uibase/inc/javaedit.hxx index 5649e5ea1e42..13b5295dc973 100644 --- a/sw/source/uibase/inc/javaedit.hxx +++ b/sw/source/uibase/inc/javaedit.hxx @@ -33,16 +33,16 @@ namespace sfx2 { class FileDialogHelper; } class SwJavaEditDialog : public SvxStandardDialog { private: - Edit* m_pTypeED; - RadioButton* m_pUrlRB; - RadioButton* m_pEditRB; - PushButton* m_pUrlPB; - Edit* m_pUrlED; - VclMultiLineEdit* m_pEditED; + VclPtr<Edit> m_pTypeED; + VclPtr<RadioButton> m_pUrlRB; + VclPtr<RadioButton> m_pEditRB; + VclPtr<PushButton> m_pUrlPB; + VclPtr<Edit> m_pUrlED; + VclPtr<VclMultiLineEdit> m_pEditED; - OKButton* m_pOKBtn; - PushButton* m_pPrevBtn; - PushButton* m_pNextBtn; + VclPtr<OKButton> m_pOKBtn; + VclPtr<PushButton> m_pPrevBtn; + VclPtr<PushButton> m_pNextBtn; OUString aText; OUString aType; @@ -54,7 +54,7 @@ private: SwFldMgr* pMgr; SwWrtShell* pSh; sfx2::FileDialogHelper* pFileDlg; - vcl::Window* pOldDefDlgParent; + VclPtr<vcl::Window> pOldDefDlgParent; DECL_LINK(OKHdl, void *); DECL_LINK(PrevHdl, void *); @@ -71,6 +71,7 @@ private: public: SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh); virtual ~SwJavaEditDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetScriptText() const { return aText; } diff --git a/sw/source/uibase/inc/label.hxx b/sw/source/uibase/inc/label.hxx index 61b452d245d4..bb23e44c80e7 100644 --- a/sw/source/uibase/inc/label.hxx +++ b/sw/source/uibase/inc/label.hxx @@ -33,7 +33,7 @@ class SwLabDlg : public SfxTabDialog { SwLabelConfig aLabelsCfg; SwDBManager* pDBManager; - SwLabPrtPage* pPrtPage; + VclPtr<SwLabPrtPage> pPrtPage; std::vector<sal_uInt16> aTypeIds; std::vector<OUString> aMakes; @@ -56,6 +56,7 @@ public: SwLabDlg( vcl::Window* pParent, const SfxItemSet& rSet, SwDBManager* pDBManager, bool bLabel); virtual ~SwLabDlg(); + virtual void dispose() SAL_OVERRIDE; SwLabRec* GetRecord(const OUString &rRecName, bool bCont); void GetLabItem(SwLabItem &rItem); diff --git a/sw/source/uibase/inc/linenum.hxx b/sw/source/uibase/inc/linenum.hxx index 7b3f0734dee6..ef0cb2b8dbdd 100644 --- a/sw/source/uibase/inc/linenum.hxx +++ b/sw/source/uibase/inc/linenum.hxx @@ -33,21 +33,21 @@ class SwLineNumberingDlg : public SfxModalDialog { private: SwWrtShell* pSh; - VclContainer* m_pBodyContent; - vcl::Window* m_pDivIntervalFT; - NumericField* m_pDivIntervalNF; - vcl::Window* m_pDivRowsFT; - NumericField* m_pNumIntervalNF; - ListBox* m_pCharStyleLB; - SwNumberingTypeListBox* m_pFormatLB; - ListBox* m_pPosLB; - MetricField* m_pOffsetMF; - Edit* m_pDivisorED; - CheckBox* m_pCountEmptyLinesCB; - CheckBox* m_pCountFrameLinesCB; - CheckBox* m_pRestartEachPageCB; - CheckBox* m_pNumberingOnCB; - CheckBox* m_pNumberingOnFooterHeader; + VclPtr<VclContainer> m_pBodyContent; + VclPtr<vcl::Window> m_pDivIntervalFT; + VclPtr<NumericField> m_pDivIntervalNF; + VclPtr<vcl::Window> m_pDivRowsFT; + VclPtr<NumericField> m_pNumIntervalNF; + VclPtr<ListBox> m_pCharStyleLB; + VclPtr<SwNumberingTypeListBox> m_pFormatLB; + VclPtr<ListBox> m_pPosLB; + VclPtr<MetricField> m_pOffsetMF; + VclPtr<Edit> m_pDivisorED; + VclPtr<CheckBox> m_pCountEmptyLinesCB; + VclPtr<CheckBox> m_pCountFrameLinesCB; + VclPtr<CheckBox> m_pRestartEachPageCB; + VclPtr<CheckBox> m_pNumberingOnCB; + VclPtr<CheckBox> m_pNumberingOnFooterHeader; DECL_LINK(OKHdl, void *); DECL_LINK(LineOnOffHdl, void * = 0); DECL_LINK(ModifyHdl, void * = 0); @@ -56,6 +56,7 @@ public: SwWrtShell* GetWrtShell() const { return pSh; } SwLineNumberingDlg(SwView *pVw); virtual ~SwLineNumberingDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/mailconfigpage.hxx b/sw/source/uibase/inc/mailconfigpage.hxx index a343c30bf5eb..e502ea9fef8c 100644 --- a/sw/source/uibase/inc/mailconfigpage.hxx +++ b/sw/source/uibase/inc/mailconfigpage.hxx @@ -33,20 +33,20 @@ class SwMailConfigPage : public SfxTabPage { friend class SwTestAccountSettingsDialog; - Edit* m_pDisplayNameED; - Edit* m_pAddressED; + VclPtr<Edit> m_pDisplayNameED; + VclPtr<Edit> m_pAddressED; - CheckBox* m_pReplyToCB; - FixedText* m_pReplyToFT; - Edit* m_pReplyToED; + VclPtr<CheckBox> m_pReplyToCB; + VclPtr<FixedText> m_pReplyToFT; + VclPtr<Edit> m_pReplyToED; - Edit* m_pServerED; - NumericField* m_pPortNF; + VclPtr<Edit> m_pServerED; + VclPtr<NumericField> m_pPortNF; - CheckBox* m_pSecureCB; + VclPtr<CheckBox> m_pSecureCB; - PushButton* m_pServerAuthenticationPB; - PushButton* m_pTestPB; + VclPtr<PushButton> m_pServerAuthenticationPB; + VclPtr<PushButton> m_pTestPB; SwMailMergeConfigItem* m_pConfigItem; @@ -57,9 +57,10 @@ class SwMailConfigPage : public SfxTabPage public: SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwMailConfigPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/mailmergechildwindow.hxx b/sw/source/uibase/inc/mailmergechildwindow.hxx index 35a76131c26f..742cb322437d 100644 --- a/sw/source/uibase/inc/mailmergechildwindow.hxx +++ b/sw/source/uibase/inc/mailmergechildwindow.hxx @@ -25,11 +25,13 @@ class SwMailMergeChildWin : public SfxFloatingWindow { - ToolBox* m_pBackTB; + VclPtr<ToolBox> m_pBackTB; DECL_LINK( BackHdl, void* ); public: SwMailMergeChildWin(SfxBindings*, SfxChildWindow*, vcl::Window *pParent); + virtual ~SwMailMergeChildWin(); + virtual void dispose() SAL_OVERRIDE; virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE; }; diff --git a/sw/source/uibase/inc/mailmergehelper.hxx b/sw/source/uibase/inc/mailmergehelper.hxx index c6691af3dcc1..deb715c98e79 100644 --- a/sw/source/uibase/inc/mailmergehelper.hxx +++ b/sw/source/uibase/inc/mailmergehelper.hxx @@ -60,7 +60,7 @@ struct SwAddressPreview_Impl; // and also the resulting address filled with database data class SW_DLLPUBLIC SwAddressPreview : public vcl::Window { - ScrollBar aVScrollBar; + VclPtr<ScrollBar> aVScrollBar; SwAddressPreview_Impl* pImpl; Link m_aSelectHdl; @@ -77,6 +77,8 @@ class SW_DLLPUBLIC SwAddressPreview : public vcl::Window public: SwAddressPreview(vcl::Window* pParent, WinBits nStyle=WB_BORDER); + virtual ~SwAddressPreview(); + virtual void dispose() SAL_OVERRIDE; void positionScrollBar(); @@ -140,7 +142,7 @@ class SW_DLLPUBLIC SwAuthenticator : { OUString m_aUserName; OUString m_aPassword; - vcl::Window* m_pParentWindow; + VclPtr<vcl::Window> m_pParentWindow; public: SwAuthenticator() : m_pParentWindow(0) {} SwAuthenticator(const OUString& username, const OUString& password, vcl::Window* pParent) : diff --git a/sw/source/uibase/inc/mailmergewizard.hxx b/sw/source/uibase/inc/mailmergewizard.hxx index 5287ca3576d1..6bcfb25aebb7 100644 --- a/sw/source/uibase/inc/mailmergewizard.hxx +++ b/sw/source/uibase/inc/mailmergewizard.hxx @@ -58,7 +58,7 @@ class SwMailMergeWizard : public ::svt::RoadmapWizard using svt::OWizardMachine::skipUntil; protected: - virtual svt::OWizardPage* createPage(WizardState _nState) SAL_OVERRIDE; + virtual VclPtr<TabPage> createPage( WizardState _nState ) SAL_OVERRIDE; virtual void enterState( WizardState _nState ) SAL_OVERRIDE; // roadmap feature ?? diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx index f3d67eeb831f..1ae4b78829de 100644 --- a/sw/source/uibase/inc/mailmrge.hxx +++ b/sw/source/uibase/inc/mailmrge.hxx @@ -51,46 +51,46 @@ class SwMailMergeDlg : public SvxStandardDialog { friend class SwXSelChgLstnr_Impl; - vcl::Window* m_pBeamerWin; - - RadioButton* m_pAllRB; - RadioButton* m_pMarkedRB; - RadioButton* m_pFromRB; - NumericField* m_pFromNF; - NumericField* m_pToNF; - - RadioButton* m_pPrinterRB; - RadioButton* m_pMailingRB; - RadioButton* m_pFileRB; - - CheckBox* m_pSingleJobsCB; - - FixedText* m_pSaveMergedDocumentFT; - RadioButton* m_pSaveSingleDocRB; - RadioButton* m_pSaveIndividualRB; - - CheckBox* m_pGenerateFromDataBaseCB; - - FixedText* m_pColumnFT; - ListBox* m_pColumnLB; - FixedText* m_pPathFT; - Edit* m_pPathED; - PushButton* m_pPathPB; - FixedText* m_pFilterFT; - ListBox* m_pFilterLB; - - ListBox* m_pAddressFldLB; - FixedText* m_pSubjectFT; - Edit* m_pSubjectED; - FixedText* m_pFormatFT; - FixedText* m_pAttachFT; - Edit* m_pAttachED; - PushButton* m_pAttachPB; - CheckBox* m_pFormatHtmlCB; - CheckBox* m_pFormatRtfCB; - CheckBox* m_pFormatSwCB; - - OKButton* m_pOkBTN; + VclPtr<vcl::Window> m_pBeamerWin; + + VclPtr<RadioButton> m_pAllRB; + VclPtr<RadioButton> m_pMarkedRB; + VclPtr<RadioButton> m_pFromRB; + VclPtr<NumericField> m_pFromNF; + VclPtr<NumericField> m_pToNF; + + VclPtr<RadioButton> m_pPrinterRB; + VclPtr<RadioButton> m_pMailingRB; + VclPtr<RadioButton> m_pFileRB; + + VclPtr<CheckBox> m_pSingleJobsCB; + + VclPtr<FixedText> m_pSaveMergedDocumentFT; + VclPtr<RadioButton> m_pSaveSingleDocRB; + VclPtr<RadioButton> m_pSaveIndividualRB; + + VclPtr<CheckBox> m_pGenerateFromDataBaseCB; + + VclPtr<FixedText> m_pColumnFT; + VclPtr<ListBox> m_pColumnLB; + VclPtr<FixedText> m_pPathFT; + VclPtr<Edit> m_pPathED; + VclPtr<PushButton> m_pPathPB; + VclPtr<FixedText> m_pFilterFT; + VclPtr<ListBox> m_pFilterLB; + + VclPtr<ListBox> m_pAddressFldLB; + VclPtr<FixedText> m_pSubjectFT; + VclPtr<Edit> m_pSubjectED; + VclPtr<FixedText> m_pFormatFT; + VclPtr<FixedText> m_pAttachFT; + VclPtr<Edit> m_pAttachED; + VclPtr<PushButton> m_pAttachPB; + VclPtr<CheckBox> m_pFormatHtmlCB; + VclPtr<CheckBox> m_pFormatRtfCB; + VclPtr<CheckBox> m_pFormatSwCB; + + VclPtr<OKButton> m_pOkBTN; SwMailMergeDlg_Impl* pImpl; @@ -122,6 +122,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >* pSelection = 0); virtual ~SwMailMergeDlg(); + virtual void dispose() SAL_OVERRIDE; inline DBManagerOptions GetMergeType() { return nMergeType; } @@ -138,9 +139,11 @@ public: class SwMailMergeCreateFromDlg : public ModalDialog { - RadioButton* m_pThisDocRB; + VclPtr<RadioButton> m_pThisDocRB; public: SwMailMergeCreateFromDlg(vcl::Window* pParent); + virtual ~SwMailMergeCreateFromDlg(); + virtual void dispose() SAL_OVERRIDE; bool IsThisDocument() const { return m_pThisDocRB->IsChecked(); @@ -149,9 +152,12 @@ public: class SwMailMergeFieldConnectionsDlg : public ModalDialog { - RadioButton* m_pUseExistingRB; + VclPtr<RadioButton> m_pUseExistingRB; public: SwMailMergeFieldConnectionsDlg(vcl::Window* pParent); + virtual ~SwMailMergeFieldConnectionsDlg(); + virtual void dispose() SAL_OVERRIDE; + bool IsUseExistingConnections() const { return m_pUseExistingRB->IsChecked(); diff --git a/sw/source/uibase/inc/mergetbl.hxx b/sw/source/uibase/inc/mergetbl.hxx index fe9882a1429b..5bd7548ca358 100644 --- a/sw/source/uibase/inc/mergetbl.hxx +++ b/sw/source/uibase/inc/mergetbl.hxx @@ -26,7 +26,7 @@ class SwMergeTblDlg : public SvxStandardDialog { - RadioButton* m_pMergePrevRB; + VclPtr<RadioButton> m_pMergePrevRB; bool& m_rMergePrev; protected: @@ -34,6 +34,8 @@ protected: public: SwMergeTblDlg( vcl::Window *pParent, bool& rWithPrev ); + virtual ~SwMergeTblDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/multmrk.hxx b/sw/source/uibase/inc/multmrk.hxx index 62ab97399cd8..2e9c26abaf82 100644 --- a/sw/source/uibase/inc/multmrk.hxx +++ b/sw/source/uibase/inc/multmrk.hxx @@ -32,8 +32,8 @@ class SwTOXMgr; class SwMultiTOXMarkDlg : public SvxStandardDialog { DECL_LINK( SelectHdl, ListBox * ); - FixedText* m_pTextFT; - ListBox* m_pTOXLB; + VclPtr<FixedText> m_pTextFT; + VclPtr<ListBox> m_pTOXLB; SwTOXMgr& rMgr; sal_uInt16 nPos; @@ -42,6 +42,7 @@ class SwMultiTOXMarkDlg : public SvxStandardDialog public: SwMultiTOXMarkDlg( vcl::Window* pParent, SwTOXMgr &rTOXMgr ); virtual ~SwMultiTOXMarkDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif // INCLUDED_SW_SOURCE_UIBASE_INC_MULTMRK_HXX diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index 074888e6f0ce..1cb6b9fe021d 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -55,12 +55,12 @@ class SwNavigationPI : public vcl::Window, friend class SwContentTree; friend class SwGlobalTree; - SwNavHelpToolBox aContentToolBox; - SwHelpToolBox aGlobalToolBox; - ImageList aContentImageList; - SwContentTree aContentTree; - SwGlobalTree aGlobalTree; - ListBox aDocListBox; + VclPtr<SwNavHelpToolBox> aContentToolBox; + VclPtr<SwHelpToolBox> aGlobalToolBox; + ImageList aContentImageList; + VclPtr<SwContentTree> aContentTree; + VclPtr<SwGlobalTree> aGlobalTree; + VclPtr<ListBox> aDocListBox; Idle aPageChgIdle; OUString sContentFileName; OUString aContextArr[3]; @@ -72,8 +72,8 @@ class SwNavigationPI : public vcl::Window, SwWrtShell *pContentWrtShell; SwView *pActContView; SwView *pCreateView; - SfxPopupWindow *pPopupWindow; - SfxPopupWindow *pFloatingWindow; + VclPtr<SfxPopupWindow> pPopupWindow; + VclPtr<SfxPopupWindow> pFloatingWindow; SfxChildWindowContext* pContextWin; @@ -137,6 +137,7 @@ public: SwNavigationPI(SfxBindings*, SfxChildWindowContext*, vcl::Window*); virtual ~SwNavigationPI(); + virtual void dispose() SAL_OVERRIDE; void GotoPage(); // jump to page; bindable function diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx index ad1a9cdc0f22..1b712e3cc50e 100644 --- a/sw/source/uibase/inc/num.hxx +++ b/sw/source/uibase/inc/num.hxx @@ -49,43 +49,43 @@ struct SwBmpItemInfo class SwNumPositionTabPage : public SfxTabPage { - ListBox* m_pLevelLB; - VclFrame* m_pPositionFrame; + VclPtr<ListBox> m_pLevelLB; + VclPtr<VclFrame> m_pPositionFrame; // former set of controls shown for numbering rules containing list level // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION - FixedText* m_pDistBorderFT; - MetricField* m_pDistBorderMF; - CheckBox* m_pRelativeCB; - FixedText* m_pIndentFT; - MetricField* m_pIndentMF; - FixedText* m_pDistNumFT; - MetricField* m_pDistNumMF; - FixedText* m_pAlignFT; - ListBox* m_pAlignLB; + VclPtr<FixedText> m_pDistBorderFT; + VclPtr<MetricField> m_pDistBorderMF; + VclPtr<CheckBox> m_pRelativeCB; + VclPtr<FixedText> m_pIndentFT; + VclPtr<MetricField> m_pIndentMF; + VclPtr<FixedText> m_pDistNumFT; + VclPtr<MetricField> m_pDistNumMF; + VclPtr<FixedText> m_pAlignFT; + VclPtr<ListBox> m_pAlignLB; // new set of controls shown for numbering rules containing list level // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT - FixedText* m_pLabelFollowedByFT; - ListBox* m_pLabelFollowedByLB; - FixedText* m_pListtabFT; - MetricField* m_pListtabMF; - FixedText* m_pAlign2FT; - ListBox* m_pAlign2LB; - FixedText* m_pAlignedAtFT; - MetricField* m_pAlignedAtMF; - FixedText* m_pIndentAtFT; - MetricField* m_pIndentAtMF; + VclPtr<FixedText> m_pLabelFollowedByFT; + VclPtr<ListBox> m_pLabelFollowedByLB; + VclPtr<FixedText> m_pListtabFT; + VclPtr<MetricField> m_pListtabMF; + VclPtr<FixedText> m_pAlign2FT; + VclPtr<ListBox> m_pAlign2LB; + VclPtr<FixedText> m_pAlignedAtFT; + VclPtr<MetricField> m_pAlignedAtMF; + VclPtr<FixedText> m_pIndentAtFT; + VclPtr<MetricField> m_pIndentAtMF; - PushButton* m_pStandardPB; + VclPtr<PushButton> m_pStandardPB; - NumberingPreview* m_pPreviewWIN; + VclPtr<NumberingPreview> m_pPreviewWIN; SwNumRule* pActNum; SwNumRule* pSaveNum; SwWrtShell* pWrtSh; - SwOutlineTabDialog* pOutlineDlg; + VclPtr<SwOutlineTabDialog> pOutlineDlg; sal_uInt16 nActNumLvl; bool bModified : 1; @@ -117,14 +117,15 @@ public: SwNumPositionTabPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwNumPositionTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); void SetOutlineTabDialog(SwOutlineTabDialog* pDlg){pOutlineDlg = pDlg;} void SetWrtShell(SwWrtShell* pSh); diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx index bedbc7225f69..b1968d7f6857 100644 --- a/sw/source/uibase/inc/numberingtypelistbox.hxx +++ b/sw/source/uibase/inc/numberingtypelistbox.hxx @@ -37,6 +37,7 @@ class SW_DLLPUBLIC SwNumberingTypeListBox : public ListBox public: SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyle = WB_BORDER ); virtual ~SwNumberingTypeListBox(); + virtual void dispose() SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx index 8dd0394575a1..ede07317deb4 100644 --- a/sw/source/uibase/inc/numfmtlb.hxx +++ b/sw/source/uibase/inc/numfmtlb.hxx @@ -48,6 +48,7 @@ public: NumFormatListBox(vcl::Window* pWin, WinBits nStyle); virtual ~NumFormatListBox(); + virtual void dispose() SAL_OVERRIDE; void Clear(); diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx index ab84db3e5cda..a5fe54a69458 100644 --- a/sw/source/uibase/inc/numpara.hxx +++ b/sw/source/uibase/inc/numpara.hxx @@ -29,23 +29,23 @@ // are performed. class SwParagraphNumTabPage : public SfxTabPage { - VclHBox* m_pOutlineStartBX; - ListBox* m_pOutlineLvLB; - VclHBox* m_pNumberStyleBX; - ListBox* m_pNumberStyleLB; - PushButton* m_pEditNumStyleBtn; + VclPtr<VclHBox> m_pOutlineStartBX; + VclPtr<ListBox> m_pOutlineLvLB; + VclPtr<VclHBox> m_pNumberStyleBX; + VclPtr<ListBox> m_pNumberStyleLB; + VclPtr<PushButton> m_pEditNumStyleBtn; - TriStateBox* m_pNewStartCB; - VclHBox* m_pNewStartBX; - TriStateBox* m_pNewStartNumberCB; - NumericField* m_pNewStartNF; + VclPtr<TriStateBox> m_pNewStartCB; + VclPtr<VclHBox> m_pNewStartBX; + VclPtr<TriStateBox> m_pNewStartNumberCB; + VclPtr<NumericField> m_pNewStartNF; - VclFrame* m_pCountParaFram; - TriStateBox* m_pCountParaCB; - TriStateBox* m_pRestartParaCountCB; + VclPtr<VclFrame> m_pCountParaFram; + VclPtr<TriStateBox> m_pCountParaCB; + VclPtr<TriStateBox> m_pRestartParaCountCB; - VclHBox* m_pRestartBX; - NumericField* m_pRestartNF; + VclPtr<VclHBox> m_pRestartBX; + VclPtr<NumericField> m_pRestartNF; // --> OD 2008-04-14 #outlinelevel# const OUString msOutlineNumbering; @@ -62,17 +62,18 @@ class SwParagraphNumTabPage : public SfxTabPage static const sal_uInt16 aPageRg[]; protected: - SwParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet ); void aCountParaFL(); bool ExecuteEditNumStyle_Impl( sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr, sal_uInt16 nFamily, sal_uInt16 nMask = 0, const sal_uInt16* pModifier = NULL ); public: - virtual ~SwParagraphNumTabPage(); + SwParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~SwParagraphNumTabPage(); + 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() { return aPageRg; } virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/optcomp.hxx b/sw/source/uibase/inc/optcomp.hxx index 8a1675176575..d48bf227ef1c 100644 --- a/sw/source/uibase/inc/optcomp.hxx +++ b/sw/source/uibase/inc/optcomp.hxx @@ -34,10 +34,10 @@ class SwCompatibilityOptPage : public SfxTabPage { private: // controls - VclFrame* m_pMain; - ListBox* m_pFormattingLB; - SvxCheckListBox* m_pOptionsLB; - PushButton* m_pDefaultPB; + VclPtr<VclFrame> m_pMain; + VclPtr<ListBox> m_pFormattingLB; + VclPtr<SvxCheckListBox> m_pOptionsLB; + VclPtr<PushButton> m_pDefaultPB; // config item SvtCompatibilityOptions m_aConfigItem; // text of the user entry @@ -62,8 +62,9 @@ private: public: SwCompatibilityOptPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwCompatibilityOptPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx index 451b30c6b9b5..8c873f184bd0 100644 --- a/sw/source/uibase/inc/optload.hxx +++ b/sw/source/uibase/inc/optload.hxx @@ -39,21 +39,21 @@ class SwWrtShell; class SwLoadOptPage : public SfxTabPage { private: - RadioButton* m_pAlwaysRB; - RadioButton* m_pRequestRB; - RadioButton* m_pNeverRB; - - CheckBox* m_pAutoUpdateFields; - CheckBox* m_pAutoUpdateCharts; - - ListBox* m_pMetricLB; - FixedText* m_pTabFT; - MetricField* m_pTabMF; - CheckBox* m_pUseSquaredPageMode; - CheckBox* m_pUseCharUnit; - Edit* m_pWordCountED; - CheckBox* m_pShowStandardizedPageCount; - NumericField* m_pStandardizedPageSizeNF; + VclPtr<RadioButton> m_pAlwaysRB; + VclPtr<RadioButton> m_pRequestRB; + VclPtr<RadioButton> m_pNeverRB; + + VclPtr<CheckBox> m_pAutoUpdateFields; + VclPtr<CheckBox> m_pAutoUpdateCharts; + + VclPtr<ListBox> m_pMetricLB; + VclPtr<FixedText> m_pTabFT; + VclPtr<MetricField> m_pTabMF; + VclPtr<CheckBox> m_pUseSquaredPageMode; + VclPtr<CheckBox> m_pUseCharUnit; + VclPtr<Edit> m_pWordCountED; + VclPtr<CheckBox> m_pShowStandardizedPageCount; + VclPtr<NumericField> m_pStandardizedPageSizeNF; SwWrtShell* m_pWrtShell; sal_uInt16 m_nLastTab; @@ -64,9 +64,11 @@ private: public: SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwLoadOptPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; @@ -105,28 +107,28 @@ public: class SwCaptionOptPage : public SfxTabPage { private: - SvxCheckListBox* m_pCheckLB; - ListBox* m_pLbCaptionOrder; - SwCaptionPreview* m_pPreview; - - VclContainer* m_pSettingsGroup; - CaptionComboBox* m_pCategoryBox; - FixedText* m_pFormatText; - ListBox* m_pFormatBox; + VclPtr<SvxCheckListBox> m_pCheckLB; + VclPtr<ListBox> m_pLbCaptionOrder; + VclPtr<SwCaptionPreview> m_pPreview; + + VclPtr<VclContainer> m_pSettingsGroup; + VclPtr<CaptionComboBox> m_pCategoryBox; + VclPtr<FixedText> m_pFormatText; + VclPtr<ListBox> m_pFormatBox; //#i61007# order of captions - FixedText* m_pNumberingSeparatorFT; - Edit* m_pNumberingSeparatorED; - FixedText* m_pTextText; - Edit* m_pTextEdit; - ListBox* m_pPosBox; + VclPtr<FixedText> m_pNumberingSeparatorFT; + VclPtr<Edit> m_pNumberingSeparatorED; + VclPtr<FixedText> m_pTextText; + VclPtr<Edit> m_pTextEdit; + VclPtr<ListBox> m_pPosBox; - VclContainer* m_pNumCapt; - ListBox* m_pLbLevel; - Edit* m_pEdDelim; + VclPtr<VclContainer> m_pNumCapt; + VclPtr<ListBox> m_pLbLevel; + VclPtr<Edit> m_pEdDelim; - VclContainer* m_pCategory; - ListBox* m_pCharStyleLB; - CheckBox* m_pApplyBorderCB; + VclPtr<VclContainer> m_pCategory; + VclPtr<ListBox> m_pCharStyleLB; + VclPtr<CheckBox> m_pApplyBorderCB; OUString m_sSWTable; OUString m_sSWFrame; @@ -165,9 +167,10 @@ public: SwCaptionOptPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwCaptionOptPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index ba424c9b596d..efe7ebda59e4 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -41,28 +41,28 @@ class FontList; // Tools->Options->Writer/Web->View class SwContentOptPage : public SfxTabPage { - CheckBox* m_pCrossCB; - - CheckBox* m_pHScrollBox; - CheckBox* m_pVScrollBox; - CheckBox* m_pAnyRulerCB; - CheckBox* m_pHRulerCBox; - ListBox* m_pHMetric; - CheckBox* m_pVRulerCBox; - CheckBox* m_pVRulerRightCBox; - ListBox* m_pVMetric; - CheckBox* m_pSmoothCBox; - - CheckBox* m_pGrfCB; - CheckBox* m_pTblCB; - CheckBox* m_pDrwCB; - CheckBox* m_pFldNameCB; - CheckBox* m_pPostItCB; - - VclFrame* m_pSettingsFrame; - FixedText* m_pSettingsLabel; - FixedText* m_pMetricLabel; - ListBox* m_pMetricLB; + VclPtr<CheckBox> m_pCrossCB; + + VclPtr<CheckBox> m_pHScrollBox; + VclPtr<CheckBox> m_pVScrollBox; + VclPtr<CheckBox> m_pAnyRulerCB; + VclPtr<CheckBox> m_pHRulerCBox; + VclPtr<ListBox> m_pHMetric; + VclPtr<CheckBox> m_pVRulerCBox; + VclPtr<CheckBox> m_pVRulerRightCBox; + VclPtr<ListBox> m_pVMetric; + VclPtr<CheckBox> m_pSmoothCBox; + + VclPtr<CheckBox> m_pGrfCB; + VclPtr<CheckBox> m_pTblCB; + VclPtr<CheckBox> m_pDrwCB; + VclPtr<CheckBox> m_pFldNameCB; + VclPtr<CheckBox> m_pPostItCB; + + VclPtr<VclFrame> m_pSettingsFrame; + VclPtr<FixedText> m_pSettingsLabel; + VclPtr<FixedText> m_pMetricLabel; + VclPtr<ListBox> m_pMetricLB; DECL_LINK(VertRulerHdl, CheckBox*); DECL_LINK(AnyRulerHdl, CheckBox*); @@ -70,8 +70,9 @@ public: SwContentOptPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwContentOptPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; @@ -82,29 +83,29 @@ public: // TabPage printer settings additions class SwAddPrinterTabPage : public SfxTabPage { - CheckBox* m_pGrfCB; - CheckBox* m_pCtrlFldCB; - CheckBox* m_pBackgroundCB; - CheckBox* m_pBlackFontCB; - CheckBox* m_pPrintHiddenTextCB; - CheckBox* m_pPrintTextPlaceholderCB; - - VclFrame* m_pPagesFrame; - CheckBox* m_pLeftPageCB; - CheckBox* m_pRightPageCB; - CheckBox* m_pProspectCB; - CheckBox* m_pProspectCB_RTL; - - VclFrame* m_pCommentsFrame; - RadioButton* m_pNoRB; - RadioButton* m_pOnlyRB; - RadioButton* m_pEndRB; - RadioButton* m_pEndPageRB; - RadioButton* m_pInMarginsRB; - - CheckBox* m_pPrintEmptyPagesCB; - CheckBox* m_pPaperFromSetupCB; - ListBox* m_pFaxLB; + VclPtr<CheckBox> m_pGrfCB; + VclPtr<CheckBox> m_pCtrlFldCB; + VclPtr<CheckBox> m_pBackgroundCB; + VclPtr<CheckBox> m_pBlackFontCB; + VclPtr<CheckBox> m_pPrintHiddenTextCB; + VclPtr<CheckBox> m_pPrintTextPlaceholderCB; + + VclPtr<VclFrame> m_pPagesFrame; + VclPtr<CheckBox> m_pLeftPageCB; + VclPtr<CheckBox> m_pRightPageCB; + VclPtr<CheckBox> m_pProspectCB; + VclPtr<CheckBox> m_pProspectCB_RTL; + + VclPtr<VclFrame> m_pCommentsFrame; + VclPtr<RadioButton> m_pNoRB; + VclPtr<RadioButton> m_pOnlyRB; + VclPtr<RadioButton> m_pEndRB; + VclPtr<RadioButton> m_pEndPageRB; + VclPtr<RadioButton> m_pInMarginsRB; + + VclPtr<CheckBox> m_pPrintEmptyPagesCB; + VclPtr<CheckBox> m_pPaperFromSetupCB; + VclPtr<ListBox> m_pFaxLB; OUString sNone; @@ -114,11 +115,13 @@ class SwAddPrinterTabPage : public SfxTabPage DECL_LINK(AutoClickHdl, void *); DECL_LINK(SelectHdl, void *); - SwAddPrinterTabPage( vcl::Window* pParent, - const SfxItemSet& rSet ); public: + SwAddPrinterTabPage( vcl::Window* pParent, + const SfxItemSet& rSet ); + virtual ~SwAddPrinterTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; @@ -132,20 +135,20 @@ public: class SwStdFontTabPage : public SfxTabPage { - FixedText* pLabelFT; - - ComboBox* pStandardBox; - FontSizeBox* pStandardHeightLB; - ComboBox* pTitleBox ; - FontSizeBox* pTitleHeightLB; - ComboBox* pListBox ; - FontSizeBox* pListHeightLB; - ComboBox* pLabelBox ; - FontSizeBox* pLabelHeightLB; - ComboBox* pIdxBox ; - FontSizeBox* pIndexHeightLB; - CheckBox* pDocOnlyCB ; - PushButton* pStandardPB; + VclPtr<FixedText> pLabelFT; + + VclPtr<ComboBox> pStandardBox; + VclPtr<FontSizeBox> pStandardHeightLB; + VclPtr<ComboBox> pTitleBox ; + VclPtr<FontSizeBox> pTitleHeightLB; + VclPtr<ComboBox> pListBox ; + VclPtr<FontSizeBox> pListHeightLB; + VclPtr<ComboBox> pLabelBox ; + VclPtr<FontSizeBox> pLabelHeightLB; + VclPtr<ComboBox> pIdxBox ; + VclPtr<FontSizeBox> pIndexHeightLB; + VclPtr<CheckBox> pDocOnlyCB ; + VclPtr<PushButton> pStandardPB; OUString sShellStd; OUString sShellTitle; @@ -153,7 +156,7 @@ class SwStdFontTabPage : public SfxTabPage OUString sShellLabel; OUString sShellIndex; - SfxPrinter* pPrt; + VclPtr<SfxPrinter> pPrt; FontList* pFontList; SwStdFontConfig* pFontConfig; SwWrtShell* pWrtShell; @@ -185,12 +188,13 @@ class SwStdFontTabPage : public SfxTabPage DECL_LINK( ModifyHeightHdl, FontSizeBox * ); DECL_LINK( LoseFocusHdl, ComboBox * ); - SwStdFontTabPage( vcl::Window* pParent, - const SfxItemSet& rSet ); - virtual ~SwStdFontTabPage(); + SwStdFontTabPage( vcl::Window* pParent, + const SfxItemSet& rSet ); + virtual ~SwStdFontTabPage(); + virtual void dispose() SAL_OVERRIDE; public: - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; @@ -202,37 +206,37 @@ public: class SwTableOptionsTabPage : public SfxTabPage { - CheckBox* pHeaderCB; - CheckBox* pRepeatHeaderCB; - CheckBox* pDontSplitCB; - CheckBox* pBorderCB; + VclPtr<CheckBox> pHeaderCB; + VclPtr<CheckBox> pRepeatHeaderCB; + VclPtr<CheckBox> pDontSplitCB; + VclPtr<CheckBox> pBorderCB; - CheckBox* pNumFormattingCB; - CheckBox* pNumFmtFormattingCB; - CheckBox* pNumAlignmentCB; + VclPtr<CheckBox> pNumFormattingCB; + VclPtr<CheckBox> pNumFmtFormattingCB; + VclPtr<CheckBox> pNumAlignmentCB; - MetricField* pRowMoveMF; - MetricField* pColMoveMF; + VclPtr<MetricField> pRowMoveMF; + VclPtr<MetricField> pColMoveMF; - MetricField* pRowInsertMF; - MetricField* pColInsertMF; + VclPtr<MetricField> pRowInsertMF; + VclPtr<MetricField> pColInsertMF; - RadioButton* pFixRB; - RadioButton* pFixPropRB; - RadioButton* pVarRB; + VclPtr<RadioButton> pFixRB; + VclPtr<RadioButton> pFixPropRB; + VclPtr<RadioButton> pVarRB; SwWrtShell* pWrtShell; bool bHTMLMode; DECL_LINK(CheckBoxHdl, void *); - SwTableOptionsTabPage( vcl::Window* pParent, - const SfxItemSet& rSet ); - virtual ~SwTableOptionsTabPage(); - public: + SwTableOptionsTabPage( vcl::Window* pParent, + const SfxItemSet& rSet ); + virtual ~SwTableOptionsTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; @@ -247,38 +251,38 @@ public: class SwShdwCrsrOptionsTabPage : public SfxTabPage { //nonprinting characters - CheckBox* m_pParaCB; - CheckBox* m_pSHyphCB; - CheckBox* m_pSpacesCB; - CheckBox* m_pHSpacesCB; - CheckBox* m_pTabCB; - CheckBox* m_pBreakCB; - CheckBox* m_pCharHiddenCB; - CheckBox* m_pFldHiddenCB; - CheckBox* m_pFldHiddenParaCB; - - VclFrame* m_pDirectCursorFrame; - CheckBox* m_pOnOffCB; - - RadioButton* m_pFillMarginRB; - RadioButton* m_pFillIndentRB; - RadioButton* m_pFillTabRB; - RadioButton* m_pFillSpaceRB; - - VclFrame* m_pCursorProtFrame; - CheckBox* m_pCrsrInProtCB; - CheckBox* m_pIgnoreProtCB; - - CheckBox* m_pMathBaselineAlignmentCB; + VclPtr<CheckBox> m_pParaCB; + VclPtr<CheckBox> m_pSHyphCB; + VclPtr<CheckBox> m_pSpacesCB; + VclPtr<CheckBox> m_pHSpacesCB; + VclPtr<CheckBox> m_pTabCB; + VclPtr<CheckBox> m_pBreakCB; + VclPtr<CheckBox> m_pCharHiddenCB; + VclPtr<CheckBox> m_pFldHiddenCB; + VclPtr<CheckBox> m_pFldHiddenParaCB; + + VclPtr<VclFrame> m_pDirectCursorFrame; + VclPtr<CheckBox> m_pOnOffCB; + + VclPtr<RadioButton> m_pFillMarginRB; + VclPtr<RadioButton> m_pFillIndentRB; + VclPtr<RadioButton> m_pFillTabRB; + VclPtr<RadioButton> m_pFillSpaceRB; + + VclPtr<VclFrame> m_pCursorProtFrame; + VclPtr<CheckBox> m_pCrsrInProtCB; + VclPtr<CheckBox> m_pIgnoreProtCB; + + VclPtr<CheckBox> m_pMathBaselineAlignmentCB; SwWrtShell * m_pWrtShell; +public: SwShdwCrsrOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwShdwCrsrOptionsTabPage(); + virtual void dispose() SAL_OVERRIDE; -public: - - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; @@ -328,28 +332,25 @@ public: // redlining options class SwRedlineOptionsTabPage : public SfxTabPage { - ListBox* pInsertLB; - ColorListBox* pInsertColorLB; - SvxFontPrevWindow* pInsertedPreviewWN; + VclPtr<ListBox> pInsertLB; + VclPtr<ColorListBox> pInsertColorLB; + VclPtr<SvxFontPrevWindow> pInsertedPreviewWN; - ListBox* pDeletedLB; - ColorListBox* pDeletedColorLB; - SvxFontPrevWindow* pDeletedPreviewWN; + VclPtr<ListBox> pDeletedLB; + VclPtr<ColorListBox> pDeletedColorLB; + VclPtr<SvxFontPrevWindow> pDeletedPreviewWN; - ListBox* pChangedLB; - ColorListBox* pChangedColorLB; - SvxFontPrevWindow* pChangedPreviewWN; + VclPtr<ListBox> pChangedLB; + VclPtr<ColorListBox> pChangedColorLB; + VclPtr<SvxFontPrevWindow> pChangedPreviewWN; - ListBox* pMarkPosLB; - ColorListBox* pMarkColorLB; - SwMarkPreview* pMarkPreviewWN; + VclPtr<ListBox> pMarkPosLB; + VclPtr<ColorListBox> pMarkColorLB; + VclPtr<SwMarkPreview> pMarkPreviewWN; OUString sAuthor; OUString sNone; - SwRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); - virtual ~SwRedlineOptionsTabPage(); - DECL_LINK( AttribHdl, ListBox *pLB ); DECL_LINK(ChangedMaskPrevHdl, void * = 0); DECL_LINK( ColorHdl, ColorListBox *pColorLB ); @@ -357,8 +358,11 @@ class SwRedlineOptionsTabPage : public SfxTabPage void InitFontStyle(SvxFontPrevWindow& rExampleWin); public: + SwRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~SwRedlineOptionsTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; @@ -373,24 +377,26 @@ class SwTestTabPage : public SfxTabPage public: SwTestTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~SwTestTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; private: - CheckBox* m_pTest1CBox; - CheckBox* m_pTest2CBox; - CheckBox* m_pTest3CBox; - CheckBox* m_pTest4CBox; - CheckBox* m_pTest5CBox; - CheckBox* m_pTest6CBox; - CheckBox* m_pTest7CBox; - CheckBox* m_pTest8CBox; - CheckBox* m_pTest9CBox; - CheckBox* m_pTest10CBox; + VclPtr<CheckBox> m_pTest1CBox; + VclPtr<CheckBox> m_pTest2CBox; + VclPtr<CheckBox> m_pTest3CBox; + VclPtr<CheckBox> m_pTest4CBox; + VclPtr<CheckBox> m_pTest5CBox; + VclPtr<CheckBox> m_pTest6CBox; + VclPtr<CheckBox> m_pTest7CBox; + VclPtr<CheckBox> m_pTest8CBox; + VclPtr<CheckBox> m_pTest9CBox; + VclPtr<CheckBox> m_pTest10CBox; bool bAttrModified; @@ -402,24 +408,24 @@ private: class SwCompareOptionsTabPage : public SfxTabPage { - RadioButton* m_pAutoRB; - RadioButton* m_pWordRB; - RadioButton* m_pCharRB; + VclPtr<RadioButton> m_pAutoRB; + VclPtr<RadioButton> m_pWordRB; + VclPtr<RadioButton> m_pCharRB; - CheckBox* m_pRsidCB; - CheckBox* m_pIgnoreCB; - NumericField* m_pLenNF; - CheckBox* m_pStoreRsidCB; - - SwCompareOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); - virtual ~SwCompareOptionsTabPage(); + VclPtr<CheckBox> m_pRsidCB; + VclPtr<CheckBox> m_pIgnoreCB; + VclPtr<NumericField> m_pLenNF; + VclPtr<CheckBox> m_pStoreRsidCB; DECL_LINK(ComparisonHdl, void *); DECL_LINK(IgnoreHdl, void *); public: + SwCompareOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~SwCompareOptionsTabPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/outline.hxx b/sw/source/uibase/inc/outline.hxx index 0e1d24f4315e..d4ae3c69821e 100644 --- a/sw/source/uibase/inc/outline.hxx +++ b/sw/source/uibase/inc/outline.hxx @@ -58,7 +58,7 @@ class SwOutlineTabDialog : public SfxTabDialog bool bModified : 1; - protected: +protected: DECL_LINK(CancelHdl, void *); DECL_LINK( FormHdl, Button * ); DECL_LINK( MenuSelectHdl, Menu * ); @@ -66,33 +66,34 @@ class SwOutlineTabDialog : public SfxTabDialog virtual void PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) SAL_OVERRIDE; virtual short Ok() SAL_OVERRIDE; - public: +public: SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell &); virtual ~SwOutlineTabDialog(); + virtual void dispose() SAL_OVERRIDE; SwNumRule* GetNumRule() {return pNumRule;} - sal_uInt16 GetLevel(const OUString &rFmtName) const; + sal_uInt16 GetLevel(const OUString &rFmtName) const; OUString* GetCollNames() {return aCollNames;} - static sal_uInt16 GetActNumLevel() {return nNumLevel;} + static sal_uInt16 GetActNumLevel() {return nNumLevel;} static void SetActNumLevel(sal_uInt16 nSet) {nNumLevel = nSet;} }; class SwOutlineSettingsTabPage : public SfxTabPage { - ListBox* m_pLevelLB; - - ListBox* m_pCollBox; - SwNumberingTypeListBox* m_pNumberBox; - ListBox* m_pCharFmtLB; - FixedText* m_pAllLevelFT; - NumericField* m_pAllLevelNF; - Edit* m_pPrefixED; - Edit* m_pSuffixED; - NumericField* m_pStartEdit; - NumberingPreview* m_pPreviewWIN; + VclPtr<ListBox> m_pLevelLB; + + VclPtr<ListBox> m_pCollBox; + VclPtr<SwNumberingTypeListBox> m_pNumberBox; + VclPtr<ListBox> m_pCharFmtLB; + VclPtr<FixedText> m_pAllLevelFT; + VclPtr<NumericField> m_pAllLevelNF; + VclPtr<Edit> m_pPrefixED; + VclPtr<Edit> m_pSuffixED; + VclPtr<NumericField> m_pStartEdit; + VclPtr<NumberingPreview> m_pPreviewWIN; OUString aNoFmtName; OUString aSaveCollNames[MAXLEVEL]; @@ -121,6 +122,7 @@ class SwOutlineSettingsTabPage : public SfxTabPage public: SwOutlineSettingsTabPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwOutlineSettingsTabPage(); + virtual void dispose() SAL_OVERRIDE; void SetWrtShell(SwWrtShell* pShell); @@ -129,8 +131,8 @@ public: virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); }; #endif diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx index a1ab9bf6df1a..49f1974b8c3e 100644 --- a/sw/source/uibase/inc/pgfnote.hxx +++ b/sw/source/uibase/inc/pgfnote.hxx @@ -32,28 +32,29 @@ class SwFootNotePage: public SfxTabPage { static const sal_uInt16 aPageRg[]; + SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet); public: - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); static const sal_uInt16* GetRanges() { return aPageRg; } virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE; -private: - SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwFootNotePage(); + virtual void dispose() SAL_OVERRIDE; +private: - RadioButton* m_pMaxHeightPageBtn; - RadioButton* m_pMaxHeightBtn; - MetricField* m_pMaxHeightEdit; - MetricField* m_pDistEdit; - - ListBox* m_pLinePosBox; - LineListBox* m_pLineTypeBox; - MetricField* m_pLineWidthEdit; - ColorListBox* m_pLineColorBox; - MetricField* m_pLineLengthEdit; - MetricField* m_pLineDistEdit; + VclPtr<RadioButton> m_pMaxHeightPageBtn; + VclPtr<RadioButton> m_pMaxHeightBtn; + VclPtr<MetricField> m_pMaxHeightEdit; + VclPtr<MetricField> m_pDistEdit; + + VclPtr<ListBox> m_pLinePosBox; + VclPtr<LineListBox> m_pLineTypeBox; + VclPtr<MetricField> m_pLineWidthEdit; + VclPtr<ColorListBox> m_pLineColorBox; + VclPtr<MetricField> m_pLineLengthEdit; + VclPtr<MetricField> m_pLineDistEdit; DECL_LINK(HeightPage, void *); DECL_LINK(HeightMetric, void *); diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx index 62144bcbe8bd..8823b1d4099f 100644 --- a/sw/source/uibase/inc/pggrid.hxx +++ b/sw/source/uibase/inc/pggrid.hxx @@ -28,36 +28,36 @@ // TabPage Format/(Styles/)Page/Text grid class SwTextGridPage: public SfxTabPage { - RadioButton* m_pNoGridRB; - RadioButton* m_pLinesGridRB; - RadioButton* m_pCharsGridRB; - CheckBox* m_pSnapToCharsCB; + VclPtr<RadioButton> m_pNoGridRB; + VclPtr<RadioButton> m_pLinesGridRB; + VclPtr<RadioButton> m_pCharsGridRB; + VclPtr<CheckBox> m_pSnapToCharsCB; - SwPageGridExample* m_pExampleWN; + VclPtr<SwPageGridExample> m_pExampleWN; - VclFrame* m_pLayoutFL; - NumericField* m_pLinesPerPageNF; - FixedText* m_pLinesRangeFT; + VclPtr<VclFrame> m_pLayoutFL; + VclPtr<NumericField> m_pLinesPerPageNF; + VclPtr<FixedText> m_pLinesRangeFT; - MetricField* m_pTextSizeMF; + VclPtr<MetricField> m_pTextSizeMF; - FixedText* m_pCharsPerLineFT; - NumericField* m_pCharsPerLineNF; - FixedText* m_pCharsRangeFT; + VclPtr<FixedText> m_pCharsPerLineFT; + VclPtr<NumericField> m_pCharsPerLineNF; + VclPtr<FixedText> m_pCharsRangeFT; - FixedText* m_pCharWidthFT; - MetricField* m_pCharWidthMF; + VclPtr<FixedText> m_pCharWidthFT; + VclPtr<MetricField> m_pCharWidthMF; - FixedText* m_pRubySizeFT; - MetricField* m_pRubySizeMF; + VclPtr<FixedText> m_pRubySizeFT; + VclPtr<MetricField> m_pRubySizeMF; - CheckBox* m_pRubyBelowCB; + VclPtr<CheckBox> m_pRubyBelowCB; - VclFrame* m_pDisplayFL; + VclPtr<VclFrame> m_pDisplayFL; - CheckBox* m_pDisplayCB; - CheckBox* m_pPrintCB; - ColorListBox* m_pColorLB; + VclPtr<CheckBox> m_pDisplayCB; + VclPtr<CheckBox> m_pPrintCB; + VclPtr<ColorListBox> m_pColorLB; sal_Int32 m_nRubyUserValue; bool m_bRubyUserValue; @@ -67,9 +67,6 @@ class SwTextGridPage: public SfxTabPage bool m_bHRulerChanged; bool m_bVRulerChanged; - SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet); - virtual ~SwTextGridPage(); - void UpdatePageSize(const SfxItemSet& rSet); void PutGridItem(SfxItemSet& rSet); void SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue ); @@ -84,7 +81,11 @@ class SwTextGridPage: public SfxTabPage using SfxTabPage::DeactivatePage; public: - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet); + virtual ~SwTextGridPage(); + virtual void dispose() SAL_OVERRIDE; + + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); static const sal_uInt16* GetRanges(); virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index 6675290b20b0..314b0b624060 100644 --- a/sw/source/uibase/inc/prcntfld.hxx +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -26,7 +26,7 @@ //Wraps a MetricField with extra features, preferred to PercentField class SW_DLLPUBLIC PercentField { - MetricField* m_pField; + VclPtr<MetricField> m_pField; sal_Int64 nRefValue; // 100% value for conversion (in Twips) sal_Int64 nOldMax; diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx index b33a4518b625..c4b154ca2869 100644 --- a/sw/source/uibase/inc/pview.hxx +++ b/sw/source/uibase/inc/pview.hxx @@ -150,7 +150,7 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell { // ViewWindow and handle to core // current dispatcher shell - SwPagePreviewWin* pViewWin; + VclPtr<SwPagePreviewWin> pViewWin; //viewdata of the previous SwView and the new crsrposition OUString sSwViewData; //and the new cursor position if the user double click in the PagePreview @@ -163,14 +163,14 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell Rectangle aVisArea; // MDI control elements - SwScrollbar *pHScrollbar; - SwScrollbar *pVScrollbar; + VclPtr<SwScrollbar> pHScrollbar; + VclPtr<SwScrollbar> pVScrollbar; bool mbHScrollbarEnabled; bool mbVScrollbarEnabled; - ImageButton *pPageUpBtn, - *pPageDownBtn; + VclPtr<ImageButton> pPageUpBtn, + pPageDownBtn; // dummy window for filling the lower right edge when both scrollbars are active - ::vcl::Window *pScrollFill; + VclPtr<::vcl::Window> pScrollFill; sal_uInt16 mnPageCount; bool bNormalPrint; @@ -192,7 +192,7 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) SAL_OVERRIDE; SAL_DLLPRIVATE virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ) SAL_OVERRIDE; SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const SAL_OVERRIDE; - SAL_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, + SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) SAL_OVERRIDE; SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, bool bInner ); diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index 7cffc0bb366a..69121137d3e5 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -67,11 +67,11 @@ typedef std::vector<SvLBoxEntryPtr> SvLBoxEntryArr; class SW_DLLPUBLIC SwRedlineAcceptDlg { - vcl::Window* pParentDlg; + VclPtr<vcl::Window> pParentDlg; SwRedlineDataParentArr aRedlineParents; SwRedlineDataChildArr aRedlineChildren; SwRedlineDataParentSortArr aUsedSeqNo; - SvxAcceptChgCtr aTabPagesCTRL; + VclPtr<SvxAcceptChgCtr> aTabPagesCTRL; PopupMenu aPopup; Timer aDeselectTimer; Timer aSelectTimer; @@ -82,8 +82,8 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg OUString sFmtCollSet; OUString sFilterAction; OUString sAutoFormat; - SvxTPView* pTPView; - SvxRedlinTable* pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox + VclPtr<SvxTPView> pTPView; + VclPtr<SvxRedlinTable> pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox Link aOldSelectHdl; Link aOldDeselectHdl; bool bOnlyFormatedRedlines; @@ -120,7 +120,7 @@ public: DECL_LINK( FilterChangedHdl, void *pDummy = 0 ); - inline SvxAcceptChgCtr& GetChgCtrl() { return aTabPagesCTRL; } + inline SvxAcceptChgCtr& GetChgCtrl() { return *aTabPagesCTRL.get(); } inline bool HasRedlineAutoFmt() const { return bRedlnAutoFmt; } void Init(sal_uInt16 nStart = 0); @@ -140,6 +140,7 @@ class SwModelessRedlineAcceptDlg : public SfxModelessDialog public: SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, vcl::Window *pParent); virtual ~SwModelessRedlineAcceptDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void Activate() SAL_OVERRIDE; virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE; @@ -166,6 +167,7 @@ class SwRedlineAcceptPanel : public PanelLayout, public SfxListener public: SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame); virtual ~SwRedlineAcceptPanel(); + virtual void dispose() SAL_OVERRIDE; /// We need to be a SfxListener to be able to update the list of changes when we get SFX_HINT_DOCCHANGED. using Control::Notify; diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx index e50a6d84cfbe..633362531f2c 100644 --- a/sw/source/uibase/inc/regionsw.hxx +++ b/sw/source/uibase/inc/regionsw.hxx @@ -61,41 +61,41 @@ typedef boost::ptr_set<SectRepr> SectReprArr; class SwEditRegionDlg : public SfxModalDialog { - Edit* m_pCurName; - SvTreeListBox* m_pTree; - - TriStateBox* m_pFileCB; - CheckBox* m_pDDECB; - VclContainer* m_pDDEFrame; - FixedText* m_pFileNameFT; - FixedText* m_pDDECommandFT; - Edit* m_pFileNameED; - PushButton* m_pFilePB; - FixedText* m_pSubRegionFT; - ComboBox* m_pSubRegionED; + VclPtr<Edit> m_pCurName; + VclPtr<SvTreeListBox> m_pTree; + + VclPtr<TriStateBox> m_pFileCB; + VclPtr<CheckBox> m_pDDECB; + VclPtr<VclContainer> m_pDDEFrame; + VclPtr<FixedText> m_pFileNameFT; + VclPtr<FixedText> m_pDDECommandFT; + VclPtr<Edit> m_pFileNameED; + VclPtr<PushButton> m_pFilePB; + VclPtr<FixedText> m_pSubRegionFT; + VclPtr<ComboBox> m_pSubRegionED; bool m_bSubRegionsFilled; - TriStateBox* m_pProtectCB; - CheckBox* m_pPasswdCB; - PushButton* m_pPasswdPB; + VclPtr<TriStateBox> m_pProtectCB; + VclPtr<CheckBox> m_pPasswdCB; + VclPtr<PushButton> m_pPasswdPB; - TriStateBox* m_pHideCB; - FixedText* m_pConditionFT; - ConditionEdit* m_pConditionED; + VclPtr<TriStateBox> m_pHideCB; + VclPtr<FixedText> m_pConditionFT; + VclPtr<ConditionEdit> m_pConditionED; // #114856# edit in readonly sections - TriStateBox* m_pEditInReadonlyCB; + VclPtr<TriStateBox> m_pEditInReadonlyCB; - OKButton* m_pOK; - PushButton* m_pOptionsPB; - PushButton* m_pDismiss; + VclPtr<OKButton> m_pOK; + VclPtr<PushButton> m_pOptionsPB; + VclPtr<PushButton> m_pDismiss; ImageList aImageIL; SwWrtShell& rSh; SectReprArr aSectReprArr; const SwSection* pCurrSect; sfx2::DocumentInserter* m_pDocInserter; - vcl::Window* m_pOldDefDlgParent; + VclPtr<vcl::Window> m_pOldDefDlgParent; bool bDontCheckPasswd :1; bool bWeb :1; @@ -131,6 +131,7 @@ class SwEditRegionDlg : public SfxModalDialog public: SwEditRegionDlg( vcl::Window* pParent, SwWrtShell& rWrtSh ); virtual ~SwEditRegionDlg(); + virtual void dispose() SAL_OVERRIDE; void SelectSection(const OUString& rSectionName); @@ -139,27 +140,27 @@ public: // dialog "insert region" class SwInsertSectionTabPage : public SfxTabPage { - ComboBox* m_pCurName; + VclPtr<ComboBox> m_pCurName; - CheckBox* m_pFileCB; - CheckBox* m_pDDECB; - FixedText* m_pDDECommandFT; - FixedText* m_pFileNameFT; - Edit* m_pFileNameED; - PushButton* m_pFilePB; - FixedText* m_pSubRegionFT; - ComboBox* m_pSubRegionED; + VclPtr<CheckBox> m_pFileCB; + VclPtr<CheckBox> m_pDDECB; + VclPtr<FixedText> m_pDDECommandFT; + VclPtr<FixedText> m_pFileNameFT; + VclPtr<Edit> m_pFileNameED; + VclPtr<PushButton> m_pFilePB; + VclPtr<FixedText> m_pSubRegionFT; + VclPtr<ComboBox> m_pSubRegionED; - CheckBox* m_pProtectCB; - CheckBox* m_pPasswdCB; - PushButton* m_pPasswdPB; + VclPtr<CheckBox> m_pProtectCB; + VclPtr<CheckBox> m_pPasswdCB; + VclPtr<PushButton> m_pPasswdPB; - CheckBox* m_pHideCB; - FixedText* m_pConditionFT; - ConditionEdit* m_pConditionED; + VclPtr<CheckBox> m_pHideCB; + VclPtr<FixedText> m_pConditionFT; + VclPtr<ConditionEdit> m_pConditionED; // #114856# edit in readonly sections - CheckBox* m_pEditInReadonlyCB; + VclPtr<CheckBox> m_pEditInReadonlyCB; OUString m_sFileName; OUString m_sFilterName; @@ -168,7 +169,7 @@ class SwInsertSectionTabPage : public SfxTabPage ::com::sun::star::uno::Sequence <sal_Int8 > m_aNewPasswd; SwWrtShell* m_pWrtSh; sfx2::DocumentInserter* m_pDocInserter; - vcl::Window* m_pOldDefDlgParent; + VclPtr<vcl::Window> m_pOldDefDlgParent; DECL_LINK( ChangeHideHdl, CheckBox * ); // #114856# edit in readonly sections @@ -184,43 +185,44 @@ class SwInsertSectionTabPage : public SfxTabPage public: SwInsertSectionTabPage(vcl::Window *pParent, const SfxItemSet &rAttrSet); virtual ~SwInsertSectionTabPage(); + virtual void dispose() SAL_OVERRIDE; void SetWrtShell(SwWrtShell& rSh); virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); }; class SwSectionFtnEndTabPage : public SfxTabPage { - CheckBox* pFtnNtAtTextEndCB; + VclPtr<CheckBox> pFtnNtAtTextEndCB; - CheckBox* pFtnNtNumCB; - FixedText* pFtnOffsetLbl; - NumericField* pFtnOffsetFld; + VclPtr<CheckBox> pFtnNtNumCB; + VclPtr<FixedText> pFtnOffsetLbl; + VclPtr<NumericField> pFtnOffsetFld; - CheckBox* pFtnNtNumFmtCB; - FixedText* pFtnPrefixFT; - Edit* pFtnPrefixED; - SwNumberingTypeListBox* pFtnNumViewBox; - FixedText* pFtnSuffixFT; - Edit* pFtnSuffixED; + VclPtr<CheckBox> pFtnNtNumFmtCB; + VclPtr<FixedText> pFtnPrefixFT; + VclPtr<Edit> pFtnPrefixED; + VclPtr<SwNumberingTypeListBox> pFtnNumViewBox; + VclPtr<FixedText> pFtnSuffixFT; + VclPtr<Edit> pFtnSuffixED; - CheckBox* pEndNtAtTextEndCB; + VclPtr<CheckBox> pEndNtAtTextEndCB; - CheckBox* pEndNtNumCB; - FixedText* pEndOffsetLbl; - NumericField* pEndOffsetFld; + VclPtr<CheckBox> pEndNtNumCB; + VclPtr<FixedText> pEndOffsetLbl; + VclPtr<NumericField> pEndOffsetFld; - CheckBox* pEndNtNumFmtCB; - FixedText* pEndPrefixFT; - Edit* pEndPrefixED; - SwNumberingTypeListBox* pEndNumViewBox; - FixedText* pEndSuffixFT; - Edit* pEndSuffixED; + VclPtr<CheckBox> pEndNtNumFmtCB; + VclPtr<FixedText> pEndPrefixFT; + VclPtr<Edit> pEndPrefixED; + VclPtr<SwNumberingTypeListBox> pEndNumViewBox; + VclPtr<FixedText> pEndSuffixFT; + VclPtr<Edit> pEndSuffixED; DECL_LINK( FootEndHdl, CheckBox * ); void ResetState( bool bFtn, const SwFmtFtnEndAtTxtEnd& ); @@ -228,29 +230,31 @@ class SwSectionFtnEndTabPage : public SfxTabPage public: SwSectionFtnEndTabPage( vcl::Window *pParent, const SfxItemSet &rAttrSet ); virtual ~SwSectionFtnEndTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); }; class SwSectionIndentTabPage : public SfxTabPage { - MetricField* m_pBeforeMF; - MetricField* m_pAfterMF; - SvxParaPrevWindow* m_pPreviewWin; + VclPtr<MetricField> m_pBeforeMF; + VclPtr<MetricField> m_pAfterMF; + VclPtr<SvxParaPrevWindow> m_pPreviewWin; DECL_LINK(IndentModifyHdl, void *); public: SwSectionIndentTabPage( vcl::Window *pParent, const SfxItemSet &rAttrSet ); virtual ~SwSectionIndentTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); void SetWrtShell(SwWrtShell& rSh); diff --git a/sw/source/uibase/inc/rowht.hxx b/sw/source/uibase/inc/rowht.hxx index 25d9e7c918f3..9727c8d9d555 100644 --- a/sw/source/uibase/inc/rowht.hxx +++ b/sw/source/uibase/inc/rowht.hxx @@ -28,8 +28,8 @@ class SwWrtShell; class SwTableHeightDlg : public SvxStandardDialog { - MetricField* m_pHeightEdit; - CheckBox* m_pAutoHeightCB; + VclPtr<MetricField> m_pHeightEdit; + VclPtr<CheckBox> m_pAutoHeightCB; SwWrtShell &rSh; protected: @@ -37,6 +37,8 @@ protected: public: SwTableHeightDlg( vcl::Window *pParent, SwWrtShell &rS ); + virtual ~SwTableHeightDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/selglos.hxx b/sw/source/uibase/inc/selglos.hxx index 501af9a28200..e67f3788a2f2 100644 --- a/sw/source/uibase/inc/selglos.hxx +++ b/sw/source/uibase/inc/selglos.hxx @@ -29,11 +29,14 @@ class SwSelGlossaryDlg : public ModalDialog { protected: - ListBox* m_pGlosBox; + VclPtr<ListBox> m_pGlosBox; DECL_LINK(DoubleClickHdl, ListBox*); public: SwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShortName); + virtual ~SwSelGlossaryDlg(); + virtual void dispose() SAL_OVERRIDE; + void InsertGlos(const OUString &rRegion, const OUString &rGlosName) { const OUString aTmp = rRegion + ":" + rGlosName; diff --git a/sw/source/uibase/inc/shdwcrsr.hxx b/sw/source/uibase/inc/shdwcrsr.hxx index 631fde3d7f5b..dcb38480dd16 100644 --- a/sw/source/uibase/inc/shdwcrsr.hxx +++ b/sw/source/uibase/inc/shdwcrsr.hxx @@ -27,7 +27,7 @@ namespace vcl { class Window; } class SwShadowCursor { - vcl::Window* pWin; + VclPtr<vcl::Window> pWin; Color aCol; Point aOldPt; long nOldHeight; diff --git a/sw/source/uibase/inc/splittbl.hxx b/sw/source/uibase/inc/splittbl.hxx index 3bcce8bb03bc..cc6a96d2c5f7 100644 --- a/sw/source/uibase/inc/splittbl.hxx +++ b/sw/source/uibase/inc/splittbl.hxx @@ -27,10 +27,10 @@ class SwWrtShell; class SwSplitTblDlg : public SvxStandardDialog { - RadioButton* mpCntntCopyRB; - RadioButton* mpBoxAttrCopyWithParaRB ; - RadioButton* mpBoxAttrCopyNoParaRB ; - RadioButton* mpBorderCopyRB; + VclPtr<RadioButton> mpCntntCopyRB; + VclPtr<RadioButton> mpBoxAttrCopyWithParaRB ; + VclPtr<RadioButton> mpBoxAttrCopyNoParaRB ; + VclPtr<RadioButton> mpBorderCopyRB; SwWrtShell &rShell; sal_uInt16 m_nSplit; @@ -40,6 +40,8 @@ protected: public: SwSplitTblDlg( vcl::Window *pParent, SwWrtShell &rSh ); + virtual ~SwSplitTblDlg(); + virtual void dispose() SAL_OVERRIDE; sal_uInt16 GetSplitMode() const { return m_nSplit; } }; diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx index 153d9e17d09d..8e1a411c645a 100644 --- a/sw/source/uibase/inc/srcedtw.hxx +++ b/sw/source/uibase/inc/srcedtw.hxx @@ -69,9 +69,9 @@ private: ExtTextView* pTextView; ExtTextEngine* pTextEngine; - TextViewOutWin* pOutWin; - ScrollBar *pHScrollbar, - *pVScrollbar; + VclPtr<TextViewOutWin> pOutWin; + VclPtr<ScrollBar> pHScrollbar, + pVScrollbar; SwSrcView* pSrcView; @@ -118,6 +118,7 @@ protected: public: SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ); virtual ~SwSrcEditWindow(); + virtual void dispose() SAL_OVERRIDE; void SetScrollBarRanges(); void InitScrollBars(); diff --git a/sw/source/uibase/inc/srcview.hxx b/sw/source/uibase/inc/srcview.hxx index ab37058fb371..5e0c4e5a5839 100644 --- a/sw/source/uibase/inc/srcview.hxx +++ b/sw/source/uibase/inc/srcview.hxx @@ -32,7 +32,7 @@ class SfxMedium; class SwSrcView: public SfxViewShell { - SwSrcEditWindow aEditWin; + VclPtr<SwSrcEditWindow> aEditWin; SvxSearchItem* pSearchItem; @@ -64,11 +64,11 @@ public: virtual ~SwSrcView(); SwDocShell* GetDocShell(); - SwSrcEditWindow& GetEditWin() {return aEditWin;} + SwSrcEditWindow& GetEditWin() { return *aEditWin.get(); } void SaveContent(const OUString& rTmpFile); void SaveContentTo(SfxMedium& rMed); - bool IsModified() {return aEditWin.IsModified();} + bool IsModified() {return aEditWin->IsModified();} void Execute(SfxRequest&); void GetState(SfxItemSet&); diff --git a/sw/source/uibase/inc/srtdlg.hxx b/sw/source/uibase/inc/srtdlg.hxx index a20fdeb6f04a..7facf548a45d 100644 --- a/sw/source/uibase/inc/srtdlg.hxx +++ b/sw/source/uibase/inc/srtdlg.hxx @@ -31,38 +31,38 @@ class CollatorResource; class SwSortDlg : public SvxStandardDialog { - FixedText* m_pColLbl; - FixedText* m_pTypLbl; + VclPtr<FixedText> m_pColLbl; + VclPtr<FixedText> m_pTypLbl; - CheckBox* m_pKeyCB1; - NumericField* m_pColEdt1; - ListBox* m_pTypDLB1; - RadioButton* m_pSortUp1RB; - RadioButton* m_pSortDn1RB; + VclPtr<CheckBox> m_pKeyCB1; + VclPtr<NumericField> m_pColEdt1; + VclPtr<ListBox> m_pTypDLB1; + VclPtr<RadioButton> m_pSortUp1RB; + VclPtr<RadioButton> m_pSortDn1RB; - CheckBox* m_pKeyCB2; - NumericField* m_pColEdt2; - ListBox* m_pTypDLB2; - RadioButton* m_pSortUp2RB; - RadioButton* m_pSortDn2RB; + VclPtr<CheckBox> m_pKeyCB2; + VclPtr<NumericField> m_pColEdt2; + VclPtr<ListBox> m_pTypDLB2; + VclPtr<RadioButton> m_pSortUp2RB; + VclPtr<RadioButton> m_pSortDn2RB; - CheckBox* m_pKeyCB3; - NumericField* m_pColEdt3; - ListBox* m_pTypDLB3; - RadioButton* m_pSortUp3RB; - RadioButton* m_pSortDn3RB; + VclPtr<CheckBox> m_pKeyCB3; + VclPtr<NumericField> m_pColEdt3; + VclPtr<ListBox> m_pTypDLB3; + VclPtr<RadioButton> m_pSortUp3RB; + VclPtr<RadioButton> m_pSortDn3RB; - RadioButton* m_pColumnRB; - RadioButton* m_pRowRB; + VclPtr<RadioButton> m_pColumnRB; + VclPtr<RadioButton> m_pRowRB; - RadioButton* m_pDelimTabRB; - RadioButton* m_pDelimFreeRB; - Edit* m_pDelimEdt; - PushButton* m_pDelimPB; + VclPtr<RadioButton> m_pDelimTabRB; + VclPtr<RadioButton> m_pDelimFreeRB; + VclPtr<Edit> m_pDelimEdt; + VclPtr<PushButton> m_pDelimPB; - SvxLanguageBox* m_pLangLB; + VclPtr<SvxLanguageBox> m_pLangLB; - CheckBox* m_pCaseCB; + VclPtr<CheckBox> m_pCaseCB; OUString aColTxt; OUString aRowTxt; @@ -85,6 +85,7 @@ class SwSortDlg : public SvxStandardDialog public: SwSortDlg(vcl::Window * pParent, SwWrtShell &rSh); virtual ~SwSortDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/swmessdialog.hxx b/sw/source/uibase/inc/swmessdialog.hxx index da9c8afe32fd..c8028265e616 100644 --- a/sw/source/uibase/inc/swmessdialog.hxx +++ b/sw/source/uibase/inc/swmessdialog.hxx @@ -20,14 +20,16 @@ class VclMultiLineEdit; class SwMessageAndEditDialog : public ModalDialog { protected: - OKButton* m_pOKPB; - FixedImage* m_pImageIM; - VclMultiLineEdit* m_pPrimaryMessage; - VclMultiLineEdit* m_pSecondaryMessage; - Edit* m_pEdit; + VclPtr<OKButton> m_pOKPB; + VclPtr<FixedImage> m_pImageIM; + VclPtr<VclMultiLineEdit> m_pPrimaryMessage; + VclPtr<VclMultiLineEdit> m_pSecondaryMessage; + VclPtr<Edit> m_pEdit; public: SwMessageAndEditDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription); + virtual ~SwMessageAndEditDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX diff --git a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx index 06ccac71cff0..2a4728a689e1 100644 --- a/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx +++ b/sw/source/uibase/inc/swmodalredlineacceptdlg.hxx @@ -30,6 +30,7 @@ class SwModalRedlineAcceptDlg : public SfxModalDialog public: SwModalRedlineAcceptDlg(vcl::Window *pParent); virtual ~SwModalRedlineAcceptDlg(); + virtual void dispose() SAL_OVERRIDE; void AcceptAll( bool bAccept ); virtual void Activate() SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/swrenamexnameddlg.hxx b/sw/source/uibase/inc/swrenamexnameddlg.hxx index aefb1efe0e91..84967e6fd9df 100644 --- a/sw/source/uibase/inc/swrenamexnameddlg.hxx +++ b/sw/source/uibase/inc/swrenamexnameddlg.hxx @@ -32,9 +32,9 @@ class SwRenameXNamedDlg : public ModalDialog { - Edit* m_pNewNameED; + VclPtr<Edit> m_pNewNameED; TextFilter m_aTextFilter; - OKButton* m_pOk; + VclPtr<OKButton> m_pOk; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess; @@ -48,6 +48,8 @@ public: SwRenameXNamedDlg( vcl::Window* pParent, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess ); + virtual ~SwRenameXNamedDlg(); + virtual void dispose() SAL_OVERRIDE; void SetForbiddenChars(const OUString& rSet) { diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx index 19b877f8253f..7e57c2abe0ae 100644 --- a/sw/source/uibase/inc/swruler.hxx +++ b/sw/source/uibase/inc/swruler.hxx @@ -34,6 +34,7 @@ public: SfxBindings& rBindings, WinBits nWinStyle); virtual ~SwCommentRuler (); + virtual void dispose() SAL_OVERRIDE; /** * Paint the ruler. @@ -43,11 +44,11 @@ public: protected: SwViewShell * mpViewShell; //< Shell to check if there is any comments on doc and their visibility - SwEditWin * mpSwWin; //< Used to get SwView to change the SideBar visibility + VclPtr<SwEditWin> mpSwWin; //< Used to get SwView to change the SideBar visibility bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it) Timer maFadeTimer; //< Timer for high/'low'light fading int mnFadeRate; //< From 0 to 100. 0 means not highlighted. - VirtualDevice maVirDev; //< VirtualDevice of this window. Just for convenience. + ScopedVclPtr<VirtualDevice> maVirDev; //< VirtualDevice of this window. Just for convenience. /** * Callback function to handle a mouse button down event. diff --git a/sw/source/uibase/inc/swuiccoll.hxx b/sw/source/uibase/inc/swuiccoll.hxx index fc903b33627f..a66a468823d9 100644 --- a/sw/source/uibase/inc/swuiccoll.hxx +++ b/sw/source/uibase/inc/swuiccoll.hxx @@ -26,18 +26,18 @@ class SwFmt; class SwCondCollPage : public SfxTabPage { - CheckBox* m_pConditionCB; + VclPtr<CheckBox> m_pConditionCB; - FixedText* m_pContextFT; - FixedText* m_pUsedFT; - SvTabListBox* m_pTbLinks; + VclPtr<FixedText> m_pContextFT; + VclPtr<FixedText> m_pUsedFT; + VclPtr<SvTabListBox> m_pTbLinks; - FixedText* m_pStyleFT; - ListBox* m_pStyleLB; - ListBox* m_pFilterLB; + VclPtr<FixedText> m_pStyleFT; + VclPtr<ListBox> m_pStyleLB; + VclPtr<ListBox> m_pFilterLB; - PushButton* m_pRemovePB; - PushButton* m_pAssignPB; + VclPtr<PushButton> m_pRemovePB; + VclPtr<PushButton> m_pAssignPB; std::vector<OUString> m_aStrArr; @@ -47,8 +47,8 @@ class SwCondCollPage : public SfxTabPage bool bNewTemplate; - SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwCondCollPage(); + virtual void dispose() SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE; @@ -62,8 +62,9 @@ class SwCondCollPage : public SfxTabPage static const sal_uInt16 aPageRg[]; public: + SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet); - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); static const sal_uInt16* GetRanges() { return aPageRg; } virtual bool FillItemSet( SfxItemSet *rSet) SAL_OVERRIDE; diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx index 41f57750c17a..a4af88ff19b1 100644 --- a/sw/source/uibase/inc/swuicnttab.hxx +++ b/sw/source/uibase/inc/swuicnttab.hxx @@ -61,8 +61,8 @@ struct SwIndexSections_Impl; class SwMultiTOXTabDialog : public SfxTabDialog { - vcl::Window* m_pExampleContainerWIN; - CheckBox* m_pShowExampleCB; + VclPtr<vcl::Window> m_pExampleContainerWIN; + VclPtr<CheckBox> m_pShowExampleCB; SwTOXMgr* pMgr; SwWrtShell& rSh; @@ -102,6 +102,7 @@ public: SwTOXBase* pCurTOX, sal_uInt16 nToxType = USHRT_MAX, bool bGlobal = false); virtual ~SwMultiTOXTabDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE; @@ -130,65 +131,65 @@ class IndexEntrySupplierWrapper; class SwTOXSelectTabPage : public SfxTabPage { - Edit* m_pTitleED; - FixedText* m_pTypeFT; - ListBox* m_pTypeLB; - CheckBox* m_pReadOnlyCB; + VclPtr<Edit> m_pTitleED; + VclPtr<FixedText> m_pTypeFT; + VclPtr<ListBox> m_pTypeLB; + VclPtr<CheckBox> m_pReadOnlyCB; - VclContainer* m_pAreaFrame; - ListBox* m_pAreaLB; - FixedText* m_pLevelFT; //content, user - NumericField* m_pLevelNF; //content, user + VclPtr<VclContainer> m_pAreaFrame; + VclPtr<ListBox> m_pAreaLB; + VclPtr<FixedText> m_pLevelFT; //content, user + VclPtr<NumericField> m_pLevelNF; //content, user //content - VclContainer* m_pCreateFrame; // content, user, illustration - CheckBox* m_pFromHeadingsCB; - CheckBox* m_pAddStylesCB; - PushButton* m_pAddStylesPB; + VclPtr<VclContainer> m_pCreateFrame; // content, user, illustration + VclPtr<CheckBox> m_pFromHeadingsCB; + VclPtr<CheckBox> m_pAddStylesCB; + VclPtr<PushButton> m_pAddStylesPB; //user - CheckBox* m_pFromTablesCB; - CheckBox* m_pFromFramesCB; - CheckBox* m_pFromGraphicsCB; - CheckBox* m_pFromOLECB; - CheckBox* m_pLevelFromChapterCB; + VclPtr<CheckBox> m_pFromTablesCB; + VclPtr<CheckBox> m_pFromFramesCB; + VclPtr<CheckBox> m_pFromGraphicsCB; + VclPtr<CheckBox> m_pFromOLECB; + VclPtr<CheckBox> m_pLevelFromChapterCB; //illustration + table - RadioButton* m_pFromCaptionsRB; - RadioButton* m_pFromObjectNamesRB; + VclPtr<RadioButton> m_pFromCaptionsRB; + VclPtr<RadioButton> m_pFromObjectNamesRB; //illustration and tables - FixedText* m_pCaptionSequenceFT; - ListBox* m_pCaptionSequenceLB; - FixedText* m_pDisplayTypeFT; - ListBox* m_pDisplayTypeLB; + VclPtr<FixedText> m_pCaptionSequenceFT; + VclPtr<ListBox> m_pCaptionSequenceLB; + VclPtr<FixedText> m_pDisplayTypeFT; + VclPtr<ListBox> m_pDisplayTypeLB; //all but illustration and table - CheckBox* m_pTOXMarksCB; + VclPtr<CheckBox> m_pTOXMarksCB; //index only - VclContainer* m_pIdxOptionsFrame; - CheckBox* m_pCollectSameCB; - CheckBox* m_pUseFFCB; - CheckBox* m_pUseDashCB; - CheckBox* m_pCaseSensitiveCB; - CheckBox* m_pInitialCapsCB; - CheckBox* m_pKeyAsEntryCB; - CheckBox* m_pFromFileCB; - MenuButton* m_pAutoMarkPB; + VclPtr<VclContainer> m_pIdxOptionsFrame; + VclPtr<CheckBox> m_pCollectSameCB; + VclPtr<CheckBox> m_pUseFFCB; + VclPtr<CheckBox> m_pUseDashCB; + VclPtr<CheckBox> m_pCaseSensitiveCB; + VclPtr<CheckBox> m_pInitialCapsCB; + VclPtr<CheckBox> m_pKeyAsEntryCB; + VclPtr<CheckBox> m_pFromFileCB; + VclPtr<MenuButton> m_pAutoMarkPB; // object only SwOLENames aFromNames; - SvxCheckListBox* m_pFromObjCLB; - VclContainer* m_pFromObjFrame; + VclPtr<SvxCheckListBox> m_pFromObjCLB; + VclPtr<VclContainer> m_pFromObjFrame; - CheckBox* m_pSequenceCB; - ListBox* m_pBracketLB; - VclContainer* m_pAuthorityFrame; + VclPtr<CheckBox> m_pSequenceCB; + VclPtr<ListBox> m_pBracketLB; + VclPtr<VclContainer> m_pAuthorityFrame; //all - VclContainer* m_pSortFrame; - SvxLanguageBox* m_pLanguageLB; - ListBox* m_pSortAlgorithmLB; + VclPtr<VclContainer> m_pSortFrame; + VclPtr<SvxLanguageBox> m_pLanguageLB; + VclPtr<ListBox> m_pSortAlgorithmLB; IndexEntryResource* pIndexRes; @@ -221,6 +222,7 @@ class SwTOXSelectTabPage : public SfxTabPage public: SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet); virtual ~SwTOXSelectTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; @@ -228,7 +230,7 @@ public: virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE; virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); void SelectType(TOXTypes eSet); //preset TOXType, GlobalDoc @@ -241,15 +243,15 @@ class SwTOXEntryTabPage; class SwTokenWindow : public VclHBox, public VclBuilderContainer { - typedef std::vector<Control*>::iterator ctrl_iterator; - typedef std::vector<Control*>::const_iterator ctrl_const_iterator; - typedef std::vector<Control*>::reverse_iterator ctrl_reverse_iterator; - typedef std::vector<Control*>::const_reverse_iterator ctrl_const_reverse_iterator; - - Button* m_pLeftScrollWin; - vcl::Window* m_pCtrlParentWin; - Button* m_pRightScrollWin; - std::vector<Control*> aControlList; + typedef std::vector<VclPtr<Control> >::iterator ctrl_iterator; + typedef std::vector<VclPtr<Control> >::const_iterator ctrl_const_iterator; + typedef std::vector<VclPtr<Control> >::reverse_iterator ctrl_reverse_iterator; + typedef std::vector<VclPtr<Control> >::const_reverse_iterator ctrl_const_reverse_iterator; + + VclPtr<Button> m_pLeftScrollWin; + VclPtr<vcl::Window> m_pCtrlParentWin; + VclPtr<Button> m_pRightScrollWin; + std::vector<VclPtr<Control> > aControlList; SwForm* pForm; sal_uInt16 nLevel; bool bValid; @@ -257,14 +259,14 @@ class SwTokenWindow : public VclHBox, public VclBuilderContainer OUString aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons OUString sCharStyle; Link aButtonSelectedHdl; - Control* pActiveCtrl; + VclPtr<Control> pActiveCtrl; Link aModifyHdl; OUString accessibleName; OUString sAdditionalAccnameString1; OUString sAdditionalAccnameString2; OUString sAdditionalAccnameString3; - SwTOXEntryTabPage* m_pParent; + VclPtr<SwTOXEntryTabPage> m_pParent; DECL_LINK(EditResize, Edit*); DECL_LINK(NextItemHdl, SwTOXEdit* ); @@ -283,6 +285,7 @@ class SwTokenWindow : public VclHBox, public VclBuilderContainer public: SwTokenWindow(vcl::Window* pParent); virtual ~SwTokenWindow(); + virtual void dispose() SAL_OVERRIDE; void SetTabPage(SwTOXEntryTabPage *pParent) { m_pParent = pParent; } @@ -325,76 +328,79 @@ class SwTOXEntryTabPage; class SwIdxTreeListBox : public SvTreeListBox { - SwTOXEntryTabPage* pParent; + VclPtr<SwTOXEntryTabPage> pParent; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; public: SwIdxTreeListBox(vcl::Window* pPar, WinBits nStyle); + virtual ~SwIdxTreeListBox(); + virtual void dispose() SAL_OVERRIDE; + void SetTabPage(SwTOXEntryTabPage* pPar) { pParent = pPar; } }; class SwTOXEntryTabPage : public SfxTabPage { - FixedText* m_pLevelFT; - SwIdxTreeListBox* m_pLevelLB; + VclPtr<FixedText> m_pLevelFT; + VclPtr<SwIdxTreeListBox> m_pLevelLB; - SwTokenWindow* m_pTokenWIN; + VclPtr<SwTokenWindow> m_pTokenWIN; - PushButton* m_pAllLevelsPB; + VclPtr<PushButton> m_pAllLevelsPB; - PushButton* m_pEntryNoPB; - PushButton* m_pEntryPB; - PushButton* m_pTabPB; - PushButton* m_pChapterInfoPB; - PushButton* m_pPageNoPB; - PushButton* m_pHyperLinkPB; + VclPtr<PushButton> m_pEntryNoPB; + VclPtr<PushButton> m_pEntryPB; + VclPtr<PushButton> m_pTabPB; + VclPtr<PushButton> m_pChapterInfoPB; + VclPtr<PushButton> m_pPageNoPB; + VclPtr<PushButton> m_pHyperLinkPB; - ListBox* m_pAuthFieldsLB; - PushButton* m_pAuthInsertPB; - PushButton* m_pAuthRemovePB; + VclPtr<ListBox> m_pAuthFieldsLB; + VclPtr<PushButton> m_pAuthInsertPB; + VclPtr<PushButton> m_pAuthRemovePB; - ListBox* m_pCharStyleLB; // character style of the current token - PushButton* m_pEditStylePB; + VclPtr<ListBox> m_pCharStyleLB; // character style of the current token + VclPtr<PushButton> m_pEditStylePB; - FixedText* m_pChapterEntryFT; - ListBox* m_pChapterEntryLB; // type of chapter info + VclPtr<FixedText> m_pChapterEntryFT; + VclPtr<ListBox> m_pChapterEntryLB; // type of chapter info - FixedText* m_pNumberFormatFT; - ListBox* m_pNumberFormatLB; //!< format for numbering (E#) + VclPtr<FixedText> m_pNumberFormatFT; + VclPtr<ListBox> m_pNumberFormatLB; //!< format for numbering (E#) - FixedText* m_pEntryOutlineLevelFT; //!< Fixed text, for i53420 - NumericField* m_pEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420 + VclPtr<FixedText> m_pEntryOutlineLevelFT; //!< Fixed text, for i53420 + VclPtr<NumericField> m_pEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420 - FixedText* m_pFillCharFT; - ComboBox* m_pFillCharCB; // fill char for tab stop + VclPtr<FixedText> m_pFillCharFT; + VclPtr<ComboBox> m_pFillCharCB; // fill char for tab stop - FixedText* m_pTabPosFT; - MetricField* m_pTabPosMF; // tab stop position - CheckBox* m_pAutoRightCB; + VclPtr<FixedText> m_pTabPosFT; + VclPtr<MetricField> m_pTabPosMF; // tab stop position + VclPtr<CheckBox> m_pAutoRightCB; - VclContainer* m_pFormatFrame; - FixedText* m_pMainEntryStyleFT; - ListBox* m_pMainEntryStyleLB; // character style of main entries in indexes - CheckBox* m_pAlphaDelimCB; - CheckBox* m_pCommaSeparatedCB; - CheckBox* m_pRelToStyleCB; // position relative to the right margin of the para style + VclPtr<VclContainer> m_pFormatFrame; + VclPtr<FixedText> m_pMainEntryStyleFT; + VclPtr<ListBox> m_pMainEntryStyleLB; // character style of main entries in indexes + VclPtr<CheckBox> m_pAlphaDelimCB; + VclPtr<CheckBox> m_pCommaSeparatedCB; + VclPtr<CheckBox> m_pRelToStyleCB; // position relative to the right margin of the para style - VclContainer* m_pSortingFrame; - RadioButton* m_pSortDocPosRB; - RadioButton* m_pSortContentRB; + VclPtr<VclContainer> m_pSortingFrame; + VclPtr<RadioButton> m_pSortDocPosRB; + VclPtr<RadioButton> m_pSortContentRB; - VclContainer* m_pSortKeyFrame; - ListBox* m_pFirstKeyLB; - RadioButton* m_pFirstSortUpRB; - RadioButton* m_pFirstSortDownRB; + VclPtr<VclContainer> m_pSortKeyFrame; + VclPtr<ListBox> m_pFirstKeyLB; + VclPtr<RadioButton> m_pFirstSortUpRB; + VclPtr<RadioButton> m_pFirstSortDownRB; - ListBox* m_pSecondKeyLB; - RadioButton* m_pSecondSortUpRB; - RadioButton* m_pSecondSortDownRB; + VclPtr<ListBox> m_pSecondKeyLB; + VclPtr<RadioButton> m_pSecondSortUpRB; + VclPtr<RadioButton> m_pSecondSortDownRB; - ListBox* m_pThirdKeyLB; - RadioButton* m_pThirdSortUpRB; - RadioButton* m_pThirdSortDownRB; + VclPtr<ListBox> m_pThirdKeyLB; + VclPtr<RadioButton> m_pThirdSortUpRB; + VclPtr<RadioButton> m_pThirdSortDownRB; OUString sDelimStr; OUString sLevelStr; @@ -434,14 +440,15 @@ class SwTOXEntryTabPage : public SfxTabPage public: SwTOXEntryTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet); virtual ~SwTOXEntryTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE; virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); void SetWrtShell(SwWrtShell& rSh); OUString GetLevelHelp(sal_uInt16 nLevel) const; @@ -453,11 +460,11 @@ public: class SwTOXStylesTabPage : public SfxTabPage { - ListBox* m_pLevelLB; - PushButton* m_pAssignBT; - ListBox* m_pParaLayLB; - PushButton* m_pStdBT; - PushButton* m_pEditStyleBT; + VclPtr<ListBox> m_pLevelLB; + VclPtr<PushButton> m_pAssignBT; + VclPtr<ListBox> m_pParaLayLB; + VclPtr<PushButton> m_pStdBT; + VclPtr<PushButton> m_pEditStyleBT; SwForm* m_pCurrentForm; @@ -480,6 +487,7 @@ class SwTOXStylesTabPage : public SfxTabPage public: SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& rAttrSet); virtual ~SwTOXStylesTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; @@ -487,8 +495,8 @@ public: virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE; virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet); }; diff --git a/sw/source/uibase/inc/swuiidxmrk.hxx b/sw/source/uibase/inc/swuiidxmrk.hxx index 0f559a63eb85..040c97d7628a 100644 --- a/sw/source/uibase/inc/swuiidxmrk.hxx +++ b/sw/source/uibase/inc/swuiidxmrk.hxx @@ -51,40 +51,40 @@ class SwIndexMarkPane friend class SwIndexMarkFloatDlg; friend class SwIndexMarkModalDlg; - VclFrame* m_pFrame; - FixedText* m_pTypeFT; - ListBox* m_pTypeDCB; - PushButton* m_pNewBT; - - Edit* m_pEntryED; - FixedText* m_pPhoneticFT0; - Edit* m_pPhoneticED0; - - FixedText* m_pKey1FT; - ComboBox* m_pKey1DCB; - FixedText* m_pPhoneticFT1; - Edit* m_pPhoneticED1; - - FixedText* m_pKey2FT; - ComboBox* m_pKey2DCB; - FixedText* m_pPhoneticFT2; - Edit* m_pPhoneticED2; - - FixedText* m_pLevelFT; - NumericField* m_pLevelNF; - CheckBox* m_pMainEntryCB; - CheckBox* m_pApplyToAllCB; - CheckBox* m_pSearchCaseSensitiveCB; - CheckBox* m_pSearchCaseWordOnlyCB; - - PushButton* m_pOKBT; - CloseButton* m_pCloseBT; - PushButton* m_pDelBT; - - PushButton* m_pPrevSameBT; - PushButton* m_pNextSameBT; - PushButton* m_pPrevBT; - PushButton* m_pNextBT; + VclPtr<VclFrame> m_pFrame; + VclPtr<FixedText> m_pTypeFT; + VclPtr<ListBox> m_pTypeDCB; + VclPtr<PushButton> m_pNewBT; + + VclPtr<Edit> m_pEntryED; + VclPtr<FixedText> m_pPhoneticFT0; + VclPtr<Edit> m_pPhoneticED0; + + VclPtr<FixedText> m_pKey1FT; + VclPtr<ComboBox> m_pKey1DCB; + VclPtr<FixedText> m_pPhoneticFT1; + VclPtr<Edit> m_pPhoneticED1; + + VclPtr<FixedText> m_pKey2FT; + VclPtr<ComboBox> m_pKey2DCB; + VclPtr<FixedText> m_pPhoneticFT2; + VclPtr<Edit> m_pPhoneticED2; + + VclPtr<FixedText> m_pLevelFT; + VclPtr<NumericField> m_pLevelNF; + VclPtr<CheckBox> m_pMainEntryCB; + VclPtr<CheckBox> m_pApplyToAllCB; + VclPtr<CheckBox> m_pSearchCaseSensitiveCB; + VclPtr<CheckBox> m_pSearchCaseWordOnlyCB; + + VclPtr<PushButton> m_pOKBT; + VclPtr<CloseButton> m_pCloseBT; + VclPtr<PushButton> m_pDelBT; + + VclPtr<PushButton> m_pPrevSameBT; + VclPtr<PushButton> m_pNextSameBT; + VclPtr<PushButton> m_pPrevBT; + VclPtr<PushButton> m_pNextBT; OUString aOrgStr; bool bDel; @@ -182,17 +182,17 @@ class SwAuthorMarkPane friend class SwAuthMarkModalDlg; friend class SwAuthMarkFloatDlg; - RadioButton* m_pFromComponentRB; - RadioButton* m_pFromDocContentRB; - FixedText* m_pAuthorFI; - FixedText* m_pTitleFI; - Edit* m_pEntryED; - ListBox* m_pEntryLB; - - PushButton* m_pActionBT; - CloseButton* m_pCloseBT; - PushButton* m_pCreateEntryPB; - PushButton* m_pEditEntryPB; + VclPtr<RadioButton> m_pFromComponentRB; + VclPtr<RadioButton> m_pFromDocContentRB; + VclPtr<FixedText> m_pAuthorFI; + VclPtr<FixedText> m_pTitleFI; + VclPtr<Edit> m_pEntryED; + VclPtr<ListBox> m_pEntryLB; + + VclPtr<PushButton> m_pActionBT; + VclPtr<CloseButton> m_pCloseBT; + VclPtr<PushButton> m_pCreateEntryPB; + VclPtr<PushButton> m_pEditEntryPB; bool bNewEntry; bool bBibAccessInitialized; diff --git a/sw/source/uibase/inc/syncbtn.hxx b/sw/source/uibase/inc/syncbtn.hxx index 76f8be74749a..83a16070a5d7 100644 --- a/sw/source/uibase/inc/syncbtn.hxx +++ b/sw/source/uibase/inc/syncbtn.hxx @@ -25,12 +25,14 @@ class SwSyncBtnDlg : public SfxFloatingWindow { - PushButton* m_pSyncBtn; + VclPtr<PushButton> m_pSyncBtn; DECL_LINK( BtnHdl, void* ); public: SwSyncBtnDlg(SfxBindings*, SfxChildWindow*, vcl::Window *pParent); + virtual ~SwSyncBtnDlg(); + virtual void dispose() SAL_OVERRIDE; }; class SwSyncChildWin : public SfxChildWindow diff --git a/sw/source/uibase/inc/tautofmt.hxx b/sw/source/uibase/inc/tautofmt.hxx index 603301b94ba4..fac2b1224840 100644 --- a/sw/source/uibase/inc/tautofmt.hxx +++ b/sw/source/uibase/inc/tautofmt.hxx @@ -39,18 +39,18 @@ enum AutoFmtLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE }; class SwAutoFormatDlg : public SfxModalDialog { - ListBox* m_pLbFormat; - VclContainer* m_pFormatting; - CheckBox* m_pBtnNumFormat; - CheckBox* m_pBtnBorder; - CheckBox* m_pBtnFont; - CheckBox* m_pBtnPattern; - CheckBox* m_pBtnAlignment; - OKButton* m_pBtnOk; - CancelButton* m_pBtnCancel; - PushButton* m_pBtnAdd; - PushButton* m_pBtnRemove; - PushButton* m_pBtnRename; + VclPtr<ListBox> m_pLbFormat; + VclPtr<VclContainer> m_pFormatting; + VclPtr<CheckBox> m_pBtnNumFormat; + VclPtr<CheckBox> m_pBtnBorder; + VclPtr<CheckBox> m_pBtnFont; + VclPtr<CheckBox> m_pBtnPattern; + VclPtr<CheckBox> m_pBtnAlignment; + VclPtr<OKButton> m_pBtnOk; + VclPtr<CancelButton> m_pBtnCancel; + VclPtr<PushButton> m_pBtnAdd; + VclPtr<PushButton> m_pBtnRemove; + VclPtr<PushButton> m_pBtnRename; OUString aStrTitle; OUString aStrLabel; OUString aStrClose; @@ -58,7 +58,7 @@ class SwAutoFormatDlg : public SfxModalDialog OUString aStrDelMsg; OUString aStrRenameTitle; OUString aStrInvalidFmt; - AutoFmtPreview* m_pWndPreview; + VclPtr<AutoFmtPreview> m_pWndPreview; SwWrtShell* pShell; SwTableAutoFmtTbl* pTableTbl; @@ -82,6 +82,7 @@ public: bool bSetAutoFmt = true, const SwTableAutoFmt* pSelFmt = 0 ); virtual ~SwAutoFormatDlg(); + virtual void dispose() SAL_OVERRIDE; void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const; }; diff --git a/sw/source/uibase/inc/tblctrl.hxx b/sw/source/uibase/inc/tblctrl.hxx index 33dad5f048fb..659591b4575d 100644 --- a/sw/source/uibase/inc/tblctrl.hxx +++ b/sw/source/uibase/inc/tblctrl.hxx @@ -31,7 +31,7 @@ public: virtual ~SwTableOptimizeCtrl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; diff --git a/sw/source/uibase/inc/tbxanchr.hxx b/sw/source/uibase/inc/tbxanchr.hxx index 64aebb711229..fcc6db520fe9 100644 --- a/sw/source/uibase/inc/tbxanchr.hxx +++ b/sw/source/uibase/inc/tbxanchr.hxx @@ -29,7 +29,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; virtual void Click() SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/sw/source/uibase/inc/titlepage.hxx b/sw/source/uibase/inc/titlepage.hxx index 598b5821d173..a881cc41ff6c 100644 --- a/sw/source/uibase/inc/titlepage.hxx +++ b/sw/source/uibase/inc/titlepage.hxx @@ -24,22 +24,22 @@ class SwPageDesc; class SwTitlePageDlg : public SfxModalDialog { private: - RadioButton* m_pUseExistingPagesRB; - NumericField* m_pPageCountNF; + VclPtr<RadioButton> m_pUseExistingPagesRB; + VclPtr<NumericField> m_pPageCountNF; - RadioButton* m_pDocumentStartRB; - RadioButton* m_pPageStartRB; - NumericField* m_pPageStartNF; + VclPtr<RadioButton> m_pDocumentStartRB; + VclPtr<RadioButton> m_pPageStartRB; + VclPtr<NumericField> m_pPageStartNF; - CheckBox* m_pRestartNumberingCB; - NumericField* m_pRestartNumberingNF; - CheckBox* m_pSetPageNumberCB; - NumericField* m_pSetPageNumberNF; + VclPtr<CheckBox> m_pRestartNumberingCB; + VclPtr<NumericField> m_pRestartNumberingNF; + VclPtr<CheckBox> m_pSetPageNumberCB; + VclPtr<NumericField> m_pSetPageNumberNF; - ListBox* m_pPagePropertiesLB; - PushButton* m_pPagePropertiesPB; + VclPtr<ListBox> m_pPagePropertiesLB; + VclPtr<PushButton> m_pPagePropertiesPB; - OKButton* m_pOkPB; + VclPtr<OKButton> m_pOkPB; SwWrtShell *mpSh; @@ -63,6 +63,7 @@ private: public: SwTitlePageDlg( vcl::Window *pParent ); virtual ~SwTitlePageDlg(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/unotools.hxx b/sw/source/uibase/inc/unotools.hxx index 8d4220f20ffe..d4cd7078b685 100644 --- a/sw/source/uibase/inc/unotools.hxx +++ b/sw/source/uibase/inc/unotools.hxx @@ -73,7 +73,7 @@ class SW_DLLPUBLIC SwOneExampleFrame ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController; ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor; - SwFrmCtrlWindow aTopWindow; + VclPtr<SwFrmCtrlWindow> aTopWindow; Idle aLoadedIdle; Link aInitializedLink; diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx index 8cd1d5cf01ca..1e76ee5a3398 100644 --- a/sw/source/uibase/inc/view.hxx +++ b/sw/source/uibase/inc/view.hxx @@ -187,7 +187,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell Size m_aDocSz; // current document size Rectangle m_aVisArea; // visible region - SwEditWin *m_pEditWin; + VclPtr<SwEditWin> m_pEditWin; SwWrtShell *m_pWrtShell; SfxShell *m_pShell; // current SubShell at the dispatcher @@ -195,21 +195,21 @@ class SW_DLLPUBLIC SwView: public SfxViewShell SwView_Impl *m_pViewImpl; // Impl-data for UNO + Basic - SwScrollbar *m_pHScrollbar, // MDI control elements - *m_pVScrollbar; + VclPtr<SwScrollbar> m_pHScrollbar, // MDI control elements + m_pVScrollbar; bool m_bHScrollbarEnabled; bool m_bVScrollbarEnabled; - ::vcl::Window *m_pScrollFill; // dummy window for filling the lower right edge + VclPtr<::vcl::Window> m_pScrollFill; // dummy window for filling the lower right edge // when both scrollbars are active - SvxRuler *m_pHRuler, - *m_pVRuler; - ImageButton *m_pTogglePageBtn; + VclPtr<SvxRuler> m_pHRuler, + m_pVRuler; + VclPtr<ImageButton> m_pTogglePageBtn; - SwHlpImageButton *m_pPageUpBtn, - *m_pPageDownBtn; + VclPtr<SwHlpImageButton> m_pPageUpBtn, + m_pPageDownBtn; SwGlossaryHdl *m_pGlosHdl; // handle text block SwDrawBase *m_pDrawActual; @@ -221,7 +221,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell SwPostItMgr *m_pPostItMgr; int m_nSelectionType; - FloatingWindow *m_pFieldPopup; + VclPtr<FloatingWindow> m_pFieldPopup; static const int m_nMASTERENUMCOMMANDS = 6; @@ -663,7 +663,7 @@ public: // methods for printing SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) SAL_OVERRIDE; SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const SAL_OVERRIDE; - SAL_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window* pParent, + SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet) SAL_OVERRIDE; }; @@ -682,9 +682,9 @@ inline const SwDocShell *SwView::GetDocShell() const return const_cast<SwView*>(this)->GetDocShell(); } -SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, - const SfxItemSet &rOptions, - bool bPreview); +VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, + const SfxItemSet &rOptions, + bool bPreview); #endif diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx index 6048a83d86be..63aa450f3aeb 100644 --- a/sw/source/uibase/inc/wordcountdialog.hxx +++ b/sw/source/uibase/inc/wordcountdialog.hxx @@ -33,22 +33,22 @@ class SwWordCountFloatDlg : public SfxModelessDialog void showCJK(bool bShowCJK); void showStandardizedPages(bool bShowStandardizedPages); - FixedText* m_pCurrentWordFT; - FixedText* m_pCurrentCharacterFT; - FixedText* m_pCurrentCharacterExcludingSpacesFT; - FixedText* m_pCurrentCjkcharsFT; - FixedText* m_pCurrentStandardizedPagesFT; + VclPtr<FixedText> m_pCurrentWordFT; + VclPtr<FixedText> m_pCurrentCharacterFT; + VclPtr<FixedText> m_pCurrentCharacterExcludingSpacesFT; + VclPtr<FixedText> m_pCurrentCjkcharsFT; + VclPtr<FixedText> m_pCurrentStandardizedPagesFT; - FixedText* m_pDocWordFT; - FixedText* m_pDocCharacterFT; - FixedText* m_pDocCharacterExcludingSpacesFT; - FixedText* m_pDocCjkcharsFT; - FixedText* m_pDocStandardizedPagesFT; + VclPtr<FixedText> m_pDocWordFT; + VclPtr<FixedText> m_pDocCharacterFT; + VclPtr<FixedText> m_pDocCharacterExcludingSpacesFT; + VclPtr<FixedText> m_pDocCjkcharsFT; + VclPtr<FixedText> m_pDocStandardizedPagesFT; - FixedText* m_pCjkcharsLabelFT; - FixedText* m_pStandardizedPagesLabelFT; + VclPtr<FixedText> m_pCjkcharsLabelFT; + VclPtr<FixedText> m_pStandardizedPagesLabelFT; - CloseButton* m_pClosePB; + VclPtr<CloseButton> m_pClosePB; DECL_LINK( CloseHdl, void* ); public: @@ -57,6 +57,7 @@ public: vcl::Window *pParent, SfxChildWinInfo* pInfo); virtual ~SwWordCountFloatDlg(); + virtual void dispose() SAL_OVERRIDE; void UpdateCounts(); void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat); diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx index 6bb9c1f5377c..85c45282e6eb 100644 --- a/sw/source/uibase/inc/workctrl.hxx +++ b/sw/source/uibase/inc/workctrl.hxx @@ -65,7 +65,7 @@ public: virtual ~SwTbxInsertCtrl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; @@ -85,7 +85,7 @@ public: virtual ~SwTbxAutoTextCtrl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; @@ -102,7 +102,7 @@ public: virtual ~SwTbxFieldCtrl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; @@ -114,7 +114,7 @@ class SwScrollNaviPopup; class SwScrollNaviToolBox : public ToolBox { - SwScrollNaviPopup *m_pNaviPopup; + VclPtr<SwScrollNaviPopup> m_pNaviPopup; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; @@ -125,12 +125,14 @@ public: , m_pNaviPopup(pNaviPopup) { } + virtual ~SwScrollNaviToolBox(); + virtual void dispose() SAL_OVERRIDE; }; class SwScrollNaviPopup : public SfxPopupWindow { - SwScrollNaviToolBox* m_pToolBox; - FixedText* m_pInfoField; + VclPtr<SwScrollNaviToolBox> m_pToolBox; + VclPtr<FixedText> m_pInfoField; ImageList aIList; OUString sQuickHelp[2 * NID_COUNT]; @@ -146,10 +148,11 @@ protected: public: SwScrollNaviPopup( sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window *pParent ); virtual ~SwScrollNaviPopup(); + virtual void dispose() SAL_OVERRIDE; static OUString GetQuickHelpText(bool bNext); - virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; void GrabFocus() { m_pToolBox->GrabFocus(); } }; @@ -178,7 +181,7 @@ public: SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx index cd69f5ca98d3..cf5eda21ee2b 100644 --- a/sw/source/uibase/inc/wrap.hxx +++ b/sw/source/uibase/inc/wrap.hxx @@ -43,24 +43,24 @@ public: class SwWrapTabPage: public SfxTabPage { // WRAPPING - RadioButton* m_pNoWrapRB; - RadioButton* m_pWrapLeftRB; - RadioButton* m_pWrapRightRB; - RadioButton* m_pWrapParallelRB; - RadioButton* m_pWrapThroughRB; - RadioButton* m_pIdealWrapRB; + VclPtr<RadioButton> m_pNoWrapRB; + VclPtr<RadioButton> m_pWrapLeftRB; + VclPtr<RadioButton> m_pWrapRightRB; + VclPtr<RadioButton> m_pWrapParallelRB; + VclPtr<RadioButton> m_pWrapThroughRB; + VclPtr<RadioButton> m_pIdealWrapRB; // MARGIN - MetricField* m_pLeftMarginED; - MetricField* m_pRightMarginED; - MetricField* m_pTopMarginED; - MetricField* m_pBottomMarginED; + VclPtr<MetricField> m_pLeftMarginED; + VclPtr<MetricField> m_pRightMarginED; + VclPtr<MetricField> m_pTopMarginED; + VclPtr<MetricField> m_pBottomMarginED; // OPTIONS - CheckBox* m_pWrapAnchorOnlyCB; - CheckBox* m_pWrapTransparentCB; - CheckBox* m_pWrapOutlineCB; - CheckBox* m_pWrapOutsideCB; + VclPtr<CheckBox> m_pWrapAnchorOnlyCB; + VclPtr<CheckBox> m_pWrapTransparentCB; + VclPtr<CheckBox> m_pWrapOutlineCB; + VclPtr<CheckBox> m_pWrapOutsideCB; sal_uInt16 nOldLeftMargin; sal_uInt16 nOldRightMargin; @@ -79,8 +79,8 @@ class SwWrapTabPage: public SfxTabPage bool bDrawMode; bool bContourImage; - SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet); virtual ~SwWrapTabPage(); + virtual void dispose() SAL_OVERRIDE; void ApplyImageList(); void EnableModes(const SfxItemSet& rSet); @@ -98,8 +98,9 @@ class SwWrapTabPage: public SfxTabPage static const sal_uInt16 aWrapPageRg[]; public: + SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet); - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE; diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index 5cba01ec71c6..5dd31fb7b31f 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -803,9 +803,9 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) uno::Any exc( ::cppu::getCaughtException() ); OUString msg( ::comphelper::anyToString( exc ) ); const SolarMutexGuard guard; - MessageDialog aErrorBox(NULL, msg); - aErrorBox.SetText( "Explanations" ); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg); + aErrorBox->SetText( "Explanations" ); + aErrorBox->Execute(); } } else if (nId == FN_REDLINE_ACCEPT_DIRECT || nId == FN_REDLINE_REJECT_DIRECT diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx index f973411b850f..0a0f9f6c33d5 100644 --- a/sw/source/uibase/misc/glshell.cxx +++ b/sw/source/uibase/misc/glshell.cxx @@ -248,7 +248,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - SfxPrinter* pPrinter = new SfxPrinter( pSet ); + VclPtr<SfxPrinter> pPrinter = VclPtr<SfxPrinter>::Create( pSet ); // and append it to the document. xDocSh->GetDoc()->getIDocumentDeviceAccess().setPrinter( pPrinter, true, true ); diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index 33361a478546..8f8264e0bc3c 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -63,7 +63,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwNumberingTypeListBox SwNumberingTypeListBox::~SwNumberingTypeListBox() { + disposeOnce(); +} + +void SwNumberingTypeListBox::dispose() +{ delete pImpl; + ListBox::dispose(); } void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags) diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 1db1ec86d86b..e0ba28d8874e 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -67,9 +67,9 @@ SwRedlineAcceptChild::SwRedlineAcceptChild( vcl::Window* _pParent, SfxChildWinInfo* pInfo ) : SwChildWinWrapper( _pParent, nId ) { - pWindow = new SwModelessRedlineAcceptDlg( pBindings, this, _pParent); + pWindow = VclPtr<SwModelessRedlineAcceptDlg>::Create( pBindings, this, _pParent); - static_cast<SwModelessRedlineAcceptDlg *>(pWindow)->Initialize(pInfo); + static_cast<SwModelessRedlineAcceptDlg *>(pWindow.get())->Initialize(pInfo); } // newly initialise dialog after document switch @@ -137,13 +137,19 @@ void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg() { + disposeOnce(); +} + +void SwModelessRedlineAcceptDlg::dispose() +{ delete pImplDlg; + SfxModelessDialog::dispose(); } SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer *pBuilder, vcl::Window *pContentArea, bool bAutoFmt) : pParentDlg (pParent), - aTabPagesCTRL (pContentArea, pBuilder), + aTabPagesCTRL (VclPtr<SvxAcceptChgCtr>::Create(pContentArea, pBuilder)), aPopup (SW_RES(MN_REDLINE_POPUP)), sInserted (SW_RES(STR_REDLINE_INSERTED)), sDeleted (SW_RES(STR_REDLINE_DELETED)), @@ -156,8 +162,8 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer bRedlnAutoFmt (bAutoFmt), bInhibitActivate( false ) { - aTabPagesCTRL.SetHelpId(HID_REDLINE_CTRL); - pTPView = aTabPagesCTRL.GetViewPage(); + aTabPagesCTRL->SetHelpId(HID_REDLINE_CTRL); + pTPView = aTabPagesCTRL->GetViewPage(); pTable = pTPView->GetTableControl(); @@ -173,9 +179,9 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer pTPView->EnableAcceptAll(false); pTPView->EnableRejectAll(false); - aTabPagesCTRL.GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl)); + aTabPagesCTRL->GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl)); - ListBox *pActLB = aTabPagesCTRL.GetFilterPage()->GetLbAction(); + ListBox *pActLB = aTabPagesCTRL->GetFilterPage()->GetLbAction(); pActLB->InsertEntry(sInserted); pActLB->InsertEntry(sDeleted); pActLB->InsertEntry(sFormated); @@ -215,6 +221,7 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer SwRedlineAcceptDlg::~SwRedlineAcceptDlg() { + aTabPagesCTRL.disposeAndClear(); } void SwRedlineAcceptDlg::Init(sal_uInt16 nStart) @@ -247,7 +254,7 @@ void SwRedlineAcceptDlg::InitAuthors() { SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage(); + SvxTPFilter *pFilterPage = aTabPagesCTRL->GetFilterPage(); std::vector<OUString> aStrings; OUString sOldAuthor(pFilterPage->GetSelectedAuthor()); @@ -911,7 +918,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, UndoHdl) IMPL_LINK_NOARG(SwRedlineAcceptDlg, FilterChangedHdl) { - SvxTPFilter *pFilterTP = aTabPagesCTRL.GetFilterPage(); + SvxTPFilter *pFilterTP = aTabPagesCTRL->GetFilterPage(); if (pFilterTP->IsAction()) sFilterAction = pFilterTP->GetLbAction()->GetSelectEntry(); @@ -1242,7 +1249,13 @@ SwRedlineAcceptPanel::SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno: SwRedlineAcceptPanel::~SwRedlineAcceptPanel() { + disposeOnce(); +} + +void SwRedlineAcceptPanel::dispose() +{ delete mpImplDlg; + PanelLayout::dispose(); } void SwRedlineAcceptPanel::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) diff --git a/sw/source/uibase/misc/swruler.cxx b/sw/source/uibase/misc/swruler.cxx index b9d43d094ec1..db2adb767018 100644 --- a/sw/source/uibase/misc/swruler.cxx +++ b/sw/source/uibase/misc/swruler.cxx @@ -41,7 +41,7 @@ SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEd , mpSwWin(pWin) , mbIsHighlighted(false) , mnFadeRate(0) -, maVirDev( *this ) +, maVirDev( VclPtr<VirtualDevice>::Create(*this) ) { // Set fading timeout: 5 x 40ms = 200ms maFadeTimer.SetTimeout(40); @@ -51,6 +51,13 @@ SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEd // Destructor SwCommentRuler::~SwCommentRuler() { + disposeOnce(); +} + +void SwCommentRuler::dispose() +{ + mpSwWin.clear(); + SvxRuler::dispose(); } void SwCommentRuler::Paint( const Rectangle& rRect ) @@ -68,25 +75,25 @@ void SwCommentRuler::DrawCommentControl() bool bIsCollapsed = ! mpViewShell->GetPostItMgr()->ShowNotes(); Rectangle aControlRect = GetCommentControlRegion(); - maVirDev.SetOutputSizePixel( aControlRect.GetSize() ); + maVirDev->SetOutputSizePixel( aControlRect.GetSize() ); // Paint comment control background // TODO Check if these are best colors to be used Color aBgColor = GetFadedColor( rStyleSettings.GetDarkShadowColor(), rStyleSettings.GetWorkspaceColor() ); - maVirDev.SetFillColor( aBgColor ); + maVirDev->SetFillColor( aBgColor ); if ( mbIsHighlighted || !bIsCollapsed ) { // Draw borders - maVirDev.SetLineColor( rStyleSettings.GetShadowColor() ); + maVirDev->SetLineColor( rStyleSettings.GetShadowColor() ); } else { // No borders - maVirDev.SetLineColor(); + maVirDev->SetLineColor(); } - maVirDev.DrawRect( Rectangle( Point(), aControlRect.GetSize() ) ); + maVirDev->DrawRect( Rectangle( Point(), aControlRect.GetSize() ) ); // Label and arrow tip OUString aLabel( SW_RESSTR ( STR_COMMENTS_LABEL ) ); @@ -135,9 +142,9 @@ void SwCommentRuler::DrawCommentControl() // Draw label Color aTextColor = GetFadedColor( rStyleSettings.GetButtonTextColor(), rStyleSettings.GetDarkShadowColor() ); - maVirDev.SetTextColor( aTextColor ); + maVirDev->SetTextColor( aTextColor ); // FIXME Expected font size? - maVirDev.DrawText( aLabelPos, aLabel ); + maVirDev->DrawText( aLabelPos, aLabel ); // Draw arrow // FIXME consistence of button colors. http://opengrok.libreoffice.org/xref/core/vcl/source/control/button.cxx#785 @@ -145,26 +152,26 @@ void SwCommentRuler::DrawCommentControl() ImplDrawArrow ( aArrowPos.X(), aArrowPos.Y(), aArrowColor, bArrowToRight ); // Blit comment control - DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), maVirDev ); + DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), *maVirDev.get() ); } void SwCommentRuler::ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight) { - maVirDev.SetLineColor(); - maVirDev.SetFillColor( rColor ); + maVirDev->SetLineColor(); + maVirDev->SetFillColor( rColor ); if ( bPointRight ) { - maVirDev.DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) ); - maVirDev.DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) ); - maVirDev.DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) ); - maVirDev.DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); + maVirDev->DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) ); + maVirDev->DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) ); + maVirDev->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) ); + maVirDev->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); } else { - maVirDev.DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) ); - maVirDev.DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) ); - maVirDev.DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) ); - maVirDev.DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) ); + maVirDev->DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) ); + maVirDev->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) ); + maVirDev->DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) ); + maVirDev->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) ); } } diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index 981fc7660cdb..c20543cdd59e 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -58,8 +58,8 @@ SFX_IMPL_POS_CHILDWINDOW_WITHID( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OB SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : ToolBox( pParent , SW_RES( RID_TBX_FORMULA )), - aPos( this, SW_RES(ED_POS)), - aEdit( this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION), + aPos( VclPtr<Edit>::Create(this, SW_RES(ED_POS))), + aEdit( VclPtr<InputEdit>::Create(this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION)), aPopMenu( SW_RES(MN_CALC_POPUP)), pMgr(0), pWrtShell(0), @@ -75,7 +75,7 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) FreeResource(); - aEdit.SetSizePixel( aEdit.CalcMinimumSize() ); + aEdit->SetSizePixel( aEdit->CalcMinimumSize() ); SfxImageManager* pManager = SfxImageManager::GetImageManager( *SW_MOD() ); pManager->RegisterToolBox(this); @@ -83,15 +83,15 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) pView = ::GetActiveView(); pWrtShell = pView ? pView->GetWrtShellPtr() : 0; - InsertWindow( ED_POS, &aPos, ToolBoxItemBits::NONE, 0); + InsertWindow( ED_POS, aPos.get(), ToolBoxItemBits::NONE, 0); SetItemText(ED_POS, SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); - aPos.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); + aPos->SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TOOLBAR)); InsertSeparator ( 1 ); InsertSeparator (); - InsertWindow( ED_FORMULA, &aEdit); + InsertWindow( ED_FORMULA, aEdit.get()); SetItemText(ED_FORMULA, SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); - aEdit.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); + aEdit->SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); SetHelpId(ED_FORMULA, HID_EDIT_FORMULA); SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC )); @@ -102,7 +102,7 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl )); Size aSizeTbx = CalcWindowSizePixel(); - Size aEditSize = aEdit.GetSizePixel(); + Size aEditSize = aEdit->GetSizePixel(); Rectangle aItemRect( GetItemRect(FN_FORMULA_CALC) ); long nMaxHeight = (aEditSize.Height() > aItemRect.GetHeight()) ? aEditSize.Height() : aItemRect.GetHeight(); if( nMaxHeight+2 > aSizeTbx.Height() ) @@ -112,21 +112,26 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent, SfxBindings* pBind ) SetSizePixel( aSize ); // align edit and item vcentered - Size aPosSize = aPos.GetSizePixel(); + Size aPosSize = aPos->GetSizePixel(); aPosSize.Height() = nMaxHeight; aEditSize.Height() = nMaxHeight; - Point aPosPos = aPos.GetPosPixel(); - Point aEditPos = aEdit.GetPosPixel(); + Point aPosPos = aPos->GetPosPixel(); + Point aEditPos = aEdit->GetPosPixel(); aPosPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1; aEditPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1; - aPos.SetPosSizePixel( aPosPos, aPosSize ); - aEdit.SetPosSizePixel( aEditPos, aEditSize ); + aPos->SetPosSizePixel( aPosPos, aPosSize ); + aEdit->SetPosSizePixel( aEditPos, aEditSize ); aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl )); } SwInputWindow::~SwInputWindow() { + disposeOnce(); +} + +void SwInputWindow::dispose() +{ SfxImageManager::GetImageManager( *SW_MOD() )->ReleaseToolBox(this); // wake rulers @@ -140,6 +145,10 @@ SwInputWindow::~SwInputWindow() pWrtShell->EndSelTblCells(); CleanupUglyHackWithUndo(); + + aPos.disposeAndClear(); + aEdit.disposeAndClear(); + ToolBox::dispose(); } void SwInputWindow::CleanupUglyHackWithUndo() @@ -179,12 +188,12 @@ void SwInputWindow::Resize() ToolBox::Resize(); long nWidth = GetSizePixel().Width(); - long nLeft = aEdit.GetPosPixel().X(); - Size aEditSize = aEdit.GetSizePixel(); + long nLeft = aEdit->GetPosPixel().X(); + Size aEditSize = aEdit->GetSizePixel(); aEditSize.Width() = std::max( ((long)(nWidth - nLeft - 5)), (long)0 ); - aEdit.SetSizePixel( aEditSize ); - aEdit.Invalidate(); + aEdit->SetSizePixel( aEditSize ); + aEdit->Invalidate(); } void SwInputWindow::ShowWin() @@ -210,11 +219,11 @@ void SwInputWindow::ShowWin() short nSrch = -1; while( (nPos = rPos.indexOf( ':',nPos + 1 ) ) != -1 ) nSrch = (short) nPos; - aPos.SetText( rPos.copy( ++nSrch ) ); + aPos->SetText( rPos.copy( ++nSrch ) ); aAktTableName = pWrtShell->GetTableFmt()->GetName(); } else - aPos.SetText(SW_RESSTR(STR_TBL_FORMULA)); + aPos->SetText(SW_RESSTR(STR_TBL_FORMULA)); // Edit current field OSL_ENSURE(pMgr == 0, "FieldManager not deleted"); @@ -273,15 +282,15 @@ void SwInputWindow::ShowWin() bFirst = false; - aEdit.SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl )); + aEdit->SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl )); - aEdit.SetText( sEdit ); - aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); + aEdit->SetText( sEdit ); + aEdit->SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); sOldFml = sEdit; - aEdit.Invalidate(); - aEdit.Update(); - aEdit.GrabFocus(); + aEdit->Invalidate(); + aEdit->Update(); + aEdit->GrabFocus(); // For input cut the UserInterface pView->GetEditWin().LockKeyInput(true); @@ -326,7 +335,7 @@ static const char * const aStrArr[] = { { OUString aTmp( OUString::createFromAscii(aStrArr[nId - 1]) ); aTmp += " "; - aEdit.ReplaceSelected( aTmp ); + aEdit->ReplaceSelected( aTmp ); } return 0; } @@ -376,7 +385,7 @@ void SwInputWindow::ApplyFormula() pWrtShell->Pop( false ); // Formular should always begin with "=", so remove it here again - OUString sEdit(comphelper::string::strip(aEdit.GetText(), ' ')); + OUString sEdit(comphelper::string::strip(aEdit->GetText(), ' ')); if( !sEdit.isEmpty() && '=' == sEdit[0] ) sEdit = sEdit.copy( 1 ); SfxStringItem aParam(FN_EDIT_FORMULA, sEdit); @@ -422,11 +431,11 @@ IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller ) if( pTblFmt && aAktTableName != pTblFmt->GetName() ) sTblNm = pTblFmt->GetName(); - aEdit.UpdateRange( sBoxNms, sTblNm ); + aEdit->UpdateRange( sBoxNms, sTblNm ); OUString sNew; sNew += OUString(CH_LRE); - sNew += aEdit.GetText(); + sNew += aEdit->GetText(); sNew += OUString(CH_PDF); if( sNew != sOldFml ) @@ -449,7 +458,7 @@ IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller ) } } else - aEdit.GrabFocus(); + aEdit->GrabFocus(); return 0; } @@ -463,9 +472,9 @@ void SwInputWindow::SetFormula( const OUString& rFormula, bool bDelFlag ) else sEdit += rFormula; } - aEdit.SetText( sEdit ); - aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); - aEdit.Invalidate(); + aEdit->SetText( sEdit ); + aEdit->SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); + aEdit->Invalidate(); bDelSel = bDelFlag; } @@ -477,7 +486,7 @@ IMPL_LINK_NOARG(SwInputWindow, ModifyHdl) DelBoxCntnt(); OUString sNew; sNew += OUString(CH_LRE); - sNew += aEdit.GetText(); + sNew += aEdit->GetText(); sNew += OUString(CH_PDF); pWrtShell->SwEditShell::Insert2( sNew ); pWrtShell->EndAllAction(); @@ -616,8 +625,8 @@ SwInputChild::SwInputChild(vcl::Window* _pParent, SfxChildWindow( _pParent, nId ) { pDispatch = pBindings->GetDispatcher(); - pWindow = new SwInputWindow( _pParent, pBindings ); - static_cast<SwInputWindow*>(pWindow)->ShowWin(); + pWindow = VclPtr<SwInputWindow>::Create( _pParent, pBindings ); + static_cast<SwInputWindow*>(pWindow.get())->ShowWin(); eChildAlignment = SfxChildAlignment::LOWESTTOP; } diff --git a/sw/source/uibase/ribbar/tblctrl.cxx b/sw/source/uibase/ribbar/tblctrl.cxx index b56e892c0da4..bcdc852aa382 100644 --- a/sw/source/uibase/ribbar/tblctrl.cxx +++ b/sw/source/uibase/ribbar/tblctrl.cxx @@ -41,7 +41,7 @@ SwTableOptimizeCtrl::~SwTableOptimizeCtrl() { } -SfxPopupWindow* SwTableOptimizeCtrl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SwTableOptimizeCtrl::CreatePopupWindow() { createAndPositionSubToolBar("private:resource/toolbar/optimizetablebar"); return NULL; diff --git a/sw/source/uibase/ribbar/tbxanchr.cxx b/sw/source/uibase/ribbar/tbxanchr.cxx index 1b747b16daa9..b25dd8aa1b56 100644 --- a/sw/source/uibase/ribbar/tbxanchr.cxx +++ b/sw/source/uibase/ribbar/tbxanchr.cxx @@ -62,7 +62,7 @@ void SwTbxAnchor::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const } -SfxPopupWindow* SwTbxAnchor::CreatePopupWindow() +VclPtr<SfxPopupWindow> SwTbxAnchor::CreatePopupWindow() { SwTbxAnchor::Click(); return 0; diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index b04dd47f240e..ed6208ca7c06 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -122,7 +122,7 @@ void SwTbxInsertCtrl::StateChanged( sal_uInt16 /*nSID*/, } -SfxPopupWindow* SwTbxInsertCtrl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SwTbxInsertCtrl::CreatePopupWindow() { if(GetSlotId() == FN_INSERT_CTRL) { @@ -176,7 +176,7 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl() DelPopup(); } -SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow() { SwView* pView = ::GetActiveView(); if(pView && !pView->GetDocShell()->IsReadOnly() && @@ -288,7 +288,7 @@ SwTbxFieldCtrl::~SwTbxFieldCtrl() { } -SfxPopupWindow* SwTbxFieldCtrl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SwTbxFieldCtrl::CreatePopupWindow() { SwView* pView = ::GetActiveView(); if(pView && !pView->GetDocShell()->IsReadOnly() && @@ -398,7 +398,7 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >& "modules/swriter/ui/floatingnavigation.ui", rFrame), aIList(SW_RES(IL_VALUES)) { - m_pToolBox = new SwScrollNaviToolBox(get<vcl::Window>("box"), this, 0); + m_pToolBox = VclPtr<SwScrollNaviToolBox>::Create(get<vcl::Window>("box"), this, 0); get(m_pInfoField, "label"); sal_uInt16 i; @@ -448,7 +448,14 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >& SwScrollNaviPopup::~SwScrollNaviPopup() { - delete m_pToolBox; + disposeOnce(); +} + +void SwScrollNaviPopup::dispose() +{ + m_pToolBox.disposeAndClear(); + m_pInfoField.clear(); + SfxPopupWindow::dispose(); } void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt ) @@ -470,9 +477,9 @@ void SwScrollNaviPopup::ApplyImageList() } } -SfxPopupWindow* SwScrollNaviPopup::Clone() const +VclPtr<SfxPopupWindow> SwScrollNaviPopup::Clone() const { - return new SwScrollNaviPopup( GetId(), GetFrame(), GetParent() ); + return VclPtr<SwScrollNaviPopup>::Create( GetId(), GetFrame(), GetParent() ); } IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet) @@ -503,6 +510,17 @@ IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet) return 0; } +SwScrollNaviToolBox::~SwScrollNaviToolBox() +{ + disposeOnce(); +} + +void SwScrollNaviToolBox::dispose() +{ + m_pNaviPopup.disposeAndClear(); + ToolBox::dispose(); +} + void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt ) { ToolBox::MouseButtonUp(rMEvt); @@ -515,7 +533,6 @@ void SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt ) SetItemText(NID_NEXT, SwScrollNaviPopup::GetQuickHelpText(true)); SetItemText(NID_PREV, SwScrollNaviPopup::GetQuickHelpText(false)); ToolBox::RequestHelp( rHEvt ); - } OUString SwScrollNaviPopup::GetQuickHelpText(bool bNext) @@ -699,10 +716,10 @@ void SwPreviewZoomControl::StateChanged( sal_uInt16 /*nSID*/, } } -vcl::Window* SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent ) { - SwZoomBox_Impl* pRet = new SwZoomBox_Impl( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY )); - return pRet; + VclPtrInstance<SwZoomBox_Impl> pRet( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY )); + return pRet.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index effa9f4b31aa..7823ca126637 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -163,19 +163,19 @@ void SwGrfShell::Execute(SfxRequest &rReq) Graphic aGraphic = Graphic( *pGraphic ); - CompressGraphicsDialog aDialog( GetView().GetWindow(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings() ); - if( aDialog.Execute() == RET_OK ) + ScopedVclPtrInstance< CompressGraphicsDialog > aDialog( GetView().GetWindow(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings() ); + if( aDialog->Execute() == RET_OK ) { rSh.StartAllAction(); rSh.StartUndo(UNDO_START); - Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle(); + Rectangle aScaledCropedRectangle = aDialog->GetScaledCropRectangle(); aCrop.SetLeft( convertMm100ToTwip( aScaledCropedRectangle.Left() )); aCrop.SetTop( convertMm100ToTwip( aScaledCropedRectangle.Top() )); aCrop.SetRight( convertMm100ToTwip( aScaledCropedRectangle.Right() )); aCrop.SetBottom( convertMm100ToTwip( aScaledCropedRectangle.Bottom() )); - Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() ); + Graphic aCompressedGraphic( aDialog->GetCompressedGraphic() ); rSh.ReRead(OUString(), OUString(), (const Graphic*) &aCompressedGraphic); rSh.SetAttrItem(aCrop); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 0631eced063e..ead7b165eb21 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -738,9 +738,9 @@ void SwTableShell::Execute(SfxRequest &rReq) break; case TBLMERGE_TOOCOMPLEX: { - MessageDialog aInfoBox( GetView().GetWindow(), + ScopedVclPtrInstance<MessageDialog> aInfoBox( GetView().GetWindow(), SW_RES( STR_ERR_TABLE_MERGE ), VCL_MESSAGE_INFO ); - aInfoBox.Execute(); + aInfoBox->Execute(); break; } default: diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 3c268fc3908e..0c0ed9b481da 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -257,23 +257,23 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const static short lcl_AskRedlineMode(vcl::Window *pWin) { - MessBox aQBox( pWin, 0, + ScopedVclPtrInstance<MessBox> aQBox( pWin, 0, OUString( SW_RES( STR_REDLINE_TITLE ) ), OUString( SW_RES( STR_REDLINE_MSG ) ) ); - aQBox.SetImage( QueryBox::GetStandardImage() ); + aQBox->SetImage( QueryBox::GetStandardImage() ); const sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON; - aQBox.AddButton(OUString(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags); - aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT); - aQBox.AddButton(OUString(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON); - aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT ); - aQBox.AddButton(OUString(SW_RES(STR_REDLINE_EDIT)), 2, 0); - aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG); - aQBox.SetButtonHelpText( RET_OK, OUString() ); + aQBox->AddButton(OUString(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags); + aQBox->GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT); + aQBox->AddButton(OUString(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON); + aQBox->GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT ); + aQBox->AddButton(OUString(SW_RES(STR_REDLINE_EDIT)), 2, 0); + aQBox->GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG); + aQBox->SetButtonHelpText( RET_OK, OUString() ); - return aQBox.Execute(); + return aQBox->Execute(); } void SwTextShell::Execute(SfxRequest &rReq) diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index 17015b256823..cd61fd1b1ec9 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -54,6 +54,7 @@ #include <shells.hrc> #include <SwStyleNameMapper.hxx> #include "swabstdlg.hxx" +#include "outline.hxx" #include "chrdlg.hrc" #include <boost/scoped_ptr.hpp> diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx index 2b28820e2b91..d7b857162f2f 100644 --- a/sw/source/uibase/shells/txtcrsr.cxx +++ b/sw/source/uibase/shells/txtcrsr.cxx @@ -43,6 +43,7 @@ #include <svx/svdouno.hxx> #include <svx/fmshell.hxx> #include <svx/sdrobjectfilter.hxx> +#include "outline.hxx" using namespace ::com::sun::star; diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx index a8aa1223d6d7..4bec55f89fc3 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.cxx +++ b/sw/source/uibase/sidebar/PageColumnControl.cxx @@ -38,7 +38,7 @@ PageColumnControl::PageColumnControl( const bool bLandscape ) : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) - , maMoreButton( this, SW_RES(CB_COLUMN_MORE) ) + , maMoreButton( VclPtr<PushButton>::Create( this, SW_RES(CB_COLUMN_MORE) ) ) , mnColumnType( nColumnType ) , mrPagePropPanel(rPanel) { @@ -69,15 +69,22 @@ PageColumnControl::PageColumnControl( mpColumnValueSet->Format(); mpColumnValueSet->StartSelection(); - maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); - maMoreButton.GrabFocus(); + maMoreButton->SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); + maMoreButton->GrabFocus(); FreeResource(); } PageColumnControl::~PageColumnControl() { - delete mpColumnValueSet; + disposeOnce(); +} + +void PageColumnControl::dispose() +{ + mpColumnValueSet.disposeAndClear(); + maMoreButton.disposeAndClear(); + ::svx::sidebar::PopupControl::dispose(); } IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl) diff --git a/sw/source/uibase/sidebar/PageColumnControl.hxx b/sw/source/uibase/sidebar/PageColumnControl.hxx index 508951a09670..79e22ccfd40f 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.hxx +++ b/sw/source/uibase/sidebar/PageColumnControl.hxx @@ -45,10 +45,11 @@ public: const bool bLandscape ); virtual ~PageColumnControl(); + virtual void dispose() SAL_OVERRIDE; private: - ::svx::sidebar::ValueSetWithTextControl* mpColumnValueSet; - PushButton maMoreButton; + VclPtr<::svx::sidebar::ValueSetWithTextControl> mpColumnValueSet; + VclPtr<PushButton> maMoreButton; sal_uInt16 mnColumnType; diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index 4760baecfeaf..aee46d43e074 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -50,18 +50,18 @@ PageMarginControl::PageMarginControl( const SfxMapUnit eUnit ) : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) ) , mpMarginValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) ) - , maCustom(this, SW_RES(FT_CUSTOM)) - , maLeft(this, SW_RES(FT_LEFT)) - , maInner(this, SW_RES(FT_INNER)) - , maLeftMarginEdit(this, SW_RES(MF_SWLEFT_MARGIN)) - , maRight(this, SW_RES(FT_RIGHT)) - , maOuter(this, SW_RES(FT_OUTER)) - , maRightMarginEdit(this, SW_RES(MF_SWRIGHT_MARGIN)) - , maTop(this, SW_RES(FT_TOP)) - , maTopMarginEdit(this, SW_RES(MF_SWTOP_MARGIN)) - , maBottom(this, SW_RES(FT_BOTTOM)) - , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN)) - , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , maCustom(VclPtr<FixedText>::Create(this, SW_RES(FT_CUSTOM))) + , maLeft(VclPtr<FixedText>::Create(this, SW_RES(FT_LEFT))) + , maInner(VclPtr<FixedText>::Create(this, SW_RES(FT_INNER))) + , maLeftMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWLEFT_MARGIN))) + , maRight(VclPtr<FixedText>::Create(this, SW_RES(FT_RIGHT))) + , maOuter(VclPtr<FixedText>::Create(this, SW_RES(FT_OUTER))) + , maRightMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWRIGHT_MARGIN))) + , maTop(VclPtr<FixedText>::Create(this, SW_RES(FT_TOP))) + , maTopMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWTOP_MARGIN))) + , maBottom(VclPtr<FixedText>::Create(this, SW_RES(FT_BOTTOM))) + , maBottomMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWBOTTOM_MARGIN))) + , maWidthHeightField(VclPtr<MetricField>::Create( this, SW_RES(FLD_WIDTH_HEIGHT) ) ) , mnPageLeftMargin( aPageLRMargin.GetLeft() ) , mnPageRightMargin( aPageLRMargin.GetRight() ) , mnPageTopMargin( aPageULMargin.GetUpper() ) @@ -77,8 +77,8 @@ PageMarginControl::PageMarginControl( , mbCustomValuesUsed( false ) , mrPagePropPanel(rPanel) { - maWidthHeightField.Hide(); - SetFieldUnit( maWidthHeightField, eFUnit ); + maWidthHeightField->Hide(); + SetFieldUnit( *maWidthHeightField.get(), eFUnit ); mbUserCustomValuesAvailable = GetUserCustomValues(); @@ -93,39 +93,39 @@ PageMarginControl::PageMarginControl( SelectValueSetItem(); - SetFieldUnit( maLeftMarginEdit, eFUnit ); + SetFieldUnit( *maLeftMarginEdit.get(), eFUnit ); Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl ); - maLeftMarginEdit.SetModifyHdl( aLinkLR ); - SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit ); + maLeftMarginEdit->SetModifyHdl( aLinkLR ); + SetMetricValue( *maLeftMarginEdit.get(), mnPageLeftMargin, meUnit ); - SetFieldUnit( maRightMarginEdit, eFUnit ); - maRightMarginEdit.SetModifyHdl( aLinkLR ); - SetMetricValue( maRightMarginEdit, mnPageRightMargin, meUnit ); + SetFieldUnit( *maRightMarginEdit.get(), eFUnit ); + maRightMarginEdit->SetModifyHdl( aLinkLR ); + SetMetricValue( *maRightMarginEdit.get(), mnPageRightMargin, meUnit ); Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl ); - SetFieldUnit( maTopMarginEdit, eFUnit ); - maTopMarginEdit.SetModifyHdl( aLinkUL ); - SetMetricValue( maTopMarginEdit, mnPageTopMargin, meUnit ); + SetFieldUnit( *maTopMarginEdit.get(), eFUnit ); + maTopMarginEdit->SetModifyHdl( aLinkUL ); + SetMetricValue( *maTopMarginEdit.get(), mnPageTopMargin, meUnit ); - SetFieldUnit( maBottomMarginEdit, eFUnit ); - maBottomMarginEdit.SetModifyHdl( aLinkUL ); - SetMetricValue( maBottomMarginEdit, mnPageBottomMargin, meUnit ); + SetFieldUnit( *maBottomMarginEdit.get(), eFUnit ); + maBottomMarginEdit->SetModifyHdl( aLinkUL ); + SetMetricValue( *maBottomMarginEdit.get(), mnPageBottomMargin, meUnit ); SetMetricFieldMaxValues(rPageSize); if ( mbMirrored ) { - maLeft.Hide(); - maRight.Hide(); - maInner.Show(); - maOuter.Show(); + maLeft->Hide(); + maRight->Hide(); + maInner->Show(); + maOuter->Show(); } else { - maLeft.Show(); - maRight.Show(); - maInner.Hide(); - maOuter.Hide(); + maLeft->Show(); + maRight->Show(); + maInner->Hide(); + maOuter->Hide(); } FreeResource(); @@ -133,36 +133,55 @@ PageMarginControl::PageMarginControl( PageMarginControl::~PageMarginControl() { - delete mpMarginValueSet; + disposeOnce(); +} + +void PageMarginControl::dispose() +{ + mpMarginValueSet.disposeAndClear(); StoreUserCustomValues(); + + maCustom.disposeAndClear(); + maLeft.disposeAndClear(); + maInner.disposeAndClear(); + maLeftMarginEdit.disposeAndClear(); + maRight.disposeAndClear(); + maOuter.disposeAndClear(); + maRightMarginEdit.disposeAndClear(); + maTop.disposeAndClear(); + maTopMarginEdit.disposeAndClear(); + maBottom.disposeAndClear(); + maBottomMarginEdit.disposeAndClear(); + maWidthHeightField.disposeAndClear(); + ::svx::sidebar::PopupControl::dispose(); } void PageMarginControl::SetMetricFieldMaxValues(const Size& rPageSize) { - const long nML = maLeftMarginEdit.Denormalize( maLeftMarginEdit.GetValue(FUNIT_TWIP) ); - const long nMR = maRightMarginEdit.Denormalize( maRightMarginEdit.GetValue(FUNIT_TWIP) ); - const long nMT = maTopMarginEdit.Denormalize(maTopMarginEdit.GetValue(FUNIT_TWIP) ); - const long nMB = maBottomMarginEdit.Denormalize( maBottomMarginEdit.GetValue(FUNIT_TWIP) ); + const long nML = maLeftMarginEdit->Denormalize( maLeftMarginEdit->GetValue(FUNIT_TWIP) ); + const long nMR = maRightMarginEdit->Denormalize( maRightMarginEdit->GetValue(FUNIT_TWIP) ); + const long nMT = maTopMarginEdit->Denormalize(maTopMarginEdit->GetValue(FUNIT_TWIP) ); + const long nMB = maBottomMarginEdit->Denormalize( maBottomMarginEdit->GetValue(FUNIT_TWIP) ); const long nPH = LogicToLogic( rPageSize.Height(), (MapUnit)meUnit, MAP_TWIP ); const long nPW = LogicToLogic( rPageSize.Width(), (MapUnit)meUnit, MAP_TWIP ); // Left long nMax = nPW - nMR - MINBODY; - maLeftMarginEdit.SetMax(maLeftMarginEdit.Normalize(nMax), FUNIT_TWIP); + maLeftMarginEdit->SetMax(maLeftMarginEdit->Normalize(nMax), FUNIT_TWIP); // Right nMax = nPW - nML - MINBODY; - maRightMarginEdit.SetMax(maRightMarginEdit.Normalize(nMax), FUNIT_TWIP); + maRightMarginEdit->SetMax(maRightMarginEdit->Normalize(nMax), FUNIT_TWIP); //Top nMax = nPH - nMB - MINBODY; - maTopMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + maTopMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP); //Bottom nMax = nPH - nMT - MINBODY; - maBottomMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + maBottomMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP); } void PageMarginControl::FillValueSet( @@ -174,8 +193,8 @@ void PageMarginControl::FillValueSet( const OUString aTop = SW_RESSTR(STR_MARGIN_TOOLTIP_TOP); const OUString aBottom = SW_RESSTR(STR_MARGIN_TOOLTIP_BOT); - SetMetricValue( maWidthHeightField, SWPAGE_NARROW_VALUE, meUnit ); - const OUString aNarrowValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_NARROW_VALUE, meUnit ); + const OUString aNarrowValText = maWidthHeightField->GetText(); OUString aHelpText = aLeft; aHelpText += aNarrowValText; aHelpText += aRight; @@ -188,8 +207,8 @@ void PageMarginControl::FillValueSet( Image((bLandscape) ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW)), 0, SW_RESSTR(STR_NARROW), &aHelpText ); - SetMetricValue( maWidthHeightField, SWPAGE_NORMAL_VALUE, meUnit ); - const OUString aNormalValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_NORMAL_VALUE, meUnit ); + const OUString aNormalValText = maWidthHeightField->GetText(); aHelpText = aLeft; aHelpText += aNormalValText; aHelpText += aRight; @@ -202,10 +221,10 @@ void PageMarginControl::FillValueSet( Image((bLandscape) ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL)), 0, SW_RESSTR(STR_NORMAL), &aHelpText ); - SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE1, meUnit ); - const OUString aWide1ValText = maWidthHeightField.GetText(); - SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE2, meUnit ); - const OUString aWide2ValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE1, meUnit ); + const OUString aWide1ValText = maWidthHeightField->GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE2, meUnit ); + const OUString aWide2ValText = maWidthHeightField->GetText(); aHelpText = aLeft; aHelpText += aWide2ValText; aHelpText += aRight; @@ -221,8 +240,8 @@ void PageMarginControl::FillValueSet( const OUString aInner = SW_RESSTR(STR_MARGIN_TOOLTIP_INNER); const OUString aOuter = SW_RESSTR(STR_MARGIN_TOOLTIP_OUTER); - SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE3, meUnit ); - const OUString aWide3ValText = maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE3, meUnit ); + const OUString aWide3ValText = maWidthHeightField->GetText(); aHelpText = aInner; aHelpText += aWide3ValText; aHelpText += aOuter; @@ -238,17 +257,17 @@ void PageMarginControl::FillValueSet( if ( bUserCustomValuesAvailable ) { aHelpText = mbUserCustomMirrored ? aInner : aLeft; - SetMetricValue( maWidthHeightField, mnUserCustomPageLeftMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageLeftMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); aHelpText += mbUserCustomMirrored ? aOuter : aRight; - SetMetricValue( maWidthHeightField, mnUserCustomPageRightMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageRightMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); aHelpText += aTop; - SetMetricValue( maWidthHeightField, mnUserCustomPageTopMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageTopMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); aHelpText += aBottom; - SetMetricValue( maWidthHeightField, mnUserCustomPageBottomMargin, meUnit ); - aHelpText += maWidthHeightField.GetText(); + SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageBottomMargin, meUnit ); + aHelpText += maWidthHeightField->GetText(); } else { @@ -389,8 +408,8 @@ IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG ) mpMarginValueSet->Format(); mpMarginValueSet->StartSelection(); - mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit ); - mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit ); + mnPageLeftMargin = GetCoreValue( *maLeftMarginEdit.get(), meUnit ); + mnPageRightMargin = GetCoreValue( *maRightMarginEdit.get(), meUnit ); mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); mbCustomValuesUsed = true; return 0; @@ -403,8 +422,8 @@ IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG ) mpMarginValueSet->Format(); mpMarginValueSet->StartSelection(); - mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit ); - mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit ); + mnPageTopMargin = GetCoreValue( *maTopMarginEdit.get(), meUnit ); + mnPageBottomMargin = GetCoreValue( *maBottomMarginEdit.get(), meUnit ); mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); mbCustomValuesUsed = true; return 0; diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx b/sw/source/uibase/sidebar/PageMarginControl.hxx index 6a0af3c4bea0..f6d8d28cef61 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.hxx +++ b/sw/source/uibase/sidebar/PageMarginControl.hxx @@ -61,24 +61,25 @@ public: const FieldUnit eFUnit, const SfxMapUnit eUnit ); virtual ~PageMarginControl(); + virtual void dispose() SAL_OVERRIDE; private: - ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet; - - FixedText maCustom; - FixedText maLeft; - FixedText maInner; - MetricField maLeftMarginEdit; - FixedText maRight; - FixedText maOuter; - MetricField maRightMarginEdit; - FixedText maTop; - MetricField maTopMarginEdit; - FixedText maBottom; - MetricField maBottomMarginEdit; + VclPtr<::svx::sidebar::ValueSetWithTextControl> mpMarginValueSet; + + VclPtr<FixedText> maCustom; + VclPtr<FixedText> maLeft; + VclPtr<FixedText> maInner; + VclPtr<MetricField> maLeftMarginEdit; + VclPtr<FixedText> maRight; + VclPtr<FixedText> maOuter; + VclPtr<MetricField> maRightMarginEdit; + VclPtr<FixedText> maTop; + VclPtr<MetricField> maTopMarginEdit; + VclPtr<FixedText> maBottom; + VclPtr<MetricField> maBottomMarginEdit; // hidden metric field - MetricField maWidthHeightField; + VclPtr<MetricField> maWidthHeightField; long mnPageLeftMargin; long mnPageRightMargin; diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx index 105eecccf13b..9e1b284a7328 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.cxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx @@ -63,7 +63,13 @@ PageOrientationControl::PageOrientationControl( PageOrientationControl::~PageOrientationControl() { - delete mpOrientationValueSet; + disposeOnce(); +} + +void PageOrientationControl::dispose() +{ + mpOrientationValueSet.disposeAndClear(); + ::svx::sidebar::PopupControl::dispose(); } IMPL_LINK(PageOrientationControl, ImplOrientationHdl, void *, pControl) diff --git a/sw/source/uibase/sidebar/PageOrientationControl.hxx b/sw/source/uibase/sidebar/PageOrientationControl.hxx index 15d7e785b2cc..2bf1f6773e72 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.hxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.hxx @@ -38,9 +38,10 @@ public: PagePropertyPanel& rPanel, const bool bLandscape ); virtual ~PageOrientationControl(); + virtual void dispose() SAL_OVERRIDE; private: - ::svx::sidebar::ValueSetWithTextControl* mpOrientationValueSet; + VclPtr<::svx::sidebar::ValueSetWithTextControl> mpOrientationValueSet; bool mbLandscape; diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.cxx b/sw/source/uibase/sidebar/PagePropertyPanel.cxx index ed4a66aeb3b1..48c7b5af3a2c 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.cxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.cxx @@ -83,7 +83,7 @@ namespace { namespace sw { namespace sidebar { -PagePropertyPanel* PagePropertyPanel::Create ( +VclPtr<vcl::Window> PagePropertyPanel::Create ( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -95,10 +95,13 @@ PagePropertyPanel* PagePropertyPanel::Create ( if (pBindings == NULL) throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2); - return new PagePropertyPanel( - pParent, - rxFrame, - pBindings); + return VclPtr<vcl::Window>( + VclPtr<PagePropertyPanel>::Create( + + pParent, + rxFrame, + pBindings), + SAL_NO_ACQUIRE); } PagePropertyPanel::PagePropertyPanel( @@ -200,8 +203,34 @@ PagePropertyPanel::PagePropertyPanel( PagePropertyPanel::~PagePropertyPanel() { + disposeOnce(); +} + +void PagePropertyPanel::dispose() +{ delete[] maImgSize; + maImgSize = NULL; delete[] maImgSize_L; + maImgSize_L = NULL; + + mpPageItem.reset(); + mpPageLRMarginItem.reset(); + mpPageULMarginItem.reset(); + mpPageSizeItem.reset(); + + mpToolBoxOrientation.clear(); + mpToolBoxMargin.clear(); + mpToolBoxSize.clear(); + mpToolBoxColumn.clear(); + + m_aSwPagePgULControl.dispose(); + m_aSwPagePgLRControl.dispose(); + m_aSwPagePgSizeControl.dispose(); + m_aSwPagePgControl.dispose(); + m_aSwPageColControl.dispose(); + m_aSwPagePgMetricControl.dispose(); + + PanelLayout::dispose(); } void PagePropertyPanel::Initialize() @@ -266,9 +295,9 @@ void PagePropertyPanel::Initialize() mpBindings->Update( SID_ATTR_PAGE_SIZE ); } -::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ) +VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ) { - return new PageOrientationControl( pParent, *this , mpPageItem->IsLandscape() ); + return VclPtr<PageOrientationControl>::Create( pParent, *this , mpPageItem->IsLandscape() ); } IMPL_LINK( PagePropertyPanel, ClickOrientationHdl, ToolBox*, pToolBox ) @@ -343,9 +372,10 @@ void PagePropertyPanel::ClosePageOrientationPopup() maOrientationPopup.Hide(); } -::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ) +VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ) { - return new PageMarginControl( + return VclPtr<PageMarginControl>::Create( + pParent, *this, *mpPageLRMarginItem.get(), @@ -393,9 +423,10 @@ void PagePropertyPanel::ClosePageMarginPopup() maMarginPopup.Hide(); } -::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ) +VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ) { - return new PageSizeControl( + return VclPtr<PageSizeControl>::Create( + pParent, *this, mePaper, @@ -427,9 +458,10 @@ void PagePropertyPanel::ClosePageSizePopup() maSizePopup.Hide(); } -::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ) +VclPtr<::svx::sidebar::PopupControl> PagePropertyPanel::CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ) { - return new PageColumnControl( + return VclPtr<PageColumnControl>::Create( + pParent, *this, mpPageColumnTypeItem->GetValue(), @@ -462,6 +494,9 @@ void PagePropertyPanel::NotifyItemUpdate( { (void)bIsEnabled; + if (IsDisposed()) + return; + switch( nSId ) { case SID_ATTR_PAGE_COLUMN: diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hxx b/sw/source/uibase/sidebar/PagePropertyPanel.hxx index 68e3bb3c074d..05119bf2b34a 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.hxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.hxx @@ -55,7 +55,7 @@ namespace sw { namespace sidebar { public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static PagePropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame, SfxBindings* pBindings ); @@ -72,11 +72,11 @@ namespace sw { namespace sidebar { return mpBindings; } - ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ); + VclPtr<::svx::sidebar::PopupControl> CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ); void ExecuteOrientationChange( const bool bLandscape ); void ClosePageOrientationPopup(); - ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ); + VclPtr<::svx::sidebar::PopupControl> CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ); void ExecuteMarginLRChange( const long nPageLeftMargin, const long nPageRightMargin ); @@ -86,31 +86,32 @@ namespace sw { namespace sidebar { void ExecutePageLayoutChange( const bool bMirrored ); void ClosePageMarginPopup(); - ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ); + VclPtr<::svx::sidebar::PopupControl> CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ); void ExecuteSizeChange( const Paper ePaper ); void ClosePageSizePopup(); - ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ); + VclPtr<::svx::sidebar::PopupControl> CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ); void ExecuteColumnChange( const sal_uInt16 nColumnType ); void ClosePageColumnPopup(); void StartUndo(); void EndUndo(); - private: PagePropertyPanel( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame, SfxBindings* pBindings ); + private: virtual ~PagePropertyPanel(); + virtual void dispose() SAL_OVERRIDE; SfxBindings* mpBindings; // toolboxes - on click open corresponding popup - ToolBox* mpToolBoxOrientation; - ToolBox* mpToolBoxMargin; - ToolBox* mpToolBoxSize; - ToolBox* mpToolBoxColumn; + VclPtr<ToolBox> mpToolBoxOrientation; + VclPtr<ToolBox> mpToolBoxMargin; + VclPtr<ToolBox> mpToolBoxSize; + VclPtr<ToolBox> mpToolBoxColumn; Image* maImgSize; Image* maImgSize_L; diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index dedc35530ce8..bc9c0b9be335 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -43,14 +43,14 @@ PageSizeControl::PageSizeControl( const FieldUnit eFUnit ) : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_SIZE) ) , mpSizeValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) ) - , maMoreButton( this, SW_RES(CB_SIZE_MORE) ) - , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , maMoreButton( VclPtr<PushButton>::Create( this, SW_RES(CB_SIZE_MORE) ) ) + , maWidthHeightField( VclPtr<MetricField>::Create( this, SW_RES(FLD_WIDTH_HEIGHT) ) ) , mePaper( ePaper ) , maPaperList() , mrPagePropPanel(rPanel) { - maWidthHeightField.Hide(); - SetFieldUnit( maWidthHeightField, eFUnit ); + maWidthHeightField->Hide(); + SetFieldUnit( *maWidthHeightField.get(), eFUnit ); maPaperList.push_back( PAPER_A3 ); maPaperList.push_back( PAPER_A4 ); @@ -68,7 +68,7 @@ PageSizeControl::PageSizeControl( { OUString aMetricStr; { - const OUString aText = maWidthHeightField.GetText(); + const OUString aText = maWidthHeightField->GetText(); for (short i = aText.getLength() - 1; i >= 0; i--) { sal_Unicode c = aText[i]; @@ -86,7 +86,7 @@ PageSizeControl::PageSizeControl( } } - const LocaleDataWrapper& localeDataWrapper = maWidthHeightField.GetLocaleDataWrapper(); + const LocaleDataWrapper& localeDataWrapper = maWidthHeightField->GetLocaleDataWrapper(); OUString aWidthStr; OUString aHeightStr; OUString aItemText2; @@ -99,19 +99,19 @@ PageSizeControl::PageSizeControl( { Swap( aPaperSize ); } - maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Width() ), FUNIT_TWIP ); + maWidthHeightField->SetValue( maWidthHeightField->Normalize( aPaperSize.Width() ), FUNIT_TWIP ); aWidthStr = localeDataWrapper.getNum( - maWidthHeightField.GetValue(), - maWidthHeightField.GetDecimalDigits(), - maWidthHeightField.IsUseThousandSep(), - maWidthHeightField.IsShowTrailingZeros() ); + maWidthHeightField->GetValue(), + maWidthHeightField->GetDecimalDigits(), + maWidthHeightField->IsUseThousandSep(), + maWidthHeightField->IsShowTrailingZeros() ); - maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Height() ), FUNIT_TWIP); + maWidthHeightField->SetValue( maWidthHeightField->Normalize( aPaperSize.Height() ), FUNIT_TWIP); aHeightStr = localeDataWrapper.getNum( - maWidthHeightField.GetValue(), - maWidthHeightField.GetDecimalDigits(), - maWidthHeightField.IsUseThousandSep(), - maWidthHeightField.IsShowTrailingZeros() ); + maWidthHeightField->GetValue(), + maWidthHeightField->GetDecimalDigits(), + maWidthHeightField->IsUseThousandSep(), + maWidthHeightField->IsShowTrailingZeros() ); aItemText2 = aWidthStr + " x " + aHeightStr + " " + aMetricStr; @@ -135,15 +135,23 @@ PageSizeControl::PageSizeControl( mpSizeValueSet->Format(); mpSizeValueSet->StartSelection(); - maMoreButton.SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) ); - maMoreButton.GrabFocus(); + maMoreButton->SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) ); + maMoreButton->GrabFocus(); FreeResource(); } PageSizeControl::~PageSizeControl() { - delete mpSizeValueSet; + disposeOnce(); +} + +void PageSizeControl::dispose() +{ + mpSizeValueSet.disposeAndClear(); + maMoreButton.disposeAndClear(); + maWidthHeightField.disposeAndClear(); + ::svx::sidebar::PopupControl::dispose(); } IMPL_LINK(PageSizeControl, ImplSizeHdl, void *, pControl) diff --git a/sw/source/uibase/sidebar/PageSizeControl.hxx b/sw/source/uibase/sidebar/PageSizeControl.hxx index bd3e9f0ca1b8..91f63cea737f 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.hxx +++ b/sw/source/uibase/sidebar/PageSizeControl.hxx @@ -48,12 +48,13 @@ public: const bool bLandscape, const FieldUnit eFUnit ); virtual ~PageSizeControl(); + virtual void dispose() SAL_OVERRIDE; private: - ::svx::sidebar::ValueSetWithTextControl* mpSizeValueSet; - PushButton maMoreButton; + VclPtr<::svx::sidebar::ValueSetWithTextControl> mpSizeValueSet; + VclPtr<PushButton> maMoreButton; // hidden metric field - MetricField maWidthHeightField; + VclPtr<MetricField> maWidthHeightField; Paper mePaper; ::std::vector< Paper > maPaperList; diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx index ead31d610595..c180c383446f 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx @@ -43,7 +43,7 @@ namespace sw { namespace sidebar { -StylePresetsPanel* StylePresetsPanel::Create (vcl::Window* pParent, +VclPtr<vcl::Window> StylePresetsPanel::Create (vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -54,7 +54,7 @@ StylePresetsPanel* StylePresetsPanel::Create (vcl::Window* pParent, if (pBindings == NULL) throw css::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2); - return new StylePresetsPanel(pParent, rxFrame, pBindings); + return VclPtr<vcl::Window>(new StylePresetsPanel(pParent, rxFrame, pBindings), SAL_NO_ACQUIRE); } StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent, @@ -91,6 +91,14 @@ StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent, StylePresetsPanel::~StylePresetsPanel() { + disposeOnce(); +} + +void StylePresetsPanel::dispose() +{ + mpListBox.disposeAndClear(); + + PanelLayout::dispose(); } IMPL_LINK_NOARG(StylePresetsPanel, DoubleClickHdl) diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.hxx b/sw/source/uibase/sidebar/StylePresetsPanel.hxx index 9560da8a6919..047272ea87ca 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.hxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.hxx @@ -42,7 +42,7 @@ class StylePresetsPanel : public PanelLayout, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static StylePresetsPanel* Create(vcl::Window* pParent, + static VclPtr<vcl::Window> Create(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -73,10 +73,11 @@ private: SfxBindings* pBindings); virtual ~StylePresetsPanel(); + virtual void dispose() SAL_OVERRIDE; SfxBindings* mpBindings; - ListBox* mpListBox; + VclPtr<ListBox> mpListBox; std::vector<std::unique_ptr<TemplateEntry>> maTemplateEntries; diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx index ea66e3b91ece..013519661a13 100644 --- a/sw/source/uibase/sidebar/SwPanelFactory.cxx +++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx @@ -121,7 +121,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( if (rsResourceURL.endsWith("/PagePropertyPanel")) { - sw::sidebar::PagePropertyPanel* pPanel = sw::sidebar::PagePropertyPanel::Create( pParentWindow, xFrame, pBindings ); + VclPtr<vcl::Window> pPanel = sw::sidebar::PagePropertyPanel::Create( pParentWindow, xFrame, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, @@ -130,7 +130,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/WrapPropertyPanel")) { - sw::sidebar::WrapPropertyPanel* pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + VclPtr<vcl::Window> pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, @@ -139,7 +139,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/NavigatorPanel")) { - vcl::Window* pPanel = new SwNavigationPI(pBindings, NULL, pParentWindow); + VclPtr<vcl::Window> pPanel( new SwNavigationPI(pBindings, NULL, pParentWindow), SAL_NO_ACQUIRE ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, @@ -148,7 +148,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/ManageChangesPanel")) { - vcl::Window* pPanel = new SwRedlineAcceptPanel(pParentWindow, xFrame); + VclPtr<vcl::Window> pPanel( new SwRedlineAcceptPanel(pParentWindow, xFrame), SAL_NO_ACQUIRE ); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, @@ -157,13 +157,13 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/StylePresetsPanel")) { - sw::sidebar::StylePresetsPanel* pPanel = sw::sidebar::StylePresetsPanel::Create(pParentWindow, xFrame, pBindings); + VclPtr<vcl::Window> pPanel = sw::sidebar::StylePresetsPanel::Create(pParentWindow, xFrame, pBindings); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, pPanel, ui::LayoutSize(-1,-1,-1)); } else if (rsResourceURL.endsWith("/ThemePanel")) { - sw::sidebar::ThemePanel* pPanel = sw::sidebar::ThemePanel::Create(pParentWindow, xFrame, pBindings); + VclPtr<vcl::Window> pPanel = sw::sidebar::ThemePanel::Create(pParentWindow, xFrame, pBindings); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, pPanel, ui::LayoutSize(-1,-1,-1)); } diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 91abd8983dbe..a246a24ad57a 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -466,7 +466,7 @@ void applyTheme(SfxStyleSheetBasePool* pPool, const OUString& sFontSetName, cons namespace sw { namespace sidebar { -ThemePanel* ThemePanel::Create (vcl::Window* pParent, +VclPtr<vcl::Window> ThemePanel::Create (vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { @@ -477,7 +477,7 @@ ThemePanel* ThemePanel::Create (vcl::Window* pParent, if (pBindings == NULL) throw css::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2); - return new ThemePanel(pParent, rxFrame, pBindings); + return VclPtr<vcl::Window>(new ThemePanel(pParent, rxFrame, pBindings), SAL_NO_ACQUIRE); } ThemePanel::ThemePanel(vcl::Window* pParent, @@ -509,6 +509,16 @@ ThemePanel::ThemePanel(vcl::Window* pParent, ThemePanel::~ThemePanel() { + disposeOnce(); +} + +void ThemePanel::dispose() +{ + mpListBoxFonts.clear(); + mpListBoxColors.clear(); + mpApplyButton.clear(); + + PanelLayout::dispose(); } IMPL_LINK_NOARG(ThemePanel, ClickHdl) diff --git a/sw/source/uibase/sidebar/ThemePanel.hxx b/sw/source/uibase/sidebar/ThemePanel.hxx index ed5c19df39f3..a14ac51de4ae 100644 --- a/sw/source/uibase/sidebar/ThemePanel.hxx +++ b/sw/source/uibase/sidebar/ThemePanel.hxx @@ -42,7 +42,7 @@ class ThemePanel : public PanelLayout, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static ThemePanel* Create(vcl::Window* pParent, + static VclPtr<vcl::Window> Create(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -62,12 +62,13 @@ private: SfxBindings* pBindings); virtual ~ThemePanel(); + virtual void dispose() SAL_OVERRIDE; SfxBindings* mpBindings; - ListBox* mpListBoxFonts; - ListBox* mpListBoxColors; - PushButton* mpApplyButton; + VclPtr<ListBox> mpListBoxFonts; + VclPtr<ListBox> mpListBoxColors; + VclPtr<PushButton> mpApplyButton; DECL_LINK(ClickHdl, void*); }; diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx index 9c7204921934..2dfe37c4b8c6 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx @@ -42,7 +42,7 @@ const char UNO_WRAPIDEAL[] = ".uno:WrapIdeal"; namespace sw { namespace sidebar { -WrapPropertyPanel* WrapPropertyPanel::Create ( +VclPtr<vcl::Window> WrapPropertyPanel::Create ( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, SfxBindings* pBindings) @@ -54,10 +54,10 @@ WrapPropertyPanel* WrapPropertyPanel::Create ( if (pBindings == NULL) throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to WrapPropertyPanel::Create", NULL, 2); - return new WrapPropertyPanel( - pParent, - rxFrame, - pBindings); + return VclPtr<WrapPropertyPanel>::Create( + pParent, + rxFrame, + pBindings); } WrapPropertyPanel::WrapPropertyPanel( @@ -89,6 +89,26 @@ WrapPropertyPanel::WrapPropertyPanel( WrapPropertyPanel::~WrapPropertyPanel() { + disposeOnce(); +} + +void WrapPropertyPanel::dispose() +{ + mpRBNoWrap.clear(); + mpRBWrapLeft.clear(); + mpRBWrapRight.clear(); + mpRBWrapParallel.clear(); + mpRBWrapThrough.clear(); + mpRBIdealWrap.clear(); + + maSwNoWrapControl.dispose(); + maSwWrapLeftControl.dispose(); + maSwWrapRightControl.dispose(); + maSwWrapParallelControl.dispose(); + maSwWrapThroughControl.dispose(); + maSwWrapIdealControl.dispose(); + + PanelLayout::dispose(); } void WrapPropertyPanel::Initialize() diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx index d1c53394021f..bd1f27ad0931 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx @@ -35,7 +35,7 @@ namespace sw { namespace sidebar { , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static WrapPropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame, SfxBindings* pBindings ); @@ -47,23 +47,23 @@ namespace sw { namespace sidebar { const SfxPoolItem* pState, const bool bIsEnabled) SAL_OVERRIDE; - private: + virtual ~WrapPropertyPanel(); + virtual void dispose() SAL_OVERRIDE; + WrapPropertyPanel( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, SfxBindings* pBindings ); - - virtual ~WrapPropertyPanel(); - + private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; SfxBindings* mpBindings; - RadioButton* mpRBNoWrap; - RadioButton* mpRBWrapLeft; - RadioButton* mpRBWrapRight; - RadioButton* mpRBWrapParallel; - RadioButton* mpRBWrapThrough; - RadioButton* mpRBIdealWrap; + VclPtr<RadioButton> mpRBNoWrap; + VclPtr<RadioButton> mpRBWrapLeft; + VclPtr<RadioButton> mpRBWrapRight; + VclPtr<RadioButton> mpRBWrapParallel; + VclPtr<RadioButton> mpRBWrapThrough; + VclPtr<RadioButton> mpRBIdealWrap; //Image resource. ImageList aWrapIL; diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index cfc07cfacaa7..3f2d8bc0734f 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -37,29 +37,29 @@ struct TColumn class SwFormatTablePage : public SfxTabPage { - Edit* m_pNameED; + VclPtr<Edit> m_pNameED; TextFilter m_aTextFilter; - FixedText* m_pWidthFT; + VclPtr<FixedText> m_pWidthFT; PercentField m_aWidthMF; - CheckBox* m_pRelWidthCB; + VclPtr<CheckBox> m_pRelWidthCB; - RadioButton* m_pFullBtn; - RadioButton* m_pLeftBtn; - RadioButton* m_pFromLeftBtn; - RadioButton* m_pRightBtn; - RadioButton* m_pCenterBtn; - RadioButton* m_pFreeBtn; + VclPtr<RadioButton> m_pFullBtn; + VclPtr<RadioButton> m_pLeftBtn; + VclPtr<RadioButton> m_pFromLeftBtn; + VclPtr<RadioButton> m_pRightBtn; + VclPtr<RadioButton> m_pCenterBtn; + VclPtr<RadioButton> m_pFreeBtn; - FixedText* m_pLeftFT; + VclPtr<FixedText> m_pLeftFT; PercentField m_aLeftMF; - FixedText* m_pRightFT; + VclPtr<FixedText> m_pRightFT; PercentField m_aRightMF; - FixedText* m_pTopFT; - MetricField* m_pTopMF; - FixedText* m_pBottomFT; - MetricField* m_pBottomMF; + VclPtr<FixedText> m_pTopFT; + VclPtr<MetricField> m_pTopMF; + VclPtr<FixedText> m_pBottomFT; + VclPtr<MetricField> m_pBottomMF; - ListBox* m_pTextDirectionLB; + VclPtr<ListBox> m_pTextDirectionLB; SwTableRep* pTblData; SwTwips nSaveWidth; @@ -81,8 +81,10 @@ class SwFormatTablePage : public SfxTabPage public: SwFormatTablePage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~SwFormatTablePage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE; @@ -94,16 +96,16 @@ public: class SwTableColumnPage : public SfxTabPage { - CheckBox* m_pModifyTableCB; - CheckBox* m_pProportionalCB; - FixedText* m_pSpaceFT; - MetricField* m_pSpaceED; - PushButton* m_pUpBtn; - PushButton* m_pDownBtn; + VclPtr<CheckBox> m_pModifyTableCB; + VclPtr<CheckBox> m_pProportionalCB; + VclPtr<FixedText> m_pSpaceFT; + VclPtr<MetricField> m_pSpaceED; + VclPtr<PushButton> m_pUpBtn; + VclPtr<PushButton> m_pDownBtn; SwTableRep* pTblData; PercentField m_aFieldArr[MET_FIELDS]; - FixedText* m_pTextArr[MET_FIELDS]; + VclPtr<FixedText> m_pTextArr[MET_FIELDS]; SwTwips nTableWidth; SwTwips nMinWidth; sal_uInt16 nNoOfCols; @@ -131,8 +133,9 @@ class SwTableColumnPage : public SfxTabPage public: SwTableColumnPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwTableColumnPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE; @@ -142,27 +145,27 @@ public: class SwTextFlowPage : public SfxTabPage { - CheckBox* m_pPgBrkCB; + VclPtr<CheckBox> m_pPgBrkCB; - RadioButton* m_pPgBrkRB; - RadioButton* m_pColBrkRB; + VclPtr<RadioButton> m_pPgBrkRB; + VclPtr<RadioButton> m_pColBrkRB; - RadioButton* m_pPgBrkBeforeRB; - RadioButton* m_pPgBrkAfterRB; + VclPtr<RadioButton> m_pPgBrkBeforeRB; + VclPtr<RadioButton> m_pPgBrkAfterRB; - CheckBox* m_pPageCollCB; - ListBox* m_pPageCollLB; - FixedText* m_pPageNoFT; - NumericField* m_pPageNoNF; - CheckBox* m_pSplitCB; - TriStateBox* m_pSplitRowCB; - CheckBox* m_pKeepCB; - CheckBox* m_pHeadLineCB; - NumericField* m_pRepeatHeaderNF; - VclContainer* m_pRepeatHeaderCombo; - ListBox* m_pTextDirectionLB; + VclPtr<CheckBox> m_pPageCollCB; + VclPtr<ListBox> m_pPageCollLB; + VclPtr<FixedText> m_pPageNoFT; + VclPtr<NumericField> m_pPageNoNF; + VclPtr<CheckBox> m_pSplitCB; + VclPtr<TriStateBox> m_pSplitRowCB; + VclPtr<CheckBox> m_pKeepCB; + VclPtr<CheckBox> m_pHeadLineCB; + VclPtr<NumericField> m_pRepeatHeaderNF; + VclPtr<VclContainer> m_pRepeatHeaderCombo; + VclPtr<ListBox> m_pTextDirectionLB; - ListBox* m_pVertOrientLB; + VclPtr<ListBox> m_pVertOrientLB; SwWrtShell* pShell; @@ -177,11 +180,11 @@ class SwTextFlowPage : public SfxTabPage DECL_LINK( SplitRowHdl_Impl, TriStateBox* ); DECL_LINK( HeadLineCBClickHdl, void* p = 0 ); +public: SwTextFlowPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~SwTextFlowPage(); - -public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 973cc9114358..aa2417c0f556 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -145,13 +145,15 @@ static void lcl_InvalidateZoomSlots(SfxBindings& rBindings) // At first the zoom dialog class SwPreviewZoomDlg : public SvxStandardDialog { - NumericField* m_pRowEdit; - NumericField* m_pColEdit; + VclPtr<NumericField> m_pRowEdit; + VclPtr<NumericField> m_pColEdit; virtual void Apply() SAL_OVERRIDE; public: SwPreviewZoomDlg( SwPagePreviewWin& rParent ); + virtual ~SwPreviewZoomDlg(); + virtual void dispose() SAL_OVERRIDE; }; SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent ) @@ -164,6 +166,18 @@ SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent ) m_pColEdit->SetValue( rParent.GetCol() ); } +SwPreviewZoomDlg::~SwPreviewZoomDlg() +{ + disposeOnce(); +} + +void SwPreviewZoomDlg::dispose() +{ + m_pRowEdit.clear(); + m_pColEdit.clear(); + SvxStandardDialog::dispose(); +} + void SwPreviewZoomDlg::Apply() { static_cast<SwPagePreviewWin*>(GetParent())->CalcWish( @@ -1145,12 +1159,12 @@ void SwPagePreview::Init(const SwViewOption * pPrefs) SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): SfxViewShell( pViewFrame, SWVIEWFLAGS ), - pViewWin( new SwPagePreviewWin(&(GetViewFrame())->GetWindow(), *this ) ), + pViewWin( VclPtr<SwPagePreviewWin>::Create(&(GetViewFrame())->GetWindow(), *this ) ), nNewPage(USHRT_MAX), sPageStr(SW_RES(STR_PAGE)), pHScrollbar(0), pVScrollbar(0), - pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(), + pScrollFill(VclPtr<ScrollBarBox>::Create( &pViewFrame->GetWindow(), pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), mnPageCount( 0 ), mbResetFormDesignMode( false ), @@ -1224,11 +1238,12 @@ SwPagePreview::~SwPagePreview() SwViewShell* pVShell = pViewWin->GetViewShell(); pVShell->SetWin(0); delete pVShell; - delete pViewWin; - delete pScrollFill; - delete pHScrollbar; - delete pVScrollbar; + pViewWin.disposeAndClear(); + + pScrollFill.disposeAndClear(); + pHScrollbar.disposeAndClear(); + pVScrollbar.disposeAndClear(); } SwDocShell* SwPagePreview::GetDocShell() @@ -1239,20 +1254,20 @@ SwDocShell* SwPagePreview::GetDocShell() int SwPagePreview::_CreateScrollbar( bool bHori ) { vcl::Window *pMDI = &GetViewFrame()->GetWindow(); - SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar; + VclPtr<SwScrollbar>& ppScrollbar = bHori ? pHScrollbar : pVScrollbar; - assert(!*ppScrollbar); //check beforehand! + assert(!ppScrollbar.get()); //check beforehand! - *ppScrollbar = new SwScrollbar( pMDI, bHori ); + ppScrollbar = VclPtr<SwScrollbar>::Create( pMDI, bHori ); ScrollDocSzChg(); - (*ppScrollbar)->EnableDrag( true ); - (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwPagePreview, EndScrollHdl )); + ppScrollbar->EnableDrag( true ); + ppScrollbar->SetEndScrollHdl( LINK( this, SwPagePreview, EndScrollHdl )); - (*ppScrollbar)->SetScrollHdl( LINK( this, SwPagePreview, ScrollHdl )); + ppScrollbar->SetScrollHdl( LINK( this, SwPagePreview, ScrollHdl )); InvalidateBorder(); - (*ppScrollbar)->ExtendedShow(); + ppScrollbar->ExtendedShow(); return 1; } @@ -1694,8 +1709,8 @@ bool SwPagePreview::HasPrintOptionsPage() const return true; } -SfxTabPage* SwPagePreview::CreatePrintOptionsPage( vcl::Window *pParent, - const SfxItemSet &rOptions ) +VclPtr<SfxTabPage> SwPagePreview::CreatePrintOptionsPage( vcl::Window *pParent, + const SfxItemSet &rOptions ) { return ::CreatePrintOptionsPage( pParent, rOptions, !bNormalPrint ); } diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index bb5696ccc5ae..76f17325268f 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -218,7 +218,7 @@ static OUString lcl_ConvertTabsToSpaces( const OUString& sLine ) SwSrcView::SwSrcView(SfxViewFrame* pViewFrame, SfxViewShell*) : SfxViewShell( pViewFrame, SWSRCVIEWFLAGS ), - aEditWin( &pViewFrame->GetWindow(), this ), + aEditWin( VclPtr<SwSrcEditWindow>::Create( &pViewFrame->GetWindow(), this ) ), pSearchItem(0), bSourceSaved(false), eLoadEncoding(RTL_TEXTENCODING_DONTKNOW) @@ -230,7 +230,7 @@ SwSrcView::~SwSrcView() { SwDocShell* pDocShell = GetDocShell(); OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); - const TextSelection& rSel = aEditWin.GetTextView()->GetSelection(); + const TextSelection& rSel = aEditWin->GetTextView()->GetSelection(); static_cast<SwWebDocShell*>(pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) ); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( @@ -249,14 +249,14 @@ void SwSrcView::SaveContentTo(SfxMedium& rMed) { SvStream* pOutStream = rMed.GetOutStream(); pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding)); - aEditWin.Write( *pOutStream ); + aEditWin->Write( *pOutStream ); } void SwSrcView::Init() { SetHelpId(SW_SRC_VIEWSHELL); SetName(OUString("Source")); - SetWindow( &aEditWin ); + SetWindow( aEditWin.get() ); SwDocShell* pDocShell = GetDocShell(); // If the doc is still loading, then the DocShell must fire up // the Load if the loading is completed. @@ -264,7 +264,7 @@ void SwSrcView::Init() Load(pDocShell); else { - aEditWin.SetReadonly(true); + aEditWin->SetReadonly(true); } SetNewWindowAllowed( false ); @@ -282,13 +282,13 @@ void SwSrcView::SaveContent(const OUString& rTmpFile) SfxMedium aMedium( rTmpFile, StreamMode::WRITE); SvStream* pOutStream = aMedium.GetOutStream(); pOutStream->SetStreamCharSet( lcl_GetStreamCharSet(eLoadEncoding) ); - aEditWin.Write(*pOutStream); + aEditWin->Write(*pOutStream); aMedium.Commit(); } void SwSrcView::Execute(SfxRequest& rReq) { - TextView* pTextView = aEditWin.GetTextView(); + TextView* pTextView = aEditWin->GetTextView(); switch( rReq.GetSlot() ) { case SID_SAVEACOPY: @@ -328,7 +328,7 @@ void SwSrcView::Execute(SfxRequest& rReq) StreamMode::WRITE | StreamMode::SHARE_DENYNONE ); SvStream* pOutStream = aMedium.GetOutStream(); pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding)); - aEditWin.Write( *pOutStream ); + aEditWin->Write( *pOutStream ); aMedium.Commit(); } } @@ -351,12 +351,12 @@ void SwSrcView::Execute(SfxRequest& rReq) pOutStream->Seek(0); pOutStream->SetStreamSize(0); pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding)); - aEditWin.Write( *pOutStream ); + aEditWin->Write( *pOutStream ); pMed->CloseOutStream(); pMed->Commit(); pDocShell->GetDoc()->getIDocumentState().ResetModified(); SourceSaved(); - aEditWin.ClearModifyFlag(); + aEditWin->ClearModifyFlag(); } } break; @@ -369,7 +369,7 @@ void SwSrcView::Execute(SfxRequest& rReq) const SfxPoolItem& rItem = pTmpArgs->Get( nWhich ); SetSearchItem( static_cast<const SvxSearchItem&>(rItem)); StartSearchAndReplace( static_cast<const SvxSearchItem&>(rItem), false, rReq.IsAPI() ); - if(aEditWin.IsModified()) + if(aEditWin->IsModified()) GetDocShell()->GetDoc()->getIDocumentState().SetModified(); } break; @@ -379,7 +379,7 @@ void SwSrcView::Execute(SfxRequest& rReq) if(pSrchItem) { StartSearchAndReplace( *pSrchItem, false, rReq.IsAPI() ); - if(aEditWin.IsModified()) + if(aEditWin->IsModified()) GetDocShell()->GetDoc()->getIDocumentState().SetModified(); } } @@ -415,14 +415,14 @@ void SwSrcView::Execute(SfxRequest& rReq) pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) ); break; } - aEditWin.Invalidate(); + aEditWin->Invalidate(); } void SwSrcView::GetState(SfxItemSet& rSet) { SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - TextView* pTextView = aEditWin.GetTextView(); + TextView* pTextView = aEditWin->GetTextView(); while(nWhich) { @@ -471,7 +471,7 @@ void SwSrcView::GetState(SfxItemSet& rSet) if ( !pTextView->HasSelection() ) { const TextSelection& rSel = pTextView->GetSelection(); - sSelected = aEditWin.GetTextEngine()->GetWord( rSel.GetStart()); + sSelected = aEditWin->GetTextEngine()->GetWord( rSel.GetStart()); } else { @@ -538,7 +538,7 @@ void SwSrcView::GetState(SfxItemSet& rSet) { TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( - &aEditWin) ); + aEditWin.get()) ); bool bDisable = !aDataHelper.GetXTransferable().is() || 0 == aDataHelper.GetFormatCount(); if( bDisable ) @@ -570,7 +570,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, bool bApi, bool bRecursive) { - ExtTextView* pTextView = aEditWin.GetTextView(); + ExtTextView* pTextView = aEditWin->GetTextView(); TextSelection aSel; TextPaM aPaM; @@ -701,11 +701,11 @@ sal_Int32 SwSrcView::PrintSource( pOutDev->Push(); - TextEngine* pTextEngine = aEditWin.GetTextEngine(); + TextEngine* pTextEngine = aEditWin->GetTextEngine(); pOutDev->SetMapMode( MAP_100TH_MM ); - vcl::Font aFont( aEditWin.GetOutWin()->GetFont() ); + vcl::Font aFont( aEditWin->GetOutWin()->GetFont() ); Size aSize( aFont.GetSize() ); - aSize = aEditWin.GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM ); + aSize = aEditWin->GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM ); aFont.SetSize( aSize ); aFont.SetColor( COL_BLACK ); pOutDev->SetFont( aFont ); @@ -772,7 +772,7 @@ void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) pSimpleHint->GetId() == SFX_HINT_MODECHANGED || ( pSimpleHint->GetId() == SFX_HINT_TITLECHANGED && - !GetDocShell()->IsReadOnly() && aEditWin.IsReadonly() + !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly() ) ) ) @@ -780,7 +780,7 @@ void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // Broadcast only comes once! const SwDocShell* pDocSh = GetDocShell(); const bool bReadonly = pDocSh->IsReadOnly(); - aEditWin.SetReadonly(bReadonly); + aEditWin->SetReadonly(bReadonly); } SfxViewShell::Notify(rBC, rHint); } @@ -792,8 +792,8 @@ void SwSrcView::Load(SwDocShell* pDocShell) rtl_getBestMimeCharsetFromTextEncoding( rHtmlOptions.GetTextEncoding() ); rtl_TextEncoding eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet ); - aEditWin.SetReadonly(pDocShell->IsReadOnly()); - aEditWin.SetTextEncoding(eDestEnc); + aEditWin->SetReadonly(pDocShell->IsReadOnly()); + aEditWin->SetTextEncoding(eDestEnc); SfxMedium* pMedium = pDocShell->GetMedium(); const SfxFilter* pFilter = pMedium->GetFilter(); @@ -817,13 +817,13 @@ void SwSrcView::Load(SwDocShell* pDocShell) eDestEnc != eHeaderEnc ) { eDestEnc = eHeaderEnc; - aEditWin.SetTextEncoding(eDestEnc); + aEditWin->SetTextEncoding(eDestEnc); } pStream->SetStreamCharSet( eDestEnc ); pStream->Seek(0); - TextEngine* pTextEngine = aEditWin.GetTextEngine(); + TextEngine* pTextEngine = aEditWin->GetTextEngine(); pTextEngine->EnableUndo(false); - aEditWin.Read(*pStream); + aEditWin->Read(*pStream); pTextEngine->EnableUndo(true); } else @@ -851,17 +851,17 @@ void SwSrcView::Load(SwDocShell* pDocShell) if(nRes) { ErrorHandler::HandleError(ErrCode(nRes)); - aEditWin.SetReadonly(true); + aEditWin->SetReadonly(true); } aMedium.Commit(); SvStream* pInStream = aMedium.GetInStream(); pInStream->Seek(0); pInStream->SetStreamCharSet( eDestEnc ); - aEditWin.Read(*pInStream); + aEditWin->Read(*pInStream); } } - aEditWin.ClearModifyFlag(); + aEditWin->ClearModifyFlag(); eLoadEncoding = eDestEnc; @@ -871,9 +871,9 @@ void SwSrcView::Load(SwDocShell* pDocShell) pDocShell->SetAutoLoad(INetURLObject(), 0, false); OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); sal_uInt16 nLine = static_cast<SwWebDocShell*>(pDocShell)->GetSourcePara(); - aEditWin.SetStartLine(nLine); - aEditWin.GetTextEngine()->ResetUndo(); - aEditWin.GetOutWin()->GrabFocus(); + aEditWin->SetStartLine(nLine); + aEditWin->GetTextEngine()->ResetUndo(); + aEditWin->GetOutWin()->GrabFocus(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 16e497b5c848..a3da88c0fcc7 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -692,14 +692,14 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_nNewPage(USHRT_MAX), m_nOldPageNum(0), m_pNumRuleNodeFromDoc(0), - m_pEditWin( new SwEditWin( &_pFrame->GetWindow(), *this ) ), + m_pEditWin( VclPtr<SwEditWin>::Create( &_pFrame->GetWindow(), *this ) ), m_pWrtShell(0), m_pShell(0), m_pFormShell(0), m_pHScrollbar(0), m_pVScrollbar(0), - m_pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), - m_pVRuler(new SvxRuler(&GetViewFrame()->GetWindow(), m_pEditWin, + m_pScrollFill(VclPtr<ScrollBarBox>::Create( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), + m_pVRuler(VclPtr<SvxRuler>::Create(&GetViewFrame()->GetWindow(), m_pEditWin, SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL| SVXRULER_SUPPORT_BORDERS | SVXRULER_SUPPORT_REDUCED_METRIC, GetViewFrame()->GetBindings(), @@ -846,7 +846,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) } } SAL_INFO( "sw.ui", "after create WrtShell" ); - m_pHRuler = new SwCommentRuler(m_pWrtShell, &GetViewFrame()->GetWindow(), m_pEditWin, + m_pHRuler = VclPtr<SwCommentRuler>::Create(m_pWrtShell, &GetViewFrame()->GetWindow(), m_pEditWin, SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS | SVXRULER_SUPPORT_BORDERS | @@ -1050,18 +1050,18 @@ SwView::~SwView() m_pViewImpl->Invalidate(); EndListening(*GetViewFrame()); EndListening(*GetDocShell()); - delete m_pScrollFill; + m_pScrollFill.disposeAndClear(); delete m_pWrtShell; m_pWrtShell = 0; // Set to 0, so that it is not accessible by the following dtors cannot. m_pShell = 0; - delete m_pHScrollbar; - delete m_pVScrollbar; - delete m_pHRuler; - delete m_pVRuler; - delete m_pTogglePageBtn; + m_pHScrollbar.disposeAndClear(); + m_pVScrollbar.disposeAndClear(); + m_pHRuler.disposeAndClear(); + m_pVRuler.disposeAndClear(); + m_pTogglePageBtn.disposeAndClear(); delete m_pGlosHdl; delete m_pViewImpl; - delete m_pEditWin; + m_pEditWin.disposeAndClear(); delete m_pFormatClipboard; } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index f052dbe1e2ea..83586ec227f1 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -240,8 +240,8 @@ int SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter, const sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - MessageDialog aQueryBox( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox.Execute() == RET_YES) + ScopedVclPtrInstance< MessageDialog > aQueryBox( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui"); + if (aQueryBox->Execute() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); @@ -439,8 +439,8 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) // really store as link only? if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() ) { - SvxLinkWarningDialog aWarnDlg(GetWindow(),pFileDlg->GetPath()); - if( aWarnDlg.Execute() != RET_OK ) + ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(GetWindow(),pFileDlg->GetPath()); + if( aWarnDlg->Execute() != RET_OK ) bAsLink=false; // don't store as link } } @@ -504,8 +504,8 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) { if( bShowError ) { - MessageDialog aInfoBox( GetWindow(), SW_RESSTR( nResId ), VCL_MESSAGE_INFO); - aInfoBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aInfoBox( GetWindow(), SW_RESSTR( nResId ), VCL_MESSAGE_INFO); + aInfoBox->Execute(); } rReq.Ignore(); } @@ -585,11 +585,11 @@ void SwView::Execute(SfxRequest &rReq) pParent = static_cast<const XWindowItem*>( pParentItem )->GetWindowPtr(); else pParent = &GetViewFrame()->GetWindow(); - SfxPasswordDialog aPasswdDlg( pParent ); - aPasswdDlg.SetMinLen( 1 ); + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg( pParent ); + aPasswdDlg->SetMinLen( 1 ); //#i69751# the result of Execute() can be ignored - (void)aPasswdDlg.Execute(); - OUString sNewPasswd( aPasswdDlg.GetPassword() ); + (void)aPasswdDlg->Execute(); + OUString sNewPasswd( aPasswdDlg->GetPassword() ); Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) @@ -623,14 +623,14 @@ void SwView::Execute(SfxRequest &rReq) pParent = static_cast<const XWindowItem*>( pParentItem )->GetWindowPtr(); else pParent = &GetViewFrame()->GetWindow(); - SfxPasswordDialog aPasswdDlg( pParent ); - aPasswdDlg.SetMinLen( 1 ); + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg( pParent ); + aPasswdDlg->SetMinLen( 1 ); if(!aPasswd.getLength()) - aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); - if (aPasswdDlg.Execute()) + aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM); + if (aPasswdDlg->Execute()) { sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON; - OUString sNewPasswd( aPasswdDlg.GetPassword() ); + OUString sNewPasswd( aPasswdDlg->GetPassword() ); Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); @@ -2286,11 +2286,11 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) if ( lcl_NeedAdditionalDataSource( xDBContext ) ) { // no data sources are available - create a new one - MessageDialog aQuery(&GetViewFrame()->GetWindow(), + ScopedVclPtrInstance<MessageDialog> aQuery(&GetViewFrame()->GetWindow(), "DataSourcesUnavailableDialog", "modules/swriter/ui/datasourcesunavailabledialog.ui"); // no cancel allowed - if (RET_OK != aQuery.Execute()) + if (RET_OK != aQuery->Execute()) return; bCallAddressPilot = true; } @@ -2335,12 +2335,12 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) OUString sSource; if(!GetWrtShell().IsFieldDataSourceAvailable(sSource)) { - MessageDialog aWarning(&GetViewFrame()->GetWindow(), + ScopedVclPtrInstance<MessageDialog> aWarning(&GetViewFrame()->GetWindow(), "WarnDataSourceDialog", "modules/swriter/ui/warndatasourcedialog.ui"); - OUString sTmp(aWarning.get_primary_text()); - aWarning.set_primary_text(sTmp.replaceFirst("%1", sSource)); - if (RET_OK == aWarning.Execute()) + OUString sTmp(aWarning->get_primary_text()); + aWarning->set_primary_text(sTmp.replaceFirst("%1", sSource)); + if (RET_OK == aWarning->Execute()) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) @@ -2389,8 +2389,8 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) SfxApplication* pSfxApp = SfxGetpApp(); vcl::Window* pTopWin = pSfxApp->GetTopWindow(); - SfxTemplateManagerDlg aDocTemplDlg; - int nRet = aDocTemplDlg.Execute(); + ScopedVclPtrInstance< SfxTemplateManagerDlg > aDocTemplDlg; + int nRet = aDocTemplDlg->Execute(); bool bNewWin = false; if ( nRet == RET_OK ) { diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 8ed2185dd44f..81e2ead3c251 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -177,9 +177,9 @@ void SwView::ExecDraw(SfxRequest& rReq) if ( pSdrView ) { SdrObject* pObj = NULL; - svx::FontWorkGalleryDialog aDlg( pSdrView, pWin, nSlotId ); - aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() ); - aDlg.Execute(); + ScopedVclPtrInstance< svx::FontWorkGalleryDialog > aDlg( pSdrView, pWin, nSlotId ); + aDlg->SetSdrObjectRef( &pObj, pSdrView->GetModel() ); + aDlg->Execute(); if ( pObj ) { Size aDocSize( m_pWrtShell->GetDocSize() ); diff --git a/sw/source/uibase/uiview/viewfunc.hxx b/sw/source/uibase/uiview/viewfunc.hxx index 4102270a1999..c66822e95a26 100644 --- a/sw/source/uibase/uiview/viewfunc.hxx +++ b/sw/source/uibase/uiview/viewfunc.hxx @@ -33,7 +33,7 @@ namespace vcl { class Window; } // The following functions are available in viewprt.cxx void SetPrinter( IDocumentDeviceAccess*, SfxPrinter*, bool bWeb ); -SfxTabPage* CreatePrintOptionsPage( vcl::Window*, const SfxItemSet& ); +VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window*, const SfxItemSet& ); void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ); // The following functions are available in viewport.cxx diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index b0142b985c58..559b9ff747b7 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -459,8 +459,8 @@ void SwView::HyphenateDocument() // turned on no special area { // I want also in special areas hyphenation - MessageDialog aBox(&GetEditWin(), SW_RES(STR_QUERY_SPECIAL_FORCED), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if( aBox.Execute() == RET_YES ) + ScopedVclPtrInstance< MessageDialog > aBox(&GetEditWin(), SW_RES(STR_QUERY_SPECIAL_FORCED), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + if( aBox->Execute() == RET_YES ) { bOther = true; if (xProp.is()) @@ -799,18 +799,20 @@ bool SwView::ExecSmartTagPopup( const Point& rPt ) class SwFieldDialog : public FloatingWindow { private: - ListBox aListBox; + VclPtr<ListBox> aListBox; IFieldmark *pFieldmark; DECL_LINK( MyListBoxHandler, ListBox * ); public: SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ); + virtual ~SwFieldDialog(); + virtual void dispose() SAL_OVERRIDE; }; SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) : FloatingWindow( parent, WB_BORDER | WB_SYSTEMWINDOW ), - aListBox(this), + aListBox(VclPtr<ListBox>::Create(this)), pFieldmark( fieldBM ) { if ( fieldBM != NULL ) @@ -827,7 +829,7 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) : pCurrent != vListEntries.getArray() + vListEntries.getLength(); ++pCurrent) { - aListBox.InsertEntry(*pCurrent); + aListBox->InsertEntry(*pCurrent); } } @@ -838,20 +840,31 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) : { sal_Int32 nSelection = -1; pResult->second >>= nSelection; - aListBox.SelectEntryPos( nSelection ); + aListBox->SelectEntryPos( nSelection ); } } - Size lbSize(aListBox.GetOptimalSize()); + Size lbSize(aListBox->GetOptimalSize()); lbSize.Width()+=50; lbSize.Height()+=20; - aListBox.SetSizePixel(lbSize); - aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) ); - aListBox.Show(); + aListBox->SetSizePixel(lbSize); + aListBox->SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) ); + aListBox->Show(); SetSizePixel( lbSize ); } +SwFieldDialog::~SwFieldDialog() +{ + disposeOnce(); +} + +void SwFieldDialog::dispose() +{ + aListBox.disposeAndClear(); + FloatingWindow::dispose(); +} + IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox ) { short res = 0; @@ -875,11 +888,7 @@ IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox ) IMPL_LINK_NOARG(SwView, FieldPopupModeEndHdl) { - if ( m_pFieldPopup ) - { - delete m_pFieldPopup; - m_pFieldPopup = NULL; - } + m_pFieldPopup.disposeAndClear(); return 0; } @@ -887,7 +896,7 @@ void SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM ) { const Point aPixPos = GetEditWin().LogicToPixel( rPt ); - m_pFieldPopup = new SwFieldDialog( m_pEditWin, fieldBM ); + m_pFieldPopup = VclPtr<SwFieldDialog>::Create( m_pEditWin, fieldBM ); m_pFieldPopup->SetPopupModeEndHdl( LINK( this, SwView, FieldPopupModeEndHdl ) ); Rectangle aRect( m_pEditWin->OutputToScreenPixel( aPixPos ), Size( 0, 0 ) ); diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 8d63bcb4580a..b362b67520bf 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -290,25 +290,25 @@ IMPL_LINK( SwView, WindowChildEventListener, VclSimpleEvent*, pEvent ) int SwView::_CreateScrollbar( bool bHori ) { vcl::Window *pMDI = &GetViewFrame()->GetWindow(); - SwScrollbar** ppScrollbar = bHori ? &m_pHScrollbar : &m_pVScrollbar; + VclPtr<SwScrollbar>& ppScrollbar = bHori ? m_pHScrollbar : m_pVScrollbar; - assert(!*ppScrollbar); //check beforehand! + assert(!ppScrollbar.get()); //check beforehand! - *ppScrollbar = new SwScrollbar( pMDI, bHori ); + ppScrollbar = VclPtr<SwScrollbar>::Create( pMDI, bHori ); UpdateScrollbars(); if(bHori) - (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, EndScrollHdl )); + ppScrollbar->SetScrollHdl( LINK( this, SwView, EndScrollHdl )); else - (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, ScrollHdl )); - (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl )); + ppScrollbar->SetScrollHdl( LINK( this, SwView, ScrollHdl )); + ppScrollbar->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl )); - (*ppScrollbar)->EnableDrag( true ); + ppScrollbar->EnableDrag( true ); if(GetWindow()) InvalidateBorder(); if (!m_bShowAtResize) - (*ppScrollbar)->ExtendedShow(); + ppScrollbar->ExtendedShow(); return 1; } diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index a9e63c363856..76cbdb39cdbe 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -147,8 +147,8 @@ bool SwView::HasPrintOptionsPage() const // TabPage for application-specific print options -SfxTabPage* SwView::CreatePrintOptionsPage(vcl::Window* pParent, - const SfxItemSet& rSet) +VclPtr<SfxTabPage> SwView::CreatePrintOptionsPage(vcl::Window* pParent, + const SfxItemSet& rSet) { return ::CreatePrintOptionsPage( pParent, rSet, false ); } @@ -175,10 +175,10 @@ void SwView::ExecutePrint(SfxRequest& rReq) } else { - MessageDialog aInfoBox(&GetEditWin(), SW_RES(STR_ERR_NO_FAX), VCL_MESSAGE_INFO); + ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetEditWin(), SW_RES(STR_ERR_NO_FAX), VCL_MESSAGE_INFO); sal_uInt16 nResNo = bWeb ? STR_WEBOPTIONS : STR_TEXTOPTIONS; - aInfoBox.set_primary_text(aInfoBox.get_primary_text().replaceFirst("%1", OUString(SW_RES(nResNo)))); - aInfoBox.Execute(); + aInfoBox->set_primary_text(aInfoBox->get_primary_text().replaceFirst("%1", OUString(SW_RES(nResNo)))); + aInfoBox->Execute(); SfxUInt16Item aDefPage(SID_SW_EDITOPTIONS, TP_OPTPRINT_PAGE); GetViewFrame()->GetDispatcher()->Execute(SID_SW_EDITOPTIONS, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, @@ -201,9 +201,9 @@ void SwView::ExecutePrint(SfxRequest& rReq) if(!bSilent && !bFromMerge && SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc()) { - MessageDialog aBox(&GetEditWin(), "PrintMergeDialog", + ScopedVclPtrInstance<MessageDialog> aBox(&GetEditWin(), "PrintMergeDialog", "modules/swriter/ui/printmergedialog.ui"); - short nRet = aBox.Execute(); + short nRet = aBox->Execute(); if(RET_YES == nRet) { SfxBoolItem aBool(FN_QRY_MERGE, true); @@ -245,8 +245,9 @@ void SwView::ExecutePrint(SfxRequest& rReq) // Create page printer/additions for SwView and SwPagePreview -SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, - const SfxItemSet &rOptions, bool bPreview ) +VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, + const SfxItemSet &rOptions, + bool bPreview ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "No Print Dialog"); @@ -258,7 +259,9 @@ SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, if (!fnCreatePage) return NULL; - SfxTabPage* pPage = (*fnCreatePage)(pParent, &rOptions); + VclPtr<SfxTabPage> pPage = + VclPtr<SfxTabPage>((*fnCreatePage)(pParent, &rOptions), + SAL_NO_ACQUIRE); OSL_ENSURE(pPage, "No page"); if (!pPage) return NULL; diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index b80a0c4403fb..7d222ae10473 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -390,7 +390,8 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true ); if ( OUString ( pPrinter->GetName()) != sPrinterName ) { - SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); + VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName ); + assert (! pNewPrinter->isDisposed() ); if( pNewPrinter->IsKnown() ) { // set printer only once; in _postSetValues @@ -398,7 +399,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } else { - delete pNewPrinter; + pNewPrinter.disposeAndClear(); } } } @@ -427,10 +428,10 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf 0 }; SfxItemSet *pItemSet = new SfxItemSet( mpDoc->GetAttrPool(), nRange ); - SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); - + VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, pItemSet ); + assert (! pPrinter->isDisposed() ); // set printer only once; in _postSetValues - delete mpPrinter; + mpPrinter.disposeAndClear(); mpPrinter = pPrinter; } } @@ -838,7 +839,7 @@ void SwXDocumentSettings::_postSetValues () throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) { // set printer only once, namely here! - if( mpPrinter != NULL ) + if( mpPrinter != nullptr ) { // #i86352# the printer is also used as container for options by sfx // when setting a printer it should have decent default options diff --git a/sw/source/uibase/uno/SwXDocumentSettings.hxx b/sw/source/uibase/uno/SwXDocumentSettings.hxx index 5485a1b971c6..20f30410f8ae 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.hxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.hxx @@ -47,7 +47,7 @@ protected: /** the printer should be set only once; since there are several * printer-related properties, remember the last printer and set it in * _postSetValues */ - SfxPrinter* mpPrinter; + VclPtr<SfxPrinter> mpPrinter; virtual void _preSetValues () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index f570dd9954de..5c12fc645d8a 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2320,9 +2320,9 @@ Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName return aAny; } -static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions ) +static VclPtr< OutputDevice > lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions ) { - OutputDevice *pOut = 0; + VclPtr< OutputDevice > pOut; uno::Any aAny( rPrintUIOptions.getValue( "RenderDevice" )); uno::Reference< awt::XDevice > xRenderDevice; @@ -2330,7 +2330,7 @@ static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptio if (xRenderDevice.is()) { VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); - pOut = pDevice ? pDevice->GetOutputDevice() : 0; + pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >(); } return pOut; @@ -2519,7 +2519,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (bIsSwSrcView) { SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView); - OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + VclPtr< OutputDevice> pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); nRet = rSwSrcView.PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ ); } else @@ -2634,7 +2634,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ); if (nPostItMode != POSTITS_NONE) { - OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); m_pRenderData->CreatePostItData( pDoc, pViewShell->GetViewOptions(), pOutDev ); } @@ -2758,7 +2758,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this // case we won't get an OutputDevice here, but then the caller also has no need // for the correct PageSisze right now... - Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); + VclPtr< Printer > pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ).get()); if (pPrinter) { // HTML source view and prospect adapt to the printer's paper size @@ -2976,7 +2976,7 @@ void SAL_CALL SwXTextDocument::render( if (bIsSwSrcView) { SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView); - OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); + VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); rSwSrcView.PrintSource(pOutDev, nRenderer + 1, false); } else @@ -2998,7 +2998,7 @@ void SAL_CALL SwXTextDocument::render( } // get output device to use - OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); + VclPtr< OutputDevice > pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions()) { diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 282a72749611..d80c5097f7dd 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -91,6 +91,7 @@ #include <unomid.h> #include "navmgr.hxx" +#include "SidebarWin.hxx" #include <boost/scoped_ptr.hpp> #define CTYPE_CNT 0 @@ -836,8 +837,15 @@ SwContentTree::SwContentTree(vcl::Window* pParent, const ResId& rResId) SwContentTree::~SwContentTree() { + disposeOnce(); +} + +void SwContentTree::dispose() +{ Clear(); // If applicable erase content types previously. bIsInDrag = false; + aUpdTimer.Stop(); + SvTreeListBox::dispose(); } OUString SwContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const @@ -1594,11 +1602,11 @@ void SwContentTree::Display( bool bActive ) bIsLastReadOnly = bReadOnly; bool bDisable = pShell == 0 || bReadOnly; SwNavigationPI* pNavi = GetParentWindow(); - pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , !bDisable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, !bDisable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, !bDisable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT, !bDisable); - pNavi->aContentToolBox.EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_UP , !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_DOWN, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_LEFT, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_RIGHT, !bDisable); + pNavi->aContentToolBox->EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable); } if(pShell) { @@ -1927,7 +1935,7 @@ bool SwContentTree::ToggleToRoot() } } pConfig->SetRootType( nRootType ); - GetParentWindow()->aContentToolBox.CheckItem(FN_SHOW_ROOT, bIsRoot); + GetParentWindow()->aContentToolBox->CheckItem(FN_SHOW_ROOT, bIsRoot); return bIsRoot; } @@ -2440,6 +2448,9 @@ void SwContentTree::HideTree() IMPL_LINK_NOARG(SwContentTree, TimerUpdate) { + if (IsDisposed()) + return 0; + // No update while drag and drop. // Query view because the Navigator is cleared too late. SwView* pView = GetParentWindow()->GetCreateView(); @@ -3046,10 +3057,10 @@ bool SwContentTree::Select( SvTreeListEntry* pEntry, bool bSelect ) } } SwNavigationPI* pNavi = GetParentWindow(); - pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, bEnable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, bEnable); - pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT,bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_UP , bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_DOWN, bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_LEFT, bEnable); + pNavi->aContentToolBox->EnableItem(FN_ITEM_RIGHT,bEnable); return SvTreeListBox::Select(pEntry, bSelect); } diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 2f4b0a5009f6..5c5a1aa75d93 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -180,8 +180,18 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, const ResId& rResId) : SwGlobalTree::~SwGlobalTree() { + disposeOnce(); +} + +void SwGlobalTree::dispose() +{ delete pSwGlblDocContents; + pSwGlblDocContents = NULL; delete pDocInserter; + pDocInserter = NULL; + pDefParentWin.clear(); + aUpdateTimer.Stop(); + SvTreeListBox::dispose(); } sal_Int8 SwGlobalTree::ExecuteDrop( const ExecuteDropEvent& rEvt ) @@ -505,12 +515,12 @@ void SwGlobalTree::SelectHdl() SwNavigationPI* pNavi = GetParentWindow(); bool bReadonly = !pActiveShell || pActiveShell->GetView().GetDocShell()->IsReadOnly(); - pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_EDIT, nSelCount == 1 && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_OPEN, nSelCount <= 1 && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_UPDATE, GetEntryCount() > 0 && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_ITEM_UP, + pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_EDIT, nSelCount == 1 && !bReadonly); + pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_OPEN, nSelCount <= 1 && !bReadonly); + pNavi->aGlobalToolBox->EnableItem(FN_GLOBAL_UPDATE, GetEntryCount() > 0 && !bReadonly); + pNavi->aGlobalToolBox->EnableItem(FN_ITEM_UP, nSelCount == 1 && nAbsPos && !bReadonly); - pNavi->aGlobalToolBox.EnableItem(FN_ITEM_DOWN, + pNavi->aGlobalToolBox->EnableItem(FN_ITEM_DOWN, nSelCount == 1 && nAbsPos < GetEntryCount() - 1 && !bReadonly); } @@ -1001,7 +1011,7 @@ void SwGlobalTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry IMPL_LINK_NOARG(SwGlobalTree, Timeout) { - if(!HasFocus() && Update( false )) + if(!IsDisposed() && !HasFocus() && Update( false )) Display(); return 0; } diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx index 7f18c24ab564..53980635be55 100644 --- a/sw/source/uibase/utlui/gloslst.cxx +++ b/sw/source/uibase/utlui/gloslst.cxx @@ -51,14 +51,17 @@ struct TripleString class SwGlossDecideDlg : public ModalDialog { - OKButton* m_pOk; - ListBox* m_pListLB; + VclPtr<OKButton> m_pOk; + VclPtr<ListBox> m_pListLB; DECL_LINK(DoubleClickHdl, void*); DECL_LINK(SelectHdl, void*); - public: - SwGlossDecideDlg(vcl::Window* pParent); +public: + SwGlossDecideDlg(vcl::Window* pParent); + virtual ~SwGlossDecideDlg(); + virtual void dispose() SAL_OVERRIDE; + ListBox& GetListBox() {return *m_pListLB;} }; @@ -73,6 +76,18 @@ SwGlossDecideDlg::SwGlossDecideDlg(vcl::Window* pParent) m_pListLB->SetSelectHdl(LINK(this, SwGlossDecideDlg, SelectHdl)); } +SwGlossDecideDlg::~SwGlossDecideDlg() +{ + disposeOnce(); +} + +void SwGlossDecideDlg::dispose() +{ + m_pOk.clear(); + m_pListLB.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(SwGlossDecideDlg, DoubleClickHdl) { EndDialog(RET_OK); @@ -143,16 +158,16 @@ bool SwGlossaryList::GetShortName(const OUString& rLongName, } else if(1 < nCount) { - SwGlossDecideDlg aDlg(0); - OUString sTitle = aDlg.GetText() + " " + aTripleStrings.front().sBlock; - aDlg.SetText(sTitle); + ScopedVclPtrInstance< SwGlossDecideDlg > aDlg(nullptr); + OUString sTitle = aDlg->GetText() + " " + aTripleStrings.front().sBlock; + aDlg->SetText(sTitle); - ListBox& rLB = aDlg.GetListBox(); + ListBox& rLB = aDlg->GetListBox(); for(std::vector<TripleString>::const_iterator i = aTripleStrings.begin(); i != aTripleStrings.end(); ++i) rLB.InsertEntry(i->sGroup.getToken(0, GLOS_DELIM)); rLB.SelectEntryPos(0); - if(RET_OK == aDlg.Execute() && + if(RET_OK == aDlg->Execute() && LISTBOX_ENTRY_NOTFOUND != rLB.GetSelectEntryPos()) { const TripleString& pTriple(aTripleStrings[rLB.GetSelectEntryPos()]); diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 946d409c1e58..b23fbb88f3b3 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -135,13 +135,13 @@ IMPL_LINK( SwNavigationPI, DocListBoxSelectHdl, ListBox *, pBox ) if(!pView) { nEntryIdx == 0 ? - aContentTree.ShowHiddenShell(): - aContentTree.ShowActualView(); + aContentTree->ShowHiddenShell(): + aContentTree->ShowActualView(); } else { - aContentTree.SetConstantShell(pView->GetWrtShellPtr()); + aContentTree->SetConstantShell(pView->GetWrtShellPtr()); } return 0; } @@ -153,23 +153,23 @@ void SwNavigationPI::FillBox() { if(pContentWrtShell) { - aContentTree.SetHiddenShell( pContentWrtShell ); - aContentTree.Display( false ); + aContentTree->SetHiddenShell( pContentWrtShell ); + aContentTree->Display( false ); } else { SwView *pView = GetCreateView(); if(!pView) { - aContentTree.SetActiveShell(0); + aContentTree->SetActiveShell(0); } else if( pView != pActContView) { SwWrtShell* pWrtShell = pView->GetWrtShellPtr(); - aContentTree.SetActiveShell(pWrtShell); + aContentTree->SetActiveShell(pWrtShell); } else - aContentTree.Display( true ); + aContentTree->Display( true ); pActContView = pView; } } @@ -222,7 +222,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) break; case FN_SHOW_ROOT: { - aContentTree.ToggleToRoot(); + aContentTree->ToggleToRoot(); } break; case FN_SHOW_CONTENT_BOX: @@ -305,9 +305,9 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) case FN_GLOBAL_EDIT: { if(IsGlobalMode()) - aGlobalTree.ExecCommand(nCurrItemId); + aGlobalTree->ExecCommand(nCurrItemId); else - aContentTree.ExecCommand(nCurrItemId, bOutlineWithChildren); + aContentTree->ExecCommand(nCurrItemId, bOutlineWithChildren); } break; case FN_GLOBAL_SWITCH: @@ -343,7 +343,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxClickHdl, ToolBox *, pBox ) case FN_GLOBAL_UPDATE: case FN_GLOBAL_OPEN: { - aGlobalTree.TbxMenuHdl(nCurrItemId, pBox); + aGlobalTree->TbxMenuHdl(nCurrItemId, pBox); } break; } @@ -396,7 +396,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox ) pMenu->InsertItem( i, OUString::number(i - 100) ); pMenu->SetHelpId( i, HID_NAVI_OUTLINES ); } - pMenu->CheckItem( aContentTree.GetOutlineLevel() + 100 ); + pMenu->CheckItem( aContentTree->GetOutlineLevel() + 100 ); pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl)); pBox->SetItemDown( nCurrItemId, true ); pMenu->Execute( pBox, @@ -435,7 +435,7 @@ void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, bool bSetFocus Rectangle aRect(rRect); Point aT1 = aRect.TopLeft(); - aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox.OutputToAbsoluteScreenPixel(aT1))); + aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox->OutputToAbsoluteScreenPixel(aT1))); aRect.SetPos(aT1); pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF); SetPopupWindow( pPopup ); @@ -544,18 +544,18 @@ void SwNavigationPI::_ZoomOut() FillBox(); if(IsGlobalMode()) { - aGlobalTree.ShowTree(); + aGlobalTree->ShowTree(); } else { - aContentTree.ShowTree(); - aDocListBox.Show(); + aContentTree->ShowTree(); + aDocListBox->Show(); } - SvTreeListEntry* pFirst = aContentTree.FirstSelected(); + SvTreeListEntry* pFirst = aContentTree->FirstSelected(); if(pFirst) - aContentTree.Select(pFirst, true); // Enable toolbox + aContentTree->Select(pFirst, true); // Enable toolbox pConfig->SetSmall( false ); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX); + aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX); } } @@ -567,9 +567,9 @@ void SwNavigationPI::_ZoomIn() if (pFloat && (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp()))) { - aContentTree.HideTree(); - aDocListBox.Hide(); - aGlobalTree.HideTree(); + aContentTree->HideTree(); + aDocListBox->Hide(); + aGlobalTree->HideTree(); bIsZoomedIn = true; Size aSz(GetOutputSizePixel()); if( aSz.Height() > nZoomIn ) @@ -580,11 +580,11 @@ void SwNavigationPI::_ZoomIn() static_cast<SfxDockingWindow*>(GetParent())->SetMinOutputSizePixel(Size( aMinOutSizePixel.Width(), aSz.Height())); pFloat->SetOutputSizePixel(aSz); - SvTreeListEntry* pFirst = aContentTree.FirstSelected(); + SvTreeListEntry* pFirst = aContentTree->FirstSelected(); if(pFirst) - aContentTree.Select(pFirst, true); // Enable toolbox + aContentTree->Select(pFirst, true); // Enable toolbox pConfig->SetSmall( true ); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, false); + aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX, false); } } } @@ -616,25 +616,25 @@ void SwNavigationPI::Resize() pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel); } - const Point aPos = aContentTree.GetPosPixel(); - Point aLBPos = aDocListBox.GetPosPixel(); + const Point aPos = aContentTree->GetPosPixel(); + Point aLBPos = aDocListBox->GetPosPixel(); long nDist = aPos.X(); aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist); aNewSize.Width() -= 2 * nDist; aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist; - aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() ); + aDocListBox->Show(!aGlobalTree->IsVisible() && aLBPos.Y() > aPos.Y() ); - Size aDocLBSz = aDocListBox.GetSizePixel(); + Size aDocLBSz = aDocListBox->GetSizePixel(); aDocLBSz.Width() = aNewSize.Width(); if(aNewSize.Height() < 0) aDocLBSz.Height() = 0; else aDocLBSz.Height() = nDocLBIniHeight; - aContentTree.SetSizePixel(aNewSize); + aContentTree->SetSizePixel(aNewSize); // GlobalTree starts on to the top and goes all the way down. - aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y()); - aGlobalTree.SetSizePixel(aNewSize); - aDocListBox.setPosSizePixel( aLBPos.X(), aLBPos.Y(), + aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree->GetPosPixel().Y()); + aGlobalTree->SetSizePixel(aNewSize); + aDocListBox->setPosSizePixel( aLBPos.X(), aLBPos.Y(), aDocLBSz.Width(), aDocLBSz.Height(), WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH); } @@ -647,12 +647,12 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, Window( pParent, SW_RES(DLG_NAVIGATION_PI)), SfxControllerItem( SID_DOCFULLNAME, *_pBindings ), - aContentToolBox(this, SW_RES(TB_CONTENT)), - aGlobalToolBox(this, SW_RES(TB_GLOBAL)), + aContentToolBox(VclPtr<SwNavHelpToolBox>::Create(this, SW_RES(TB_CONTENT))), + aGlobalToolBox(VclPtr<SwHelpToolBox>::Create(this, SW_RES(TB_GLOBAL))), aContentImageList(SW_RES(IL_CONTENT)), - aContentTree(this, SW_RES(TL_CONTENT)), - aGlobalTree(this, SW_RES(TL_GLOBAL)), - aDocListBox(this, SW_RES(LB_DOCS)), + aContentTree(VclPtr<SwContentTree>::Create(this, SW_RES(TL_CONTENT))), + aGlobalTree(VclPtr<SwGlobalTree>::Create(this, SW_RES(TL_GLOBAL))), + aDocListBox(VclPtr<ListBox>::Create(this, SW_RES(LB_DOCS))), pxObjectShell(0), pContentView(0), @@ -679,17 +679,17 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, GetCreateView(); InitImageList(); - aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX ); - aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX); - aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX ); - aDocListBox.SetDropDownLineCount(9); + aContentToolBox->SetHelpId(HID_NAVIGATOR_TOOLBOX ); + aGlobalToolBox->SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX); + aDocListBox->SetHelpId(HID_NAVIGATOR_LISTBOX ); + aDocListBox->SetDropDownLineCount(9); - nDocLBIniHeight = aDocListBox.GetSizePixel().Height(); + nDocLBIniHeight = aDocListBox->GetSizePixel().Height(); nZoomOutInit = nZoomOut = Resource::ReadShortRes(); // Insert the numeric field in the toolbox. - NumEditAction* pEdit = new NumEditAction( - &aContentToolBox, SW_RES(NF_PAGE )); + VclPtr<NumEditAction> pEdit = VclPtr<NumEditAction>::Create( + aContentToolBox.get(), SW_RES(NF_PAGE )); pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction)); pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus)); pEdit->SetAccessibleName(pEdit->GetQuickHelpText()); @@ -700,16 +700,16 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, // Double separators are not allowed, so you have to // determine the suitable size differently. - Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE); - Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER); + Rectangle aFirstRect = aContentToolBox->GetItemRect(FN_SELECT_FOOTNOTE); + Rectangle aSecondRect = aContentToolBox->GetItemRect(FN_SELECT_HEADER); Size aItemWinSize( aFirstRect.Left() - aSecondRect.Left(), aFirstRect.Bottom() - aFirstRect.Top() ); pEdit->SetSizePixel(aItemWinSize); - aContentToolBox.InsertSeparator(4); - aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, ToolBoxItemBits::NONE, 4); - aContentToolBox.InsertSeparator(4); - aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16); - aContentToolBox.ShowItem( FN_PAGENUMBER ); + aContentToolBox->InsertSeparator(4); + aContentToolBox->InsertWindow( FN_PAGENUMBER, pEdit, ToolBoxItemBits::NONE, 4); + aContentToolBox->InsertSeparator(4); + aContentToolBox->SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16); + aContentToolBox->ShowItem( FN_PAGENUMBER ); for( sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++ ) { @@ -724,15 +724,15 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, nZoomIn = (short)rOutSize.Height(); // Make sure the toolbox has a size that fits all its contents - Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() ); - aContentToolBox.SetOutputSizePixel( aContentToolboxSize ); + Size aContentToolboxSize( aContentToolBox->CalcWindowSizePixel() ); + aContentToolBox->SetOutputSizePixel( aContentToolboxSize ); // position listbox below toolbar and add some space - long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4; + long nListboxYPos = aContentToolBox->GetPosPixel().Y() + aContentToolboxSize.Height() + 4; // The left and right margins around the toolboxes should be equal. nWishWidth = aContentToolboxSize.Width(); - nWishWidth += 2 * aContentToolBox.GetPosPixel().X(); + nWishWidth += 2 * aContentToolBox->GetPosPixel().X(); DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent); if (pDockingParent != NULL) @@ -758,76 +758,76 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, } } - aContentTree.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); - aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| + aContentTree->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + aContentTree->SetStyle( aContentTree->GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); - aContentTree.SetSpaceBetweenEntries(3); - aContentTree.SetSelectionMode( SINGLE_SELECTION ); - aContentTree.SetDragDropMode( DragDropMode::CTRL_MOVE | - DragDropMode::CTRL_COPY | - DragDropMode::ENABLE_TOP ); - aContentTree.EnableAsyncDrag(true); - aContentTree.ShowTree(); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, true); + aContentTree->SetSpaceBetweenEntries(3); + aContentTree->SetSelectionMode( SINGLE_SELECTION ); + aContentTree->SetDragDropMode( DragDropMode::CTRL_MOVE | + DragDropMode::CTRL_COPY | + DragDropMode::ENABLE_TOP ); + aContentTree->EnableAsyncDrag(true); + aContentTree->ShowTree(); + aContentToolBox->CheckItem(FN_SHOW_CONTENT_BOX, true); // TreeListBox for global document - aGlobalTree.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); - aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION ); - aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| + aGlobalTree->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); + aGlobalTree->SetSelectionMode( MULTIPLE_SELECTION ); + aGlobalTree->SetStyle( aGlobalTree->GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| WB_CLIPCHILDREN|WB_HSCROLL ); - Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel()); - aGlobalToolBox.SetSizePixel(aGlblSize); + Size aGlblSize(aGlobalToolBox->CalcWindowSizePixel()); + aGlobalToolBox->SetSizePixel(aGlblSize); // Handler Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl); - aContentToolBox.SetSelectHdl( aLk ); - aGlobalToolBox.SetSelectHdl( aLk ); - aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI, + aContentToolBox->SetSelectHdl( aLk ); + aGlobalToolBox->SetSelectHdl( aLk ); + aDocListBox->SetSelectHdl(LINK(this, SwNavigationPI, DocListBoxSelectHdl)); - aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); - aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); - aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); - aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); - aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, true); + aContentToolBox->SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); + aContentToolBox->SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); + aGlobalToolBox->SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) ); + aGlobalToolBox->SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) ); + aGlobalToolBox->CheckItem(FN_GLOBAL_SWITCH, true); vcl::Font aFont(GetFont()); aFont.SetWeight(WEIGHT_NORMAL); GetPageEdit().SetFont(aFont); - aFont = aContentTree.GetFont(); + aFont = aContentTree->GetFont(); aFont.SetWeight(WEIGHT_NORMAL); - aContentTree.SetFont(aFont); - aGlobalTree.SetFont(aFont); + aContentTree->SetFont(aFont); + aGlobalTree->SetFont(aFont); StartListening(*SfxGetpApp()); if ( pCreateView ) StartListening(*pCreateView); SfxImageManager* pImgMan = SfxImageManager::GetImageManager(*SW_MOD()); - pImgMan->RegisterToolBox(&aContentToolBox, SfxToolboxFlags::CHANGEOUTSTYLE); - pImgMan->RegisterToolBox(&aGlobalToolBox, SfxToolboxFlags::CHANGEOUTSTYLE); + pImgMan->RegisterToolBox(aContentToolBox.get(), SfxToolboxFlags::CHANGEOUTSTYLE); + pImgMan->RegisterToolBox(aGlobalToolBox.get(), SfxToolboxFlags::CHANGEOUTSTYLE); - aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | ToolBoxItemBits::DROPDOWNONLY ); - aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | ToolBoxItemBits::DROPDOWNONLY ); - aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | ToolBoxItemBits::DROPDOWNONLY ); + aContentToolBox->SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox->GetItemBits( FN_CREATE_NAVIGATION ) | ToolBoxItemBits::DROPDOWNONLY ); + aContentToolBox->SetItemBits( FN_DROP_REGION, aContentToolBox->GetItemBits( FN_DROP_REGION ) | ToolBoxItemBits::DROPDOWNONLY ); + aContentToolBox->SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox->GetItemBits( FN_OUTLINE_LEVEL ) | ToolBoxItemBits::DROPDOWNONLY ); if(IsGlobalDoc()) { SwView *pActView = GetCreateView(); - aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, + aGlobalToolBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, pActView->GetWrtShellPtr()->IsGlblDocSaveLinks()); if(pConfig->IsGlobalActive()) ToggleTree(); - aGlobalTree.GrabFocus(); + aGlobalTree->GrabFocus(); } else - aContentTree.GrabFocus(); + aContentTree->GrabFocus(); UsePage(0); aPageChgIdle.SetIdleHdl(LINK(this, SwNavigationPI, ChangePageHdl)); aPageChgIdle.SetPriority(SchedulerPriority::LOWEST); - aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT)); - aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); - aDocListBox.SetAccessibleName(aStatusArr[3]); + aContentTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT)); + aGlobalTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); + aDocListBox->SetAccessibleName(aStatusArr[3]); if (pContextWin == NULL) { @@ -835,12 +835,17 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, // displayed in the sidebar. While the navigator could change // its size, the sidebar can not, and the navigator would just // waste space. Therefore hide this button. - aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX)); + aContentToolBox->RemoveItem(aContentToolBox->GetItemPos(FN_SHOW_CONTENT_BOX)); } } SwNavigationPI::~SwNavigationPI() { + disposeOnce(); +} + +void SwNavigationPI::dispose() +{ if(IsGlobalDoc() && !IsGlobalMode()) { SwView *pView = GetCreateView(); @@ -852,21 +857,31 @@ SwNavigationPI::~SwNavigationPI() EndListening(*SfxGetpApp()); SfxImageManager* pImgMan = SfxImageManager::GetImageManager(*SW_MOD()); - pImgMan->ReleaseToolBox(&aContentToolBox); - pImgMan->ReleaseToolBox(&aGlobalToolBox); - delete aContentToolBox.GetItemWindow(FN_PAGENUMBER); - aContentToolBox.Clear(); + pImgMan->ReleaseToolBox(aContentToolBox.get()); + pImgMan->ReleaseToolBox(aGlobalToolBox.get()); + aContentToolBox->GetItemWindow(FN_PAGENUMBER)->disposeOnce(); + aContentToolBox->Clear(); if(pxObjectShell) { if(pxObjectShell->Is()) (*pxObjectShell)->DoClose(); delete pxObjectShell; } - delete pPopupWindow; - delete pFloatingWindow; if ( IsBound() ) rBindings.Release(*this); + + pPopupWindow.disposeAndClear(); + pFloatingWindow.disposeAndClear(); + aContentToolBox.disposeAndClear(); + aGlobalToolBox.disposeAndClear(); + aContentTree.disposeAndClear(); + aGlobalTree.disposeAndClear(); + aDocListBox.disposeAndClear(); + + aPageChgIdle.Stop(); + + vcl::Window::dispose(); } void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow ) @@ -882,7 +897,7 @@ IMPL_LINK_NOARG(SwNavigationPI, PopupModeEndHdl) { // Replace floating window with popup window and destroy // floating window instance. - delete pFloatingWindow; + pFloatingWindow.disposeAndClear(); pFloatingWindow = pPopupWindow; pPopupWindow = 0; } @@ -915,9 +930,9 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, if(pActView) { SwWrtShell* pWrtShell = pActView->GetWrtShellPtr(); - aContentTree.SetActiveShell(pWrtShell); + aContentTree->SetActiveShell(pWrtShell); bool bGlobal = IsGlobalDoc(); - aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal); + aContentToolBox->EnableItem(FN_GLOBAL_SWITCH, bGlobal); if( (!bGlobal && IsGlobalMode()) || (!IsGlobalMode() && pConfig->IsGlobalActive()) ) { @@ -925,12 +940,12 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, } if(bGlobal) { - aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks()); + aGlobalToolBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks()); } } else { - aContentTree.SetActiveShell(0); + aContentTree->SetActiveShell(0); } UpdateListBox(); } @@ -940,7 +955,7 @@ void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, NumEditAction& SwNavigationPI::GetPageEdit() { - return *static_cast<NumEditAction*>(aContentToolBox.GetItemWindow(FN_PAGENUMBER)); + return *static_cast<NumEditAction*>(aContentToolBox->GetItemWindow(FN_PAGENUMBER)); } // Notification on modified DocInfo @@ -969,15 +984,15 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint ) if(pActView) { SwWrtShell* pWrtShell = pActView->GetWrtShellPtr(); - aContentTree.SetActiveShell(pWrtShell); - if(aGlobalTree.IsVisible()) + aContentTree->SetActiveShell(pWrtShell); + if(aGlobalTree->IsVisible()) { - if(aGlobalTree.Update( false )) - aGlobalTree.Display(); + if(aGlobalTree->Update( false )) + aGlobalTree->Display(); else // If no update is needed, then paint at least, // because of the red entries for the broken links. - aGlobalTree.Invalidate(); + aGlobalTree->Invalidate(); } } } @@ -993,24 +1008,24 @@ IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu ) if(nMenuId < 100) SetRegionDropMode( --nMenuId); else - aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) ); + aContentTree->SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) ); } return 0; } void SwNavigationPI::UpdateListBox() { - aDocListBox.SetUpdateMode(false); - aDocListBox.Clear(); + aDocListBox->SetUpdateMode(false); + aDocListBox->Clear(); SwView *pActView = GetCreateView(); bool bDisable = pActView == 0; SwView *pView = SwModule::GetFirstView(); sal_Int32 nCount = 0; sal_Int32 nAct = 0; sal_Int32 nConstPos = 0; - const SwView* pConstView = aContentTree.IsConstantView() && - aContentTree.GetActiveWrtShell() ? - &aContentTree.GetActiveWrtShell()->GetView(): + const SwView* pConstView = aContentTree->IsConstantView() && + aContentTree->GetActiveWrtShell() ? + &aContentTree->GetActiveWrtShell()->GetView(): 0; while (pView) { @@ -1028,7 +1043,7 @@ void SwNavigationPI::UpdateListBox() else sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST]; sEntry += ")"; - aDocListBox.InsertEntry(sEntry); + aDocListBox->InsertEntry(sEntry); if (pConstView && pView == pConstView) nConstPos = nCount; @@ -1037,33 +1052,33 @@ void SwNavigationPI::UpdateListBox() } pView = SwModule::GetNextView(pView); } - aDocListBox.InsertEntry(aStatusArr[3]); // "Active Window" + aDocListBox->InsertEntry(aStatusArr[3]); // "Active Window" nCount++; - if(aContentTree.GetHiddenWrtShell()) + if(aContentTree->GetHiddenWrtShell()) { - OUString sEntry = aContentTree.GetHiddenWrtShell()->GetView(). + OUString sEntry = aContentTree->GetHiddenWrtShell()->GetView(). GetDocShell()->GetTitle(); sEntry += " ("; sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST]; sEntry += ")"; - aDocListBox.InsertEntry(sEntry); + aDocListBox->InsertEntry(sEntry); bDisable = false; } - if(aContentTree.IsActiveView()) + if(aContentTree->IsActiveView()) { //Either the name of the current Document or "Active Document". - aDocListBox.SelectEntryPos( pActView ? nAct : --nCount ); + aDocListBox->SelectEntryPos( pActView ? nAct : --nCount ); } - else if(aContentTree.IsHiddenView()) + else if(aContentTree->IsHiddenView()) { - aDocListBox.SelectEntryPos(nCount); + aDocListBox->SelectEntryPos(nCount); } else - aDocListBox.SelectEntryPos(nConstPos); + aDocListBox->SelectEntryPos(nConstPos); - aDocListBox.Enable( !bDisable ); - aDocListBox.SetUpdateMode(true); + aDocListBox->Enable( !bDisable ); + aDocListBox->SetUpdateMode(true); } IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem) @@ -1074,7 +1089,7 @@ IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem) SfxViewFrame* pFrame = pFrameItem->GetFrame(); if(pFrame) { - aContentTree.Clear(); + aContentTree->Clear(); pContentView = PTR_CAST(SwView, pFrame->GetViewShell()); OSL_ENSURE(pContentView, "no SwView"); if(pContentView) @@ -1083,7 +1098,7 @@ IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem) pContentWrtShell = 0; pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell()); FillBox(); - aContentTree.Update(); + aContentTree->Update(); } } return 0; @@ -1125,14 +1140,14 @@ OUString SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData ) sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) { return ( !SwContentTree::IsInDrag() && - ( aContentTree.IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::STRING ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::SOLK ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )|| - aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILECONTENT ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) || - aContentTree.IsDropFormatSupported( SotClipboardFormatId::FILENAME ))) + ( aContentTree->IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::STRING ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::SOLK ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )|| + aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILECONTENT ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) || + aContentTree->IsDropFormatSupported( SotClipboardFormatId::FILENAME ))) ? DND_ACTION_COPY : DND_ACTION_NONE; } @@ -1157,7 +1172,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt ) sContentFileName = sFileName; if(pxObjectShell) { - aContentTree.SetHiddenShell( 0 ); + aContentTree->SetHiddenShell( 0 ); (*pxObjectShell)->DoClose(); DELETEZ( pxObjectShell); } @@ -1187,7 +1202,7 @@ void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode) ImageList& rImgLst = aContentImageList; - aContentToolBox.SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId)); + aContentToolBox->SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId)); } bool SwNavigationPI::ToggleTree() @@ -1199,23 +1214,23 @@ bool SwNavigationPI::ToggleTree() SetUpdateMode(false); if(_IsZoomedIn()) _ZoomOut(); - aGlobalTree.ShowTree(); - aGlobalToolBox.Show(); - aContentTree.HideTree(); - aContentToolBox.Hide(); - aDocListBox.Hide(); + aGlobalTree->ShowTree(); + aGlobalToolBox->Show(); + aContentTree->HideTree(); + aContentToolBox->Hide(); + aDocListBox->Hide(); SetGlobalMode(true); SetUpdateMode(true); } else { - aGlobalTree.HideTree(); - aGlobalToolBox.Hide(); + aGlobalTree->HideTree(); + aGlobalToolBox->Hide(); if(!_IsZoomedIn()) { - aContentTree.ShowTree(); - aContentToolBox.Show(); - aDocListBox.Show(); + aContentTree->ShowTree(); + aContentToolBox->Show(); + aDocListBox->Show(); } bRet = false; SetGlobalMode(false); @@ -1237,8 +1252,11 @@ bool SwNavigationPI::IsGlobalDoc() const IMPL_LINK_NOARG(SwNavigationPI, ChangePageHdl) { - EditAction(&GetPageEdit()); - GetPageEdit().GrabFocus(); + if (!IsDisposed()) + { + EditAction(&GetPageEdit()); + GetPageEdit().GrabFocus(); + } return 0; } @@ -1275,7 +1293,7 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent, SfxChildWinInfo* ) : SfxChildWindowContext( nId ) { - SwNavigationPI* pNavi = new SwNavigationPI( _pBindings, this, pParent ); + VclPtr<SwNavigationPI> pNavi = VclPtr<SwNavigationPI>::Create( _pBindings, this, pParent ); SetWindow( pNavi ); _pBindings->Invalidate(SID_NAVIGATOR); @@ -1284,10 +1302,10 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent, const sal_uInt16 nRootType = static_cast< sal_uInt16 >( pNaviConfig->GetRootType() ); if( nRootType < CONTENT_TYPE_MAX ) { - pNavi->aContentTree.SetRootType(nRootType); - pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, true); + pNavi->aContentTree->SetRootType(nRootType); + pNavi->aContentToolBox->CheckItem(FN_SHOW_ROOT, true); } - pNavi->aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) ); + pNavi->aContentTree->SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) ); pNavi->SetRegionDropMode( static_cast< sal_uInt16 >( pNaviConfig->GetRegionMode() ) ); if(GetFloatingWindow() && pNaviConfig->IsSmall()) @@ -1313,20 +1331,20 @@ void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt ) void SwNavigationPI::InitImageList() { ImageList& rImgLst = aContentImageList; - for( sal_uInt16 k = 0; k < aContentToolBox.GetItemCount(); k++) - aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k), - rImgLst.GetImage(aContentToolBox.GetItemId(k))); + for( sal_uInt16 k = 0; k < aContentToolBox->GetItemCount(); k++) + aContentToolBox->SetItemImage(aContentToolBox->GetItemId(k), + rImgLst.GetImage(aContentToolBox->GetItemId(k))); - for( sal_uInt16 k = 0; k < aGlobalToolBox.GetItemCount(); k++) - aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k), - rImgLst.GetImage(aGlobalToolBox.GetItemId(k))); + for( sal_uInt16 k = 0; k < aGlobalToolBox->GetItemCount(); k++) + aGlobalToolBox->SetItemImage(aGlobalToolBox->GetItemId(k), + rImgLst.GetImage(aGlobalToolBox->GetItemId(k))); sal_uInt16 nDropId = FN_DROP_REGION; if(nRegionMode == REGION_MODE_LINK) nDropId = FN_DROP_REGION_LINK; else if(nRegionMode == REGION_MODE_EMBEDDED) nDropId = FN_DROP_REGION_COPY; - aContentToolBox.SetItemImage( FN_DROP_REGION, + aContentToolBox->SetItemImage( FN_DROP_REGION, rImgLst.GetImage(nDropId)); } diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index c4ad0d190093..56d87e6edb49 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -109,7 +109,13 @@ void NumFormatListBox::Init(short nFormatType, bool bUsrFmts) NumFormatListBox::~NumFormatListBox() { + disposeOnce(); +} + +void NumFormatListBox::dispose() +{ delete pOwnFormatter; + ListBox::dispose(); } SwView* NumFormatListBox::GetView() diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 707f361d5020..a7446c3a4096 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -66,7 +66,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, sal_uInt32 nFlags, const Link* pInitializedLink, const OUString* pURL ) : - aTopWindow(&rWin, this), + aTopWindow(VclPtr<SwFrmCtrlWindow>::Create(&rWin, this)), aMenuRes(SW_RES(RES_FRMEX_MENU)), pModuleView(SW_MOD()->GetView()), nStyleFlags(nFlags), @@ -76,7 +76,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, if (pURL && !pURL->isEmpty()) sArgumentURL = *pURL; - aTopWindow.SetPosSizePixel(Point(0, 0), rWin.GetSizePixel()); + aTopWindow->SetPosSizePixel(Point(0, 0), rWin.GetSizePixel()); if( pInitializedLink ) aInitializedLink = *pInitializedLink; @@ -87,7 +87,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, CreateControl(); - aTopWindow.Show(); + aTopWindow->Show(); } void SwOneExampleFrame::CreateErrorMessage(vcl::Window* pParent) @@ -117,7 +117,7 @@ void SwOneExampleFrame::CreateControl() _xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY); if(_xControl.is()) { - uno::Reference< awt::XWindowPeer > xParent( aTopWindow.GetComponentInterface() ); + uno::Reference< awt::XWindowPeer > xParent( aTopWindow->GetComponentInterface() ); uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW ); @@ -125,7 +125,7 @@ void SwOneExampleFrame::CreateControl() uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY ); xWin->setVisible(sal_False); - Size aWinSize(aTopWindow.GetOutputSizePixel()); + Size aWinSize(aTopWindow->GetOutputSizePixel()); xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY); @@ -361,7 +361,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) } uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY ); - Size aWinSize(aTopWindow.GetOutputSizePixel()); + Size aWinSize(aTopWindow->GetOutputSizePixel()); xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); // can only be done here - the SFX changes the ScrollBar values @@ -376,7 +376,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) xScrCrsr->screenUp(); xWin->setVisible( sal_True ); - aTopWindow.Show(); + aTopWindow->Show(); if( xTunnel.is() ) { @@ -482,7 +482,7 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt) aPop.SetPopupMenu( ITEM_ZOOM, &aSubPop1 ); aSubPop1.SetSelectHdl(aSelLk); } - aPop.Execute( &aTopWindow, rPt ); + aPop.Execute( aTopWindow.get(), rPt ); } |