diff options
Diffstat (limited to 'sc/source/ui/miscdlgs')
33 files changed, 701 insertions, 119 deletions
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 76363796d8de..ac1b5a4bb012 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -111,7 +111,7 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window bHasFilterEntry(false), bUseColor(false) { - m_pAcceptChgCtr = new SvxAcceptChgCtr(get_content_area(), this); + m_pAcceptChgCtr = VclPtr<SvxAcceptChgCtr>::Create(get_content_area(), this); nAcceptCount=0; nRejectCount=0; aReOpenIdle.SetPriority(SchedulerPriority::MEDIUM); @@ -154,6 +154,11 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window ScAcceptChgDlg::~ScAcceptChgDlg() { + disposeOnce(); +} + +void ScAcceptChgDlg::dispose() +{ ClearView(); ScChangeTrack* pChanges=pDoc->GetChangeTrack(); @@ -163,7 +168,11 @@ ScAcceptChgDlg::~ScAcceptChgDlg() pChanges->SetModifiedLink(aLink); } - delete m_pAcceptChgCtr; + m_pAcceptChgCtr.disposeAndClear(); + pTPFilter.clear(); + pTPView.clear(); + pTheView.clear(); + SfxModelessDialog::dispose(); } void ScAcceptChgDlg::ReInit(ScViewData* ptrViewData) diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index fc0d82c909b7..d2084b4b79e6 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -344,8 +344,6 @@ IMPL_LINK( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator *, pSelAccel ) return long(true); } -typedef std::vector<vcl::Window*> winvec; - void ScFormulaReferenceHelper::RefInputDone( bool bForced ) { if ( CanInputDone( bForced ) ) @@ -394,7 +392,7 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced ) pRefBtn->SetStartImage(); // All others: Show(); - for (winvec::iterator aI = m_aHiddenWidgets.begin(); aI != m_aHiddenWidgets.end(); ++aI) + for (auto aI = m_aHiddenWidgets.begin(); aI != m_aHiddenWidgets.end(); ++aI) { vcl::Window *pWindow = *aI; pWindow->Show(); @@ -416,12 +414,12 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced ) } } -typedef std::set<vcl::Window*> winset; +typedef std::set<VclPtr<vcl::Window> > winset; namespace { void hideUnless(vcl::Window *pTop, const winset& rVisibleWidgets, - winvec &rWasVisibleWidgets) + std::vector<VclPtr<vcl::Window> > &rWasVisibleWidgets) { for (vcl::Window* pChild = pTop->GetWindow(WINDOW_FIRSTCHILD); pChild; pChild = pChild->GetWindow(WINDOW_NEXT)) @@ -759,14 +757,14 @@ static void lcl_HideAllReferences() // class ScRefHandler ScRefHandler::ScRefHandler( vcl::Window &rWindow, SfxBindings* pB, bool bBindRef ): - m_rWindow( rWindow ), + m_rWindow( &rWindow ), m_bInRefMode( false ), m_aHelper(this,pB), pMyBindings( pB ), pActiveWin(NULL) { - m_aHelper.SetWindow(&m_rWindow); - reverseUniqueHelpIdHack(m_rWindow); + m_aHelper.SetWindow(m_rWindow.get()); + reverseUniqueHelpIdHack(*m_rWindow.get()); aIdle.SetPriority(SchedulerPriority::LOWER); aIdle.SetIdleHdl(LINK( this, ScRefHandler, UpdateFocusHdl)); @@ -889,7 +887,7 @@ bool ScRefHandler::IsDocAllowed(SfxObjectShell* pDocSh) const // pDocSh may be bool ScRefHandler::IsRefInputMode() const { - return m_rWindow.IsVisible(); // references can only be input to visible windows + return m_rWindow->IsVisible(); // references can only be input to visible windows } bool ScRefHandler::DoClose( sal_uInt16 nId ) @@ -951,7 +949,7 @@ void ScRefHandler::stateChanged(const StateChangedType nStateChange, const bool if(nStateChange == StateChangedType::VISIBLE) { - if(m_rWindow.IsVisible()) + if(m_rWindow->IsVisible()) { ScFormulaReferenceHelper::enableInput( false ); m_aHelper.EnableSpreadsheets(); diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index ffd54c8547c8..f07d19594cde 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -58,7 +58,7 @@ ScAutoFmtPreview::ScAutoFmtPreview(vcl::Window* pParent) : Window(pParent) , pCurData(NULL) , aVD(*this) - , aScriptedText(aVD) + , aScriptedText(*aVD.get()) , bFitWidth(false) , mbRTL(false) , aStrJan(ScResId(STR_JAN)) @@ -90,7 +90,13 @@ void ScAutoFmtPreview::Resize() ScAutoFmtPreview::~ScAutoFmtPreview() { + disposeOnce(); +} + +void ScAutoFmtPreview::dispose() +{ delete pNumFmt; + vcl::Window::dispose(); } static void lcl_SetFontProperties( @@ -376,11 +382,11 @@ void ScAutoFmtPreview::DrawBackground() const SvxBrushItem* pItem = static_cast< const SvxBrushItem* >( pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND ) ); - aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); - aVD.SetLineColor(); - aVD.SetFillColor( pItem->GetColor() ); - aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) ); - aVD.Pop(); + aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); + aVD->SetLineColor(); + aVD->SetFillColor( pItem->GetColor() ); + aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) ); + aVD->Pop(); } } } @@ -399,7 +405,7 @@ void ScAutoFmtPreview::PaintCells() // 3) border if ( pCurData->GetIncludeFrame() ) - maArray.DrawArray( aVD ); + maArray.DrawArray( *aVD.get() ); } } @@ -484,20 +490,20 @@ void ScAutoFmtPreview::NotifyChange( ScAutoFormatData* pNewData ) void ScAutoFmtPreview::DoPaint( const Rectangle& /* rRect */ ) { - sal_uInt32 nOldDrawMode = aVD.GetDrawMode(); + sal_uInt32 nOldDrawMode = aVD->GetDrawMode(); Size aWndSize( GetSizePixel() ); - vcl::Font aFont( aVD.GetFont() ); + vcl::Font aFont( aVD->GetFont() ); Color aBackCol( GetSettings().GetStyleSettings().GetWindowColor() ); Point aTmpPoint; Rectangle aRect( aTmpPoint, aWndSize ); aFont.SetTransparent( true ); - aVD.SetFont( aFont ); - aVD.SetLineColor(); - aVD.SetFillColor( aBackCol ); - aVD.SetOutputSize( aWndSize ); - aVD.DrawRect( aRect ); + aVD->SetFont( aFont ); + aVD->SetLineColor(); + aVD->SetFillColor( aBackCol ); + aVD->SetOutputSize( aWndSize ); + aVD->DrawRect( aRect ); PaintCells(); SetLineColor(); @@ -507,9 +513,9 @@ void ScAutoFmtPreview::DoPaint( const Rectangle& /* rRect */ ) Point aPos( (aWndSize.Width() - aPrvSize.Width()) / 2, (aWndSize.Height() - aPrvSize.Height()) / 2 ); if (AllSettings::GetLayoutRTL()) aPos.X() = -aPos.X(); - DrawOutDev( aPos, aWndSize, Point(), aWndSize, aVD ); + DrawOutDev( aPos, aWndSize, Point(), aWndSize, *aVD.get() ); - aVD.SetDrawMode( nOldDrawMode ); + aVD->SetDrawMode( nOldDrawMode ); } void ScAutoFmtPreview::Paint( const Rectangle& rRect ) diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index db83be927871..9c0b55637cb6 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -374,7 +374,7 @@ void ScConflictsResolver::HandleAction( ScChangeAction* pAction, bool bIsSharedA ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList ) :ModalDialog( pParent, "ConflictsDialog", "modules/scalc/ui/conflictsdialog.ui" ) ,m_pLbConflictsContainer ( get<SvSimpleTableContainer>("container") ) - ,m_pLbConflicts ( new SvxRedlinTable(*m_pLbConflictsContainer) ) + ,m_pLbConflicts ( VclPtr<SvxRedlinTable>::Create(*m_pLbConflictsContainer) ) ,maStrTitleConflict ( ScResId( STR_TITLE_CONFLICT ) ) ,maStrTitleAuthor ( ScResId( STR_TITLE_AUTHOR ) ) ,maStrTitleDate ( ScResId( STR_TITLE_DATE ) ) @@ -442,6 +442,18 @@ ScConflictsDlg::ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScD ScConflictsDlg::~ScConflictsDlg() { + disposeOnce(); +} + +void ScConflictsDlg::dispose() +{ + m_pLbConflictsContainer.clear(); + m_pLbConflicts.disposeAndClear(); + m_pBtnKeepMine.clear(); + m_pBtnKeepOther.clear(); + m_pBtnKeepAllMine.clear(); + m_pBtnKeepAllOthers.clear(); + ModalDialog::dispose(); } OUString ScConflictsDlg::GetConflictString( const ScConflictsListEntry& rConflictEntry ) diff --git a/sc/source/ui/miscdlgs/crdlg.cxx b/sc/source/ui/miscdlgs/crdlg.cxx index 5d5e833ca768..497a76ecfa8a 100644 --- a/sc/source/ui/miscdlgs/crdlg.cxx +++ b/sc/source/ui/miscdlgs/crdlg.cxx @@ -44,6 +44,21 @@ ScColOrRowDlg::ScColOrRowDlg(vcl::Window* pParent, const OUString& rStrTitle, m_pBtnOk->SetClickHdl( LINK( this, ScColOrRowDlg, OkHdl ) ); } +ScColOrRowDlg::~ScColOrRowDlg() +{ + disposeOnce(); +} + +void ScColOrRowDlg::dispose() +{ + m_pFrame.clear(); + m_pBtnRows.clear(); + m_pBtnCols.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); +} + + IMPL_LINK_NOARG_INLINE_START(ScColOrRowDlg, OkHdl) { EndDialog( m_pBtnCols->IsChecked() ? SCRET_COLS : SCRET_ROWS ); diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 6510dc13290e..c2195145d446 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -74,6 +74,24 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB, ScColRowNameRangesDlg::~ScColRowNameRangesDlg() { + disposeOnce(); +} + +void ScColRowNameRangesDlg::dispose() +{ + pLbRange.clear(); + pEdAssign.clear(); + pRbAssign.clear(); + pBtnColHead.clear(); + pBtnRowHead.clear(); + pEdAssign2.clear(); + pRbAssign2.clear(); + pBtnOk.clear(); + pBtnCancel.clear(); + pBtnAdd.clear(); + pBtnRemove.clear(); + pEdActive.clear(); + ScAnyRefDlg::dispose(); } // initialises event handlers and start parameters in the dialog @@ -475,7 +493,7 @@ void ScColRowNameRangesDlg::UpdateRangeData( const ScRange& rRange, bool bColNam bool ScColRowNameRangesDlg::IsRefInputMode() const { - return (pEdActive != NULL); + return (pEdActive != nullptr); } // Handler: diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx index 0d3f58d4fda0..5b1d6c8f2d6f 100644 --- a/sc/source/ui/miscdlgs/datafdlg.cxx +++ b/sc/source/ui/miscdlgs/datafdlg.cxx @@ -154,30 +154,30 @@ ScDataFormDlg::ScDataFormDlg(vcl::Window* pParent, ScTabViewShell* pTabViewShell int nColWidth = pDoc->GetColWidth( nIndex + nStartCol, nTab ); if (nColWidth) { - maFixedTexts.push_back( new FixedText(m_pGrid) ); - maEdits.push_back( new Edit(m_pGrid, WB_BORDER) ); + maFixedTexts.push_back( VclPtr<FixedText>::Create(m_pGrid) ); + maEdits.push_back( VclPtr<Edit>::Create(m_pGrid, WB_BORDER) ); - maFixedTexts[nIndex].set_grid_left_attach(0); - maEdits[nIndex].set_grid_left_attach(1); - maFixedTexts[nIndex].set_grid_top_attach(nGridRow); - maEdits[nIndex].set_grid_top_attach(nGridRow); + maFixedTexts[nIndex]->set_grid_left_attach(0); + maEdits[nIndex]->set_grid_left_attach(1); + maFixedTexts[nIndex]->set_grid_top_attach(nGridRow); + maEdits[nIndex]->set_grid_top_attach(nGridRow); - maEdits[nIndex].SetWidthInChars(32); - maEdits[nIndex].set_hexpand(true); + maEdits[nIndex]->SetWidthInChars(32); + maEdits[nIndex]->set_hexpand(true); ++nGridRow; - maFixedTexts[nIndex].SetText(aFieldName); - maFixedTexts[nIndex].Show(); - maEdits[nIndex].Show(); + maFixedTexts[nIndex]->SetText(aFieldName); + maFixedTexts[nIndex]->Show(); + maEdits[nIndex]->Show(); } else { maFixedTexts.push_back( NULL ); maEdits.push_back( NULL ); } - if (!maEdits.is_null(nIndex)) - maEdits[nIndex].SetModifyHdl( HDL(Impl_DataModifyHdl) ); + if (maEdits[nIndex] != nullptr) + maEdits[nIndex]->SetModifyHdl( HDL(Impl_DataModifyHdl) ); } } @@ -204,22 +204,36 @@ ScDataFormDlg::ScDataFormDlg(vcl::Window* pParent, ScTabViewShell* pTabViewShell ScDataFormDlg::~ScDataFormDlg() { + disposeOnce(); +} +void ScDataFormDlg::dispose() +{ + m_pBtnNew.clear(); + m_pBtnDelete.clear(); + m_pBtnRestore.clear(); + m_pBtnPrev.clear(); + m_pBtnNext.clear(); + m_pBtnClose.clear(); + m_pSlider.clear(); + m_pGrid.clear(); + m_pFixedText.clear(); + ModalDialog::dispose(); } void ScDataFormDlg::FillCtrls(SCROW /*nCurrentRow*/) { for (sal_uInt16 i = 0; i < aColLength; ++i) { - if (!maEdits.is_null(i)) + if (maEdits[i] != nullptr) { if (nCurrentRow<=nEndRow && pDoc) { OUString aFieldName(pDoc->GetString(i + nStartCol, nCurrentRow, nTab)); - maEdits[i].SetText(aFieldName); + maEdits[i]->SetText(aFieldName); } else - maEdits[i].SetText(OUString()); + maEdits[i]->SetText(OUString()); } } @@ -251,10 +265,10 @@ IMPL_LINK_NOARG(ScDataFormDlg, Impl_NewHdl) if ( pDoc ) { bool bHasData = false; - boost::ptr_vector<Edit>::iterator itr = maEdits.begin(), itrEnd = maEdits.end(); + auto itr = maEdits.begin(), itrEnd = maEdits.end(); for(; itr != itrEnd; ++itr) - if (!boost::is_null(itr)) - if ( !(*itr).GetText().isEmpty() ) + if ((*itr) != nullptr) + if ( !(*itr)->GetText().isEmpty() ) { bHasData = true; break; @@ -367,8 +381,8 @@ void ScDataFormDlg::SetButtonState() m_pBtnPrev->Enable( true ); m_pBtnRestore->Enable( false ); - if ( maEdits.size()>=1 && !maEdits.is_null(0) ) - maEdits[0].GrabFocus(); + if ( maEdits.size()>=1 && maEdits[0] != nullptr ) + maEdits[0]->GrabFocus(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/datastreamdlg.cxx b/sc/source/ui/miscdlgs/datastreamdlg.cxx index 345293b81201..7f6c826a46de 100644 --- a/sc/source/ui/miscdlgs/datastreamdlg.cxx +++ b/sc/source/ui/miscdlgs/datastreamdlg.cxx @@ -52,6 +52,33 @@ DataStreamDlg::DataStreamDlg(ScDocShell *pDocShell, vcl::Window* pParent) UpdateEnable(); } +DataStreamDlg::~DataStreamDlg() +{ + disposeOnce(); +} + +void DataStreamDlg::dispose() +{ + m_pCbUrl.clear(); + m_pBtnBrowse.clear(); + m_pRBDirectData.clear(); + m_pRBScriptData.clear(); + m_pRBValuesInLine.clear(); + m_pRBAddressValue.clear(); + m_pCBRefreshOnEmpty.clear(); + m_pRBDataDown.clear(); + m_pRBRangeDown.clear(); + m_pRBNoMove.clear(); + m_pRBMaxLimit.clear(); + m_pRBUnlimited.clear(); + m_pEdRange.clear(); + m_pEdLimit.clear(); + m_pBtnOk.clear(); + m_pVclFrameLimit.clear(); + m_pVclFrameMove.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(DataStreamDlg, BrowseHdl) { sfx2::FileDialogHelper aFileDialog(0, 0); diff --git a/sc/source/ui/miscdlgs/delcldlg.cxx b/sc/source/ui/miscdlgs/delcldlg.cxx index 06e43a4b5e19..a618d802909f 100644 --- a/sc/source/ui/miscdlgs/delcldlg.cxx +++ b/sc/source/ui/miscdlgs/delcldlg.cxx @@ -57,6 +57,21 @@ ScDeleteCellDlg::ScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove) } } +ScDeleteCellDlg::~ScDeleteCellDlg() +{ + disposeOnce(); +} + +void ScDeleteCellDlg::dispose() +{ + m_pBtnCellsUp.clear(); + m_pBtnCellsLeft.clear(); + m_pBtnDelRows.clear(); + m_pBtnDelCols.clear(); + ModalDialog::dispose(); +} + + DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const { DelCellCmd nReturn = DEL_NONE; diff --git a/sc/source/ui/miscdlgs/delcodlg.cxx b/sc/source/ui/miscdlgs/delcodlg.cxx index 21eccac2c1b1..911af874bcbb 100644 --- a/sc/source/ui/miscdlgs/delcodlg.cxx +++ b/sc/source/ui/miscdlgs/delcodlg.cxx @@ -71,6 +71,25 @@ ScDeleteContentsDlg::ScDeleteContentsDlg( vcl::Window* pParent, aBtnDelAll->SetClickHdl( LINK( this, ScDeleteContentsDlg, DelAllHdl ) ); } +ScDeleteContentsDlg::~ScDeleteContentsDlg() +{ + disposeOnce(); +} + +void ScDeleteContentsDlg::dispose() +{ + aBtnDelAll.clear(); + aBtnDelStrings.clear(); + aBtnDelNumbers.clear(); + aBtnDelDateTime.clear(); + aBtnDelFormulas.clear(); + aBtnDelNotes.clear(); + aBtnDelAttrs.clear(); + aBtnDelObjects.clear(); + aBtnOk.clear(); + ModalDialog::dispose(); +} + InsertDeleteFlags ScDeleteContentsDlg::GetDelContentsCmdBits() const { ScDeleteContentsDlg::nPreviousChecks = IDF_NONE; @@ -139,8 +158,4 @@ IMPL_LINK_NOARG_INLINE_START(ScDeleteContentsDlg, DelAllHdl) } IMPL_LINK_NOARG_INLINE_END(ScDeleteContentsDlg, DelAllHdl) -ScDeleteContentsDlg::~ScDeleteContentsDlg() -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx index 9067a15bb28c..4a0113d85e7d 100644 --- a/sc/source/ui/miscdlgs/filldlg.cxx +++ b/sc/source/ui/miscdlgs/filldlg.cxx @@ -76,6 +76,32 @@ ScFillSeriesDlg::ScFillSeriesDlg( vcl::Window* pParent, ScFillSeriesDlg::~ScFillSeriesDlg() { + disposeOnce(); +} + +void ScFillSeriesDlg::dispose() +{ + m_pFtStartVal.clear(); + m_pEdStartVal.clear(); + m_pFtEndVal.clear(); + m_pEdEndVal.clear(); + m_pFtIncrement.clear(); + m_pEdIncrement.clear(); + m_pBtnDown.clear(); + m_pBtnRight.clear(); + m_pBtnUp.clear(); + m_pBtnLeft.clear(); + m_pBtnArithmetic.clear(); + m_pBtnGeometric.clear(); + m_pBtnDate.clear(); + m_pBtnAutoFill.clear(); + m_pFtTimeUnit.clear(); + m_pBtnDay.clear(); + m_pBtnDayOfWeek.clear(); + m_pBtnMonth.clear(); + m_pBtnYear.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); } void ScFillSeriesDlg::SetEdStartValEnabled(bool bFlag) diff --git a/sc/source/ui/miscdlgs/groupdlg.cxx b/sc/source/ui/miscdlgs/groupdlg.cxx index 62b726b41570..0b85da75efd6 100644 --- a/sc/source/ui/miscdlgs/groupdlg.cxx +++ b/sc/source/ui/miscdlgs/groupdlg.cxx @@ -42,13 +42,21 @@ ScGroupDlg::ScGroupDlg(vcl::Window* pParent, bool bUngroup, bool bRows) m_pBtnRows->GrabFocus(); } -bool ScGroupDlg::GetColsChecked() const +ScGroupDlg::~ScGroupDlg() { - return m_pBtnCols->IsChecked(); + disposeOnce(); } -ScGroupDlg::~ScGroupDlg() +void ScGroupDlg::dispose() { + m_pBtnRows.clear(); + m_pBtnCols.clear(); + ModalDialog::dispose(); +} + +bool ScGroupDlg::GetColsChecked() const +{ + return m_pBtnCols->IsChecked(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx index bddfdef57fc0..8141ca08aa03 100644 --- a/sc/source/ui/miscdlgs/highred.cxx +++ b/sc/source/ui/miscdlgs/highred.cxx @@ -46,7 +46,7 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl: , pDoc(ptrViewData->GetDocument()) , aLocalRangeName(*(pDoc->GetRangeName())) { - m_pFilterCtr = new SvxTPFilter(get<VclContainer>("box")); + m_pFilterCtr = VclPtr<SvxTPFilter>::Create(get<VclContainer>("box")); get(m_pHighlightBox, "showchanges"); get(m_pCbAccept, "showaccepted"); get(m_pCbReject, "showrejected"); @@ -69,8 +69,20 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl: ScHighlightChgDlg::~ScHighlightChgDlg() { + disposeOnce(); +} + +void ScHighlightChgDlg::dispose() +{ SetDispatcherLock( false ); - delete m_pFilterCtr; + m_pFilterCtr.disposeAndClear(); + m_pHighlightBox.clear(); + m_pCbAccept.clear(); + m_pCbReject.clear(); + m_pOkButton.clear(); + m_pEdAssign.clear(); + m_pRbAssign.clear(); + ScAnyRefDlg::dispose(); } void ScHighlightChgDlg::Init() diff --git a/sc/source/ui/miscdlgs/inscldlg.cxx b/sc/source/ui/miscdlgs/inscldlg.cxx index b2f805974027..001d0778f931 100644 --- a/sc/source/ui/miscdlgs/inscldlg.cxx +++ b/sc/source/ui/miscdlgs/inscldlg.cxx @@ -58,6 +58,20 @@ ScInsertCellDlg::ScInsertCellDlg( vcl::Window* pParent,bool bDisallowCellMove) : } } +ScInsertCellDlg::~ScInsertCellDlg() +{ + disposeOnce(); +} + +void ScInsertCellDlg::dispose() +{ + m_pBtnCellsDown.clear(); + m_pBtnCellsRight.clear(); + m_pBtnInsRow.clear(); + m_pBtnInsCol.clear(); + ModalDialog::dispose(); +} + InsCellCmd ScInsertCellDlg::GetInsCellCmd() const { InsCellCmd nReturn = INS_NONE; @@ -86,8 +100,4 @@ InsCellCmd ScInsertCellDlg::GetInsCellCmd() const return nReturn; } -ScInsertCellDlg::~ScInsertCellDlg() -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx index 75e5bac2574f..6d7d1ce1249e 100644 --- a/sc/source/ui/miscdlgs/inscodlg.cxx +++ b/sc/source/ui/miscdlgs/inscodlg.cxx @@ -361,6 +361,11 @@ IMPL_LINK_NOARG(ScInsertContentsDlg, LinkBtnHdl) ScInsertContentsDlg::~ScInsertContentsDlg() { + disposeOnce(); +} + +void ScInsertContentsDlg::dispose() +{ ScInsertContentsDlg::nPreviousChecks2 = 0; if(mpBtnSkipEmptyCells->IsChecked()) ScInsertContentsDlg::nPreviousChecks2 |= INS_CONT_NOEMPTY; @@ -378,6 +383,29 @@ ScInsertContentsDlg::~ScInsertContentsDlg() else if ( mpRbMoveRight->IsChecked() ) ScInsertContentsDlg::nPreviousMoveMode = INS_CELLSRIGHT; } + mpBtnInsAll.clear(); + mpBtnInsStrings.clear(); + mpBtnInsNumbers.clear(); + mpBtnInsDateTime.clear(); + mpBtnInsFormulas.clear(); + mpBtnInsNotes.clear(); + mpBtnInsAttrs.clear(); + mpBtnInsObjects.clear(); + mpBtnSkipEmptyCells.clear(); + mpBtnTranspose.clear(); + mpBtnLink.clear(); + mpRbNoOp.clear(); + mpRbAdd.clear(); + mpRbSub.clear(); + mpRbMul.clear(); + mpRbDiv.clear(); + mpRbMoveNone.clear(); + mpRbMoveDown.clear(); + mpRbMoveRight.clear(); + mpBtnShortCutPasteValuesOnly.clear(); + mpBtnShortCutPasteValuesFormats.clear(); + mpBtnShortCutPasteTranspose.clear(); + ModalDialog::dispose(); } sal_uInt16 ScInsertContentsDlg::GetFormulaCmdBits() const diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index eda2e79bb4dd..27825d3198a9 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -64,9 +64,28 @@ ScInsertTableDlg::ScInsertTableDlg( vcl::Window* pParent, ScViewData& rData, SCT ScInsertTableDlg::~ScInsertTableDlg() { + disposeOnce(); +} + +void ScInsertTableDlg::dispose() +{ if (pDocShTables) pDocShTables->DoClose(); delete pDocInserter; + m_pBtnBefore.clear(); + m_pBtnBehind.clear(); + m_pBtnNew.clear(); + m_pBtnFromFile.clear(); + m_pFtCount.clear(); + m_pNfCount.clear(); + m_pFtName.clear(); + m_pEdName.clear(); + m_pLbTables.clear(); + m_pFtPath.clear(); + m_pBtnBrowse.clear(); + m_pBtnLink.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); } void ScInsertTableDlg::Init_Impl( bool bFromFile ) diff --git a/sc/source/ui/miscdlgs/lbseldlg.cxx b/sc/source/ui/miscdlgs/lbseldlg.cxx index 9fd2f570c257..2528212d3776 100644 --- a/sc/source/ui/miscdlgs/lbseldlg.cxx +++ b/sc/source/ui/miscdlgs/lbseldlg.cxx @@ -41,6 +41,18 @@ ScSelEntryDlg::ScSelEntryDlg(vcl::Window* pParent, const std::vector<OUString> m_pLb->SelectEntryPos( 0 ); } +ScSelEntryDlg::~ScSelEntryDlg() +{ + disposeOnce(); +} + +void ScSelEntryDlg::dispose() +{ + m_pLb.clear(); + ModalDialog::dispose(); +} + + OUString ScSelEntryDlg::GetSelectEntry() const { return m_pLb->GetSelectEntry(); diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index cf09932f6247..51402b17cffb 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -62,7 +62,20 @@ ScLinkedAreaDlg::ScLinkedAreaDlg(vcl::Window* pParent) ScLinkedAreaDlg::~ScLinkedAreaDlg() { + disposeOnce(); +} + +void ScLinkedAreaDlg::dispose() +{ // pSourceShell is deleted by aSourceRef + m_pCbUrl.clear(); + m_pBtnBrowse.clear(); + m_pLbRanges.clear(); + m_pBtnReload.clear(); + m_pNfDelay.clear(); + m_pFtSeconds.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); } short ScLinkedAreaDlg::Execute() diff --git a/sc/source/ui/miscdlgs/mtrindlg.cxx b/sc/source/ui/miscdlgs/mtrindlg.cxx index 7651d8310bd8..ce23d3797014 100644 --- a/sc/source/ui/miscdlgs/mtrindlg.cxx +++ b/sc/source/ui/miscdlgs/mtrindlg.cxx @@ -58,6 +58,18 @@ ScMetricInputDlg::ScMetricInputDlg( vcl::Window* pParent, m_pBtnDefVal->Check( nCurrentValue == nDefaultValue ); } +ScMetricInputDlg::~ScMetricInputDlg() +{ + disposeOnce(); +} + +void ScMetricInputDlg::dispose() +{ + m_pEdValue.clear(); + m_pBtnDefVal.clear(); + ModalDialog::dispose(); +} + long ScMetricInputDlg::GetInputValue( FieldUnit eUnit ) const { /* diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx index 32d997b971b2..995aa7267e49 100644 --- a/sc/source/ui/miscdlgs/mvtabdlg.cxx +++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx @@ -65,6 +65,19 @@ ScMoveTableDlg::ScMoveTableDlg(vcl::Window* pParent, const OUString& rDefault) ScMoveTableDlg::~ScMoveTableDlg() { + disposeOnce(); +} + +void ScMoveTableDlg::dispose() +{ + pBtnMove.clear(); + pBtnCopy.clear(); + pLbDoc.clear(); + pLbTable.clear(); + pEdTabName.clear(); + pFtWarn.clear(); + pBtnOk.clear(); + ModalDialog::dispose(); } void ScMoveTableDlg::GetTabNameString( OUString& rString ) const diff --git a/sc/source/ui/miscdlgs/namecrea.cxx b/sc/source/ui/miscdlgs/namecrea.cxx index 4ae99df8007a..09c821c1c75d 100644 --- a/sc/source/ui/miscdlgs/namecrea.cxx +++ b/sc/source/ui/miscdlgs/namecrea.cxx @@ -35,6 +35,20 @@ ScNameCreateDlg::ScNameCreateDlg( vcl::Window * pParent, sal_uInt16 nFlags ) m_pRightBox->Check ( (nFlags & NAME_RIGHT) != 0 ); } +ScNameCreateDlg::~ScNameCreateDlg() +{ + disposeOnce(); +} + +void ScNameCreateDlg::dispose() +{ + m_pTopBox.clear(); + m_pLeftBox.clear(); + m_pBottomBox.clear(); + m_pRightBox.clear(); + ModalDialog::dispose(); +} + sal_uInt16 ScNameCreateDlg::GetFlags() const { sal_uInt16 nResult = 0; diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index e65e0cbae03b..9b4f998f56fe 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -53,6 +53,18 @@ ScSolverProgressDialog::ScSolverProgressDialog(vcl::Window* pParent) get(m_pFtTime, "progress"); } +ScSolverProgressDialog::~ScSolverProgressDialog() +{ + disposeOnce(); +} + +void ScSolverProgressDialog::dispose() +{ + m_pFtTime.clear(); + ModelessDialog::dispose(); +} + + void ScSolverProgressDialog::HideTimeLimit() { m_pFtTime->Hide(); @@ -72,6 +84,17 @@ ScSolverNoSolutionDialog::ScSolverNoSolutionDialog( vcl::Window* pParent, const m_pFtErrorText->SetText(rErrorText); } +ScSolverNoSolutionDialog::~ScSolverNoSolutionDialog() +{ + disposeOnce(); +} + +void ScSolverNoSolutionDialog::dispose() +{ + m_pFtErrorText.clear(); + ModalDialog::dispose(); +} + ScSolverSuccessDialog::ScSolverSuccessDialog( vcl::Window* pParent, const OUString& rSolution ) : ModalDialog(pParent, "SolverSuccessDialog", "modules/scalc/ui/solversuccessdialog.ui") { @@ -84,6 +107,19 @@ ScSolverSuccessDialog::ScSolverSuccessDialog( vcl::Window* pParent, const OUStri m_pFtResult->SetText(aMessage); } +ScSolverSuccessDialog::~ScSolverSuccessDialog() +{ + disposeOnce(); +} + +void ScSolverSuccessDialog::dispose() +{ + m_pFtResult.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + ModalDialog::dispose(); +} + IMPL_LINK( ScSolverSuccessDialog, ClickHdl, PushButton*, pBtn ) { if (pBtn == m_pBtnOk) @@ -101,7 +137,7 @@ ScCursorRefEdit::ScCursorRefEdit( vcl::Window* pParent, vcl::Window *pLabel ) extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScCursorRefEdit(vcl::Window *pParent, VclBuilder::stringmap &) { - return new ScCursorRefEdit(pParent, NULL); + return new ScCursorRefEdit(pParent, nullptr); } void ScCursorRefEdit::SetCursorLinks( const Link& rUp, const Link& rDown ) @@ -267,6 +303,63 @@ ScOptSolverDlg::ScOptSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Windo ScOptSolverDlg::~ScOptSolverDlg() { + disposeOnce(); +} + +void ScOptSolverDlg::dispose() +{ + m_pFtObjectiveCell.clear(); + m_pEdObjectiveCell.clear(); + m_pRBObjectiveCell.clear(); + m_pRbMax.clear(); + m_pRbMin.clear(); + m_pRbValue.clear(); + m_pEdTargetValue.clear(); + m_pRBTargetValue.clear(); + m_pFtVariableCells.clear(); + m_pEdVariableCells.clear(); + m_pRBVariableCells.clear(); + m_pFtCellRef.clear(); + m_pEdLeft1.clear(); + m_pRBLeft1.clear(); + m_pFtOperator.clear(); + m_pLbOp1.clear(); + m_pFtConstraint.clear(); + m_pEdRight1.clear(); + m_pRBRight1.clear(); + m_pBtnDel1.clear(); + m_pEdLeft2.clear(); + m_pRBLeft2.clear(); + m_pLbOp2.clear(); + m_pEdRight2.clear(); + m_pRBRight2.clear(); + m_pBtnDel2.clear(); + m_pEdLeft3.clear(); + m_pRBLeft3.clear(); + m_pLbOp3.clear(); + m_pEdRight3.clear(); + m_pRBRight3.clear(); + m_pBtnDel3.clear(); + m_pEdLeft4.clear(); + m_pRBLeft4.clear(); + m_pLbOp4.clear(); + m_pEdRight4.clear(); + m_pRBRight4.clear(); + m_pBtnDel4.clear(); + m_pScrollBar.clear(); + m_pBtnOpt.clear(); + m_pBtnCancel.clear(); + m_pBtnSolve.clear(); + mpEdActive.clear(); + for (auto p : mpLeftButton) + p.clear(); + for (auto p : mpRightButton) + p.clear(); + for (auto p : mpOperator) + p.clear(); + for (auto p : mpDelButton) + p.clear(); + ScAnyRefDlg::dispose(); } void ScOptSolverDlg::Init(const ScAddress& rCursorPos) @@ -506,7 +599,7 @@ void ScOptSolverDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) bool ScOptSolverDlg::IsRefInputMode() const { - return mpEdActive != NULL; + return mpEdActive != nullptr; } // Handler: @@ -543,8 +636,8 @@ IMPL_LINK( ScOptSolverDlg, BtnHdl, PushButton*, pBtn ) else if ( pBtn == m_pBtnOpt ) { //! move options dialog to UI lib? - boost::scoped_ptr<ScSolverOptionsDialog> pOptDlg( - new ScSolverOptionsDialog( this, maImplNames, maDescriptions, maEngine, maProperties )); + ScopedVclPtr<ScSolverOptionsDialog> pOptDlg( + VclPtr<ScSolverOptionsDialog>::Create( this, maImplNames, maDescriptions, maEngine, maProperties )); if ( pOptDlg->Execute() == RET_OK ) { maEngine = pOptDlg->GetEngine(); @@ -569,11 +662,11 @@ IMPL_LINK( ScOptSolverDlg, GetFocusHdl, Control*, pCtrl ) for ( sal_uInt16 nRow = 0; nRow < EDIT_ROW_COUNT; ++nRow ) { if( pCtrl == mpLeftEdit[nRow] || pCtrl == mpLeftButton[nRow] ) - pEdit = mpEdActive = mpLeftEdit[nRow]; + pEdit = mpEdActive = mpLeftEdit[nRow].get(); else if( pCtrl == mpRightEdit[nRow] || pCtrl == mpRightButton[nRow] ) - pEdit = mpEdActive = mpRightEdit[nRow]; + pEdit = mpEdActive = mpRightEdit[nRow].get(); else if( pCtrl == mpOperator[nRow] ) // focus on "operator" list box - mpEdActive = mpRightEdit[nRow]; // use right edit for ref input, but don't change selection + mpEdActive = mpRightEdit[nRow].get(); // use right edit for ref input, but don't change selection } if( pCtrl == m_pRbValue ) // focus on "Value of" radio button mpEdActive = m_pEdTargetValue; // use value edit for ref input, but don't change selection @@ -609,7 +702,7 @@ IMPL_LINK( ScOptSolverDlg, DelBtnHdl, PushButton*, pBtn ) // If the button is disabled, focus would normally move to the next control, // (left edit of the next row). Move it to left edit of this row instead. - mpEdActive = mpLeftEdit[nRow]; + mpEdActive = mpLeftEdit[nRow].get(); mpEdActive->GrabFocus(); } } @@ -768,15 +861,15 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal { // show progress dialog - ScSolverProgressDialog aProgress( this ); + ScopedVclPtrInstance< ScSolverProgressDialog > aProgress( this ); sal_Int32 nTimeout = 0; if ( FindTimeout( nTimeout ) ) - aProgress.SetTimeLimit( nTimeout ); + aProgress->SetTimeLimit( nTimeout ); else - aProgress.HideTimeLimit(); - aProgress.Show(); - aProgress.Update(); - aProgress.Sync(); + aProgress->HideTimeLimit(); + aProgress->Show(); + aProgress->Update(); + aProgress->Sync(); // try to make sure the progress dialog is painted before continuing Application::Reschedule(true); @@ -967,7 +1060,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal xSolver->solve(); bool bSuccess = xSolver->getSuccess(); - aProgress.Hide(); + aProgress->Hide(); bool bClose = false; bool bRestore = true; // restore old values unless a solution is accepted if ( bSuccess ) @@ -993,8 +1086,8 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal static_cast<SCCOL>(aObjective.Column), static_cast<SCROW>(aObjective.Row), static_cast<SCTAB>(aObjective.Sheet)); - ScSolverSuccessDialog aDialog( this, aResultStr ); - if ( aDialog.Execute() == RET_OK ) + ScopedVclPtrInstance< ScSolverSuccessDialog > aDialog( this, aResultStr ); + if ( aDialog->Execute() == RET_OK ) { // keep results and close dialog bRestore = false; @@ -1007,8 +1100,8 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal uno::Reference<sheet::XSolverDescription> xDesc( xSolver, uno::UNO_QUERY ); if ( xDesc.is() ) aError = xDesc->getStatusDescription(); // error description from component - ScSolverNoSolutionDialog aDialog( this, aError ); - aDialog.Execute(); + ScopedVclPtrInstance< ScSolverNoSolutionDialog > aDialog( this, aError ); + aDialog->Execute(); } if ( bRestore ) // restore old values diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx index 5c2e89582887..cf552f41f0e7 100644 --- a/sc/source/ui/miscdlgs/protectiondlg.cxx +++ b/sc/source/ui/miscdlgs/protectiondlg.cxx @@ -50,6 +50,19 @@ ScTableProtectionDlg::ScTableProtectionDlg(vcl::Window* pParent) ScTableProtectionDlg::~ScTableProtectionDlg() { + disposeOnce(); +} + +void ScTableProtectionDlg::dispose() +{ + m_pBtnProtect.clear(); + m_pPasswords.clear(); + m_pOptions.clear(); + m_pPassword1Edit.clear(); + m_pPassword2Edit.clear(); + m_pOptionsListBox.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); } short ScTableProtectionDlg::Execute() diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx index d804ea16a353..60be4c415bcf 100644 --- a/sc/source/ui/miscdlgs/retypepassdlg.cxx +++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx @@ -54,22 +54,32 @@ ScRetypePassDlg::ScRetypePassDlg(vcl::Window* pParent) : ScRetypePassDlg::~ScRetypePassDlg() { + disposeOnce(); +} + +void ScRetypePassDlg::dispose() +{ DeleteSheets(); + mpBtnOk.clear(); + mpTextDocStatus.clear(); + mpBtnRetypeDoc.clear(); + mpSheetsBox.clear(); + ModalDialog::dispose(); } void ScRetypePassDlg::DeleteSheets() { - for(std::vector<VclHBox*>::iterator it = maSheets.begin(); it != maSheets.end(); ++it) + for(auto it = maSheets.begin(); it != maSheets.end(); ++it) { - vcl::Window *pWindow = (*it); + VclPtr<vcl::Window> pWindow = (*it); vcl::Window *pChild = pWindow->GetWindow(WINDOW_FIRSTCHILD); while (pChild) { - vcl::Window *pOldChild = pChild; + VclPtr<vcl::Window> pOldChild = pChild; pChild = pChild->GetWindow(WINDOW_NEXT); - delete pOldChild; + pOldChild.disposeAndClear(); } - delete pWindow; + pWindow.disposeAndClear(); } } @@ -100,17 +110,17 @@ void ScRetypePassDlg::SetDataFromDocument(const ScDocument& rDoc) aTabItem.mpProtect.reset(new ScTableProtection(*pTabProtect)); maTableItems.push_back(aTabItem); - VclHBox* pSheet = new VclHBox(mpSheetsBox, false, 12); + VclPtr<VclHBox> pSheet = VclPtr<VclHBox>::Create(mpSheetsBox, false, 12); pSheet->Show(true); - FixedText* pFtSheetName = new FixedText(pSheet); + VclPtr<FixedText> pFtSheetName = VclPtr<FixedText>::Create(pSheet); pFtSheetName->Show(true); pFtSheetName->SetStyle(WB_VCENTER); - FixedText* pFtSheetStatus = new FixedText(pSheet); + FixedText* pFtSheetStatus = VclPtr<FixedText>::Create(pSheet); pFtSheetStatus->Show(true); pFtSheetStatus->SetStyle(WB_VCENTER); - PushButton* pBtnSheet = new PushButton(pSheet); + VclPtr<PushButton> pBtnSheet = VclPtr<PushButton>::Create((vcl::Window*)pSheet); pBtnSheet->SetText(ScResId(STR_RETYPE)); pBtnSheet->SetClickHdl(LINK(this, ScRetypePassDlg, RetypeBtnHdl)); pBtnSheet->Disable(); @@ -283,11 +293,11 @@ IMPL_LINK( ScRetypePassDlg, RetypeBtnHdl, PushButton*, pBtn ) // What the ... !? return 0; - ScRetypePassInputDlg aDlg(this, pProtected); - if (aDlg.Execute() == RET_OK) + ScopedVclPtrInstance< ScRetypePassInputDlg > aDlg(this, pProtected); + if (aDlg->Execute() == RET_OK) { // OK is pressed. Update the protected item. - if (aDlg.IsRemovePassword()) + if (aDlg->IsRemovePassword()) { // Remove password from this item. pProtected->setPassword(OUString()); @@ -295,7 +305,7 @@ IMPL_LINK( ScRetypePassDlg, RetypeBtnHdl, PushButton*, pBtn ) else { // Set a new password. - OUString aNewPass = aDlg.GetNewPassword(); + OUString aNewPass = aDlg->GetNewPassword(); pProtected->setPassword(aNewPass); } @@ -323,6 +333,19 @@ ScRetypePassInputDlg::ScRetypePassInputDlg(vcl::Window* pParent, ScPassHashProte ScRetypePassInputDlg::~ScRetypePassInputDlg() { + disposeOnce(); +} + +void ScRetypePassInputDlg::dispose() +{ + m_pBtnOk.clear(); + m_pBtnRetypePassword.clear(); + m_pPasswordGrid.clear(); + m_pPassword1Edit.clear(); + m_pPassword2Edit.clear(); + m_pBtnMatchOldPass.clear(); + m_pBtnRemovePassword.clear(); + ModalDialog::dispose(); } short ScRetypePassInputDlg::Execute() diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index b55b722294c0..6a115706e598 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -88,6 +88,29 @@ ScAutoFormatDlg::ScAutoFormatDlg(vcl::Window* pParent, m_pWndPreview->NotifyChange(it->second); } +ScAutoFormatDlg::~ScAutoFormatDlg() +{ + disposeOnce(); +} + +void ScAutoFormatDlg::dispose() +{ + m_pLbFormat.clear(); + m_pWndPreview.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + m_pBtnAdd.clear(); + m_pBtnRemove.clear(); + m_pBtnRename.clear(); + m_pBtnNumFormat.clear(); + m_pBtnBorder.clear(); + m_pBtnFont.clear(); + m_pBtnPattern.clear(); + m_pBtnAlignment.clear(); + m_pBtnAdjust.clear(); + ModalDialog::dispose(); +} + void ScAutoFormatDlg::Init() { m_pLbFormat->SetSelectHdl( LINK( this, ScAutoFormatDlg, SelFmtHdl ) ); @@ -201,11 +224,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl) while ( !bOk ) { - boost::scoped_ptr<ScStringInputDlg> pDlg(new ScStringInputDlg( this, - aStrTitle, - aStrLabel, - aFormatName, - HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME )); + VclPtrInstance<ScStringInputDlg> pDlg( this, + aStrTitle, + aStrLabel, + aFormatName, + HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME ); if ( pDlg->Execute() == RET_OK ) { @@ -308,11 +331,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl) OUString aFormatName = m_pLbFormat->GetSelectEntry(); OUString aEntry; - boost::scoped_ptr<ScStringInputDlg> pDlg(new ScStringInputDlg( this, - aStrRename, - aStrLabel, - aFormatName, - HID_SC_REN_AFMT_DLG, HID_SC_REN_AFMT_NAME )); + VclPtrInstance<ScStringInputDlg> pDlg( this, + aStrRename, + aStrLabel, + aFormatName, + HID_SC_REN_AFMT_DLG, HID_SC_REN_AFMT_NAME ); if( pDlg->Execute() == RET_OK ) { bool bFmtRenamed = false; diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 35b1fff147fa..9cb3ca29bccb 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -83,7 +83,7 @@ ScShareDocumentDlg::ScShareDocumentDlg( vcl::Window* pParent, ScViewData* pViewD SvSimpleTableContainer *pCtrl = get<SvSimpleTableContainer>("users"); pCtrl->set_height_request(pCtrl->GetTextHeight()*9); - m_pLbUsers = new ScShareTable(*pCtrl); + m_pLbUsers = VclPtr<ScShareTable>::Create(*pCtrl); m_aStrNoUserData = get<FixedText>("nouserdata")->GetText(); m_aStrUnknownUser = get<FixedText>("unknownuser")->GetText(); @@ -108,7 +108,15 @@ ScShareDocumentDlg::ScShareDocumentDlg( vcl::Window* pParent, ScViewData* pViewD ScShareDocumentDlg::~ScShareDocumentDlg() { - delete m_pLbUsers; + disposeOnce(); +} + +void ScShareDocumentDlg::dispose() +{ + m_pLbUsers.disposeAndClear(); + m_pCbShare.clear(); + m_pFtWarning.clear(); + ModalDialog::dispose(); } IMPL_LINK_NOARG(ScShareDocumentDlg, ToggleHandle) diff --git a/sc/source/ui/miscdlgs/shtabdlg.cxx b/sc/source/ui/miscdlgs/shtabdlg.cxx index 48ed2c95b5ce..7898fc904488 100644 --- a/sc/source/ui/miscdlgs/shtabdlg.cxx +++ b/sc/source/ui/miscdlgs/shtabdlg.cxx @@ -37,6 +37,18 @@ ScShowTabDlg::ScShowTabDlg(vcl::Window* pParent) m_pLb->SetDoubleClickHdl( LINK( this, ScShowTabDlg, DblClkHdl ) ); } +ScShowTabDlg::~ScShowTabDlg() +{ + disposeOnce(); +} + +void ScShowTabDlg::dispose() +{ + m_pFrame.clear(); + m_pLb.clear(); + ModalDialog::dispose(); +} + void ScShowTabDlg::SetDescription( const OUString& rTitle, const OUString& rFixedText, const OString& rDlgHelpId, const OString& sLbHelpId ) diff --git a/sc/source/ui/miscdlgs/simpref.cxx b/sc/source/ui/miscdlgs/simpref.cxx index 93cb3e06d96d..866bb129af9d 100644 --- a/sc/source/ui/miscdlgs/simpref.cxx +++ b/sc/source/ui/miscdlgs/simpref.cxx @@ -59,7 +59,18 @@ ScSimpleRefDlg::ScSimpleRefDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window ScSimpleRefDlg::~ScSimpleRefDlg() { + disposeOnce(); +} + +void ScSimpleRefDlg::dispose() +{ SetDispatcherLock( false ); // deactivate modal mode + m_pFtAssign.clear(); + m_pEdAssign.clear(); + m_pRbAssign.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + ScAnyRefDlg::dispose(); } void ScSimpleRefDlg::FillInfo(SfxChildWinInfo& rWinInfo) const diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 307bc6734974..447c6a0bd887 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -159,7 +159,16 @@ ScSolverOptionsDialog::ScSolverOptionsDialog( vcl::Window* pParent, ScSolverOptionsDialog::~ScSolverOptionsDialog() { + disposeOnce(); +} + +void ScSolverOptionsDialog::dispose() +{ delete mpCheckButtonData; + m_pLbEngine.clear(); + m_pLbSettings.clear(); + m_pBtnEdit.clear(); + ModalDialog::dispose(); } const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties() @@ -308,23 +317,23 @@ void ScSolverOptionsDialog::EditOption() { if ( pStringItem->IsDouble() ) { - ScSolverValueDialog aValDialog( this ); - aValDialog.SetOptionName( pStringItem->GetText() ); - aValDialog.SetValue( pStringItem->GetDoubleValue() ); - if ( aValDialog.Execute() == RET_OK ) + ScopedVclPtrInstance< ScSolverValueDialog > aValDialog( this ); + aValDialog->SetOptionName( pStringItem->GetText() ); + aValDialog->SetValue( pStringItem->GetDoubleValue() ); + if ( aValDialog->Execute() == RET_OK ) { - pStringItem->SetDoubleValue( aValDialog.GetValue() ); + pStringItem->SetDoubleValue( aValDialog->GetValue() ); m_pLbSettings->InvalidateEntry( pEntry ); } } else { - ScSolverIntegerDialog aIntDialog( this ); - aIntDialog.SetOptionName( pStringItem->GetText() ); - aIntDialog.SetValue( pStringItem->GetIntValue() ); - if ( aIntDialog.Execute() == RET_OK ) + ScopedVclPtrInstance< ScSolverIntegerDialog > aIntDialog( this ); + aIntDialog->SetOptionName( pStringItem->GetText() ); + aIntDialog->SetValue( pStringItem->GetIntValue() ); + if ( aIntDialog->Execute() == RET_OK ) { - pStringItem->SetIntValue( aIntDialog.GetValue() ); + pStringItem->SetIntValue( aIntDialog->GetValue() ); m_pLbSettings->InvalidateEntry( pEntry ); } } @@ -388,6 +397,18 @@ ScSolverIntegerDialog::ScSolverIntegerDialog(vcl::Window * pParent) get(m_pNfValue, "value"); } +ScSolverIntegerDialog::~ScSolverIntegerDialog() +{ + disposeOnce(); +} + +void ScSolverIntegerDialog::dispose() +{ + m_pFrame.clear(); + m_pNfValue.clear(); + ModalDialog::dispose(); +} + void ScSolverIntegerDialog::SetOptionName( const OUString& rName ) { m_pFrame->set_label(rName); @@ -416,6 +437,18 @@ ScSolverValueDialog::ScSolverValueDialog( vcl::Window * pParent ) get(m_pEdValue, "value"); } +ScSolverValueDialog::~ScSolverValueDialog() +{ + disposeOnce(); +} + +void ScSolverValueDialog::dispose() +{ + m_pFrame.clear(); + m_pEdValue.clear(); + ModalDialog::dispose(); +} + void ScSolverValueDialog::SetOptionName( const OUString& rName ) { m_pFrame->set_label(rName); diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx index 10ffbfa0ca9b..45f6f453b83b 100644 --- a/sc/source/ui/miscdlgs/solvrdlg.cxx +++ b/sc/source/ui/miscdlgs/solvrdlg.cxx @@ -73,6 +73,22 @@ ScSolverDlg::ScSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pPa ScSolverDlg::~ScSolverDlg() { + disposeOnce(); +} + +void ScSolverDlg::dispose() +{ + m_pFtFormulaCell.clear(); + m_pEdFormulaCell.clear(); + m_pRBFormulaCell.clear(); + m_pEdTargetVal.clear(); + m_pFtVariableCell.clear(); + m_pEdVariableCell.clear(); + m_pRBVariableCell.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + pEdActive.clear(); + ScAnyRefDlg::dispose(); } void ScSolverDlg::Init() @@ -170,7 +186,7 @@ void ScSolverDlg::RaiseError( ScSolverErr eError ) bool ScSolverDlg::IsRefInputMode() const { - return pEdActive != NULL; + return pEdActive != nullptr; } bool ScSolverDlg::CheckTargetValue( const OUString& rStrVal ) diff --git a/sc/source/ui/miscdlgs/strindlg.cxx b/sc/source/ui/miscdlgs/strindlg.cxx index c053016f33fe..482ca29aed33 100644 --- a/sc/source/ui/miscdlgs/strindlg.cxx +++ b/sc/source/ui/miscdlgs/strindlg.cxx @@ -39,4 +39,16 @@ ScStringInputDlg::ScStringInputDlg( vcl::Window* pParent, m_pEdInput->SetHelpId( sEditHelpId ); } +ScStringInputDlg::~ScStringInputDlg() +{ + disposeOnce(); +} + +void ScStringInputDlg::dispose() +{ + m_pFtEditTitle.clear(); + m_pEdInput.clear(); + ModalDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx index b2299f777194..0387e31596f5 100644 --- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx +++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx @@ -59,6 +59,18 @@ ScTabBgColorDlg::ScTabBgColorDlg(vcl::Window* pParent, const OUString& rTitle, m_pBtnOk->SetClickHdl( HDL(TabBgColorOKHdl_Impl) ); } +ScTabBgColorDlg::~ScTabBgColorDlg() +{ + disposeOnce(); +} + +void ScTabBgColorDlg::dispose() +{ + m_pTabBgColorSet.clear(); + m_pBtnOk.clear(); + ModalDialog::dispose(); +} + void ScTabBgColorDlg::GetSelectedColor( Color& rColor ) const { rColor = this->m_aTabBgColor; @@ -135,6 +147,17 @@ ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet(vcl::Window* pParent { } +ScTabBgColorDlg::ScTabBgColorValueSet::~ScTabBgColorValueSet() +{ + disposeOnce(); +} + +void ScTabBgColorDlg::ScTabBgColorValueSet::dispose() +{ + m_pTabBgColorDlg.clear(); + SvxColorValueSet::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScTabBgColorValueSet(vcl::Window *pParent, VclBuilder::stringmap &rMap) { WinBits nWinBits = WB_TABSTOP; diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx index cbfeca17bce7..d4f8c17ece4a 100644 --- a/sc/source/ui/miscdlgs/tabopdlg.cxx +++ b/sc/source/ui/miscdlgs/tabopdlg.cxx @@ -76,9 +76,28 @@ ScTabOpDlg::ScTabOpDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pPare ScTabOpDlg::~ScTabOpDlg() { + disposeOnce(); +} + +void ScTabOpDlg::dispose() +{ Hide(); + m_pFtFormulaRange.clear(); + m_pEdFormulaRange.clear(); + m_pRBFormulaRange.clear(); + m_pFtRowCell.clear(); + m_pEdRowCell.clear(); + m_pRBRowCell.clear(); + m_pFtColCell.clear(); + m_pEdColCell.clear(); + m_pRBColCell.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + pEdActive.clear(); + ScAnyRefDlg::dispose(); } + void ScTabOpDlg::Init() { m_pBtnOk->SetClickHdl ( LINK( this, ScTabOpDlg, BtnHdl ) ); |