diff options
Diffstat (limited to 'svx/source/dialog')
38 files changed, 725 insertions, 292 deletions
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index bda7ae2b1c01..8588f9862428 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -84,13 +84,13 @@ public: class MaskSet : public ValueSet { - SvxBmpMask* pSvxBmpMask; - + VclPtr<SvxBmpMask> pSvxBmpMask; public: MaskSet(SvxBmpMask* pMask, vcl::Window* pParent); - - virtual void Select() SAL_OVERRIDE; + virtual ~MaskSet() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { pSvxBmpMask.clear(); ValueSet::dispose(); } + virtual void Select() SAL_OVERRIDE; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE @@ -160,7 +160,7 @@ void MaskSet::onEditColor() class MaskData { - SvxBmpMask* pMask; + VclPtr<SvxBmpMask> pMask; bool bIsReady; bool bExecState; SfxBindings& rBindings; @@ -361,7 +361,7 @@ SvxBmpMaskChildWindow::SvxBmpMaskChildWindow(vcl::Window* pParent_, sal_uInt16 n SfxChildWinInfo* pInfo) : SfxChildWindow(pParent_, nId) { - SvxBmpMask* pDlg = new SvxBmpMask(pBindings, this, pParent_); + VclPtr<SvxBmpMask> pDlg = VclPtr<SvxBmpMask>::Create(pBindings, this, pParent_); pWindow = pDlg; @@ -381,35 +381,35 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pTbxPipette->SetItemBits(m_pTbxPipette->GetItemId(0), ToolBoxItemBits::AUTOCHECK); get(m_pBtnExec, "replace"); - m_pCtlPipette = new ColorWindow(get<Window>("toolgrid")); + m_pCtlPipette = VclPtr<ColorWindow>::Create(get<Window>("toolgrid")); m_pCtlPipette->Show(); m_pCtlPipette->set_grid_left_attach(1); m_pCtlPipette->set_grid_top_attach(0); m_pCtlPipette->set_hexpand(true); get(m_pCbx1, "cbx1"); Window *pGrid = get<Window>("colorgrid"); - m_pQSet1 = new MaskSet(this, pGrid); + m_pQSet1 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet1->set_grid_left_attach(1); m_pQSet1->set_grid_top_attach(1); m_pQSet1->Show(); get(m_pSp1, "tol1"); get(m_pLbColor1, "color1"); get(m_pCbx2, "cbx2"); - m_pQSet2 = new MaskSet(this, pGrid); + m_pQSet2 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet2->set_grid_left_attach(1); m_pQSet2->set_grid_top_attach(2); m_pQSet2->Show(); get(m_pSp2, "tol2"); get(m_pLbColor2, "color2"); get(m_pCbx3, "cbx3"); - m_pQSet3 = new MaskSet(this, pGrid); + m_pQSet3 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet3->set_grid_left_attach(1); m_pQSet3->set_grid_top_attach(3); m_pQSet3->Show(); get(m_pSp3, "tol3"); get(m_pLbColor3, "color3"); get(m_pCbx4, "cbx4"); - m_pQSet4 = new MaskSet(this, pGrid); + m_pQSet4 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet4->set_grid_left_attach(1); m_pQSet4->set_grid_top_attach(4); m_pQSet4->Show(); @@ -483,12 +483,34 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* SvxBmpMask::~SvxBmpMask() { - delete m_pQSet1; - delete m_pQSet2; - delete m_pQSet3; - delete m_pQSet4; - delete m_pCtlPipette; + disposeOnce(); +} + +void SvxBmpMask::dispose() +{ + m_pQSet1.disposeAndClear(); + m_pQSet2.disposeAndClear(); + m_pQSet3.disposeAndClear(); + m_pQSet4.disposeAndClear(); + m_pCtlPipette.disposeAndClear(); delete pData; + m_pTbxPipette.clear(); + m_pBtnExec.clear(); + m_pCbx1.clear(); + m_pSp1.clear(); + m_pLbColor1.clear(); + m_pCbx2.clear(); + m_pSp2.clear(); + m_pLbColor2.clear(); + m_pCbx3.clear(); + m_pSp3.clear(); + m_pLbColor3.clear(); + m_pCbx4.clear(); + m_pSp4.clear(); + m_pLbColor4.clear(); + m_pCbxTrans.clear(); + m_pLbColorTrans.clear(); + SfxDockingWindow::dispose(); } /** is called by a MaskSet when it is selected */ @@ -982,22 +1004,22 @@ Animation SvxBmpMask::ImpReplaceTransparency( const Animation& rAnim, const Colo GDIMetaFile SvxBmpMask::ImpReplaceTransparency( const GDIMetaFile& rMtf, const Color& rColor ) { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; GDIMetaFile aMtf; const MapMode& rPrefMap = rMtf.GetPrefMapMode(); const Size& rPrefSize = rMtf.GetPrefSize(); const size_t nActionCount = rMtf.GetActionSize(); - aVDev.EnableOutput( false ); - aMtf.Record( &aVDev ); + pVDev->EnableOutput( false ); + aMtf.Record( pVDev ); aMtf.SetPrefSize( rPrefSize ); aMtf.SetPrefMapMode( rPrefMap ); - aVDev.SetLineColor( rColor ); - aVDev.SetFillColor( rColor ); + pVDev->SetLineColor( rColor ); + pVDev->SetFillColor( rColor ); // retrieve one action at the time; first // set the whole area to the replacement color. - aVDev.DrawRect( Rectangle( rPrefMap.GetOrigin(), rPrefSize ) ); + pVDev->DrawRect( Rectangle( rPrefMap.GetOrigin(), rPrefSize ) ); for ( size_t i = 0; i < nActionCount; i++ ) { MetaAction* pAct = rMtf.GetAction( i ); diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx index a189d195496c..1d4799c7cc07 100644 --- a/svx/source/dialog/_contdlg.cxx +++ b/svx/source/dialog/_contdlg.cxx @@ -67,7 +67,7 @@ SvxContourDlgChildWindow::SvxContourDlgChildWindow( vcl::Window* _pParent, sal_u SfxBindings* pBindings, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - SvxSuperContourDlg* pDlg = new SvxSuperContourDlg(pBindings, this, _pParent); + VclPtr<SvxSuperContourDlg> pDlg = VclPtr<SvxSuperContourDlg>::Create(pBindings, this, _pParent); pWindow = pDlg; if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN ) @@ -88,6 +88,18 @@ SvxContourDlg::SvxContourDlg(SfxBindings* _pBindings, SfxChildWindow* pCW, SvxContourDlg::~SvxContourDlg() { + disposeOnce(); +} + +void SvxContourDlg::dispose() +{ + pSuperClass.clear(); + SfxFloatingWindow::dispose(); +} + +void SvxContourDlg::SetSuperClass( SvxSuperContourDlg& rSuperClass ) +{ + pSuperClass = &rSuperClass; } tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic, @@ -101,16 +113,16 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic, { if( rGraphic.IsAnimated() ) { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; MapMode aTransMap; const Animation aAnim( rGraphic.GetAnimation() ); const Size& rSizePix = aAnim.GetDisplaySizePixel(); const sal_uInt16 nCount = aAnim.Count(); - if ( aVDev.SetOutputSizePixel( rSizePix ) ) + if ( pVDev->SetOutputSizePixel( rSizePix ) ) { - aVDev.SetLineColor( Color( COL_BLACK ) ); - aVDev.SetFillColor( Color( COL_BLACK ) ); + pVDev->SetLineColor( Color( COL_BLACK ) ); + pVDev->SetFillColor( Color( COL_BLACK ) ); for( sal_uInt16 i = 0; i < nCount; i++ ) { @@ -119,13 +131,13 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic, // Push Polygon output to the right place; this is the // offset of the sub-image within the total animation aTransMap.SetOrigin( Point( rStepBmp.aPosPix.X(), rStepBmp.aPosPix.Y() ) ); - aVDev.SetMapMode( aTransMap ); - aVDev.DrawPolyPolygon( CreateAutoContour( rStepBmp.aBmpEx, pRect, nFlags ) ); + pVDev->SetMapMode( aTransMap ); + pVDev->DrawPolyPolygon( CreateAutoContour( rStepBmp.aBmpEx, pRect, nFlags ) ); } aTransMap.SetOrigin( Point() ); - aVDev.SetMapMode( aTransMap ); - aBmp = aVDev.GetBitmap( Point(), rSizePix ); + pVDev->SetMapMode( aTransMap ); + aBmp = pVDev->GetBitmap( Point(), rSizePix ); aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); } } @@ -140,8 +152,8 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic, else if( rGraphic.GetType() != GRAPHIC_NONE ) { const Graphic aTmpGrf( rGraphic.GetGDIMetaFile().GetMonochromeMtf( Color( COL_BLACK ) ) ); - VirtualDevice aVDev; - Size aSizePix( aVDev.LogicToPixel( aTmpGrf.GetPrefSize(), aTmpGrf.GetPrefMapMode() ) ); + ScopedVclPtrInstance< VirtualDevice > pVDev; + Size aSizePix( pVDev->LogicToPixel( aTmpGrf.GetPrefSize(), aTmpGrf.GetPrefMapMode() ) ); if( aSizePix.Width() && aSizePix.Height() && ( aSizePix.Width() > 512 || aSizePix.Height() > 512 ) ) { @@ -153,11 +165,11 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic, aSizePix.Height() = FRound( ( aSizePix.Width() = 512 ) / fWH ); } - if( aVDev.SetOutputSizePixel( aSizePix ) ) + if( pVDev->SetOutputSizePixel( aSizePix ) ) { const Point aPt; - aTmpGrf.Draw( &aVDev, aPt, aSizePix ); - aBmp = aVDev.GetBitmap( aPt, aSizePix ); + aTmpGrf.Draw( pVDev, aPt, aSizePix ); + aBmp = pVDev->GetBitmap( aPt, aSizePix ); } nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT; @@ -211,7 +223,7 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow * { get(m_pTbx1, "toolbar"); get(m_pMtfTolerance, "spinbutton"); - m_pContourWnd = new ContourWindow(get<vcl::Window>("container"), WB_BORDER); + m_pContourWnd = VclPtr<ContourWindow>::Create(get<vcl::Window>("container"), WB_BORDER); m_pContourWnd->set_hexpand(true); m_pContourWnd->set_vexpand(true); m_pContourWnd->Show(); @@ -282,9 +294,18 @@ SvxSuperContourDlg::SvxSuperContourDlg(SfxBindings *_pBindings, SfxChildWindow * SvxSuperContourDlg::~SvxSuperContourDlg() { + disposeOnce(); +} + +void SvxSuperContourDlg::dispose() +{ SvtMiscOptions aMiscOptions; aMiscOptions.RemoveListenerLink( LINK(this, SvxSuperContourDlg, MiscHdl) ); - delete m_pContourWnd; + m_pContourWnd.disposeAndClear(); + m_pTbx1.clear(); + m_pMtfTolerance.clear(); + m_pStbStatus.clear(); + SvxContourDlg::dispose(); } bool SvxSuperContourDlg::Close() @@ -293,8 +314,8 @@ bool SvxSuperContourDlg::Close() if (m_pTbx1->IsItemEnabled(mnApplyId)) { - MessageDialog aQBox( this,"QuerySaveContourChangesDialog","svx/ui/querysavecontchangesdialog.ui"); - const long nRet = aQBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aQBox( this,"QuerySaveContourChangesDialog","svx/ui/querysavecontchangesdialog.ui"); + const long nRet = aQBox->Execute(); if ( nRet == RET_YES ) { @@ -425,9 +446,9 @@ IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx ) { if (m_pTbx1->IsItemChecked(mnWorkSpaceId)) { - MessageDialog aQBox( this,"QueryDeleteContourDialog","svx/ui/querydeletecontourdialog.ui"); + ScopedVclPtrInstance< MessageDialog > aQBox( this,"QueryDeleteContourDialog","svx/ui/querydeletecontourdialog.ui" ); - if ( !m_pContourWnd->IsContourChanged() || ( aQBox.Execute() == RET_YES ) ) + if ( !m_pContourWnd->IsContourChanged() || ( aQBox->Execute() == RET_YES ) ) m_pContourWnd->SetWorkplaceMode( true ); else m_pTbx1->CheckItem(mnWorkSpaceId, false); @@ -499,10 +520,9 @@ IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx ) m_pStbStatus->Invalidate(); else if ( bGraphicLinked ) { - MessageDialog aQBox(this, "QueryUnlinkGraphicsDialog", - "svx/ui/queryunlinkgraphicsdialog.ui"); - - if (aQBox.Execute() != RET_YES) + ScopedVclPtrInstance<MessageDialog> aQBox(this, "QueryUnlinkGraphicsDialog", + "svx/ui/queryunlinkgraphicsdialog.ui"); + if (aQBox->Execute() != RET_YES) { bPipette = false; m_pTbx1->CheckItem(mnPipetteId, bPipette); @@ -693,7 +713,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow*, pWnd ) if( !!aMask ) { - MessageDialog aQBox( this,"QueryNewContourDialog","svx/ui/querynewcontourdialog.ui"); + ScopedVclPtrInstance< MessageDialog > aQBox( this,"QueryNewContourDialog","svx/ui/querynewcontourdialog.ui" ); bool bNewContour; aRedoGraphic = Graphic(); @@ -701,7 +721,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow*, pWnd ) aGraphic = Graphic( BitmapEx( aBmp, aMask ) ); nGrfChanged++; - bNewContour = ( aQBox.Execute() == RET_YES ); + bNewContour = ( aQBox->Execute() == RET_YES ); pWnd->SetGraphic( aGraphic, bNewContour ); if( bNewContour ) diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 3cbd7eda07c3..9071e536139a 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -56,7 +56,7 @@ sal_uInt32& SvxShowCharSet::getSelectedChar() SvxShowCharSet::SvxShowCharSet(vcl::Window* pParent) : Control(pParent, WB_TABSTOP | WB_BORDER) , m_pAccessible(NULL) - , aVscrollSB( this, WB_VERT) + , aVscrollSB( VclPtr<ScrollBar>::Create(this, WB_VERT) ) { init(); InitSettings( true, true ); @@ -69,8 +69,8 @@ void SvxShowCharSet::init() m_nYGap = 0; SetStyle( GetStyle() | WB_CLIPCHILDREN ); - aVscrollSB.SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) ); - aVscrollSB.EnableDrag( true ); + aVscrollSB->SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) ); + aVscrollSB->EnableDrag( true ); // other settings like aVscroll depend on selected font => see SetFont bDrag = false; @@ -190,7 +190,7 @@ void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt ) void SvxShowCharSet::Command( const CommandEvent& rCEvt ) { - if( !HandleScrollCommand( rCEvt, 0, &aVscrollSB ) ) + if( !HandleScrollCommand( rCEvt, 0, aVscrollSB.get() ) ) Control::Command( rCEvt ); } @@ -213,8 +213,8 @@ sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos) int SvxShowCharSet::FirstInView() const { int nIndex = 0; - if( aVscrollSB.IsVisible() ) - nIndex += aVscrollSB.GetThumbPos() * COLUMN_COUNT; + if( aVscrollSB->IsVisible() ) + nIndex += aVscrollSB->GetThumbPos() * COLUMN_COUNT; return nIndex; } @@ -365,8 +365,8 @@ void SvxShowCharSet::DrawChars_Impl( int n1, int n2 ) return; Size aOutputSize = GetOutputSizePixel(); - if (aVscrollSB.IsVisible()) - aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width(); + if (aVscrollSB->IsVisible()) + aOutputSize.Width() -= aVscrollSB->GetOptimalSize().Width(); int i; for ( i = 1; i < COLUMN_COUNT; ++i ) @@ -513,7 +513,7 @@ void SvxShowCharSet::SetFont( const vcl::Font& rFont ) getSelectedChar() = mpFontCharMap->GetCharFromIndex( nSelectedIndex ); Size aSize = GetOutputSizePixel(); - long nSBWidth = aVscrollSB.GetOptimalSize().Width(); + long nSBWidth = aVscrollSB->GetOptimalSize().Width(); aSize.Width() -= nSBWidth; vcl::Font aFont = rFont; @@ -528,18 +528,18 @@ void SvxShowCharSet::SetFont( const vcl::Font& rFont ) nX = aSize.Width() / COLUMN_COUNT; nY = aSize.Height() / ROW_COUNT; - aVscrollSB.setPosSizePixel( aSize.Width(), 0, nSBWidth, aSize.Height() ); - aVscrollSB.SetRangeMin( 0 ); + aVscrollSB->setPosSizePixel( aSize.Width(), 0, nSBWidth, aSize.Height() ); + aVscrollSB->SetRangeMin( 0 ); int nLastRow = (mpFontCharMap->GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT; - aVscrollSB.SetRangeMax( nLastRow ); - aVscrollSB.SetPageSize( ROW_COUNT-1 ); - aVscrollSB.SetVisibleSize( ROW_COUNT ); + aVscrollSB->SetRangeMax( nLastRow ); + aVscrollSB->SetPageSize( ROW_COUNT-1 ); + aVscrollSB->SetVisibleSize( ROW_COUNT ); // restore last selected unicode int nMapIndex = mpFontCharMap->GetIndexFromChar( getSelectedChar() ); SelectIndex( nMapIndex ); - aVscrollSB.Show(); + aVscrollSB->Show(); // rearrange CharSet element in sync with nX- and nY-multiples Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT); @@ -559,7 +559,7 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus ) sal_uInt32 cPrev = mpFontCharMap->GetPrevChar( getSelectedChar() ); int nMapIndex = mpFontCharMap->GetIndexFromChar( cPrev ); int nNewPos = nMapIndex / COLUMN_COUNT; - aVscrollSB.SetThumbPos( nNewPos ); + aVscrollSB->SetThumbPos( nNewPos ); nSelectedIndex = bFocus ? nMapIndex+1 : -1; Invalidate(); Update(); @@ -567,9 +567,9 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus ) else if( nNewIndex < FirstInView() ) { // need to scroll up to see selected item - int nOldPos = aVscrollSB.GetThumbPos(); + int nOldPos = aVscrollSB->GetThumbPos(); int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT; - aVscrollSB.SetThumbPos( nOldPos - nDelta ); + aVscrollSB->SetThumbPos( nOldPos - nDelta ); nSelectedIndex = nNewIndex; Invalidate(); if( nDelta ) @@ -578,15 +578,15 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus ) else if( nNewIndex > LastInView() ) { // need to scroll down to see selected item - int nOldPos = aVscrollSB.GetThumbPos(); + int nOldPos = aVscrollSB->GetThumbPos(); int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT; - aVscrollSB.SetThumbPos( nOldPos + nDelta ); + aVscrollSB->SetThumbPos( nOldPos + nDelta ); if( nNewIndex < mpFontCharMap->GetCharCount() ) { nSelectedIndex = nNewIndex; Invalidate(); } - if( nOldPos != aVscrollSB.GetThumbPos() ) + if( nOldPos != aVscrollSB->GetThumbPos() ) { Invalidate(); Update(); @@ -603,8 +603,8 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool bFocus ) Point aOldPixel = MapIndexToPixel( nSelectedIndex ); aOldPixel.Move( +1, +1); Size aOutputSize = GetOutputSizePixel(); - if (aVscrollSB.IsVisible()) - aOutputSize.Width() -= aVscrollSB.GetOptimalSize().Width(); + if (aVscrollSB->IsVisible()) + aOutputSize.Width() -= aVscrollSB->GetOptimalSize().Width(); DrawRect( getGridRectangle(aOldPixel, aOutputSize) ); SetLineColor( aLineCol ); SetFillColor( aFillCol ); @@ -655,7 +655,7 @@ void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, bool bFocus ) if( !bFocus ) { // move selected item to top row if not in focus - aVscrollSB.SetThumbPos( nMapIndex / COLUMN_COUNT ); + aVscrollSB->SetThumbPos( nMapIndex / COLUMN_COUNT ); Invalidate(); } } @@ -691,8 +691,15 @@ IMPL_LINK_NOARG(SvxShowCharSet, VscrollHdl) SvxShowCharSet::~SvxShowCharSet() { + disposeOnce(); +} + +void SvxShowCharSet::dispose() +{ if ( m_pAccessible ) ReleaseAccessible(); + aVscrollSB.disposeAndClear(); + Control::dispose(); } void SvxShowCharSet::ReleaseAccessible() diff --git a/svx/source/dialog/checklbx.cxx b/svx/source/dialog/checklbx.cxx index e7f3542e9887..d767d4707285 100644 --- a/svx/source/dialog/checklbx.cxx +++ b/svx/source/dialog/checklbx.cxx @@ -50,7 +50,13 @@ void SvxCheckListBox::SetNormalStaticImage(const Image& rNormalStaticImage) SvxCheckListBox::~SvxCheckListBox() { + disposeOnce(); +} + +void SvxCheckListBox::dispose() +{ delete pCheckButton; + SvTreeListBox::dispose(); } void SvxCheckListBox::Init_Impl() diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index f69b5545f216..53fc5635c587 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -63,6 +63,31 @@ CompressGraphicsDialog::CompressGraphicsDialog( vcl::Window* pParent, Graphic& r Initialize(); } +CompressGraphicsDialog::~CompressGraphicsDialog() +{ + disposeOnce(); +} + +void CompressGraphicsDialog::dispose() +{ + m_pLabelGraphicType.clear(); + m_pFixedText2.clear(); + m_pFixedText3.clear(); + m_pFixedText5.clear(); + m_pFixedText6.clear(); + m_pReduceResolutionCB.clear(); + m_pMFNewWidth.clear(); + m_pMFNewHeight.clear(); + m_pResolutionLB.clear(); + m_pLosslessRB.clear(); + m_pJpegCompRB.clear(); + m_pCompressionMF.clear(); + m_pQualityMF.clear(); + m_pBtnCalculate.clear(); + m_pInterpolationCombo.clear(); + ModalDialog::dispose(); +} + void CompressGraphicsDialog::Initialize() { get(m_pLabelGraphicType, "label-graphic-type"); @@ -103,10 +128,6 @@ void CompressGraphicsDialog::Initialize() Update(); } -CompressGraphicsDialog::~CompressGraphicsDialog() -{ -} - void CompressGraphicsDialog::Update() { GfxLinkType aLinkType = m_aGraphic.GetLink().GetType(); @@ -150,7 +171,7 @@ void CompressGraphicsDialog::Update() const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); sal_Unicode cSeparator = rLocaleWrapper.getNumDecimalSep()[0]; - VirtualDevice* pDummyVDev = new VirtualDevice(); + VclPtr<VirtualDevice> pDummyVDev = VclPtr<VirtualDevice>::Create(); pDummyVDev->EnableOutput( false ); pDummyVDev->SetMapMode( m_aGraphic.GetPrefMapMode() ); diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx index 6cb31753ab37..3db87d5b7564 100644 --- a/svx/source/dialog/connctrl.cxx +++ b/svx/source/dialog/connctrl.cxx @@ -57,7 +57,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxXConnectionPreview( SvxXConnectionPreview::~SvxXConnectionPreview() { + disposeOnce(); +} + +void SvxXConnectionPreview::dispose() +{ delete pObjList; + Control::dispose(); } void SvxXConnectionPreview::Resize() diff --git a/svx/source/dialog/contimp.hxx b/svx/source/dialog/contimp.hxx index c667544cbd46..68c78423c9e6 100644 --- a/svx/source/dialog/contimp.hxx +++ b/svx/source/dialog/contimp.hxx @@ -57,10 +57,10 @@ class SvxSuperContourDlg : public SvxContourDlg void* pUpdateEditingObject; void* pCheckObj; SvxContourDlgItem aContourItem; - ToolBox* m_pTbx1; - MetricField* m_pMtfTolerance; - ContourWindow* m_pContourWnd; - StatusBar* m_pStbStatus; + VclPtr<ToolBox> m_pTbx1; + VclPtr<MetricField> m_pMtfTolerance; + VclPtr<ContourWindow> m_pContourWnd; + VclPtr<StatusBar> m_pStbStatus; sal_uIntPtr nGrfChanged; bool bExecState; bool bUpdateGraphicLinked; @@ -99,6 +99,7 @@ public: SvxSuperContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW, vcl::Window* pParent); virtual ~SvxSuperContourDlg(); + virtual void dispose() SAL_OVERRIDE; void SetExecState( bool bEnable ); diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx index cea52c2aa502..8b4fded5ab8b 100644 --- a/svx/source/dialog/contwnd.cxx +++ b/svx/source/dialog/contwnd.cxx @@ -43,10 +43,6 @@ ContourWindow::ContourWindow( vcl::Window* pParent, WinBits nBits ) : SetWinStyle( WB_SDRMODE ); } -ContourWindow::~ContourWindow() -{ -} - void ContourWindow::SetPolyPolygon( const tools::PolyPolygon& rPolyPoly ) { SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 ); diff --git a/svx/source/dialog/contwnd.hxx b/svx/source/dialog/contwnd.hxx index 2bbf9a6f2feb..e96118c8527c 100644 --- a/svx/source/dialog/contwnd.hxx +++ b/svx/source/dialog/contwnd.hxx @@ -50,7 +50,6 @@ protected: public: ContourWindow(vcl::Window* pParent, WinBits nBits); - virtual ~ContourWindow(); void SetPolyPolygon( const tools::PolyPolygon& rPolyPoly ); const tools::PolyPolygon& GetPolyPolygon(); diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 5406ba14804d..40973ace77b5 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -112,7 +112,14 @@ SvxRedlinTable::SvxRedlinTable(SvSimpleTableContainer& rParent, WinBits nBits) SvxRedlinTable::~SvxRedlinTable() { + disposeOnce(); +} + +void SvxRedlinTable::dispose() +{ delete pCommentSearcher; + pCommentSearcher = NULL; + SvSimpleTable::dispose(); } sal_Int32 SvxRedlinTable::ColCompare(SvTreeListEntry* pLeft,SvTreeListEntry* pRight) @@ -378,7 +385,7 @@ SvxTPView::SvxTPView(vcl::Window *pParent, VclBuilderContainer *pTopLevel) aControlSize = LogicToPixel(aControlSize, MAP_APPFONT); pTable->set_width_request(aControlSize.Width()); pTable->set_height_request(aControlSize.Height()); - m_pViewData = new SvxRedlinTable(*pTable, 0); + m_pViewData = VclPtr<SvxRedlinTable>::Create(*pTable, 0); Link aLink=LINK( this, SvxTPView, PbClickHdl); @@ -411,7 +418,18 @@ void SvxTPView::DeactivatePage() SvxTPView::~SvxTPView() { - delete m_pViewData; + disposeOnce(); +} + +void SvxTPView::dispose() +{ + m_pViewData.disposeAndClear(); + m_pAccept.clear(); + m_pReject.clear(); + m_pAcceptAll.clear(); + m_pRejectAll.clear(); + m_pUndo.clear(); + TabPage::dispose(); } void SvxTPView::InsertWriterHeader() @@ -584,6 +602,35 @@ SvxTPFilter::SvxTPFilter( vcl::Window * pParent) bModified=false; } +SvxTPFilter::~SvxTPFilter() +{ + disposeOnce(); +} + +void SvxTPFilter::dispose() +{ + pRedlinTable.clear(); + m_pCbDate.clear(); + m_pLbDate.clear(); + m_pDfDate.clear(); + m_pTfDate.clear(); + m_pIbClock.clear(); + m_pFtDate2.clear(); + m_pDfDate2.clear(); + m_pTfDate2.clear(); + m_pIbClock2.clear(); + m_pCbAuthor.clear(); + m_pLbAuthor.clear(); + m_pCbRange.clear(); + m_pEdRange.clear(); + m_pBtnRange.clear(); + m_pCbAction.clear(); + m_pLbAction.clear(); + m_pCbComment.clear(); + m_pEdComment.clear(); + TabPage::dispose(); +} + void SvxTPFilter::SetRedlinTable(SvxRedlinTable* pTable) { pRedlinTable=pTable; @@ -950,7 +997,7 @@ void SvxTPFilter::DeactivatePage() { if(bModified) { - if(pRedlinTable!=NULL) + if(pRedlinTable!=nullptr) { pRedlinTable->SetFilterDate(IsDate()); pRedlinTable->SetDateTimeMode(GetDateMode()); @@ -1003,7 +1050,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF) if(m_pDfDate->GetText().isEmpty()) m_pDfDate->SetDate(aDate); - if(pRedlinTable!=NULL) + if(pRedlinTable!=nullptr) pRedlinTable->SetFirstDate(m_pDfDate->GetDate()); } else if (m_pDfDate2==pTF) @@ -1011,7 +1058,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF) if(m_pDfDate2->GetText().isEmpty()) m_pDfDate2->SetDate(aDate); - if(pRedlinTable!=NULL) + if(pRedlinTable!=nullptr) pRedlinTable->SetLastDate(m_pDfDate2->GetDate()); } else if (m_pTfDate==pTF) @@ -1019,7 +1066,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF) if(m_pTfDate->GetText().isEmpty()) m_pTfDate->SetTime(aTime); - if(pRedlinTable!=NULL) + if(pRedlinTable!=nullptr) pRedlinTable->SetFirstTime(m_pTfDate->GetTime()); } else if (m_pTfDate2==pTF) @@ -1027,7 +1074,7 @@ IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF) if(m_pTfDate2->GetText().isEmpty()) m_pTfDate2->SetTime(aTime); - if(pRedlinTable!=NULL) + if(pRedlinTable!=nullptr) pRedlinTable->SetLastTime(m_pTfDate2->GetTime()); } @@ -1049,8 +1096,8 @@ SvxAcceptChgCtr::SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTop { m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "svx/ui/redlinecontrol.ui", "RedlineControl"); - pTPFilter = new SvxTPFilter(this); - pTPView = new SvxTPView(this, pTopLevel); + pTPFilter = VclPtr<SvxTPFilter>::Create(this); + pTPView = VclPtr<SvxTPView>::Create(this, pTopLevel); m_nViewPageId = GetPageId("view"); m_nFilterPageId = GetPageId("filter"); @@ -1066,8 +1113,15 @@ SvxAcceptChgCtr::SvxAcceptChgCtr(vcl::Window* pParent, VclBuilderContainer* pTop SvxAcceptChgCtr::~SvxAcceptChgCtr() { - delete pTPView; - delete pTPFilter; + disposeOnce(); +} + +void SvxAcceptChgCtr::dispose() +{ + disposeBuilder(); + pTPView.disposeAndClear(); + pTPFilter.disposeAndClear(); + TabControl::dispose(); } void SvxAcceptChgCtr::ShowFilterPage() diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 55016d24cc10..0735098c3cae 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -220,9 +220,9 @@ void DialControlBmp::DrawBackground() DialControl::DialControl_Impl::DialControl_Impl ( vcl::Window& rParent ) : - mxBmpEnabled(new DialControlBmp(rParent)), - mxBmpDisabled(new DialControlBmp(rParent)), - mxBmpBuffered(new DialControlBmp(rParent)), + mxBmpEnabled(VclPtr<DialControlBmp>::Create(rParent)), + mxBmpDisabled(VclPtr<DialControlBmp>::Create(rParent)), + mxBmpBuffered(VclPtr<DialControlBmp>::Create(rParent)), mpLinkField( 0 ), mnLinkedFieldValueMultiplyer( 0 ), mnAngle( 0 ), @@ -267,10 +267,6 @@ DialControl::DialControl( vcl::Window* pParent, WinBits nBits ) : Init( GetOutputSizePixel() ); } -DialControl::~DialControl() -{ -} - extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeDialControl(vcl::Window *pParent, VclBuilder::stringmap &) { return new DialControl(pParent, WB_TABSTOP); diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index ce4358124f81..fb4923ebd747 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -69,8 +69,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvx3DPreviewControl(vc Svx3DPreviewControl::~Svx3DPreviewControl() { + disposeOnce(); +} + +void Svx3DPreviewControl::dispose() +{ delete mp3DView; delete mpModel; + Control::dispose(); } void Svx3DPreviewControl::Construct() @@ -272,12 +278,6 @@ Svx3DLightControl::Svx3DLightControl(vcl::Window* pParent, WinBits nStyle) Construct2(); } -Svx3DLightControl::~Svx3DLightControl() -{ - // SdrObjects like mpExpansionObject and mpLampBottomObject/mpLampShaftObject get deleted - // with deletion of the DrawingLayer and model -} - void Svx3DLightControl::Construct2() { { @@ -948,10 +948,10 @@ basegfx::B3DVector Svx3DLightControl::GetLightDirection(sal_uInt32 nNum) const SvxLightCtl3D::SvxLightCtl3D( vcl::Window* pParent) : Control(pParent, WB_BORDER | WB_TABSTOP), - maLightControl(this, 0), - maHorScroller(this, WB_HORZ | WB_DRAG), - maVerScroller(this, WB_VERT | WB_DRAG), - maSwitcher(this, 0) + maLightControl(VclPtr<Svx3DLightControl>::Create(this, 0)), + maHorScroller(VclPtr<ScrollBar>::Create(this, WB_HORZ | WB_DRAG)), + maVerScroller(VclPtr<ScrollBar>::Create(this, WB_VERT | WB_DRAG)), + maSwitcher(VclPtr<PushButton>::Create(this, 0)) { // init members Init(); @@ -970,33 +970,33 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxLightCtl3D(vcl::Win void SvxLightCtl3D::Init() { // #i58240# set HelpIDs for scrollbars and switcher - maHorScroller.SetHelpId(HID_CTRL3D_HSCROLL); - maVerScroller.SetHelpId(HID_CTRL3D_VSCROLL); - maSwitcher.SetHelpId(HID_CTRL3D_SWITCHER); - maSwitcher.SetAccessibleName(SVX_RESSTR(STR_SWITCH)); + maHorScroller->SetHelpId(HID_CTRL3D_HSCROLL); + maVerScroller->SetHelpId(HID_CTRL3D_VSCROLL); + maSwitcher->SetHelpId(HID_CTRL3D_SWITCHER); + maSwitcher->SetAccessibleName(SVX_RESSTR(STR_SWITCH)); // Light preview - maLightControl.Show(); - maLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) ); - maLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) ); + maLightControl->Show(); + maLightControl->SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) ); + maLightControl->SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) ); // Horiz Scrollbar - maHorScroller.Show(); - maHorScroller.SetRange(Range(0, 36000)); - maHorScroller.SetLineSize(100); - maHorScroller.SetPageSize(1000); - maHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) ); + maHorScroller->Show(); + maHorScroller->SetRange(Range(0, 36000)); + maHorScroller->SetLineSize(100); + maHorScroller->SetPageSize(1000); + maHorScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) ); // Vert Scrollbar - maVerScroller.Show(); - maVerScroller.SetRange(Range(0, 18000)); - maVerScroller.SetLineSize(100); - maVerScroller.SetPageSize(1000); - maVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) ); + maVerScroller->Show(); + maVerScroller->SetRange(Range(0, 18000)); + maVerScroller->SetLineSize(100); + maVerScroller->SetPageSize(1000); + maVerScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) ); // Switch Button - maSwitcher.Show(); - maSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) ); + maSwitcher->Show(); + maSwitcher->SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) ); // check selection CheckSelection(); @@ -1007,6 +1007,16 @@ void SvxLightCtl3D::Init() SvxLightCtl3D::~SvxLightCtl3D() { + disposeOnce(); +} + +void SvxLightCtl3D::dispose() +{ + maLightControl.disposeAndClear(); + maHorScroller.disposeAndClear(); + maVerScroller.disposeAndClear(); + maSwitcher.disposeAndClear(); + Control::dispose(); } void SvxLightCtl3D::Resize() @@ -1022,43 +1032,43 @@ void SvxLightCtl3D::NewLayout() { // Layout members const Size aSize(GetOutputSizePixel()); - const sal_Int32 nScrollSize(maHorScroller.GetSizePixel().Height()); + const sal_Int32 nScrollSize(maHorScroller->GetSizePixel().Height()); // Preview control Point aPoint(0, 0); Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize); - maLightControl.SetPosSizePixel(aPoint, aDestSize); + maLightControl->SetPosSizePixel(aPoint, aDestSize); // hor scrollbar aPoint.Y() = aSize.Height() - nScrollSize; aDestSize.Height() = nScrollSize; - maHorScroller.SetPosSizePixel(aPoint, aDestSize); + maHorScroller->SetPosSizePixel(aPoint, aDestSize); // vert scrollbar aPoint.X() = aSize.Width() - nScrollSize; aPoint.Y() = 0; aDestSize.Width() = nScrollSize; aDestSize.Height() = aSize.Height() - nScrollSize; - maVerScroller.SetPosSizePixel(aPoint, aDestSize); + maVerScroller->SetPosSizePixel(aPoint, aDestSize); // button aPoint.Y() = aSize.Height() - nScrollSize; aDestSize.Height() = nScrollSize; - maSwitcher.SetPosSizePixel(aPoint, aDestSize); + maSwitcher->SetPosSizePixel(aPoint, aDestSize); } void SvxLightCtl3D::CheckSelection() { - const bool bSelectionValid(maLightControl.IsSelectionValid() || maLightControl.IsGeometrySelected()); - maHorScroller.Enable(bSelectionValid); - maVerScroller.Enable(bSelectionValid); + const bool bSelectionValid(maLightControl->IsSelectionValid() || maLightControl->IsGeometrySelected()); + maHorScroller->Enable(bSelectionValid); + maVerScroller->Enable(bSelectionValid); if(bSelectionValid) { double fHor(0.0), fVer(0.0); - maLightControl.GetPosition(fHor, fVer); - maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) ); - maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) ); + maLightControl->GetPosition(fHor, fVer); + maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) ); + maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) ); } } @@ -1066,7 +1076,7 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer ) { double fHor(0.0), fVer(0.0); - maLightControl.GetPosition(fHor, fVer); + maLightControl->GetPosition(fHor, fVer); fHor += fDeltaHor; fVer += fDeltaVer; @@ -1076,9 +1086,9 @@ void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer ) if ( fVer < -90.0 ) return; - maLightControl.SetPosition(fHor, fVer); - maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) ); - maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) ); + maLightControl->SetPosition(fHor, fVer); + maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) ); + maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) ); if(maUserInteractiveChangeCallback.IsSet()) { @@ -1124,9 +1134,9 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt ) } case KEY_PAGEUP: { - sal_Int32 nLight(maLightControl.GetSelectedLight() - 1); + sal_Int32 nLight(maLightControl->GetSelectedLight() - 1); - while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight)) + while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight)) { nLight--; } @@ -1135,7 +1145,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt ) { nLight = 7; - while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight)) + while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight)) { nLight--; } @@ -1143,7 +1153,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt ) if(nLight >= 0) { - maLightControl.SelectLight(nLight); + maLightControl->SelectLight(nLight); CheckSelection(); if(maUserSelectionChangeCallback.IsSet()) @@ -1156,9 +1166,9 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt ) } case KEY_PAGEDOWN: { - sal_Int32 nLight(maLightControl.GetSelectedLight() - 1); + sal_Int32 nLight(maLightControl->GetSelectedLight() - 1); - while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight)) + while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight)) { nLight++; } @@ -1167,7 +1177,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt ) { nLight = 0; - while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight)) + while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight)) { nLight++; } @@ -1175,7 +1185,7 @@ void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt ) if(nLight <= 7) { - maLightControl.SelectLight(nLight); + maLightControl->SelectLight(nLight); CheckSelection(); if(maUserSelectionChangeCallback.IsSet()) @@ -1202,16 +1212,16 @@ void SvxLightCtl3D::GetFocus() { CheckSelection(); - Size aFocusSize = maLightControl.GetOutputSizePixel(); + Size aFocusSize = maLightControl->GetOutputSizePixel(); aFocusSize.Width() -= 4; aFocusSize.Height() -= 4; Rectangle aFocusRect( Point( 2, 2 ), aFocusSize ); - aFocusRect = maLightControl.PixelToLogic( aFocusRect ); + aFocusRect = maLightControl->PixelToLogic( aFocusRect ); - maLightControl.ShowFocus( aFocusRect ); + maLightControl->ShowFocus( aFocusRect ); } } @@ -1219,15 +1229,15 @@ void SvxLightCtl3D::LoseFocus() { Control::LoseFocus(); - maLightControl.HideFocus(); + maLightControl->HideFocus(); } IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove) { - const sal_Int32 nHor(maHorScroller.GetThumbPos()); - const sal_Int32 nVer(maVerScroller.GetThumbPos()); + const sal_Int32 nHor(maHorScroller->GetThumbPos()); + const sal_Int32 nVer(maVerScroller->GetThumbPos()); - maLightControl.SetPosition( + maLightControl->SetPosition( ((double)nHor) / 100.0, ((double)((18000 - nVer) - 9000)) / 100.0); @@ -1257,9 +1267,9 @@ IMPL_LINK_NOARG(SvxLightCtl3D, InternalInteractiveChange) { double fHor(0.0), fVer(0.0); - maLightControl.GetPosition(fHor, fVer); - maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) ); - maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) ); + maLightControl->GetPosition(fHor, fVer); + maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) ); + maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) ); if(maUserInteractiveChangeCallback.IsSet()) { diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 7ced4eaf2856..5ab4213297ce 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -106,10 +106,16 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxRectCtl(vcl::Window SvxRectCtl::~SvxRectCtl() { + disposeOnce(); +} + +void SvxRectCtl::dispose() +{ delete pBitmap; if( pAccContext ) pAccContext->release(); + Control::dispose(); } @@ -841,7 +847,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPixelCtl(vcl::Windo SvxPixelCtl::~SvxPixelCtl( ) { + disposeOnce(); +} + +void SvxPixelCtl::dispose() +{ delete []pPixel; + Control::dispose(); } // Changes the foreground or Background color @@ -1427,8 +1439,8 @@ namespace { if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0) { - VirtualDevice aVirtualDevice; - aVirtualDevice.SetOutputSizePixel(rSize); + ScopedVclPtrInstance< VirtualDevice > pVirtualDevice; + pVirtualDevice->SetOutputSizePixel(rSize); if(rBitmapEx.IsTransparent()) { @@ -1441,19 +1453,19 @@ namespace static const Color aW(COL_WHITE); static const Color aG(0xef, 0xef, 0xef); - aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG); + pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG); } else { - aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); - aVirtualDevice.Erase(); + pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor()); + pVirtualDevice->Erase(); } } if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height()) { rBitmapEx.Scale(rSize, BMP_SCALE_DEFAULT); - aVirtualDevice.DrawBitmapEx(Point(0, 0), rBitmapEx); + pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx); } else { @@ -1463,14 +1475,14 @@ namespace { for(sal_Int32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) { - aVirtualDevice.DrawBitmapEx( + pVirtualDevice->DrawBitmapEx( Point(x, y), rBitmapEx); } } } - rBitmapEx = aVirtualDevice.GetBitmap(Point(0, 0), rSize); + rBitmapEx = pVirtualDevice->GetBitmap(Point(0, 0), rSize); } } } // end of anonymous namespace @@ -1594,10 +1606,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineLB(vcl::Window *pP return pListBox; } -LineLB::~LineLB() -{ -} - void LineLB::setAddStandardFields(bool bNew) { if(getAddStandardFields() != bNew) @@ -1696,17 +1704,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineEndLB(vcl::Window return pListBox; } -LineEndLB::~LineEndLB() -{ -} - void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart ) { if( !pList.is() ) return; long nCount = pList->Count(); - VirtualDevice aVD; + ScopedVclPtrInstance< VirtualDevice > pVD; SetUpdateMode( false ); for( long i = 0; i < nCount; i++ ) @@ -1716,10 +1720,10 @@ void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart ) if( !aBitmap.IsEmpty() ) { Size aBmpSize( aBitmap.GetSizePixel() ); - aVD.SetOutputSizePixel( aBmpSize, false ); - aVD.DrawBitmap( Point(), aBitmap ); + pVD->SetOutputSizePixel( aBmpSize, false ); + pVD->DrawBitmap( Point(), aBitmap ); InsertEntry( pEntry->GetName(), - Image(aVD.GetBitmap( + Image(pVD->GetBitmap( (bStart) ? Point() : Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height())))); //delete pBitmap; @@ -1736,14 +1740,14 @@ void LineEndLB::Append( const XLineEndEntry& rEntry, const Bitmap& rBitmap, bool { if(!rBitmap.IsEmpty()) { - VirtualDevice aVD; + ScopedVclPtrInstance< VirtualDevice > pVD; const Size aBmpSize(rBitmap.GetSizePixel()); - aVD.SetOutputSizePixel(aBmpSize, false); - aVD.DrawBitmap(Point(), rBitmap); + pVD->SetOutputSizePixel(aBmpSize, false); + pVD->DrawBitmap(Point(), rBitmap); InsertEntry( rEntry.GetName(), - Image(aVD.GetBitmap( + Image(pVD->GetBitmap( (bStart) ? Point() : Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height())))); } @@ -1761,14 +1765,14 @@ void LineEndLB::Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const Bitma if(!rBitmap.IsEmpty()) { - VirtualDevice aVD; + ScopedVclPtrInstance< VirtualDevice > pVD; const Size aBmpSize(rBitmap.GetSizePixel()); - aVD.SetOutputSizePixel(aBmpSize, false); - aVD.DrawBitmap(Point(), rBitmap); + pVD->SetOutputSizePixel(aBmpSize, false); + pVD->DrawBitmap(Point(), rBitmap); InsertEntry( rEntry.GetName(), - Image(aVD.GetBitmap( + Image(pVD->GetBitmap( (bStart) ? Point() : Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height()))), nPos); @@ -1820,7 +1824,7 @@ void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground) SvxPreviewBase::SvxPreviewBase(vcl::Window* pParent) : Control(pParent, WB_BORDER) , mpModel(new SdrModel()) - , mpBufferDevice(new VirtualDevice(*this)) + , mpBufferDevice(VclPtr<VirtualDevice>::Create(*this)) { // Draw the control's border as a flat thin black line. SetBorderStyle(WindowBorderStyle::MONO); @@ -1833,8 +1837,14 @@ SvxPreviewBase::SvxPreviewBase(vcl::Window* pParent) SvxPreviewBase::~SvxPreviewBase() { + disposeOnce(); +} + +void SvxPreviewBase::dispose() +{ delete mpModel; - delete mpBufferDevice; + mpBufferDevice.disposeAndClear(); + Control::dispose(); } void SvxPreviewBase::LocalPrePaint() @@ -1988,12 +1998,18 @@ Size SvxXLinePreview::GetOptimalSize() const SvxXLinePreview::~SvxXLinePreview() { + disposeOnce(); +} + +void SvxXLinePreview::dispose() +{ SdrObject *pFoo = mpLineObjA; SdrObject::Free( pFoo ); pFoo = mpLineObjB; SdrObject::Free( pFoo ); pFoo = mpLineObjC; SdrObject::Free( pFoo ); + SvxPreviewBase::dispose(); } @@ -2094,7 +2110,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxXRectPreview(vcl::W SvxXRectPreview::~SvxXRectPreview() { + disposeOnce(); +} + +void SvxXRectPreview::dispose() +{ SdrObject::Free(mpRectangleObject); + SvxPreviewBase::dispose(); } void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet) @@ -2149,8 +2171,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxXShadowPreview (vcl SvxXShadowPreview::~SvxXShadowPreview() { + disposeOnce(); +} + +void SvxXShadowPreview::dispose() +{ SdrObject::Free(mpRectangleObject); SdrObject::Free(mpRectangleShadow); + SvxPreviewBase::dispose(); } void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet) diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index b0a0653429d0..b7b32b35f6cf 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -539,15 +539,21 @@ PluginProgressWindow::PluginProgressWindow( vcl::Window* PluginProgressWindow::~PluginProgressWindow() { + disposeOnce(); +} + +void PluginProgressWindow::dispose() +{ if (m_xProgress.is()) m_xProgress->dispose(); + vcl::Window::dispose(); } PluginProgress::PluginProgress( vcl::Window* pParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) { - m_pPlugProgressWindow = new PluginProgressWindow(pParent, static_cast< css::lang::XComponent* >(this)); + m_pPlugProgressWindow = VclPtr<PluginProgressWindow>::Create(pParent, static_cast< css::lang::XComponent* >(this)); css::uno::Reference< css::awt::XWindow > xProgressWindow = VCLUnoHelper::GetInterface(m_pPlugProgressWindow); m_xProgressFactory = css::task::StatusIndicatorFactory::createWithWindow(xContext, xProgressWindow, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/); m_xProgress = m_xProgressFactory->createStatusIndicator(); @@ -660,10 +666,23 @@ SaveDialog::SaveDialog(vcl::Window* pParent, RecoveryCore* pCore) } } +SaveDialog::~SaveDialog() +{ + disposeOnce(); +} + +void SaveDialog::dispose() +{ + m_pTitleFT.clear(); + m_pFileListLB.clear(); + m_pOkBtn.clear(); + Dialog::dispose(); +} + IMPL_LINK_NOARG(SaveDialog, OKButtonHdl) { // start crash-save with progress - boost::scoped_ptr<SaveProgressDialog> pProgress(new SaveProgressDialog(this, m_pCore)); + ScopedVclPtrInstance< SaveProgressDialog > pProgress(this, m_pCore); short nResult = pProgress->Execute(); pProgress.reset(); @@ -690,6 +709,17 @@ SaveProgressDialog::SaveProgressDialog(vcl::Window* pParent, RecoveryCore* pCore m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW); } +SaveProgressDialog::~SaveProgressDialog() +{ + disposeOnce(); +} + +void SaveProgressDialog::dispose() +{ + m_pProgrParent.clear(); + ModalDialog::dispose(); +} + short SaveProgressDialog::Execute() { ::SolarMutexGuard aLock; @@ -808,10 +838,6 @@ RecovDocList::RecovDocList(SvSimpleTableContainer& rParent, ResMgr &rResMgr) { } -RecovDocList::~RecovDocList() -{ -} - void RecovDocList::InitEntry(SvTreeListEntry* pEntry, const OUString& rText, const Image& rImage1, @@ -829,8 +855,8 @@ void RecovDocList::InitEntry(SvTreeListEntry* pEntry, short impl_askUserForWizardCancel(vcl::Window* pParent, sal_Int16 nRes) { - MessageDialog aQuery(pParent, SVX_RES(nRes), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if (aQuery.Execute() == RET_YES) + ScopedVclPtrInstance< MessageDialog > aQuery(pParent, SVX_RES(nRes), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + if (aQuery->Execute() == RET_YES) return DLG_RET_OK; else return DLG_RET_CANCEL; @@ -858,7 +884,7 @@ RecoveryDialog::RecoveryDialog(vcl::Window* pParent, RecoveryCore* pCore) Size aSize(LogicToPixel(Size(RECOV_CONTROLWIDTH, RECOV_FILELISTHEIGHT), MAP_APPFONT)); pFileListLBContainer->set_width_request(aSize.Width()); pFileListLBContainer->set_height_request(aSize.Height()); - m_pFileListLB = new RecovDocList(*pFileListLBContainer, DIALOG_MGR()); + m_pFileListLB = VclPtr<RecovDocList>::Create(*pFileListLBContainer, DIALOG_MGR()); static long nTabs[] = { 2, 0, 40*RECOV_CONTROLWIDTH/100 }; m_pFileListLB->SetTabs( &nTabs[0] ); @@ -901,7 +927,18 @@ RecoveryDialog::RecoveryDialog(vcl::Window* pParent, RecoveryCore* pCore) RecoveryDialog::~RecoveryDialog() { - delete m_pFileListLB; + disposeOnce(); +} + +void RecoveryDialog::dispose() +{ + m_pFileListLB.disposeAndClear(); + m_pTitleFT.clear(); + m_pDescrFT.clear(); + m_pProgrParent.clear(); + m_pNextBtn.clear(); + m_pCancelBtn.clear(); + Dialog::dispose(); } short RecoveryDialog::execute() @@ -951,7 +988,7 @@ short RecoveryDialog::execute() // failed recovery documents. They must be saved to // a user selected directrory. short nRet = DLG_RET_UNKNOWN; - boost::scoped_ptr<BrokenRecoveryDialog> pBrokenRecoveryDialog(new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted)); + ScopedVclPtrInstance< BrokenRecoveryDialog > pBrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted); OUString sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default dir if (pBrokenRecoveryDialog->isExecutionNeeded()) { @@ -1020,7 +1057,7 @@ short RecoveryDialog::execute() // If no temp files exists or user decided to ignore it ... // we have to remove all recovery/session data anyway! short nRet = DLG_RET_UNKNOWN; - boost::scoped_ptr<BrokenRecoveryDialog> pBrokenRecoveryDialog(new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted)); + ScopedVclPtrInstance< BrokenRecoveryDialog > pBrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted); OUString sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default save location // dialog itself checks if there is a need to copy files for this mode. @@ -1231,9 +1268,19 @@ BrokenRecoveryDialog::BrokenRecoveryDialog(vcl::Window* pParent , impl_refresh(); } - BrokenRecoveryDialog::~BrokenRecoveryDialog() { + disposeOnce(); +} + +void BrokenRecoveryDialog::dispose() +{ + m_pFileListLB.clear(); + m_pSaveDirED.clear(); + m_pSaveDirBtn.clear(); + m_pOkBtn.clear(); + m_pCancelBtn.clear(); + ModalDialog::dispose(); } diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 4b0b3920d59d..feb6a20466fc 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -128,8 +128,8 @@ class FontPrevWin_Impl friend class SvxFontPrevWindow; SvxFont aFont; - Printer* pPrinter; - bool bDelPrinter; + VclPtr<Printer> pPrinter; + bool bDelPrinter; Reference < XBreakIterator > xBreak; std::vector<sal_uIntPtr> aTextWidth; @@ -183,7 +183,7 @@ public: delete pColor; delete pBackColor; if( bDelPrinter ) - delete pPrinter; + pPrinter.disposeAndClear(); } void CheckScript(); @@ -502,7 +502,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFontPrevWindow(vcl: SvxFontPrevWindow::~SvxFontPrevWindow() { + disposeOnce(); +} + +void SvxFontPrevWindow::dispose() +{ delete pImpl; + vcl::Window::dispose(); } diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 27a067725c45..7e3f5d4bb831 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -163,8 +163,8 @@ SvxFontWorkChildWindow::SvxFontWorkChildWindow SfxChildWindow( _pParent, nId ) { - SvxFontWorkDialog* pDlg = new SvxFontWorkDialog(pBindings, this, _pParent); - pWindow = pDlg; + VclPtrInstance<SvxFontWorkDialog> pDlg(pBindings, this, _pParent); + pWindow = pDlg.get(); eChildAlignment = SfxChildAlignment::NOALIGNMENT; @@ -288,8 +288,26 @@ SvxFontWorkDialog::SvxFontWorkDialog(SfxBindings *pBindinx, SvxFontWorkDialog::~SvxFontWorkDialog() { + disposeOnce(); +} + +void SvxFontWorkDialog::dispose() +{ for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++) DELETEZ(pCtrlItems[i]); + m_pTbxStyle.clear(); + m_pTbxAdjust.clear(); + m_pFbDistance.clear(); + m_pMtrFldDistance.clear(); + m_pFbTextStart.clear(); + m_pMtrFldTextStart.clear(); + m_pTbxShadow.clear(); + m_pFbShadowX.clear(); + m_pMtrFldShadowX.clear(); + m_pFbShadowY.clear(); + m_pMtrFldShadowY.clear(); + m_pShadowColorLB.clear(); + SfxDockingWindow::dispose(); } SfxChildAlignment SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign, diff --git a/svx/source/dialog/frmdirlbox.cxx b/svx/source/dialog/frmdirlbox.cxx index de7ff69ddd1f..5c2465df0811 100644 --- a/svx/source/dialog/frmdirlbox.cxx +++ b/svx/source/dialog/frmdirlbox.cxx @@ -44,10 +44,6 @@ FrameDirectionListBox::FrameDirectionListBox( vcl::Window* pParent, WinBits nBit { } -FrameDirectionListBox::~FrameDirectionListBox() -{ -} - extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFrameDirectionListBox(vcl::Window *pParent, VclBuilder::stringmap &) { FrameDirectionListBox* pListBox = new FrameDirectionListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK|WB_TABSTOP); diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 911a09a1919a..5897a876200f 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -209,6 +209,7 @@ FrameBorderType FrameBorder::GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) : Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ), mrFrameSel( rFrameSel ), + mpVirDev( VclPtr<VirtualDevice>::Create() ), maILArrows( 16 ), maLeft( FRAMEBORDER_LEFT ), maRight( FRAMEBORDER_RIGHT ), @@ -269,6 +270,7 @@ FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) : } FrameSelectorImpl::~FrameSelectorImpl() + { if( mpAccess ) mpAccess->Invalidate(); @@ -345,7 +347,7 @@ void FrameSelectorImpl::InitGlobalGeometry() /* The final size of the usable area. */ mnCtrlSize = 2 * nBetwBordersSize + nFixedSize; - maVirDev.SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) ); + mpVirDev->SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) ); /* Center the virtual device in the control. */ maVirDevPos = Point( (aCtrlSize.Width() - mnCtrlSize) / 2, (aCtrlSize.Height() - mnCtrlSize) / 2 ); @@ -517,14 +519,14 @@ FrameBorder& FrameSelectorImpl::GetBorderAccess( FrameBorderType eBorder ) void FrameSelectorImpl::DrawBackground() { // clear the area - maVirDev.SetLineColor(); - maVirDev.SetFillColor( maBackCol ); - maVirDev.DrawRect( Rectangle( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) ); + mpVirDev->SetLineColor(); + mpVirDev->SetFillColor( maBackCol ); + mpVirDev->DrawRect( Rectangle( Point( 0, 0 ), mpVirDev->GetOutputSizePixel() ) ); // draw the inner gray (or whatever color) rectangle - maVirDev.SetLineColor(); - maVirDev.SetFillColor( maMarkCol ); - maVirDev.DrawRect( Rectangle( + mpVirDev->SetLineColor(); + mpVirDev->SetFillColor( maMarkCol ); + mpVirDev->DrawRect( Rectangle( mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) ); // draw the white space for enabled frame borders @@ -532,9 +534,9 @@ void FrameSelectorImpl::DrawBackground() for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt ) (*aIt)->MergeFocusToPolyPolygon( aPPoly ); aPPoly.Optimize( PolyOptimizeFlags::CLOSE ); - maVirDev.SetLineColor( maBackCol ); - maVirDev.SetFillColor( maBackCol ); - maVirDev.DrawPolyPolygon( aPPoly ); + mpVirDev->SetLineColor( maBackCol ); + mpVirDev->SetFillColor( maBackCol ); + mpVirDev->DrawPolyPolygon( aPPoly ); } void FrameSelectorImpl::DrawArrows( const FrameBorder& rBorder ) @@ -587,8 +589,8 @@ void FrameSelectorImpl::DrawArrows( const FrameBorder& rBorder ) // Arrow or marker? Do not draw arrows into disabled control. sal_uInt16 nSelectAdd = (mrFrameSel.IsEnabled() && rBorder.IsSelected()) ? 0 : 8; - maVirDev.DrawImage( aPos1, maILArrows.GetImage( nImgId1 + nSelectAdd ) ); - maVirDev.DrawImage( aPos2, maILArrows.GetImage( nImgId2 + nSelectAdd ) ); + mpVirDev->DrawImage( aPos1, maILArrows.GetImage( nImgId1 + nSelectAdd ) ); + mpVirDev->DrawImage( aPos2, maILArrows.GetImage( nImgId2 + nSelectAdd ) ); } void FrameSelectorImpl::DrawAllArrows() @@ -656,7 +658,7 @@ void FrameSelectorImpl::DrawAllFrameBorders() maArray.SetCellStyleDiag( nCol, nRow, maTLBR.GetUIStyle(), maBLTR.GetUIStyle() ); // Let the helper array draw itself - maArray.DrawArray( maVirDev ); + maArray.DrawArray( *mpVirDev.get() ); } void FrameSelectorImpl::DrawVirtualDevice() @@ -671,7 +673,7 @@ void FrameSelectorImpl::CopyVirDevToControl() { if( mbFullRepaint ) DrawVirtualDevice(); - mrFrameSel.DrawBitmap( maVirDevPos, maVirDev.GetBitmap( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) ); + mrFrameSel.DrawBitmap( maVirDevPos, mpVirDev->GetBitmap( Point( 0, 0 ), mpVirDev->GetOutputSizePixel() ) ); } void FrameSelectorImpl::DrawAllTrackingRects() @@ -685,7 +687,7 @@ void FrameSelectorImpl::DrawAllTrackingRects() } else // no frame border selected -> draw tracking rectangle around entire control - aPPoly.Insert( Polygon( Rectangle( maVirDevPos, maVirDev.GetOutputSizePixel() ) ) ); + aPPoly.Insert( Polygon( Rectangle( maVirDevPos, mpVirDev->GetOutputSizePixel() ) ) ); aPPoly.Optimize( PolyOptimizeFlags::CLOSE ); for( sal_uInt16 nIdx = 0, nCount = aPPoly.Count(); nIdx < nCount; ++nIdx ) @@ -789,13 +791,14 @@ FrameSelector::FrameSelector(vcl::Window* pParent) EnableRTL( false ); // #107808# don't mirror the mouse handling } -extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFrameSelector(vcl::Window *pParent, VclBuilder::stringmap &) +FrameSelector::~FrameSelector() { - return new FrameSelector(pParent); + disposeOnce(); } -FrameSelector::~FrameSelector() +extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFrameSelector(vcl::Window *pParent, VclBuilder::stringmap &) { + return new FrameSelector(pParent); } void FrameSelector::Initialize( FrameSelFlags nFlags ) diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 2cbee8804493..236f046a8c69 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -84,6 +84,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeGraphCtrl(vcl::Window GraphCtrl::~GraphCtrl() { + disposeOnce(); +} + +void GraphCtrl::dispose() +{ if( mpAccContext ) { mpAccContext->disposing(); @@ -92,6 +97,7 @@ GraphCtrl::~GraphCtrl() delete pView; delete pModel; delete pUserCall; + Control::dispose(); } void GraphCtrl::SetWinStyle( WinBits nWinBits ) diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 54974addc7f2..9802a4427311 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -115,16 +115,16 @@ namespace svx { } } -SfxTabPage* SvxHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +VclPtr<SfxTabPage> SvxHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return new SvxHeaderPage( pParent, *rSet ); + return VclPtr<SvxHeaderPage>::Create( pParent, *rSet ); } -SfxTabPage* SvxFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +VclPtr<SfxTabPage> SvxFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return new SvxFooterPage( pParent, *rSet ); + return VclPtr<SvxFooterPage>::Create( pParent, *rSet ); } @@ -203,7 +203,29 @@ SvxHFPage::SvxHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 n SvxHFPage::~SvxHFPage() { + disposeOnce(); +} + +void SvxHFPage::dispose() +{ delete pBBSet; + m_pPageLbl.clear(); + m_pTurnOnBox.clear(); + m_pCntSharedBox.clear(); + m_pCntSharedFirstBox.clear(); + m_pLMLbl.clear(); + m_pLMEdit.clear(); + m_pRMLbl.clear(); + m_pRMEdit.clear(); + m_pDistFT.clear(); + m_pDistEdit.clear(); + m_pDynSpacingCB.clear(); + m_pHeightFT.clear(); + m_pHeightEdit.clear(); + m_pHeightDynBtn.clear(); + m_pBspWin.clear(); + m_pBackgroundBtn.clear(); + SfxTabPage::dispose(); } diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 76470da30158..1d606ce45a72 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -95,8 +95,8 @@ SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( vcl::Window* _pParent, sal_uInt16 SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - pWindow = new SvxIMapDlg( pBindings, this, _pParent ); - SvxIMapDlg* pDlg = static_cast<SvxIMapDlg*>(pWindow); + pWindow = VclPtr<SvxIMapDlg>::Create( pBindings, this, _pParent ); + SvxIMapDlg* pDlg = static_cast<SvxIMapDlg*>(pWindow.get()); if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN ) pDlg->RollUp(); @@ -168,7 +168,7 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window get(m_pStbStatus, "statusbar"); VclVBox* _pContainer = get<VclVBox>("container"); - pIMapWnd = new IMapWindow( _pContainer, WB_BORDER, _pBindings->GetActiveFrame() ); + pIMapWnd = VclPtr<IMapWindow>::Create( _pContainer, WB_BORDER, _pBindings->GetActiveFrame() ); pIMapWnd->set_hexpand(true); pIMapWnd->set_vexpand(true); pIMapWnd->Show(); @@ -217,9 +217,23 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window SvxIMapDlg::~SvxIMapDlg() { + disposeOnce(); +} + +void SvxIMapDlg::dispose() +{ // Delete URL-List - delete pIMapWnd; + pIMapWnd.disposeAndClear(); delete pOwnData; + m_pTbxIMapDlg1.clear(); + m_pFtURL.clear(); + m_pURLBox.clear(); + m_pFtText.clear(); + m_pEdtText.clear(); + m_pFtTarget.clear(); + m_pCbbTarget.clear(); + m_pStbStatus.clear(); + SfxModelessDialog::dispose(); } bool SvxIMapDlg::Close() @@ -228,8 +242,8 @@ bool SvxIMapDlg::Close() if ( m_pTbxIMapDlg1->IsItemEnabled( mnApplyId ) ) { - MessageDialog aQBox( this,"QueryModifyImageMapChangesDialog","svx/ui/querymodifyimagemapchangesdialog.ui"); - const long nRet = aQBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aQBox(this,"QueryModifyImageMapChangesDialog","svx/ui/querymodifyimagemapchangesdialog.ui"); + const long nRet = aQBox->Execute(); if( nRet == RET_YES ) { @@ -242,8 +256,8 @@ bool SvxIMapDlg::Close() } else if( pIMapWnd->IsChanged() ) { - MessageDialog aQBox( this,"QuerySaveImageMapChangesDialog","svx/ui/querysaveimagemapchangesdialog.ui"); - const long nRet = aQBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aQBox(this,"QuerySaveImageMapChangesDialog","svx/ui/querysaveimagemapchangesdialog.ui"); + const long nRet = aQBox->Execute(); if( nRet == RET_YES ) bRet = DoSave(); diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 941519e30853..1b7fed9b042f 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -72,8 +72,14 @@ IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XF IMapWindow::~IMapWindow() { + disposeOnce(); +} + +void IMapWindow::dispose() +{ SfxItemPool::Free(pIMapPool); delete[] pItemInfo; + GraphCtrl::dispose(); } Size IMapWindow::GetOptimalSize() const diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index 26b266de8998..4209190be843 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -134,6 +134,7 @@ public: IMapWindow( vcl::Window* pParent, WinBits nBits, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame ); virtual ~IMapWindow(); + virtual void dispose() SAL_OVERRIDE; bool ReplaceActualIMapInfo( const NotifyInfo& rNewInfo ); diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 950a11af2a71..f9527185afd8 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -499,11 +499,6 @@ SvxLanguageBox::SvxLanguageBox( vcl::Window* pParent, WinBits nBits, bool bCheck ImplLanguageBoxBaseInit(); } -SvxLanguageBox::~SvxLanguageBox() -{ -} - - SvxLanguageComboBox::SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits, bool bCheck ) : ComboBox( pParent, nBits ) , SvxLanguageBoxBase( bCheck ) @@ -520,11 +515,6 @@ SvxLanguageComboBox::SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits, b SetModifyHdl( LINK( this, SvxLanguageComboBox, EditModifyHdl ) ); } -SvxLanguageComboBox::~SvxLanguageComboBox() -{ -} - - sal_Int32 SvxLanguageBox::ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) { return InsertEntry( rEntry, (bChecked ? m_aCheckedImage : m_aNotCheckedImage), nPos ); diff --git a/svx/source/dialog/linkwarn.cxx b/svx/source/dialog/linkwarn.cxx index 9015d1ae119c..26879f23f7fe 100644 --- a/svx/source/dialog/linkwarn.cxx +++ b/svx/source/dialog/linkwarn.cxx @@ -43,11 +43,18 @@ SvxLinkWarningDialog::SvxLinkWarningDialog( vcl::Window* pParent, const OUString SvxLinkWarningDialog::~SvxLinkWarningDialog() { + disposeOnce(); +} + +void SvxLinkWarningDialog::dispose() +{ // save value of "warning off" checkbox, if necessary SvtMiscOptions aMiscOpt; bool bChecked = m_pWarningOnBox->IsChecked(); if ( aMiscOpt.ShowLinkWarningDialog() != bChecked ) aMiscOpt.SetShowLinkWarningDialog( bChecked ); + m_pWarningOnBox.clear(); + MessageDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx index 109955906a00..e2ed6e0a1016 100644 --- a/svx/source/dialog/measctrl.cxx +++ b/svx/source/dialog/measctrl.cxx @@ -78,6 +78,11 @@ Size SvxXMeasurePreview::GetOptimalSize() const SvxXMeasurePreview::~SvxXMeasurePreview() { + disposeOnce(); +} + +void SvxXMeasurePreview::dispose() +{ // No one is deleting the MeasureObj? This is not only an error but also // a memory leak (!). Main problem is that this object is still listening to // a StyleSheet of the model which was set. Thus, if You want to keep the obnject, @@ -86,6 +91,7 @@ SvxXMeasurePreview::~SvxXMeasurePreview() delete pMeasureObj; delete pModel; + Control::dispose(); } void SvxXMeasurePreview::Paint( const Rectangle& ) diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx index 8455400d2a0c..c82ac45ded8e 100644 --- a/svx/source/dialog/optgrid.cxx +++ b/svx/source/dialog/optgrid.cxx @@ -171,11 +171,38 @@ SvxGridTabPage::SvxGridTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) ); } +SvxGridTabPage::~SvxGridTabPage() +{ + disposeOnce(); +} + +void SvxGridTabPage::dispose() +{ + pCbxUseGridsnap.clear(); + pCbxGridVisible.clear(); + pMtrFldDrawX.clear(); + pMtrFldDrawY.clear(); + pNumFldDivisionX.clear(); + pNumFldDivisionY.clear(); + pCbxSynchronize.clear(); + pSnapFrames.clear(); + pCbxSnapHelplines.clear(); + pCbxSnapBorder.clear(); + pCbxSnapFrame.clear(); + pCbxSnapPoints.clear(); + pMtrFldSnapArea.clear(); + pCbxOrtho.clear(); + pCbxBigOrtho.clear(); + pCbxRotate.clear(); + pMtrFldAngle.clear(); + pMtrFldBezAngle.clear(); + SfxTabPage::dispose(); +} -SfxTabPage* SvxGridTabPage::Create( vcl::Window* pParent, const SfxItemSet& rAttrSet ) +VclPtr<SfxTabPage> SvxGridTabPage::Create( vcl::Window* pParent, const SfxItemSet& rAttrSet ) { - return new SvxGridTabPage( pParent, rAttrSet ); + return VclPtr<SvxGridTabPage>::Create( pParent, rAttrSet ); } diff --git a/svx/source/dialog/orienthelper.cxx b/svx/source/dialog/orienthelper.cxx index b1b61e9ed1a0..89ecc71dfed8 100644 --- a/svx/source/dialog/orienthelper.cxx +++ b/svx/source/dialog/orienthelper.cxx @@ -31,7 +31,7 @@ namespace svx { struct OrientationHelper_Impl { - typedef std::pair< vcl::Window*, TriState > WindowPair; + typedef std::pair< VclPtr<vcl::Window>, TriState > WindowPair; typedef std::vector< WindowPair > WindowVec; DialControl& mrCtrlDial; diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index 08a7e9cbf740..d1e4c5c04232 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -90,8 +90,14 @@ SvxPageWindow::SvxPageWindow(vcl::Window* pParent) SvxPageWindow::~SvxPageWindow() { + disposeOnce(); +} + +void SvxPageWindow::dispose() +{ delete pHdBorder; delete pFtBorder; + vcl::Window::dispose(); } extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPageWindow(vcl::Window *pParent, VclBuilder::stringmap &) diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx index c794ebb309b5..25b01d703dfa 100644 --- a/svx/source/dialog/passwd.cxx +++ b/svx/source/dialog/passwd.cxx @@ -97,13 +97,21 @@ SvxPasswordDialog::SvxPasswordDialog(vcl::Window* pParent, bool bAllowEmptyPassw } } - - SvxPasswordDialog::~SvxPasswordDialog() { + disposeOnce(); } - +void SvxPasswordDialog::dispose() +{ + m_pOldFL.clear(); + m_pOldPasswdFT.clear(); + m_pOldPasswdED.clear(); + m_pNewPasswdED.clear(); + m_pRepeatPasswdED.clear(); + m_pOKBtn.clear(); + SfxModalDialog::dispose(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/prtqry.cxx b/svx/source/dialog/prtqry.cxx index d14872f65be4..9a6d750f9774 100644 --- a/svx/source/dialog/prtqry.cxx +++ b/svx/source/dialog/prtqry.cxx @@ -37,9 +37,4 @@ SvxPrtQryBox::SvxPrtQryBox(vcl::Window* pParent) : SetButtonHelpText( RET_OK, OUString() ); } -SvxPrtQryBox::~SvxPrtQryBox() -{ -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index e85409be5e4a..29d0ae7c9e39 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -64,7 +64,7 @@ SvxRubyChildWindow::SvxRubyChildWindow( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo) : SfxChildWindow(_pParent, nId) { - SvxRubyDialog* pDlg = new SvxRubyDialog(pBindings, this, _pParent); + VclPtr<SvxRubyDialog> pDlg = VclPtr<SvxRubyDialog>::Create(pBindings, this, _pParent); pWindow = pDlg; if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN ) @@ -263,9 +263,37 @@ SvxRubyDialog::SvxRubyDialog(SfxBindings *pBind, SfxChildWindow *pCW, SvxRubyDialog::~SvxRubyDialog() { + disposeOnce(); +} + +void SvxRubyDialog::dispose() +{ ClearCharStyleList(); EventObject aEvent; xImpl->disposing(aEvent); + m_pLeftFT.clear(); + m_pRightFT.clear(); + m_pLeft1ED.clear(); + m_pRight1ED.clear(); + m_pLeft2ED.clear(); + m_pRight2ED.clear(); + m_pLeft3ED.clear(); + m_pRight3ED.clear(); + m_pLeft4ED.clear(); + m_pRight4ED.clear(); + for (int i=0; i<7; i++) + aEditArr[i].clear(); + m_pScrolledWindow.clear(); + m_pScrollSB.clear(); + m_pAdjustLB.clear(); + m_pPositionLB.clear(); + m_pCharStyleFT.clear(); + m_pCharStyleLB.clear(); + m_pStylistPB.clear(); + m_pPreviewWin.clear(); + m_pApplyPB.clear(); + m_pClosePB.clear(); + SfxModelessDialog::dispose(); } void SvxRubyDialog::ClearCharStyleList() @@ -760,6 +788,17 @@ RubyPreview::RubyPreview(vcl::Window *pParent) SetBorderStyle( WindowBorderStyle::MONO ); } +RubyPreview::~RubyPreview() +{ + disposeOnce(); +} + +void RubyPreview::dispose() +{ + m_pParentDlg.clear(); + vcl::Window::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRubyPreview(vcl::Window *pParent, VclBuilder::stringmap &) { return new RubyPreview(pParent); diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 4e945af0d366..7f022235614a 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -345,6 +345,11 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi SvxSearchDialog::~SvxSearchDialog() { + disposeOnce(); +} + +void SvxSearchDialog::dispose() +{ Hide(); rBindings.EnterRegistrations(); @@ -359,6 +364,49 @@ SvxSearchDialog::~SvxSearchDialog() delete pImpl; delete pSearchList; delete pReplaceList; + mpDocWin.clear(); + m_pSearchFrame.clear(); + m_pSearchLB.clear(); + m_pSearchTmplLB.clear(); + m_pSearchAttrText.clear(); + m_pSearchLabel.clear(); + m_pReplaceFrame.clear(); + m_pReplaceLB.clear(); + m_pReplaceTmplLB.clear(); + m_pReplaceAttrText.clear(); + m_pSearchBtn.clear(); + m_pSearchAllBtn.clear(); + m_pReplaceBtn.clear(); + m_pReplaceAllBtn.clear(); + m_pComponentFrame.clear(); + m_pSearchComponent1PB.clear(); + m_pSearchComponent2PB.clear(); + m_pMatchCaseCB.clear(); + m_pWordBtn.clear(); + m_pCloseBtn.clear(); + m_pIgnoreDiacritics.clear(); + m_pIgnoreKashida.clear(); + m_pSelectionBtn.clear(); + m_pBackwardsBtn.clear(); + m_pRegExpBtn.clear(); + m_pSimilarityBox.clear(); + m_pSimilarityBtn.clear(); + m_pLayoutBtn.clear(); + m_pNotesBtn.clear(); + m_pJapMatchFullHalfWidthCB.clear(); + m_pJapOptionsCB.clear(); + m_pJapOptionsBtn.clear(); + m_pAttributeBtn.clear(); + m_pFormatBtn.clear(); + m_pNoFormatBtn.clear(); + m_pCalcGrid.clear(); + m_pCalcSearchInFT.clear(); + m_pCalcSearchInLB.clear(); + m_pCalcSearchDirFT.clear(); + m_pRowsBtn.clear(); + m_pColumnsBtn.clear(); + m_pAllSheetsCB.clear(); + SfxModelessDialog::dispose(); } void SvxSearchDialog::Construct_Impl() @@ -2222,7 +2270,7 @@ SvxSearchDialogWrapper::SvxSearchDialogWrapper( vcl::Window* _pParent, sal_uInt1 : SfxChildWindow( _pParent, nId ) , dialog (new SvxSearchDialog (_pParent, this, *pBindings)) { - pWindow = dialog; + pWindow = dialog.get(); dialog->Initialize( pInfo ); pBindings->Update( SID_SEARCH_ITEM ); @@ -2260,7 +2308,7 @@ static vcl::Window* lcl_GetSearchLabelWindow() return 0; css::uno::Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW); - ToolBox* pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow).get() ); for (size_t i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) if (pToolBox->GetItemCommand(i) == ".uno:SearchLabel") return pToolBox->GetItemWindow(i); diff --git a/svx/source/dialog/stddlg.cxx b/svx/source/dialog/stddlg.cxx index d06e5245f306..9ae4ca27098f 100644 --- a/svx/source/dialog/stddlg.cxx +++ b/svx/source/dialog/stddlg.cxx @@ -35,8 +35,4 @@ SvxStandardDialog::SvxStandardDialog(vcl::Window *pParent, const OUString& rID, { } -SvxStandardDialog::~SvxStandardDialog() -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx index 3b6ad3f66f21..65d12c962e88 100644 --- a/svx/source/dialog/svxbmpnumvalueset.cxx +++ b/svx/source/dialog/svxbmpnumvalueset.cxx @@ -179,7 +179,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) { // The lines are only one time in the virtual device, only the outline // page is currently done - pVDev = new VirtualDevice(*pDev); + pVDev = VclPtr<VirtualDevice>::Create(*pDev); pVDev->SetMapMode(pDev->GetMapMode()); pVDev->EnableRTL( IsRTLEnabled() ); pVDev->SetOutputSize( aRectSize ); @@ -423,7 +423,13 @@ void SvxNumValueSet::init(sal_uInt16 nType) SvxNumValueSet::~SvxNumValueSet() { - delete pVDev; + disposeOnce(); +} + +void SvxNumValueSet::dispose() +{ + pVDev.disposeAndClear(); + ValueSet::dispose(); } void SvxNumValueSet::SetNumberingSettings( @@ -487,8 +493,14 @@ void SvxBmpNumValueSet::init() SvxBmpNumValueSet::~SvxBmpNumValueSet() { + disposeOnce(); +} + +void SvxBmpNumValueSet::dispose() +{ GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS); aFormatIdle.Stop(); + SvxNumValueSet::dispose(); } void SvxBmpNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 9c8146dd2ba8..7eed4e891f07 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -341,6 +341,11 @@ SvxRuler::SvxRuler( SvxRuler::~SvxRuler() { + disposeOnce(); +} + +void SvxRuler::dispose() +{ /* Destructor ruler; release internal buffer */ REMOVE_DEBUG_WINDOW if(bListening) @@ -348,11 +353,18 @@ SvxRuler::~SvxRuler() pBindings->EnterRegistrations(); - for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i) - delete pCtrlItem[i]; - delete[] pCtrlItem; + if (pCtrlItem) + { + for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i) + delete pCtrlItem[i]; + delete[] pCtrlItem; + pCtrlItem = NULL; + } pBindings->LeaveRegistrations(); + + pEditWin.clear(); + Ruler::dispose(); } long SvxRuler::MakePositionSticky(long aPosition, long aPointOfReference, bool aSnapToFrameMargin) const @@ -3455,23 +3467,23 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent ) { PopupMenu aMenu; aMenu.SetSelectHdl(LINK(this, SvxRuler, TabMenuSelect)); - VirtualDevice aDev; + ScopedVclPtrInstance< VirtualDevice > pDev; const Size aSz(ruler_tab_svx.width + 2, ruler_tab_svx.height + 2); - aDev.SetOutputSize(aSz); - aDev.SetBackground(Wallpaper(Color(COL_WHITE))); - Color aFillColor(aDev.GetSettings().GetStyleSettings().GetShadowColor()); + pDev->SetOutputSize(aSz); + pDev->SetBackground(Wallpaper(Color(COL_WHITE))); + Color aFillColor(pDev->GetSettings().GetStyleSettings().GetShadowColor()); const Point aPt(aSz.Width() / 2, aSz.Height() / 2); for ( sal_uInt16 i = RULER_TAB_LEFT; i < RULER_TAB_DEFAULT; ++i ) { sal_uInt16 nStyle = bRTL ? i|RULER_TAB_RTL : i; nStyle |= static_cast<sal_uInt16>(bHorz ? WB_HORZ : WB_VERT); - DrawTab(&aDev, aFillColor, aPt, nStyle); + DrawTab(pDev, aFillColor, aPt, nStyle); aMenu.InsertItem(i + 1, ResId(RID_SVXSTR_RULER_START + i, DIALOG_MGR()).toString(), - Image(aDev.GetBitmap(Point(), aSz), Color(COL_WHITE))); + Image(pDev->GetBitmap(Point(), aSz), Color(COL_WHITE))); aMenu.CheckItem(i + 1, i == mpTabs[mxRulerImpl->nIdx + TAB_GAP].nStyle); - aDev.SetOutputSize(aSz); // delete device + pDev->SetOutputSize(aSz); // delete device } aMenu.Execute( this, rCommandEvent.GetMousePosPixel() ); } diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx index 35ab86b85636..964899b8c45a 100644 --- a/svx/source/dialog/swframeexample.cxx +++ b/svx/source/dialog/swframeexample.cxx @@ -62,10 +62,6 @@ Size SvxSwFrameExample::GetOptimalSize() const return LogicToPixel(Size(52, 86), MapMode(MAP_APPFONT)); } -SvxSwFrameExample::~SvxSwFrameExample() -{ -} - void SvxSwFrameExample::InitColors_Impl() { const StyleSettings& rSettings = GetSettings().GetStyleSettings(); diff --git a/svx/source/dialog/txencbox.cxx b/svx/source/dialog/txencbox.cxx index f9cf52f232be..bc16ac104620 100644 --- a/svx/source/dialog/txencbox.cxx +++ b/svx/source/dialog/txencbox.cxx @@ -59,7 +59,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxTextEncodingBox(vcl SvxTextEncodingBox::~SvxTextEncodingBox() { + disposeOnce(); +} + +void SvxTextEncodingBox::dispose() +{ delete m_pEncTable; + ListBox::dispose(); } |