diff options
Diffstat (limited to 'sc/source/ui/dbgui')
25 files changed, 773 insertions, 200 deletions
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index c8087b39920f..6858d5df706e 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -184,7 +184,41 @@ ScPivotLayoutDialog::ScPivotLayoutDialog( } ScPivotLayoutDialog::~ScPivotLayoutDialog() -{} +{ + disposeOnce(); +} + +void ScPivotLayoutDialog::dispose() +{ + mpPreviouslyFocusedListBox.clear(); + mpCurrentlyFocusedListBox.clear(); + mpListBoxField.clear(); + mpListBoxPage.clear(); + mpListBoxColumn.clear(); + mpListBoxRow.clear(); + mpListBoxData.clear(); + mpCheckIgnoreEmptyRows.clear(); + mpCheckTotalColumns.clear(); + mpCheckAddFilter.clear(); + mpCheckIdentifyCategories.clear(); + mpCheckTotalRows.clear(); + mpCheckDrillToDetail.clear(); + mpSourceRadioNamedRange.clear(); + mpSourceRadioSelection.clear(); + mpSourceListBox.clear(); + mpSourceEdit.clear(); + mpSourceButton.clear(); + mpDestinationRadioNewSheet.clear(); + mpDestinationRadioNamedRange.clear(); + mpDestinationRadioSelection.clear(); + mpDestinationListBox.clear(); + mpDestinationEdit.clear(); + mpDestinationButton.clear(); + mpBtnOK.clear(); + mpBtnCancel.clear(); + mpActiveEdit.clear(); + ScAnyRefDlg::dispose(); +} void ScPivotLayoutDialog::SetupSource() { @@ -314,7 +348,7 @@ void ScPivotLayoutDialog::SetActive() if (mbDialogLostFocus) { mbDialogLostFocus = false; - if(mpActiveEdit != NULL) + if(mpActiveEdit != nullptr) { mpActiveEdit->GrabFocus(); if (mpActiveEdit == mpSourceEdit) @@ -334,7 +368,7 @@ void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocumen if (!mbDialogLostFocus) return; - if (mpActiveEdit == NULL) + if (mpActiveEdit == nullptr) return; if (rReferenceRange.aStart != rReferenceRange.aEnd) diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx index e0423626febc..99bb77b0c742 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx @@ -28,7 +28,15 @@ ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBi } ScPivotLayoutTreeListBase::~ScPivotLayoutTreeListBase() -{} +{ + disposeOnce(); +} + +void ScPivotLayoutTreeListBase::dispose() +{ + mpParent.clear(); + SvTreeListBox::dispose(); +} void ScPivotLayoutTreeListBase::Setup(ScPivotLayoutDialog* pParent) { @@ -126,7 +134,7 @@ void ScPivotLayoutTreeListBase::GetFocus() if (pEntry) InsertEntryForSourceTarget(pEntry, NULL); - if (mpParent->mpPreviouslyFocusedListBox != NULL) + if (mpParent->mpPreviouslyFocusedListBox != nullptr) mpParent->mpPreviouslyFocusedListBox->GrabFocus(); } diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx index 3644f8444040..3595286c2fda 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx @@ -59,7 +59,7 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/) { - if(mpParent->mpPreviouslyFocusedListBox != this) + if(mpParent->mpPreviouslyFocusedListBox.get() != this) mpParent->mpPreviouslyFocusedListBox->RemoveSelection(); } diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx index a8b6c737d010..1b84ae626154 100644 --- a/sc/source/ui/dbgui/consdlg.cxx +++ b/sc/source/ui/dbgui/consdlg.cxx @@ -105,8 +105,31 @@ ScConsolidateDlg::ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::W ScConsolidateDlg::~ScConsolidateDlg() { + disposeOnce(); +} + +void ScConsolidateDlg::dispose() +{ delete [] pAreaData; delete pRangeUtil; + pLbFunc.clear(); + pLbConsAreas.clear(); + pLbDataArea.clear(); + pEdDataArea.clear(); + pRbDataArea.clear(); + pLbDestArea.clear(); + pEdDestArea.clear(); + pRbDestArea.clear(); + pExpander.clear(); + pBtnByRow.clear(); + pBtnByCol.clear(); + pBtnRefs.clear(); + pBtnOk.clear(); + pBtnCancel.clear(); + pBtnAdd.clear(); + pBtnRemove.clear(); + pRefInputEdit.clear(); + ScAnyRefDlg::dispose(); } void ScConsolidateDlg::Init() diff --git a/sc/source/ui/dbgui/csvcontrol.cxx b/sc/source/ui/dbgui/csvcontrol.cxx index ac0b16c91122..72a437720e3e 100644 --- a/sc/source/ui/dbgui/csvcontrol.cxx +++ b/sc/source/ui/dbgui/csvcontrol.cxx @@ -74,8 +74,14 @@ ScCsvControl::ScCsvControl( vcl::Window* pParent, const ScCsvLayoutData& rData, ScCsvControl::~ScCsvControl() { + disposeOnce(); +} + +void ScCsvControl::dispose() +{ if( mpAccessible ) mpAccessible->dispose(); + Control::dispose(); } // event handling ------------------------------------------------------------- diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index f99a609ea52a..c0adb89e590d 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -62,6 +62,8 @@ struct Func_Select ScCsvGrid::ScCsvGrid( ScCsvControl& rParent ) : ScCsvControl( rParent ), + mpBackgrDev( VclPtr<VirtualDevice>::Create() ), + mpGridDev( VclPtr<VirtualDevice>::Create() ), mpColorConfig( 0 ), mpEditEngine( new ScEditEngineDefaulter( EditEngine::CreatePool(), true ) ), maHeaderFont( GetFont() ), @@ -72,7 +74,7 @@ ScCsvGrid::ScCsvGrid( ScCsvControl& rParent ) : mnMTCurrCol( SAL_MAX_UINT32 ), mbMTSelecting( false ) { - mpEditEngine->SetRefDevice( &maBackgrDev ); + mpEditEngine->SetRefDevice( mpBackgrDev.get() ); mpEditEngine->SetRefMapMode( MapMode( MAP_PIXEL ) ); maEdEngSize = mpEditEngine->GetPaperSize(); @@ -85,9 +87,17 @@ ScCsvGrid::ScCsvGrid( ScCsvControl& rParent ) : ScCsvGrid::~ScCsvGrid() { + disposeOnce(); +} + +void ScCsvGrid::dispose() +{ OSL_ENSURE(mpColorConfig, "the object hasn't been initialized properly"); if (mpColorConfig) mpColorConfig->RemoveListener(this); + mpBackgrDev.disposeAndClear(); + mpGridDev.disposeAndClear(); + ScCsvControl::dispose(); } void @@ -257,8 +267,8 @@ void ScCsvGrid::InitFonts() void ScCsvGrid::InitSizeData() { maWinSize = GetSizePixel(); - maBackgrDev.SetOutputSizePixel( maWinSize ); - maGridDev.SetOutputSizePixel( maWinSize ); + mpBackgrDev->SetOutputSizePixel( maWinSize ); + mpGridDev->SetOutputSizePixel( maWinSize ); InvalidateGfx(); } @@ -1015,7 +1025,7 @@ void ScCsvGrid::ImplRedraw() ImplDrawBackgrDev(); ImplDrawGridDev(); } - DrawOutDev( Point(), maWinSize, Point(), maWinSize, maGridDev ); + DrawOutDev( Point(), maWinSize, Point(), maWinSize, *mpGridDev.get() ); ImplDrawTrackingRect( GetFocusColumn() ); } } @@ -1072,7 +1082,7 @@ void ScCsvGrid::ImplDrawCellText( const Point& rPos, const OUString& rText ) { sal_Int32 nX = rPos.X() + GetCharWidth() * nBeginIx; mpEditEngine->SetText( aToken ); - mpEditEngine->Draw( &maBackgrDev, Point( nX, rPos.Y() ) ); + mpEditEngine->Draw( mpBackgrDev.get(), Point( nX, rPos.Y() ) ); } } @@ -1083,10 +1093,10 @@ void ScCsvGrid::ImplDrawCellText( const Point& rPos, const OUString& rText ) sal_Int32 nX2 = nX1 + GetCharWidth() - 2; sal_Int32 nY = rPos.Y() + GetLineHeight() / 2; Color aColor( maTextColor ); - maBackgrDev.SetLineColor( aColor ); - maBackgrDev.DrawLine( Point( nX1, nY ), Point( nX2, nY ) ); - maBackgrDev.DrawLine( Point( nX2 - 2, nY - 2 ), Point( nX2, nY ) ); - maBackgrDev.DrawLine( Point( nX2 - 2, nY + 2 ), Point( nX2, nY ) ); + mpBackgrDev->SetLineColor( aColor ); + mpBackgrDev->DrawLine( Point( nX1, nY ), Point( nX2, nY ) ); + mpBackgrDev->DrawLine( Point( nX2 - 2, nY - 2 ), Point( nX2, nY ) ); + mpBackgrDev->DrawLine( Point( nX2 - 2, nY + 2 ), Point( nX2, nY ) ); ++nCharIx; } nCharIx = 0; @@ -1096,11 +1106,11 @@ void ScCsvGrid::ImplDrawCellText( const Point& rPos, const OUString& rText ) sal_Int32 nX2 = nX1 + GetCharWidth() - 2; sal_Int32 nY = rPos.Y() + GetLineHeight() / 2; Color aColor( maTextColor ); - maBackgrDev.SetLineColor( aColor ); - maBackgrDev.DrawLine( Point( nX1, nY ), Point( nX2, nY ) ); - maBackgrDev.DrawLine( Point( nX1 + 2, nY - 2 ), Point( nX1, nY ) ); - maBackgrDev.DrawLine( Point( nX1 + 2, nY + 2 ), Point( nX1, nY ) ); - maBackgrDev.DrawLine( Point( nX2, nY - 2 ), Point( nX2, nY ) ); + mpBackgrDev->SetLineColor( aColor ); + mpBackgrDev->DrawLine( Point( nX1, nY ), Point( nX2, nY ) ); + mpBackgrDev->DrawLine( Point( nX1 + 2, nY - 2 ), Point( nX1, nY ) ); + mpBackgrDev->DrawLine( Point( nX1 + 2, nY + 2 ), Point( nX1, nY ) ); + mpBackgrDev->DrawLine( Point( nX2, nY - 2 ), Point( nX2, nY ) ); ++nCharIx; } } @@ -1111,8 +1121,8 @@ void ScCsvGrid::ImplDrawFirstLineSep( bool bSet ) { sal_Int32 nY = GetY( mnFirstImpLine ); sal_Int32 nX = std::min( GetColumnX( GetLastVisColumn() + 1 ), GetLastX() ); - maBackgrDev.SetLineColor( bSet ? maGridPBColor : maGridColor ); - maBackgrDev.DrawLine( Point( GetFirstX() + 1, nY ), Point( nX, nY ) ); + mpBackgrDev->SetLineColor( bSet ? maGridPBColor : maGridColor ); + mpBackgrDev->DrawLine( Point( GetFirstX() + 1, nY ), Point( nX, nY ) ); } } @@ -1121,20 +1131,20 @@ void ScCsvGrid::ImplDrawColumnBackgr( sal_uInt32 nColIndex ) if( !IsVisibleColumn( nColIndex ) ) return; - ImplSetColumnClipRegion( maBackgrDev, nColIndex ); + ImplSetColumnClipRegion( *mpBackgrDev.get(), nColIndex ); // grid - maBackgrDev.SetLineColor(); - maBackgrDev.SetFillColor( maBackColor ); + mpBackgrDev->SetLineColor(); + mpBackgrDev->SetFillColor( maBackColor ); sal_Int32 nX1 = GetColumnX( nColIndex ) + 1; sal_Int32 nX2 = GetColumnX( nColIndex + 1 ); sal_Int32 nY2 = GetY( GetLastVisLine() + 1 ); sal_Int32 nHdrHt = GetHdrHeight(); Rectangle aRect( nX1, nHdrHt, nX2, nY2 ); - maBackgrDev.DrawRect( aRect ); - maBackgrDev.SetLineColor( maGridColor ); - maBackgrDev.DrawGrid( aRect, Size( 1, GetLineHeight() ), GRID_HORZLINES ); - maBackgrDev.DrawLine( Point( nX2, nHdrHt ), Point( nX2, nY2 ) ); + mpBackgrDev->DrawRect( aRect ); + mpBackgrDev->SetLineColor( maGridColor ); + mpBackgrDev->DrawGrid( aRect, Size( 1, GetLineHeight() ), GRID_HORZLINES ); + mpBackgrDev->DrawLine( Point( nX2, nHdrHt ), Point( nX2, nY2 ) ); ImplDrawFirstLineSep( true ); // cell texts @@ -1158,53 +1168,53 @@ void ScCsvGrid::ImplDrawColumnBackgr( sal_uInt32 nColIndex ) } // header - ImplDrawColumnHeader( maBackgrDev, nColIndex, maHeaderBackColor ); + ImplDrawColumnHeader( *mpBackgrDev.get(), nColIndex, maHeaderBackColor ); - maBackgrDev.SetClipRegion(); + mpBackgrDev->SetClipRegion(); } void ScCsvGrid::ImplDrawRowHeaders() { - maBackgrDev.SetLineColor(); - maBackgrDev.SetFillColor( maAppBackColor ); + mpBackgrDev->SetLineColor(); + mpBackgrDev->SetFillColor( maAppBackColor ); Point aPoint( GetHdrX(), 0 ); Rectangle aRect( aPoint, Size( GetHdrWidth() + 1, GetHeight() ) ); - maBackgrDev.DrawRect( aRect ); + mpBackgrDev->DrawRect( aRect ); - maBackgrDev.SetFillColor( maHeaderBackColor ); + mpBackgrDev->SetFillColor( maHeaderBackColor ); aRect.Bottom() = GetY( GetLastVisLine() + 1 ); - maBackgrDev.DrawRect( aRect ); + mpBackgrDev->DrawRect( aRect ); // line numbers - maBackgrDev.SetFont( maHeaderFont ); - maBackgrDev.SetTextColor( maHeaderTextColor ); - maBackgrDev.SetTextFillColor(); + mpBackgrDev->SetFont( maHeaderFont ); + mpBackgrDev->SetTextColor( maHeaderTextColor ); + mpBackgrDev->SetTextFillColor(); sal_Int32 nLastLine = GetLastVisLine(); for( sal_Int32 nLine = GetFirstVisLine(); nLine <= nLastLine; ++nLine ) { OUString aText( OUString::number( nLine + 1 ) ); - sal_Int32 nX = GetHdrX() + (GetHdrWidth() - maBackgrDev.GetTextWidth( aText )) / 2; - maBackgrDev.DrawText( Point( nX, GetY( nLine ) ), aText ); + sal_Int32 nX = GetHdrX() + (GetHdrWidth() - mpBackgrDev->GetTextWidth( aText )) / 2; + mpBackgrDev->DrawText( Point( nX, GetY( nLine ) ), aText ); } // grid - maBackgrDev.SetLineColor( maHeaderGridColor ); + mpBackgrDev->SetLineColor( maHeaderGridColor ); if( IsRTL() ) { - maBackgrDev.DrawLine( Point( 0, 0 ), Point( 0, GetHeight() - 1 ) ); - maBackgrDev.DrawLine( aRect.TopLeft(), aRect.BottomLeft() ); + mpBackgrDev->DrawLine( Point( 0, 0 ), Point( 0, GetHeight() - 1 ) ); + mpBackgrDev->DrawLine( aRect.TopLeft(), aRect.BottomLeft() ); } else - maBackgrDev.DrawLine( aRect.TopRight(), aRect.BottomRight() ); + mpBackgrDev->DrawLine( aRect.TopRight(), aRect.BottomRight() ); aRect.Top() = GetHdrHeight(); - maBackgrDev.DrawGrid( aRect, Size( 1, GetLineHeight() ), GRID_HORZLINES ); + mpBackgrDev->DrawGrid( aRect, Size( 1, GetLineHeight() ), GRID_HORZLINES ); } void ScCsvGrid::ImplDrawBackgrDev() { - maBackgrDev.SetLineColor(); - maBackgrDev.SetFillColor( maAppBackColor ); - maBackgrDev.DrawRect( Rectangle( + mpBackgrDev->SetLineColor(); + mpBackgrDev->SetFillColor( maAppBackColor ); + mpBackgrDev->DrawRect( Rectangle( Point( GetFirstX() + 1, 0 ), Size( GetWidth() - GetHdrWidth(), GetHeight() ) ) ); sal_uInt32 nLastCol = GetLastVisColumn(); @@ -1219,8 +1229,8 @@ void ScCsvGrid::ImplDrawBackgrDev() void ScCsvGrid::ImplDrawColumnSelection( sal_uInt32 nColIndex ) { ImplInvertCursor( GetRulerCursorPos() ); - ImplSetColumnClipRegion( maGridDev, nColIndex ); - maGridDev.DrawOutDev( Point(), maWinSize, Point(), maWinSize, maBackgrDev ); + ImplSetColumnClipRegion( *mpGridDev.get(), nColIndex ); + mpGridDev->DrawOutDev( Point(), maWinSize, Point(), maWinSize, *mpBackgrDev.get() ); if( IsSelected( nColIndex ) ) { @@ -1229,29 +1239,29 @@ void ScCsvGrid::ImplDrawColumnSelection( sal_uInt32 nColIndex ) // header Rectangle aRect( nX1, 0, nX2, GetHdrHeight() ); - maGridDev.SetLineColor(); + mpGridDev->SetLineColor(); if( maHeaderBackColor.IsDark() ) // redraw with light gray background in dark mode - ImplDrawColumnHeader( maGridDev, nColIndex, COL_LIGHTGRAY ); + ImplDrawColumnHeader( *mpGridDev.get(), nColIndex, COL_LIGHTGRAY ); else { // use transparent active color - maGridDev.SetFillColor( maSelectColor ); - maGridDev.DrawTransparent( tools::PolyPolygon( Polygon( aRect ) ), CSV_HDR_TRANSPARENCY ); + mpGridDev->SetFillColor( maSelectColor ); + mpGridDev->DrawTransparent( tools::PolyPolygon( Polygon( aRect ) ), CSV_HDR_TRANSPARENCY ); } // column selection aRect = Rectangle( nX1, GetHdrHeight() + 1, nX2, GetY( GetLastVisLine() + 1 ) - 1 ); - ImplInvertRect( maGridDev, aRect ); + ImplInvertRect( *mpGridDev.get(), aRect ); } - maGridDev.SetClipRegion(); + mpGridDev->SetClipRegion(); ImplInvertCursor( GetRulerCursorPos() ); } void ScCsvGrid::ImplDrawGridDev() { - maGridDev.DrawOutDev( Point(), maWinSize, Point(), maWinSize, maBackgrDev ); + mpGridDev->DrawOutDev( Point(), maWinSize, Point(), maWinSize, *mpBackgrDev ); sal_uInt32 nLastCol = GetLastVisColumn(); if (nLastCol == CSV_COLUMN_INVALID) return; @@ -1297,12 +1307,12 @@ void ScCsvGrid::ImplDrawHorzScrolled( sal_Int32 nOldPos ) ImplInvertCursor( GetRulerCursorPos() + (nPos - nOldPos) ); Rectangle aRectangle( GetFirstX(), 0, GetLastX(), GetHeight() - 1 ); vcl::Region aClipReg( aRectangle ); - maBackgrDev.SetClipRegion( aClipReg ); - maBackgrDev.CopyArea( aDest, aSrc, maWinSize ); - maBackgrDev.SetClipRegion(); - maGridDev.SetClipRegion( aClipReg ); - maGridDev.CopyArea( aDest, aSrc, maWinSize ); - maGridDev.SetClipRegion(); + mpBackgrDev->SetClipRegion( aClipReg ); + mpBackgrDev->CopyArea( aDest, aSrc, maWinSize ); + mpBackgrDev->SetClipRegion(); + mpGridDev->SetClipRegion( aClipReg ); + mpGridDev->CopyArea( aDest, aSrc, maWinSize ); + mpGridDev->SetClipRegion(); ImplInvertCursor( GetRulerCursorPos() ); for( sal_uInt32 nColIx = nFirstColIx; nColIx <= nLastColIx; ++nColIx ) @@ -1312,12 +1322,12 @@ void ScCsvGrid::ImplDrawHorzScrolled( sal_Int32 nOldPos ) if( nLastX <= GetLastX() ) { Rectangle aRect( nLastX, 0, GetLastX(), GetHeight() - 1 ); - maBackgrDev.SetLineColor(); - maBackgrDev.SetFillColor( maAppBackColor ); - maBackgrDev.DrawRect( aRect ); - maGridDev.SetLineColor(); - maGridDev.SetFillColor( maAppBackColor ); - maGridDev.DrawRect( aRect ); + mpBackgrDev->SetLineColor(); + mpBackgrDev->SetFillColor( maAppBackColor ); + mpBackgrDev->DrawRect( aRect ); + mpGridDev->SetLineColor(); + mpGridDev->SetFillColor( maAppBackColor ); + mpGridDev->DrawRect( aRect ); } } @@ -1327,10 +1337,10 @@ void ScCsvGrid::ImplInvertCursor( sal_Int32 nPos ) { sal_Int32 nX = GetX( nPos ) - 1; Rectangle aRect( Point( nX, 0 ), Size( 3, GetHdrHeight() ) ); - ImplInvertRect( maGridDev, aRect ); + ImplInvertRect( *mpGridDev.get(), aRect ); aRect.Top() = GetHdrHeight() + 1; aRect.Bottom() = GetY( GetLastVisLine() + 1 ); - ImplInvertRect( maGridDev, aRect ); + ImplInvertRect( *mpGridDev.get(), aRect ); } } diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 71a1ce4f4c84..4057831ea94b 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -93,15 +93,21 @@ ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) : EnableRTL( false ); // RTL InitColors(); InitSizeData(); - maBackgrDev.SetFont( GetFont() ); - maRulerDev.SetFont( GetFont() ); + maBackgrDev->SetFont( GetFont() ); + maRulerDev->SetFont( GetFont() ); load_FixedWidthList( maSplits ); } ScCsvRuler::~ScCsvRuler() { + disposeOnce(); +} + +void ScCsvRuler::dispose() +{ save_FixedWidthList( maSplits ); + ScCsvControl::dispose(); } // common ruler handling ------------------------------------------------------ @@ -159,8 +165,8 @@ void ScCsvRuler::InitSizeData() maActiveRect.SetPos( Point( GetFirstX(), (GetHeight() - nActiveHeight - 1) / 2 ) ); maActiveRect.SetSize( Size( nActiveWidth, nActiveHeight ) ); - maBackgrDev.SetOutputSizePixel( maWinSize ); - maRulerDev.SetOutputSizePixel( maWinSize ); + maBackgrDev->SetOutputSizePixel( maWinSize ); + maRulerDev->SetOutputSizePixel( maWinSize ); InvalidateGfx(); } @@ -527,30 +533,30 @@ void ScCsvRuler::ImplRedraw() ImplDrawBackgrDev(); ImplDrawRulerDev(); } - DrawOutDev( Point(), maWinSize, Point(), maWinSize, maRulerDev ); + DrawOutDev( Point(), maWinSize, Point(), maWinSize, *maRulerDev.get() ); ImplDrawTrackingRect(); } } void ScCsvRuler::ImplDrawArea( sal_Int32 nPosX, sal_Int32 nWidth ) { - maBackgrDev.SetLineColor(); + maBackgrDev->SetLineColor(); Rectangle aRect( Point( nPosX, 0 ), Size( nWidth, GetHeight() ) ); - maBackgrDev.SetFillColor( maBackColor ); - maBackgrDev.DrawRect( aRect ); + maBackgrDev->SetFillColor( maBackColor ); + maBackgrDev->DrawRect( aRect ); aRect = maActiveRect; aRect.Left() = std::max( GetFirstX(), nPosX ); aRect.Right() = std::min( std::min( GetX( GetPosCount() ), GetLastX() ), nPosX + nWidth - sal_Int32( 1 ) ); if( aRect.Left() <= aRect.Right() ) { - maBackgrDev.SetFillColor( maActiveColor ); - maBackgrDev.DrawRect( aRect ); + maBackgrDev->SetFillColor( maActiveColor ); + maBackgrDev->DrawRect( aRect ); } - maBackgrDev.SetLineColor( maTextColor ); + maBackgrDev->SetLineColor( maTextColor ); sal_Int32 nY = GetHeight() - 1; - maBackgrDev.DrawLine( Point( nPosX, nY ), Point( nPosX + nWidth - 1, nY ) ); + maBackgrDev->DrawLine( Point( nPosX, nY ), Point( nPosX + nWidth - 1, nY ) ); } void ScCsvRuler::ImplDrawBackgrDev() @@ -558,8 +564,8 @@ void ScCsvRuler::ImplDrawBackgrDev() ImplDrawArea( 0, GetWidth() ); // scale - maBackgrDev.SetLineColor( maTextColor ); - maBackgrDev.SetFillColor(); + maBackgrDev->SetLineColor( maTextColor ); + maBackgrDev->SetFillColor(); sal_Int32 nPos; sal_Int32 nFirstPos = std::max( GetPosFromX( 0 ) - (sal_Int32)(1L), (sal_Int32)(0L) ); @@ -569,21 +575,21 @@ void ScCsvRuler::ImplDrawBackgrDev() { sal_Int32 nX = GetX( nPos ); if( nPos % 5 ) - maBackgrDev.DrawPixel( Point( nX, nY ) ); + maBackgrDev->DrawPixel( Point( nX, nY ) ); else - maBackgrDev.DrawLine( Point( nX, nY - 1 ), Point( nX, nY + 1 ) ); + maBackgrDev->DrawLine( Point( nX, nY - 1 ), Point( nX, nY + 1 ) ); } // texts - maBackgrDev.SetTextColor( maTextColor ); - maBackgrDev.SetTextFillColor(); + maBackgrDev->SetTextColor( maTextColor ); + maBackgrDev->SetTextFillColor(); for( nPos = ((nFirstPos + 9) / 10) * 10; nPos <= nLastPos; nPos += 10 ) { OUString aText( OUString::number( nPos ) ); - sal_Int32 nTextWidth = maBackgrDev.GetTextWidth( aText ); + sal_Int32 nTextWidth = maBackgrDev->GetTextWidth( aText ); sal_Int32 nTextX = GetX( nPos ) - nTextWidth / 2; ImplDrawArea( nTextX - 1, nTextWidth + 2 ); - maBackgrDev.DrawText( Point( nTextX, maActiveRect.Top() ), aText ); + maBackgrDev->DrawText( Point( nTextX, maActiveRect.Top() ), aText ); } } @@ -593,10 +599,10 @@ void ScCsvRuler::ImplDrawSplit( sal_Int32 nPos ) { Point aPos( GetX( nPos ) - mnSplitSize / 2, GetHeight() - mnSplitSize - 2 ); Size aSize( mnSplitSize, mnSplitSize ); - maRulerDev.SetLineColor( maTextColor ); - maRulerDev.SetFillColor( maSplitColor ); - maRulerDev.DrawEllipse( Rectangle( aPos, aSize ) ); - maRulerDev.DrawPixel( Point( GetX( nPos ), GetHeight() - 2 ) ); + maRulerDev->SetLineColor( maTextColor ); + maRulerDev->SetFillColor( maSplitColor ); + maRulerDev->DrawEllipse( Rectangle( aPos, aSize ) ); + maRulerDev->DrawPixel( Point( GetX( nPos ), GetHeight() - 2 ) ); } } @@ -607,14 +613,14 @@ void ScCsvRuler::ImplEraseSplit( sal_Int32 nPos ) ImplInvertCursor( GetRulerCursorPos() ); Point aPos( GetX( nPos ) - mnSplitSize / 2, 0 ); Size aSize( mnSplitSize, GetHeight() ); - maRulerDev.DrawOutDev( aPos, aSize, aPos, aSize, maBackgrDev ); + maRulerDev->DrawOutDev( aPos, aSize, aPos, aSize, *maBackgrDev.get() ); ImplInvertCursor( GetRulerCursorPos() ); } } void ScCsvRuler::ImplDrawRulerDev() { - maRulerDev.DrawOutDev( Point(), maWinSize, Point(), maWinSize, maBackgrDev ); + maRulerDev->DrawOutDev( Point(), maWinSize, Point(), maWinSize, *maBackgrDev.get() ); ImplInvertCursor( GetRulerCursorPos() ); sal_uInt32 nFirst = maSplits.LowerBound( GetFirstVisPos() ); @@ -628,7 +634,7 @@ void ScCsvRuler::ImplInvertCursor( sal_Int32 nPos ) { if( IsVisibleSplitPos( nPos ) ) { - ImplInvertRect( maRulerDev, Rectangle( Point( GetX( nPos ) - 1, 0 ), Size( 3, GetHeight() - 1 ) ) ); + ImplInvertRect( *maRulerDev.get(), Rectangle( Point( GetX( nPos ) - 1, 0 ), Size( 3, GetHeight() - 1 ) ) ); if( HasSplit( nPos ) ) ImplDrawSplit( nPos ); } diff --git a/sc/source/ui/dbgui/csvtablebox.cxx b/sc/source/ui/dbgui/csvtablebox.cxx index 424bcc0b6dd7..9dab72200314 100644 --- a/sc/source/ui/dbgui/csvtablebox.cxx +++ b/sc/source/ui/dbgui/csvtablebox.cxx @@ -25,35 +25,50 @@ ScCsvTableBox::ScCsvTableBox( vcl::Window* pParent, WinBits nBits ) : ScCsvControl( pParent, maData, nBits ), - maRuler( *this ), - maGrid( *this ), - maHScroll( this, WB_HORZ | WB_DRAG ), - maVScroll( this, WB_VERT | WB_DRAG ), - maScrollBox( this ) + maRuler( VclPtr<ScCsvRuler>::Create(*this) ), + maGrid( VclPtr<ScCsvGrid>::Create(*this) ), + maHScroll( VclPtr<ScrollBar>::Create( this, WB_HORZ | WB_DRAG ) ), + maVScroll( VclPtr<ScrollBar>::Create( this, WB_VERT | WB_DRAG ) ), + maScrollBox( VclPtr<ScrollBarBox>::Create(this) ) { mbFixedMode = false; mnFixedWidth = 1; - maHScroll.EnableRTL( false ); // RTL - maHScroll.SetLineSize( 1 ); - maVScroll.SetLineSize( 1 ); + maHScroll->EnableRTL( false ); // RTL + maHScroll->SetLineSize( 1 ); + maVScroll->SetLineSize( 1 ); Link aLink = LINK( this, ScCsvTableBox, CsvCmdHdl ); SetCmdHdl( aLink ); - maRuler.SetCmdHdl( aLink ); - maGrid.SetCmdHdl( aLink ); + maRuler->SetCmdHdl( aLink ); + maGrid->SetCmdHdl( aLink ); aLink = LINK( this, ScCsvTableBox, ScrollHdl ); - maHScroll.SetScrollHdl( aLink ); - maVScroll.SetScrollHdl( aLink ); + maHScroll->SetScrollHdl( aLink ); + maVScroll->SetScrollHdl( aLink ); aLink = LINK( this, ScCsvTableBox, ScrollEndHdl ); - maHScroll.SetEndScrollHdl( aLink ); - maVScroll.SetEndScrollHdl( aLink ); + maHScroll->SetEndScrollHdl( aLink ); + maVScroll->SetEndScrollHdl( aLink ); InitControls(); } +ScCsvTableBox::~ScCsvTableBox() +{ + disposeOnce(); +} + +void ScCsvTableBox::dispose() +{ + maRuler.disposeAndClear(); + maGrid.disposeAndClear(); + maHScroll.disposeAndClear(); + maVScroll.disposeAndClear(); + maScrollBox.disposeAndClear(); + ScCsvControl::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScCsvTableBox(vcl::Window *pParent, VclBuilder::stringmap &) { return new ScCsvTableBox(pParent, WB_BORDER); @@ -73,7 +88,7 @@ void ScCsvTableBox::SetSeparatorsMode() { // rescue data for fixed width mode mnFixedWidth = GetPosCount(); - maFixColStates = maGrid.GetColumnStates(); + maFixColStates = maGrid->GetColumnStates(); // switch to separators mode mbFixedMode = false; // reset and reinitialize controls @@ -81,7 +96,7 @@ void ScCsvTableBox::SetSeparatorsMode() Execute( CSVCMD_SETLINEOFFSET, 0 ); Execute( CSVCMD_SETPOSCOUNT, 1 ); Execute( CSVCMD_NEWCELLTEXTS ); - maGrid.SetColumnStates( maSepColStates ); + maGrid->SetColumnStates( maSepColStates ); InitControls(); EnableRepaint(); } @@ -92,15 +107,15 @@ void ScCsvTableBox::SetFixedWidthMode() if( !mbFixedMode ) { // rescue data for separators mode - maSepColStates = maGrid.GetColumnStates(); + maSepColStates = maGrid->GetColumnStates(); // switch to fixed width mode mbFixedMode = true; // reset and reinitialize controls DisableRepaint(); Execute( CSVCMD_SETLINEOFFSET, 0 ); Execute( CSVCMD_SETPOSCOUNT, mnFixedWidth ); - maGrid.SetSplits( maRuler.GetSplits() ); - maGrid.SetColumnStates( maFixColStates ); + maGrid->SetSplits( maRuler->GetSplits() ); + maGrid->SetColumnStates( maFixColStates ); InitControls(); EnableRepaint(); } @@ -108,12 +123,12 @@ void ScCsvTableBox::SetFixedWidthMode() void ScCsvTableBox::Init() { - maGrid.Init(); + maGrid->Init(); } void ScCsvTableBox::InitControls() { - maGrid.UpdateLayoutData(); + maGrid->UpdateLayoutData(); long nScrollBarSize = GetSettings().GetStyleSettings().GetScrollBarSize(); Size aWinSize = CalcOutputSize( GetSizePixel() ); @@ -126,30 +141,30 @@ void ScCsvTableBox::InitControls() if( mbFixedMode ) { // ruler sets height internally - maRuler.setPosSizePixel( 0, 0, nDataWidth, 0 ); - sal_Int32 nY = maRuler.GetSizePixel().Height(); + maRuler->setPosSizePixel( 0, 0, nDataWidth, 0 ); + sal_Int32 nY = maRuler->GetSizePixel().Height(); maData.mnWinHeight -= nY; - maGrid.setPosSizePixel( 0, nY, nDataWidth, maData.mnWinHeight ); + maGrid->setPosSizePixel( 0, nY, nDataWidth, maData.mnWinHeight ); } else - maGrid.setPosSizePixel( 0, 0, nDataWidth, nDataHeight ); - maGrid.Show(); - maRuler.Show( mbFixedMode ); + maGrid->setPosSizePixel( 0, 0, nDataWidth, nDataHeight ); + maGrid->Show(); + maRuler->Show( mbFixedMode ); // scrollbars always visible - maHScroll.setPosSizePixel( 0, nDataHeight, nDataWidth, nScrollBarSize ); + maHScroll->setPosSizePixel( 0, nDataHeight, nDataWidth, nScrollBarSize ); InitHScrollBar(); - maHScroll.Show(); + maHScroll->Show(); // scrollbars always visible - maVScroll.setPosSizePixel( nDataWidth, 0, nScrollBarSize, nDataHeight ); + maVScroll->setPosSizePixel( nDataWidth, 0, nScrollBarSize, nDataHeight ); InitVScrollBar(); - maVScroll.Show(); + maVScroll->Show(); - bool bScrBox = maHScroll.IsVisible() && maVScroll.IsVisible(); + bool bScrBox = maHScroll->IsVisible() && maVScroll->IsVisible(); if( bScrBox ) - maScrollBox.setPosSizePixel( nDataWidth, nDataHeight, nScrollBarSize, nScrollBarSize ); - maScrollBox.Show( bScrBox ); + maScrollBox->setPosSizePixel( nDataWidth, nDataHeight, nScrollBarSize, nScrollBarSize ); + maScrollBox->Show( bScrBox ); // let the controls self-adjust to visible area Execute( CSVCMD_SETPOSOFFSET, GetFirstVisPos() ); @@ -158,18 +173,18 @@ void ScCsvTableBox::InitControls() void ScCsvTableBox::InitHScrollBar() { - maHScroll.SetRange( Range( 0, GetPosCount() + 2 ) ); - maHScroll.SetVisibleSize( GetVisPosCount() ); - maHScroll.SetPageSize( GetVisPosCount() * 3 / 4 ); - maHScroll.SetThumbPos( GetFirstVisPos() ); + maHScroll->SetRange( Range( 0, GetPosCount() + 2 ) ); + maHScroll->SetVisibleSize( GetVisPosCount() ); + maHScroll->SetPageSize( GetVisPosCount() * 3 / 4 ); + maHScroll->SetThumbPos( GetFirstVisPos() ); } void ScCsvTableBox::InitVScrollBar() { - maVScroll.SetRange( Range( 0, GetLineCount() + 1 ) ); - maVScroll.SetVisibleSize( GetVisLineCount() ); - maVScroll.SetPageSize( GetVisLineCount() - 2 ); - maVScroll.SetThumbPos( GetFirstVisLine() ); + maVScroll->SetRange( Range( 0, GetLineCount() + 1 ) ); + maVScroll->SetVisibleSize( GetVisLineCount() ); + maVScroll->SetPageSize( GetVisLineCount() - 2 ); + maVScroll->SetThumbPos( GetFirstVisLine() ); } void ScCsvTableBox::MakePosVisible( sal_Int32 nPos ) @@ -197,9 +212,9 @@ void ScCsvTableBox::SetUniStrings( for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString ) { if( mbFixedMode ) - maGrid.ImplSetTextLineFix( nLine, *pString ); + maGrid->ImplSetTextLineFix( nLine, *pString ); else - maGrid.ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, bMergeSep ); + maGrid->ImplSetTextLineSep( nLine, *pString, rSepChars, cTextSep, bMergeSep ); } EnableRepaint(); } @@ -212,15 +227,15 @@ void ScCsvTableBox::InitTypes( const ListBox& rListBox ) StringVec aTypeNames( nTypeCount ); for( sal_uInt16 nIndex = 0; nIndex < nTypeCount; ++nIndex ) aTypeNames[ nIndex ] = rListBox.GetEntry( nIndex ); - maGrid.SetTypeNames( aTypeNames ); + maGrid->SetTypeNames( aTypeNames ); } void ScCsvTableBox::FillColumnData( ScAsciiOptions& rOptions ) const { if( mbFixedMode ) - maGrid.FillColumnDataFix( rOptions ); + maGrid->FillColumnDataFix( rOptions ); else - maGrid.FillColumnDataSep( rOptions ); + maGrid->FillColumnDataSep( rOptions ); } // event handling ------------------------------------------------------------- @@ -253,8 +268,8 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) case CSVCMD_REPAINT: if( !IsNoRepaint() ) { - maGrid.ImplRedraw(); - maRuler.ImplRedraw(); + maGrid->ImplRedraw(); + maRuler->ImplRedraw(); InitHScrollBar(); InitVScrollBar(); } @@ -269,12 +284,12 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) else { DisableRepaint(); - ScCsvColStateVec aStates( maGrid.GetColumnStates() ); + ScCsvColStateVec aStates( maGrid->GetColumnStates() ); sal_Int32 nPos = GetFirstVisPos(); Execute( CSVCMD_SETPOSCOUNT, 1 ); Execute( CSVCMD_UPDATECELLTEXTS ); Execute( CSVCMD_SETPOSOFFSET, nPos ); - maGrid.SetColumnStates( aStates ); + maGrid->SetColumnStates( aStates ); EnableRepaint(); } break; @@ -282,40 +297,40 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) maUpdateTextHdl.Call( this ); break; case CSVCMD_SETCOLUMNTYPE: - maGrid.SetSelColumnType( nParam1 ); + maGrid->SetSelColumnType( nParam1 ); break; case CSVCMD_EXPORTCOLUMNTYPE: maColTypeHdl.Call( this ); break; case CSVCMD_SETFIRSTIMPORTLINE: - maGrid.SetFirstImportedLine( nParam1 ); + maGrid->SetFirstImportedLine( nParam1 ); break; case CSVCMD_INSERTSPLIT: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::InsertSplit - invalid call" ); - if( maRuler.GetSplitCount() + 1 < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT) ) + if( maRuler->GetSplitCount() + 1 < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT) ) { - maRuler.InsertSplit( nParam1 ); - maGrid.InsertSplit( nParam1 ); + maRuler->InsertSplit( nParam1 ); + maGrid->InsertSplit( nParam1 ); } break; case CSVCMD_REMOVESPLIT: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::RemoveSplit - invalid call" ); - maRuler.RemoveSplit( nParam1 ); - maGrid.RemoveSplit( nParam1 ); + maRuler->RemoveSplit( nParam1 ); + maGrid->RemoveSplit( nParam1 ); break; case CSVCMD_TOGGLESPLIT: - Execute( maRuler.HasSplit( nParam1 ) ? CSVCMD_REMOVESPLIT : CSVCMD_INSERTSPLIT, nParam1 ); + Execute( maRuler->HasSplit( nParam1 ) ? CSVCMD_REMOVESPLIT : CSVCMD_INSERTSPLIT, nParam1 ); break; case CSVCMD_MOVESPLIT: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::MoveSplit - invalid call" ); - maRuler.MoveSplit( nParam1, nParam2 ); - maGrid.MoveSplit( nParam1, nParam2 ); + maRuler->MoveSplit( nParam1, nParam2 ); + maGrid->MoveSplit( nParam1, nParam2 ); break; case CSVCMD_REMOVEALLSPLITS: OSL_ENSURE( mbFixedMode, "ScCsvTableBox::CsvCmdHdl::RemoveAllSplits - invalid call" ); - maRuler.RemoveAllSplits(); - maGrid.RemoveAllSplits(); + maRuler->RemoveAllSplits(); + maGrid->RemoveAllSplits(); break; default: bFound = false; @@ -371,8 +386,8 @@ IMPL_LINK( ScCsvTableBox, CsvCmdHdl, ScCsvControl*, pCtrl ) if( maData != aOldData ) { DisableRepaint(); - maRuler.ApplyLayout( aOldData ); - maGrid.ApplyLayout( aOldData ); + maRuler->ApplyLayout( aOldData ); + maGrid->ApplyLayout( aOldData ); EnableRepaint(); } @@ -383,9 +398,9 @@ IMPL_LINK( ScCsvTableBox, ScrollHdl, ScrollBar*, pScrollBar ) { OSL_ENSURE( pScrollBar, "ScCsvTableBox::ScrollHdl - missing sender" ); - if( pScrollBar == &maHScroll ) + if( pScrollBar == maHScroll.get() ) Execute( CSVCMD_SETPOSOFFSET, pScrollBar->GetThumbPos() ); - else if( pScrollBar == &maVScroll ) + else if( pScrollBar == maVScroll.get() ) Execute( CSVCMD_SETLINEOFFSET, pScrollBar->GetThumbPos() ); return 0; @@ -395,12 +410,12 @@ IMPL_LINK( ScCsvTableBox, ScrollEndHdl, ScrollBar*, pScrollBar ) { OSL_ENSURE( pScrollBar, "ScCsvTableBox::ScrollEndHdl - missing sender" ); - if( pScrollBar == &maHScroll ) + if( pScrollBar == maHScroll.get() ) { if( GetRulerCursorPos() != CSV_POS_INVALID ) - Execute( CSVCMD_MOVERULERCURSOR, maRuler.GetNoScrollPos( GetRulerCursorPos() ) ); + Execute( CSVCMD_MOVERULERCURSOR, maRuler->GetNoScrollPos( GetRulerCursorPos() ) ); if( GetGridCursorPos() != CSV_POS_INVALID ) - Execute( CSVCMD_MOVEGRIDCURSOR, maGrid.GetNoScrollCol( GetGridCursorPos() ) ); + Execute( CSVCMD_MOVEGRIDCURSOR, maGrid->GetNoScrollCol( GetGridCursorPos() ) ); } return 0; diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx index 5cf72605ee55..dd39bf05d290 100644 --- a/sc/source/ui/dbgui/dapidata.cxx +++ b/sc/source/ui/dbgui/dapidata.cxx @@ -82,6 +82,19 @@ ScDataPilotDatabaseDlg::ScDataPilotDatabaseDlg( vcl::Window* pParent ) : m_pLbType->SetSelectHdl( LINK( this, ScDataPilotDatabaseDlg, SelectHdl ) ); } +ScDataPilotDatabaseDlg::~ScDataPilotDatabaseDlg() +{ + disposeOnce(); +} + +void ScDataPilotDatabaseDlg::dispose() +{ + m_pLbDatabase.clear(); + m_pCbObject.clear(); + m_pLbType.clear(); + ModalDialog::dispose(); +} + void ScDataPilotDatabaseDlg::GetValues( ScImportSourceDesc& rDesc ) { sal_uInt16 nSelect = m_pLbType->GetSelectEntryPos(); diff --git a/sc/source/ui/dbgui/dapitype.cxx b/sc/source/ui/dbgui/dapitype.cxx index f32ce2bf0ad1..35407ade36b8 100644 --- a/sc/source/ui/dbgui/dapitype.cxx +++ b/sc/source/ui/dbgui/dapitype.cxx @@ -53,6 +53,17 @@ ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg(vcl::Window* pParent, bool bE ScDataPilotSourceTypeDlg::~ScDataPilotSourceTypeDlg() { + disposeOnce(); +} + +void ScDataPilotSourceTypeDlg::dispose() +{ + m_pBtnSelection.clear(); + m_pBtnNamedRange.clear(); + m_pBtnDatabase.clear(); + m_pBtnExternal.clear(); + m_pLbNamedRange.clear(); + ModalDialog::dispose(); } bool ScDataPilotSourceTypeDlg::IsDatabase() const @@ -115,8 +126,20 @@ ScDataPilotServiceDlg::ScDataPilotServiceDlg( vcl::Window* pParent, ScDataPilotServiceDlg::~ScDataPilotServiceDlg() { + disposeOnce(); } +void ScDataPilotServiceDlg::dispose() +{ + m_pLbService.clear(); + m_pEdSource.clear(); + m_pEdName.clear(); + m_pEdUser.clear(); + m_pEdPasswd.clear(); + ModalDialog::dispose(); +} + + OUString ScDataPilotServiceDlg::GetServiceName() const { return m_pLbService->GetSelectEntry(); diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index fef3575368ba..7df39d8335b2 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -158,7 +158,28 @@ ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pPar ScDbNameDlg::~ScDbNameDlg() { + disposeOnce(); +} + +void ScDbNameDlg::dispose() +{ DELETEZ( pSaveObj ); + m_pEdName.clear(); + m_pAssignFrame.clear(); + m_pEdAssign.clear(); + m_pRbAssign.clear(); + m_pOptions.clear(); + m_pBtnHeader.clear(); + m_pBtnDoSize.clear(); + m_pBtnKeepFmt.clear(); + m_pBtnStripData.clear(); + m_pFTSource.clear(); + m_pFTOperations.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + m_pBtnAdd.clear(); + m_pBtnRemove.clear(); + ScAnyRefDlg::dispose(); } void ScDbNameDlg::Init() @@ -498,9 +519,9 @@ IMPL_LINK_NOARG(ScDbNameDlg, RemoveBtnHdl) aBuf.append(aStrDelMsg.getToken(0, '#')); aBuf.append(aStrEntry); aBuf.append(aStrDelMsg.getToken(1, '#')); - QueryBox aBox(this, WinBits(WB_YES_NO|WB_DEF_YES), aBuf.makeStringAndClear()); + ScopedVclPtrInstance< QueryBox > aBox(this, WinBits(WB_YES_NO|WB_DEF_YES), aBuf.makeStringAndClear()); - if (RET_YES == aBox.Execute()) + if (RET_YES == aBox->Execute()) { SCTAB nTab; SCCOL nColStart, nColEnd; diff --git a/sc/source/ui/dbgui/dpgroupdlg.cxx b/sc/source/ui/dbgui/dpgroupdlg.cxx index 17493333b5fb..7bbb0fd80985 100644 --- a/sc/source/ui/dbgui/dpgroupdlg.cxx +++ b/sc/source/ui/dbgui/dpgroupdlg.cxx @@ -173,6 +173,24 @@ ScDPNumGroupDlg::ScDPNumGroupDlg( vcl::Window* pParent, const ScDPNumGroupInfo& mpEdBy->GrabFocus(); } +ScDPNumGroupDlg::~ScDPNumGroupDlg() +{ + disposeOnce(); +} + +void ScDPNumGroupDlg::dispose() +{ + mpRbAutoStart.clear(); + mpRbManStart.clear(); + mpEdStart.clear(); + mpRbAutoEnd.clear(); + mpRbManEnd.clear(); + mpEdEnd.clear(); + mpEdBy.clear(); + ModalDialog::dispose(); +} + + ScDPNumGroupInfo ScDPNumGroupDlg::GetGroupInfo() const { ScDPNumGroupInfo aInfo; @@ -259,6 +277,27 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( vcl::Window* pParent, mpLbUnits->SetCheckButtonHdl( LINK( this, ScDPDateGroupDlg, CheckHdl ) ); } +ScDPDateGroupDlg::~ScDPDateGroupDlg() +{ + disposeOnce(); +} + +void ScDPDateGroupDlg::dispose() +{ + mpRbAutoStart.clear(); + mpRbManStart.clear(); + mpEdStart.clear(); + mpRbAutoEnd.clear(); + mpRbManEnd.clear(); + mpEdEnd.clear(); + mpRbNumDays.clear(); + mpRbUnits.clear(); + mpEdNumDays.clear(); + mpLbUnits.clear(); + mpBtnOk.clear(); + ModalDialog::dispose(); +} + ScDPNumGroupInfo ScDPDateGroupDlg::GetGroupInfo() const { ScDPNumGroupInfo aInfo; diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 5de6d53668fd..e3584d570015 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -160,12 +160,50 @@ ScFilterDlg::ScFilterDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pPar ScFilterDlg::~ScFilterDlg() { + disposeOnce(); +} + +void ScFilterDlg::dispose() +{ delete pOptionsMgr; delete pOutItem; // Hack: RefInput control pTimer->Stop(); delete pTimer; + + pLbConnect1.clear(); + pLbField1.clear(); + pLbCond1.clear(); + pEdVal1.clear(); + pLbConnect2.clear(); + pLbField2.clear(); + pLbCond2.clear(); + pEdVal2.clear(); + pLbConnect3.clear(); + pLbField3.clear(); + pLbCond3.clear(); + pEdVal3.clear(); + pLbConnect4.clear(); + pLbField4.clear(); + pLbCond4.clear(); + pEdVal4.clear(); + pScrollBar.clear(); + pExpander.clear(); + pBtnOk.clear(); + pBtnCancel.clear(); + pBtnCase.clear(); + pBtnRegExp.clear(); + pBtnHeader.clear(); + pBtnUnique.clear(); + pBtnCopyResult.clear(); + pLbCopyArea.clear(); + pEdCopyArea.clear(); + pRbCopyArea.clear(); + pBtnDestPers.clear(); + pFtDbAreaLabel.clear(); + pFtDbArea.clear(); + ScAnyRefDlg::dispose(); } void ScFilterDlg::Init( const SfxItemSet& rArgSet ) diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index 096c9c2e17dd..18f2072731e2 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -83,10 +83,34 @@ ScPivotFilterDlg::ScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgS ScPivotFilterDlg::~ScPivotFilterDlg() { + disposeOnce(); +} + +void ScPivotFilterDlg::dispose() +{ for (sal_uInt16 i=0; i<=MAXCOL; i++) delete pEntryLists[i]; delete pOutItem; + m_pLbField1.clear(); + m_pLbCond1.clear(); + m_pEdVal1.clear(); + m_pLbConnect1.clear(); + m_pLbField2.clear(); + m_pLbCond2.clear(); + m_pEdVal2.clear(); + m_pLbConnect2.clear(); + m_pLbField3.clear(); + m_pLbCond3.clear(); + m_pEdVal3.clear(); + m_pBtnCase.clear(); + m_pBtnRegExp.clear(); + m_pBtnUnique.clear(); + m_pFtDbArea.clear(); + for (auto a : aValueEdArr) a.clear(); + for (auto a : aFieldLbArr) a.clear(); + for (auto a : aCondLbArr) a.clear(); + ModalDialog::dispose(); } void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index 3f55a4be76d9..4cc9de6ed1b0 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -214,6 +214,25 @@ ScDPFunctionDlg::ScDPFunctionDlg( Init( rLabelData, rFuncData ); } +ScDPFunctionDlg::~ScDPFunctionDlg() +{ + disposeOnce(); +} + +void ScDPFunctionDlg::dispose() +{ + mpLbFunc.clear(); + mpFtName.clear(); + mpLbType.clear(); + mpFtBaseField.clear(); + mpLbBaseField.clear(); + mpFtBaseItem.clear(); + mpLbBaseItem.clear(); + mpBtnOk.clear(); + ModalDialog::dispose(); +} + + sal_uInt16 ScDPFunctionDlg::GetFuncMask() const { return mpLbFunc->GetSelection(); @@ -431,6 +450,24 @@ ScDPSubtotalDlg::ScDPSubtotalDlg( vcl::Window* pParent, ScDPObject& rDPObj, Init( rLabelData, rFuncData ); } +ScDPSubtotalDlg::~ScDPSubtotalDlg() +{ + disposeOnce(); +} + +void ScDPSubtotalDlg::dispose() +{ + mpRbNone.clear(); + mpRbAuto.clear(); + mpRbUser.clear(); + mpLbFunc.clear(); + mpFtName.clear(); + mpCbShowAll.clear(); + mpBtnOk.clear(); + mpBtnOptions.clear(); + ModalDialog::dispose(); +} + sal_uInt16 ScDPSubtotalDlg::GetFuncMask() const { sal_uInt16 nFuncMask = PIVOT_FUNC_NONE; @@ -502,7 +539,7 @@ IMPL_LINK( ScDPSubtotalDlg, ClickHdl, PushButton*, pBtn ) { if (pBtn == mpBtnOptions) { - boost::scoped_ptr<ScDPSubtotalOptDlg> pDlg(new ScDPSubtotalOptDlg( this, mrDPObj, maLabelData, mrDataFields, mbEnableLayout )); + VclPtrInstance< ScDPSubtotalOptDlg > pDlg( this, mrDPObj, maLabelData, mrDataFields, mbEnableLayout ); if( pDlg->Execute() == RET_OK ) pDlg->FillLabelData( maLabelData ); } @@ -545,6 +582,35 @@ ScDPSubtotalOptDlg::ScDPSubtotalOptDlg( vcl::Window* pParent, ScDPObject& rDPObj Init( rDataFields, bEnableLayout ); } +ScDPSubtotalOptDlg::~ScDPSubtotalOptDlg() +{ + disposeOnce(); +} + +void ScDPSubtotalOptDlg::dispose() +{ + m_pLbSortBy.clear(); + m_pRbSortAsc.clear(); + m_pRbSortDesc.clear(); + m_pRbSortMan.clear(); + m_pLayoutFrame.clear(); + m_pLbLayout.clear(); + m_pCbLayoutEmpty.clear(); + m_pCbRepeatItemLabels.clear(); + m_pCbShow.clear(); + m_pNfShow.clear(); + m_pFtShow.clear(); + m_pFtShowFrom.clear(); + m_pLbShowFrom.clear(); + m_pFtShowUsing.clear(); + m_pLbShowUsing.clear(); + m_pHideFrame.clear(); + m_pLbHide.clear(); + m_pFtHierarchy.clear(); + m_pLbHierarchy.clear(); + ModalDialog::dispose(); +} + void ScDPSubtotalOptDlg::FillLabelData( ScDPLabelData& rLabelData ) const { // *** SORTING *** @@ -798,6 +864,18 @@ ScDPShowDetailDlg::ScDPShowDetailDlg( vcl::Window* pParent, ScDPObject& rDPObj, mpLbDims->SetDoubleClickHdl( LINK( this, ScDPShowDetailDlg, DblClickHdl ) ); } +ScDPShowDetailDlg::~ScDPShowDetailDlg() +{ + disposeOnce(); +} + +void ScDPShowDetailDlg::dispose() +{ + mpLbDims.clear(); + mpBtnOk.clear(); + ModalDialog::dispose(); +} + short ScDPShowDetailDlg::Execute() { return mpLbDims->GetEntryCount() ? ModalDialog::Execute() : static_cast<short>(RET_CANCEL); diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx index cd2b3a750fde..bbe8b6c4e5e5 100644 --- a/sc/source/ui/dbgui/scendlg.cxx +++ b/sc/source/ui/dbgui/scendlg.cxx @@ -108,6 +108,24 @@ ScNewScenarioDlg::ScNewScenarioDlg( vcl::Window* pParent, const OUString& rName, m_pCbProtect->Enable(false); } +ScNewScenarioDlg::~ScNewScenarioDlg() +{ + disposeOnce(); +} + +void ScNewScenarioDlg::dispose() +{ + m_pEdName.clear(); + m_pEdComment.clear(); + m_pCbShowFrame.clear(); + m_pLbColor.clear(); + m_pCbTwoWay.clear(); + m_pCbCopyAll.clear(); + m_pCbProtect.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); +} + void ScNewScenarioDlg::GetScenarioData( OUString& rName, OUString& rComment, Color& rColor, sal_uInt16& rFlags ) const { diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index a3b73879b266..1ac8ca860e35 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -464,7 +464,35 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa ScImportAsciiDlg::~ScImportAsciiDlg() { + disposeOnce(); +} + +void ScImportAsciiDlg::dispose() +{ delete[] mpRowPosArray; + pFtCharSet.clear(); + pLbCharSet.clear(); + pFtCustomLang.clear(); + pLbCustomLang.clear(); + pFtRow.clear(); + pNfRow.clear(); + pRbFixed.clear(); + pRbSeparated.clear(); + pCkbTab.clear(); + pCkbSemicolon.clear(); + pCkbComma.clear(); + pCkbSpace.clear(); + pCkbOther.clear(); + pEdOther.clear(); + pCkbAsOnce.clear(); + pFtTextSep.clear(); + pCbTextSep.clear(); + pCkbQuotedAsText.clear(); + pCkbDetectNumber.clear(); + pFtType.clear(); + pLbType.clear(); + mpTableBox.clear(); + ModalDialog::dispose(); } bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText ) diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 4079b60c39cc..a1c1e487b530 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -239,8 +239,26 @@ ScImportOptionsDlg::ScImportOptionsDlg( ScImportOptionsDlg::~ScImportOptionsDlg() { + disposeOnce(); +} + +void ScImportOptionsDlg::dispose() +{ delete pFieldSepTab; delete pTextSepTab; + m_pFieldFrame.clear(); + m_pFtCharset.clear(); + m_pLbCharset.clear(); + m_pFtFieldSep.clear(); + m_pEdFieldSep.clear(); + m_pFtTextSep.clear(); + m_pEdTextSep.clear(); + m_pCbShown.clear(); + m_pCbFormulas.clear(); + m_pCbQuoteAll.clear(); + m_pCbFixed.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); } void ScImportOptionsDlg::GetImportOptions( ScImportOptions& rOptions ) const diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 380278b8c8b8..028963d76556 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -97,6 +97,11 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc ScSpecialFilterDlg::~ScSpecialFilterDlg() { + disposeOnce(); +} + +void ScSpecialFilterDlg::dispose() +{ sal_uInt16 nEntries = pLbFilterArea->GetEntryCount(); sal_uInt16 i; @@ -111,6 +116,26 @@ ScSpecialFilterDlg::~ScSpecialFilterDlg() // Hack: RefInput-Kontrolle pIdle->Stop(); delete pIdle; + + pLbFilterArea.clear(); + pEdFilterArea.clear(); + pRbFilterArea.clear(); + pExpander.clear(); + pBtnCase.clear(); + pBtnRegExp.clear(); + pBtnHeader.clear(); + pBtnUnique.clear(); + pBtnCopyResult.clear(); + pLbCopyArea.clear(); + pEdCopyArea.clear(); + pRbCopyArea.clear(); + pBtnDestPers.clear(); + pFtDbAreaLabel.clear(); + pFtDbArea.clear(); + pBtnOk.clear(); + pBtnCancel.clear(); + pRefInputEdit.clear(); + ScAnyRefDlg::dispose(); } void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx index 97c6b98641c8..4702a0615c0a 100644 --- a/sc/source/ui/dbgui/sortdlg.cxx +++ b/sc/source/ui/dbgui/sortdlg.cxx @@ -50,6 +50,19 @@ ScSortWarningDlg::ScSortWarningDlg(vcl::Window* pParent, aBtnCurSort->SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) ); } +ScSortWarningDlg::~ScSortWarningDlg() +{ + disposeOnce(); +} + +void ScSortWarningDlg::dispose() +{ + aFtText.clear(); + aBtnExtSort.clear(); + aBtnCurSort.clear(); + ModalDialog::dispose(); +} + IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn ) { if ( pBtn == aBtnExtSort ) diff --git a/sc/source/ui/dbgui/subtdlg.cxx b/sc/source/ui/dbgui/subtdlg.cxx index c4a718a9e6d7..45132c0b02ff 100644 --- a/sc/source/ui/dbgui/subtdlg.cxx +++ b/sc/source/ui/dbgui/subtdlg.cxx @@ -36,6 +36,17 @@ ScSubTotalDlg::ScSubTotalDlg(vcl::Window* pParent, const SfxItemSet* pArgSet) m_pBtnRemove->SetClickHdl( LINK( this, ScSubTotalDlg, RemoveHdl ) ); } +ScSubTotalDlg::~ScSubTotalDlg() +{ + disposeOnce(); +} + +void ScSubTotalDlg::dispose() +{ + m_pBtnRemove.clear(); + SfxTabDialog::dispose(); +} + IMPL_LINK_INLINE_START( ScSubTotalDlg, RemoveHdl, PushButton *, pBtn ) { if (pBtn == m_pBtnRemove) diff --git a/sc/source/ui/dbgui/textimportoptions.cxx b/sc/source/ui/dbgui/textimportoptions.cxx index fb1b34945c14..6ec64bf36506 100644 --- a/sc/source/ui/dbgui/textimportoptions.cxx +++ b/sc/source/ui/dbgui/textimportoptions.cxx @@ -38,8 +38,20 @@ ScTextImportOptionsDlg::ScTextImportOptionsDlg(vcl::Window* pParent) ScTextImportOptionsDlg::~ScTextImportOptionsDlg() { + disposeOnce(); } +void ScTextImportOptionsDlg::dispose() +{ + m_pBtnOk.clear(); + m_pRbAutomatic.clear(); + m_pRbCustom.clear(); + m_pLbCustomLang.clear(); + m_pBtnConvertDate.clear(); + ModalDialog::dispose(); +} + + short ScTextImportOptionsDlg::Execute() { return ModalDialog::Execute(); diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index c1a0770a51fd..210f60468d98 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -93,6 +93,17 @@ ScTabPageSortFields::ScTabPageSortFields(vcl::Window* pParent, SetExchangeSupport(); } +ScTabPageSortFields::~ScTabPageSortFields() +{ + disposeOnce(); +} + +void ScTabPageSortFields::dispose() +{ + pDlg.clear(); + SfxTabPage::dispose(); +} + void ScTabPageSortFields::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) { SfxTabPage::SetPosSizePixel(rAllocPos, rAllocation); @@ -111,10 +122,6 @@ void ScTabPageSortFields::SetPosPixel(const Point& rAllocPos) maSortKeyCtrl.setScrollRange(); } -ScTabPageSortFields::~ScTabPageSortFields() -{ -} - void ScTabPageSortFields::Init() { const ScSortItem& rSortItem = static_cast<const ScSortItem&>( @@ -135,10 +142,10 @@ void ScTabPageSortFields::Init() } } -SfxTabPage* ScTabPageSortFields::Create( vcl::Window* pParent, - const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTabPageSortFields::Create( vcl::Window* pParent, + const SfxItemSet* rArgSet ) { - return ( new ScTabPageSortFields( pParent, *rArgSet ) ); + return VclPtr<ScTabPageSortFields>::Create( pParent, *rArgSet ); } void ScTabPageSortFields::Reset( const SfxItemSet* /* rArgSet */ ) @@ -516,6 +523,11 @@ ScTabPageSortOptions::ScTabPageSortOptions( vcl::Window* pParent, ScTabPageSortOptions::~ScTabPageSortOptions() { + disposeOnce(); +} + +void ScTabPageSortOptions::dispose() +{ sal_uInt16 nEntries = m_pLbOutPos->GetEntryCount(); for ( sal_uInt16 i=1; i<nEntries; i++ ) @@ -523,6 +535,22 @@ ScTabPageSortOptions::~ScTabPageSortOptions() delete pColRes; delete pColWrap; //! not if from document + m_pBtnCase.clear(); + m_pBtnHeader.clear(); + m_pBtnFormats.clear(); + m_pBtnNaturalSort.clear(); + m_pBtnCopyResult.clear(); + m_pLbOutPos.clear(); + m_pEdOutPos.clear(); + m_pBtnSortUser.clear(); + m_pLbSortUser.clear(); + m_pLbLanguage.clear(); + m_pFtAlgorithm.clear(); + m_pLbAlgorithm.clear(); + m_pBtnTopDown.clear(); + m_pBtnLeftRight.clear(); + pDlg.clear(); + SfxTabPage::dispose(); } void ScTabPageSortOptions::Init() @@ -607,11 +635,10 @@ void ScTabPageSortOptions::Init() m_pLbLanguage->InsertLanguage( LANGUAGE_SYSTEM ); } -SfxTabPage* ScTabPageSortOptions::Create( - vcl::Window* pParent, - const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTabPageSortOptions::Create( vcl::Window* pParent, + const SfxItemSet* rArgSet ) { - return ( new ScTabPageSortOptions( pParent, *rArgSet ) ); + return VclPtr<ScTabPageSortOptions>::Create( pParent, *rArgSet ); } void ScTabPageSortOptions::Reset( const SfxItemSet* /* rArgSet */ ) diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index f76265dbf9b0..c41bbc1a07ca 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -67,6 +67,11 @@ ScTpSubTotalGroup::ScTpSubTotalGroup( vcl::Window* pParent, ScTpSubTotalGroup::~ScTpSubTotalGroup() { + disposeOnce(); +} + +void ScTpSubTotalGroup::dispose() +{ sal_uLong nCount = mpLbColumns->GetEntryCount(); if ( nCount > 0 ) @@ -79,6 +84,10 @@ ScTpSubTotalGroup::~ScTpSubTotalGroup() delete pData; } } + mpLbGroup.clear(); + mpLbColumns.clear(); + mpLbFunctions.clear(); + SfxTabPage::dispose(); } void ScTpSubTotalGroup::Init() @@ -376,17 +385,17 @@ IMPL_LINK( ScTpSubTotalGroup, CheckHdl, void *, pLb ) // Derived Group TabPages: -SfxTabPage* ScTpSubTotalGroup1::Create( vcl::Window* pParent, +VclPtr<SfxTabPage> ScTpSubTotalGroup1::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) - { return ( new ScTpSubTotalGroup1( pParent, *rArgSet ) ); } + { return VclPtr<SfxTabPage>( new ScTpSubTotalGroup1( pParent, *rArgSet ), SAL_NO_ACQUIRE ); } -SfxTabPage* ScTpSubTotalGroup2::Create( vcl::Window* pParent, +VclPtr<SfxTabPage> ScTpSubTotalGroup2::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) - { return ( new ScTpSubTotalGroup2( pParent, *rArgSet ) ); } + { return VclPtr<SfxTabPage>( new ScTpSubTotalGroup2( pParent, *rArgSet ), SAL_NO_ACQUIRE ); } -SfxTabPage* ScTpSubTotalGroup3::Create( vcl::Window* pParent, +VclPtr<SfxTabPage> ScTpSubTotalGroup3::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) - { return ( new ScTpSubTotalGroup3( pParent, *rArgSet ) ); } + { return VclPtr<SfxTabPage>( new ScTpSubTotalGroup3( pParent, *rArgSet ), SAL_NO_ACQUIRE ); } ScTpSubTotalGroup1::ScTpSubTotalGroup1( vcl::Window* pParent, const SfxItemSet& rArgSet ) : ScTpSubTotalGroup( pParent, rArgSet ) @@ -442,6 +451,21 @@ ScTpSubTotalOptions::ScTpSubTotalOptions( vcl::Window* pParent, ScTpSubTotalOptions::~ScTpSubTotalOptions() { + disposeOnce(); +} + +void ScTpSubTotalOptions::dispose() +{ + pBtnPagebreak.clear(); + pBtnCase.clear(); + pBtnSort.clear(); + pFlSort.clear(); + pBtnAscending.clear(); + pBtnDescending.clear(); + pBtnFormats.clear(); + pBtnUserDef.clear(); + pLbUserDef.clear(); + SfxTabPage::dispose(); } void ScTpSubTotalOptions::Init() @@ -460,10 +484,10 @@ void ScTpSubTotalOptions::Init() FillUserSortListBox(); } -SfxTabPage* ScTpSubTotalOptions::Create( vcl::Window* pParent, - const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTpSubTotalOptions::Create( vcl::Window* pParent, + const SfxItemSet* rArgSet ) { - return ( new ScTpSubTotalOptions( pParent, *rArgSet ) ); + return VclPtr<SfxTabPage>( new ScTpSubTotalOptions( pParent, *rArgSet ), SAL_NO_ACQUIRE ); } void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ ) diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index af21095d6c1e..7952949c3b67 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -168,6 +168,17 @@ void ScTPValidationValue::RefInputDonePostHdl() m_pRefEdit->GrabFocus(); } +ScTPValidationValue::ScRefButtonEx::~ScRefButtonEx() +{ + disposeOnce(); +} + +void ScTPValidationValue::ScRefButtonEx::dispose() +{ + m_pPage.clear(); + ::formula::RefButton::dispose(); +} + namespace { /** Converts the passed ScValidationMode to the position in the list box. */ @@ -346,6 +357,33 @@ ScTPValidationValue::ScTPValidationValue( vcl::Window* pParent, const SfxItemSet m_pBtnRef->Hide(); // cell range picker } +ScTPValidationValue::~ScTPValidationValue() +{ + disposeOnce(); +} + +void ScTPValidationValue::dispose() +{ + m_pLbAllow.clear(); + m_pCbAllow.clear(); + m_pCbShow.clear(); + m_pCbSort.clear(); + m_pFtValue.clear(); + m_pLbValue.clear(); + m_pFtMin.clear(); + m_pMinGrid.clear(); + m_pEdMin.clear(); + m_pEdList.clear(); + m_pFtMax.clear(); + m_pEdMax.clear(); + m_pFtHint.clear(); + m_pRefEdit.clear(); + m_pBtnRef.clear(); + m_pRefGrid.clear(); + SfxTabPage::dispose(); +} + + void ScTPValidationValue::Init() { m_pLbAllow->SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) ); @@ -366,9 +404,9 @@ void ScTPValidationValue::Init() CheckHdl( NULL ); } -SfxTabPage* ScTPValidationValue::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTPValidationValue::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) { - return( new ScTPValidationValue( pParent, *rArgSet ) ); + return VclPtr<SfxTabPage>(new ScTPValidationValue( pParent, *rArgSet ), SAL_NO_ACQUIRE); } void ScTPValidationValue::Reset( const SfxItemSet* rArgSet ) @@ -649,6 +687,15 @@ ScTPValidationHelp::ScTPValidationHelp( vcl::Window* pParent, ScTPValidationHelp::~ScTPValidationHelp() { + disposeOnce(); +} + +void ScTPValidationHelp::dispose() +{ + pTsbHelp.clear(); + pEdtTitle.clear(); + pEdInputHelp.clear(); + SfxTabPage::dispose(); } void ScTPValidationHelp::Init() @@ -656,10 +703,10 @@ void ScTPValidationHelp::Init() pTsbHelp->EnableTriState( false ); } -SfxTabPage* ScTPValidationHelp::Create( vcl::Window* pParent, - const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTPValidationHelp::Create( vcl::Window* pParent, + const SfxItemSet* rArgSet ) { - return ( new ScTPValidationHelp( pParent, *rArgSet ) ); + return VclPtr<ScTPValidationHelp>::Create( pParent, *rArgSet ); } void ScTPValidationHelp::Reset( const SfxItemSet* rArgSet ) @@ -713,6 +760,18 @@ ScTPValidationError::ScTPValidationError( vcl::Window* pParent, ScTPValidationError::~ScTPValidationError() { + disposeOnce(); +} + +void ScTPValidationError::dispose() +{ + m_pTsbShow.clear(); + m_pLbAction.clear(); + m_pBtnSearch.clear(); + m_pEdtTitle.clear(); + m_pFtError.clear(); + m_pEdError.clear(); + SfxTabPage::dispose(); } void ScTPValidationError::Init() @@ -726,10 +785,10 @@ void ScTPValidationError::Init() SelectActionHdl( NULL ); } -SfxTabPage* ScTPValidationError::Create( vcl::Window* pParent, - const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTPValidationError::Create( vcl::Window* pParent, + const SfxItemSet* rArgSet ) { - return ( new ScTPValidationError( pParent, *rArgSet ) ); + return VclPtr<ScTPValidationError>::Create( pParent, *rArgSet ); } void ScTPValidationError::Reset( const SfxItemSet* rArgSet ) |