diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 11:41:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:08:48 +0100 |
commit | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch) | |
tree | b322529f4a54a6427862cb20cb4cf87fb6a5d065 /sc/source/ui | |
parent | 2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff) | |
parent | 0cde74f788a054fa2b65107a030dd463b8d11c7a (diff) |
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts.
Conflicts:
accessibility/source/extended/accessiblelistbox.cxx
accessibility/source/standard/vclxaccessiblecombobox.cxx
accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
accessibility/source/standard/vclxaccessiblelistbox.cxx
accessibility/source/standard/vclxaccessibletextfield.cxx
basctl/source/basicide/basidesh.cxx
cui/source/inc/chardlg.hxx
cui/source/tabpages/tpbitmap.cxx
dbaccess/source/ui/dlg/UserAdmin.cxx
dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
extensions/source/propctrlr/propertyeditor.hxx
extensions/source/scanner/sanedlg.cxx
filter/source/pdf/impdialog.cxx
include/sfx2/mgetempl.hxx
include/sfx2/sidebar/SidebarToolBox.hxx
include/sfx2/viewsh.hxx
include/svtools/brwbox.hxx
include/svtools/filectrl.hxx
include/svtools/scrwin.hxx
include/svx/dlgctrl.hxx
include/svx/sidebar/Popup.hxx
include/svx/sidebar/PopupContainer.hxx
include/svx/sidebar/PopupControl.hxx
include/svx/sidebar/SidebarDialControl.hxx
include/svx/sidebar/ValueSetWithTextControl.hxx
sc/source/ui/condformat/condformatdlgentry.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/sidebar/CellBorderStyleControl.hxx
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/Ruler.hxx
sd/source/ui/inc/SlideSorter.hxx
sd/source/ui/inc/ViewTabBar.hxx
sd/source/ui/inc/Window.hxx
sd/source/ui/inc/morphdlg.hxx
sd/source/ui/inc/sdpreslt.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/NavigatorWrapper.hxx
sd/source/ui/sidebar/PanelBase.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
sd/source/ui/slideshow/showwindow.hxx
sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drviewsa.cxx
sfx2/source/appl/fileobj.hxx
sfx2/source/appl/opengrf.cxx
sfx2/source/control/thumbnailviewacc.hxx
sfx2/source/dialog/securitypage.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/doc/docinsert.cxx
sfx2/source/doc/guisaveas.cxx
sfx2/source/inc/alienwarn.hxx
sfx2/source/sidebar/Deck.cxx
sfx2/source/sidebar/Deck.hxx
sfx2/source/sidebar/DeckTitleBar.cxx
sfx2/source/sidebar/DeckTitleBar.hxx
sfx2/source/sidebar/MenuButton.cxx
sfx2/source/sidebar/MenuButton.hxx
sfx2/source/sidebar/Panel.cxx
sfx2/source/sidebar/Panel.hxx
sfx2/source/sidebar/PanelTitleBar.hxx
sfx2/source/sidebar/SidebarDockingWindow.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
sfx2/source/sidebar/TabBar.hxx
sfx2/source/sidebar/TabItem.cxx
sfx2/source/sidebar/TabItem.hxx
sfx2/source/sidebar/TitleBar.hxx
sfx2/source/toolbox/imgmgr.cxx
starmath/inc/edit.hxx
starmath/inc/smmod.hxx
starmath/qa/cppunit/test_starmath.cxx
starmath/source/edit.cxx
starmath/source/smmod.cxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/simptabl.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/valueimp.hxx
svx/inc/GalleryControl.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/swframeexample.cxx
svx/source/fmcomp/fmgridif.cxx
svx/source/gallery2/GalleryControl.cxx
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/area/AreaPropertyPanel.hxx
svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/line/LinePropertyPanel.hxx
svx/source/sidebar/line/LineWidthControl.cxx
svx/source/sidebar/line/LineWidthControl.hxx
svx/source/sidebar/line/LineWidthValueSet.hxx
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
svx/source/sidebar/possize/SidebarDialControl.cxx
svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
svx/source/sidebar/text/TextPropertyPanel.hxx
svx/source/sidebar/tools/PopupContainer.cxx
svx/source/sidebar/tools/PopupControl.cxx
svx/source/sidebar/tools/ValueSetWithTextControl.cxx
svx/source/svdraw/svdfmtf.hxx
svx/source/svdraw/svdibrow.cxx
svx/source/tbxctrls/colrctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
sw/source/ui/dbui/mmaddressblockpage.cxx
sw/source/ui/dialog/uiregionsw.cxx
sw/source/ui/index/cnttab.cxx
sw/source/uibase/inc/drpcps.hxx
sw/source/uibase/sidebar/PageColumnControl.hxx
sw/source/uibase/sidebar/PageMarginControl.hxx
sw/source/uibase/sidebar/PageOrientationControl.hxx
sw/source/uibase/sidebar/PagePropertyPanel.hxx
sw/source/uibase/sidebar/PageSizeControl.hxx
sw/source/uibase/uiview/view2.cxx
sw/source/uibase/utlui/navipi.cxx
vcl/inc/svdata.hxx
vcl/source/control/combobox.cxx
vcl/source/control/lstbox.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/winproc.cxx
Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'sc/source/ui')
294 files changed, 5288 insertions, 3059 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index a11a7309b66e..c6ca6ad40564 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -142,9 +142,9 @@ void ScViewForwarder::SetInvalid() class ScEditObjectViewForwarder : public SvxViewForwarder { - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; // #i49561# EditView needed for access to its visible area. - const EditView* mpEditView; + const EditView* mpEditView; public: ScEditObjectViewForwarder( vcl::Window* pWindow, const EditView* _pEditView); @@ -172,7 +172,7 @@ ScEditObjectViewForwarder::~ScEditObjectViewForwarder() bool ScEditObjectViewForwarder::IsValid() const { - return (mpWindow != NULL); + return (mpWindow != nullptr); } Rectangle ScEditObjectViewForwarder::GetVisArea() const @@ -545,7 +545,7 @@ Rectangle ScPreviewNoteViewForwarder::GetVisArea() const class ScEditViewForwarder : public SvxEditViewForwarder { EditView* mpEditView; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; public: ScEditViewForwarder(EditView* pEditView, vcl::Window* pWin); virtual ~ScEditViewForwarder(); @@ -1073,7 +1073,7 @@ ScAccessibleEditLineTextData::ScAccessibleEditLineTextData(EditView* pEditView, ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData() { - ScTextWnd* pTxtWnd = dynamic_cast< ScTextWnd* >(mpWindow); + ScTextWnd* pTxtWnd = dynamic_cast< ScTextWnd* >(mpWindow.get()); if (pTxtWnd) pTxtWnd->RemoveAccessibleTextData( *this ); @@ -1094,7 +1094,7 @@ ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData() void ScAccessibleEditLineTextData::Dispose() { - ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow); + ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow.get()); if (pTxtWnd) pTxtWnd->RemoveAccessibleTextData( *this ); @@ -1110,7 +1110,7 @@ ScAccessibleTextData* ScAccessibleEditLineTextData::Clone() const SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder() { - ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow); + ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow.get()); if (pTxtWnd) { @@ -1156,7 +1156,7 @@ SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder() SvxEditViewForwarder* ScAccessibleEditLineTextData::GetEditViewForwarder( bool bCreate ) { - ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow); + ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow.get()); if (pTxtWnd) { @@ -1178,7 +1178,7 @@ SvxEditViewForwarder* ScAccessibleEditLineTextData::GetEditViewForwarder( bool b void ScAccessibleEditLineTextData::ResetEditMode() { - ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow); + ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow.get()); if (mbEditEngineCreated && mpEditEngine) delete mpEditEngine; @@ -1196,7 +1196,7 @@ void ScAccessibleEditLineTextData::TextChanged() { if (mbEditEngineCreated && mpEditEngine) { - ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow); + ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow.get()); if (pTxtWnd) mpEditEngine->SetText(pTxtWnd->GetTextString()); @@ -1637,7 +1637,7 @@ SvxViewForwarder* ScAccessibleNoteTextData::GetViewForwarder() class ScCsvViewForwarder : public SvxViewForwarder { Rectangle maBoundBox; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; public: explicit ScCsvViewForwarder( vcl::Window* pWindow, const Rectangle& rBoundBox ); @@ -1658,7 +1658,7 @@ ScCsvViewForwarder::ScCsvViewForwarder( vcl::Window* pWindow, const Rectangle& r bool ScCsvViewForwarder::IsValid() const { - return mpWindow != NULL; + return mpWindow != nullptr; } Rectangle ScCsvViewForwarder::GetVisArea() const diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx index 89e2fa4cdc15..6a7467d16fb7 100644 --- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx @@ -117,7 +117,18 @@ ScAnalysisOfVarianceDialog::ScAnalysisOfVarianceDialog( } ScAnalysisOfVarianceDialog::~ScAnalysisOfVarianceDialog() -{} +{ + disposeOnce(); +} + +void ScAnalysisOfVarianceDialog::dispose() +{ + mpAlphaField.clear(); + mpSingleFactorRadio.clear(); + mpTwoFactorRadio.clear(); + mpRowsPerSampleField.clear(); + ScStatisticsInputOutputDialog::dispose(); +} bool ScAnalysisOfVarianceDialog::Close() { diff --git a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx index 8063b4ab82d9..9acf9ed6f1d7 100644 --- a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx @@ -37,7 +37,15 @@ ScExponentialSmoothingDialog::ScExponentialSmoothingDialog( } ScExponentialSmoothingDialog::~ScExponentialSmoothingDialog() -{} +{ + disposeOnce(); +} + +void ScExponentialSmoothingDialog::dispose() +{ + mpSmoothingFactor.clear(); + ScStatisticsInputOutputDialog::dispose(); +} bool ScExponentialSmoothingDialog::Close() { diff --git a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx index 4a43e79ea8b3..8514dfc1342b 100644 --- a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx @@ -37,7 +37,15 @@ ScMovingAverageDialog::ScMovingAverageDialog( } ScMovingAverageDialog::~ScMovingAverageDialog() -{} +{ + disposeOnce(); +} + +void ScMovingAverageDialog::dispose() +{ + mpIntervalSpin.clear(); + ScStatisticsInputOutputDialog::dispose(); +} bool ScMovingAverageDialog::Close() { diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index ee906d410857..5583760ba2e2 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -81,6 +81,31 @@ ScRandomNumberGeneratorDialog::ScRandomNumberGeneratorDialog( GetRangeFromSelection(); } +ScRandomNumberGeneratorDialog::~ScRandomNumberGeneratorDialog() +{ + disposeOnce(); +} + +void ScRandomNumberGeneratorDialog::dispose() +{ + mpInputRangeText.clear(); + mpInputRangeEdit.clear(); + mpInputRangeButton.clear(); + mpDistributionCombo.clear(); + mpParameter1Text.clear(); + mpParameter1Value.clear(); + mpParameter2Text.clear(); + mpParameter2Value.clear(); + mpSeed.clear(); + mpEnableSeed.clear(); + mpDecimalPlaces.clear(); + mpEnableRounding.clear(); + mpButtonApply.clear(); + mpButtonOk.clear(); + mpButtonClose.clear(); + ScAnyRefDlg::dispose(); +} + void ScRandomNumberGeneratorDialog::Init() { mpButtonOk->SetClickHdl( LINK( this, ScRandomNumberGeneratorDialog, OkClicked ) ); @@ -114,9 +139,6 @@ void ScRandomNumberGeneratorDialog::GetRangeFromSelection() mpInputRangeEdit->SetText( aCurrentString ); } -ScRandomNumberGeneratorDialog::~ScRandomNumberGeneratorDialog() -{} - void ScRandomNumberGeneratorDialog::SetActive() { if ( mbDialogLostFocus ) diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx index a88faafd1f64..f985adb04648 100644 --- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx @@ -60,6 +60,28 @@ ScSamplingDialog::ScSamplingDialog( GetRangeFromSelection(); } +ScSamplingDialog::~ScSamplingDialog() +{ + disposeOnce(); +} + +void ScSamplingDialog::dispose() +{ + mpInputRangeLabel.clear(); + mpInputRangeEdit.clear(); + mpInputRangeButton.clear(); + mpOutputRangeLabel.clear(); + mpOutputRangeEdit.clear(); + mpOutputRangeButton.clear(); + mpSampleSize.clear(); + mpPeriod.clear(); + mpRandomMethodRadio.clear(); + mpPeriodicMethodRadio.clear(); + mpButtonOk.clear(); + mpActiveEdit.clear(); + ScAnyRefDlg::dispose(); +} + void ScSamplingDialog::Init() { mpButtonOk->SetClickHdl( LINK( this, ScSamplingDialog, OkClicked ) ); @@ -98,9 +120,6 @@ void ScSamplingDialog::GetRangeFromSelection() mpInputRangeEdit->SetText(aCurrentString); } -ScSamplingDialog::~ScSamplingDialog() -{} - void ScSamplingDialog::SetActive() { if ( mDialogLostFocus ) diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx index cb6382142fe3..8e2fa67a455c 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx @@ -87,7 +87,24 @@ ScStatisticsInputOutputDialog::ScStatisticsInputOutputDialog( } ScStatisticsInputOutputDialog::~ScStatisticsInputOutputDialog() -{} +{ + disposeOnce(); +} + +void ScStatisticsInputOutputDialog::dispose() +{ + mpInputRangeLabel.clear(); + mpInputRangeEdit.clear(); + mpInputRangeButton.clear(); + mpOutputRangeLabel.clear(); + mpOutputRangeEdit.clear(); + mpOutputRangeButton.clear(); + mpGroupByColumnsRadio.clear(); + mpGroupByRowsRadio.clear(); + mpButtonOk.clear(); + mpActiveEdit.clear(); + ScAnyRefDlg::dispose(); +} void ScStatisticsInputOutputDialog::Init() { diff --git a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx index 80da64a8bd2a..8dc5ade17d61 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx @@ -65,7 +65,27 @@ ScStatisticsTwoVariableDialog::ScStatisticsTwoVariableDialog( } ScStatisticsTwoVariableDialog::~ScStatisticsTwoVariableDialog() -{} +{ + disposeOnce(); +} + +void ScStatisticsTwoVariableDialog::dispose() +{ + mpVariable1RangeLabel.clear(); + mpVariable1RangeEdit.clear(); + mpVariable1RangeButton.clear(); + mpVariable2RangeLabel.clear(); + mpVariable2RangeEdit.clear(); + mpVariable2RangeButton.clear(); + mpOutputRangeLabel.clear(); + mpOutputRangeEdit.clear(); + mpOutputRangeButton.clear(); + mpButtonOk.clear(); + mpGroupByColumnsRadio.clear(); + mpGroupByRowsRadio.clear(); + mpActiveEdit.clear(); + ScAnyRefDlg::dispose(); +} void ScStatisticsTwoVariableDialog::Init() { @@ -141,7 +161,7 @@ void ScStatisticsTwoVariableDialog::SetActive() void ScStatisticsTwoVariableDialog::SetReference( const ScRange& rReferenceRange, ScDocument* pDocument ) { - if ( mpActiveEdit != NULL ) + if ( mpActiveEdit != nullptr ) { if ( rReferenceRange.aStart != rReferenceRange.aEnd ) RefInputStart( mpActiveEdit ); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index b1a19832233d..caf2c4a98373 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1750,6 +1750,11 @@ void ScInputHandler::UpdateActiveView() pTopView = NULL; } +void ScInputHandler::SetInputWindow( ScInputWindow* pNew ) +{ + pInputWin = pNew; +} + void ScInputHandler::StopInputWinEngine( bool bAll ) { if (pInputWin) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index f5dd784bc22e..95bd92d64358 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -124,7 +124,7 @@ ScInputWindowWrapper::ScInputWindowWrapper( vcl::Window* pParentP, SfxChildWinInfo* /* pInfo */ ) : SfxChildWindow( pParentP, nId ) { - ScInputWindow* pWin=new ScInputWindow( pParentP, pBindings ); + VclPtr<ScInputWindow> pWin=VclPtr<ScInputWindow>::Create( pParentP, pBindings ); pWindow = pWin; pWin->Show(); @@ -154,7 +154,7 @@ static inline bool lcl_isExperimentalMode() // class ScInputWindow -static ScTextWndBase* lcl_chooseRuntimeImpl( vcl::Window* pParent, SfxBindings* pBind ) +static VclPtr<ScTextWndBase> lcl_chooseRuntimeImpl( vcl::Window* pParent, SfxBindings* pBind ) { ScTabViewShell* pViewSh = NULL; SfxDispatcher* pDisp = pBind->GetDispatcher(); @@ -166,16 +166,16 @@ static ScTextWndBase* lcl_chooseRuntimeImpl( vcl::Window* pParent, SfxBindings* } if ( !lcl_isExperimentalMode() ) - return new ScTextWnd( pParent, pViewSh ); - return new ScInputBarGroup( pParent, pViewSh ); + return VclPtr<ScTextWnd>::Create( pParent, pViewSh ); + return VclPtr<ScInputBarGroup>::Create( pParent, pViewSh ); } ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : // With WB_CLIPCHILDREN otherwise we get flickering ToolBox ( pParent, WinBits(WB_CLIPCHILDREN) ), - aWndPos ( this ), - pRuntimeWindow ( lcl_chooseRuntimeImpl( this, pBind ) ), - aTextWindow ( *pRuntimeWindow ), + aWndPos ( VclPtr<ScPosWnd>::Create(this) ), + pRuntimeWindow ( lcl_chooseRuntimeImpl( this, pBind ) ), + aTextWindow ( *pRuntimeWindow ), pInputHdl ( NULL ), aTextOk ( ScResId( SCSTR_QHELP_BTNOK ) ), // Not always new as a Resource aTextCancel ( ScResId( SCSTR_QHELP_BTNCANCEL ) ), @@ -202,7 +202,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : OSL_ENSURE( pViewSh, "no view shell for input window" ); // Position window, 3 buttons, input window - InsertWindow ( 1, &aWndPos, ToolBoxItemBits::NONE, 0 ); + InsertWindow ( 1, aWndPos.get(), ToolBoxItemBits::NONE, 0 ); InsertSeparator ( 1 ); InsertItem ( SID_INPUT_FUNCTION, IMAGE( SID_INPUT_FUNCTION ), ToolBoxItemBits::NONE, 2 ); InsertItem ( SID_INPUT_SUM, IMAGE( SID_INPUT_SUM ), ToolBoxItemBits::NONE, 3 ); @@ -210,8 +210,8 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : InsertSeparator ( 5 ); InsertWindow ( 7, &aTextWindow, ToolBoxItemBits::NONE, 6 ); - aWndPos .SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) ); - aWndPos .SetHelpId ( HID_INSWIN_POS ); + aWndPos ->SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) ); + aWndPos ->SetHelpId ( HID_INSWIN_POS ); aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); aTextWindow.SetHelpId ( HID_INSWIN_INPUT ); @@ -227,7 +227,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : SetHelpId( HID_SC_INPUTWIN ); // For the whole input row - aWndPos .Show(); + aWndPos ->Show(); aTextWindow.Show(); pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set @@ -259,6 +259,11 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) : ScInputWindow::~ScInputWindow() { + disposeOnce(); +} + +void ScInputWindow::dispose() +{ bool bDown = ( ScGlobal::pSysLocale == NULL ); // after Clear? // if any view's input handler has a pointer to this input window, reset it @@ -282,6 +287,11 @@ ScInputWindow::~ScInputWindow() } SfxImageManager::GetImageManager( *SC_MOD() )->ReleaseToolBox( this ); + + pRuntimeWindow.disposeAndClear(); + aWndPos.disposeAndClear(); + + ToolBox::dispose(); } void ScInputWindow::SetInputHandler( ScInputHandler* pNew ) @@ -630,7 +640,7 @@ void ScInputWindow::SetFuncString( const OUString& rString, bool bDoEdit ) void ScInputWindow::SetPosString( const OUString& rStr ) { - aWndPos.SetPos( rStr ); + aWndPos->SetPos( rStr ); } void ScInputWindow::SetTextString( const OUString& rString ) @@ -690,7 +700,7 @@ void ScInputWindow::SetSumAssignMode() void ScInputWindow::SetFormulaMode( bool bSet ) { - aWndPos.SetFormulaMode(bSet); + aWndPos->SetFormulaMode(bSet); aTextWindow.SetFormulaMode(bSet); } @@ -755,7 +765,7 @@ void ScInputWindow::SwitchToTextWin() void ScInputWindow::PosGrabFocus() { - aWndPos.GrabFocus(); + aWndPos->GrabFocus(); } void ScInputWindow::EnableButtons( bool bEnable ) @@ -897,54 +907,62 @@ void ScInputWindow::MouseButtonUp( const MouseEvent& rMEvt ) ScInputBarGroup::ScInputBarGroup(vcl::Window* pParent, ScTabViewShell* pViewSh) : ScTextWndBase ( pParent, WinBits(WB_HIDE | WB_TABSTOP ) ), - aMultiTextWnd ( this, pViewSh ), - aButton ( this, WB_TABSTOP | WB_RECTSTYLE | WB_SMALLSTYLE ), - aScrollBar ( this, WB_TABSTOP | WB_VERT | WB_DRAG ), + aMultiTextWnd ( VclPtr<ScMultiTextWnd>::Create(this, pViewSh) ), + aButton ( VclPtr<ImageButton>::Create(this, WB_TABSTOP | WB_RECTSTYLE | WB_SMALLSTYLE) ), + aScrollBar ( VclPtr<ScrollBar>::Create(this, WB_TABSTOP | WB_VERT | WB_DRAG) ), nVertOffset ( 0 ) { - aMultiTextWnd.Show(); - aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); - aMultiTextWnd.SetHelpId( HID_INSWIN_INPUT ); + aMultiTextWnd->Show(); + aMultiTextWnd->SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) ); + aMultiTextWnd->SetHelpId( HID_INSWIN_INPUT ); - Size aSize( GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd.GetPixelHeightForLines(1) ); + Size aSize( GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd->GetPixelHeightForLines(1) ); - aButton.SetClickHdl( LINK( this, ScInputBarGroup, ClickHdl ) ); - aButton.SetSizePixel( aSize ); - aButton.Enable(); - aButton.SetSymbol( SymbolType::SPIN_DOWN ); - aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); - aButton.Show(); + aButton->SetClickHdl( LINK( this, ScInputBarGroup, ClickHdl ) ); + aButton->SetSizePixel( aSize ); + aButton->Enable(); + aButton->SetSymbol( SymbolType::SPIN_DOWN ); + aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); + aButton->Show(); - aScrollBar.SetSizePixel( aSize ); - aScrollBar.SetScrollHdl( LINK( this, ScInputBarGroup, Impl_ScrollHdl ) ); + aScrollBar->SetSizePixel( aSize ); + aScrollBar->SetScrollHdl( LINK( this, ScInputBarGroup, Impl_ScrollHdl ) ); } ScInputBarGroup::~ScInputBarGroup() { + disposeOnce(); +} +void ScInputBarGroup::dispose() +{ + aMultiTextWnd.disposeAndClear(); + aButton.disposeAndClear(); + aScrollBar.disposeAndClear(); + ScTextWndBase::dispose(); } void ScInputBarGroup::InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) { - aMultiTextWnd.InsertAccessibleTextData( rTextData ); + aMultiTextWnd->InsertAccessibleTextData( rTextData ); } void ScInputBarGroup::RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) { - aMultiTextWnd.RemoveAccessibleTextData( rTextData ); + aMultiTextWnd->RemoveAccessibleTextData( rTextData ); } const OUString& ScInputBarGroup::GetTextString() const { - return aMultiTextWnd.GetTextString(); + return aMultiTextWnd->GetTextString(); } void ScInputBarGroup::SetTextString( const OUString& rString ) { - aMultiTextWnd.SetTextString(rString); + aMultiTextWnd->SetTextString(rString); } void ScInputBarGroup::Resize() @@ -965,89 +983,89 @@ void ScInputBarGroup::Resize() Size aSize = GetSizePixel(); aSize.Width() = std::max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 ); - aScrollBar.SetPosPixel(Point( aSize.Width() - aButton.GetSizePixel().Width(), aButton.GetSizePixel().Height() ) ); + aScrollBar->SetPosPixel(Point( aSize.Width() - aButton->GetSizePixel().Width(), aButton->GetSizePixel().Height() ) ); Size aTmpSize( aSize ); - aTmpSize.Width() = aTmpSize.Width() - aButton.GetSizePixel().Width() - BUTTON_OFFSET; - aMultiTextWnd.SetSizePixel(aTmpSize); + aTmpSize.Width() = aTmpSize.Width() - aButton->GetSizePixel().Width() - BUTTON_OFFSET; + aMultiTextWnd->SetSizePixel(aTmpSize); - aMultiTextWnd.Resize(); + aMultiTextWnd->Resize(); - aSize.Height() = aMultiTextWnd.GetSizePixel().Height(); + aSize.Height() = aMultiTextWnd->GetSizePixel().Height(); SetSizePixel(aSize); - if( aMultiTextWnd.GetNumLines() > 1 ) + if( aMultiTextWnd->GetNumLines() > 1 ) { - aButton.SetSymbol( SymbolType::SPIN_UP ); - aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_COLLAPSE_FORMULA ) ); - Size scrollSize = aButton.GetSizePixel(); - scrollSize.Height() = aMultiTextWnd.GetSizePixel().Height() - aButton.GetSizePixel().Height(); - aScrollBar.SetSizePixel( scrollSize ); + aButton->SetSymbol( SymbolType::SPIN_UP ); + aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_COLLAPSE_FORMULA ) ); + Size scrollSize = aButton->GetSizePixel(); + scrollSize.Height() = aMultiTextWnd->GetSizePixel().Height() - aButton->GetSizePixel().Height(); + aScrollBar->SetSizePixel( scrollSize ); - Size aOutSz = aMultiTextWnd.GetOutputSize(); + Size aOutSz = aMultiTextWnd->GetOutputSize(); - aScrollBar.SetVisibleSize( aOutSz.Height() ); - aScrollBar.SetPageSize( aOutSz.Height() ); - aScrollBar.SetLineSize( aMultiTextWnd.GetTextHeight() ); - aScrollBar.SetRange( Range( 0, aMultiTextWnd.GetEditEngTxtHeight() ) ); + aScrollBar->SetVisibleSize( aOutSz.Height() ); + aScrollBar->SetPageSize( aOutSz.Height() ); + aScrollBar->SetLineSize( aMultiTextWnd->GetTextHeight() ); + aScrollBar->SetRange( Range( 0, aMultiTextWnd->GetEditEngTxtHeight() ) ); - aScrollBar.Resize(); - aScrollBar.Show(); + aScrollBar->Resize(); + aScrollBar->Show(); } else { - aButton.SetSymbol( SymbolType::SPIN_DOWN ); - aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); - aScrollBar.Hide(); + aButton->SetSymbol( SymbolType::SPIN_DOWN ); + aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); + aScrollBar->Hide(); } - aButton.SetPosPixel(Point(aSize.Width() - aButton.GetSizePixel().Width(), 0)); + aButton->SetPosPixel(Point(aSize.Width() - aButton->GetSizePixel().Width(), 0)); Invalidate(); } void ScInputBarGroup::StopEditEngine( bool bAll ) { - aMultiTextWnd.StopEditEngine( bAll ); + aMultiTextWnd->StopEditEngine( bAll ); } void ScInputBarGroup::StartEditEngine() { - aMultiTextWnd.StartEditEngine(); + aMultiTextWnd->StartEditEngine(); } void ScInputBarGroup::MakeDialogEditView() { - aMultiTextWnd.MakeDialogEditView(); + aMultiTextWnd->MakeDialogEditView(); } EditView* ScInputBarGroup::GetEditView() { - return aMultiTextWnd.GetEditView(); + return aMultiTextWnd->GetEditView(); } bool ScInputBarGroup::IsInputActive() { - return aMultiTextWnd.IsInputActive(); + return aMultiTextWnd->IsInputActive(); } void ScInputBarGroup::SetFormulaMode(bool bSet) { - aMultiTextWnd.SetFormulaMode(bSet); + aMultiTextWnd->SetFormulaMode(bSet); } void ScInputBarGroup::IncrementVerticalSize() { - aMultiTextWnd.SetNumLines( aMultiTextWnd.GetNumLines() + 1 ); + aMultiTextWnd->SetNumLines( aMultiTextWnd->GetNumLines() + 1 ); TriggerToolboxLayout(); } void ScInputBarGroup::DecrementVerticalSize() { - if ( aMultiTextWnd.GetNumLines() > 1 ) + if ( aMultiTextWnd->GetNumLines() > 1 ) { - aMultiTextWnd.SetNumLines( aMultiTextWnd.GetNumLines() - 1 ); + aMultiTextWnd->SetNumLines( aMultiTextWnd->GetNumLines() - 1 ); TriggerToolboxLayout(); } } @@ -1063,19 +1081,19 @@ IMPL_LINK_NOARG(ScInputBarGroup, ClickHdl) OSL_FAIL("The parent window pointer pParent is null"); return 1; } - if( aMultiTextWnd.GetNumLines() > 1 ) + if( aMultiTextWnd->GetNumLines() > 1 ) { - aMultiTextWnd.SetNumLines( 1 ); + aMultiTextWnd->SetNumLines( 1 ); } else { - aMultiTextWnd.SetNumLines( aMultiTextWnd.GetLastNumExpandedLines() ); + aMultiTextWnd->SetNumLines( aMultiTextWnd->GetLastNumExpandedLines() ); } TriggerToolboxLayout(); // Restore focus to input line(s) if necessary if ( SC_MOD()->GetInputHdl()->IsTopMode() ) - aMultiTextWnd.GrabFocus(); + aMultiTextWnd->GrabFocus(); return 0; } @@ -1104,7 +1122,7 @@ void ScInputBarGroup::TriggerToolboxLayout() if ( xLayoutManager.is() ) { - if ( aMultiTextWnd.GetNumLines() > 1) + if ( aMultiTextWnd->GetNumLines() > 1) rParent.SetToolbarLayoutMode( TBX_LAYOUT_LOCKVERT ); else rParent.SetToolbarLayoutMode( TBX_LAYOUT_NORMAL ); @@ -1132,13 +1150,13 @@ void ScInputBarGroup::TriggerToolboxLayout() IMPL_LINK_NOARG(ScInputBarGroup, Impl_ScrollHdl) { - aMultiTextWnd.DoScroll(); + aMultiTextWnd->DoScroll(); return 0; } void ScInputBarGroup::TextGrabFocus() { - aMultiTextWnd.TextGrabFocus(); + aMultiTextWnd->TextGrabFocus(); } ScMultiTextWnd::ScMultiTextWnd( ScInputBarGroup* pParen, ScTabViewShell* pViewSh ) @@ -1480,11 +1498,20 @@ ScTextWnd::ScTextWnd( vcl::Window* pParent, ScTabViewShell* pViewSh ) ScTextWnd::~ScTextWnd() { + disposeOnce(); +} + +void ScTextWnd::dispose() +{ while (!maAccTextDatas.empty()) { maAccTextDatas.back()->Dispose(); } delete pEditView; + pEditView = NULL; delete pEditEngine; + pEditEngine = NULL; + + ScTextWndBase::dispose(); } void ScTextWnd::Paint( const Rectangle& rRect ) @@ -2068,11 +2095,17 @@ ScPosWnd::ScPosWnd( vcl::Window* pParent ) : ScPosWnd::~ScPosWnd() { + disposeOnce(); +} + +void ScPosWnd::dispose() +{ EndListening( *SfxGetpApp() ); HideTip(); delete pAccel; + ComboBox::dispose(); } void ScPosWnd::SetFormulaMode( bool bSet ) diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 2115fec08daf..116aada89a07 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2094,9 +2094,9 @@ void ScModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) } } -SfxTabPage* ScModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) +VclPtr<SfxTabPage> ScModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) { - SfxTabPage* pRet = NULL; + VclPtr<SfxTabPage> pRet; ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); switch(nId) @@ -2105,7 +2105,7 @@ SfxTabPage* ScModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, cons { ::CreateTabPage ScTpLayoutOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_LAYOUT ); if ( ScTpLayoutOptionsCreate ) - pRet = (*ScTpLayoutOptionsCreate) (pParent, &rSet); + pRet = (*ScTpLayoutOptionsCreate) (pParent, &rSet); } break; case SID_SC_TP_CONTENT: @@ -2218,7 +2218,7 @@ IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo ) bool ScModule::RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ) { - std::list<vcl::Window*> & rlRefWindow = m_mapRefWindow[nSlotId]; + std::list<VclPtr<vcl::Window> > & rlRefWindow = m_mapRefWindow[nSlotId]; if( std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ) == rlRefWindow.end() ) { @@ -2231,14 +2231,14 @@ bool ScModule::RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ) bool ScModule::UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ) { - std::map<sal_uInt16, std::list<vcl::Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId ); + auto iSlot = m_mapRefWindow.find( nSlotId ); if( iSlot == m_mapRefWindow.end() ) return false; - std::list<vcl::Window*> & rlRefWindow = iSlot->second; + std::list<VclPtr<vcl::Window> > & rlRefWindow = iSlot->second; - std::list<vcl::Window*>::iterator i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ); + auto i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ); if( i == rlRefWindow.end() ) return false; @@ -2256,16 +2256,16 @@ vcl::Window * ScModule::Find1RefWindow( sal_uInt16 nSlotId, vcl::Window *pWndAn if (!pWndAncestor) return NULL; - std::map<sal_uInt16, std::list<vcl::Window*> >::iterator iSlot = m_mapRefWindow.find( nSlotId ); + auto iSlot = m_mapRefWindow.find( nSlotId ); if( iSlot == m_mapRefWindow.end() ) return NULL; - std::list<vcl::Window*> & rlRefWindow = iSlot->second; + std::list<VclPtr<vcl::Window> > & rlRefWindow = iSlot->second; while( vcl::Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent; - for( std::list<vcl::Window*>::iterator i = rlRefWindow.begin(); i!=rlRefWindow.end(); ++i ) + for( auto i = rlRefWindow.begin(); i!=rlRefWindow.end(); ++i ) if ( pWndAncestor->IsWindowOrChild( *i, (*i)->IsSystemWindow() ) ) return *i; diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 759b737918c7..815c10206486 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -337,13 +337,13 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt Rectangle aMMRect = pDoc->GetMMRect( aBlock.aStart.Col(), aBlock.aStart.Row(), aBlock.aEnd.Col(), aBlock.aEnd.Row(), aBlock.aStart.Tab() ); - VirtualDevice aVirtDev; - aVirtDev.SetOutputSizePixel( aVirtDev.LogicToPixel( aMMRect.GetSize(), MAP_100TH_MM ) ); + ScopedVclPtrInstance< VirtualDevice > pVirtDev; + pVirtDev->SetOutputSizePixel( pVirtDev->LogicToPixel( aMMRect.GetSize(), MAP_100TH_MM ) ); - PaintToDev( &aVirtDev, pDoc, 1.0, aBlock, false ); + PaintToDev( pVirtDev, pDoc, 1.0, aBlock, false ); - aVirtDev.SetMapMode( MapMode( MAP_PIXEL ) ); - Bitmap aBmp = aVirtDev.GetBitmap( Point(), aVirtDev.GetOutputSize() ); + pVirtDev->SetMapMode( MapMode( MAP_PIXEL ) ); + Bitmap aBmp = pVirtDev->GetBitmap( Point(), pVirtDev->GetOutputSize() ); bOK = SetBitmapEx( aBmp, rFlavor ); } else if ( nFormat == SotClipboardFormatId::GDIMETAFILE ) @@ -358,17 +358,17 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt // like SvEmbeddedTransfer::GetData: GDIMetaFile aMtf; - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; MapMode aMapMode( pEmbObj->GetMapUnit() ); Rectangle aVisArea( pEmbObj->GetVisArea( ASPECT_CONTENT ) ); - aVDev.EnableOutput( false ); - aVDev.SetMapMode( aMapMode ); + pVDev->EnableOutput( false ); + pVDev->SetMapMode( aMapMode ); aMtf.SetPrefSize( aVisArea.GetSize() ); aMtf.SetPrefMapMode( aMapMode ); - aMtf.Record( &aVDev ); + aMtf.Record( pVDev ); - pEmbObj->DoDraw( &aVDev, Point(), aVisArea.GetSize(), JobSetup(), ASPECT_CONTENT ); + pEmbObj->DoDraw( pVDev, Point(), aVisArea.GetSize(), JobSetup(), ASPECT_CONTENT ); aMtf.Stop(); aMtf.WindStart(); diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index a8ca5903bb2c..0e142fdfdb31 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -603,13 +603,13 @@ bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg ( vcl::Window* pParent, const OUString& aDatName, SvStream* pInStream, ScImportAsciiCall eCall ) { - ScImportAsciiDlg* pDlg = new ScImportAsciiDlg( pParent, aDatName,pInStream, eCall ); + VclPtr<ScImportAsciiDlg> pDlg = VclPtr<ScImportAsciiDlg>::Create( pParent, aDatName,pInStream, eCall ); return new AbstractScImportAsciiDlg_Impl( pDlg ); } AbstractScTextImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg(vcl::Window* pParent) { - ScTextImportOptionsDlg* pDlg = new ScTextImportOptionsDlg(pParent); + VclPtr<ScTextImportOptionsDlg> pDlg = VclPtr<ScTextImportOptionsDlg>::Create(pParent); return new AbstractScTextImportOptionsDlg_Impl(pDlg); } @@ -618,7 +618,7 @@ AbstractScAutoFormatDlg * ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg(vc const ScAutoFormatData* pSelFormatData, ScViewData *pViewData) { - ScAutoFormatDlg* pDlg = new ScAutoFormatDlg(pParent, pAutoFormat, pSelFormatData, pViewData); + VclPtr<ScAutoFormatDlg> pDlg = VclPtr<ScAutoFormatDlg>::Create(pParent, pAutoFormat, pSelFormatData, pViewData); return new AbstractScAutoFormatDlg_Impl(pDlg); } @@ -626,24 +626,24 @@ AbstractScColRowLabelDlg * ScAbstractDialogFactory_Impl::CreateScColRowLabelDlg bool bCol , bool bRow) { - ScColRowLabelDlg* pDlg = new ScColRowLabelDlg( pParent, bCol,bRow ); + VclPtr<ScColRowLabelDlg> pDlg = VclPtr<ScColRowLabelDlg>::Create( pParent, bCol,bRow ); return new AbstractScColRowLabelDlg_Impl( pDlg ); } AbstractScSortWarningDlg* ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( vcl::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) { - ScSortWarningDlg* pDlg = new ScSortWarningDlg(pParent, rExtendText, rCurrentText ); + VclPtr<ScSortWarningDlg> pDlg = VclPtr<ScSortWarningDlg>::Create(pParent, rExtendText, rCurrentText ); return new AbstractScSortWarningDlg_Impl( pDlg ); } AbstractScCondFormatManagerDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScAddress& rPos, int nId ) { - ScCondFormatManagerDlg* pDlg = NULL; + VclPtr<ScCondFormatManagerDlg> pDlg; switch( nId ) { case RID_SCDLG_COND_FORMAT_MANAGER: - pDlg = new ScCondFormatManagerDlg( pParent, pDoc, pFormatList, rPos ); + pDlg = VclPtr<ScCondFormatManagerDlg>::Create( pParent, pDoc, pFormatList, rPos ); break; default: break; @@ -656,14 +656,14 @@ AbstractScCondFormatManagerDlg* ScAbstractDialogFactory_Impl::CreateScCondFormat AbstractScDataPilotDatabaseDlg * ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(vcl::Window* pParent) { - ScDataPilotDatabaseDlg * pDlg = new ScDataPilotDatabaseDlg( pParent ); + VclPtr<ScDataPilotDatabaseDlg> pDlg = VclPtr<ScDataPilotDatabaseDlg>::Create( pParent ); return new AbstractScDataPilotDatabaseDlg_Impl( pDlg ); } AbstractScDataPilotSourceTypeDlg* ScAbstractDialogFactory_Impl::CreateScDataPilotSourceTypeDlg( vcl::Window* pParent, bool bEnableExternal) { - ScDataPilotSourceTypeDlg* pDlg = new ScDataPilotSourceTypeDlg(pParent, bEnableExternal); + VclPtr<ScDataPilotSourceTypeDlg> pDlg = VclPtr<ScDataPilotSourceTypeDlg>::Create(pParent, bEnableExternal); return new AbstractScDataPilotSourceTypeDlg_Impl(pDlg); } @@ -671,11 +671,11 @@ AbstractScDataPilotServiceDlg* ScAbstractDialogFactory_Impl::CreateScDataPilotSe const com::sun::star::uno::Sequence<OUString>& rServices, int nId ) { - ScDataPilotServiceDlg * pDlg=NULL; + VclPtr<ScDataPilotServiceDlg> pDlg; switch ( nId ) { case RID_SCDLG_DAPISERVICE : - pDlg = new ScDataPilotServiceDlg( pParent, rServices ); + pDlg = VclPtr<ScDataPilotServiceDlg>::Create( pParent, rServices ); break; default: break; @@ -689,21 +689,21 @@ AbstractScDataPilotServiceDlg* ScAbstractDialogFactory_Impl::CreateScDataPilotSe AbstractScDeleteCellDlg* ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove) { - ScDeleteCellDlg * pDlg = new ScDeleteCellDlg(pParent, bDisallowCellMove); + VclPtr<ScDeleteCellDlg> pDlg = VclPtr<ScDeleteCellDlg>::Create(pParent, bDisallowCellMove); return new AbstractScDeleteCellDlg_Impl( pDlg ); } AbstractScDataFormDlg* ScAbstractDialogFactory_Impl::CreateScDataFormDlg(vcl::Window* pParent, ScTabViewShell* pTabViewShell) { - ScDataFormDlg* pDlg = new ScDataFormDlg(pParent, pTabViewShell); + VclPtr<ScDataFormDlg> pDlg = VclPtr<ScDataFormDlg>::Create(pParent, pTabViewShell); return new AbstractScDataFormDlg_Impl(pDlg); } AbstractScDeleteContentsDlg* ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(vcl::Window* pParent, InsertDeleteFlags nCheckDefaults) { - ScDeleteContentsDlg* pDlg = new ScDeleteContentsDlg(pParent, nCheckDefaults); + VclPtr<ScDeleteContentsDlg> pDlg = VclPtr<ScDeleteContentsDlg>::Create(pParent, nCheckDefaults); return new AbstractScDeleteContentsDlg_Impl( pDlg ); } @@ -717,15 +717,15 @@ AbstractScFillSeriesDlg* ScAbstractDialogFactory_Impl::CreateScFillSeriesDlg( vc double fMax, sal_uInt16 nPossDir) { - ScFillSeriesDlg * pDlg = new ScFillSeriesDlg( pParent, rDocument,eFillDir, eFillCmd,eFillDateCmd, aStartStr,fStep,fMax,nPossDir); - return new AbstractScFillSeriesDlg_Impl( pDlg ); + VclPtr<ScFillSeriesDlg> pDlg = VclPtr<ScFillSeriesDlg>::Create( pParent, rDocument,eFillDir, eFillCmd,eFillDateCmd, aStartStr,fStep,fMax,nPossDir); + return new AbstractScFillSeriesDlg_Impl( pDlg ); } AbstractScGroupDlg* ScAbstractDialogFactory_Impl::CreateAbstractScGroupDlg( vcl::Window* pParent, bool bUnGroup, bool bRows ) { - ScGroupDlg * pDlg = new ScGroupDlg( pParent, bUnGroup, bRows); + VclPtr<ScGroupDlg> pDlg = VclPtr<ScGroupDlg>::Create( pParent, bUnGroup, bRows); return new AbstractScGroupDlg_Impl( pDlg ); } @@ -733,11 +733,11 @@ AbstractScInsertCellDlg * ScAbstractDialogFactory_Impl::CreateScInsertCellDlg( v int nId, bool bDisallowCellMove ) { - ScInsertCellDlg * pDlg=NULL; + VclPtr<ScInsertCellDlg> pDlg; switch ( nId ) { case RID_SCDLG_INSCELL : - pDlg = new ScInsertCellDlg( pParent, bDisallowCellMove); + pDlg = VclPtr<ScInsertCellDlg>::Create( pParent, bDisallowCellMove); break; default: break; @@ -752,27 +752,27 @@ AbstractScInsertContentsDlg * ScAbstractDialogFactory_Impl::CreateScInsertConten InsertDeleteFlags nCheckDefaults, const OUString* pStrTitle ) { - ScInsertContentsDlg * pDlg = new ScInsertContentsDlg(pParent, nCheckDefaults, pStrTitle); + VclPtr<ScInsertContentsDlg> pDlg = VclPtr<ScInsertContentsDlg>::Create(pParent, nCheckDefaults, pStrTitle); return new AbstractScInsertContentsDlg_Impl( pDlg ); } AbstractScInsertTableDlg * ScAbstractDialogFactory_Impl::CreateScInsertTableDlg(vcl::Window* pParent, ScViewData& rViewData, SCTAB nTabCount, bool bFromFile) { - ScInsertTableDlg* pDlg = new ScInsertTableDlg( pParent, rViewData,nTabCount, bFromFile ); + VclPtr<ScInsertTableDlg> pDlg = VclPtr<ScInsertTableDlg>::Create( pParent, rViewData,nTabCount, bFromFile ); return new AbstractScInsertTableDlg_Impl( pDlg ); } AbstractScSelEntryDlg * ScAbstractDialogFactory_Impl::CreateScSelEntryDlg ( vcl::Window* pParent, const std::vector<OUString> &rEntryList ) { - ScSelEntryDlg * pDlg = new ScSelEntryDlg( pParent, rEntryList ); + VclPtr<ScSelEntryDlg> pDlg = VclPtr<ScSelEntryDlg>::Create( pParent, rEntryList ); return new AbstractScSelEntryDlg_Impl( pDlg ); } AbstractScLinkedAreaDlg * ScAbstractDialogFactory_Impl::CreateScLinkedAreaDlg(vcl::Window* pParent) { - ScLinkedAreaDlg* pDlg = new ScLinkedAreaDlg( pParent ); + VclPtr<ScLinkedAreaDlg> pDlg = VclPtr<ScLinkedAreaDlg>::Create( pParent ); return new AbstractScLinkedAreaDlg_Impl( pDlg ); } @@ -787,7 +787,7 @@ AbstractScMetricInputDlg * ScAbstractDialogFactory_Impl::CreateScMetricInputDlg long nFirst, long nLast ) { - ScMetricInputDlg * pDlg = new ScMetricInputDlg(pParent, sDialogName, nCurrent ,nDefault, eFUnit, + VclPtr<ScMetricInputDlg> pDlg = VclPtr<ScMetricInputDlg>::Create(pParent, sDialogName, nCurrent ,nDefault, eFUnit, nDecimals, nMaximum , nMinimum , nFirst, nLast); return new AbstractScMetricInputDlg_Impl( pDlg ); } @@ -795,26 +795,26 @@ AbstractScMetricInputDlg * ScAbstractDialogFactory_Impl::CreateScMetricInputDlg AbstractScMoveTableDlg * ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(vcl::Window* pParent, const OUString& rDefault) { - ScMoveTableDlg * pDlg = new ScMoveTableDlg( pParent, rDefault ); + VclPtr<ScMoveTableDlg> pDlg = VclPtr<ScMoveTableDlg>::Create( pParent, rDefault ); return new AbstractScMoveTableDlg_Impl( pDlg ); } AbstractScNameCreateDlg * ScAbstractDialogFactory_Impl::CreateScNameCreateDlg(vcl::Window * pParent, sal_uInt16 nFlags) { - ScNameCreateDlg * pDlg = new ScNameCreateDlg( pParent, nFlags ); + VclPtr<ScNameCreateDlg> pDlg = VclPtr<ScNameCreateDlg>::Create( pParent, nFlags ); return new AbstractScNameCreateDlg_Impl( pDlg ); } AbstractScNamePasteDlg * ScAbstractDialogFactory_Impl::CreateScNamePasteDlg ( vcl::Window * pParent, ScDocShell* pShell, bool bInsList ) { - ScNamePasteDlg * pDlg = new ScNamePasteDlg( pParent, pShell, bInsList ); + VclPtr<ScNamePasteDlg> pDlg = VclPtr<ScNamePasteDlg>::Create( pParent, pShell, bInsList ); return new AbstractScNamePasteDlg_Impl( pDlg ); } AbstractScPivotFilterDlg * ScAbstractDialogFactory_Impl::CreateScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgSet, sal_uInt16 nSourceTab) { - ScPivotFilterDlg *pDlg = new ScPivotFilterDlg(pParent, rArgSet, nSourceTab); + VclPtr<ScPivotFilterDlg> pDlg = VclPtr<ScPivotFilterDlg>::Create(pParent, rArgSet, nSourceTab); return new AbstractScPivotFilterDlg_Impl(pDlg); } @@ -823,7 +823,7 @@ AbstractScDPFunctionDlg * ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg ( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) { - ScDPFunctionDlg * pDlg = new ScDPFunctionDlg( pParent, rLabelVec, rLabelData, rFuncData ); + VclPtr<ScDPFunctionDlg> pDlg = VclPtr<ScDPFunctionDlg>::Create( pParent, rLabelVec, rLabelData, rFuncData ); return new AbstractScDPFunctionDlg_Impl( pDlg ); } @@ -834,7 +834,7 @@ AbstractScDPSubtotalDlg * ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg ( const ScDPNameVec& rDataFields, bool bEnableLayout ) { - ScDPSubtotalDlg * pDlg = new ScDPSubtotalDlg( pParent, rDPObj, rLabelData, rFuncData, rDataFields, bEnableLayout ); + VclPtr<ScDPSubtotalDlg> pDlg = VclPtr<ScDPSubtotalDlg>::Create( pParent, rDPObj, rLabelData, rFuncData, rDataFields, bEnableLayout ); return new AbstractScDPSubtotalDlg_Impl( pDlg ); } @@ -842,7 +842,7 @@ AbstractScDPNumGroupDlg * ScAbstractDialogFactory_Impl::CreateScDPNumGroupDlg( vcl::Window* pParent, int nId, const ScDPNumGroupInfo& rInfo ) { if( nId == RID_SCDLG_DPNUMGROUP ) - return new AbstractScDPNumGroupDlg_Impl( new ScDPNumGroupDlg( pParent, rInfo ) ); + return new AbstractScDPNumGroupDlg_Impl( VclPtr<ScDPNumGroupDlg>::Create( pParent, rInfo ) ); return 0; } @@ -851,7 +851,7 @@ AbstractScDPDateGroupDlg * ScAbstractDialogFactory_Impl::CreateScDPDateGroupDlg( const ScDPNumGroupInfo& rInfo, sal_Int32 nDatePart, const Date& rNullDate ) { if( nId == RID_SCDLG_DPDATEGROUP ) - return new AbstractScDPDateGroupDlg_Impl( new ScDPDateGroupDlg( pParent, rInfo, nDatePart, rNullDate ) ); + return new AbstractScDPDateGroupDlg_Impl( VclPtr<ScDPDateGroupDlg>::Create( pParent, rInfo, nDatePart, rNullDate ) ); return 0; } @@ -859,20 +859,20 @@ AbstractScDPShowDetailDlg * ScAbstractDialogFactory_Impl::CreateScDPShowDetailDl vcl::Window* pParent, int nId, ScDPObject& rDPObj, sal_uInt16 nOrient ) { if( nId == RID_SCDLG_DPSHOWDETAIL ) - return new AbstractScDPShowDetailDlg_Impl( new ScDPShowDetailDlg( pParent, rDPObj, nOrient ) ); + return new AbstractScDPShowDetailDlg_Impl( VclPtr<ScDPShowDetailDlg>::Create( pParent, rDPObj, nOrient ) ); return 0; } AbstractScNewScenarioDlg * ScAbstractDialogFactory_Impl::CreateScNewScenarioDlg(vcl::Window* pParent, const OUString& rName, bool bEdit, bool bSheetProtected) { - ScNewScenarioDlg *pDlg = new ScNewScenarioDlg(pParent, rName, bEdit, bSheetProtected); + VclPtr<ScNewScenarioDlg> pDlg = VclPtr<ScNewScenarioDlg>::Create(pParent, rName, bEdit, bSheetProtected); return new AbstractScNewScenarioDlg_Impl( pDlg ); } AbstractScShowTabDlg * ScAbstractDialogFactory_Impl::CreateScShowTabDlg(vcl::Window* pParent) { - ScShowTabDlg * pDlg = new ScShowTabDlg( pParent); + VclPtr<ScShowTabDlg> pDlg = VclPtr<ScShowTabDlg>::Create( pParent); return new AbstractScShowTabDlg_Impl( pDlg ); } @@ -882,7 +882,7 @@ AbstractScStringInputDlg * ScAbstractDialogFactory_Impl::CreateScStringInputDlg const OUString& rDefault, const OString& sHelpId, const OString& sEditHelpId ) { - ScStringInputDlg *pDlg = new ScStringInputDlg( pParent, rTitle, rEditTitle, rDefault, sHelpId, sEditHelpId ); + VclPtr<ScStringInputDlg> pDlg = VclPtr<ScStringInputDlg>::Create( pParent, rTitle, rEditTitle, rDefault, sHelpId, sEditHelpId ); return new AbstractScStringInputDlg_Impl( pDlg ); } @@ -893,7 +893,7 @@ AbstractScTabBgColorDlg * ScAbstractDialogFactory_Impl::CreateScTabBgColorDlg( const Color& rDefaultColor, const OString& sHelpId) { - ScTabBgColorDlg * pDlg = new ScTabBgColorDlg( pParent, rTitle, rTabBgColorNoColorText, rDefaultColor, sHelpId ); + VclPtr<ScTabBgColorDlg> pDlg = VclPtr<ScTabBgColorDlg>::Create( pParent, rTitle, rTabBgColorNoColorText, rDefaultColor, sHelpId ); return new AbstractScTabBgColorDlg_Impl( pDlg ); } @@ -905,14 +905,14 @@ AbstractScImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScImportOptions bool bOnlyDbtoolsEncodings, bool bImport ) { - ScImportOptionsDlg * pDlg = new ScImportOptionsDlg( pParent, bAscii, pOptions,pStrTitle, bMultiByte,bOnlyDbtoolsEncodings, bImport ); + VclPtr<ScImportOptionsDlg> pDlg = VclPtr<ScImportOptionsDlg>::Create( pParent, bAscii, pOptions,pStrTitle, bMultiByte,bOnlyDbtoolsEncodings, bImport ); return new AbstractScImportOptionsDlg_Impl( pDlg ); } SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScAttrDlg(SfxViewFrame* pFrame, vcl::Window* pParent, const SfxItemSet* pCellAttrs) { - SfxTabDialog* pDlg = new ScAttrDlg(pFrame, pParent, pCellAttrs); + VclPtr<SfxTabDialog> pDlg = VclPtr<ScAttrDlg>::Create(pFrame, pParent, pCellAttrs); return new ScAbstractTabDialog_Impl(pDlg); } @@ -922,42 +922,42 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScHFEditDlg( SfxViewF const OUString& rPageStyle, sal_uInt16 nResId ) { - SfxTabDialog* pDlg = NULL; + VclPtr<SfxTabDialog> pDlg; switch (nResId) { case RID_SCDLG_HFED_HEADER: case RID_SCDLG_HFEDIT_HEADER: - pDlg = new ScHFEditHeaderDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditHeaderDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFED_FOOTER: case RID_SCDLG_HFEDIT_FOOTER: - pDlg = new ScHFEditFooterDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditFooterDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFEDIT_LEFTHEADER: - pDlg = new ScHFEditLeftHeaderDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditLeftHeaderDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFEDIT_RIGHTHEADER: - pDlg = new ScHFEditRightHeaderDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditRightHeaderDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFEDIT_LEFTFOOTER: - pDlg = new ScHFEditLeftFooterDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditLeftFooterDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFEDIT_RIGHTFOOTER: - pDlg = new ScHFEditRightFooterDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditRightFooterDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFEDIT_SHDR: - pDlg = new ScHFEditSharedHeaderDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditSharedHeaderDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFEDIT_SFTR: - pDlg = new ScHFEditSharedFooterDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditSharedFooterDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; case RID_SCDLG_HFEDIT_ALL: - pDlg = new ScHFEditAllDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditAllDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; default: case RID_SCDLG_HFEDIT: - pDlg = new ScHFEditActiveDlg(pFrame, pParent, rCoreSet, rPageStyle); + pDlg = VclPtr<ScHFEditActiveDlg>::Create(pFrame, pParent, rCoreSet, rPageStyle); break; } @@ -969,12 +969,12 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScStyleDlg( vcl::Wind sal_uInt16 nRscId, int nId) { - SfxTabDialog* pDlg=NULL; + VclPtr<SfxTabDialog> pDlg; switch ( nId ) { case RID_SCDLG_STYLES_PAGE : case RID_SCDLG_STYLES_PAR : - pDlg = new ScStyleDlg( pParent, rStyleBase, nRscId ); + pDlg = VclPtr<ScStyleDlg>::Create( pParent, rStyleBase, nRscId ); break; default: break; @@ -987,34 +987,34 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScStyleDlg( vcl::Wind SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSubTotalDlg(vcl::Window* pParent, const SfxItemSet* pArgSet) { - SfxTabDialog* pDlg = new ScSubTotalDlg( pParent, pArgSet ); + VclPtr<SfxTabDialog> pDlg = VclPtr<ScSubTotalDlg>::Create( pParent, pArgSet ); return new ScAbstractTabDialog_Impl( pDlg ); } SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScCharDlg( vcl::Window* pParent, const SfxItemSet* pAttr, const SfxObjectShell* pDocShell) { - SfxTabDialog* pDlg = new ScCharDlg(pParent, pAttr, pDocShell); + VclPtr<SfxTabDialog> pDlg = VclPtr<ScCharDlg>::Create(pParent, pAttr, pDocShell); return new ScAbstractTabDialog_Impl(pDlg); } SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScParagraphDlg( vcl::Window* pParent, const SfxItemSet* pAttr) { - SfxTabDialog* pDlg = new ScParagraphDlg(pParent, pAttr); + VclPtr<SfxTabDialog> pDlg = VclPtr<ScParagraphDlg>::Create(pParent, pAttr); return new ScAbstractTabDialog_Impl(pDlg); } SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScValidationDlg(vcl::Window* pParent, const SfxItemSet* pArgSet, ScTabViewShell *pTabVwSh) { - SfxTabDialog* pDlg = new ScValidationDlg(pParent, pArgSet, pTabVwSh); + VclPtr<SfxTabDialog> pDlg = VclPtr<ScValidationDlg>::Create(pParent, pArgSet, pTabVwSh); return new ScAbstractTabDialog_Impl(pDlg); } SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg(vcl::Window* pParent, const SfxItemSet* pArgSet) { - SfxTabDialog* pDlg = new ScSortDlg( pParent, pArgSet ); + VclPtr<SfxTabDialog> pDlg = VclPtr<ScSortDlg>::Create( pParent, pArgSet ); return new ScAbstractTabDialog_Impl( pDlg ); } diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 6e493396bad5..216c3c8a8211 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -58,7 +58,7 @@ class ScTextImportOptionsDlg; class ScCondFormatManagerDlg; #define DECL_ABSTDLG_BASE(Class,DialogClass) \ - DialogClass* pDlg; \ + ScopedVclPtr<DialogClass> pDlg; \ public: \ Class( DialogClass* p) \ : pDlg(p) \ @@ -66,8 +66,8 @@ public: \ virtual ~Class(); \ virtual short Execute() SAL_OVERRIDE ; -#define DECL_ABSTDLG2_BASE(Class,DialogClass) \ - DialogClass* pDlg; \ +#define DECL_ABSTDLG2_BASE(Class,DialogClass) \ + ScopedVclPtr<DialogClass> pDlg; \ public: \ Class( DialogClass* p) \ : pDlg(p) \ @@ -79,9 +79,8 @@ public: \ #define IMPL_ABSTDLG_BASE(Class) \ Class::~Class() \ { \ - delete pDlg; \ } \ -short Class::Execute() \ +short Class::Execute() \ { \ return pDlg->Execute(); \ } @@ -89,7 +88,6 @@ short Class::Execute() \ #define IMPL_ABSTDLG2_BASE(Class) \ Class::~Class() \ { \ - delete pDlg; \ } \ void Class::StartExecuteModal( const Link& rEndDialogHdl ) \ { \ diff --git a/sc/source/ui/attrdlg/scuiexp.cxx b/sc/source/ui/attrdlg/scuiexp.cxx index f3e026f24ff2..374e8ad74d15 100644 --- a/sc/source/ui/attrdlg/scuiexp.cxx +++ b/sc/source/ui/attrdlg/scuiexp.cxx @@ -20,6 +20,36 @@ #undef SC_DLLIMPLEMENTATION #include "scdlgfact.hxx" +#include "corodlg.hxx" +#include "condformatmgr.hxx" +#include "dapitype.hxx" +#include "dapidata.hxx" +#include "datafdlg.hxx" +#include "delcodlg.hxx" +#include "delcldlg.hxx" +#include "dpgroupdlg.hxx" +#include "filldlg.hxx" +#include "groupdlg.hxx" +#include "linkarea.hxx" +#include "lbseldlg.hxx" +#include "inscldlg.hxx" +#include "instbdlg.hxx" +#include "inscodlg.hxx" +#include "mtrindlg.hxx" +#include "mvtabdlg.hxx" +#include "namecrea.hxx" +#include "namepast.hxx" +#include "pfiltdlg.hxx" +#include "pvfundlg.hxx" +#include "shtabdlg.hxx" +#include "scendlg.hxx" +#include "scuiasciiopt.hxx" +#include "scuiautofmt.hxx" +#include "scuiimoptdlg.hxx" +#include "sortdlg.hxx" +#include "strindlg.hxx" +#include "tabbgcolordlg.hxx" +#include "textimportoptions.hxx" #include <sal/types.h> namespace scui diff --git a/sc/source/ui/attrdlg/tabpages.cxx b/sc/source/ui/attrdlg/tabpages.cxx index 2202754e7192..163b8742fc4c 100644 --- a/sc/source/ui/attrdlg/tabpages.cxx +++ b/sc/source/ui/attrdlg/tabpages.cxx @@ -59,9 +59,23 @@ ScTabPageProtection::ScTabPageProtection(vcl::Window* pParent, const SfxItemSet& m_pBtnHidePrint->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); } -SfxTabPage* ScTabPageProtection::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +ScTabPageProtection::~ScTabPageProtection() { - return ( new ScTabPageProtection( pParent, *rAttrSet ) ); + disposeOnce(); +} + +void ScTabPageProtection::dispose() +{ + m_pBtnHideCell.clear(); + m_pBtnProtect.clear(); + m_pBtnHideFormula.clear(); + m_pBtnHidePrint.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> ScTabPageProtection::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>( new ScTabPageProtection( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); } void ScTabPageProtection::Reset( const SfxItemSet* rCoreAttrs ) diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 4e73d9ef5e77..3fa8a6a8d6ab 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -97,7 +97,14 @@ ScMenuFloatingWindow::ScMenuFloatingWindow(vcl::Window* pParent, ScDocument* pDo ScMenuFloatingWindow::~ScMenuFloatingWindow() { + disposeOnce(); +} + +void ScMenuFloatingWindow::dispose() +{ EndPopupMode(); + mpParentMenu.clear(); + PopupMenuFloatingWindow::dispose(); } void ScMenuFloatingWindow::PopupModeEnd() @@ -307,7 +314,7 @@ ScMenuFloatingWindow* ScMenuFloatingWindow::addSubMenuItem(const OUString& rText MenuItemData aItem; aItem.maText = rText; aItem.mbEnabled = bEnabled; - aItem.mpSubMenuWin.reset(new ScMenuFloatingWindow(this, mpDoc, GetMenuStackLevel()+1)); + aItem.mpSubMenuWin.reset(VclPtr<ScMenuFloatingWindow>::Create(this, mpDoc, GetMenuStackLevel()+1)); aItem.mpSubMenuWin->setName(rText); maMenuItems.push_back(aItem); return aItem.mpSubMenuWin.get(); @@ -848,6 +855,17 @@ ScCheckListMenuWindow::Member::Member() ScCheckListMenuWindow::CancelButton::CancelButton(ScCheckListMenuWindow* pParent) : ::CancelButton(pParent), mpParent(pParent) {} +ScCheckListMenuWindow::CancelButton::~CancelButton() +{ + disposeOnce(); +} + +void ScCheckListMenuWindow::CancelButton::dispose() +{ + mpParent.clear(); + ::CancelButton::dispose(); +} + void ScCheckListMenuWindow::CancelButton::Click() { mpParent->EndPopupMode(); @@ -856,13 +874,13 @@ void ScCheckListMenuWindow::CancelButton::Click() ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc) : ScMenuFloatingWindow(pParent, pDoc), - maEdSearch(this), - maChecks(this, WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ), - maChkToggleAll(this, 0), - maBtnSelectSingle (this, 0), - maBtnUnselectSingle(this, 0), - maBtnOk(this), - maBtnCancel(this), + maEdSearch(new Edit (this)), + maChecks(VclPtr<ScCheckListBox>::Create(this, WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ), + maChkToggleAll(VclPtr<TriStateBox>::Create(this, 0)), + maBtnSelectSingle(VclPtr<ImageButton>::Create(this, 0)), + maBtnUnselectSingle(VclPtr<ImageButton>::Create(this, 0)), + maBtnOk(VclPtr<OKButton>::Create(this)), + maBtnCancel(VclPtr<CancelButton>::Create(this)), mnCurTabStop(0), mpExtendedData(NULL), mpOKAction(NULL), @@ -876,20 +894,32 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* p maTabStopCtrls.reserve(8); maTabStopCtrls.push_back(this); - maTabStopCtrls.push_back(&maEdSearch); - maTabStopCtrls.push_back(&maChecks); - maTabStopCtrls.push_back(&maChkToggleAll); - maTabStopCtrls.push_back(&maBtnSelectSingle); - maTabStopCtrls.push_back(&maBtnUnselectSingle); - maTabStopCtrls.push_back(&maBtnOk); - maTabStopCtrls.push_back(&maBtnCancel); + maTabStopCtrls.push_back(maEdSearch.get()); + maTabStopCtrls.push_back(maChecks.get()); + maTabStopCtrls.push_back(maChkToggleAll.get()); + maTabStopCtrls.push_back(maBtnSelectSingle.get()); + maTabStopCtrls.push_back(maBtnUnselectSingle.get()); + maTabStopCtrls.push_back(maBtnOk.get()); + maTabStopCtrls.push_back(maBtnCancel.get()); // Enable type-ahead search in the check list box. - maChecks.SetStyle(maChecks.GetStyle() | WB_QUICK_SEARCH); + maChecks->SetStyle(maChecks->GetStyle() | WB_QUICK_SEARCH); } ScCheckListMenuWindow::~ScCheckListMenuWindow() { + disposeOnce(); +} + +void ScCheckListMenuWindow::dispose() +{ + maChecks.disposeAndClear(); + maChkToggleAll.disposeAndClear(); + maBtnSelectSingle.disposeAndClear(); + maBtnUnselectSingle.disposeAndClear(); + maBtnOk.disposeAndClear(); + maBtnCancel.disposeAndClear(); + ScMenuFloatingWindow::dispose(); } void ScCheckListMenuWindow::getSectionPosSize( @@ -958,7 +988,7 @@ void ScCheckListMenuWindow::getSectionPosSize( break; case CHECK_TOGGLE_ALL: { - long h = std::min(maChkToggleAll.CalcMinimumSize().Height(), 26L); + long h = std::min(maChkToggleAll->CalcMinimumSize().Height(), 26L); rPos = Point(nListBoxMargin, nSingleBtnAreaY); rPos.X() += 5; rPos.Y() += (nSingleItemBtnAreaHeight - h)/2; @@ -1029,38 +1059,38 @@ void ScCheckListMenuWindow::packWindow() SetOutputSizePixel(aSize); getSectionPosSize(aPos, aSize, BTN_OK); - maBtnOk.SetPosSizePixel(aPos, aSize); - maBtnOk.SetFont(getLabelFont()); - maBtnOk.SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); - maBtnOk.Show(); + maBtnOk->SetPosSizePixel(aPos, aSize); + maBtnOk->SetFont(getLabelFont()); + maBtnOk->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); + maBtnOk->Show(); getSectionPosSize(aPos, aSize, BTN_CANCEL); - maBtnCancel.SetPosSizePixel(aPos, aSize); - maBtnCancel.SetFont(getLabelFont()); - maBtnCancel.Show(); + maBtnCancel->SetPosSizePixel(aPos, aSize); + maBtnCancel->SetFont(getLabelFont()); + maBtnCancel->Show(); getSectionPosSize(aPos, aSize, EDIT_SEARCH); - maEdSearch.SetPosSizePixel(aPos, aSize); - maEdSearch.SetFont(getLabelFont()); - maEdSearch.SetControlBackground(rStyle.GetFieldColor()); - maEdSearch.SetPlaceholderText(SC_STRLOAD(RID_POPUP_FILTER, STR_EDIT_SEARCH_ITEMS)); - maEdSearch.SetModifyHdl( LINK(this, ScCheckListMenuWindow, EdModifyHdl) ); - maEdSearch.Show(); + maEdSearch->SetPosSizePixel(aPos, aSize); + maEdSearch->SetFont(getLabelFont()); + maEdSearch->SetControlBackground(rStyle.GetFieldColor()); + maEdSearch->SetPlaceholderText(SC_STRLOAD(RID_POPUP_FILTER, STR_EDIT_SEARCH_ITEMS)); + maEdSearch->SetModifyHdl( LINK(this, ScCheckListMenuWindow, EdModifyHdl) ); + maEdSearch->Show(); getSectionPosSize(aPos, aSize, LISTBOX_AREA_INNER); - maChecks.SetPosSizePixel(aPos, aSize); - maChecks.SetFont(getLabelFont()); - maChecks.SetCheckButtonHdl( LINK(this, ScCheckListMenuWindow, CheckHdl) ); - maChecks.Show(); + maChecks->SetPosSizePixel(aPos, aSize); + maChecks->SetFont(getLabelFont()); + maChecks->SetCheckButtonHdl( LINK(this, ScCheckListMenuWindow, CheckHdl) ); + maChecks->Show(); getSectionPosSize(aPos, aSize, CHECK_TOGGLE_ALL); - maChkToggleAll.SetPosSizePixel(aPos, aSize); - maChkToggleAll.SetFont(getLabelFont()); - maChkToggleAll.SetText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_TOGGLE_ALL)); - maChkToggleAll.SetTextColor(rStyle.GetMenuTextColor()); - maChkToggleAll.SetControlBackground(rStyle.GetMenuColor()); - maChkToggleAll.SetClickHdl( LINK(this, ScCheckListMenuWindow, TriStateHdl) ); - maChkToggleAll.Show(); + maChkToggleAll->SetPosSizePixel(aPos, aSize); + maChkToggleAll->SetFont(getLabelFont()); + maChkToggleAll->SetText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_TOGGLE_ALL)); + maChkToggleAll->SetTextColor(rStyle.GetMenuTextColor()); + maChkToggleAll->SetControlBackground(rStyle.GetMenuColor()); + maChkToggleAll->SetClickHdl( LINK(this, ScCheckListMenuWindow, TriStateHdl) ); + maChkToggleAll->Show(); sal_Int32 nScaleFactor = GetDPIScaleFactor(); @@ -1073,11 +1103,11 @@ void ScCheckListMenuWindow::packWindow() } getSectionPosSize(aPos, aSize, BTN_SINGLE_SELECT); - maBtnSelectSingle.SetPosSizePixel(aPos, aSize); - maBtnSelectSingle.SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_SELECT_CURRENT)); - maBtnSelectSingle.SetModeImage(aSingleSelect); - maBtnSelectSingle.SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); - maBtnSelectSingle.Show(); + maBtnSelectSingle->SetPosSizePixel(aPos, aSize); + maBtnSelectSingle->SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_SELECT_CURRENT)); + maBtnSelectSingle->SetModeImage(aSingleSelect); + maBtnSelectSingle->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); + maBtnSelectSingle->Show(); Image aSingleUnselect(ScResId(RID_IMG_UNSELECT_CURRENT)); if (nScaleFactor != 1) @@ -1088,11 +1118,11 @@ void ScCheckListMenuWindow::packWindow() } getSectionPosSize(aPos, aSize, BTN_SINGLE_UNSELECT); - maBtnUnselectSingle.SetPosSizePixel(aPos, aSize); - maBtnUnselectSingle.SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_UNSELECT_CURRENT)); - maBtnUnselectSingle.SetModeImage(aSingleUnselect); - maBtnUnselectSingle.SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); - maBtnUnselectSingle.Show(); + maBtnUnselectSingle->SetPosSizePixel(aPos, aSize); + maBtnUnselectSingle->SetQuickHelpText(SC_STRLOAD(RID_POPUP_FILTER, STR_BTN_UNSELECT_CURRENT)); + maBtnUnselectSingle->SetModeImage(aSingleUnselect); + maBtnUnselectSingle->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) ); + maBtnUnselectSingle->Show(); } void ScCheckListMenuWindow::setAllMemberState(bool bSet) @@ -1103,21 +1133,21 @@ void ScCheckListMenuWindow::setAllMemberState(bool bSet) aLabel = maMembers[i].maName; if (aLabel.isEmpty()) aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); - maChecks.ShowCheckEntry( aLabel, maMembers[i].mpParent, true, bSet); + maChecks->ShowCheckEntry( aLabel, maMembers[i].mpParent, true, bSet); } if (!maConfig.mbAllowEmptySet) // We need to have at least one member selected. - maBtnOk.Enable(maChecks.GetCheckedEntryCount() != 0); + maBtnOk->Enable(maChecks->GetCheckedEntryCount() != 0); } void ScCheckListMenuWindow::selectCurrentMemberOnly(bool bSet) { setAllMemberState(!bSet); - SvTreeListEntry* pEntry = maChecks.GetCurEntry(); + SvTreeListEntry* pEntry = maChecks->GetCurEntry(); if (!pEntry) return; - maChecks.CheckEntry(pEntry, bSet ); + maChecks->CheckEntry(pEntry, bSet ); } void ScCheckListMenuWindow::cycleFocus(bool bReverse) @@ -1146,17 +1176,17 @@ void ScCheckListMenuWindow::cycleFocus(bool bReverse) IMPL_LINK( ScCheckListMenuWindow, ButtonHdl, Button*, pBtn ) { - if (pBtn == &maBtnOk) + if (pBtn == maBtnOk.get()) close(true); - else if (pBtn == &maBtnSelectSingle) + else if (pBtn == maBtnSelectSingle.get()) { selectCurrentMemberOnly(true); - CheckHdl(&maChecks); + CheckHdl(maChecks.get()); } - else if (pBtn == &maBtnUnselectSingle) + else if (pBtn == maBtnUnselectSingle.get()) { selectCurrentMemberOnly(false); - CheckHdl(&maChecks); + CheckHdl(maChecks.get()); } return 0; } @@ -1166,27 +1196,27 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, TriStateHdl) switch (mePrevToggleAllState) { case TRISTATE_FALSE: - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); setAllMemberState(true); break; case TRISTATE_TRUE: - maChkToggleAll.SetState(TRISTATE_FALSE); + maChkToggleAll->SetState(TRISTATE_FALSE); setAllMemberState(false); break; case TRISTATE_INDET: default: - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); setAllMemberState(true); break; } - mePrevToggleAllState = maChkToggleAll.GetState(); + mePrevToggleAllState = maChkToggleAll->GetState(); return 0; } IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl) { - OUString aSearchText = maEdSearch.GetText(); + OUString aSearchText = maEdSearch->GetText(); aSearchText = aSearchText.toAsciiLowerCase(); bool bSearchTextEmpty = aSearchText.isEmpty(); size_t n = maMembers.size(); @@ -1202,7 +1232,7 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl) if ( bSearchTextEmpty ) { - maChecks.ShowCheckEntry( aLabelDisp, maMembers[i].mpParent, true, maMembers[i].mbVisible ); + maChecks->ShowCheckEntry( aLabelDisp, maMembers[i].mpParent, true, maMembers[i].mbVisible ); if ( maMembers[i].mbVisible ) ++nSelCount; continue; @@ -1210,45 +1240,45 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl) if ( aLabelDisp.toAsciiLowerCase().indexOf( aSearchText ) != -1 ) { - maChecks.ShowCheckEntry( aLabelDisp, maMembers[i].mpParent, true, true ); + maChecks->ShowCheckEntry( aLabelDisp, maMembers[i].mpParent, true, true ); ++nSelCount; } else - maChecks.ShowCheckEntry( aLabelDisp, maMembers[i].mpParent, false, false ); + maChecks->ShowCheckEntry( aLabelDisp, maMembers[i].mpParent, false, false ); } if ( nSelCount == n ) - maChkToggleAll.SetState( TRISTATE_TRUE ); + maChkToggleAll->SetState( TRISTATE_TRUE ); else if ( nSelCount == 0 ) - maChkToggleAll.SetState( TRISTATE_FALSE ); + maChkToggleAll->SetState( TRISTATE_FALSE ); else - maChkToggleAll.SetState( TRISTATE_INDET ); + maChkToggleAll->SetState( TRISTATE_INDET ); return 0; } IMPL_LINK( ScCheckListMenuWindow, CheckHdl, SvTreeListBox*, pChecks ) { - if (pChecks != &maChecks) + if (pChecks != maChecks.get()) return 0; SvTreeListEntry* pEntry = pChecks->GetHdlEntry(); if ( pEntry ) - maChecks.CheckEntry( pEntry, ( pChecks->GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) ); - size_t nNumChecked = maChecks.GetCheckedEntryCount(); + maChecks->CheckEntry( pEntry, ( pChecks->GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) ); + size_t nNumChecked = maChecks->GetCheckedEntryCount(); if (nNumChecked == maMembers.size()) // all members visible - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); else if (nNumChecked == 0) // no members visible - maChkToggleAll.SetState(TRISTATE_FALSE); + maChkToggleAll->SetState(TRISTATE_FALSE); else - maChkToggleAll.SetState(TRISTATE_INDET); + maChkToggleAll->SetState(TRISTATE_INDET); if (!maConfig.mbAllowEmptySet) // We need to have at least one member selected. - maBtnOk.Enable(nNumChecked != 0); + maBtnOk->Enable(nNumChecked != 0); - mePrevToggleAllState = maChkToggleAll.GetState(); + mePrevToggleAllState = maChkToggleAll->GetState(); return 0; } @@ -1315,19 +1345,19 @@ Reference<XAccessible> ScCheckListMenuWindow::CreateAccessible() fillMenuItemsToAccessible(pAccTop); pAccTop->setAccessibleChild( - maEdSearch.CreateAccessible(), ScAccessibleFilterTopWindow::EDIT_SEARCH_BOX); + maEdSearch->CreateAccessible(), ScAccessibleFilterTopWindow::EDIT_SEARCH_BOX); pAccTop->setAccessibleChild( - maChecks.CreateAccessible(), ScAccessibleFilterTopWindow::LISTBOX); + maChecks->CreateAccessible(), ScAccessibleFilterTopWindow::LISTBOX); pAccTop->setAccessibleChild( - maChkToggleAll.CreateAccessible(), ScAccessibleFilterTopWindow::TOGGLE_ALL); + maChkToggleAll->CreateAccessible(), ScAccessibleFilterTopWindow::TOGGLE_ALL); pAccTop->setAccessibleChild( - maBtnSelectSingle.CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_ON_BTN); + maBtnSelectSingle->CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_ON_BTN); pAccTop->setAccessibleChild( - maBtnUnselectSingle.CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_OFF_BTN); + maBtnUnselectSingle->CreateAccessible(), ScAccessibleFilterTopWindow::SINGLE_OFF_BTN); pAccTop->setAccessibleChild( - maBtnOk.CreateAccessible(), ScAccessibleFilterTopWindow::OK_BTN); + maBtnOk->CreateAccessible(), ScAccessibleFilterTopWindow::OK_BTN); pAccTop->setAccessibleChild( - maBtnCancel.CreateAccessible(), ScAccessibleFilterTopWindow::CANCEL_BTN); + maBtnCancel->CreateAccessible(), ScAccessibleFilterTopWindow::CANCEL_BTN); } return mxAccessible; @@ -1361,12 +1391,12 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b OUString aMonthName = aMonths[nMonth-1].FullName; OUString aDayName = OUString::number(nDay); - maChecks.SetUpdateMode(false); + maChecks->SetUpdateMode(false); - SvTreeListEntry* pYearEntry = maChecks.FindEntry(NULL, aYearName); + SvTreeListEntry* pYearEntry = maChecks->FindEntry(NULL, aYearName); if (!pYearEntry) { - pYearEntry = maChecks.InsertEntry(aYearName, NULL, true); + pYearEntry = maChecks->InsertEntry(aYearName, NULL, true); Member aMemYear; aMemYear.maName = aYearName; aMemYear.maRealName = rsName; @@ -1377,10 +1407,10 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b maMembers.push_back(aMemYear); } - SvTreeListEntry* pMonthEntry = maChecks.FindEntry(pYearEntry, aMonthName); + SvTreeListEntry* pMonthEntry = maChecks->FindEntry(pYearEntry, aMonthName); if (!pMonthEntry) { - pMonthEntry = maChecks.InsertEntry(aMonthName, pYearEntry, true); + pMonthEntry = maChecks->InsertEntry(aMonthName, pYearEntry, true); Member aMemMonth; aMemMonth.maName = aMonthName; aMemMonth.maRealName = rsName; @@ -1391,10 +1421,10 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b maMembers.push_back(aMemMonth); } - SvTreeListEntry* pDayEntry = maChecks.FindEntry(pMonthEntry, aDayName); + SvTreeListEntry* pDayEntry = maChecks->FindEntry(pMonthEntry, aDayName); if (!pDayEntry) { - maChecks.InsertEntry(aDayName, pMonthEntry, false); + maChecks->InsertEntry(aDayName, pMonthEntry, false); Member aMemDay; aMemDay.maName = aDayName; aMemDay.maRealName = rsName; @@ -1405,7 +1435,7 @@ void ScCheckListMenuWindow::addDateMember(const OUString& rsName, double nVal, b maMembers.push_back(aMemDay); } - maChecks.SetUpdateMode(true); + maChecks->SetUpdateMode(true); } void ScCheckListMenuWindow::addMember(const OUString& rName, bool bVisible) @@ -1591,20 +1621,20 @@ void ScCheckListMenuWindow::initMembers() size_t n = maMembers.size(); size_t nVisMemCount = 0; - maChecks.SetUpdateMode(false); - maChecks.GetModel()->EnableInvalidate(false); + maChecks->SetUpdateMode(false); + maChecks->GetModel()->EnableInvalidate(false); for (size_t i = 0; i < n; ++i) { if (maMembers[i].mbDate) { - maChecks.CheckEntry(maMembers[i].maName, maMembers[i].mpParent, maMembers[i].mbVisible); + maChecks->CheckEntry(maMembers[i].maName, maMembers[i].mpParent, maMembers[i].mbVisible); // Expand first node of checked dates - if (!maMembers[i].mpParent && maChecks.IsChecked(maMembers[i].maName, maMembers[i].mpParent)) + if (!maMembers[i].mpParent && maChecks->IsChecked(maMembers[i].maName, maMembers[i].mpParent)) { - SvTreeListEntry* pEntry = maChecks.FindEntry(NULL, maMembers[i].maName); + SvTreeListEntry* pEntry = maChecks->FindEntry(NULL, maMembers[i].maName); if (pEntry) - maChecks.Expand(pEntry); + maChecks->Expand(pEntry); } } else @@ -1612,11 +1642,11 @@ void ScCheckListMenuWindow::initMembers() OUString aLabel = maMembers[i].maName; if (aLabel.isEmpty()) aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); - SvTreeListEntry* pEntry = maChecks.InsertEntry( + SvTreeListEntry* pEntry = maChecks->InsertEntry( aLabel, NULL, false, TREELIST_APPEND, NULL, SvLBoxButtonKind_enabledCheckbox); - maChecks.SetCheckButtonState( + maChecks->SetCheckButtonState( pEntry, maMembers[i].mbVisible ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED); } @@ -1626,23 +1656,23 @@ void ScCheckListMenuWindow::initMembers() if (nVisMemCount == n) { // all members visible - maChkToggleAll.SetState(TRISTATE_TRUE); + maChkToggleAll->SetState(TRISTATE_TRUE); mePrevToggleAllState = TRISTATE_TRUE; } else if (nVisMemCount == 0) { // no members visible - maChkToggleAll.SetState(TRISTATE_FALSE); + maChkToggleAll->SetState(TRISTATE_FALSE); mePrevToggleAllState = TRISTATE_FALSE; } else { - maChkToggleAll.SetState(TRISTATE_INDET); + maChkToggleAll->SetState(TRISTATE_INDET); mePrevToggleAllState = TRISTATE_INDET; } - maChecks.GetModel()->EnableInvalidate(true); - maChecks.SetUpdateMode(true); + maChecks->GetModel()->EnableInvalidate(true); + maChecks->SetUpdateMode(true); } void ScCheckListMenuWindow::setConfig(const Config& rConfig) @@ -1652,7 +1682,7 @@ void ScCheckListMenuWindow::setConfig(const Config& rConfig) bool ScCheckListMenuWindow::isAllSelected() const { - return maChkToggleAll.IsChecked(); + return maChkToggleAll->IsChecked(); } void ScCheckListMenuWindow::getResult(ResultType& rResult) @@ -1666,7 +1696,7 @@ void ScCheckListMenuWindow::getResult(ResultType& rResult) OUString aLabel = maMembers[i].maName; if (aLabel.isEmpty()) aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); - bool bState = maChecks.IsChecked( aLabel, maMembers[i].mpParent ); + bool bState = maChecks->IsChecked( aLabel, maMembers[i].mpParent ); OUString sName; if ( maMembers[i].mbDate ) sName = maMembers[i].maRealName; @@ -1683,7 +1713,7 @@ void ScCheckListMenuWindow::launch(const Rectangle& rRect) packWindow(); if (!maConfig.mbAllowEmptySet) // We need to have at least one member selected. - maBtnOk.Enable(maChecks.GetCheckedEntryCount() != 0); + maBtnOk->Enable(maChecks->GetCheckedEntryCount() != 0); Rectangle aRect(rRect); if (maConfig.mbRTL) diff --git a/sc/source/ui/cctrl/tbinsert.cxx b/sc/source/ui/cctrl/tbinsert.cxx index 32b06bbb8d90..8b3469a6f89e 100644 --- a/sc/source/ui/cctrl/tbinsert.cxx +++ b/sc/source/ui/cctrl/tbinsert.cxx @@ -72,7 +72,7 @@ void ScTbxInsertCtrl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eState, } } -SfxPopupWindow* ScTbxInsertCtrl::CreatePopupWindow() +VclPtr<SfxPopupWindow> ScTbxInsertCtrl::CreatePopupWindow() { sal_uInt16 nSlotId = GetSlotId(); if (nSlotId == SID_TBXCTL_INSERT) diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 3a3bcd769c76..b93ec720901c 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -79,14 +79,14 @@ void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState } } -vcl::Window* ScZoomSliderControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> ScZoomSliderControl::CreateItemWindow( vcl::Window *pParent ) { // #i98000# Don't try to get a value via SfxViewFrame::Current here. // The view's value is always notified via StateChanged later. - ScZoomSliderWnd* pSlider = new ScZoomSliderWnd( pParent, + VclPtrInstance<ScZoomSliderWnd> pSlider( pParent, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(), ::com::sun::star::uno::UNO_QUERY ), m_xFrame, 100 ); - return pSlider; + return pSlider.get(); } struct ScZoomSliderWnd::ScZoomSliderWnd_Impl @@ -233,7 +233,13 @@ ScZoomSliderWnd::ScZoomSliderWnd( vcl::Window* pParent, const ::com::sun::star:: ScZoomSliderWnd::~ScZoomSliderWnd() { + disposeOnce(); +} + +void ScZoomSliderWnd::dispose() +{ delete mpImpl; + vcl::Window::dispose(); } void ScZoomSliderWnd::MouseButtonDown( const MouseEvent& rMEvt ) @@ -395,7 +401,7 @@ void ScZoomSliderWnd::DoPaint( const Rectangle& /*rRect*/ ) Size aSliderWindowSize = GetOutputSizePixel(); Rectangle aRect( Point( 0, 0 ), aSliderWindowSize ); - VirtualDevice* pVDev = new VirtualDevice( *this ); + ScopedVclPtrInstance< VirtualDevice > pVDev( *this ); pVDev->SetOutputSizePixel( aSliderWindowSize ); Rectangle aSlider = aRect; @@ -478,9 +484,6 @@ void ScZoomSliderWnd::DoPaint( const Rectangle& /*rRect*/ ) pVDev->DrawImage( aImagePoint, mpImpl->maIncreaseButton ); DrawOutDev( Point(0, 0), aSliderWindowSize, Point(0, 0), aSliderWindowSize, *pVDev ); - - delete pVDev; - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 26c204030610..37bae8c62d19 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -123,6 +123,30 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar PosSelectHdl(NULL); } +ScDataBarSettingsDlg::~ScDataBarSettingsDlg() +{ + disposeOnce(); +} + +void ScDataBarSettingsDlg::dispose() +{ + mpBtnOk.clear(); + mpBtnCancel.clear(); + mpLbPos.clear(); + mpLbNeg.clear(); + mpLbAxisCol.clear(); + mpLbTypeMin.clear(); + mpLbTypeMax.clear(); + mpLbFillType.clear(); + mpLbAxisPos.clear(); + mpEdMin.clear(); + mpEdMax.clear(); + mpLenMin.clear(); + mpLenMax.clear(); + mpCbOnlyBar.clear(); + ModalDialog::dispose(); +} + void ScDataBarSettingsDlg::Init() { SfxObjectShell* pDocSh = SfxObjectShell::Current(); @@ -264,8 +288,8 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl ) if(bWarn) { //show warning message and don't close - WarningBox aWarn(this, WB_OK, maStrWarnSameValue ); - aWarn.Execute(); + ScopedVclPtrInstance< WarningBox > aWarn(this, WB_OK, maStrWarnSameValue ); + aWarn->Execute(); } else { diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index ad260e40fe80..59d343195294 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -37,7 +37,7 @@ ScCondFormatList::ScCondFormatList(vcl::Window* pParent, WinBits nStyle) : Control(pParent, nStyle | WB_DIALOGCONTROL) , mbHasScrollBar(false) - , mpScrollBar(new ScrollBar(this, WB_VERT )) + , mpScrollBar(VclPtr<ScrollBar>::Create(this, WB_VERT )) , mpDoc(NULL) , mpDialogParent(NULL) { @@ -47,6 +47,18 @@ ScCondFormatList::ScCondFormatList(vcl::Window* pParent, WinBits nStyle) SetBackground(GetControlBackground()); } +ScCondFormatList::~ScCondFormatList() +{ + disposeOnce(); +} + +void ScCondFormatList::dispose() +{ + mpDialogParent.clear(); + mpScrollBar.disposeAndClear(); + Control::dispose(); +} + void ScCondFormatList::init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType) @@ -68,9 +80,9 @@ void ScCondFormatList::init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent, { const ScCondFormatEntry* pConditionEntry = static_cast<const ScCondFormatEntry*>( pEntry ); if(pConditionEntry->GetOperation() != SC_COND_DIRECT) - maEntries.push_back(new ScConditionFrmtEntry( this, mpDoc, pDialogParent, maPos, pConditionEntry ) ); + maEntries.push_back(VclPtr<ScConditionFrmtEntry>::Create( this, mpDoc, pDialogParent, maPos, pConditionEntry ) ); else - maEntries.push_back(new ScFormulaFrmtEntry( this, mpDoc, pDialogParent, maPos, pConditionEntry ) ); + maEntries.push_back(VclPtr<ScFormulaFrmtEntry>::Create( this, mpDoc, pDialogParent, maPos, pConditionEntry ) ); } break; @@ -78,43 +90,43 @@ void ScCondFormatList::init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent, { const ScColorScaleFormat* pColorScale = static_cast<const ScColorScaleFormat*>( pEntry ); if( pColorScale->size() == 2 ) - maEntries.push_back(new ScColorScale2FrmtEntry( this, mpDoc, maPos, pColorScale ) ); + maEntries.push_back(VclPtr<ScColorScale2FrmtEntry>::Create( this, mpDoc, maPos, pColorScale ) ); else - maEntries.push_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos, pColorScale ) ); + maEntries.push_back(VclPtr<ScColorScale3FrmtEntry>::Create( this, mpDoc, maPos, pColorScale ) ); } break; case condformat::DATABAR: - maEntries.push_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) ); + maEntries.push_back(VclPtr<ScDataBarFrmtEntry>::Create( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) ); break; case condformat::ICONSET: - maEntries.push_back(new ScIconSetFrmtEntry( this, mpDoc, maPos, static_cast<const ScIconSetFormat*>( pEntry ) ) ); + maEntries.push_back(VclPtr<ScIconSetFrmtEntry>::Create( this, mpDoc, maPos, static_cast<const ScIconSetFormat*>( pEntry ) ) ); break; case condformat::DATE: - maEntries.push_back(new ScDateFrmtEntry( this, mpDoc, static_cast<const ScCondDateFormatEntry*>( pEntry ) ) ); + maEntries.push_back(VclPtr<ScDateFrmtEntry>::Create( this, mpDoc, static_cast<const ScCondDateFormatEntry*>( pEntry ) ) ); break; } } if(nCount) - EntrySelectHdl(&maEntries[0]); + EntrySelectHdl(maEntries[0].get()); } else { switch(eType) { case condformat::dialog::CONDITION: - maEntries.push_back(new ScConditionFrmtEntry( this, mpDoc, pDialogParent, maPos )); + maEntries.push_back(VclPtr<ScConditionFrmtEntry>::Create( this, mpDoc, pDialogParent, maPos )); break; case condformat::dialog::COLORSCALE: - maEntries.push_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos )); + maEntries.push_back(VclPtr<ScColorScale3FrmtEntry>::Create( this, mpDoc, maPos )); break; case condformat::dialog::DATABAR: - maEntries.push_back(new ScDataBarFrmtEntry( this, mpDoc, maPos )); + maEntries.push_back(VclPtr<ScDataBarFrmtEntry>::Create( this, mpDoc, maPos )); break; case condformat::dialog::ICONSET: - maEntries.push_back(new ScIconSetFrmtEntry( this, mpDoc, maPos )); + maEntries.push_back(VclPtr<ScIconSetFrmtEntry>::Create( this, mpDoc, maPos )); break; case condformat::dialog::DATE: - maEntries.push_back(new ScDateFrmtEntry( this, mpDoc )); + maEntries.push_back(VclPtr<ScDateFrmtEntry>::Create( this, mpDoc )); break; case condformat::dialog::NONE: break; @@ -122,7 +134,7 @@ void ScCondFormatList::init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent, } RecalcAll(); if (!maEntries.empty()) - maEntries.begin()->SetActive(); + (*maEntries.begin())->SetActive(); RecalcAll(); } @@ -158,7 +170,7 @@ ScConditionalFormat* ScCondFormatList::GetConditionalFormat() const ScConditionalFormat* pFormat = new ScConditionalFormat(0, mpDoc); for(EntryContainer::const_iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) { - ScFormatEntry* pEntry = itr->GetEntry(); + ScFormatEntry* pEntry = (*itr)->GetEntry(); if(pEntry) pFormat->AddEntry(pEntry); } @@ -174,8 +186,8 @@ void ScCondFormatList::RecalcAll() sal_Int32 nIndex = 1; for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) { - nTotalHeight += itr->GetSizePixel().Height(); - itr->SetIndex( nIndex ); + nTotalHeight += (*itr)->GetSizePixel().Height(); + (*itr)->SetIndex( nIndex ); ++nIndex; } @@ -199,15 +211,15 @@ void ScCondFormatList::RecalcAll() Point aPoint(0,-1*mpScrollBar->GetThumbPos()); for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) { - itr->SetPosPixel(aPoint); - Size aSize = itr->GetSizePixel(); + (*itr)->SetPosPixel(aPoint); + Size aSize = (*itr)->GetSizePixel(); if(mbHasScrollBar) aSize.Width() = aCtrlSize.Width() - nSrcBarSize; else aSize.Width() = aCtrlSize.Width(); - itr->SetSizePixel(aSize); + (*itr)->SetSizePixel(aSize); - aPoint.Y() += itr->GetSizePixel().Height(); + aPoint.Y() += (*itr)->GetSizePixel().Height(); } } @@ -225,7 +237,7 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox) EntryContainer::iterator itr = maEntries.begin(); for(; itr != maEntries.end(); ++itr) { - if(itr->IsSelected()) + if((*itr)->IsSelected()) break; } if(itr == maEntries.end()) @@ -235,34 +247,34 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox) switch(nPos) { case 0: - if(itr->GetType() == condformat::entry::COLORSCALE2) + if((*itr)->GetType() == condformat::entry::COLORSCALE2) return 0; - maEntries.replace( itr, new ScColorScale2FrmtEntry( this, mpDoc, maPos ) ); + *itr = VclPtr<ScColorScale2FrmtEntry>::Create( this, mpDoc, maPos ); break; case 1: - if(itr->GetType() == condformat::entry::COLORSCALE3) + if((*itr)->GetType() == condformat::entry::COLORSCALE3) return 0; - maEntries.replace( itr, new ScColorScale3FrmtEntry( this, mpDoc, maPos ) ); + *itr = VclPtr<ScColorScale3FrmtEntry>::Create( this, mpDoc, maPos ); break; case 2: - if(itr->GetType() == condformat::entry::DATABAR) + if((*itr)->GetType() == condformat::entry::DATABAR) return 0; - maEntries.replace( itr, new ScDataBarFrmtEntry( this, mpDoc, maPos ) ); + *itr = VclPtr<ScDataBarFrmtEntry>::Create( this, mpDoc, maPos ); break; case 3: - if(itr->GetType() == condformat::entry::ICONSET) + if((*itr)->GetType() == condformat::entry::ICONSET) return 0; - maEntries.replace( itr, new ScIconSetFrmtEntry( this, mpDoc, maPos ) ); + *itr = VclPtr<ScIconSetFrmtEntry>::Create( this, mpDoc, maPos ); break; default: break; } mpDialogParent->InvalidateRefData(); - itr->SetActive(); + (*itr)->SetActive(); RecalcAll(); return 0; } @@ -282,7 +294,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox) EntryContainer::iterator itr = maEntries.begin(); for(; itr != maEntries.end(); ++itr) { - if(itr->IsSelected()) + if((*itr)->IsSelected()) break; } if(itr == maEntries.end()) @@ -292,7 +304,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox) switch(nPos) { case 0: - switch(itr->GetType()) + switch((*itr)->GetType()) { case condformat::entry::FORMULA: case condformat::entry::CONDITION: @@ -304,33 +316,33 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox) case condformat::entry::ICONSET: return 0; } - maEntries.replace( itr, new ScColorScale3FrmtEntry(this, mpDoc, maPos)); + *itr = VclPtr<ScColorScale3FrmtEntry>::Create(this, mpDoc, maPos); mpDialogParent->InvalidateRefData(); - itr->SetActive(); + (*itr)->SetActive(); break; case 1: - if(itr->GetType() == condformat::entry::CONDITION) + if((*itr)->GetType() == condformat::entry::CONDITION) return 0; - maEntries.replace( itr, new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos)); + *itr = VclPtr<ScConditionFrmtEntry>::Create(this, mpDoc, mpDialogParent, maPos); mpDialogParent->InvalidateRefData(); - itr->SetActive(); + (*itr)->SetActive(); break; case 2: - if(itr->GetType() == condformat::entry::FORMULA) + if((*itr)->GetType() == condformat::entry::FORMULA) return 0; - maEntries.replace( itr, new ScFormulaFrmtEntry(this, mpDoc, mpDialogParent, maPos)); + *itr = VclPtr<ScFormulaFrmtEntry>::Create(this, mpDoc, mpDialogParent, maPos); mpDialogParent->InvalidateRefData(); - itr->SetActive(); + (*itr)->SetActive(); break; case 3: - if(itr->GetType() == condformat::entry::DATE) + if((*itr)->GetType() == condformat::entry::DATE) return 0; - maEntries.replace( itr, new ScDateFrmtEntry( this, mpDoc )); + *itr = VclPtr<ScDateFrmtEntry>::Create( this, mpDoc ); mpDialogParent->InvalidateRefData(); - itr->SetActive(); + (*itr)->SetActive(); break; } @@ -340,11 +352,11 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, ListBox*, pBox) IMPL_LINK_NOARG( ScCondFormatList, AddBtnHdl ) { - ScCondFrmtEntry* pNewEntry = new ScConditionFrmtEntry(this, mpDoc, mpDialogParent, maPos); + VclPtr<ScCondFrmtEntry> pNewEntry = VclPtr<ScConditionFrmtEntry>::Create(this, mpDoc, mpDialogParent, maPos); maEntries.push_back( pNewEntry ); for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) { - itr->SetInactive(); + (*itr)->SetInactive(); } mpDialogParent->InvalidateRefData(); pNewEntry->SetActive(); @@ -356,7 +368,7 @@ IMPL_LINK_NOARG( ScCondFormatList, RemoveBtnHdl ) { for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) { - if(itr->IsSelected()) + if((*itr)->IsSelected()) { maEntries.erase(itr); break; @@ -377,7 +389,7 @@ IMPL_LINK( ScCondFormatList, EntrySelectHdl, ScCondFrmtEntry*, pEntry ) bool bReGrabFocus = HasChildPathFocus(); for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) { - itr->SetInactive(); + (*itr)->SetInactive(); } mpDialogParent->InvalidateRefData(); pEntry->SetActive(); @@ -436,7 +448,20 @@ ScCondFormatDlg::ScCondFormatDlg(vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg::~ScCondFormatDlg() { + disposeOnce(); +} + +void ScCondFormatDlg::dispose() +{ SC_MOD()->PopAnyRefDlg(); + mpBtnAdd.clear(); + mpBtnRemove.clear(); + mpFtRange.clear(); + mpEdRange.clear(); + mpRbRange.clear(); + mpCondFormList.clear(); + mpLastEdit.clear(); + ScAnyRefModalDlg::dispose(); } void ScCondFormatDlg::SetActive() diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 4a8160b3ffe8..aa37bdfe0bc9 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -38,11 +38,11 @@ ScCondFrmtEntry::ScCondFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos): Control(pParent, ScResId( RID_COND_ENTRY ) ), mbActive(false), - maFtCondNr( this, ScResId( FT_COND_NR ) ), - maFtCondition( this, ScResId( FT_CONDITION ) ), + maFtCondNr( VclPtr<FixedText>::Create( this, ScResId( FT_COND_NR ) ) ), + maFtCondition( VclPtr<FixedText>::Create( this, ScResId( FT_CONDITION ) ) ), mnIndex(0), maStrCondition(ScResId( STR_CONDITION ).toString()), - maLbType( this, ScResId( LB_TYPE ) ), + maLbType( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE ) ) ), mpDoc(pDoc), maPos(rPos) { @@ -51,18 +51,27 @@ ScCondFrmtEntry::ScCondFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, const S SetControlBackground(aBack); SetBackground(GetControlBackground()); - maFtCondNr.SetControlBackground(aBack); - maFtCondNr.SetBackground(maFtCondNr.GetControlBackground()); + maFtCondNr->SetControlBackground(aBack); + maFtCondNr->SetBackground(maFtCondNr->GetControlBackground()); - maFtCondition.SetControlBackground(aBack); - maFtCondition.SetBackground(maFtCondition.GetControlBackground()); + maFtCondition->SetControlBackground(aBack); + maFtCondition->SetBackground(maFtCondition->GetControlBackground()); - maLbType.SetSelectHdl( LINK( pParent, ScCondFormatList, TypeListHdl ) ); + maLbType->SetSelectHdl( LINK( pParent, ScCondFormatList, TypeListHdl ) ); maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl ); } ScCondFrmtEntry::~ScCondFrmtEntry() { + disposeOnce(); +} + +void ScCondFrmtEntry::dispose() +{ + maFtCondNr.disposeAndClear(); + maFtCondition.disposeAndClear(); + maLbType.disposeAndClear(); + Control::dispose(); } bool ScCondFrmtEntry::Notify( NotifyEvent& rNEvt ) @@ -79,7 +88,7 @@ void ScCondFrmtEntry::SetIndex(sal_Int32 nIndex) mnIndex = nIndex; OUStringBuffer aBuffer(maStrCondition); aBuffer.append(OUString::number(nIndex)); - maFtCondNr.SetText(aBuffer.makeStringAndClear()); + maFtCondNr->SetText(aBuffer.makeStringAndClear()); } void ScCondFrmtEntry::SetHeight() @@ -109,9 +118,9 @@ void ScCondFrmtEntry::SetHeight() void ScCondFrmtEntry::Select() { - maFtCondition.SetText(OUString()); - maFtCondition.Hide(); - maLbType.Show(); + maFtCondition->SetText(OUString()); + maFtCondition->Hide(); + maLbType->Show(); mbActive = true; SetHeight(); } @@ -119,9 +128,9 @@ void ScCondFrmtEntry::Select() void ScCondFrmtEntry::Deselect() { OUString maCondText = GetExpressionString(); - maFtCondition.SetText(maCondText); - maFtCondition.Show(); - maLbType.Hide(); + maFtCondition->SetText(maCondText); + maFtCondition->Show(); + maLbType->Hide(); mbActive = false; SetHeight(); } @@ -179,18 +188,18 @@ const ScConditionMode ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry:: ScConditionFrmtEntry::ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbCondType( this, ScResId( LB_CELLIS_TYPE ) ), - maEdVal1( this, NULL, NULL, ScResId( ED_VAL1 ) ), - maEdVal2( this, NULL, NULL, ScResId( ED_VAL2 ) ), - maFtVal( this, ScResId( FT_VAL ) ), - maFtStyle( this, ScResId( FT_STYLE ) ), - maLbStyle( this, ScResId( LB_STYLE ) ), - maWdPreview( this, ScResId( WD_PREVIEW ) ), + maLbCondType( VclPtr<ListBox>::Create( this, ScResId( LB_CELLIS_TYPE ) ) ), + maEdVal1( VclPtr<formula::RefEdit>::Create( this, nullptr, nullptr, ScResId( ED_VAL1 ) ) ), + maEdVal2( VclPtr<formula::RefEdit>::Create( this, nullptr, nullptr, ScResId( ED_VAL2 ) ) ), + maFtVal( VclPtr<FixedText>::Create( this, ScResId( FT_VAL ) ) ), + maFtStyle( VclPtr<FixedText>::Create( this, ScResId( FT_STYLE ) ) ), + maLbStyle( VclPtr<ListBox>::Create( this, ScResId( LB_STYLE ) ) ), + maWdPreview( VclPtr<SvxFontPrevWindow>::Create( this, ScResId( WD_PREVIEW ) ) ), mbIsInStyleCreate(false) { FreeResource(); - maLbType.SelectEntryPos(1); + maLbType->SelectEntryPos(1); Init(pDialogParent); @@ -199,76 +208,93 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pD if(pFormatEntry) { OUString aStyleName = pFormatEntry->GetStyle(); - maLbStyle.SelectEntry(aStyleName); + maLbStyle->SelectEntry(aStyleName); StyleSelectHdl(NULL); ScConditionMode eMode = pFormatEntry->GetOperation(); - maLbCondType.SelectEntryPos(ConditionModeToEntryPos(eMode)); + maLbCondType->SelectEntryPos(ConditionModeToEntryPos(eMode)); switch(GetNumberEditFields(eMode)) { case 0: - maEdVal1.Hide(); - maEdVal2.Hide(); + maEdVal1->Hide(); + maEdVal2->Hide(); break; case 1: - maEdVal1.Show(); - maEdVal1.SetText(pFormatEntry->GetExpression(maPos, 0)); - maEdVal2.Hide(); - OnEdChanged(&maEdVal1); + maEdVal1->Show(); + maEdVal1->SetText(pFormatEntry->GetExpression(maPos, 0)); + maEdVal2->Hide(); + OnEdChanged(maEdVal1); break; case 2: - maEdVal1.Show(); - maEdVal1.SetText(pFormatEntry->GetExpression(maPos, 0)); - OnEdChanged(&maEdVal1); - maEdVal2.Show(); - maEdVal2.SetText(pFormatEntry->GetExpression(maPos, 1)); - OnEdChanged(&maEdVal2); + maEdVal1->Show(); + maEdVal1->SetText(pFormatEntry->GetExpression(maPos, 0)); + OnEdChanged(maEdVal1); + maEdVal2->Show(); + maEdVal2->SetText(pFormatEntry->GetExpression(maPos, 1)); + OnEdChanged(maEdVal2); break; } } else { - maLbCondType.SelectEntryPos(0); - maEdVal2.Hide(); - maLbStyle.SelectEntryPos(1); + maLbCondType->SelectEntryPos(0); + maEdVal2->Hide(); + maLbStyle->SelectEntryPos(1); } } +ScConditionFrmtEntry::~ScConditionFrmtEntry() +{ + disposeOnce(); +} + +void ScConditionFrmtEntry::dispose() +{ + maLbCondType.disposeAndClear(); + maEdVal1.disposeAndClear(); + maEdVal2.disposeAndClear(); + maFtVal.disposeAndClear(); + maFtStyle.disposeAndClear(); + maLbStyle.disposeAndClear(); + maWdPreview.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScConditionFrmtEntry::Init(ScCondFormatDlg* pDialogParent) { - maEdVal1.SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - maEdVal2.SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - maEdVal1.SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); - maEdVal2.SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); + maEdVal1->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdVal2->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdVal1->SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); + maEdVal2->SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); - maEdVal1.SetStyle( maEdVal1.GetStyle() | WB_FORCECTRLBACKGROUND ); - maEdVal2.SetStyle( maEdVal2.GetStyle() | WB_FORCECTRLBACKGROUND ); + maEdVal1->SetStyle( maEdVal1->GetStyle() | WB_FORCECTRLBACKGROUND ); + maEdVal2->SetStyle( maEdVal2->GetStyle() | WB_FORCECTRLBACKGROUND ); - maEdVal1.SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); - maEdVal2.SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); + maEdVal1->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); + maEdVal2->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); - FillStyleListBox( mpDoc, maLbStyle ); - maLbStyle.SetSelectHdl( LINK( this, ScConditionFrmtEntry, StyleSelectHdl ) ); + FillStyleListBox( mpDoc, *maLbStyle.get() ); + maLbStyle->SetSelectHdl( LINK( this, ScConditionFrmtEntry, StyleSelectHdl ) ); - maLbCondType.SetSelectHdl( LINK( this, ScConditionFrmtEntry, ConditionTypeSelectHdl ) ); + maLbCondType->SetSelectHdl( LINK( this, ScConditionFrmtEntry, ConditionTypeSelectHdl ) ); } ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const { - ScConditionMode eMode = EntryPosToConditionMode(maLbCondType.GetSelectEntryPos()); - OUString aExpr1 = maEdVal1.GetText(); + ScConditionMode eMode = EntryPosToConditionMode(maLbCondType->GetSelectEntryPos()); + OUString aExpr1 = maEdVal1->GetText(); OUString aExpr2; if (GetNumberEditFields(eMode) == 2) { - aExpr2 = maEdVal2.GetText(); + aExpr2 = maEdVal2->GetText(); if (aExpr2.isEmpty()) { return NULL; } } - ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, mpDoc, maPos, maLbStyle.GetSelectEntry()); + ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, mpDoc, maPos, maLbStyle->GetSelectEntry()); return pEntry; } @@ -278,7 +304,7 @@ IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, Edit*, pEdit) if( aFormula.isEmpty() ) { - maFtVal.SetText(ScGlobal::GetRscString(STR_ENTER_VALUE)); + maFtVal->SetText(ScGlobal::GetRscString(STR_ENTER_VALUE)); return 0; } @@ -290,7 +316,7 @@ IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, Edit*, pEdit) if( ta->GetCodeError() ) { pEdit->SetControlBackground(COL_LIGHTRED); - maFtVal.SetText(ScGlobal::GetRscString(STR_VALID_DEFERROR)); + maFtVal->SetText(ScGlobal::GetRscString(STR_VALID_DEFERROR)); return 0; } @@ -303,24 +329,24 @@ IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, Edit*, pEdit) ) { pEdit->SetControlBackground(COL_YELLOW); - maFtVal.SetText(ScGlobal::GetRscString(STR_UNQUOTED_STRING)); + maFtVal->SetText(ScGlobal::GetRscString(STR_UNQUOTED_STRING)); return 0; } pEdit->SetControlBackground(GetSettings().GetStyleSettings().GetWindowColor()); - maFtVal.SetText(""); + maFtVal->SetText(""); return 0; } void ScConditionFrmtEntry::Select() { - maFtVal.Show(); + maFtVal->Show(); ScCondFrmtEntry::Select(); } void ScConditionFrmtEntry::Deselect() { - maFtVal.Hide(); + maFtVal->Hide(); ScCondFrmtEntry::Deselect(); } @@ -383,7 +409,7 @@ sal_Int32 ScConditionFrmtEntry::GetNumberEditFields( ScConditionMode eMode ) con OUString ScConditionFrmtEntry::GetExpressionString() { - return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos(), maEdVal1.GetText(), maEdVal2.GetText()); + return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType->GetSelectEntryPos(), maEdVal1->GetText(), maEdVal2->GetText()); } ScFormatEntry* ScConditionFrmtEntry::GetEntry() const @@ -393,33 +419,33 @@ ScFormatEntry* ScConditionFrmtEntry::GetEntry() const void ScConditionFrmtEntry::SetActive() { - ScConditionMode eMode = EntryPosToConditionMode(maLbCondType.GetSelectEntryPos()); - maLbCondType.Show(); + ScConditionMode eMode = EntryPosToConditionMode(maLbCondType->GetSelectEntryPos()); + maLbCondType->Show(); switch(GetNumberEditFields(eMode)) { case 1: - maEdVal1.Show(); + maEdVal1->Show(); break; case 2: - maEdVal1.Show(); - maEdVal2.Show(); + maEdVal1->Show(); + maEdVal2->Show(); break; } - maFtStyle.Show(); - maLbStyle.Show(); - maWdPreview.Show(); + maFtStyle->Show(); + maLbStyle->Show(); + maWdPreview->Show(); Select(); } void ScConditionFrmtEntry::SetInactive() { - maLbCondType.Hide(); - maEdVal1.Hide(); - maEdVal2.Hide(); - maFtStyle.Hide(); - maLbStyle.Hide(); - maWdPreview.Hide(); + maLbCondType->Hide(); + maEdVal1->Hide(); + maEdVal2->Hide(); + maFtStyle->Hide(); + maLbStyle->Hide(); + maWdPreview->Hide(); Deselect(); } @@ -449,7 +475,7 @@ void ScConditionFrmtEntry::Notify(SfxBroadcaster&, const SfxHint& rHint) if(nHint == SfxStyleSheetHintId::MODIFIED) { if(!mbIsInStyleCreate) - UpdateStyleList(maLbStyle, mpDoc); + UpdateStyleList(*maLbStyle.get(), mpDoc); } } @@ -523,7 +549,7 @@ void StyleSelect( ListBox& rLbStyle, ScDocument* pDoc, SvxFontPrevWindow& rWdPre IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl) { mbIsInStyleCreate = true; - StyleSelect( maLbStyle, mpDoc, maWdPreview ); + StyleSelect( *maLbStyle.get(), mpDoc, *maWdPreview.get() ); mbIsInStyleCreate = false; return 0; } @@ -532,41 +558,55 @@ IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl) ScFormulaFrmtEntry::ScFormulaFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maFtStyle( this, ScResId( FT_STYLE ) ), - maLbStyle( this, ScResId( LB_STYLE ) ), - maWdPreview( this, ScResId( WD_PREVIEW ) ), - maEdFormula( this, NULL, NULL, ScResId( ED_FORMULA ) ) + maFtStyle( VclPtr<FixedText>::Create( this, ScResId( FT_STYLE ) ) ), + maLbStyle( VclPtr<ListBox>::Create( this, ScResId( LB_STYLE ) ) ), + maWdPreview( VclPtr<SvxFontPrevWindow>::Create( this, ScResId( WD_PREVIEW ) ) ), + maEdFormula( VclPtr<formula::RefEdit>::Create(this, nullptr, nullptr, ScResId( ED_FORMULA ) ) ) { Init(pDialogParent); FreeResource(); - maLbType.SelectEntryPos(2); + maLbType->SelectEntryPos(2); if(pFormat) { - maEdFormula.SetText(pFormat->GetExpression(rPos, 0, 0, pDoc->GetGrammar())); - maLbStyle.SelectEntry(pFormat->GetStyle()); + maEdFormula->SetText(pFormat->GetExpression(rPos, 0, 0, pDoc->GetGrammar())); + maLbStyle->SelectEntry(pFormat->GetStyle()); } else { - maLbStyle.SelectEntryPos(1); + maLbStyle->SelectEntryPos(1); } StyleSelectHdl(NULL); } +ScFormulaFrmtEntry::~ScFormulaFrmtEntry() +{ + disposeOnce(); +} + +void ScFormulaFrmtEntry::dispose() +{ + maFtStyle.disposeAndClear(); + maLbStyle.disposeAndClear(); + maWdPreview.disposeAndClear(); + maEdFormula.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScFormulaFrmtEntry::Init(ScCondFormatDlg* pDialogParent) { - maEdFormula.SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - maEdFormula.SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); + maEdFormula->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdFormula->SetLoseFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeLoseFocusHdl ) ); - FillStyleListBox( mpDoc, maLbStyle ); - maLbStyle.SetSelectHdl( LINK( this, ScFormulaFrmtEntry, StyleSelectHdl ) ); + FillStyleListBox( mpDoc, *maLbStyle.get() ); + maLbStyle->SetSelectHdl( LINK( this, ScFormulaFrmtEntry, StyleSelectHdl ) ); } IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl) { - StyleSelect( maLbStyle, mpDoc, maWdPreview ); + StyleSelect( *maLbStyle.get(), mpDoc, *maWdPreview.get() ); return 0; } @@ -574,12 +614,12 @@ IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl) ScFormatEntry* ScFormulaFrmtEntry::createFormulaEntry() const { ScConditionMode eMode = SC_COND_DIRECT; - OUString aFormula = maEdFormula.GetText(); + OUString aFormula = maEdFormula->GetText(); if(aFormula.isEmpty()) return NULL; OUString aExpr2; - ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aFormula, aExpr2, mpDoc, maPos, maLbStyle.GetSelectEntry()); + ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aFormula, aExpr2, mpDoc, maPos, maLbStyle->GetSelectEntry()); return pEntry; } @@ -590,25 +630,25 @@ ScFormatEntry* ScFormulaFrmtEntry::GetEntry() const OUString ScFormulaFrmtEntry::GetExpressionString() { - return ScCondFormatHelper::GetExpression(FORMULA, 0, maEdFormula.GetText()); + return ScCondFormatHelper::GetExpression(FORMULA, 0, maEdFormula->GetText()); } void ScFormulaFrmtEntry::SetActive() { - maWdPreview.Show(); - maFtStyle.Show(); - maLbStyle.Show(); - maEdFormula.Show(); + maWdPreview->Show(); + maFtStyle->Show(); + maLbStyle->Show(); + maEdFormula->Show(); Select(); } void ScFormulaFrmtEntry::SetInactive() { - maWdPreview.Hide(); - maFtStyle.Hide(); - maLbStyle.Hide(); - maEdFormula.Hide(); + maWdPreview->Hide(); + maFtStyle->Hide(); + maLbStyle->Hide(); + maEdFormula->Hide(); Deselect(); } @@ -702,45 +742,62 @@ ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListB ScColorScale2FrmtEntry::ScColorScale2FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbEntryTypeMin( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ), - maLbEntryTypeMax( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ), - maEdMin( this, ScResId( ED_COL_SCALE_MIN ) ), - maEdMax( this, ScResId( ED_COL_SCALE_MAX ) ), - maLbColMin( this, ScResId( LB_COL_MIN ) ), - maLbColMax( this, ScResId( LB_COL_MAX ) ) + maLbColorFormat( VclPtr<ListBox>::Create( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbEntryTypeMin( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ) ), + maLbEntryTypeMax( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ) ), + maEdMin( VclPtr<Edit>::Create( this, ScResId( ED_COL_SCALE_MIN ) ) ), + maEdMax( VclPtr<Edit>::Create( this, ScResId( ED_COL_SCALE_MAX ) ) ), + maLbColMin( VclPtr<ColorListBox>::Create( this, ScResId( LB_COL_MIN ) ) ), + maLbColMax( VclPtr<ColorListBox>::Create( this, ScResId( LB_COL_MAX ) ) ) { // remove the automatic entry from color scales - maLbEntryTypeMin.RemoveEntry(0); - maLbEntryTypeMax.RemoveEntry(0); + maLbEntryTypeMin->RemoveEntry(0); + maLbEntryTypeMax->RemoveEntry(0); - maLbType.SelectEntryPos(0); - maLbColorFormat.SelectEntryPos(0); + maLbType->SelectEntryPos(0); + maLbColorFormat->SelectEntryPos(0); Init(); if(pFormat) { ScColorScaleFormat::const_iterator itr = pFormat->begin(); - SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMin.get(), *maEdMin.get(), *maLbColMin.get(), pDoc); ++itr; - SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMax.get(), *maEdMax.get(), *maLbColMax.get(), pDoc); } else { - maLbEntryTypeMin.SelectEntryPos(0); - maLbEntryTypeMax.SelectEntryPos(1); + maLbEntryTypeMin->SelectEntryPos(0); + maLbEntryTypeMax->SelectEntryPos(1); } FreeResource(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); - EntryTypeHdl(&maLbEntryTypeMin); - EntryTypeHdl(&maLbEntryTypeMax); + EntryTypeHdl(maLbEntryTypeMin.get()); + EntryTypeHdl(maLbEntryTypeMax.get()); +} + +ScColorScale2FrmtEntry::~ScColorScale2FrmtEntry() +{ + disposeOnce(); +} + +void ScColorScale2FrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbEntryTypeMin.disposeAndClear(); + maLbEntryTypeMax.disposeAndClear(); + maEdMin.disposeAndClear(); + maEdMax.disposeAndClear(); + maLbColMin.disposeAndClear(); + maLbColMax.disposeAndClear(); + ScCondFrmtEntry::dispose(); } void ScColorScale2FrmtEntry::Init() { - maLbEntryTypeMin.SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); - maLbEntryTypeMax.SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); SfxObjectShell* pDocSh = SfxObjectShell::Current(); XColorListRef pColorTable; @@ -756,30 +813,30 @@ void ScColorScale2FrmtEntry::Init() if ( pColorTable.is() ) { // filling the line color box - maLbColMin.SetUpdateMode( false ); - maLbColMax.SetUpdateMode( false ); + maLbColMin->SetUpdateMode( false ); + maLbColMax->SetUpdateMode( false ); for ( long i = 0; i < pColorTable->Count(); ++i ) { XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin.SelectEntryPos(i); + maLbColMin->SelectEntryPos(i); if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - maLbColMax.SelectEntryPos(i); + maLbColMax->SelectEntryPos(i); } - maLbColMin.SetUpdateMode( true ); - maLbColMax.SetUpdateMode( true ); + maLbColMin->SetUpdateMode( true ); + maLbColMax->SetUpdateMode( true ); } } ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const { ScColorScaleFormat* pColorScale = new ScColorScaleFormat(mpDoc); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMin, maLbColMin, maEdMin, mpDoc, maPos)); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMax, maLbColMax, maEdMax, mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMin.get(), *maLbColMin.get(), *maEdMin.get(), mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMax.get(), *maLbColMax.get(), *maEdMax.get(), mpDoc, maPos)); return pColorScale; } @@ -795,32 +852,32 @@ ScFormatEntry* ScColorScale2FrmtEntry::GetEntry() const void ScColorScale2FrmtEntry::SetActive() { - maLbColorFormat.Show(); + maLbColorFormat->Show(); - maLbEntryTypeMin.Show(); - maLbEntryTypeMax.Show(); + maLbEntryTypeMin->Show(); + maLbEntryTypeMax->Show(); - maEdMin.Show(); - maEdMax.Show(); + maEdMin->Show(); + maEdMax->Show(); - maLbColMin.Show(); - maLbColMax.Show(); + maLbColMin->Show(); + maLbColMax->Show(); Select(); } void ScColorScale2FrmtEntry::SetInactive() { - maLbColorFormat.Hide(); + maLbColorFormat->Hide(); - maLbEntryTypeMin.Hide(); - maLbEntryTypeMax.Hide(); + maLbEntryTypeMin->Hide(); + maLbEntryTypeMax->Hide(); - maEdMin.Hide(); - maEdMax.Hide(); + maEdMin->Hide(); + maEdMax->Hide(); - maLbColMin.Hide(); - maLbColMax.Hide(); + maLbColMin->Hide(); + maLbColMax->Hide(); Deselect(); } @@ -828,10 +885,10 @@ void ScColorScale2FrmtEntry::SetInactive() IMPL_LINK( ScColorScale2FrmtEntry, EntryTypeHdl, ListBox*, pBox ) { Edit* pEd = NULL; - if (pBox == &maLbEntryTypeMin) - pEd = &maEdMin; - else if (pBox == &maLbEntryTypeMax) - pEd = &maEdMax; + if (pBox == maLbEntryTypeMin.get()) + pEd = maEdMin; + else if (pBox == maLbEntryTypeMax.get()) + pEd = maEdMax.get(); if (!pEd) return 0; @@ -853,56 +910,76 @@ IMPL_LINK( ScColorScale2FrmtEntry, EntryTypeHdl, ListBox*, pBox ) ScColorScale3FrmtEntry::ScColorScale3FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbEntryTypeMin( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ), - maLbEntryTypeMiddle( this, ScResId( LB_TYPE_COL_SCALE_MIDDLE ) ), - maLbEntryTypeMax( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ), - maEdMin( this, ScResId( ED_COL_SCALE_MIN ) ), - maEdMiddle( this, ScResId( ED_COL_SCALE_MIDDLE ) ), - maEdMax( this, ScResId( ED_COL_SCALE_MAX ) ), - maLbColMin( this, ScResId( LB_COL_MIN ) ), - maLbColMiddle( this, ScResId( LB_COL_MIDDLE ) ), - maLbColMax( this, ScResId( LB_COL_MAX ) ) + maLbColorFormat( VclPtr<ListBox>::Create( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbEntryTypeMin( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ) ), + maLbEntryTypeMiddle( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE_COL_SCALE_MIDDLE ) ) ), + maLbEntryTypeMax( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ) ), + maEdMin( VclPtr<Edit>::Create( this, ScResId( ED_COL_SCALE_MIN ) ) ), + maEdMiddle( VclPtr<Edit>::Create( this, ScResId( ED_COL_SCALE_MIDDLE ) ) ), + maEdMax( VclPtr<Edit>::Create( this, ScResId( ED_COL_SCALE_MAX ) ) ), + maLbColMin( VclPtr<ColorListBox>::Create( this, ScResId( LB_COL_MIN ) ) ), + maLbColMiddle( VclPtr<ColorListBox>::Create( this, ScResId( LB_COL_MIDDLE ) ) ), + maLbColMax( VclPtr<ColorListBox>::Create( this, ScResId( LB_COL_MAX ) ) ) { // remove the automatic entry from color scales - maLbEntryTypeMin.RemoveEntry(0); - maLbEntryTypeMiddle.RemoveEntry(0); - maLbEntryTypeMax.RemoveEntry(0); - maLbColorFormat.SelectEntryPos(1); + maLbEntryTypeMin->RemoveEntry(0); + maLbEntryTypeMiddle->RemoveEntry(0); + maLbEntryTypeMax->RemoveEntry(0); + maLbColorFormat->SelectEntryPos(1); Init(); - maLbType.SelectEntryPos(0); + maLbType->SelectEntryPos(0); if(pFormat) { ScColorScaleFormat::const_iterator itr = pFormat->begin(); - SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMin.get(), *maEdMin.get(), *maLbColMin.get(), pDoc); assert(pFormat->size() == 3); ++itr; - SetColorScaleEntryTypes(*itr, maLbEntryTypeMiddle, maEdMiddle, maLbColMiddle, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMiddle.get(), *maEdMiddle.get(), *maLbColMiddle.get(), pDoc); ++itr; - SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax, pDoc); + SetColorScaleEntryTypes(*itr, *maLbEntryTypeMax.get(), *maEdMax.get(), *maLbColMax.get(), pDoc); } else { - maLbColorFormat.SelectEntryPos(1); - maLbEntryTypeMin.SelectEntryPos(0); - maLbEntryTypeMiddle.SelectEntryPos(2); - maLbEntryTypeMax.SelectEntryPos(1); - maEdMiddle.SetText(OUString::number(50)); + maLbColorFormat->SelectEntryPos(1); + maLbEntryTypeMin->SelectEntryPos(0); + maLbEntryTypeMiddle->SelectEntryPos(2); + maLbEntryTypeMax->SelectEntryPos(1); + maEdMiddle->SetText(OUString::number(50)); } FreeResource(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); - EntryTypeHdl(&maLbEntryTypeMin); - EntryTypeHdl(&maLbEntryTypeMiddle); - EntryTypeHdl(&maLbEntryTypeMax); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + EntryTypeHdl(maLbEntryTypeMin.get()); + EntryTypeHdl(maLbEntryTypeMiddle.get()); + EntryTypeHdl(maLbEntryTypeMax.get()); +} + +ScColorScale3FrmtEntry::~ScColorScale3FrmtEntry() +{ + disposeOnce(); +} + +void ScColorScale3FrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbEntryTypeMin.disposeAndClear(); + maLbEntryTypeMiddle.disposeAndClear(); + maLbEntryTypeMax.disposeAndClear(); + maEdMin.disposeAndClear(); + maEdMiddle.disposeAndClear(); + maEdMax.disposeAndClear(); + maLbColMin.disposeAndClear(); + maLbColMiddle.disposeAndClear(); + maLbColMax.disposeAndClear(); + ScCondFrmtEntry::dispose(); } void ScColorScale3FrmtEntry::Init() { - maLbEntryTypeMin.SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - maLbEntryTypeMax.SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - maLbEntryTypeMiddle.SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); + maLbEntryTypeMiddle->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); SfxObjectShell* pDocSh = SfxObjectShell::Current(); XColorListRef pColorTable; @@ -918,37 +995,37 @@ void ScColorScale3FrmtEntry::Init() if ( pColorTable.is() ) { // filling the line color box - maLbColMin.SetUpdateMode( false ); - maLbColMiddle.SetUpdateMode( false ); - maLbColMax.SetUpdateMode( false ); + maLbColMin->SetUpdateMode( false ); + maLbColMiddle->SetUpdateMode( false ); + maLbColMax->SetUpdateMode( false ); for ( long i = 0; i < pColorTable->Count(); ++i ) { XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMiddle.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMiddle->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); + maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin.SelectEntryPos(i); + maLbColMin->SelectEntryPos(i); if(pEntry->GetColor() == Color(COL_GREEN)) - maLbColMiddle.SelectEntryPos(i); + maLbColMiddle->SelectEntryPos(i); if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - maLbColMax.SelectEntryPos(i); + maLbColMax->SelectEntryPos(i); } - maLbColMin.SetUpdateMode( true ); - maLbColMiddle.SetUpdateMode( true ); - maLbColMax.SetUpdateMode( true ); + maLbColMin->SetUpdateMode( true ); + maLbColMiddle->SetUpdateMode( true ); + maLbColMax->SetUpdateMode( true ); } } ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const { ScColorScaleFormat* pColorScale = new ScColorScaleFormat(mpDoc); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMin, maLbColMin, maEdMin, mpDoc, maPos)); - if(maLbColorFormat.GetSelectEntryPos() == 1) - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMiddle, maLbColMiddle, maEdMiddle, mpDoc, maPos)); - pColorScale->AddEntry(createColorScaleEntry(maLbEntryTypeMax, maLbColMax, maEdMax, mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMin.get(), *maLbColMin.get(), *maEdMin.get(), mpDoc, maPos)); + if(maLbColorFormat->GetSelectEntryPos() == 1) + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMiddle.get(), *maLbColMiddle.get(), *maEdMiddle.get(), mpDoc, maPos)); + pColorScale->AddEntry(createColorScaleEntry(*maLbEntryTypeMax.get(), *maLbColMax.get(), *maEdMax.get(), mpDoc, maPos)); return pColorScale; } @@ -964,37 +1041,37 @@ ScFormatEntry* ScColorScale3FrmtEntry::GetEntry() const void ScColorScale3FrmtEntry::SetActive() { - maLbColorFormat.Show(); - maLbEntryTypeMin.Show(); - maLbEntryTypeMiddle.Show(); - maLbEntryTypeMax.Show(); + maLbColorFormat->Show(); + maLbEntryTypeMin->Show(); + maLbEntryTypeMiddle->Show(); + maLbEntryTypeMax->Show(); - maEdMin.Show(); - maEdMiddle.Show(); - maEdMax.Show(); + maEdMin->Show(); + maEdMiddle->Show(); + maEdMax->Show(); - maLbColMin.Show(); - maLbColMiddle.Show(); - maLbColMax.Show(); + maLbColMin->Show(); + maLbColMiddle->Show(); + maLbColMax->Show(); Select(); } void ScColorScale3FrmtEntry::SetInactive() { - maLbColorFormat.Hide(); + maLbColorFormat->Hide(); - maLbEntryTypeMin.Hide(); - maLbEntryTypeMiddle.Hide(); - maLbEntryTypeMax.Hide(); + maLbEntryTypeMin->Hide(); + maLbEntryTypeMiddle->Hide(); + maLbEntryTypeMax->Hide(); - maEdMin.Hide(); - maEdMiddle.Hide(); - maEdMax.Hide(); + maEdMin->Hide(); + maEdMiddle->Hide(); + maEdMax->Hide(); - maLbColMin.Hide(); - maLbColMiddle.Hide(); - maLbColMax.Hide(); + maLbColMin->Hide(); + maLbColMiddle->Hide(); + maLbColMax->Hide(); Deselect(); } @@ -1002,12 +1079,12 @@ void ScColorScale3FrmtEntry::SetInactive() IMPL_LINK( ScColorScale3FrmtEntry, EntryTypeHdl, ListBox*, pBox ) { Edit* pEd = NULL; - if(pBox == &maLbEntryTypeMin) - pEd = &maEdMin; - else if(pBox == &maLbEntryTypeMiddle) - pEd = &maEdMiddle; - else if(pBox == &maLbEntryTypeMax) - pEd = &maEdMax; + if(pBox == maLbEntryTypeMin.get()) + pEd = maEdMin.get(); + else if(pBox == maLbEntryTypeMiddle.get()) + pEd = maEdMiddle.get(); + else if(pBox == maLbEntryTypeMax.get()) + pEd = maEdMax.get(); if (!pEd) return 0; @@ -1029,24 +1106,24 @@ IMPL_LINK( ScColorScale3FrmtEntry, EntryTypeHdl, ListBox*, pBox ) IMPL_LINK_NOARG( ScConditionFrmtEntry, ConditionTypeSelectHdl ) { - sal_Int32 nSelectPos = maLbCondType.GetSelectEntryPos(); + sal_Int32 nSelectPos = maLbCondType->GetSelectEntryPos(); ScConditionMode eMode = EntryPosToConditionMode(nSelectPos); switch(GetNumberEditFields(eMode)) { case 0: - maEdVal1.Hide(); - maEdVal2.Hide(); - maFtVal.Hide(); + maEdVal1->Hide(); + maEdVal2->Hide(); + maFtVal->Hide(); break; case 1: - maEdVal1.Show(); - maEdVal2.Hide(); - maFtVal.Show(); + maEdVal1->Show(); + maEdVal2->Hide(); + maFtVal->Show(); break; case 2: - maEdVal1.Show(); - maEdVal2.Show(); - maFtVal.Show(); + maEdVal1->Show(); + maEdVal2->Show(); + maFtVal->Show(); break; } @@ -1087,35 +1164,51 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Ed ScDataBarFrmtEntry::ScDataBarFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbDataBarMinType( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ), - maLbDataBarMaxType( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ), - maEdDataBarMin( this, ScResId( ED_COL_SCALE_MIN ) ), - maEdDataBarMax( this, ScResId( ED_COL_SCALE_MAX ) ), - maBtOptions( this, ScResId( BTN_OPTIONS ) ) -{ - maLbColorFormat.SelectEntryPos(2); - maLbType.SelectEntryPos(0); + maLbColorFormat( VclPtr<ListBox>::Create( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbDataBarMinType( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE_COL_SCALE_MIN ) ) ), + maLbDataBarMaxType( VclPtr<ListBox>::Create( this, ScResId( LB_TYPE_COL_SCALE_MAX ) ) ), + maEdDataBarMin( VclPtr<Edit>::Create( this, ScResId( ED_COL_SCALE_MIN ) ) ), + maEdDataBarMax( VclPtr<Edit>::Create( this, ScResId( ED_COL_SCALE_MAX ) ) ), + maBtOptions( VclPtr<PushButton>::Create( this, ScResId( BTN_OPTIONS ) ) ) +{ + maLbColorFormat->SelectEntryPos(2); + maLbType->SelectEntryPos(0); if(pFormat) { mpDataBarData.reset(new ScDataBarFormatData(*pFormat->GetDataBarData())); - SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin, pDoc); - SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax, pDoc); + SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *maLbDataBarMinType.get(), *maEdDataBarMin.get(), pDoc); + SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), pDoc); DataBarTypeSelectHdl(NULL); } else { - maLbDataBarMinType.SelectEntryPos(0); - maLbDataBarMaxType.SelectEntryPos(0); + maLbDataBarMinType->SelectEntryPos(0); + maLbDataBarMaxType->SelectEntryPos(0); DataBarTypeSelectHdl(NULL); } Init(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); FreeResource(); } +ScDataBarFrmtEntry::~ScDataBarFrmtEntry() +{ + disposeOnce(); +} + +void ScDataBarFrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbDataBarMinType.disposeAndClear(); + maLbDataBarMaxType.disposeAndClear(); + maEdDataBarMin.disposeAndClear(); + maEdDataBarMax.disposeAndClear(); + maBtOptions.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + ScFormatEntry* ScDataBarFrmtEntry::GetEntry() const { return createDatabarEntry(); @@ -1123,10 +1216,10 @@ ScFormatEntry* ScDataBarFrmtEntry::GetEntry() const void ScDataBarFrmtEntry::Init() { - maLbDataBarMinType.SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); - maLbDataBarMaxType.SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); + maLbDataBarMinType->SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); + maLbDataBarMaxType->SetSelectHdl( LINK( this, ScDataBarFrmtEntry, DataBarTypeSelectHdl ) ); - maBtOptions.SetClickHdl( LINK( this, ScDataBarFrmtEntry, OptionBtnHdl ) ); + maBtOptions->SetClickHdl( LINK( this, ScDataBarFrmtEntry, OptionBtnHdl ) ); if(!mpDataBarData) { @@ -1141,8 +1234,8 @@ void ScDataBarFrmtEntry::Init() ScFormatEntry* ScDataBarFrmtEntry::createDatabarEntry() const { - SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos, true); - SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), *maLbDataBarMinType.get(), *maEdDataBarMin.get(), mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), mpDoc, maPos, true); ScDataBarFormat* pDataBar = new ScDataBarFormat(mpDoc); pDataBar->SetDataBarData(new ScDataBarFormatData(*mpDataBarData.get())); return pDataBar; @@ -1155,57 +1248,57 @@ OUString ScDataBarFrmtEntry::GetExpressionString() void ScDataBarFrmtEntry::SetActive() { - maLbColorFormat.Show(); + maLbColorFormat->Show(); - maLbDataBarMinType.Show(); - maLbDataBarMaxType.Show(); - maEdDataBarMin.Show(); - maEdDataBarMax.Show(); - maBtOptions.Show(); + maLbDataBarMinType->Show(); + maLbDataBarMaxType->Show(); + maEdDataBarMin->Show(); + maEdDataBarMax->Show(); + maBtOptions->Show(); Select(); } void ScDataBarFrmtEntry::SetInactive() { - maLbColorFormat.Hide(); + maLbColorFormat->Hide(); - maLbDataBarMinType.Hide(); - maLbDataBarMaxType.Hide(); - maEdDataBarMin.Hide(); - maEdDataBarMax.Hide(); - maBtOptions.Hide(); + maLbDataBarMinType->Hide(); + maLbDataBarMaxType->Hide(); + maEdDataBarMin->Hide(); + maEdDataBarMax->Hide(); + maBtOptions->Hide(); Deselect(); } IMPL_LINK_NOARG( ScDataBarFrmtEntry, DataBarTypeSelectHdl ) { - sal_Int32 nSelectPos = maLbDataBarMinType.GetSelectEntryPos(); + sal_Int32 nSelectPos = maLbDataBarMinType->GetSelectEntryPos(); if(nSelectPos <= COLORSCALE_MAX) - maEdDataBarMin.Disable(); + maEdDataBarMin->Disable(); else - maEdDataBarMin.Enable(); + maEdDataBarMin->Enable(); - nSelectPos = maLbDataBarMaxType.GetSelectEntryPos(); + nSelectPos = maLbDataBarMaxType->GetSelectEntryPos(); if(nSelectPos <= COLORSCALE_MAX) - maEdDataBarMax.Disable(); + maEdDataBarMax->Disable(); else - maEdDataBarMax.Enable(); + maEdDataBarMax->Enable(); return 0; } IMPL_LINK_NOARG( ScDataBarFrmtEntry, OptionBtnHdl ) { - SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos, true); - SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos, true); - ScDataBarSettingsDlg* pDlg = new ScDataBarSettingsDlg(this, *mpDataBarData, mpDoc, maPos); + SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), *maLbDataBarMinType.get(), *maEdDataBarMin.get(), mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), mpDoc, maPos, true); + ScopedVclPtrInstance<ScDataBarSettingsDlg> pDlg(this, *mpDataBarData, mpDoc, maPos); if( pDlg->Execute() == RET_OK) { mpDataBarData.reset(pDlg->GetData()); - SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin, mpDoc); - SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax, mpDoc); + SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, *maLbDataBarMinType, *maEdDataBarMin.get(), mpDoc); + SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, *maLbDataBarMaxType.get(), *maEdDataBarMax.get(), mpDoc); DataBarTypeSelectHdl(NULL); } return 0; @@ -1213,10 +1306,10 @@ IMPL_LINK_NOARG( ScDataBarFrmtEntry, OptionBtnHdl ) ScDateFrmtEntry::ScDateFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat ): ScCondFrmtEntry( pParent, pDoc, ScAddress() ), - maLbDateEntry( this, ScResId( LB_DATE_TYPE ) ), - maFtStyle( this, ScResId( FT_STYLE ) ), - maLbStyle( this, ScResId( LB_STYLE ) ), - maWdPreview( this, ScResId( WD_PREVIEW ) ), + maLbDateEntry( VclPtr<ListBox>::Create( this, ScResId( LB_DATE_TYPE ) ) ), + maFtStyle( VclPtr<FixedText>::Create( this, ScResId( FT_STYLE ) ) ), + maLbStyle( VclPtr<ListBox>::Create( this, ScResId( LB_STYLE ) ) ), + maWdPreview( VclPtr<SvxFontPrevWindow>::Create( this, ScResId( WD_PREVIEW ) ) ), mbIsInStyleCreate(false) { Init(); @@ -1227,41 +1320,55 @@ ScDateFrmtEntry::ScDateFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const if(pFormat) { sal_Int32 nPos = static_cast<sal_Int32>(pFormat->GetDateType()); - maLbDateEntry.SelectEntryPos(nPos); + maLbDateEntry->SelectEntryPos(nPos); OUString aStyleName = pFormat->GetStyleName(); - maLbStyle.SelectEntry(aStyleName); + maLbStyle->SelectEntry(aStyleName); } StyleSelectHdl(NULL); } +ScDateFrmtEntry::~ScDateFrmtEntry() +{ + disposeOnce(); +} + +void ScDateFrmtEntry::dispose() +{ + maLbDateEntry.disposeAndClear(); + maFtStyle.disposeAndClear(); + maLbStyle.disposeAndClear(); + maWdPreview.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScDateFrmtEntry::Init() { - maLbDateEntry.SelectEntryPos(0); - maLbType.SelectEntryPos(3); + maLbDateEntry->SelectEntryPos(0); + maLbType->SelectEntryPos(3); - FillStyleListBox( mpDoc, maLbStyle ); - maLbStyle.SetSelectHdl( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) ); - maLbStyle.SelectEntryPos(1); + FillStyleListBox( mpDoc, *maLbStyle.get() ); + maLbStyle->SetSelectHdl( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) ); + maLbStyle->SelectEntryPos(1); } void ScDateFrmtEntry::SetActive() { - maLbDateEntry.Show(); - maFtStyle.Show(); - maWdPreview.Show(); - maLbStyle.Show(); + maLbDateEntry->Show(); + maFtStyle->Show(); + maWdPreview->Show(); + maLbStyle->Show(); Select(); } void ScDateFrmtEntry::SetInactive() { - maLbDateEntry.Hide(); - maFtStyle.Hide(); - maWdPreview.Hide(); - maLbStyle.Hide(); + maLbDateEntry->Hide(); + maFtStyle->Hide(); + maWdPreview->Hide(); + maLbStyle->Hide(); Deselect(); } @@ -1276,16 +1383,16 @@ void ScDateFrmtEntry::Notify( SfxBroadcaster&, const SfxHint& rHint ) if(nHint == SfxStyleSheetHintId::MODIFIED) { if(!mbIsInStyleCreate) - UpdateStyleList(maLbStyle, mpDoc); + UpdateStyleList(*maLbStyle.get(), mpDoc); } } ScFormatEntry* ScDateFrmtEntry::GetEntry() const { ScCondDateFormatEntry* pNewEntry = new ScCondDateFormatEntry(mpDoc); - condformat::ScCondFormatDateType eType = static_cast<condformat::ScCondFormatDateType>(maLbDateEntry.GetSelectEntryPos()); + condformat::ScCondFormatDateType eType = static_cast<condformat::ScCondFormatDateType>(maLbDateEntry->GetSelectEntryPos()); pNewEntry->SetDateType(eType); - pNewEntry->SetStyleName(maLbStyle.GetSelectEntry()); + pNewEntry->SetStyleName(maLbStyle->GetSelectEntry()); return pNewEntry; } @@ -1297,7 +1404,7 @@ OUString ScDateFrmtEntry::GetExpressionString() IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl ) { mbIsInStyleCreate = true; - StyleSelect( maLbStyle, mpDoc, maWdPreview ); + StyleSelect( *maLbStyle.get(), mpDoc, *maWdPreview.get() ); mbIsInStyleCreate = false; return 0; @@ -1306,14 +1413,16 @@ IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl ) class ScIconSetFrmtDataEntry : public Control { private: - FixedImage maImgIcon; - FixedText maFtEntry; - Edit maEdEntry; - ListBox maLbEntryType; + VclPtr<FixedImage> maImgIcon; + VclPtr<FixedText> maFtEntry; + VclPtr<Edit> maEdEntry; + VclPtr<ListBox> maLbEntryType; public: ScIconSetFrmtDataEntry( vcl::Window* pParent, ScIconSetType eType, ScDocument* pDoc, sal_Int32 i, const ScColorScaleEntry* pEntry = NULL ); + virtual ~ScIconSetFrmtDataEntry(); + virtual void dispose() SAL_OVERRIDE; ScColorScaleEntry* CreateEntry(ScDocument* pDoc, const ScAddress& rPos) const; @@ -1322,31 +1431,31 @@ class ScIconSetFrmtDataEntry : public Control ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( vcl::Window* pParent, ScIconSetType eType, ScDocument* pDoc, sal_Int32 i, const ScColorScaleEntry* pEntry ): Control( pParent, ScResId( RID_ICON_SET_ENTRY ) ), - maImgIcon( this, ScResId( IMG_ICON ) ), - maFtEntry( this, ScResId( FT_ICON_SET_ENTRY_TEXT ) ), - maEdEntry( this, ScResId( ED_ICON_SET_ENTRY_VALUE ) ), - maLbEntryType( this, ScResId( LB_ICON_SET_ENTRY_TYPE ) ) + maImgIcon( VclPtr<FixedImage>::Create( this, ScResId( IMG_ICON ) ) ), + maFtEntry( VclPtr<FixedText>::Create( this, ScResId( FT_ICON_SET_ENTRY_TEXT ) ) ), + maEdEntry( VclPtr<Edit>::Create( this, ScResId( ED_ICON_SET_ENTRY_VALUE ) ) ), + maLbEntryType( VclPtr<ListBox>::Create( this, ScResId( LB_ICON_SET_ENTRY_TYPE ) ) ) { - maImgIcon.SetImage(Image(ScIconSetFormat::getBitmap(eType, i))); + maImgIcon->SetImage(Image(ScIconSetFormat::getBitmap(eType, i))); if(pEntry) { switch(pEntry->GetType()) { case COLORSCALE_VALUE: - maLbEntryType.SelectEntryPos(0); - maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc)); + maLbEntryType->SelectEntryPos(0); + maEdEntry->SetText(convertNumberToString(pEntry->GetValue(), pDoc)); break; case COLORSCALE_PERCENTILE: - maLbEntryType.SelectEntryPos(2); - maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc)); + maLbEntryType->SelectEntryPos(2); + maEdEntry->SetText(convertNumberToString(pEntry->GetValue(), pDoc)); break; case COLORSCALE_PERCENT: - maLbEntryType.SelectEntryPos(1); - maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc)); + maLbEntryType->SelectEntryPos(1); + maEdEntry->SetText(convertNumberToString(pEntry->GetValue(), pDoc)); break; case COLORSCALE_FORMULA: - maLbEntryType.SelectEntryPos(3); - maEdEntry.SetText(pEntry->GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); + maLbEntryType->SelectEntryPos(3); + maEdEntry->SetText(pEntry->GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); break; default: assert(false); @@ -1354,15 +1463,29 @@ ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( vcl::Window* pParent, ScIconSetT } else { - maLbEntryType.SelectEntryPos(1); + maLbEntryType->SelectEntryPos(1); } FreeResource(); } +ScIconSetFrmtDataEntry::~ScIconSetFrmtDataEntry() +{ + disposeOnce(); +} + +void ScIconSetFrmtDataEntry::dispose() +{ + maImgIcon.disposeAndClear(); + maFtEntry.disposeAndClear(); + maEdEntry.disposeAndClear(); + maLbEntryType.disposeAndClear(); + Control::dispose(); +} + ScColorScaleEntry* ScIconSetFrmtDataEntry::CreateEntry(ScDocument* pDoc, const ScAddress& rPos) const { - sal_Int32 nPos = maLbEntryType.GetSelectEntryPos(); - OUString aText = maEdEntry.GetText(); + sal_Int32 nPos = maLbEntryType->GetSelectEntryPos(); + OUString aText = maEdEntry->GetText(); ScColorScaleEntry* pEntry = new ScColorScaleEntry(); sal_uInt32 nIndex = 0; @@ -1395,69 +1518,81 @@ ScColorScaleEntry* ScIconSetFrmtDataEntry::CreateEntry(ScDocument* pDoc, const S void ScIconSetFrmtDataEntry::SetFirstEntry() { - maEdEntry.Hide(); - maLbEntryType.Hide(); - maFtEntry.Hide(); - maEdEntry.SetText(OUString("0")); - maLbEntryType.SelectEntryPos(1); + maEdEntry->Hide(); + maLbEntryType->Hide(); + maFtEntry->Hide(); + maEdEntry->SetText(OUString("0")); + maLbEntryType->SelectEntryPos(1); } ScIconSetFrmtEntry::ScIconSetFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat ): ScCondFrmtEntry( pParent, pDoc, rPos ), - maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), - maLbIconSetType( this, ScResId( LB_ICONSET_TYPE ) ) + maLbColorFormat( VclPtr<ListBox>::Create( this, ScResId( LB_COLOR_FORMAT ) ) ), + maLbIconSetType( VclPtr<ListBox>::Create( this, ScResId( LB_ICONSET_TYPE ) ) ) { Init(); FreeResource(); - maLbColorFormat.SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); + maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); if(pFormat) { const ScIconSetFormatData* pIconSetFormatData = pFormat->GetIconSetData(); ScIconSetType eType = pIconSetFormatData->eIconSetType; sal_Int32 nType = static_cast<sal_Int32>(eType); - maLbIconSetType.SelectEntryPos(nType); + maLbIconSetType->SelectEntryPos(nType); for(size_t i = 0, n = pIconSetFormatData->maEntries.size(); i < n; ++i) { - maEntries.push_back( new ScIconSetFrmtDataEntry( this, eType, pDoc, i, &pIconSetFormatData->maEntries[i] ) ); - Point aPos = maEntries[0].GetPosPixel(); - aPos.Y() += maEntries[0].GetSizePixel().Height() * i * 1.2; - maEntries[i].SetPosPixel( aPos ); + maEntries.push_back( VclPtr<ScIconSetFrmtDataEntry>::Create( this, eType, pDoc, i, &pIconSetFormatData->maEntries[i] ) ); + Point aPos = maEntries[0]->GetPosPixel(); + aPos.Y() += maEntries[0]->GetSizePixel().Height() * i * 1.2; + maEntries[i]->SetPosPixel( aPos ); } - maEntries.begin()->SetFirstEntry(); + maEntries[0]->SetFirstEntry(); } else IconSetTypeHdl(NULL); } +ScIconSetFrmtEntry::~ScIconSetFrmtEntry() +{ + disposeOnce(); +} + +void ScIconSetFrmtEntry::dispose() +{ + maLbColorFormat.disposeAndClear(); + maLbIconSetType.disposeAndClear(); + ScCondFrmtEntry::dispose(); +} + void ScIconSetFrmtEntry::Init() { - maLbColorFormat.SelectEntryPos(3); - maLbType.SelectEntryPos(0); - maLbIconSetType.SelectEntryPos(0); + maLbColorFormat->SelectEntryPos(3); + maLbType->SelectEntryPos(0); + maLbIconSetType->SelectEntryPos(0); - maLbIconSetType.SetSelectHdl( LINK( this, ScIconSetFrmtEntry, IconSetTypeHdl ) ); + maLbIconSetType->SetSelectHdl( LINK( this, ScIconSetFrmtEntry, IconSetTypeHdl ) ); } IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl ) { ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap(); - sal_Int32 nPos = maLbIconSetType.GetSelectEntryPos(); + sal_Int32 nPos = maLbIconSetType->GetSelectEntryPos(); sal_uInt32 nElements = pMap[nPos].nElements; maEntries.clear(); for(size_t i = 0; i < nElements; ++i) { - maEntries.push_back( new ScIconSetFrmtDataEntry( this, static_cast<ScIconSetType>(nPos), mpDoc, i ) ); - Point aPos = maEntries[0].GetPosPixel(); - aPos.Y() += maEntries[0].GetSizePixel().Height() * i * 1.2; - maEntries[i].SetPosPixel( aPos ); - maEntries[i].Show(); + maEntries.push_back( VclPtr<ScIconSetFrmtDataEntry>::Create( this, static_cast<ScIconSetType>(nPos), mpDoc, i ) ); + Point aPos = maEntries[0]->GetPosPixel(); + aPos.Y() += maEntries[0]->GetSizePixel().Height() * i * 1.2; + maEntries[i]->SetPosPixel( aPos ); + maEntries[i]->Show(); } - maEntries.begin()->SetFirstEntry(); + maEntries[0]->SetFirstEntry(); SetHeight(); static_cast<ScCondFormatList*>(GetParent())->RecalcAll(); @@ -1472,12 +1607,12 @@ OUString ScIconSetFrmtEntry::GetExpressionString() void ScIconSetFrmtEntry::SetActive() { - maLbColorFormat.Show(); - maLbIconSetType.Show(); + maLbColorFormat->Show(); + maLbIconSetType->Show(); for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(), itrEnd = maEntries.end(); itr != itrEnd; ++itr) { - itr->Show(); + (*itr)->Show(); } Select(); @@ -1485,12 +1620,12 @@ void ScIconSetFrmtEntry::SetActive() void ScIconSetFrmtEntry::SetInactive() { - maLbColorFormat.Hide(); - maLbIconSetType.Hide(); + maLbColorFormat->Hide(); + maLbIconSetType->Hide(); for(ScIconSetFrmtDataEntriesType::iterator itr = maEntries.begin(), itrEnd = maEntries.end(); itr != itrEnd; ++itr) { - itr->Hide(); + (*itr)->Hide(); } Deselect(); @@ -1501,11 +1636,11 @@ ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const ScIconSetFormat* pFormat = new ScIconSetFormat(mpDoc); ScIconSetFormatData* pData = new ScIconSetFormatData; - pData->eIconSetType = static_cast<ScIconSetType>(maLbIconSetType.GetSelectEntryPos()); + pData->eIconSetType = static_cast<ScIconSetType>(maLbIconSetType->GetSelectEntryPos()); for(ScIconSetFrmtDataEntriesType::const_iterator itr = maEntries.begin(), itrEnd = maEntries.end(); itr != itrEnd; ++itr) { - pData->maEntries.push_back(itr->CreateEntry(mpDoc, maPos)); + pData->maEntries.push_back((*itr)->CreateEntry(mpDoc, maPos)); } pFormat->SetIconSetData(pData); diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index c4c73b5deff7..f018fce02b07 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -120,7 +120,7 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* Size aSize(LogicToPixel(Size(290, 220), MAP_APPFONT)); pContainer->set_width_request(aSize.Width()); pContainer->set_height_request(aSize.Height()); - m_pCtrlManager = new ScCondFormatManagerWindow(*pContainer, mpDoc, mpFormatList); + m_pCtrlManager = VclPtr<ScCondFormatManagerWindow>::Create(*pContainer, mpDoc, mpFormatList); get(m_pBtnAdd, "add"); get(m_pBtnRemove, "remove"); get(m_pBtnEdit, "edit"); @@ -133,8 +133,17 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* ScCondFormatManagerDlg::~ScCondFormatManagerDlg() { - delete m_pCtrlManager; + disposeOnce(); +} + +void ScCondFormatManagerDlg::dispose() +{ delete mpFormatList; + m_pBtnAdd.clear(); + m_pBtnRemove.clear(); + m_pBtnEdit.clear(); + m_pCtrlManager.disposeAndClear(); + ModalDialog::dispose(); } @@ -162,8 +171,8 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl) sal_uInt16 nId = 1; ScModule* pScMod = SC_MOD(); pScMod->SetRefDialog( nId, true ); - boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), - pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE)); + VclPtrInstance<ScCondFormatDlg> pDlg(this, mpDoc, pFormat, pFormat->GetRange(), + pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE); Show(false, 0); if(pDlg->Execute() == RET_OK) { @@ -208,8 +217,8 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl) sal_uInt16 nId = 1; ScModule* pScMod = SC_MOD(); pScMod->SetRefDialog( nId, true ); - boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(), - maPos, condformat::dialog::CONDITION)); + VclPtrInstance<ScCondFormatDlg> pDlg(this, mpDoc, nullptr, ScRangeList(), + maPos, condformat::dialog::CONDITION); Show(false, 0); if(pDlg->Execute() == RET_OK) { 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 ) diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx index f9384ac281e0..2d91c929f12c 100644 --- a/sc/source/ui/dialogs/searchresults.cxx +++ b/sc/source/ui/dialogs/searchresults.cxx @@ -32,7 +32,7 @@ SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, vcl::Window* pParen pContainer->set_width_request(aControlSize.Width()); pContainer->set_height_request(aControlSize.Height()); - mpList = new SvSimpleTable(*pContainer); + mpList = VclPtr<SvSimpleTable>::Create(*pContainer); long nTabs[] = {3, 0, 40, 60}; mpList->SetTabs(&nTabs[0]); mpList->InsertHeaderEntry(SC_RESSTR(STR_SHEET) + "\t" + SC_RESSTR(STR_CELL) + "\t" + SC_RESSTR(STR_CONTENT)); @@ -41,7 +41,13 @@ SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, vcl::Window* pParen SearchResultsDlg::~SearchResultsDlg() { - delete mpList; + disposeOnce(); +} + +void SearchResultsDlg::dispose() +{ + mpList.disposeAndClear(); + ModelessDialog::dispose(); } void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatchedRanges ) @@ -118,7 +124,7 @@ SearchResultsDlgWrapper::SearchResultsDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* /*pInfo*/ ) : SfxChildWindow(_pParent, nId) { - pWindow = new SearchResultsDlg(pBindings, _pParent, nId); + pWindow = VclPtr<SearchResultsDlg>::Create(pBindings, _pParent, nId); } SearchResultsDlgWrapper::~SearchResultsDlgWrapper() {} diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 663eb89dfaf5..8b3247af4f3b 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -459,9 +459,9 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, //! Link-Dialog muss Default-Parent setzen // "kann keine Zeilen einfuegen" - InfoBox aBox( Application::GetDefDialogParent(), - ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_2 ) ); - aBox.Execute(); + ScopedVclPtrInstance<InfoBox> aBox( Application::GetDefDialogParent(), + ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_2 ) ); + aBox->Execute(); } // aufraeumen diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index bb974630a333..d8e63818fb7e 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1269,9 +1269,9 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb // OutRange of pOldObj (pDestObj) is still old area if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange())) { - QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), + ScopedVclPtrInstance<QueryBox> aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) ); - if (aBox.Execute() == RET_NO) + if (aBox->Execute() == RET_NO) { //! like above (not editable) *pOldObj = aUndoDPObj; @@ -1421,11 +1421,11 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool if (!bEmpty) { - QueryBox aBox( + ScopedVclPtrInstance<QueryBox> aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY)); - if (aBox.Execute() == RET_NO) + if (aBox->Execute() == RET_NO) { //! like above (not editable) return false; @@ -1495,9 +1495,9 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) { if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange())) { - QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), - ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) ); - if (aBox.Execute() == RET_NO) + ScopedVclPtrInstance<QueryBox> aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), + ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) ); + if (aBox->Execute() == RET_NO) { rDPObj = aUndoDPObj; return false; @@ -1593,9 +1593,9 @@ void ScDBDocFunc::UpdateImport( const OUString& rTarget, const svx::ODataAccessD const ScDBData* pData = rDBColl.getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rTarget)); if (!pData) { - InfoBox aInfoBox(rDocShell.GetActiveDialogParent(), - ScGlobal::GetRscString( STR_TARGETNOTFOUND ) ); - aInfoBox.Execute(); + ScopedVclPtrInstance<InfoBox> aInfoBox( rDocShell.GetActiveDialogParent(), + ScGlobal::GetRscString( STR_TARGETNOTFOUND ) ); + aInfoBox->Execute(); return; } diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 6c0b23772d5a..df197e37db44 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -635,8 +635,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, nErrStringId = STR_MSSG_IMPORTDATA_0; aErrorMessage = ScGlobal::GetRscString( nErrStringId ); } - InfoBox aInfoBox( rDocShell.GetActiveDialogParent(), aErrorMessage ); - aInfoBox.Execute(); + ScopedVclPtrInstance< InfoBox > aInfoBox( rDocShell.GetActiveDialogParent(), aErrorMessage ); + aInfoBox->Execute(); } delete pImportDoc; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 753fd6de8735..305ab149d229 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2764,7 +2764,6 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() ) UnmergeCells( aPasteDest, false ); - VirtualDevice aVirtDev; bool bDestHeight = AdjustRowHeight( ScRange( 0,nDestRow,nDestTab, MAXCOL,nDestEndRow,nDestEndTab ), false ); @@ -3757,8 +3756,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi ) { if (!bApi) { - InfoBox aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) ); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) ); + aBox->Execute(); } return false; } @@ -3787,8 +3786,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi ) { if (!bApi) { - InfoBox aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) ); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) ); + aBox->Execute(); } return false; } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index a422041945e6..ad3b6bffee8f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -472,14 +472,14 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::R { // Generator is not LibreOffice. Ask if the user wants to perform // full re-calculation. - QueryBox aBox( + ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS)); - aBox.SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED)); + aBox->SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED)); - bHardRecalc = aBox.Execute() == RET_YES; + bHardRecalc = aBox->Execute() == RET_YES; - if (aBox.GetCheckBoxState()) + if (aBox->GetCheckBoxState()) { // Always perform selected action in the future. std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); @@ -689,11 +689,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) ScAppOptions aAppOptions = SC_MOD()->GetAppOptions(); if ( aAppOptions.GetShowSharedDocumentWarning() ) { - WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ), + ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_OK ), ScGlobal::GetRscString( STR_SHARED_DOC_WARNING ) ); - aBox.SetDefaultCheckBoxText(); - aBox.Execute(); - bool bChecked = aBox.GetCheckBoxState(); + aBox->SetDefaultCheckBoxText(); + aBox->Execute(); + bool bChecked = aBox->GetCheckBoxState(); if ( bChecked ) { aAppOptions.SetShowSharedDocumentWarning( !bChecked ); @@ -818,8 +818,8 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_SAVE_LATER ) ); aMessage = aMessage.replaceFirst( "%1", aUserName ); - WarningBox aBox( GetActiveDialogParent(), WinBits( WB_RETRY_CANCEL | WB_DEF_RETRY ), aMessage ); - if ( aBox.Execute() == RET_RETRY ) + ScopedVclPtrInstance< WarningBox > aBox( GetActiveDialogParent(), WinBits( WB_RETRY_CANCEL | WB_DEF_RETRY ), aMessage ); + if ( aBox->Execute() == RET_RETRY ) { bRetry = true; } @@ -893,9 +893,9 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } else { - WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ), + ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_OK ), ScGlobal::GetRscString( STR_DOC_NOLONGERSHARED ) ); - aBox.Execute(); + aBox->Execute(); SfxBindings* pBindings = GetViewBindings(); if ( pBindings ) @@ -934,10 +934,10 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { if ( GetDocument().GetExternalRefManager()->containsUnsavedReferences() ) { - WarningBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO ), + ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_YES_NO ), ScGlobal::GetRscString( STR_UNSAVED_EXT_REF ) ); - if( RET_NO == aBox.Execute()) + if( RET_NO == aBox->Execute()) { SetError( ERRCODE_IO_ABORT, OUString( OSL_LOG_PREFIX ) ); // this error code will produce no error message, but will break the further saving process } @@ -1454,7 +1454,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) Fraction aZoom( 1, 1 ); double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / GetOutputFactor(); // Factor is printer display ratio double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom; - VirtualDevice aVirtDev; + ScopedVclPtrInstance< VirtualDevice > pVirtDev; // all sheets (for Excel import) SCTAB nTabCount = aDocument.GetTableCount(); for (SCTAB nTab=0; nTab<nTabCount; nTab++) @@ -1477,7 +1477,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) aColWidthParam[nCol].mbSimpleText = false; sal_uInt16 nWidth = aDocument.GetOptimalColWidth( - nCol, nTab, &aVirtDev, nPPTX, nPPTY, aZoom, aZoom, false, &aMark, + nCol, nTab, pVirtDev, nPPTX, nPPTY, aZoom, aZoom, false, &aMark, &aColWidthParam[nCol] ); aDocument.SetColWidth( nCol, nTab, nWidth + (sal_uInt16)ScGlobal::nLastColWidthExtra ); @@ -2880,10 +2880,10 @@ void ScDocShell::GetDocStat( ScDocStat& rDocStat ) (sal_uInt16) ScPrintFunc( this, pPrinter, i ).GetTotalPages() ); } -SfxDocumentInfoDialog* ScDocShell::CreateDocumentInfoDialog( +VclPtr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet ) { - SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog( pParent, rSet ); + VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( pParent, rSet ); ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current()); // Only for statistics, if this Doc is shown; not from the Doc Manager diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 66c3a8608338..b97bf8675e89 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -368,11 +368,11 @@ void ScDocShell::CalcOutputFactor() pRefDev->SetFont(aOldFont); pRefDev->SetMapMode(aOldMode); - VirtualDevice aVirtWindow( *Application::GetDefaultDevice() ); - aVirtWindow.SetMapMode(MAP_PIXEL); - pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, &aVirtWindow); // font color doesn't matter here - aVirtWindow.SetFont(aDefFont); - nWindowWidth = aVirtWindow.GetTextWidth(aTestString); + ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *Application::GetDefaultDevice() ); + pVirtWindow->SetMapMode(MAP_PIXEL); + pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // font color doesn't matter here + pVirtWindow->SetFont(aDefFont); + nWindowWidth = pVirtWindow->GetTextWidth(aTestString); nWindowWidth = (long) ( nWindowWidth / ScGlobal::nScreenPPTX * HMM_PER_TWIPS ); if (nPrinterWidth && nWindowWidth) @@ -1202,12 +1202,12 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) while ( bLoop ) { bLoop = false; - ScConflictsDlg aDlg( GetActiveDialogParent(), GetViewData(), &rSharedDoc, aConflictsList ); - if ( aDlg.Execute() == RET_CANCEL ) + ScopedVclPtrInstance< ScConflictsDlg > aDlg( GetActiveDialogParent(), GetViewData(), &rSharedDoc, aConflictsList ); + if ( aDlg->Execute() == RET_CANCEL ) { - QueryBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ), + ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ), ScGlobal::GetRscString( STR_DOC_WILLNOTBESAVED ) ); - if ( aBox.Execute() == RET_YES ) + if ( aBox->Execute() == RET_YES ) { return false; } @@ -1320,8 +1320,8 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) PostPaintExtras(); PostPaintGridAll(); - InfoBox aInfoBox( GetActiveDialogParent(), ScGlobal::GetRscString( STR_DOC_UPDATED ) ); - aInfoBox.Execute(); + ScopedVclPtrInstance< InfoBox > aInfoBox( GetActiveDialogParent(), ScGlobal::GetRscString( STR_DOC_UPDATED ) ); + aInfoBox->Execute(); } return ( pThisAction != NULL ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 8e400290014e..515ed542a921 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -222,8 +222,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) aMessage += sTarget; aMessage += aTemplate.getToken( 1, '#' ); - QueryBox aBox( 0, WinBits(WB_YES_NO | WB_DEF_YES), aMessage ); - bDo = ( aBox.Execute() == RET_YES ); + ScopedVclPtrInstance< QueryBox > aBox( nullptr, WinBits(WB_YES_NO | WB_DEF_YES), aMessage ); + bDo = ( aBox->Execute() == RET_YES ); } if (bDo) @@ -427,10 +427,10 @@ void ScDocShell::Execute( SfxRequest& rReq ) if(nSet==LM_ON_DEMAND) { - QueryBox aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), + ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_RELOAD_TABLES) ); - nDlgRet=aBox.Execute(); + nDlgRet=aBox->Execute(); } if (nDlgRet == RET_YES || nSet==LM_ALWAYS) @@ -476,9 +476,9 @@ void ScDocShell::Execute( SfxRequest& rReq ) OSL_ENSURE(pViewSh,"SID_REIMPORT_AFTER_LOAD: keine View"); if (pViewSh && pDBColl) { - QueryBox aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), + ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD) ); - if (aBox.Execute() == RET_YES) + if (aBox->Execute() == RET_YES) { ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs(); ScDBCollection::NamedDBs::iterator itr = rDBs.begin(), itrEnd = rDBs.end(); @@ -575,10 +575,10 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( !pItem ) { // no dialog on playing the macro - WarningBox aBox( pParent ? pParent : GetActiveDialogParent(), + ScopedVclPtrInstance<WarningBox> aBox( pParent ? pParent : GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_NO), ScGlobal::GetRscString( STR_END_REDLINING ) ); - bDo = ( aBox.Execute() == RET_YES ); + bDo = ( aBox->Execute() == RET_YES ); } if ( bDo ) @@ -644,10 +644,10 @@ void ScDocShell::Execute( SfxRequest& rReq ) { if ( nSlot == SID_DOCUMENT_COMPARE ) { //! old changes trace will be lost - WarningBox aBox( GetActiveDialogParent(), + ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_NO), ScGlobal::GetRscString( STR_END_REDLINING ) ); - if( aBox.Execute() == RET_YES ) + if( aBox->Execute() == RET_YES ) bDo = ExecuteChangeProtectionDialog( NULL, true ); else bDo = false; @@ -913,10 +913,10 @@ void ScDocShell::Execute( SfxRequest& rReq ) break; } - ScShareDocumentDlg aDlg( GetActiveDialogParent(), pViewData ); - if ( aDlg.Execute() == RET_OK ) + ScopedVclPtrInstance< ScShareDocumentDlg > aDlg( GetActiveDialogParent(), pViewData ); + if ( aDlg->Execute() == RET_OK ) { - bool bSetShared = aDlg.IsShareDocumentChecked(); + bool bSetShared = aDlg->IsShareDocumentChecked(); if ( bSetShared != static_cast< bool >( IsDocShared() ) ) { if ( bSetShared ) @@ -924,9 +924,11 @@ void ScDocShell::Execute( SfxRequest& rReq ) bool bContinue = true; if ( HasName() ) { - QueryBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ), + ScopedVclPtrInstance<QueryBox> aBox( + GetActiveDialogParent(), + WinBits( WB_YES_NO | WB_DEF_YES ), ScGlobal::GetRscString( STR_DOC_WILLBESAVED ) ); - if ( aBox.Execute() == RET_NO ) + if ( aBox->Execute() == RET_NO ) { bContinue = false; } @@ -1013,14 +1015,16 @@ void ScDocShell::Execute( SfxRequest& rReq ) OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_TRY_LATER ) ); aMessage = aMessage.replaceFirst( "%1", aUserName ); - WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ), aMessage ); - aBox.Execute(); + ScopedVclPtrInstance< WarningBox > aBox( GetActiveDialogParent(), WinBits( WB_OK ), aMessage ); + aBox->Execute(); } else { - WarningBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ), + ScopedVclPtrInstance<WarningBox> aBox( + GetActiveDialogParent(), + WinBits( WB_YES_NO | WB_DEF_YES ), ScGlobal::GetRscString( STR_DOC_DISABLESHARED ) ); - if ( aBox.Execute() == RET_YES ) + if ( aBox->Execute() == RET_YES ) { xCloseable->close( sal_True ); @@ -1052,9 +1056,9 @@ void ScDocShell::Execute( SfxRequest& rReq ) else { xCloseable->close( sal_True ); - WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ), + ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_OK ), ScGlobal::GetRscString( STR_DOC_NOLONGERSHARED ) ); - aBox.Execute(); + aBox->Execute(); } } catch ( uno::Exception& ) @@ -1127,8 +1131,8 @@ bool ScDocShell::ExecuteChangeProtectionDialog( vcl::Window* _pParent, bool bJus OUString aText( ScResId( SCSTR_PASSWORD ) ); OUString aPassword; - boost::scoped_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog( - _pParent ? _pParent : GetActiveDialogParent(), &aText )); + ScopedVclPtrInstance<SfxPasswordDialog> pDlg( + _pParent ? _pParent : GetActiveDialogParent(), &aText ); pDlg->SetText( aTitle ); pDlg->SetMinLen( 1 ); pDlg->SetHelpId( GetStaticInterface()->GetSlot(SID_CHG_PROTECT)->GetCommand() ); @@ -1153,9 +1157,9 @@ bool ScDocShell::ExecuteChangeProtectionDialog( vcl::Window* _pParent, bool bJus } else { - InfoBox aBox( GetActiveDialogParent(), + ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) ); - aBox.Execute(); + aBox->Execute(); } } else @@ -1483,9 +1487,9 @@ void ScDocShell::PageStyleModified( const OUString& rStyleName, bool bApi ) if (bWarn && !bApi) { ScWaitCursorOff aWaitOff( GetActiveDialogParent() ); - InfoBox aInfoBox(GetActiveDialogParent(), - ScGlobal::GetRscString(STR_PRINT_INVALID_AREA)); - aInfoBox.Execute(); + ScopedVclPtrInstance<InfoBox> aInfoBox(GetActiveDialogParent(), + ScGlobal::GetRscString(STR_PRINT_INVALID_AREA)); + aInfoBox->Execute(); } } diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 79167bcaa71d..f95815389e66 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -81,8 +81,8 @@ void ScDocShell::ErrorMessage( sal_uInt16 nGlobStrId ) } } - InfoBox aBox( pParent, ScGlobal::GetRscString( nGlobStrId ) ); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox( pParent, ScGlobal::GetRscString( nGlobStrId ) ); + aBox->Execute(); if (bFocus) pParent->GrabFocus(); } @@ -487,9 +487,9 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord ) if (bErr) { - InfoBox aBox( GetActiveDialogParent(), + ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(), ScGlobal::GetRscString( STR_CONSOLIDATE_ERR1 ) ); - aBox.Execute(); + aBox->Execute(); return; } @@ -697,16 +697,16 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) } else { - InfoBox aBox(GetActiveDialogParent(), + ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(), ScGlobal::GetRscString( STR_PROTECTIONERR ) ); - aBox.Execute(); + aBox->Execute(); } } else { - InfoBox aBox(GetActiveDialogParent(), + ScopedVclPtrInstance<InfoBox> aBox(GetActiveDialogParent(), ScGlobal::GetRscString( STR_SCENARIO_NOTFOUND ) ); - aBox.Execute(); + aBox->Execute(); } } else diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index 3918dbc929df..6d320959f46e 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -531,8 +531,8 @@ void ScDocShell::CheckConfigOptions() if (pViewShell) { vcl::Window* pParent = pViewShell->GetFrameWin(); - InfoBox aBox(pParent, ScGlobal::GetRscString(STR_OPTIONS_WARN_SEPARATORS)); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox(pParent, ScGlobal::GetRscString(STR_OPTIONS_WARN_SEPARATORS)); + aBox->Execute(); } // For now, this is the only option setting that could launch info diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index 7da7c3855d8c..42745eb3f344 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -165,8 +165,8 @@ bool DocumentLinkManager::updateDdeLinks( vcl::Window* pWin ) aBuf.append(aElem); aBuf.appendAscii("\nType : "); aBuf.append(aType); - MessageDialog aBox(pWin, aBuf.makeStringAndClear()); - aBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aBox(pWin, aBuf.makeStringAndClear()); + aBox->Execute(); } } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index e99e9e017e94..ddea5130c995 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -3020,9 +3020,9 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint ) { SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell(); ScDocShell* pDocShell = static_cast< ScDocShell* >( pObjShell ); - WarningBox aBox( pDocShell->GetActiveDialogParent(), WinBits( WB_OK ), + ScopedVclPtrInstance<WarningBox> aBox( pDocShell->GetActiveDialogParent(), WinBits( WB_OK ), ScGlobal::GetRscString( STR_CLOSE_WITH_UNSAVED_REFS ) ); - aBox.Execute(); + aBox->Execute(); } break; case SFX_EVENT_SAVEDOCDONE: diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 806c1b4d7c01..e11b6be89f79 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -210,9 +210,9 @@ bool ScImportExport::StartPaste() ScEditableTester aTester( pDoc, aRange ); if ( !aTester.IsEditable() ) { - InfoBox aInfoBox(Application::GetDefDialogParent(), + ScopedVclPtrInstance<InfoBox> aInfoBox( Application::GetDefDialogParent(), ScGlobal::GetRscString( aTester.GetMessageId() ) ); - aInfoBox.Execute(); + aInfoBox->Execute(); return false; } } @@ -1452,8 +1452,8 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) if ( !mbApi && nStartCol != nEndCol && !pDoc->IsBlockEmpty( nTab, nStartCol + 1, nStartRow, nEndCol, nRow ) ) { - ScReplaceWarnBox aBox( pDocSh->GetActiveDialogParent() ); - if ( aBox.Execute() != RET_YES ) + ScopedVclPtrInstance< ScReplaceWarnBox > aBox( pDocSh->GetActiveDialogParent() ); + if ( aBox->Execute() != RET_YES ) { return false; } diff --git a/sc/source/ui/docshell/sizedev.cxx b/sc/source/ui/docshell/sizedev.cxx index e0ff33c205c1..744266efe4f5 100644 --- a/sc/source/ui/docshell/sizedev.cxx +++ b/sc/source/ui/docshell/sizedev.cxx @@ -55,7 +55,7 @@ ScSizeDeviceProvider::ScSizeDeviceProvider( ScDocShell* pDocSh ) ScSizeDeviceProvider::~ScSizeDeviceProvider() { if (bOwner) - delete pDevice; + pDevice.disposeAndClear(); else pDevice->SetMapMode( aOldMapMode ); } diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 65df85b18ff9..6c8edb9ecbb5 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -47,9 +47,9 @@ struct TableLink_Impl { - ScDocShell* m_pDocSh; - vcl::Window* m_pOldParent; - Link m_aEndEditLink; + ScDocShell* m_pDocSh; + VclPtr<vcl::Window> m_pOldParent; + Link m_aEndEditLink; TableLink_Impl() : m_pDocSh( NULL ), m_pOldParent( NULL ) {} }; diff --git a/sc/source/ui/docshell/tpstat.cxx b/sc/source/ui/docshell/tpstat.cxx index 7895be53451e..7aca08e43042 100644 --- a/sc/source/ui/docshell/tpstat.cxx +++ b/sc/source/ui/docshell/tpstat.cxx @@ -27,9 +27,9 @@ // Dokumentinfo-Tabpage: -SfxTabPage* ScDocStatPage::Create( vcl::Window *pParent, const SfxItemSet* rSet ) +VclPtr<SfxTabPage> ScDocStatPage::Create( vcl::Window *pParent, const SfxItemSet* rSet ) { - return new ScDocStatPage( pParent, *rSet ); + return VclPtr<SfxTabPage>( new ScDocStatPage ( pParent, *rSet ), SAL_NO_ACQUIRE ); } ScDocStatPage::ScDocStatPage( vcl::Window *pParent, const SfxItemSet& rSet ) @@ -56,8 +56,18 @@ ScDocStatPage::ScDocStatPage( vcl::Window *pParent, const SfxItemSet& rSet ) ScDocStatPage::~ScDocStatPage() { + disposeOnce(); } +void ScDocStatPage::dispose() +{ + m_pFtTables.clear(); + m_pFtCells.clear(); + m_pFtPages.clear(); + SfxTabPage::dispose(); +} + + bool ScDocStatPage::FillItemSet( SfxItemSet* /* rSet */ ) { return false; diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index d53741d617e9..43b8f0616b54 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -271,8 +271,8 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell* pViewSh, // really store as link only? if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() ) { - SvxLinkWarningDialog aWarnDlg(pWin,aFileName); - if( aWarnDlg.Execute() != RET_OK ) + ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(pWin,aFileName); + if( aWarnDlg->Execute() != RET_OK ) bAsLink = false; // don't store as link } diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx index aab43720b1c8..46b4132fc7be 100644 --- a/sc/source/ui/drawfunc/fupoor.cxx +++ b/sc/source/ui/drawfunc/fupoor.cxx @@ -53,8 +53,7 @@ FuPoor::~FuPoor() { aDragTimer.Stop(); aScrollTimer.Stop(); - - delete pDialog; + pDialog.disposeAndClear(); } void FuPoor::Activate() diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index b98f92be1f57..f8c2be9ca17b 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -200,10 +200,10 @@ void ScGraphicShell::ExecuteCompressGraphic( SfxRequest& ) if( pObj && pObj->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GRAPHIC_BITMAP ) { SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj); - CompressGraphicsDialog dialog( GetViewData()->GetDialogParent(), pGraphicObj, GetViewData()->GetBindings() ); - if ( dialog.Execute() == RET_OK ) + ScopedVclPtrInstance< CompressGraphicsDialog > dialog( GetViewData()->GetDialogParent(), pGraphicObj, GetViewData()->GetBindings() ); + if ( dialog->Execute() == RET_OK ) { - SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj(); + SdrGrafObj* pNewObject = dialog->GetCompressedSdrGrafObj(); SdrPageView* pPageView = pView->GetSdrPageView(); OUString aUndoString = pView->GetDescriptionOfMarkedObjects() + " Compress"; pView->BegUndo( aUndoString ); diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 65604ad60cac..1a692d54dc80 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -63,7 +63,7 @@ ScFunctionChildWindow::ScFunctionChildWindow( vcl::Window* pParentP, SfxChildWinInfo* pInfo ) : SfxChildWindow( pParentP, nId ) { - ScFunctionDockWin* pWin = new ScFunctionDockWin( pBindings, this, + VclPtr<ScFunctionDockWin> pWin = VclPtr<ScFunctionDockWin>::Create( pBindings, this, pParentP, ScResId( FID_FUNCTION_BOX ) ); pWindow = pWin; @@ -90,12 +90,12 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, SfxChildWindow *pCW, vcl::Window* pParent, const ResId& rResId ) : SfxDockingWindow( pBindingsP, pCW, pParent, rResId ), - aPrivatSplit ( this, ResId( FT_SPLIT, *rResId.GetResMgr() ),SC_SPLIT_VERT), - aCatBox ( this, ResId( CB_CAT, *rResId.GetResMgr() ) ), - aFuncList ( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ), - aDDFuncList ( this, ResId( DDLB_FUNC, *rResId.GetResMgr() ) ), - aInsertButton ( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ), - aFiFuncDesc ( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ), + aPrivatSplit ( VclPtr<ScPrivatSplit>::Create( this, ResId( FT_SPLIT, *rResId.GetResMgr() ),SC_SPLIT_VERT) ), + aCatBox ( VclPtr<ListBox>::Create( this, ResId( CB_CAT, *rResId.GetResMgr() ) ) ), + aFuncList ( VclPtr<ListBox>::Create( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ) ), + aDDFuncList ( VclPtr<ListBox>::Create( this, ResId( DDLB_FUNC, *rResId.GetResMgr() ) ) ), + aInsertButton ( VclPtr<ImageButton>::Create( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ) ), + aFiFuncDesc ( VclPtr<FixedText>::Create( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ) ), aOldSize (0,0), pFuncDesc (NULL) { @@ -111,45 +111,45 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, else eSfxNewAlignment=SfxChildAlignment::RIGHT; eSfxOldAlignment=eSfxNewAlignment; - aFiFuncDesc.SetUpdateMode(true); - pAllFuncList=&aFuncList; - aDDFuncList.Disable(); - aDDFuncList.Hide(); + aFiFuncDesc->SetUpdateMode(true); + pAllFuncList=aFuncList.get(); + aDDFuncList->Disable(); + aDDFuncList->Hide(); nArgs=0; nDockMode=0; bSizeFlag=false; - aCatBox.SetDropDownLineCount(9); - vcl::Font aFont=aFiFuncDesc.GetFont(); + aCatBox->SetDropDownLineCount(9); + vcl::Font aFont=aFiFuncDesc->GetFont(); aFont.SetColor(Color(COL_BLACK)); - aFiFuncDesc.SetFont(aFont); - aFiFuncDesc.SetBackground( GetBackground() ); //! never transparent? + aFiFuncDesc->SetFont(aFont); + aFiFuncDesc->SetBackground( GetBackground() ); //! never transparent? Link aLink=LINK( this, ScFunctionDockWin, SelHdl); - aCatBox.SetSelectHdl(aLink); - aFuncList.SetSelectHdl(aLink); - aDDFuncList.SetSelectHdl(aLink); + aCatBox->SetSelectHdl(aLink); + aFuncList->SetSelectHdl(aLink); + aDDFuncList->SetSelectHdl(aLink); Link a2Link=LINK( this, ScFunctionDockWin, SetSelectionHdl); - aFuncList.SetDoubleClickHdl(a2Link); - aDDFuncList.SetSelectHdl(aLink); - aInsertButton.SetClickHdl(a2Link); + aFuncList->SetDoubleClickHdl(a2Link); + aDDFuncList->SetSelectHdl(aLink); + aInsertButton->SetClickHdl(a2Link); Link a3Link=LINK( this, ScFunctionDockWin, SetSplitHdl); - aPrivatSplit.SetCtrModifiedHdl(a3Link); + aPrivatSplit->SetCtrModifiedHdl(a3Link); StartListening( *pBindingsP, true ); - Point aTopLeft=aCatBox.GetPosPixel(); + Point aTopLeft=aCatBox->GetPosPixel(); OUString aString("ww"); - Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() ); + Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() ); nMinWidth=aTxtSize.Width()+aTopLeft.X() - +2*aFuncList.GetPosPixel().X(); + +2*aFuncList->GetPosPixel().X(); nMinHeight=19*aTxtSize.Height(); - aCatBox.SelectEntryPos(0); + aCatBox->SelectEntryPos(0); - Range aYRange(3*aTxtSize.Height()+aFuncList.GetPosPixel().Y(), + Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(), GetOutputSizePixel().Height()-2*aTxtSize.Height()); - aPrivatSplit.SetYRange(aYRange); - SelHdl(&aCatBox); + aPrivatSplit->SetYRange(aYRange); + SelHdl(aCatBox.get()); bInit = true; } @@ -169,7 +169,20 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, ScFunctionDockWin::~ScFunctionDockWin() { + disposeOnce(); +} + +void ScFunctionDockWin::dispose() +{ EndListening( GetBindings() ); + aPrivatSplit.disposeAndClear(); + aCatBox.disposeAndClear(); + aFuncList.disposeAndClear(); + aDDFuncList.disposeAndClear(); + aInsertButton.disposeAndClear(); + aFiFuncDesc.disposeAndClear(); + pAllFuncList.clear(); + SfxDockingWindow::dispose(); } /************************************************************************* @@ -192,7 +205,7 @@ void ScFunctionDockWin::InitLRUList() ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr(); pFuncMgr->fillLastRecentlyUsedFunctions(aLRUList); - sal_Int32 nSelPos = aCatBox.GetSelectEntryPos(); + sal_Int32 nSelPos = aCatBox->GetSelectEntryPos(); if(nSelPos == 0) UpdateFunctionList(); @@ -254,18 +267,18 @@ void ScFunctionDockWin::SetSize() if(nDockMode!=nNewDockMode) { nDockMode=nNewDockMode; - nSelEntry=aFuncList.GetSelectEntryPos(); - aFuncList.Clear(); - aFiFuncDesc.SetPosPixel(aFuncList.GetPosPixel()); - aDDFuncList.Enable(); - aDDFuncList.Show(); - aPrivatSplit.Disable(); - aPrivatSplit.Hide(); - aFuncList.Disable(); - aFuncList.Hide(); - pAllFuncList=&aDDFuncList; - SelHdl(&aCatBox); - aDDFuncList.SelectEntryPos(nSelEntry); + nSelEntry=aFuncList->GetSelectEntryPos(); + aFuncList->Clear(); + aFiFuncDesc->SetPosPixel(aFuncList->GetPosPixel()); + aDDFuncList->Enable(); + aDDFuncList->Show(); + aPrivatSplit->Disable(); + aPrivatSplit->Hide(); + aFuncList->Disable(); + aFuncList->Hide(); + pAllFuncList=aDDFuncList.get(); + SelHdl(aCatBox.get()); + aDDFuncList->SelectEntryPos(nSelEntry); } break; @@ -273,17 +286,17 @@ void ScFunctionDockWin::SetSize() if(nDockMode!=nNewDockMode) { nDockMode=nNewDockMode; - nSelEntry=aDDFuncList.GetSelectEntryPos(); - aDDFuncList.Clear(); - aDDFuncList.Disable(); - aDDFuncList.Hide(); - aPrivatSplit.Enable(); - aPrivatSplit.Show(); - aFuncList.Enable(); - aFuncList.Show(); - pAllFuncList=&aFuncList; - SelHdl(&aCatBox); - aFuncList.SelectEntryPos(nSelEntry); + nSelEntry=aDDFuncList->GetSelectEntryPos(); + aDDFuncList->Clear(); + aDDFuncList->Disable(); + aDDFuncList->Hide(); + aPrivatSplit->Enable(); + aPrivatSplit->Show(); + aFuncList->Enable(); + aFuncList->Show(); + pAllFuncList=aFuncList.get(); + SelHdl(aCatBox.get()); + aFuncList->SelectEntryPos(nSelEntry); } break; } @@ -324,11 +337,11 @@ void ScFunctionDockWin::SetLeftRightSize() aDiffSize.Height()-=aNewSize.Height(); OUString aString("ww"); - Size aTxtSize( aFuncList.GetTextWidth(aString), aFuncList.GetTextHeight() ); + Size aTxtSize( aFuncList->GetTextWidth(aString), aFuncList->GetTextHeight() ); - Range aYRange(3*aTxtSize.Height()+aFuncList.GetPosPixel().Y(), + Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(), GetOutputSizePixel().Height()-2*aTxtSize.Height()); - aPrivatSplit.SetYRange(aYRange); + aPrivatSplit->SetYRange(aYRange); if(aOldSize.Width()!=aNewSize.Width()) SetMyWidthLeRi(aNewSize); @@ -396,23 +409,23 @@ void ScFunctionDockWin::SetMyWidthLeRi(Size &aNewSize) { if((sal_uLong)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth; - Size aCDSize=aCatBox.GetSizePixel(); - Size aFLSize=aFuncList.GetSizePixel(); - Size aSplitterSize=aPrivatSplit.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aCDSize=aCatBox->GetSizePixel(); + Size aFLSize=aFuncList->GetSizePixel(); + Size aSplitterSize=aPrivatSplit->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aCDTopLeft=aCatBox.GetPosPixel(); - Point aFLTopLeft=aFuncList.GetPosPixel(); + Point aCDTopLeft=aCatBox->GetPosPixel(); + Point aFLTopLeft=aFuncList->GetPosPixel(); aCDSize.Width()=aNewSize.Width()-aCDTopLeft.X()-aFLTopLeft.X(); aFLSize.Width()=aNewSize.Width()-2*aFLTopLeft.X(); aFDSize.Width()=aFLSize.Width(); aSplitterSize.Width()=aFLSize.Width(); - aCatBox.SetSizePixel(aCDSize); - aFuncList.SetSizePixel(aFLSize); - aPrivatSplit.SetSizePixel(aSplitterSize); - aFiFuncDesc.SetSizePixel(aFDSize); + aCatBox->SetSizePixel(aCDSize); + aFuncList->SetSizePixel(aFLSize); + aPrivatSplit->SetSizePixel(aSplitterSize); + aFiFuncDesc->SetSizePixel(aFDSize); } /************************************************************************* @@ -434,18 +447,18 @@ void ScFunctionDockWin::SetMyHeightLeRi(Size &aNewSize) { if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight; - Size aFLSize=aFuncList.GetSizePixel(); - Size aSplitterSize=aPrivatSplit.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aFLSize=aFuncList->GetSizePixel(); + Size aSplitterSize=aPrivatSplit->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aFLTopLeft=aFuncList.GetPosPixel(); - Point aSplitterTopLeft=aPrivatSplit.GetPosPixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); + Point aFLTopLeft=aFuncList->GetPosPixel(); + Point aSplitterTopLeft=aPrivatSplit->GetPosPixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); - long nTxtHeight = aFuncList.GetTextHeight(); + long nTxtHeight = aFuncList->GetTextHeight(); short nY=(short)(3*nTxtHeight+ - aFuncList.GetPosPixel().Y()+aSplitterSize.Height()); + aFuncList->GetPosPixel().Y()+aSplitterSize.Height()); aFDTopLeft.Y()=aNewSize.Height()-aFDSize.Height()-4; if(nY>aFDTopLeft.Y()) @@ -456,10 +469,10 @@ void ScFunctionDockWin::SetMyHeightLeRi(Size &aNewSize) aSplitterTopLeft.Y()=aFDTopLeft.Y()-aSplitterSize.Height()-1; aFLSize.Height()=aSplitterTopLeft.Y()-aFLTopLeft.Y()-1; - aFuncList.SetSizePixel(aFLSize); - aPrivatSplit.SetPosPixel(aSplitterTopLeft); - aFiFuncDesc.SetPosPixel(aFDTopLeft); - aFiFuncDesc.SetSizePixel(aFDSize); + aFuncList->SetSizePixel(aFLSize); + aPrivatSplit->SetPosPixel(aSplitterTopLeft); + aFiFuncDesc->SetPosPixel(aFDTopLeft); + aFiFuncDesc->SetSizePixel(aFDSize); } @@ -483,13 +496,13 @@ void ScFunctionDockWin::SetMyWidthToBo(Size &aNewSize) { if((sal_uLong)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth; - Size aCDSize=aCatBox.GetSizePixel(); - Size aDdFLSize=aDDFuncList.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aCDSize=aCatBox->GetSizePixel(); + Size aDdFLSize=aDDFuncList->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aCDTopLeft=aCatBox.GetPosPixel(); - Point aDdFLTopLeft=aDDFuncList.GetPosPixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); + Point aCDTopLeft=aCatBox->GetPosPixel(); + Point aDdFLTopLeft=aDDFuncList->GetPosPixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); aCDSize.Width()=aDdFLTopLeft.X()-aFDTopLeft.X()-aCDTopLeft.X(); aDdFLTopLeft.X()=aCDSize.Width()+aCDTopLeft.X()+aFDTopLeft.X(); @@ -498,10 +511,10 @@ void ScFunctionDockWin::SetMyWidthToBo(Size &aNewSize) aFDSize.Width()=aNewSize.Width()-2*aFDTopLeft.X(); - aDDFuncList.SetPosPixel(aDdFLTopLeft); - aDDFuncList.SetSizePixel(aDdFLSize); - aCatBox.SetSizePixel(aCDSize); - aFiFuncDesc.SetSizePixel(aFDSize); + aDDFuncList->SetPosPixel(aDdFLTopLeft); + aDDFuncList->SetSizePixel(aDdFLSize); + aCatBox->SetSizePixel(aCDSize); + aFiFuncDesc->SetSizePixel(aFDSize); } /************************************************************************* @@ -524,12 +537,12 @@ void ScFunctionDockWin::SetMyHeightToBo(Size &aNewSize) { if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight; - Size aFDSize=aFiFuncDesc.GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); - Point aCBTopLeft=aCatBox.GetPosPixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); + Point aCBTopLeft=aCatBox->GetPosPixel(); aFDSize.Height()=aNewSize.Height()-aFDTopLeft.Y()-aCBTopLeft.Y(); - aFiFuncDesc.SetSizePixel(aFDSize); + aFiFuncDesc->SetSizePixel(aFDSize); } @@ -549,7 +562,7 @@ void ScFunctionDockWin::SetMyHeightToBo(Size &aNewSize) void ScFunctionDockWin::SetDescription() { - aFiFuncDesc.SetText( EMPTY_OUSTRING ); + aFiFuncDesc->SetText( EMPTY_OUSTRING ); const ScFuncDesc* pDesc = static_cast<const ScFuncDesc*>(pAllFuncList->GetEntryData( pAllFuncList->GetSelectEntryPos() )); @@ -580,10 +593,10 @@ void ScFunctionDockWin::SetDescription() aBuf.append(*pDesc->pFuncDesc); - aFiFuncDesc.SetText(aBuf.makeStringAndClear()); - aFiFuncDesc.StateChanged(StateChangedType::TEXT); - aFiFuncDesc.Invalidate(); - aFiFuncDesc.Update(); + aFiFuncDesc->SetText(aBuf.makeStringAndClear()); + aFiFuncDesc->StateChanged(StateChangedType::TEXT); + aFiFuncDesc->Invalidate(); + aFiFuncDesc->Update(); } } @@ -641,7 +654,7 @@ SfxChildAlignment ScFunctionDockWin::CheckAlignment(SfxChildAlignment /* abla */ SfxChildAlignment aChildAlign) { OUString aString("ww"); - Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() ); + Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() ); if(!bInit) { eSfxOldAlignment=eSfxNewAlignment; @@ -671,14 +684,14 @@ SfxChildAlignment ScFunctionDockWin::CheckAlignment(SfxChildAlignment /* abla */ case SfxChildAlignment::NOALIGNMENT: - aString = aCatBox.GetEntry(0); + aString = aCatBox->GetEntry(0); aString += "www"; - aTxtSize = Size( aFiFuncDesc.GetTextWidth(aString), - aFiFuncDesc.GetTextHeight() ); + aTxtSize = Size( aFiFuncDesc->GetTextWidth(aString), + aFiFuncDesc->GetTextHeight() ); // fall-through - default: Point aTopLeft=aCatBox.GetPosPixel(); + default: Point aTopLeft=aCatBox->GetPosPixel(); nMinWidth=aTxtSize.Width()+aTopLeft.X() - +2*aFuncList.GetPosPixel().X(); + +2*aFuncList->GetPosPixel().X(); nMinHeight=19*aTxtSize.Height(); break; @@ -733,7 +746,7 @@ void ScFunctionDockWin::Resize() void ScFunctionDockWin::UpdateFunctionList() { - sal_Int32 nSelPos = aCatBox.GetSelectEntryPos(); + sal_Int32 nSelPos = aCatBox->GetSelectEntryPos(); sal_Int32 nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) ? (nSelPos-1) : 0; @@ -912,13 +925,13 @@ void ScFunctionDockWin::DoEnter() IMPL_LINK( ScFunctionDockWin, SelHdl, ListBox*, pLb ) { - if ( pLb == &aCatBox) + if ( pLb == aCatBox.get() ) { UpdateFunctionList(); SetDescription(); } - if ( pLb == &aFuncList||pLb == &aDDFuncList) + if ( pLb == aFuncList.get() || pLb == aDDFuncList.get() ) { SetDescription(); } @@ -944,8 +957,8 @@ IMPL_LINK( ScFunctionDockWin, SelHdl, ListBox*, pLb ) IMPL_LINK( ScFunctionDockWin, SetSelectionHdl, void*, pCtrl ) { - if (static_cast<ImageButton *>(pCtrl) == &aInsertButton || - static_cast<ListBox *>(pCtrl) == &aFuncList) + if (static_cast<ImageButton *>(pCtrl) == aInsertButton.get() || + static_cast<ListBox *>(pCtrl) == aFuncList.get()) { DoEnter(); // Uebernimmt die Eingabe } @@ -970,19 +983,19 @@ IMPL_LINK( ScFunctionDockWin, SetSelectionHdl, void*, pCtrl ) IMPL_LINK( ScFunctionDockWin, SetSplitHdl, ScPrivatSplit*, pCtrl ) { - if (pCtrl == &aPrivatSplit) + if (pCtrl == aPrivatSplit.get()) { - short nDeltaY=aPrivatSplit.GetDeltaY(); - Size aFLSize=aFuncList.GetSizePixel(); - Size aFDSize=aFiFuncDesc.GetSizePixel(); - Point aFDTopLeft=aFiFuncDesc.GetPosPixel(); + short nDeltaY=aPrivatSplit->GetDeltaY(); + Size aFLSize=aFuncList->GetSizePixel(); + Size aFDSize=aFiFuncDesc->GetSizePixel(); + Point aFDTopLeft=aFiFuncDesc->GetPosPixel(); aFLSize.Height()+=nDeltaY; aFDSize.Height()-=nDeltaY; aFDTopLeft.Y()+=nDeltaY; - aFuncList.SetSizePixel(aFLSize); - aFiFuncDesc.SetPosPixel(aFDTopLeft); - aFiFuncDesc.SetSizePixel(aFDSize); + aFuncList->SetSizePixel(aFLSize); + aFiFuncDesc->SetPosPixel(aFDTopLeft); + aFiFuncDesc->SetSizePixel(aFDSize); } return 0; @@ -1040,13 +1053,13 @@ void ScFunctionDockWin::Initialize(SfxChildWinInfo *pInfo) if ( !aStr.isEmpty()) { - aSplitterInitPos = aPrivatSplit.GetPosPixel(); + aSplitterInitPos = aPrivatSplit->GetPosPixel(); aSplitterInitPos.Y() = (sal_uInt16) aStr.toInt32(); sal_Int32 n1 = aStr.indexOf(';'); aStr = aStr.copy( n1+1 ); sal_Int32 nSelPos = aStr.toInt32(); - aCatBox.SelectEntryPos(nSelPos); - SelHdl(&aCatBox); + aCatBox->SelectEntryPos(nSelPos); + SelHdl(aCatBox.get()); // if the window has already been shown (from SfxDockingWindow::Initialize if docked), // set the splitter position now, otherwise it is set in StateChanged with type INITSHOW @@ -1058,17 +1071,17 @@ void ScFunctionDockWin::Initialize(SfxChildWinInfo *pInfo) void ScFunctionDockWin::FillInfo(SfxChildWinInfo& rInfo) const { SfxDockingWindow::FillInfo(rInfo); - Point aPoint=aPrivatSplit.GetPosPixel(); + Point aPoint=aPrivatSplit->GetPosPixel(); rInfo.aExtraString += "ScFuncList:(" + OUString::number(aPoint.Y()) + ";" + - OUString::number(aCatBox.GetSelectEntryPos()) + ")"; + OUString::number(aCatBox->GetSelectEntryPos()) + ")"; } void ScFunctionDockWin::UseSplitterInitPos() { - if ( IsVisible() && aPrivatSplit.IsEnabled() && aSplitterInitPos != Point() ) + if ( IsVisible() && aPrivatSplit->IsEnabled() && aSplitterInitPos != Point() ) { - aPrivatSplit.MoveSplitTo(aSplitterInitPos); + aPrivatSplit->MoveSplitTo(aSplitterInitPos); aSplitterInitPos = Point(); // use only once } } diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 5909f3bf7dfe..e9f160fb13f8 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -241,6 +241,11 @@ void ScFormulaDlg::fill() ScFormulaDlg::~ScFormulaDlg() { + disposeOnce(); +} + +void ScFormulaDlg::dispose() +{ ScModule* pScMod = SC_MOD(); ScFormEditData* pData = pScMod->GetFormEditData(); @@ -250,6 +255,7 @@ ScFormulaDlg::~ScFormulaDlg() pScMod->SetRefInputHdl(NULL); StoreFormEditData(pData); } + formula::FormulaDlg::dispose(); } bool ScFormulaDlg::IsInputHdl(ScInputHandler* pHdl) diff --git a/sc/source/ui/inc/AccessibleCsvControl.hxx b/sc/source/ui/inc/AccessibleCsvControl.hxx index 74753391a62c..a8f3180b3090 100644 --- a/sc/source/ui/inc/AccessibleCsvControl.hxx +++ b/sc/source/ui/inc/AccessibleCsvControl.hxx @@ -29,6 +29,7 @@ #include <cppuhelper/implbase2.hxx> #include <editeng/AccessibleStaticTextBase.hxx> #include <comphelper/uno3.hxx> +#include <vcl/vclptr.hxx> #include "AccessibleContextBase.hxx" class ScCsvControl; @@ -50,7 +51,7 @@ protected: typedef ::com::sun::star::awt::Rectangle AwtRectangle; private: - ScCsvControl* mpControl; /// Pointer to the VCL control. + VclPtr<ScCsvControl> mpControl; /// Pointer to the VCL control. public: explicit ScAccessibleCsvControl( diff --git a/sc/source/ui/inc/AccessibleEditObject.hxx b/sc/source/ui/inc/AccessibleEditObject.hxx index 919a896a561f..4e6501929d18 100644 --- a/sc/source/ui/inc/AccessibleEditObject.hxx +++ b/sc/source/ui/inc/AccessibleEditObject.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include "global.hxx" +#include <vcl/window.hxx> namespace accessibility { @@ -188,7 +189,7 @@ public: private: accessibility::AccessibleTextHelper* mpTextHelper; EditView* mpEditView; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; EditObjectType meObjectType; bool mbHasFocus; diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx index 9be73428bd3b..2d4601b6c92b 100644 --- a/sc/source/ui/inc/AccessibleText.hxx +++ b/sc/source/ui/inc/AccessibleText.hxx @@ -134,7 +134,7 @@ protected: EditView* mpEditView; EditEngine* mpEditEngine; SvxEditEngineForwarder* mpForwarder; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; bool mbIsCloned; }; @@ -274,7 +274,7 @@ private: typedef ::std::unique_ptr< SvxTextForwarder > TextForwarderPtr; typedef ::std::unique_ptr< ScCsvViewForwarder > ViewForwarderPtr; - vcl::Window* mpWindow; + VclPtr<vcl::Window> mpWindow; EditEngine* mpEditEngine; TextForwarderPtr mpTextForwarder; ViewForwarderPtr mpViewForwarder; diff --git a/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx index a6808a53b3e5..0b1d068149aa 100644 --- a/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx +++ b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx @@ -33,10 +33,10 @@ private: TWO_FACTOR }; - NumericField* mpAlphaField; - RadioButton* mpSingleFactorRadio; - RadioButton* mpTwoFactorRadio; - NumericField* mpRowsPerSampleField; + VclPtr<NumericField> mpAlphaField; + VclPtr<RadioButton> mpSingleFactorRadio; + VclPtr<RadioButton> mpTwoFactorRadio; + VclPtr<NumericField> mpRowsPerSampleField; DECL_LINK(FactorChanged, void*); @@ -55,6 +55,7 @@ public: vcl::Window* pParent, ScViewData* pViewData ); virtual ~ScAnalysisOfVarianceDialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/ExponentialSmoothingDialog.hxx b/sc/source/ui/inc/ExponentialSmoothingDialog.hxx index 9012c6755435..0f186b4f4252 100644 --- a/sc/source/ui/inc/ExponentialSmoothingDialog.hxx +++ b/sc/source/ui/inc/ExponentialSmoothingDialog.hxx @@ -24,7 +24,7 @@ class ScExponentialSmoothingDialog : public ScStatisticsInputOutputDialog { private: - NumericField* mpSmoothingFactor; + VclPtr<NumericField> mpSmoothingFactor; public: ScExponentialSmoothingDialog( @@ -32,6 +32,7 @@ public: vcl::Window* pParent, ScViewData* pViewData ); virtual ~ScExponentialSmoothingDialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/MovingAverageDialog.hxx b/sc/source/ui/inc/MovingAverageDialog.hxx index dab6acc8e5a2..f6aa85eb079b 100644 --- a/sc/source/ui/inc/MovingAverageDialog.hxx +++ b/sc/source/ui/inc/MovingAverageDialog.hxx @@ -24,7 +24,7 @@ class ScMovingAverageDialog : public ScStatisticsInputOutputDialog { private: - NumericField* mpIntervalSpin; + VclPtr<NumericField> mpIntervalSpin; public: ScMovingAverageDialog( @@ -32,6 +32,7 @@ public: vcl::Window* pParent, ScViewData* pViewData ); virtual ~ScMovingAverageDialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx index c806a8ccb2ff..765990615a98 100644 --- a/sc/source/ui/inc/PivotLayoutDialog.hxx +++ b/sc/source/ui/inc/PivotLayoutDialog.hxx @@ -44,8 +44,8 @@ class ScPivotLayoutDialog : public ScAnyRefDlg public: ScDPObject maPivotTableObject; - ScPivotLayoutTreeListBase* mpPreviouslyFocusedListBox; - ScPivotLayoutTreeListBase* mpCurrentlyFocusedListBox; + VclPtr<ScPivotLayoutTreeListBase> mpPreviouslyFocusedListBox; + VclPtr<ScPivotLayoutTreeListBase> mpCurrentlyFocusedListBox; private: ScViewData* mpViewData; @@ -53,38 +53,38 @@ private: bool mbNewPivotTable; - ScPivotLayoutTreeListLabel* mpListBoxField; - ScPivotLayoutTreeList* mpListBoxPage; - ScPivotLayoutTreeList* mpListBoxColumn; - ScPivotLayoutTreeList* mpListBoxRow; - ScPivotLayoutTreeListData* mpListBoxData; + VclPtr<ScPivotLayoutTreeListLabel> mpListBoxField; + VclPtr<ScPivotLayoutTreeList> mpListBoxPage; + VclPtr<ScPivotLayoutTreeList> mpListBoxColumn; + VclPtr<ScPivotLayoutTreeList> mpListBoxRow; + VclPtr<ScPivotLayoutTreeListData> mpListBoxData; - CheckBox* mpCheckIgnoreEmptyRows; - CheckBox* mpCheckTotalColumns; - CheckBox* mpCheckAddFilter; - CheckBox* mpCheckIdentifyCategories; - CheckBox* mpCheckTotalRows; - CheckBox* mpCheckDrillToDetail; + VclPtr<CheckBox> mpCheckIgnoreEmptyRows; + VclPtr<CheckBox> mpCheckTotalColumns; + VclPtr<CheckBox> mpCheckAddFilter; + VclPtr<CheckBox> mpCheckIdentifyCategories; + VclPtr<CheckBox> mpCheckTotalRows; + VclPtr<CheckBox> mpCheckDrillToDetail; - RadioButton* mpSourceRadioNamedRange; - RadioButton* mpSourceRadioSelection; + VclPtr<RadioButton> mpSourceRadioNamedRange; + VclPtr<RadioButton> mpSourceRadioSelection; - ListBox* mpSourceListBox; - formula::RefEdit* mpSourceEdit; - formula::RefButton* mpSourceButton; + VclPtr<ListBox> mpSourceListBox; + VclPtr<formula::RefEdit> mpSourceEdit; + VclPtr<formula::RefButton> mpSourceButton; - RadioButton* mpDestinationRadioNewSheet; - RadioButton* mpDestinationRadioNamedRange; - RadioButton* mpDestinationRadioSelection; + VclPtr<RadioButton> mpDestinationRadioNewSheet; + VclPtr<RadioButton> mpDestinationRadioNamedRange; + VclPtr<RadioButton> mpDestinationRadioSelection; - ListBox* mpDestinationListBox; - formula::RefEdit* mpDestinationEdit; - formula::RefButton* mpDestinationButton; + VclPtr<ListBox> mpDestinationListBox; + VclPtr<formula::RefEdit> mpDestinationEdit; + VclPtr<formula::RefButton> mpDestinationButton; - PushButton* mpBtnOK; - CancelButton* mpBtnCancel; + VclPtr<PushButton> mpBtnOK; + VclPtr<CancelButton> mpBtnCancel; - formula::RefEdit* mpActiveEdit; + VclPtr<formula::RefEdit> mpActiveEdit; ScAddress::Details maAddressDetails; bool mbDialogLostFocus; @@ -111,6 +111,7 @@ public: ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent, ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable); virtual ~ScPivotLayoutDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx index 7812674a351c..4ce7740f2bb9 100644 --- a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx +++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx @@ -35,13 +35,14 @@ public: protected: SvPivotTreeListType meType; - ScPivotLayoutDialog* mpParent; + VclPtr<ScPivotLayoutDialog> mpParent; public: void Setup(ScPivotLayoutDialog* pParent); ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBits nBits, SvPivotTreeListType eType = UNDEFINED); virtual ~ScPivotLayoutTreeListBase(); + virtual void dispose() SAL_OVERRIDE; virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvent) SAL_OVERRIDE; virtual bool NotifyAcceptDrop(SvTreeListEntry* pEntry) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx index b1736b2661c0..6d791c27c2a4 100644 --- a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx +++ b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx @@ -29,6 +29,7 @@ public: vcl::Window* pParent, ScViewData* pViewData ); virtual ~ScRandomNumberGeneratorDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; @@ -36,21 +37,21 @@ public: private: // Widgets - FixedText* mpInputRangeText; - formula::RefEdit* mpInputRangeEdit; - formula::RefButton* mpInputRangeButton; - ListBox* mpDistributionCombo; - FixedText* mpParameter1Text; - NumericField* mpParameter1Value; - FixedText* mpParameter2Text; - NumericField* mpParameter2Value; - NumericField* mpSeed; - CheckBox* mpEnableSeed; - NumericField* mpDecimalPlaces; - CheckBox* mpEnableRounding; - PushButton* mpButtonApply; - OKButton* mpButtonOk; - CloseButton* mpButtonClose; + VclPtr<FixedText> mpInputRangeText; + VclPtr<formula::RefEdit> mpInputRangeEdit; + VclPtr<formula::RefButton> mpInputRangeButton; + VclPtr<ListBox> mpDistributionCombo; + VclPtr<FixedText> mpParameter1Text; + VclPtr<NumericField> mpParameter1Value; + VclPtr<FixedText> mpParameter2Text; + VclPtr<NumericField> mpParameter2Value; + VclPtr<NumericField> mpSeed; + VclPtr<CheckBox> mpEnableSeed; + VclPtr<NumericField> mpDecimalPlaces; + VclPtr<CheckBox> mpEnableRounding; + VclPtr<PushButton> mpButtonApply; + VclPtr<OKButton> mpButtonOk; + VclPtr<CloseButton> mpButtonClose; // Data ScViewData* mpViewData; diff --git a/sc/source/ui/inc/SamplingDialog.hxx b/sc/source/ui/inc/SamplingDialog.hxx index 022b5e8075d0..6622ad90cd4c 100644 --- a/sc/source/ui/inc/SamplingDialog.hxx +++ b/sc/source/ui/inc/SamplingDialog.hxx @@ -27,30 +27,31 @@ public: vcl::Window* pParent, ScViewData* pViewData ); virtual ~ScSamplingDialog(); + virtual void dispose() SAL_OVERRIDE; - virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; - virtual void SetActive() SAL_OVERRIDE; + virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; + virtual void SetActive() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; private: // Widgets - FixedText* mpInputRangeLabel; - formula::RefEdit* mpInputRangeEdit; - formula::RefButton* mpInputRangeButton; + VclPtr<FixedText> mpInputRangeLabel; + VclPtr<formula::RefEdit> mpInputRangeEdit; + VclPtr<formula::RefButton> mpInputRangeButton; - FixedText* mpOutputRangeLabel; - formula::RefEdit* mpOutputRangeEdit; - formula::RefButton* mpOutputRangeButton; + VclPtr<FixedText> mpOutputRangeLabel; + VclPtr<formula::RefEdit> mpOutputRangeEdit; + VclPtr<formula::RefButton> mpOutputRangeButton; - NumericField* mpSampleSize; - NumericField* mpPeriod; + VclPtr<NumericField> mpSampleSize; + VclPtr<NumericField> mpPeriod; - RadioButton* mpRandomMethodRadio; - RadioButton* mpPeriodicMethodRadio; + VclPtr<RadioButton> mpRandomMethodRadio; + VclPtr<RadioButton> mpPeriodicMethodRadio; - OKButton* mpButtonOk; + VclPtr<OKButton> mpButtonOk; - formula::RefEdit* mpActiveEdit; + VclPtr<formula::RefEdit> mpActiveEdit; // Data ScViewData* mViewData; diff --git a/sc/source/ui/inc/StatisticsInputOutputDialog.hxx b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx index 520ec223a784..c18119c0b4ec 100644 --- a/sc/source/ui/inc/StatisticsInputOutputDialog.hxx +++ b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx @@ -33,6 +33,7 @@ public: const OUString& rID, const OUString& rUIXMLDescription ); virtual ~ScStatisticsInputOutputDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; @@ -44,16 +45,16 @@ protected: virtual sal_Int16 GetUndoNameId() = 0; // Widgets - FixedText* mpInputRangeLabel; - formula::RefEdit* mpInputRangeEdit; - formula::RefButton* mpInputRangeButton; + VclPtr<FixedText> mpInputRangeLabel; + VclPtr<formula::RefEdit> mpInputRangeEdit; + VclPtr<formula::RefButton> mpInputRangeButton; - FixedText* mpOutputRangeLabel; - formula::RefEdit* mpOutputRangeEdit; - formula::RefButton* mpOutputRangeButton; + VclPtr<FixedText> mpOutputRangeLabel; + VclPtr<formula::RefEdit> mpOutputRangeEdit; + VclPtr<formula::RefButton> mpOutputRangeButton; - RadioButton* mpGroupByColumnsRadio; - RadioButton* mpGroupByRowsRadio; + VclPtr<RadioButton> mpGroupByColumnsRadio; + VclPtr<RadioButton> mpGroupByRowsRadio; // Data ScViewData* mViewData; @@ -69,9 +70,9 @@ protected: private: // Widgets - OKButton* mpButtonOk; + VclPtr<OKButton> mpButtonOk; - formula::RefEdit* mpActiveEdit; + VclPtr<formula::RefEdit> mpActiveEdit; ScAddress mCurrentAddress; bool mDialogLostFocus; diff --git a/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx b/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx index db4514ab49f9..b0a48e1dcbc7 100644 --- a/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx +++ b/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx @@ -33,6 +33,7 @@ public: const OUString& rID, const OUString& rUIXMLDescription ); virtual ~ScStatisticsTwoVariableDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; @@ -44,17 +45,17 @@ protected: virtual sal_Int16 GetUndoNameId() = 0; // Widgets - FixedText* mpVariable1RangeLabel; - formula::RefEdit* mpVariable1RangeEdit; - formula::RefButton* mpVariable1RangeButton; + VclPtr<FixedText> mpVariable1RangeLabel; + VclPtr<formula::RefEdit> mpVariable1RangeEdit; + VclPtr<formula::RefButton> mpVariable1RangeButton; - FixedText* mpVariable2RangeLabel; - formula::RefEdit* mpVariable2RangeEdit; - formula::RefButton* mpVariable2RangeButton; + VclPtr<FixedText> mpVariable2RangeLabel; + VclPtr<formula::RefEdit> mpVariable2RangeEdit; + VclPtr<formula::RefButton> mpVariable2RangeButton; - FixedText* mpOutputRangeLabel; - formula::RefEdit* mpOutputRangeEdit; - formula::RefButton* mpOutputRangeButton; + VclPtr<FixedText> mpOutputRangeLabel; + VclPtr<formula::RefEdit> mpOutputRangeEdit; + VclPtr<formula::RefButton> mpOutputRangeButton; // Data ScViewData* mViewData; @@ -69,12 +70,12 @@ protected: private: // Widgets - OKButton* mpButtonOk; + VclPtr<OKButton> mpButtonOk; - RadioButton* mpGroupByColumnsRadio; - RadioButton* mpGroupByRowsRadio; + VclPtr<RadioButton> mpGroupByColumnsRadio; + VclPtr<RadioButton> mpGroupByRowsRadio; - formula::RefEdit* mpActiveEdit; + VclPtr<formula::RefEdit> mpActiveEdit; ScAddress mCurrentAddress; bool mDialogLostFocus; diff --git a/sc/source/ui/inc/acredlin.hxx b/sc/source/ui/inc/acredlin.hxx index 5f10898ba278..c8252fd9db0b 100644 --- a/sc/source/ui/inc/acredlin.hxx +++ b/sc/source/ui/inc/acredlin.hxx @@ -98,13 +98,13 @@ private: Idle aSelectionIdle; Idle aReOpenIdle; - SvxAcceptChgCtr* m_pAcceptChgCtr; + VclPtr<SvxAcceptChgCtr> m_pAcceptChgCtr; ScViewData* pViewData; ScDocument* pDoc; ScRangeName aLocalRangeName; - SvxTPFilter* pTPFilter; - SvxTPView* pTPView; - SvxRedlinTable* pTheView; // #i48648 now SvHeaderTabListBox + VclPtr<SvxTPFilter> pTPFilter; + VclPtr<SvxTPView> pTPView; + VclPtr<SvxRedlinTable> pTheView; // #i48648 now SvHeaderTabListBox ScRangeList aRangeList; ScChangeViewSettings aChangeViewSet; OUString aStrInsertCols; @@ -206,6 +206,7 @@ public: ScViewData* ptrViewData); virtual ~ScAcceptChgDlg(); + virtual void dispose() SAL_OVERRIDE; void ReInit(ScViewData* ptrViewData); diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 4a7ee80233f9..833b541709dc 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -45,13 +45,13 @@ class ScFormulaReferenceHelper { IAnyRefDialog* m_pDlg; ::std::unique_ptr<ScCompiler> pRefComp; - formula::RefEdit* pRefEdit; // active input field - formula::RefButton* pRefBtn; // associated button - vcl::Window* m_pWindow; + VclPtr<formula::RefEdit> pRefEdit; // active input field + VclPtr<formula::RefButton> pRefBtn; // associated button + VclPtr<vcl::Window> m_pWindow; SfxBindings* m_pBindings; ::std::unique_ptr<Accelerator> pAccel; // for Enter/Escape - ::std::vector<vcl::Window*> m_aHiddenWidgets; // vector of hidden Controls + ::std::vector<VclPtr<vcl::Window> > m_aHiddenWidgets; // vector of hidden Controls sal_Int32 m_nOldBorderWidth; // border width for expanded dialog SCTAB nRefTab; // used for ShowReference @@ -61,7 +61,7 @@ class ScFormulaReferenceHelper Size aOldEditSize; // Original size of the input field long mnOldEditWidthReq; Point aOldButtonPos; // Original position of the button - vcl::Window* mpOldEditParent; // Original parent of the edit field and the button + VclPtr<vcl::Window> mpOldEditParent; // Original parent of the edit field and the button bool mbOldDlgLayoutEnabled; // Original layout state of parent dialog bool mbOldEditParentLayoutEnabled; // Original layout state of edit widget parent @@ -106,11 +106,11 @@ public: class SC_DLLPUBLIC ScRefHandler : public IAnyRefDialog { - vcl::Window & m_rWindow; - bool m_bInRefMode; + VclPtr<vcl::Window> m_rWindow; + bool m_bInRefMode; public: - operator vcl::Window *(){ return &m_rWindow; } + operator vcl::Window *(){ return m_rWindow.get(); } vcl::Window* operator ->() { return static_cast<vcl::Window *>(*this); } friend class formula::RefButton; friend class formula::RefEdit; @@ -120,7 +120,7 @@ private: m_aHelper; SfxBindings* pMyBindings; - vcl::Window* pActiveWin; + VclPtr<vcl::Window> pActiveWin; Idle aIdle; OUString aDocName; // document on which the dialog was opened diff --git a/sc/source/ui/inc/areasdlg.hxx b/sc/source/ui/inc/areasdlg.hxx index dab930898c55..dbc09faa4467 100644 --- a/sc/source/ui/inc/areasdlg.hxx +++ b/sc/source/ui/inc/areasdlg.hxx @@ -1,4 +1,3 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * @@ -35,6 +34,7 @@ class ScPrintAreasDlg : public ScAnyRefDlg public: ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent ); virtual ~ScPrintAreasDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual void AddRefEntry() SAL_OVERRIDE; @@ -46,23 +46,23 @@ public: virtual bool Close() SAL_OVERRIDE; private: - ListBox* pLbPrintArea; - formula::RefEdit* pEdPrintArea; - formula::RefButton* pRbPrintArea; + VclPtr<ListBox> pLbPrintArea; + VclPtr<formula::RefEdit> pEdPrintArea; + VclPtr<formula::RefButton> pRbPrintArea; - ListBox* pLbRepeatRow; - formula::RefEdit* pEdRepeatRow; - formula::RefButton* pRbRepeatRow; + VclPtr<ListBox> pLbRepeatRow; + VclPtr<formula::RefEdit> pEdRepeatRow; + VclPtr<formula::RefButton> pRbRepeatRow; - ListBox* pLbRepeatCol; - formula::RefEdit* pEdRepeatCol; - formula::RefButton* pRbRepeatCol; + VclPtr<ListBox> pLbRepeatCol; + VclPtr<formula::RefEdit> pEdRepeatCol; + VclPtr<formula::RefButton> pRbRepeatCol; - OKButton* pBtnOk; - CancelButton* pBtnCancel; + VclPtr<OKButton> pBtnOk; + VclPtr<CancelButton> pBtnCancel; bool bDlgLostFocus; - formula::RefEdit* pRefInputEdit; + VclPtr<formula::RefEdit> pRefInputEdit; ScDocument* pDoc; ScViewData* pViewData; SCTAB nCurTab; diff --git a/sc/source/ui/inc/autofmt.hxx b/sc/source/ui/inc/autofmt.hxx index 59879825d07b..8227376434f3 100644 --- a/sc/source/ui/inc/autofmt.hxx +++ b/sc/source/ui/inc/autofmt.hxx @@ -46,6 +46,7 @@ public: ScAutoFmtPreview(vcl::Window* pParent); void DetectRTL(ScViewData *pViewData); virtual ~ScAutoFmtPreview(); + virtual void dispose() SAL_OVERRIDE; void NotifyChange( ScAutoFormatData* pNewData ); @@ -55,7 +56,7 @@ protected: private: ScAutoFormatData* pCurData; - VirtualDevice aVD; + ScopedVclPtrInstance<VirtualDevice> aVD; SvtScriptedTextHelper aScriptedText; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter; bool bFitWidth; diff --git a/sc/source/ui/inc/cbutton.hxx b/sc/source/ui/inc/cbutton.hxx index f6b15a68ccea..2e8c8b1eac53 100644 --- a/sc/source/ui/inc/cbutton.hxx +++ b/sc/source/ui/inc/cbutton.hxx @@ -22,6 +22,7 @@ #include <tools/gen.hxx> #include <tools/color.hxx> +#include <vcl/vclptr.hxx> class OutputDevice; @@ -60,7 +61,7 @@ private: bool bState ); protected: - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; Point aBtnPos; Size aBtnSize; }; diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index aea85074aba1..11dc8ddf0108 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -48,6 +48,7 @@ public: explicit ScMenuFloatingWindow(vcl::Window* pParent, ScDocument* pDoc, sal_uInt16 nMenuStackLevel = 0); virtual ~ScMenuFloatingWindow(); + void dispose() SAL_OVERRIDE; virtual void PopupModeEnd() SAL_OVERRIDE; virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE; @@ -148,7 +149,7 @@ private: bool mbSeparator:1; ::boost::shared_ptr<Action> mpAction; - ::boost::shared_ptr<ScMenuFloatingWindow> mpSubMenuWin; + VclPtr<ScMenuFloatingWindow> mpSubMenuWin; MenuItemData(); }; @@ -158,7 +159,7 @@ private: struct SubMenuItemData { Timer maTimer; - ScMenuFloatingWindow* mpSubMenu; + VclPtr<ScMenuFloatingWindow> mpSubMenu; size_t mnMenuPos; DECL_LINK( TimeoutHdl, void* ); @@ -167,7 +168,7 @@ private: void reset(); private: - ScMenuFloatingWindow* mpParent; + VclPtr<ScMenuFloatingWindow> mpParent; }; SubMenuItemData maOpenTimer; SubMenuItemData maCloseTimer; @@ -184,7 +185,7 @@ private: ScDocument* mpDoc; - ScMenuFloatingWindow* mpParentMenu; + VclPtr<ScMenuFloatingWindow> mpParentMenu; }; class ScCheckListBox : public SvTreeListBox @@ -196,7 +197,8 @@ class ScCheckListBox : public SvTreeListBox public: ScCheckListBox( vcl::Window* pParent, WinBits nWinStyle = 0 ); - virtual ~ScCheckListBox() { delete mpCheckButton; } + virtual ~ScCheckListBox() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { delete mpCheckButton; SvTreeListBox::dispose(); } void Init(); void CheckEntry( const OUString& sName, SvTreeListEntry* pParent, bool bCheck = true ); void CheckEntry( SvTreeListEntry* pEntry, bool bCheck = true ); @@ -238,6 +240,7 @@ public: explicit ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc); virtual ~ScCheckListMenuWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE; virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE; @@ -291,11 +294,13 @@ private: { public: CancelButton(ScCheckListMenuWindow* pParent); + virtual ~CancelButton(); + virtual void dispose() SAL_OVERRIDE; virtual void Click() SAL_OVERRIDE; private: - ScCheckListMenuWindow* mpParent; + VclPtr<ScCheckListMenuWindow> mpParent; }; enum SectionType { @@ -329,18 +334,17 @@ private: private: SvTreeListEntry* findEntry( SvTreeListEntry* pParent, const OUString& rText ); - Edit maEdSearch; + VclPtr<Edit> maEdSearch; + VclPtr<ScCheckListBox> maChecks; - ScCheckListBox maChecks; + VclPtr<TriStateBox> maChkToggleAll; + VclPtr<ImageButton> maBtnSelectSingle; + VclPtr<ImageButton> maBtnUnselectSingle; - TriStateBox maChkToggleAll; - ImageButton maBtnSelectSingle; - ImageButton maBtnUnselectSingle; + VclPtr<OKButton> maBtnOk; + VclPtr<CancelButton> maBtnCancel; - OKButton maBtnOk; - CancelButton maBtnCancel; - - ::std::vector<vcl::Window*> maTabStopCtrls; + ::std::vector<VclPtr<vcl::Window> > maTabStopCtrls; size_t mnCurTabStop; ::std::vector<Member> maMembers; diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx index a3003755ca4b..9c0dca889596 100644 --- a/sc/source/ui/inc/colorformat.hxx +++ b/sc/source/ui/inc/colorformat.hxx @@ -23,24 +23,24 @@ class ScDocument; class ScDataBarSettingsDlg : public ModalDialog { private: - OKButton* mpBtnOk; - CancelButton* mpBtnCancel; + VclPtr<OKButton> mpBtnOk; + VclPtr<CancelButton> mpBtnCancel; - ColorListBox* mpLbPos; - ColorListBox* mpLbNeg; - ColorListBox* mpLbAxisCol; + VclPtr<ColorListBox> mpLbPos; + VclPtr<ColorListBox> mpLbNeg; + VclPtr<ColorListBox> mpLbFillType; + VclPtr<ColorListBox> mpLbAxisCol; - ListBox* mpLbTypeMin; - ListBox* mpLbTypeMax; - ListBox* mpLbFillType; - ListBox* mpLbAxisPos; + VclPtr<ListBox> mpLbTypeMin; + VclPtr<ListBox> mpLbTypeMax; + VclPtr<ListBox> mpLbAxisPos; - Edit* mpEdMin; - Edit* mpEdMax; - Edit* mpLenMin; - Edit* mpLenMax; + VclPtr<Edit> mpEdMin; + VclPtr<Edit> mpEdMax; + VclPtr<Edit> mpLenMin; + VclPtr<Edit> mpLenMax; - CheckBox *mpCbOnlyBar; + VclPtr<CheckBox> mpCbOnlyBar; OUString maStrWarnSameValue; SvNumberFormatter* mpNumberFormatter; @@ -56,6 +56,8 @@ private: public: ScDataBarSettingsDlg(vcl::Window* pParent, const ScDataBarFormatData& rData, ScDocument* pDoc, const ScAddress& rPos); + virtual ~ScDataBarSettingsDlg(); + virtual void dispose() SAL_OVERRIDE; ScDataBarFormatData* GetData(); }; diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 6f6d2c0c7d04..eaf90aa2dcfb 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -22,8 +22,6 @@ #include "rangelst.hxx" #include "condformathelper.hxx" -#include <boost/ptr_container/ptr_vector.hpp> -#include <boost/scoped_ptr.hpp> #include "anyrefdg.hxx" class ScDocument; @@ -56,21 +54,23 @@ class ScCondFormatDlg; class ScCondFormatList : public Control { private: - typedef boost::ptr_vector<ScCondFrmtEntry> EntryContainer; + typedef std::vector<VclPtr<ScCondFrmtEntry>> EntryContainer; EntryContainer maEntries; bool mbHasScrollBar; - boost::scoped_ptr<ScrollBar> mpScrollBar; + VclPtr<ScrollBar> mpScrollBar; ScDocument* mpDoc; ScAddress maPos; ScRangeList maRanges; - ScCondFormatDlg* mpDialogParent; + VclPtr<ScCondFormatDlg> mpDialogParent; void DoScroll(long nDiff); public: ScCondFormatList(vcl::Window* pParent, WinBits nStyle); + virtual ~ScCondFormatList(); + virtual void dispose() SAL_OVERRIDE; void init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos, @@ -95,18 +95,18 @@ public: class ScCondFormatDlg : public ScAnyRefModalDlg { private: - PushButton* mpBtnAdd; - PushButton* mpBtnRemove; - FixedText* mpFtRange; - formula::RefEdit* mpEdRange; - formula::RefButton* mpRbRange; + VclPtr<PushButton> mpBtnAdd; + VclPtr<PushButton> mpBtnRemove; + VclPtr<FixedText> mpFtRange; + VclPtr<formula::RefEdit> mpEdRange; + VclPtr<formula::RefButton> mpRbRange; - ScCondFormatList* mpCondFormList; + VclPtr<ScCondFormatList> mpCondFormList; ScAddress maPos; ScDocument* mpDoc; - formula::RefEdit* mpLastEdit; + VclPtr<formula::RefEdit> mpLastEdit; DECL_LINK( EdRangeModifyHdl, Edit* ); protected: @@ -117,6 +117,7 @@ public: SC_DLLPUBLIC ScCondFormatDlg(vcl::Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType); virtual ~ScCondFormatDlg(); + virtual void dispose() SAL_OVERRIDE; SC_DLLPUBLIC ScConditionalFormat* GetConditionalFormat() const; diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index 0ed7a5b40717..168b6927cbfc 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -46,13 +46,13 @@ private: Link maClickHdl; //general ui elements - FixedText maFtCondNr; - FixedText maFtCondition; + VclPtr<FixedText> maFtCondNr; + VclPtr<FixedText> maFtCondition; sal_Int32 mnIndex; OUString maStrCondition; protected: - ListBox maLbType; + VclPtr<ListBox> maLbType; ScDocument* mpDoc; ScAddress maPos; @@ -67,6 +67,7 @@ protected: public: ScCondFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos ); virtual ~ScCondFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; @@ -85,13 +86,13 @@ public: class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener { //cond format ui elements - ListBox maLbCondType; - formula::RefEdit maEdVal1; - formula::RefEdit maEdVal2; - FixedText maFtVal; - FixedText maFtStyle; - ListBox maLbStyle; - SvxFontPrevWindow maWdPreview; + VclPtr<ListBox> maLbCondType; + VclPtr<formula::RefEdit> maEdVal1; + VclPtr<formula::RefEdit> maEdVal2; + VclPtr<FixedText> maFtVal; + VclPtr<FixedText> maFtStyle; + VclPtr<ListBox> maLbStyle; + VclPtr<SvxFontPrevWindow> maWdPreview; bool mbIsInStyleCreate; static const sal_Int32 NUM_COND_ENTRIES = 24; @@ -120,6 +121,8 @@ protected: public: ScConditionFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL ); + virtual ~ScConditionFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; @@ -133,10 +136,10 @@ public: class ScFormulaFrmtEntry : public ScCondFrmtEntry { - FixedText maFtStyle; - ListBox maLbStyle; - SvxFontPrevWindow maWdPreview; - formula::RefEdit maEdFormula; + VclPtr<FixedText> maFtStyle; + VclPtr<ListBox> maLbStyle; + VclPtr<SvxFontPrevWindow> maWdPreview; + VclPtr<formula::RefEdit> maEdFormula; ScFormatEntry* createFormulaEntry() const; virtual OUString GetExpressionString() SAL_OVERRIDE; @@ -146,6 +149,8 @@ class ScFormulaFrmtEntry : public ScCondFrmtEntry public: ScFormulaFrmtEntry( vcl::Window* pParent, ScDocument* PDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL ); + virtual ~ScFormulaFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; @@ -157,17 +162,17 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; //color scale ui elements - ListBox maLbEntryTypeMin; - ListBox maLbEntryTypeMax; + VclPtr<ListBox> maLbEntryTypeMin; + VclPtr<ListBox> maLbEntryTypeMax; - Edit maEdMin; - Edit maEdMax; + VclPtr<Edit> maEdMin; + VclPtr<Edit> maEdMax; - ColorListBox maLbColMin; - ColorListBox maLbColMax; + VclPtr<ColorListBox> maLbColMin; + VclPtr<ColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; @@ -177,6 +182,8 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry DECL_LINK( EntryTypeHdl, ListBox* ); public: ScColorScale2FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = NULL ); + virtual ~ScColorScale2FrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -187,20 +194,20 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; //color scale ui elements - ListBox maLbEntryTypeMin; - ListBox maLbEntryTypeMiddle; - ListBox maLbEntryTypeMax; + VclPtr<ListBox> maLbEntryTypeMin; + VclPtr<ListBox> maLbEntryTypeMiddle; + VclPtr<ListBox> maLbEntryTypeMax; - Edit maEdMin; - Edit maEdMiddle; - Edit maEdMax; + VclPtr<Edit> maEdMin; + VclPtr<Edit> maEdMiddle; + VclPtr<Edit> maEdMax; - ColorListBox maLbColMin; - ColorListBox maLbColMiddle; - ColorListBox maLbColMax; + VclPtr<ColorListBox> maLbColMin; + VclPtr<ColorListBox> maLbColMiddle; + VclPtr<ColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; @@ -210,6 +217,8 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry DECL_LINK( EntryTypeHdl, ListBox* ); public: ScColorScale3FrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScColorScaleFormat* pFormat = NULL ); + virtual ~ScColorScale3FrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -219,15 +228,15 @@ public: class ScDataBarFrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; //data bar ui elements - ListBox maLbDataBarMinType; - ListBox maLbDataBarMaxType; - Edit maEdDataBarMin; - Edit maEdDataBarMax; + VclPtr<ListBox> maLbDataBarMinType; + VclPtr<ListBox> maLbDataBarMaxType; + VclPtr<Edit> maEdDataBarMin; + VclPtr<Edit> maEdDataBarMax; - PushButton maBtOptions; + VclPtr<PushButton> maBtOptions; boost::scoped_ptr<ScDataBarFormatData> mpDataBarData; @@ -240,6 +249,8 @@ class ScDataBarFrmtEntry : public ScCondFrmtEntry DECL_LINK( DataBarTypeSelectHdl, void* ); public: ScDataBarFrmtEntry( vcl::Window* pParemt, ScDocument* pDoc, const ScAddress& rPos, const ScDataBarFormat* pFormat = NULL ); + virtual ~ScDataBarFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -251,6 +262,8 @@ class ScDateFrmtEntry : public ScCondFrmtEntry, public SfxListener { public: ScDateFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat = NULL ); + virtual ~ScDateFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; @@ -266,10 +279,10 @@ private: DECL_LINK( StyleSelectHdl, void* ); - ListBox maLbDateEntry; - FixedText maFtStyle; - ListBox maLbStyle; - SvxFontPrevWindow maWdPreview; + VclPtr<ListBox> maLbDateEntry; + VclPtr<FixedText> maFtStyle; + VclPtr<ListBox> maLbStyle; + VclPtr<SvxFontPrevWindow> maWdPreview; bool mbIsInStyleCreate; }; @@ -277,12 +290,12 @@ private: class ScIconSetFrmtEntry : public ScCondFrmtEntry { //color format ui elements - ListBox maLbColorFormat; + VclPtr<ListBox> maLbColorFormat; // icon set ui elements - ListBox maLbIconSetType; + VclPtr<ListBox> maLbIconSetType; - typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDataEntriesType; + typedef std::vector<VclPtr<ScIconSetFrmtDataEntry>> ScIconSetFrmtDataEntriesType; ScIconSetFrmtDataEntriesType maEntries; virtual OUString GetExpressionString() SAL_OVERRIDE; @@ -293,6 +306,8 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry public: ScIconSetFrmtEntry( vcl::Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = NULL ); + virtual ~ScIconSetFrmtEntry(); + virtual void dispose() SAL_OVERRIDE; virtual ScFormatEntry* GetEntry() const SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetInactive() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 6f577e4cf5b1..1d339884e19a 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -50,17 +50,18 @@ class ScCondFormatManagerDlg : public ModalDialog public: ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScAddress& rPos); virtual ~ScCondFormatManagerDlg(); + virtual void dispose() SAL_OVERRIDE; ScConditionalFormatList* GetConditionalFormatList(); bool CondFormatsChanged() { return mbModified;} private: - PushButton *m_pBtnAdd; - PushButton *m_pBtnRemove; - PushButton *m_pBtnEdit; + VclPtr<PushButton> m_pBtnAdd; + VclPtr<PushButton> m_pBtnRemove; + VclPtr<PushButton> m_pBtnEdit; ScConditionalFormatList* mpFormatList; - ScCondFormatManagerWindow *m_pCtrlManager; + VclPtr<ScCondFormatManagerWindow> m_pCtrlManager; ScDocument* mpDoc; ScAddress maPos; diff --git a/sc/source/ui/inc/conflictsdlg.hxx b/sc/source/ui/inc/conflictsdlg.hxx index 3e9ebd64fdbe..3c429d11a021 100644 --- a/sc/source/ui/inc/conflictsdlg.hxx +++ b/sc/source/ui/inc/conflictsdlg.hxx @@ -117,12 +117,12 @@ public: class ScConflictsDlg : public ModalDialog { private: - SvSimpleTableContainer *m_pLbConflictsContainer; - boost::scoped_ptr<SvxRedlinTable> m_pLbConflicts; - PushButton *m_pBtnKeepMine; - PushButton *m_pBtnKeepOther; - PushButton *m_pBtnKeepAllMine; - PushButton *m_pBtnKeepAllOthers; + VclPtr<SvSimpleTableContainer> m_pLbConflictsContainer; + VclPtr<SvxRedlinTable> m_pLbConflicts; + VclPtr<PushButton> m_pBtnKeepMine; + VclPtr<PushButton> m_pBtnKeepOther; + VclPtr<PushButton> m_pBtnKeepAllMine; + VclPtr<PushButton> m_pBtnKeepAllOthers; OUString maStrTitleConflict; OUString maStrTitleAuthor; @@ -160,6 +160,7 @@ private: public: ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList ); virtual ~ScConflictsDlg(); + virtual void dispose() SAL_OVERRIDE; void UpdateView(); }; diff --git a/sc/source/ui/inc/consdlg.hxx b/sc/source/ui/inc/consdlg.hxx index 0f3c60c69781..c71f7e979927 100644 --- a/sc/source/ui/inc/consdlg.hxx +++ b/sc/source/ui/inc/consdlg.hxx @@ -39,6 +39,7 @@ public: ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScConsolidateDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; @@ -51,27 +52,27 @@ protected: virtual void Deactivate() SAL_OVERRIDE; private: - ListBox* pLbFunc; - ListBox* pLbConsAreas; + VclPtr<ListBox> pLbFunc; + VclPtr<ListBox> pLbConsAreas; - ListBox* pLbDataArea; - formula::RefEdit* pEdDataArea; - formula::RefButton* pRbDataArea; + VclPtr<ListBox> pLbDataArea; + VclPtr<formula::RefEdit> pEdDataArea; + VclPtr<formula::RefButton> pRbDataArea; - ListBox* pLbDestArea; - formula::RefEdit* pEdDestArea; - formula::RefButton* pRbDestArea; + VclPtr<ListBox> pLbDestArea; + VclPtr<formula::RefEdit> pEdDestArea; + VclPtr<formula::RefButton> pRbDestArea; - VclExpander* pExpander; - CheckBox* pBtnByRow; - CheckBox* pBtnByCol; + VclPtr<VclExpander> pExpander; + VclPtr<CheckBox> pBtnByRow; + VclPtr<CheckBox> pBtnByCol; - CheckBox* pBtnRefs; + VclPtr<CheckBox> pBtnRefs; - OKButton* pBtnOk; - CancelButton* pBtnCancel; - PushButton* pBtnAdd; - PushButton* pBtnRemove; + VclPtr<OKButton> pBtnOk; + VclPtr<CancelButton> pBtnCancel; + VclPtr<PushButton> pBtnAdd; + VclPtr<PushButton> pBtnRemove; OUString aStrUndefined; @@ -83,7 +84,7 @@ private: size_t nAreaDataCount; sal_uInt16 nWhichCons; - formula::RefEdit* pRefInputEdit; + VclPtr<formula::RefEdit> pRefInputEdit; bool bDlgLostFocus; void Init (); diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index d98bdb825053..11ff60501331 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -46,7 +46,7 @@ const sal_uLong SC_CONTENT_NOCHILD = ~0UL; class ScContentTree : public SvTreeListBox { - ScNavigatorDlg* pParentWindow; + VclPtr<ScNavigatorDlg> pParentWindow; ImageList aEntryImages; SvTreeListEntry* pRootNodes[SC_CONTENT_COUNT]; sal_uInt16 nRootType; // set as Root @@ -124,6 +124,7 @@ protected: public: ScContentTree( vcl::Window* pParent, const ResId& rResId ); virtual ~ScContentTree(); + virtual void dispose() SAL_OVERRIDE; OUString getAltLongDescText(SvTreeListEntry* pEntry, bool isAltText) const; OUString GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE; diff --git a/sc/source/ui/inc/corodlg.hxx b/sc/source/ui/inc/corodlg.hxx index 1f6de3df6b05..dbc8dcc34f4f 100644 --- a/sc/source/ui/inc/corodlg.hxx +++ b/sc/source/ui/inc/corodlg.hxx @@ -37,13 +37,20 @@ public: m_pBtnCol->Check(bCol); m_pBtnRow->Check(bRow); } + virtual ~ScColRowLabelDlg() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE + { + m_pBtnRow.clear(); + m_pBtnCol.clear(); + ModalDialog::dispose(); + } bool IsCol() const { return m_pBtnCol->IsChecked(); } bool IsRow() const { return m_pBtnRow->IsChecked(); } private: - CheckBox* m_pBtnRow; - CheckBox* m_pBtnCol; + VclPtr<CheckBox> m_pBtnRow; + VclPtr<CheckBox> m_pBtnCol; }; #endif diff --git a/sc/source/ui/inc/crdlg.hxx b/sc/source/ui/inc/crdlg.hxx index 571d04a20bea..cc0b941e7da2 100644 --- a/sc/source/ui/inc/crdlg.hxx +++ b/sc/source/ui/inc/crdlg.hxx @@ -30,11 +30,13 @@ class ScColOrRowDlg : public ModalDialog public: ScColOrRowDlg(vcl::Window* pParent, const OUString& rStrTitle, const OUString& rStrLabel, bool bColDefault = true); + virtual ~ScColOrRowDlg(); + virtual void dispose() SAL_OVERRIDE; private: - VclFrame* m_pFrame; - RadioButton* m_pBtnRows; - RadioButton* m_pBtnCols; - OKButton* m_pBtnOk; + VclPtr<VclFrame> m_pFrame; + VclPtr<RadioButton> m_pBtnRows; + VclPtr<RadioButton> m_pBtnCols; + VclPtr<OKButton> m_pBtnOk; DECL_LINK(OkHdl, void *); }; diff --git a/sc/source/ui/inc/crnrdlg.hxx b/sc/source/ui/inc/crnrdlg.hxx index b2d97ab9035d..f23f5dd51d7e 100644 --- a/sc/source/ui/inc/crnrdlg.hxx +++ b/sc/source/ui/inc/crnrdlg.hxx @@ -36,6 +36,7 @@ public: ScColRowNameRangesDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScViewData* ptrViewData ); virtual ~ScColRowNameRangesDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; @@ -44,19 +45,19 @@ public: virtual bool Close() SAL_OVERRIDE; private: - ListBox* pLbRange; + VclPtr<ListBox> pLbRange; - formula::RefEdit* pEdAssign; - formula::RefButton* pRbAssign; - RadioButton* pBtnColHead; - RadioButton* pBtnRowHead; - formula::RefEdit* pEdAssign2; - formula::RefButton* pRbAssign2; + VclPtr<formula::RefEdit> pEdAssign; + VclPtr<formula::RefButton> pRbAssign; + VclPtr<RadioButton> pBtnColHead; + VclPtr<RadioButton> pBtnRowHead; + VclPtr<formula::RefEdit> pEdAssign2; + VclPtr<formula::RefButton> pRbAssign2; - OKButton* pBtnOk; - CancelButton* pBtnCancel; - PushButton* pBtnAdd; - PushButton* pBtnRemove; + VclPtr<OKButton> pBtnOk; + VclPtr<CancelButton> pBtnCancel; + VclPtr<PushButton> pBtnAdd; + VclPtr<PushButton> pBtnRemove; ScRange theCurArea; ScRange theCurData; @@ -68,7 +69,7 @@ private: NameRangeMap aRangeMap; ScViewData* pViewData; ScDocument* pDoc; - formula::RefEdit* pEdActive; + VclPtr<formula::RefEdit> pEdActive; bool bDlgLostFocus; void Init (); diff --git a/sc/source/ui/inc/csvcontrol.hxx b/sc/source/ui/inc/csvcontrol.hxx index c66bac55d988..fee07ecba715 100644 --- a/sc/source/ui/inc/csvcontrol.hxx +++ b/sc/source/ui/inc/csvcontrol.hxx @@ -241,6 +241,7 @@ public: explicit ScCsvControl( ScCsvControl& rParent ); explicit ScCsvControl( vcl::Window* pParent, const ScCsvLayoutData& rData, WinBits nBits ); virtual ~ScCsvControl(); + virtual void dispose() SAL_OVERRIDE; // event handling --------------------------------------------------------- diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx index bab6dda53287..1c5b1dcab4db 100644 --- a/sc/source/ui/inc/csvgrid.hxx +++ b/sc/source/ui/inc/csvgrid.hxx @@ -75,8 +75,8 @@ class SC_DLLPUBLIC ScCsvGrid : public ScCsvControl, public utl::ConfigurationLis private: typedef ::std::unique_ptr< ScEditEngineDefaulter > ScEditEnginePtr; - VirtualDevice maBackgrDev; /// Grid background, headers, cell texts. - VirtualDevice maGridDev; /// Data grid with selection and cursor. + VclPtr<VirtualDevice> mpBackgrDev; /// Grid background, headers, cell texts. + VclPtr<VirtualDevice> mpGridDev; /// Data grid with selection and cursor. PopupMenu maPopup; /// Popup menu for column types. ::svtools::ColorConfig* mpColorConfig; /// Application color configuration. @@ -109,6 +109,7 @@ private: public: explicit ScCsvGrid( ScCsvControl& rParent ); virtual ~ScCsvGrid(); + virtual void dispose() SAL_OVERRIDE; /** Finishes initialization. Must be called after constructing a new object. */ void Init(); diff --git a/sc/source/ui/inc/csvruler.hxx b/sc/source/ui/inc/csvruler.hxx index ef73cae674c4..991111525b02 100644 --- a/sc/source/ui/inc/csvruler.hxx +++ b/sc/source/ui/inc/csvruler.hxx @@ -32,8 +32,8 @@ class ScAccessibleCsvControl; class SC_DLLPUBLIC ScCsvRuler : public ScCsvControl { private: - VirtualDevice maBackgrDev; /// Ruler background, scaling. - VirtualDevice maRulerDev; /// Ruler with splits and cursor. + ScopedVclPtr<VirtualDevice> maBackgrDev; /// Ruler background, scaling. + ScopedVclPtr<VirtualDevice> maRulerDev; /// Ruler with splits and cursor. Color maBackColor; /// Background color. Color maActiveColor; /// Color for active part of ruler. @@ -55,6 +55,7 @@ private: public: explicit ScCsvRuler( ScCsvControl& rParent ); virtual ~ScCsvRuler(); + virtual void dispose() SAL_OVERRIDE; // common ruler handling -------------------------------------------------- public: diff --git a/sc/source/ui/inc/csvtablebox.hxx b/sc/source/ui/inc/csvtablebox.hxx index cda528abf86c..2c5b458b5fcc 100644 --- a/sc/source/ui/inc/csvtablebox.hxx +++ b/sc/source/ui/inc/csvtablebox.hxx @@ -22,6 +22,7 @@ #include <vcl/ctrl.hxx> #include <vcl/scrbar.hxx> +#include <vcl/vclptr.hxx> #include "scdllapi.h" #include "csvcontrol.hxx" #include "csvruler.hxx" @@ -44,11 +45,11 @@ class SC_DLLPUBLIC ScCsvTableBox : public ScCsvControl private: ScCsvLayoutData maData; /// Current layout data of the controls. - ScCsvRuler maRuler; /// The ruler for fixed width mode. - ScCsvGrid maGrid; /// Calc-like data table for fixed width mode. - ScrollBar maHScroll; /// Horizontal scroll bar. - ScrollBar maVScroll; /// Vertical scroll bar. - ScrollBarBox maScrollBox; /// For the bottom right edge. + VclPtr<ScCsvRuler> maRuler; /// The ruler for fixed width mode. + VclPtr<ScCsvGrid> maGrid; /// Calc-like data table for fixed width mode. + VclPtr<ScrollBar> maHScroll; /// Horizontal scroll bar. + VclPtr<ScrollBar> maVScroll; /// Vertical scroll bar. + VclPtr<ScrollBarBox> maScrollBox; /// For the bottom right edge. Link maUpdateTextHdl; /// Updates all cell texts. Link maColTypeHdl; /// Handler for exporting the column type. @@ -62,6 +63,8 @@ private: public: explicit ScCsvTableBox( vcl::Window* pParent, WinBits nBits ); + virtual ~ScCsvTableBox(); + virtual void dispose() SAL_OVERRIDE; /** Finishes initialization. Must be called after constructing a new object. */ void Init(); @@ -102,7 +105,7 @@ public: /** Reads UI strings for data types from the list box. */ void InitTypes( const ListBox& rListBox ); /** Returns the data type of the selected columns. */ - inline sal_Int32 GetSelColumnType() const { return maGrid.GetSelColumnType(); } + inline sal_Int32 GetSelColumnType() const { return maGrid->GetSelColumnType(); } /** Fills the options object with current column data. */ void FillColumnData( ScAsciiOptions& rOptions ) const; diff --git a/sc/source/ui/inc/dapidata.hxx b/sc/source/ui/inc/dapidata.hxx index b157c05cf6e4..02c76e0dc8ae 100644 --- a/sc/source/ui/inc/dapidata.hxx +++ b/sc/source/ui/inc/dapidata.hxx @@ -30,9 +30,9 @@ struct ScImportSourceDesc; class ScDataPilotDatabaseDlg : public ModalDialog { private: - ListBox* m_pLbDatabase; - ComboBox* m_pCbObject; - ListBox* m_pLbType; + VclPtr<ListBox> m_pLbDatabase; + VclPtr<ComboBox> m_pCbObject; + VclPtr<ListBox> m_pLbType; void FillObjects(); @@ -40,6 +40,8 @@ private: public: ScDataPilotDatabaseDlg(vcl::Window* pParent); + virtual ~ScDataPilotDatabaseDlg(); + virtual void dispose() SAL_OVERRIDE; void GetValues( ScImportSourceDesc& rDesc ); }; diff --git a/sc/source/ui/inc/dapitype.hxx b/sc/source/ui/inc/dapitype.hxx index e024ba3f5451..fb85f0e47687 100644 --- a/sc/source/ui/inc/dapitype.hxx +++ b/sc/source/ui/inc/dapitype.hxx @@ -30,16 +30,16 @@ class ScDataPilotSourceTypeDlg : public ModalDialog { private: - RadioButton* m_pBtnSelection; - RadioButton* m_pBtnNamedRange; - RadioButton* m_pBtnDatabase; - RadioButton* m_pBtnExternal; - ListBox* m_pLbNamedRange; + VclPtr<RadioButton> m_pBtnSelection; + VclPtr<RadioButton> m_pBtnNamedRange; + VclPtr<RadioButton> m_pBtnDatabase; + VclPtr<RadioButton> m_pBtnExternal; + VclPtr<ListBox> m_pLbNamedRange; public: ScDataPilotSourceTypeDlg(vcl::Window* pParent, bool bEnableExternal); virtual ~ScDataPilotSourceTypeDlg(); - + virtual void dispose() SAL_OVERRIDE; bool IsDatabase() const; bool IsExternal() const; bool IsNamedRange() const; @@ -53,16 +53,17 @@ private: class ScDataPilotServiceDlg : public ModalDialog { private: - ListBox *m_pLbService; - Edit *m_pEdSource; - Edit *m_pEdName; - Edit *m_pEdUser; - Edit *m_pEdPasswd; + VclPtr<ListBox> m_pLbService; + VclPtr<Edit> m_pEdSource; + VclPtr<Edit> m_pEdName; + VclPtr<Edit> m_pEdUser; + VclPtr<Edit> m_pEdPasswd; public: ScDataPilotServiceDlg( vcl::Window* pParent, const com::sun::star::uno::Sequence<OUString>& rServices ); virtual ~ScDataPilotServiceDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetServiceName() const; OUString GetParSource() const; diff --git a/sc/source/ui/inc/datafdlg.hxx b/sc/source/ui/inc/datafdlg.hxx index 00460ece6b8f..762b0cd5d761 100644 --- a/sc/source/ui/inc/datafdlg.hxx +++ b/sc/source/ui/inc/datafdlg.hxx @@ -20,8 +20,6 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -#include <boost/ptr_container/ptr_vector.hpp> - #define MAX_DATAFORM_COLS 256 #define MAX_DATAFORM_ROWS 32000 @@ -29,15 +27,15 @@ class ScDataFormDlg : public ModalDialog { private: - PushButton* m_pBtnNew; - PushButton* m_pBtnDelete; - PushButton* m_pBtnRestore; - PushButton* m_pBtnPrev; - PushButton* m_pBtnNext; - PushButton* m_pBtnClose; - ScrollBar* m_pSlider; - VclGrid* m_pGrid; - FixedText* m_pFixedText; + VclPtr<PushButton> m_pBtnNew; + VclPtr<PushButton> m_pBtnDelete; + VclPtr<PushButton> m_pBtnRestore; + VclPtr<PushButton> m_pBtnPrev; + VclPtr<PushButton> m_pBtnNext; + VclPtr<PushButton> m_pBtnClose; + VclPtr<ScrollBar> m_pSlider; + VclPtr<VclGrid> m_pGrid; + VclPtr<FixedText> m_pFixedText; OUString sNewRecord; ScTabViewShell* pTabViewShell; @@ -51,12 +49,13 @@ private: SCTAB nTab; bool bNoSelection; - boost::ptr_vector<boost::nullable<FixedText> > maFixedTexts; - boost::ptr_vector<boost::nullable<Edit> > maEdits; + std::vector<VclPtr<FixedText> > maFixedTexts; + std::vector<VclPtr<Edit> > maEdits; public: ScDataFormDlg( vcl::Window* pParent, ScTabViewShell* pTabViewShell); virtual ~ScDataFormDlg(); + virtual void dispose() SAL_OVERRIDE; void FillCtrls(SCROW nCurrentRow); private: diff --git a/sc/source/ui/inc/datastreamdlg.hxx b/sc/source/ui/inc/datastreamdlg.hxx index 09b461fa8635..0b8bf8c38966 100644 --- a/sc/source/ui/inc/datastreamdlg.hxx +++ b/sc/source/ui/inc/datastreamdlg.hxx @@ -28,23 +28,23 @@ class DataStreamDlg : public ModalDialog { ScDocShell *mpDocShell; - SvtURLBox* m_pCbUrl; - PushButton* m_pBtnBrowse; - RadioButton* m_pRBDirectData; - RadioButton* m_pRBScriptData; - RadioButton* m_pRBValuesInLine; - RadioButton* m_pRBAddressValue; - CheckBox* m_pCBRefreshOnEmpty; - RadioButton* m_pRBDataDown; - RadioButton* m_pRBRangeDown; - RadioButton* m_pRBNoMove; - RadioButton* m_pRBMaxLimit; - RadioButton* m_pRBUnlimited; - Edit* m_pEdRange; - Edit* m_pEdLimit; - OKButton* m_pBtnOk; - VclFrame* m_pVclFrameLimit; - VclFrame* m_pVclFrameMove; + VclPtr<SvtURLBox> m_pCbUrl; + VclPtr<PushButton> m_pBtnBrowse; + VclPtr<RadioButton> m_pRBDirectData; + VclPtr<RadioButton> m_pRBScriptData; + VclPtr<RadioButton> m_pRBValuesInLine; + VclPtr<RadioButton> m_pRBAddressValue; + VclPtr<CheckBox> m_pCBRefreshOnEmpty; + VclPtr<RadioButton> m_pRBDataDown; + VclPtr<RadioButton> m_pRBRangeDown; + VclPtr<RadioButton> m_pRBNoMove; + VclPtr<RadioButton> m_pRBMaxLimit; + VclPtr<RadioButton> m_pRBUnlimited; + VclPtr<Edit> m_pEdRange; + VclPtr<Edit> m_pEdLimit; + VclPtr<OKButton> m_pBtnOk; + VclPtr<VclFrame> m_pVclFrameLimit; + VclPtr<VclFrame> m_pVclFrameMove; DECL_LINK(UpdateHdl, void *); DECL_LINK(BrowseHdl, void *); @@ -54,6 +54,8 @@ class DataStreamDlg : public ModalDialog public: DataStreamDlg(ScDocShell *pDocShell, vcl::Window* pParent); + virtual ~DataStreamDlg(); + virtual void dispose() SAL_OVERRIDE; void Init( const DataStream& rStrm ); diff --git a/sc/source/ui/inc/dbnamdlg.hxx b/sc/source/ui/inc/dbnamdlg.hxx index 6b6d68384a0a..032b8e9df704 100644 --- a/sc/source/ui/inc/dbnamdlg.hxx +++ b/sc/source/ui/inc/dbnamdlg.hxx @@ -38,6 +38,7 @@ public: ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScViewData* ptrViewData ); virtual ~ScDbNameDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; @@ -46,24 +47,24 @@ public: virtual bool Close() SAL_OVERRIDE; private: - ComboBox* m_pEdName; - - VclFrame* m_pAssignFrame; - formula::RefEdit* m_pEdAssign; - formula::RefButton* m_pRbAssign; - - VclContainer* m_pOptions; - CheckBox* m_pBtnHeader; - CheckBox* m_pBtnDoSize; - CheckBox* m_pBtnKeepFmt; - CheckBox* m_pBtnStripData; - FixedText* m_pFTSource; - FixedText* m_pFTOperations; - - OKButton* m_pBtnOk; - CancelButton* m_pBtnCancel; - PushButton* m_pBtnAdd; - PushButton* m_pBtnRemove; + VclPtr<ComboBox> m_pEdName; + + VclPtr<VclFrame> m_pAssignFrame; + VclPtr<formula::RefEdit> m_pEdAssign; + VclPtr<formula::RefButton> m_pRbAssign; + + VclPtr<VclContainer> m_pOptions; + VclPtr<CheckBox> m_pBtnHeader; + VclPtr<CheckBox> m_pBtnDoSize; + VclPtr<CheckBox> m_pBtnKeepFmt; + VclPtr<CheckBox> m_pBtnStripData; + VclPtr<FixedText> m_pFTSource; + VclPtr<FixedText> m_pFTOperations; + + VclPtr<OKButton> m_pBtnOk; + VclPtr<CancelButton> m_pBtnCancel; + VclPtr<PushButton> m_pBtnAdd; + VclPtr<PushButton> m_pBtnRemove; bool bSaved; diff --git a/sc/source/ui/inc/delcldlg.hxx b/sc/source/ui/inc/delcldlg.hxx index 6683fcb81a02..676d93b242cc 100644 --- a/sc/source/ui/inc/delcldlg.hxx +++ b/sc/source/ui/inc/delcldlg.hxx @@ -29,13 +29,15 @@ class ScDeleteCellDlg : public ModalDialog { private: - RadioButton* m_pBtnCellsUp; - RadioButton* m_pBtnCellsLeft; - RadioButton* m_pBtnDelRows; - RadioButton* m_pBtnDelCols; + VclPtr<RadioButton> m_pBtnCellsUp; + VclPtr<RadioButton> m_pBtnCellsLeft; + VclPtr<RadioButton> m_pBtnDelRows; + VclPtr<RadioButton> m_pBtnDelCols; public: ScDeleteCellDlg(vcl::Window* pParent, bool bDisallowCellMove = false); + virtual ~ScDeleteCellDlg(); + virtual void dispose() SAL_OVERRIDE; DelCellCmd GetDelCellCmd() const; }; diff --git a/sc/source/ui/inc/delcodlg.hxx b/sc/source/ui/inc/delcodlg.hxx index 6bc898a82134..a2741a6448a5 100644 --- a/sc/source/ui/inc/delcodlg.hxx +++ b/sc/source/ui/inc/delcodlg.hxx @@ -27,15 +27,15 @@ class ScDeleteContentsDlg : public ModalDialog { private: - CheckBox* aBtnDelAll; - CheckBox* aBtnDelStrings; - CheckBox* aBtnDelNumbers; - CheckBox* aBtnDelDateTime; - CheckBox* aBtnDelFormulas; - CheckBox* aBtnDelNotes; - CheckBox* aBtnDelAttrs; - CheckBox* aBtnDelObjects; - OKButton* aBtnOk; + VclPtr<CheckBox> aBtnDelAll; + VclPtr<CheckBox> aBtnDelStrings; + VclPtr<CheckBox> aBtnDelNumbers; + VclPtr<CheckBox> aBtnDelDateTime; + VclPtr<CheckBox> aBtnDelFormulas; + VclPtr<CheckBox> aBtnDelNotes; + VclPtr<CheckBox> aBtnDelAttrs; + VclPtr<CheckBox> aBtnDelObjects; + VclPtr<OKButton> aBtnOk; bool bObjectsDisabled; @@ -49,6 +49,7 @@ public: ScDeleteContentsDlg( vcl::Window* pParent, InsertDeleteFlags nCheckDefaults = IDF_NONE ); virtual ~ScDeleteContentsDlg(); + virtual void dispose() SAL_OVERRIDE; void DisableObjects(); InsertDeleteFlags GetDelContentsCmdBits() const; diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 5cd1d00d04fc..f0c8be5e8374 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -224,7 +224,7 @@ public: void SetVisAreaOrSize( const Rectangle& rVisArea, bool bModifyStart ); - virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( vcl::Window *pParent, + virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( vcl::Window *pParent, const SfxItemSet &rSet ) SAL_OVERRIDE; void GetDocStat( ScDocStat& rDocStat ); diff --git a/sc/source/ui/inc/dpcontrol.hxx b/sc/source/ui/inc/dpcontrol.hxx index e574f672429b..e4030752386a 100644 --- a/sc/source/ui/inc/dpcontrol.hxx +++ b/sc/source/ui/inc/dpcontrol.hxx @@ -23,6 +23,7 @@ #include <rtl/ustring.hxx> #include <tools/gen.hxx> #include <tools/fract.hxx> +#include <vcl/vclptr.hxx> class OutputDevice; class Point; @@ -62,7 +63,7 @@ private: Fraction maZoomX; Fraction maZoomY; ScDocument* mpDoc; - OutputDevice* mpOutDev; + VclPtr<OutputDevice> mpOutDev; const StyleSettings* mpStyle; bool mbBaseButton; bool mbPopupButton; diff --git a/sc/source/ui/inc/dpgroupdlg.hxx b/sc/source/ui/inc/dpgroupdlg.hxx index 3066f41a610c..3ba0db194083 100644 --- a/sc/source/ui/inc/dpgroupdlg.hxx +++ b/sc/source/ui/inc/dpgroupdlg.hxx @@ -49,9 +49,9 @@ private: DECL_LINK( ClickHdl, RadioButton* ); private: - RadioButton* mpRbAuto; - RadioButton* mpRbMan; - Edit* mpEdValue; + VclPtr<RadioButton> mpRbAuto; + VclPtr<RadioButton> mpRbMan; + VclPtr<Edit> mpEdValue; }; class ScDPNumGroupEditHelper : public ScDPGroupEditHelper @@ -61,14 +61,13 @@ public: RadioButton* pRbAuto, RadioButton* pRbMan, ScDoubleField* pEdValue ); - virtual ~ScDPNumGroupEditHelper() {} - + virtual ~ScDPNumGroupEditHelper() {} private: virtual bool ImplGetValue( double& rfValue ) const SAL_OVERRIDE; virtual void ImplSetValue( double fValue ) SAL_OVERRIDE; private: - ScDoubleField* mpEdValue; + VclPtr<ScDoubleField> mpEdValue; }; class ScDPDateGroupEditHelper : public ScDPGroupEditHelper @@ -85,7 +84,7 @@ private: virtual void ImplSetValue( double fValue ) SAL_OVERRIDE; private: - DateField* mpEdValue; + VclPtr<DateField> mpEdValue; Date maNullDate; }; @@ -93,17 +92,18 @@ class ScDPNumGroupDlg : public ModalDialog { public: explicit ScDPNumGroupDlg( vcl::Window* pParent, const ScDPNumGroupInfo& rInfo ); - + virtual ~ScDPNumGroupDlg(); + virtual void dispose() SAL_OVERRIDE; ScDPNumGroupInfo GetGroupInfo() const; private: - RadioButton* mpRbAutoStart; - RadioButton* mpRbManStart; - ScDoubleField* mpEdStart; - RadioButton* mpRbAutoEnd; - RadioButton* mpRbManEnd; - ScDoubleField* mpEdEnd; - ScDoubleField* mpEdBy; + VclPtr<RadioButton> mpRbAutoStart; + VclPtr<RadioButton> mpRbManStart; + VclPtr<ScDoubleField> mpEdStart; + VclPtr<RadioButton> mpRbAutoEnd; + VclPtr<RadioButton> mpRbManEnd; + VclPtr<ScDoubleField> mpEdEnd; + VclPtr<ScDoubleField> mpEdBy; ScDPNumGroupEditHelper maStartHelper; ScDPNumGroupEditHelper maEndHelper; }; @@ -113,7 +113,8 @@ class ScDPDateGroupDlg : public ModalDialog public: explicit ScDPDateGroupDlg( vcl::Window* pParent, const ScDPNumGroupInfo& rInfo, sal_Int32 nDatePart, const Date& rNullDate ); - + virtual ~ScDPDateGroupDlg(); + virtual void dispose() SAL_OVERRIDE; ScDPNumGroupInfo GetGroupInfo() const; sal_Int32 GetDatePart() const; @@ -122,17 +123,17 @@ private: DECL_LINK( CheckHdl, SvxCheckListBox* ); private: - RadioButton* mpRbAutoStart; - RadioButton* mpRbManStart; - DateField* mpEdStart; - RadioButton* mpRbAutoEnd; - RadioButton* mpRbManEnd; - DateField* mpEdEnd; - RadioButton* mpRbNumDays; - RadioButton* mpRbUnits; - NumericField* mpEdNumDays; - SvxCheckListBox* mpLbUnits; - OKButton* mpBtnOk; + VclPtr<RadioButton> mpRbAutoStart; + VclPtr<RadioButton> mpRbManStart; + VclPtr<DateField> mpEdStart; + VclPtr<RadioButton> mpRbAutoEnd; + VclPtr<RadioButton> mpRbManEnd; + VclPtr<DateField> mpEdEnd; + VclPtr<RadioButton> mpRbNumDays; + VclPtr<RadioButton> mpRbUnits; + VclPtr<NumericField> mpEdNumDays; + VclPtr<SvxCheckListBox> mpLbUnits; + VclPtr<OKButton> mpBtnOk; ScDPDateGroupEditHelper maStartHelper; ScDPDateGroupEditHelper maEndHelper; }; diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx index baf0fa89e295..54f20bde7eba 100644 --- a/sc/source/ui/inc/drawview.hxx +++ b/sc/source/ui/inc/drawview.hxx @@ -34,7 +34,7 @@ class SdrUndoManager; class ScDrawView: public FmFormView { ScViewData* pViewData; - OutputDevice* pDev; //! needed ? + VclPtr<OutputDevice> pDev; //! needed ? ScDocument* pDoc; SCTAB nTab; Fraction aScaleX; // Factor for Drawing-MapMode diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx index 07b532f58718..bef700938a8f 100644 --- a/sc/source/ui/inc/dwfunctr.hxx +++ b/sc/source/ui/inc/dwfunctr.hxx @@ -47,16 +47,16 @@ class ScFunctionDockWin : public SfxDockingWindow, public SfxListener private: Idle aIdle; - ScPrivatSplit aPrivatSplit; - ListBox aCatBox; - ListBox aFuncList; - ListBox aDDFuncList; - ListBox* pAllFuncList; + VclPtr<ScPrivatSplit> aPrivatSplit; + VclPtr<ListBox> aCatBox; + VclPtr<ListBox> aFuncList; + VclPtr<ListBox> aDDFuncList; + VclPtr<ListBox> pAllFuncList; SfxChildAlignment eSfxNewAlignment; SfxChildAlignment eSfxOldAlignment; - ImageButton aInsertButton; - FixedText aFiFuncDesc; + VclPtr<ImageButton> aInsertButton; + VclPtr<FixedText> aFiFuncDesc; sal_uLong nMinWidth; sal_uLong nMinHeight; Size aOldSize; @@ -105,6 +105,7 @@ public: const ResId& rResId ); virtual ~ScFunctionDockWin(); + virtual void dispose() SAL_OVERRIDE; using SfxDockingWindow::Notify; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/filldlg.hxx b/sc/source/ui/inc/filldlg.hxx index c68b604cee46..70a2d086bb45 100644 --- a/sc/source/ui/inc/filldlg.hxx +++ b/sc/source/ui/inc/filldlg.hxx @@ -43,6 +43,7 @@ public: double fMax, sal_uInt16 nPossDir ); virtual ~ScFillSeriesDlg(); + virtual void dispose() SAL_OVERRIDE; FillDir GetFillDir() const { return theFillDir; } FillCmd GetFillCmd() const { return theFillCmd; } @@ -56,32 +57,32 @@ public: void SetEdStartValEnabled(bool bFlag = false); private: - FixedText* m_pFtStartVal; - Edit* m_pEdStartVal; + VclPtr<FixedText> m_pFtStartVal; + VclPtr<Edit> m_pEdStartVal; const OUString aStartStrVal; - FixedText* m_pFtEndVal; - Edit* m_pEdEndVal; + VclPtr<FixedText> m_pFtEndVal; + VclPtr<Edit> m_pEdEndVal; - FixedText* m_pFtIncrement; - Edit* m_pEdIncrement; - RadioButton* m_pBtnDown; - RadioButton* m_pBtnRight; - RadioButton* m_pBtnUp; - RadioButton* m_pBtnLeft; + VclPtr<FixedText> m_pFtIncrement; + VclPtr<Edit> m_pEdIncrement; + VclPtr<RadioButton> m_pBtnDown; + VclPtr<RadioButton> m_pBtnRight; + VclPtr<RadioButton> m_pBtnUp; + VclPtr<RadioButton> m_pBtnLeft; - RadioButton* m_pBtnArithmetic; - RadioButton* m_pBtnGeometric; - RadioButton* m_pBtnDate; - RadioButton* m_pBtnAutoFill; + VclPtr<RadioButton> m_pBtnArithmetic; + VclPtr<RadioButton> m_pBtnGeometric; + VclPtr<RadioButton> m_pBtnDate; + VclPtr<RadioButton> m_pBtnAutoFill; - FixedText* m_pFtTimeUnit; - RadioButton* m_pBtnDay; - RadioButton* m_pBtnDayOfWeek; - RadioButton* m_pBtnMonth; - RadioButton* m_pBtnYear; + VclPtr<FixedText> m_pFtTimeUnit; + VclPtr<RadioButton> m_pBtnDay; + VclPtr<RadioButton> m_pBtnDayOfWeek; + VclPtr<RadioButton> m_pBtnMonth; + VclPtr<RadioButton> m_pBtnYear; - OKButton* m_pBtnOk; + VclPtr<OKButton> m_pBtnOk; const OUString aErrMsgInvalidVal; diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index e7e89cc9fcab..44d48c228524 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -56,6 +56,7 @@ public: ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScFilterDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; @@ -68,43 +69,43 @@ public: void RefreshEditRow( size_t nOffset ); private: - ListBox* pLbConnect1; - ListBox* pLbField1; - ListBox* pLbCond1; - ComboBox* pEdVal1; - - ListBox* pLbConnect2; - ListBox* pLbField2; - ListBox* pLbCond2; - ComboBox* pEdVal2; - - ListBox* pLbConnect3; - ListBox* pLbField3; - ListBox* pLbCond3; - ComboBox* pEdVal3; - - ListBox* pLbConnect4; - ListBox* pLbField4; - ListBox* pLbCond4; - ComboBox* pEdVal4; - - ScrollBar* pScrollBar; - VclExpander* pExpander; - - OKButton* pBtnOk; - CancelButton* pBtnCancel; - - CheckBox* pBtnCase; - CheckBox* pBtnRegExp; - CheckBox* pBtnHeader; - CheckBox* pBtnUnique; - CheckBox* pBtnCopyResult; - ListBox* pLbCopyArea; - formula::RefEdit* pEdCopyArea; - formula::RefButton* pRbCopyArea; - CheckBox* pBtnDestPers; - FixedText* pFtDbAreaLabel; - FixedText* pFtDbArea; + VclPtr<ListBox> pLbConnect1; + VclPtr<ListBox> pLbField1; + VclPtr<ListBox> pLbCond1; + VclPtr<ComboBox> pEdVal1; + + VclPtr<ListBox> pLbConnect2; + VclPtr<ListBox> pLbField2; + VclPtr<ListBox> pLbCond2; + VclPtr<ComboBox> pEdVal2; + + VclPtr<ListBox> pLbConnect3; + VclPtr<ListBox> pLbField3; + VclPtr<ListBox> pLbCond3; + VclPtr<ComboBox> pEdVal3; + + VclPtr<ListBox> pLbConnect4; + VclPtr<ListBox> pLbField4; + VclPtr<ListBox> pLbCond4; + VclPtr<ComboBox> pEdVal4; + + VclPtr<ScrollBar> pScrollBar; + VclPtr<VclExpander> pExpander; + + VclPtr<OKButton> pBtnOk; + VclPtr<CancelButton> pBtnCancel; + + VclPtr<CheckBox> pBtnCase; + VclPtr<CheckBox> pBtnRegExp; + VclPtr<CheckBox> pBtnHeader; + VclPtr<CheckBox> pBtnUnique; + VclPtr<CheckBox> pBtnCopyResult; + VclPtr<ListBox> pLbCopyArea; + VclPtr<formula::RefEdit> pEdCopyArea; + VclPtr<formula::RefButton> pRbCopyArea; + VclPtr<CheckBox> pBtnDestPers; + VclPtr<FixedText> pFtDbAreaLabel; + VclPtr<FixedText> pFtDbArea; const OUString aStrUndefined; const OUString aStrNone; @@ -121,10 +122,10 @@ private: ScDocument* pDoc; SCTAB nSrcTab; - std::vector<ComboBox*> maValueEdArr; - std::vector<ListBox*> maFieldLbArr; - std::vector<ListBox*> maCondLbArr; - std::vector<ListBox*> maConnLbArr; + std::vector<VclPtr<ComboBox>> maValueEdArr; + std::vector<VclPtr<ListBox>> maFieldLbArr; + std::vector<VclPtr<ListBox>> maCondLbArr; + std::vector<VclPtr<ListBox>> maConnLbArr; std::deque<bool> maHasDates; std::deque<bool> maRefreshExceptQuery; @@ -163,6 +164,7 @@ public: ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScSpecialFilterDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; @@ -172,27 +174,27 @@ public: virtual bool Close() SAL_OVERRIDE; private: - ListBox* pLbFilterArea; - formula::RefEdit* pEdFilterArea; - formula::RefButton* pRbFilterArea; - - VclExpander* pExpander; - CheckBox* pBtnCase; - CheckBox* pBtnRegExp; - CheckBox* pBtnHeader; - CheckBox* pBtnUnique; - CheckBox* pBtnCopyResult; - ListBox* pLbCopyArea; - formula::RefEdit* pEdCopyArea; - formula::RefButton* pRbCopyArea; - CheckBox* pBtnDestPers; - FixedText* pFtDbAreaLabel; - FixedText* pFtDbArea; + VclPtr<ListBox> pLbFilterArea; + VclPtr<formula::RefEdit> pEdFilterArea; + VclPtr<formula::RefButton> pRbFilterArea; + + VclPtr<VclExpander> pExpander; + VclPtr<CheckBox> pBtnCase; + VclPtr<CheckBox> pBtnRegExp; + VclPtr<CheckBox> pBtnHeader; + VclPtr<CheckBox> pBtnUnique; + VclPtr<CheckBox> pBtnCopyResult; + VclPtr<ListBox> pLbCopyArea; + VclPtr<formula::RefEdit> pEdCopyArea; + VclPtr<formula::RefButton> pRbCopyArea; + VclPtr<CheckBox> pBtnDestPers; + VclPtr<FixedText> pFtDbAreaLabel; + VclPtr<FixedText> pFtDbArea; const OUString aStrUndefined; const OUString aStrNoName; - OKButton* pBtnOk; - CancelButton* pBtnCancel; + VclPtr<OKButton> pBtnOk; + VclPtr<CancelButton> pBtnCancel; ScFilterOptionsMgr* pOptionsMgr; @@ -202,7 +204,7 @@ private: ScViewData* pViewData; ScDocument* pDoc; - formula::RefEdit* pRefInputEdit; + VclPtr<formula::RefEdit> pRefInputEdit; bool bRefInputMode; // Hack: RefInput control diff --git a/sc/source/ui/inc/foptmgr.hxx b/sc/source/ui/inc/foptmgr.hxx index fae7f16a8520..ee27b40f5fc5 100644 --- a/sc/source/ui/inc/foptmgr.hxx +++ b/sc/source/ui/inc/foptmgr.hxx @@ -46,7 +46,7 @@ public: CheckBox* refBtnDestPers, ListBox* refLbCopyArea, Edit* refEdCopyArea, - formula::RefButton* refRbCopyArea, + formula::RefButton* refRbCopyArea, FixedText* refFtDbAreaLabel, FixedText* refFtDbArea, const OUString& refStrUndefined ); @@ -57,17 +57,17 @@ private: ScViewData* pViewData; ScDocument* pDoc; - CheckBox* pBtnCase; - CheckBox* pBtnRegExp; - CheckBox* pBtnHeader; - CheckBox* pBtnUnique; - CheckBox* pBtnCopyResult; - CheckBox* pBtnDestPers; - ListBox* pLbCopyArea; - Edit* pEdCopyArea; - formula::RefButton* pRbCopyArea; - FixedText* pFtDbAreaLabel; - FixedText* pFtDbArea; + VclPtr<CheckBox> pBtnCase; + VclPtr<CheckBox> pBtnRegExp; + VclPtr<CheckBox> pBtnHeader; + VclPtr<CheckBox> pBtnUnique; + VclPtr<CheckBox> pBtnCopyResult; + VclPtr<CheckBox> pBtnDestPers; + VclPtr<ListBox> pLbCopyArea; + VclPtr<Edit> pEdCopyArea; + VclPtr<formula::RefButton> pRbCopyArea; + VclPtr<FixedText> pFtDbAreaLabel; + VclPtr<FixedText> pFtDbArea; const OUString& rStrUndefined; diff --git a/sc/source/ui/inc/formula.hxx b/sc/source/ui/inc/formula.hxx index 66db8807c815..b525b189c18f 100644 --- a/sc/source/ui/inc/formula.hxx +++ b/sc/source/ui/inc/formula.hxx @@ -55,6 +55,7 @@ public: ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScViewData* pViewData ,formula::IFunctionManager* _pFunctionMgr); virtual ~ScFormulaDlg(); + virtual void dispose() SAL_OVERRIDE; // IFormulaEditorHelper virtual void notifyChange() SAL_OVERRIDE; diff --git a/sc/source/ui/inc/fupoor.hxx b/sc/source/ui/inc/fupoor.hxx index 131edf61ed68..e38ca5c08f74 100644 --- a/sc/source/ui/inc/fupoor.hxx +++ b/sc/source/ui/inc/fupoor.hxx @@ -43,11 +43,11 @@ class FuPoor protected: ScDrawView* pView; ScTabViewShell* pViewShell; - vcl::Window* pWindow; + VclPtr<vcl::Window> pWindow; SdrModel* pDrDoc; SfxRequest aSfxRequest; - Dialog* pDialog; + VclPtr<Dialog> pDialog; Timer aScrollTimer; // for Autoscrolling DECL_LINK( ScrollHdl, void * ); diff --git a/sc/source/ui/inc/gridmerg.hxx b/sc/source/ui/inc/gridmerg.hxx index f98d76fd8982..94e8994df881 100644 --- a/sc/source/ui/inc/gridmerg.hxx +++ b/sc/source/ui/inc/gridmerg.hxx @@ -25,7 +25,7 @@ class OutputDevice; class ScGridMerger { private: - OutputDevice* pDev; + VclPtr<OutputDevice> pDev; long nOneX; long nOneY; long nFixStart; diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index a9d54d0e7426..8a0f5d4f7237 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -136,10 +136,10 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou std::unique_ptr<ScNoteMarker> mpNoteMarker; - std::unique_ptr<ScFilterListBox> mpFilterBox; - std::unique_ptr<FloatingWindow> mpFilterFloat; - std::unique_ptr<ScCheckListMenuWindow> mpAutoFilterPopup; - std::unique_ptr<ScCheckListMenuWindow> mpDPFieldPopup; + VclPtr<ScFilterListBox> mpFilterBox; + VclPtr<FloatingWindow> mpFilterFloat; + VclPtr<ScCheckListMenuWindow> mpAutoFilterPopup; + VclPtr<ScCheckListMenuWindow> mpDPFieldPopup; std::unique_ptr<ScDPFieldButton> mpFilterButton; sal_uInt16 nCursorHideCount; @@ -310,6 +310,7 @@ public: ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ); virtual ~ScGridWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; // #i70788# flush and get overlay diff --git a/sc/source/ui/inc/groupdlg.hxx b/sc/source/ui/inc/groupdlg.hxx index 04a98c6a15c5..2fdee6c08855 100644 --- a/sc/source/ui/inc/groupdlg.hxx +++ b/sc/source/ui/inc/groupdlg.hxx @@ -29,12 +29,12 @@ class ScGroupDlg : public ModalDialog public: ScGroupDlg(vcl::Window* pParent, bool bUnGroup = false, bool bRows = true); virtual ~ScGroupDlg(); - + virtual void dispose() SAL_OVERRIDE; bool GetColsChecked() const; private: - RadioButton* m_pBtnRows; - RadioButton* m_pBtnCols; + VclPtr<RadioButton> m_pBtnRows; + VclPtr<RadioButton> m_pBtnCols; }; #endif // INCLUDED_SC_SOURCE_UI_INC_GROUPDLG_HXX diff --git a/sc/source/ui/inc/highred.hxx b/sc/source/ui/inc/highred.hxx index 0b0039dd9ca6..d384c1caf23a 100644 --- a/sc/source/ui/inc/highred.hxx +++ b/sc/source/ui/inc/highred.hxx @@ -51,14 +51,14 @@ class ScDocument; class ScHighlightChgDlg : public ScAnyRefDlg { private: - CheckBox* m_pHighlightBox; - SvxTPFilter* m_pFilterCtr; - CheckBox* m_pCbAccept; - CheckBox* m_pCbReject; - OKButton* m_pOkButton; + VclPtr<CheckBox> m_pHighlightBox; + VclPtr<SvxTPFilter> m_pFilterCtr; + VclPtr<CheckBox> m_pCbAccept; + VclPtr<CheckBox> m_pCbReject; + VclPtr<OKButton> m_pOkButton; - formula::RefEdit* m_pEdAssign; - formula::RefButton* m_pRbAssign; + VclPtr<formula::RefEdit> m_pEdAssign; + VclPtr<formula::RefButton> m_pRbAssign; ScViewData* pViewData; ScDocument* pDoc; @@ -81,6 +81,7 @@ public: ScViewData* ptrViewData); virtual ~ScHighlightChgDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetActive() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index 829ec975f875..dfad789dcf40 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -28,6 +28,7 @@ #include <tools/gen.hxx> #include <tools/link.hxx> #include <vcl/vclevent.hxx> +#include <vcl/vclptr.hxx> #include <editeng/svxenum.hxx> #include <set> @@ -54,7 +55,7 @@ struct ESelection; class ScInputHandler : boost::noncopyable { private: - ScInputWindow* pInputWin; + VclPtr<ScInputWindow> pInputWin; ScEditEngineDefaulter* pEngine; ///< Edited data in the sheet (when the user clicks into the sheet, and starts writing there). EditView* pTableView; // associated active EditView @@ -66,9 +67,9 @@ private: ScTypedCaseStrSet::const_iterator miAutoPosColumn; ScTypedCaseStrSet::const_iterator miAutoPosFormula; - vcl::Window* pTipVisibleParent; + VclPtr<vcl::Window> pTipVisibleParent; sal_uLong nTipVisible; - vcl::Window* pTipVisibleSecParent; + VclPtr<vcl::Window> pTipVisibleSecParent; sal_uLong nTipVisibleSec; OUString aManualTip; OUString aAutoSearch; @@ -240,7 +241,7 @@ public: bool IsFormulaMode() const { return bFormulaMode; } ScInputWindow* GetInputWindow() { return pInputWin; } - void SetInputWindow( ScInputWindow* pNew ) { pInputWin = pNew; } + void SetInputWindow( ScInputWindow* pNew ); void StopInputWinEngine( bool bAll ); bool IsInEnterHandler() const { return bInEnterHandler; } diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index a1c9478ff104..f846d7b9b8c0 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -62,6 +62,7 @@ class ScTextWnd : public ScTextWndBase, public DragSourceHelper // edit wind public: ScTextWnd( vcl::Window* pParent, ScTabViewShell* pViewSh ); virtual ~ScTextWnd(); + virtual void dispose() SAL_OVERRIDE; virtual void SetTextString( const OUString& rString ) SAL_OVERRIDE; virtual const OUString& GetTextString() const SAL_OVERRIDE; @@ -139,6 +140,7 @@ private: public: ScPosWnd( vcl::Window* pParent ); virtual ~ScPosWnd(); + virtual void dispose() SAL_OVERRIDE; void SetPos( const OUString& rPosStr ); // Displayed Text void SetFormulaMode( bool bSet ); @@ -201,8 +203,9 @@ class ScInputBarGroup : public ScTextWndBase public: ScInputBarGroup( vcl::Window* Parent, ScTabViewShell* pViewSh ); virtual ~ScInputBarGroup(); - virtual void InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; - virtual void RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; + virtual void dispose() SAL_OVERRIDE; + virtual void InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; + virtual void RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ) SAL_OVERRIDE; // virtual void Paint(const Rectangle& rRect ); void SetTextString( const OUString& rString ) SAL_OVERRIDE; void StartEditEngine() SAL_OVERRIDE; @@ -217,16 +220,16 @@ public: bool IsFocus(); void MakeDialogEditView() SAL_OVERRIDE; bool IsInputActive() SAL_OVERRIDE; - ScrollBar& GetScrollBar() { return aScrollBar; } + ScrollBar& GetScrollBar() { return *aScrollBar.get(); } void IncrementVerticalSize(); void DecrementVerticalSize(); - long GetNumLines() { return aMultiTextWnd.GetNumLines(); } + long GetNumLines() { return aMultiTextWnd->GetNumLines(); } long GetVertOffset() { return nVertOffset; } private: void TriggerToolboxLayout(); - ScMultiTextWnd aMultiTextWnd; - ImageButton aButton; - ScrollBar aScrollBar; + VclPtr<ScMultiTextWnd> aMultiTextWnd; + VclPtr<ImageButton> aButton; + VclPtr<ScrollBar> aScrollBar; long nVertOffset; DECL_LINK( ClickHdl, void* ); DECL_LINK( Impl_ScrollHdl, void* ); @@ -238,6 +241,7 @@ class ScInputWindow : public ToolBox // Parent toolbox public: ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ); virtual ~ScInputWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -284,8 +288,8 @@ protected: bool UseSubTotal( ScRangeList* pRangeList ) const; bool IsPointerAtResizePos(); private: - ScPosWnd aWndPos; - std::unique_ptr<ScTextWndBase> pRuntimeWindow; + VclPtr<ScPosWnd> aWndPos; + VclPtr<ScTextWndBase> pRuntimeWindow; ScTextWndBase& aTextWindow; ScInputHandler* pInputHdl; OUString aTextOk; diff --git a/sc/source/ui/inc/inscldlg.hxx b/sc/source/ui/inc/inscldlg.hxx index dd9a250f7acb..e89d68d9bdb3 100644 --- a/sc/source/ui/inc/inscldlg.hxx +++ b/sc/source/ui/inc/inscldlg.hxx @@ -29,14 +29,15 @@ class ScInsertCellDlg : public ModalDialog { private: - RadioButton* m_pBtnCellsDown; - RadioButton* m_pBtnCellsRight; - RadioButton* m_pBtnInsRow; - RadioButton* m_pBtnInsCol; + VclPtr<RadioButton> m_pBtnCellsDown; + VclPtr<RadioButton> m_pBtnCellsRight; + VclPtr<RadioButton> m_pBtnInsRow; + VclPtr<RadioButton> m_pBtnInsCol; public: ScInsertCellDlg( vcl::Window* pParent,bool bDisallowCellMove = false ); virtual ~ScInsertCellDlg(); + virtual void dispose() SAL_OVERRIDE; InsCellCmd GetInsCellCmd() const; }; diff --git a/sc/source/ui/inc/inscodlg.hxx b/sc/source/ui/inc/inscodlg.hxx index 30f89fe35eda..65ea1d9d5f6f 100644 --- a/sc/source/ui/inc/inscodlg.hxx +++ b/sc/source/ui/inc/inscodlg.hxx @@ -34,6 +34,7 @@ public: InsertDeleteFlags nCheckDefaults = IDF_NONE, const OUString* pStrTitle = NULL ); virtual ~ScInsertContentsDlg(); + virtual void dispose() SAL_OVERRIDE; InsertDeleteFlags GetInsContentsCmdBits() const; sal_uInt16 GetFormulaCmdBits() const; @@ -48,32 +49,32 @@ public: void SetCellShiftDisabled( int nDisable ); private: - CheckBox* mpBtnInsAll; - CheckBox* mpBtnInsStrings; - CheckBox* mpBtnInsNumbers; - CheckBox* mpBtnInsDateTime; - CheckBox* mpBtnInsFormulas; - CheckBox* mpBtnInsNotes; - CheckBox* mpBtnInsAttrs; - CheckBox* mpBtnInsObjects; - - CheckBox* mpBtnSkipEmptyCells; - CheckBox* mpBtnTranspose; - CheckBox* mpBtnLink; - - RadioButton* mpRbNoOp; - RadioButton* mpRbAdd; - RadioButton* mpRbSub; - RadioButton* mpRbMul; - RadioButton* mpRbDiv; - - RadioButton* mpRbMoveNone; - RadioButton* mpRbMoveDown; - RadioButton* mpRbMoveRight; - - PushButton* mpBtnShortCutPasteValuesOnly; - PushButton* mpBtnShortCutPasteValuesFormats; - PushButton* mpBtnShortCutPasteTranspose; + VclPtr<CheckBox> mpBtnInsAll; + VclPtr<CheckBox> mpBtnInsStrings; + VclPtr<CheckBox> mpBtnInsNumbers; + VclPtr<CheckBox> mpBtnInsDateTime; + VclPtr<CheckBox> mpBtnInsFormulas; + VclPtr<CheckBox> mpBtnInsNotes; + VclPtr<CheckBox> mpBtnInsAttrs; + VclPtr<CheckBox> mpBtnInsObjects; + + VclPtr<CheckBox> mpBtnSkipEmptyCells; + VclPtr<CheckBox> mpBtnTranspose; + VclPtr<CheckBox> mpBtnLink; + + VclPtr<RadioButton> mpRbNoOp; + VclPtr<RadioButton> mpRbAdd; + VclPtr<RadioButton> mpRbSub; + VclPtr<RadioButton> mpRbMul; + VclPtr<RadioButton> mpRbDiv; + + VclPtr<RadioButton> mpRbMoveNone; + VclPtr<RadioButton> mpRbMoveDown; + VclPtr<RadioButton> mpRbMoveRight; + + VclPtr<PushButton> mpBtnShortCutPasteValuesOnly; + VclPtr<PushButton> mpBtnShortCutPasteValuesFormats; + VclPtr<PushButton> mpBtnShortCutPasteTranspose; bool bOtherDoc; bool bFillMode; diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx index 7bc1dd590b7f..64bc24f5bc17 100644 --- a/sc/source/ui/inc/instbdlg.hxx +++ b/sc/source/ui/inc/instbdlg.hxx @@ -44,6 +44,7 @@ class ScInsertTableDlg : public ModalDialog public: ScInsertTableDlg( vcl::Window* pParent, ScViewData& rViewData, SCTAB nTabCount, bool bFromFile ); virtual ~ScInsertTableDlg(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; // override to set parent dialog @@ -57,19 +58,19 @@ public: SCTAB GetTableCount() const { return nTableCount;} private: - RadioButton* m_pBtnBefore; - RadioButton* m_pBtnBehind; - RadioButton* m_pBtnNew; - RadioButton* m_pBtnFromFile; - FixedText* m_pFtCount; - NumericField* m_pNfCount; - FixedText* m_pFtName; - Edit* m_pEdName; - ListBox* m_pLbTables; - FixedText* m_pFtPath; - PushButton* m_pBtnBrowse; - CheckBox* m_pBtnLink; - OKButton* m_pBtnOk; + VclPtr<RadioButton> m_pBtnBefore; + VclPtr<RadioButton> m_pBtnBehind; + VclPtr<RadioButton> m_pBtnNew; + VclPtr<RadioButton> m_pBtnFromFile; + VclPtr<FixedText> m_pFtCount; + VclPtr<NumericField> m_pNfCount; + VclPtr<FixedText> m_pFtName; + VclPtr<Edit> m_pEdName; + VclPtr<ListBox> m_pLbTables; + VclPtr<FixedText> m_pFtPath; + VclPtr<PushButton> m_pBtnBrowse; + VclPtr<CheckBox> m_pBtnLink; + VclPtr<OKButton> m_pBtnOk; Timer aBrowseTimer; ScViewData& rViewData; diff --git a/sc/source/ui/inc/lbseldlg.hxx b/sc/source/ui/inc/lbseldlg.hxx index 39c2fd61a67b..ab52b76318fd 100644 --- a/sc/source/ui/inc/lbseldlg.hxx +++ b/sc/source/ui/inc/lbseldlg.hxx @@ -30,12 +30,14 @@ class ScSelEntryDlg : public ModalDialog { private: - ListBox* m_pLb; + VclPtr<ListBox> m_pLb; DECL_LINK( DblClkHdl, void * ); public: ScSelEntryDlg(vcl::Window* pParent, const std::vector<OUString> &rEntryList); + virtual ~ScSelEntryDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetSelectEntry() const; }; diff --git a/sc/source/ui/inc/linkarea.hxx b/sc/source/ui/inc/linkarea.hxx index 6c11b2f0053b..d88b17d76b41 100644 --- a/sc/source/ui/inc/linkarea.hxx +++ b/sc/source/ui/inc/linkarea.hxx @@ -37,13 +37,13 @@ class ScDocShell; class ScLinkedAreaDlg : public ModalDialog { private: - SvtURLBox* m_pCbUrl; - PushButton* m_pBtnBrowse; - ListBox* m_pLbRanges; - CheckBox* m_pBtnReload; - NumericField* m_pNfDelay; - FixedText* m_pFtSeconds; - OKButton* m_pBtnOk; + VclPtr<SvtURLBox> m_pCbUrl; + VclPtr<PushButton> m_pBtnBrowse; + VclPtr<ListBox> m_pLbRanges; + VclPtr<CheckBox> m_pBtnReload; + VclPtr<NumericField> m_pNfDelay; + VclPtr<FixedText> m_pFtSeconds; + VclPtr<OKButton> m_pBtnOk; ScDocShell* pSourceShell; sfx2::DocumentInserter* pDocInserter; @@ -64,6 +64,7 @@ private: public: ScLinkedAreaDlg( vcl::Window* pParent ); virtual ~ScLinkedAreaDlg(); + virtual void dispose() SAL_OVERRIDE; void InitFromOldLink( const OUString& rFile, const OUString& rFilter, const OUString& rOptions, const OUString& rSource, diff --git a/sc/source/ui/inc/mtrindlg.hxx b/sc/source/ui/inc/mtrindlg.hxx index ab422cf22819..72b106fd3504 100644 --- a/sc/source/ui/inc/mtrindlg.hxx +++ b/sc/source/ui/inc/mtrindlg.hxx @@ -38,12 +38,14 @@ public: long nMinimum = 0, long nFirst = 1, long nLast = 100 ); + virtual ~ScMetricInputDlg(); + virtual void dispose() SAL_OVERRIDE; long GetInputValue( FieldUnit eUnit = FUNIT_TWIP ) const; private: - MetricField* m_pEdValue; - CheckBox* m_pBtnDefVal; + VclPtr<MetricField> m_pEdValue; + VclPtr<CheckBox> m_pBtnDefVal; long nDefaultValue; long nCurrentValue; diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx index 0087e42927e6..cef3d5f8160b 100644 --- a/sc/source/ui/inc/mvtabdlg.hxx +++ b/sc/source/ui/inc/mvtabdlg.hxx @@ -32,6 +32,7 @@ class ScMoveTableDlg : public ModalDialog public: ScMoveTableDlg(vcl::Window* pParent, const OUString& rDefault); virtual ~ScMoveTableDlg(); + virtual void dispose() SAL_OVERRIDE; sal_uInt16 GetSelectedDocument () const { return nDocument; } SCTAB GetSelectedTable () const { return nTable; } @@ -49,13 +50,13 @@ private: bool IsCurrentDocSelected() const; private: - RadioButton* pBtnMove; - RadioButton* pBtnCopy; - ListBox* pLbDoc; - ListBox* pLbTable; - Edit* pEdTabName; - FixedText* pFtWarn; - OKButton* pBtnOk; + VclPtr<RadioButton> pBtnMove; + VclPtr<RadioButton> pBtnCopy; + VclPtr<ListBox> pLbDoc; + VclPtr<ListBox> pLbTable; + VclPtr<Edit> pEdTabName; + VclPtr<FixedText> pFtWarn; + VclPtr<OKButton> pBtnOk; OUString msCurrentDoc; OUString msNewDoc; diff --git a/sc/source/ui/inc/namecrea.hxx b/sc/source/ui/inc/namecrea.hxx index ef8762605dbc..7a53cd85a4a7 100644 --- a/sc/source/ui/inc/namecrea.hxx +++ b/sc/source/ui/inc/namecrea.hxx @@ -28,13 +28,14 @@ class ScNameCreateDlg : public ModalDialog { protected: - CheckBox* m_pTopBox; - CheckBox* m_pLeftBox; - CheckBox* m_pBottomBox; - CheckBox* m_pRightBox; + VclPtr<CheckBox> m_pTopBox; + VclPtr<CheckBox> m_pLeftBox; + VclPtr<CheckBox> m_pBottomBox; + VclPtr<CheckBox> m_pRightBox; public: ScNameCreateDlg( vcl::Window * pParent, sal_uInt16 nFlags ); - + virtual ~ScNameCreateDlg(); + virtual void dispose() SAL_OVERRIDE; sal_uInt16 GetFlags() const; }; diff --git a/sc/source/ui/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx index b21a0be4924b..acdb9ed31e52 100644 --- a/sc/source/ui/inc/namedefdlg.hxx +++ b/sc/source/ui/inc/namedefdlg.hxx @@ -26,21 +26,21 @@ class ScViewData; class ScNameDefDlg : public ScAnyRefDlg { private: - Edit* m_pEdName; + VclPtr<Edit> m_pEdName; - formula::RefEdit* m_pEdRange; - formula::RefButton* m_pRbRange; + VclPtr<formula::RefEdit> m_pEdRange; + VclPtr<formula::RefButton> m_pRbRange; - ListBox* m_pLbScope; + VclPtr<ListBox> m_pLbScope; - CheckBox* m_pBtnRowHeader; - CheckBox* m_pBtnColHeader; - CheckBox* m_pBtnPrintArea; - CheckBox* m_pBtnCriteria; + VclPtr<CheckBox> m_pBtnRowHeader; + VclPtr<CheckBox> m_pBtnColHeader; + VclPtr<CheckBox> m_pBtnPrintArea; + VclPtr<CheckBox> m_pBtnCriteria; - PushButton* m_pBtnAdd; - PushButton* m_pBtnCancel; - FixedText* m_pFtInfo; + VclPtr<PushButton> m_pBtnAdd; + VclPtr<PushButton> m_pBtnCancel; + VclPtr<FixedText> m_pFtInfo; bool mbUndo; //if true we need to add an undo action after creating a range name ScDocument* mpDoc; @@ -77,7 +77,8 @@ public: ScViewData* pViewData, const std::map<OUString, ScRangeName*>& aRangeMap, const ScAddress& aCursorPos, const bool bUndo); - virtual ~ScNameDefDlg() {}; + virtual ~ScNameDefDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual bool IsRefInputMode() const SAL_OVERRIDE; diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index cb586b928554..cad2f9d8d364 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -43,24 +43,24 @@ class ScDocument; class ScNameDlg : public ScAnyRefDlg, public ScRangeManagerTable::InitListener { private: - Edit* m_pEdName; - formula::RefEdit* m_pEdAssign; - formula::RefButton* m_pRbAssign; - ListBox* m_pLbScope; + VclPtr<Edit> m_pEdName; + VclPtr<formula::RefEdit> m_pEdAssign; + VclPtr<formula::RefButton> m_pRbAssign; + VclPtr<ListBox> m_pLbScope; - CheckBox* m_pBtnPrintArea; - CheckBox* m_pBtnColHeader; - CheckBox* m_pBtnCriteria; - CheckBox* m_pBtnRowHeader; + VclPtr<CheckBox> m_pBtnPrintArea; + VclPtr<CheckBox> m_pBtnColHeader; + VclPtr<CheckBox> m_pBtnCriteria; + VclPtr<CheckBox> m_pBtnRowHeader; - PushButton* m_pBtnAdd; - PushButton* m_pBtnDelete; - PushButton* m_pBtnOk; - PushButton* m_pBtnCancel; + VclPtr<PushButton> m_pBtnAdd; + VclPtr<PushButton> m_pBtnDelete; + VclPtr<PushButton> m_pBtnOk; + VclPtr<PushButton> m_pBtnCancel; - FixedText* m_pFtInfo; + VclPtr<FixedText> m_pFtInfo; - ScRangeManagerTable* m_pRangeManagerTable; + VclPtr<ScRangeManagerTable> m_pRangeManagerTable; const OUString maGlobalNameStr; const OUString maErrInvalidNameStr; @@ -123,6 +123,7 @@ public: ScViewData* ptrViewData, const ScAddress& aCursorPos, boost::ptr_map<OUString, ScRangeName>* pRangeMap = NULL ); virtual ~ScNameDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual bool IsRefInputMode() const SAL_OVERRIDE; diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx index f50b7bd8a47e..f87e3dd99519 100644 --- a/sc/source/ui/inc/namemgrtable.hxx +++ b/sc/source/ui/inc/namemgrtable.hxx @@ -66,6 +66,7 @@ private: public: ScRangeManagerTable( SvSimpleTableContainer& rParent, boost::ptr_map<OUString, ScRangeName>& aTabRangeNames, const ScAddress& rPos ); virtual ~ScRangeManagerTable(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx index 866ffc79ee04..a71a95b23e9c 100644 --- a/sc/source/ui/inc/namepast.hxx +++ b/sc/source/ui/inc/namepast.hxx @@ -37,11 +37,11 @@ class ScNamePasteDlg : public ModalDialog DECL_LINK( ButtonHdl, Button * ); private: - PushButton* m_pBtnPasteAll; - PushButton* m_pBtnPaste; - PushButton* m_pBtnClose; + VclPtr<PushButton> m_pBtnPasteAll; + VclPtr<PushButton> m_pBtnPaste; + VclPtr<PushButton> m_pBtnClose; - ScRangeManagerTable* mpTable; + VclPtr<ScRangeManagerTable> mpTable; std::vector<OUString> maSelectedNames; boost::ptr_map<OUString, ScRangeName> maRangeMap; @@ -49,6 +49,7 @@ public: ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool bInsList=true ); virtual ~ScNamePasteDlg(); + virtual void dispose() SAL_OVERRIDE; std::vector<OUString> GetSelectedNames() const; }; diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index f966fba1b9ff..8445a094019c 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -97,10 +97,11 @@ class ScScenarioWindow : public vcl::Window public: ScScenarioWindow( vcl::Window* pParent, const OUString& aQH_List, const OUString& aQH_Comment); virtual ~ScScenarioWindow(); + virtual void dispose() SAL_OVERRIDE; void NotifyState( const SfxPoolItem* pState ); void SetComment( const OUString& rComment ) - { aEdComment.SetText( rComment ); } + { aEdComment->SetText( rComment ); } void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE; @@ -109,8 +110,8 @@ protected: virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; private: - ScScenarioListBox aLbScenario; - MultiLineEdit aEdComment; + VclPtr<ScScenarioListBox> aLbScenario; + VclPtr<MultiLineEdit> aEdComment; }; // class ColumnEdit @@ -220,14 +221,14 @@ private: SfxBindings& rBindings; // must be first member ImageList aCmdImageList; // must be before aTbxCmd - FixedInfo aFtCol; - ColumnEdit aEdCol; - FixedInfo aFtRow; - RowEdit aEdRow; - CommandToolBox aTbxCmd; - ScContentTree aLbEntries; - ScScenarioWindow aWndScenarios; - ScDocListBox aLbDocuments; + VclPtr<FixedInfo> aFtCol; + VclPtr<ColumnEdit> aEdCol; + VclPtr<FixedInfo> aFtRow; + VclPtr<RowEdit> aEdRow; + VclPtr<CommandToolBox> aTbxCmd; + VclPtr<ScContentTree> aLbEntries; + VclPtr<ScScenarioWindow> aWndScenarios; + VclPtr<ScDocListBox> aLbDocuments; Idle aContentIdle; @@ -309,6 +310,7 @@ public: ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl::Window* pParent, const bool bUseStyleSettingsBackground); virtual ~ScNavigatorDlg(); + virtual void dispose() SAL_OVERRIDE; using Window::Notify; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; @@ -329,7 +331,7 @@ public: virtual void Resizing( Size& rSize ) SAL_OVERRIDE; private: - ScNavigatorDlg* pNavigator; + VclPtr<ScNavigatorDlg> pNavigator; }; #endif // INCLUDED_SC_SOURCE_UI_INC_NAVIPI_HXX diff --git a/sc/source/ui/inc/notemark.hxx b/sc/source/ui/inc/notemark.hxx index 537837aa7af3..ee8af56338f0 100644 --- a/sc/source/ui/inc/notemark.hxx +++ b/sc/source/ui/inc/notemark.hxx @@ -31,10 +31,10 @@ class SdrObject; class ScNoteMarker { private: - vcl::Window* pWindow; - vcl::Window* pRightWin; - vcl::Window* pBottomWin; - vcl::Window* pDiagWin; + VclPtr<vcl::Window> pWindow; + VclPtr<vcl::Window> pRightWin; + VclPtr<vcl::Window> pBottomWin; + VclPtr<vcl::Window> pDiagWin; ScDocument* pDoc; ScAddress aDocPos; OUString aUserText; diff --git a/sc/source/ui/inc/olinewin.hxx b/sc/source/ui/inc/olinewin.hxx index 107447d8529e..c95dffef4229 100644 --- a/sc/source/ui/inc/olinewin.hxx +++ b/sc/source/ui/inc/olinewin.hxx @@ -62,6 +62,7 @@ public: ScViewData* pViewData, ScSplitPos eWhich ); virtual ~ScOutlineWindow(); + virtual void dispose() SAL_OVERRIDE; /** Sets the size of the header area (width/height dep. on window type). */ void SetHeaderSize( long nNewSize ); diff --git a/sc/source/ui/inc/opredlin.hxx b/sc/source/ui/inc/opredlin.hxx index 0e5e07c6b518..adfb4062a266 100644 --- a/sc/source/ui/inc/opredlin.hxx +++ b/sc/source/ui/inc/opredlin.hxx @@ -36,10 +36,10 @@ class ScRedlineOptionsTabPage : public SfxTabPage { - ColorListBox* m_pContentColorLB; - ColorListBox* m_pRemoveColorLB; - ColorListBox* m_pInsertColorLB; - ColorListBox* m_pMoveColorLB; + VclPtr<ColorListBox> m_pContentColorLB; + VclPtr<ColorListBox> m_pRemoveColorLB; + VclPtr<ColorListBox> m_pInsertColorLB; + VclPtr<ColorListBox> m_pMoveColorLB; OUString aAuthorStr; DECL_LINK(ColorHdl, void *); @@ -47,8 +47,8 @@ public: ScRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ); virtual ~ScRedlineOptionsTabPage(); - - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/optsolver.hxx b/sc/source/ui/inc/optsolver.hxx index 6d1fd0f35f1b..1a9acfa1f072 100644 --- a/sc/source/ui/inc/optsolver.hxx +++ b/sc/source/ui/inc/optsolver.hxx @@ -96,6 +96,7 @@ public: ScOptSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScDocShell* pDocSh, ScAddress aCursorPos ); virtual ~ScOptSolverDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual bool IsRefInputMode() const SAL_OVERRIDE; @@ -103,56 +104,56 @@ public: virtual bool Close() SAL_OVERRIDE; private: - FixedText* m_pFtObjectiveCell; - formula::RefEdit* m_pEdObjectiveCell; - formula::RefButton* m_pRBObjectiveCell; - - RadioButton* m_pRbMax; - RadioButton* m_pRbMin; - RadioButton* m_pRbValue; - formula::RefEdit* m_pEdTargetValue; - formula::RefButton* m_pRBTargetValue; - - FixedText* m_pFtVariableCells; - formula::RefEdit* m_pEdVariableCells; - formula::RefButton* m_pRBVariableCells; - - FixedText* m_pFtCellRef; // labels are together with controls for the first row - ScCursorRefEdit* m_pEdLeft1; - formula::RefButton* m_pRBLeft1; - FixedText* m_pFtOperator; - ListBox* m_pLbOp1; - FixedText* m_pFtConstraint; - ScCursorRefEdit* m_pEdRight1; - formula::RefButton* m_pRBRight1; - PushButton* m_pBtnDel1; - - ScCursorRefEdit* m_pEdLeft2; - formula::RefButton* m_pRBLeft2; - ListBox* m_pLbOp2; - ScCursorRefEdit* m_pEdRight2; - formula::RefButton* m_pRBRight2; - PushButton* m_pBtnDel2; - - ScCursorRefEdit* m_pEdLeft3; - formula::RefButton* m_pRBLeft3; - ListBox* m_pLbOp3; - ScCursorRefEdit* m_pEdRight3; - formula::RefButton* m_pRBRight3; - PushButton* m_pBtnDel3; - - ScCursorRefEdit* m_pEdLeft4; - formula::RefButton* m_pRBLeft4; - ListBox* m_pLbOp4; - ScCursorRefEdit* m_pEdRight4; - formula::RefButton* m_pRBRight4; - PushButton* m_pBtnDel4; - - ScrollBar* m_pScrollBar; - - PushButton* m_pBtnOpt; - PushButton* m_pBtnCancel; - PushButton* m_pBtnSolve; + VclPtr<FixedText> m_pFtObjectiveCell; + VclPtr<formula::RefEdit> m_pEdObjectiveCell; + VclPtr<formula::RefButton> m_pRBObjectiveCell; + + VclPtr<RadioButton> m_pRbMax; + VclPtr<RadioButton> m_pRbMin; + VclPtr<RadioButton> m_pRbValue; + VclPtr<formula::RefEdit> m_pEdTargetValue; + VclPtr<formula::RefButton> m_pRBTargetValue; + + VclPtr<FixedText> m_pFtVariableCells; + VclPtr<formula::RefEdit> m_pEdVariableCells; + VclPtr<formula::RefButton> m_pRBVariableCells; + + VclPtr<FixedText> m_pFtCellRef; // labels are together with controls for the first row + VclPtr<ScCursorRefEdit> m_pEdLeft1; + VclPtr<formula::RefButton> m_pRBLeft1; + VclPtr<FixedText> m_pFtOperator; + VclPtr<ListBox> m_pLbOp1; + VclPtr<FixedText> m_pFtConstraint; + VclPtr<ScCursorRefEdit> m_pEdRight1; + VclPtr<formula::RefButton> m_pRBRight1; + VclPtr<PushButton> m_pBtnDel1; + + VclPtr<ScCursorRefEdit> m_pEdLeft2; + VclPtr<formula::RefButton> m_pRBLeft2; + VclPtr<ListBox> m_pLbOp2; + VclPtr<ScCursorRefEdit> m_pEdRight2; + VclPtr<formula::RefButton> m_pRBRight2; + VclPtr<PushButton> m_pBtnDel2; + + VclPtr<ScCursorRefEdit> m_pEdLeft3; + VclPtr<formula::RefButton> m_pRBLeft3; + VclPtr<ListBox> m_pLbOp3; + VclPtr<ScCursorRefEdit> m_pEdRight3; + VclPtr<formula::RefButton> m_pRBRight3; + VclPtr<PushButton> m_pBtnDel3; + + VclPtr<ScCursorRefEdit> m_pEdLeft4; + VclPtr<formula::RefButton> m_pRBLeft4; + VclPtr<ListBox> m_pLbOp4; + VclPtr<ScCursorRefEdit> m_pEdRight4; + VclPtr<formula::RefButton> m_pRBRight4; + VclPtr<PushButton> m_pBtnDel4; + + VclPtr<ScrollBar> m_pScrollBar; + + VclPtr<PushButton> m_pBtnOpt; + VclPtr<PushButton> m_pBtnCancel; + VclPtr<PushButton> m_pBtnSolve; OUString maInputError; OUString maConditionError; @@ -160,16 +161,16 @@ private: ScDocShell* mpDocShell; ScDocument& mrDoc; const SCTAB mnCurTab; - formula::RefEdit* mpEdActive; + VclPtr<formula::RefEdit> mpEdActive; bool mbDlgLostFocus; static const sal_uInt16 EDIT_ROW_COUNT = 4; - ScCursorRefEdit* mpLeftEdit[EDIT_ROW_COUNT]; - formula::RefButton* mpLeftButton[EDIT_ROW_COUNT]; - ScCursorRefEdit* mpRightEdit[EDIT_ROW_COUNT]; - formula::RefButton* mpRightButton[EDIT_ROW_COUNT]; - ListBox* mpOperator[EDIT_ROW_COUNT]; - PushButton* mpDelButton[EDIT_ROW_COUNT]; + VclPtr<ScCursorRefEdit> mpLeftEdit[EDIT_ROW_COUNT]; + VclPtr<formula::RefButton> mpLeftButton[EDIT_ROW_COUNT]; + VclPtr<ScCursorRefEdit> mpRightEdit[EDIT_ROW_COUNT]; + VclPtr<formula::RefButton> mpRightButton[EDIT_ROW_COUNT]; + VclPtr<ListBox> mpOperator[EDIT_ROW_COUNT]; + VclPtr<PushButton> mpDelButton[EDIT_ROW_COUNT]; std::vector<ScOptConditionRow> maConditions; long nScrollPos; @@ -202,10 +203,12 @@ private: class ScSolverProgressDialog : public ModelessDialog { - FixedText* m_pFtTime; + VclPtr<FixedText> m_pFtTime; public: ScSolverProgressDialog( vcl::Window* pParent ); + virtual ~ScSolverProgressDialog(); + virtual void dispose() SAL_OVERRIDE; void HideTimeLimit(); void SetTimeLimit( sal_Int32 nSeconds ); @@ -213,22 +216,26 @@ public: class ScSolverNoSolutionDialog : public ModalDialog { - FixedText* m_pFtErrorText; + VclPtr<FixedText> m_pFtErrorText; public: ScSolverNoSolutionDialog(vcl::Window* pParent, const OUString& rErrorText); + virtual ~ScSolverNoSolutionDialog(); + virtual void dispose() SAL_OVERRIDE; }; class ScSolverSuccessDialog : public ModalDialog { - FixedText* m_pFtResult; - PushButton* m_pBtnOk; - PushButton* m_pBtnCancel; + VclPtr<FixedText> m_pFtResult; + VclPtr<PushButton> m_pBtnOk; + VclPtr<PushButton> m_pBtnCancel; DECL_LINK(ClickHdl, PushButton*); public: ScSolverSuccessDialog( vcl::Window* pParent, const OUString& rSolution ); + virtual ~ScSolverSuccessDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 7d8ef814651e..8873af7bd287 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -141,9 +141,9 @@ private: void adjustForHyperlinkInPDF(Point aURLStart, OutputDevice* pDev); }; - OutputDevice* mpDev; // Device - OutputDevice* mpRefDevice; // printer if used for preview - OutputDevice* pFmtDevice; // reference for text formatting + VclPtr<OutputDevice> mpDev; // Device + VclPtr<OutputDevice> mpRefDevice; // printer if used for preview + VclPtr<OutputDevice> pFmtDevice; // reference for text formatting ScTableInfo& mrTabInfo; RowInfo* pRowInfo; // Info block SCSIZE nArrCount; // occupied lines in info block diff --git a/sc/source/ui/inc/pfiltdlg.hxx b/sc/source/ui/inc/pfiltdlg.hxx index 55b3fa8625c2..c2272b311c76 100644 --- a/sc/source/ui/inc/pfiltdlg.hxx +++ b/sc/source/ui/inc/pfiltdlg.hxx @@ -40,28 +40,29 @@ class ScPivotFilterDlg : public ModalDialog public: ScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgSet, SCTAB nSourceTab); virtual ~ScPivotFilterDlg(); + virtual void dispose() SAL_OVERRIDE; const ScQueryItem& GetOutputItem(); private: - ListBox* m_pLbField1; - ListBox* m_pLbCond1; - ComboBox* m_pEdVal1; - - ListBox* m_pLbConnect1; - ListBox* m_pLbField2; - ListBox* m_pLbCond2; - ComboBox* m_pEdVal2; - - ListBox* m_pLbConnect2; - ListBox* m_pLbField3; - ListBox* m_pLbCond3; - ComboBox* m_pEdVal3; - - CheckBox* m_pBtnCase; - CheckBox* m_pBtnRegExp; - CheckBox* m_pBtnUnique; - FixedText* m_pFtDbArea; + VclPtr<ListBox> m_pLbField1; + VclPtr<ListBox> m_pLbCond1; + VclPtr<ComboBox> m_pEdVal1; + + VclPtr<ListBox> m_pLbConnect1; + VclPtr<ListBox> m_pLbField2; + VclPtr<ListBox> m_pLbCond2; + VclPtr<ComboBox> m_pEdVal2; + + VclPtr<ListBox> m_pLbConnect2; + VclPtr<ListBox> m_pLbField3; + VclPtr<ListBox> m_pLbCond3; + VclPtr<ComboBox> m_pEdVal3; + + VclPtr<CheckBox> m_pBtnCase; + VclPtr<CheckBox> m_pBtnRegExp; + VclPtr<CheckBox> m_pBtnUnique; + VclPtr<FixedText> m_pFtDbArea; const OUString aStrNone; const OUString aStrEmpty; const OUString aStrNotEmpty; @@ -75,9 +76,9 @@ private: SCTAB nSrcTab; sal_uInt16 nFieldCount; - ComboBox* aValueEdArr[3]; - ListBox* aFieldLbArr[3]; - ListBox* aCondLbArr[3]; + VclPtr<ComboBox> aValueEdArr[3]; + VclPtr<ListBox> aFieldLbArr[3]; + VclPtr<ListBox> aCondLbArr[3]; std::vector<ScTypedStrData>* pEntryLists[MAXCOLCOUNT]; diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx index bcf4fbc66d15..7be36eeca8a3 100644 --- a/sc/source/ui/inc/preview.hxx +++ b/sc/source/ui/inc/preview.hxx @@ -118,6 +118,7 @@ protected: public: ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pViewSh ); virtual ~ScPreview(); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/prevloc.hxx b/sc/source/ui/inc/prevloc.hxx index 3a4b5bbbefee..3f59e330725e 100644 --- a/sc/source/ui/inc/prevloc.hxx +++ b/sc/source/ui/inc/prevloc.hxx @@ -82,7 +82,7 @@ public: class ScPreviewLocationData { - OutputDevice* pWindow; + VclPtr<OutputDevice> pWindow; ScDocument* pDoc; MapMode aCellMapMode; MapMode aDrawMapMode[SC_PREVIEW_MAXRANGES]; diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx index b17ff47669cc..448b3f514151 100644 --- a/sc/source/ui/inc/prevwsh.hxx +++ b/sc/source/ui/inc/prevwsh.hxx @@ -40,11 +40,11 @@ class ScPreviewShell: public SfxViewShell { ScDocShell* pDocShell; - SystemWindow* mpFrameWindow; - ScPreview* pPreview; // Output window - ScrollBar* pHorScroll; - ScrollBar* pVerScroll; - vcl::Window* pCorner; + VclPtr<SystemWindow> mpFrameWindow; + VclPtr<ScPreview> pPreview; // Output window + VclPtr<ScrollBar> pHorScroll; + VclPtr<ScrollBar> pVerScroll; + VclPtr<vcl::Window> pCorner; ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSourceData; // ViewData TriState nSourceDesignMode; // form design mode from TabView @@ -109,7 +109,7 @@ public: virtual SfxPrinter* GetPrinter( bool bCreate = false ) SAL_OVERRIDE; virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ) SAL_OVERRIDE; virtual bool HasPrintOptionsPage() const SAL_OVERRIDE; - virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) SAL_OVERRIDE; + virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) SAL_OVERRIDE; void AddAccessibilityObject( SfxListener& rObject ); void RemoveAccessibilityObject( SfxListener& rObject ); diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index 2e8d51eb575e..265789578cca 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -130,8 +130,8 @@ class ScPrintFunc private: ScDocShell* pDocShell; ScDocument* pDoc; - SfxPrinter* pPrinter; - OutputDevice* pDev; + VclPtr<SfxPrinter> pPrinter; + VclPtr<OutputDevice> pDev; FmFormView* pDrawView; MapMode aOldPrinterMode; // MapMode before the call diff --git a/sc/source/ui/inc/protectiondlg.hxx b/sc/source/ui/inc/protectiondlg.hxx index 812b40258dc7..32a0b724c466 100644 --- a/sc/source/ui/inc/protectiondlg.hxx +++ b/sc/source/ui/inc/protectiondlg.hxx @@ -35,6 +35,7 @@ class ScTableProtectionDlg : public ModalDialog public: explicit ScTableProtectionDlg(vcl::Window* pParent); virtual ~ScTableProtectionDlg(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; @@ -49,16 +50,16 @@ private: void EnableOptionalWidgets(bool bEnable = true); - CheckBox* m_pBtnProtect; + VclPtr<CheckBox> m_pBtnProtect; - VclContainer* m_pPasswords; - VclContainer* m_pOptions; - Edit* m_pPassword1Edit; - Edit* m_pPassword2Edit; + VclPtr<VclContainer> m_pPasswords; + VclPtr<VclContainer> m_pOptions; + VclPtr<Edit> m_pPassword1Edit; + VclPtr<Edit> m_pPassword2Edit; - SvxCheckListBox* m_pOptionsListBox; + VclPtr<SvxCheckListBox> m_pOptionsListBox; - OKButton* m_pBtnOk; + VclPtr<OKButton> m_pBtnOk; OUString m_aSelectLockedCells; OUString m_aSelectUnlockedCells; diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx index 4718e5e5e026..bfebea6b8439 100644 --- a/sc/source/ui/inc/pvfundlg.hxx +++ b/sc/source/ui/inc/pvfundlg.hxx @@ -60,7 +60,8 @@ class ScDPFunctionDlg : public ModalDialog public: explicit ScDPFunctionDlg( vcl::Window* pParent, const ScDPLabelDataVector& rLabelVec, const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); - + virtual ~ScDPFunctionDlg(); + virtual void dispose() SAL_OVERRIDE; sal_uInt16 GetFuncMask() const; ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const; @@ -77,14 +78,14 @@ private: DECL_LINK( DblClickHdl, void* ); private: - ScDPFunctionListBox* mpLbFunc; - FixedText* mpFtName; - ListBox* mpLbType; - FixedText* mpFtBaseField; - ListBox* mpLbBaseField; - FixedText* mpFtBaseItem; - ListBox* mpLbBaseItem; - OKButton* mpBtnOk; + VclPtr<ScDPFunctionListBox> mpLbFunc; + VclPtr<FixedText> mpFtName; + VclPtr<ListBox> mpLbType; + VclPtr<FixedText> mpFtBaseField; + VclPtr<ListBox> mpLbBaseField; + VclPtr<FixedText> mpFtBaseItem; + VclPtr<ListBox> mpLbBaseItem; + VclPtr<OKButton> mpBtnOk; NameMapType maBaseFieldNameMap; // cache for base field display -> original name. NameMapType maBaseItemNameMap; // cache for base item display -> original name. @@ -101,8 +102,9 @@ public: explicit ScDPSubtotalDlg( vcl::Window* pParent, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ); - - sal_uInt16 GetFuncMask() const; + virtual ~ScDPSubtotalDlg(); + virtual void dispose() SAL_OVERRIDE; + sal_uInt16 GetFuncMask() const; void FillLabelData( ScDPLabelData& rLabelData ) const; @@ -114,14 +116,14 @@ private: DECL_LINK( ClickHdl, PushButton* ); private: - RadioButton* mpRbNone; - RadioButton* mpRbAuto; - RadioButton* mpRbUser; - ScDPFunctionListBox* mpLbFunc; - FixedText* mpFtName; - CheckBox* mpCbShowAll; - OKButton* mpBtnOk; - PushButton* mpBtnOptions; + VclPtr<RadioButton> mpRbNone; + VclPtr<RadioButton> mpRbAuto; + VclPtr<RadioButton> mpRbUser; + VclPtr<ScDPFunctionListBox> mpLbFunc; + VclPtr<FixedText> mpFtName; + VclPtr<CheckBox> mpCbShowAll; + VclPtr<OKButton> mpBtnOk; + VclPtr<PushButton> mpBtnOptions; ScDPObject& mrDPObj; /// The DataPilot object (for member names). const ScDPNameVec& mrDataFields; /// The list of all data field names. @@ -136,7 +138,8 @@ public: explicit ScDPSubtotalOptDlg( vcl::Window* pParent, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields, bool bEnableLayout ); - + virtual ~ScDPSubtotalOptDlg(); + virtual void dispose() SAL_OVERRIDE; void FillLabelData( ScDPLabelData& rLabelData ) const; private: @@ -153,25 +156,25 @@ private: DECL_LINK( SelectHdl, ListBox* ); private: - ListBox* m_pLbSortBy; - RadioButton* m_pRbSortAsc; - RadioButton* m_pRbSortDesc; - RadioButton* m_pRbSortMan; - VclContainer* m_pLayoutFrame; - ListBox* m_pLbLayout; - CheckBox* m_pCbLayoutEmpty; - CheckBox* m_pCbRepeatItemLabels; - CheckBox* m_pCbShow; - NumericField* m_pNfShow; - FixedText* m_pFtShow; - FixedText* m_pFtShowFrom; - ListBox* m_pLbShowFrom; - FixedText* m_pFtShowUsing; - ListBox* m_pLbShowUsing; - VclContainer* m_pHideFrame; - SvxCheckListBox* m_pLbHide; - FixedText* m_pFtHierarchy; - ListBox* m_pLbHierarchy; + VclPtr<ListBox> m_pLbSortBy; + VclPtr<RadioButton> m_pRbSortAsc; + VclPtr<RadioButton> m_pRbSortDesc; + VclPtr<RadioButton> m_pRbSortMan; + VclPtr<VclContainer> m_pLayoutFrame; + VclPtr<ListBox> m_pLbLayout; + VclPtr<CheckBox> m_pCbLayoutEmpty; + VclPtr<CheckBox> m_pCbRepeatItemLabels; + VclPtr<CheckBox> m_pCbShow; + VclPtr<NumericField> m_pNfShow; + VclPtr<FixedText> m_pFtShow; + VclPtr<FixedText> m_pFtShowFrom; + VclPtr<ListBox> m_pLbShowFrom; + VclPtr<FixedText> m_pFtShowUsing; + VclPtr<ListBox> m_pLbShowUsing; + VclPtr<VclContainer> m_pHideFrame; + VclPtr<SvxCheckListBox> m_pLbHide; + VclPtr<FixedText> m_pFtHierarchy; + VclPtr<ListBox> m_pLbHierarchy; boost::scoped_ptr<ScDPListBoxWrapper> m_xLbLayoutWrp; /// Wrapper for direct usage of API constants. boost::scoped_ptr<ScDPListBoxWrapper> m_xLbShowFromWrp; /// Wrapper for direct usage of API constants. @@ -187,7 +190,8 @@ class ScDPShowDetailDlg : public ModalDialog { public: explicit ScDPShowDetailDlg( vcl::Window* pParent, ScDPObject& rDPObj, sal_uInt16 nOrient ); - + virtual ~ScDPShowDetailDlg(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; /** @@ -201,8 +205,8 @@ private: DECL_LINK( DblClickHdl, ListBox* ); private: - ListBox* mpLbDims; - OKButton* mpBtnOk; + VclPtr<ListBox> mpLbDims; + VclPtr<OKButton> mpBtnOk; typedef std::unordered_map<OUString, long, OUStringHash> DimNameIndexMap; DimNameIndexMap maNameIndexMap; diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index 1388bde13b5b..650ac840d8b7 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -173,7 +173,7 @@ class SC_DLLPUBLIC ScValidityRefChildWin : public SfxChildWindow { bool m_bVisibleLock:1; bool m_bFreeWindowLock:1; - vcl::Window * m_pSavedWndParent; + VclPtr<vcl::Window> m_pSavedWndParent; public: ScValidityRefChildWin( vcl::Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* ); SFX_DECL_CHILDWINDOW_WITHID(ScValidityRefChildWin); diff --git a/sc/source/ui/inc/retypepassdlg.hxx b/sc/source/ui/inc/retypepassdlg.hxx index 2763202b0395..8c746c1438f0 100644 --- a/sc/source/ui/inc/retypepassdlg.hxx +++ b/sc/source/ui/inc/retypepassdlg.hxx @@ -46,6 +46,7 @@ public: explicit ScRetypePassDlg(vcl::Window* pParent); virtual ~ScRetypePassDlg(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; @@ -71,12 +72,12 @@ private: void DeleteSheets(); private: - OKButton* mpBtnOk; - FixedText* mpTextDocStatus; - PushButton* mpBtnRetypeDoc; - VclVBox* mpSheetsBox; + VclPtr<OKButton> mpBtnOk; + VclPtr<FixedText> mpTextDocStatus; + VclPtr<PushButton> mpBtnRetypeDoc; + VclPtr<VclVBox> mpSheetsBox; - std::vector<VclHBox*> maSheets; + std::vector<VclPtr<VclHBox>> maSheets; OUString maTextNotProtected; OUString maTextNotPassProtected; @@ -104,6 +105,7 @@ class ScRetypePassInputDlg : public ModalDialog public: explicit ScRetypePassInputDlg(vcl::Window* pParent, ScPassHashProtectable* pProtected); virtual ~ScRetypePassInputDlg(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; @@ -117,17 +119,17 @@ private: void CheckPasswordInput(); private: - OKButton* m_pBtnOk; + VclPtr<OKButton> m_pBtnOk; - RadioButton* m_pBtnRetypePassword; + VclPtr<RadioButton> m_pBtnRetypePassword; - VclContainer* m_pPasswordGrid; - Edit* m_pPassword1Edit; - Edit* m_pPassword2Edit; + VclPtr<VclContainer> m_pPasswordGrid; + VclPtr<Edit> m_pPassword1Edit; + VclPtr<Edit> m_pPassword2Edit; - CheckBox* m_pBtnMatchOldPass; + VclPtr<CheckBox> m_pBtnMatchOldPass; - RadioButton* m_pBtnRemovePassword; + VclPtr<RadioButton> m_pBtnRemovePassword; DECL_LINK( OKHdl, void* ); DECL_LINK( RadioBtnHdl, RadioButton* ); diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx index 2675f3b346a3..96bc48d9add2 100644 --- a/sc/source/ui/inc/scendlg.hxx +++ b/sc/source/ui/inc/scendlg.hxx @@ -31,7 +31,8 @@ class ScNewScenarioDlg : public ModalDialog { public: ScNewScenarioDlg(vcl::Window* pParent, const OUString& rName, bool bEdit = false, bool bSheetProtected = false); - + virtual ~ScNewScenarioDlg(); + virtual void dispose() SAL_OVERRIDE; void SetScenarioData( const OUString& rName, const OUString& rComment, const Color& rColor, sal_uInt16 nFlags ); @@ -39,14 +40,14 @@ public: Color& rColor, sal_uInt16& rFlags ) const; private: - Edit* m_pEdName; - VclMultiLineEdit* m_pEdComment; - CheckBox* m_pCbShowFrame; - ColorListBox* m_pLbColor; - CheckBox* m_pCbTwoWay; - CheckBox* m_pCbCopyAll; - CheckBox* m_pCbProtect; - OKButton* m_pBtnOk; + VclPtr<Edit> m_pEdName; + VclPtr<VclMultiLineEdit> m_pEdComment; + VclPtr<CheckBox> m_pCbShowFrame; + VclPtr<ColorListBox> m_pLbColor; + VclPtr<CheckBox> m_pCbTwoWay; + VclPtr<CheckBox> m_pCbCopyAll; + VclPtr<CheckBox> m_pCbProtect; + VclPtr<OKButton> m_pBtnOk; const OUString aDefScenarioName; bool bIsEdit; diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx index 646e4ef4bf77..c05237a49984 100644 --- a/sc/source/ui/inc/scuiasciiopt.hxx +++ b/sc/source/ui/inc/scuiasciiopt.hxx @@ -32,38 +32,38 @@ class ScImportAsciiDlg : public ModalDialog OUString maPreviewLine[ CSV_PREVIEW_LINES ]; - FixedText* pFtCharSet; + VclPtr<FixedText> pFtCharSet; - SvxTextEncodingBox* pLbCharSet; + VclPtr<SvxTextEncodingBox> pLbCharSet; - FixedText* pFtCustomLang; + VclPtr<FixedText> pFtCustomLang; - SvxLanguageBox* pLbCustomLang; + VclPtr<SvxLanguageBox> pLbCustomLang; - FixedText* pFtRow; - NumericField* pNfRow; + VclPtr<FixedText> pFtRow; + VclPtr<NumericField> pNfRow; - RadioButton* pRbFixed; - RadioButton* pRbSeparated; + VclPtr<RadioButton> pRbFixed; + VclPtr<RadioButton> pRbSeparated; - CheckBox* pCkbTab; - CheckBox* pCkbSemicolon; - CheckBox* pCkbComma; - CheckBox* pCkbSpace; - CheckBox* pCkbOther; - Edit* pEdOther; - CheckBox* pCkbAsOnce; + VclPtr<CheckBox> pCkbTab; + VclPtr<CheckBox> pCkbSemicolon; + VclPtr<CheckBox> pCkbComma; + VclPtr<CheckBox> pCkbSpace; + VclPtr<CheckBox> pCkbOther; + VclPtr<Edit> pEdOther; + VclPtr<CheckBox> pCkbAsOnce; - FixedText* pFtTextSep; - ComboBox* pCbTextSep; + VclPtr<FixedText> pFtTextSep; + VclPtr<ComboBox> pCbTextSep; - CheckBox* pCkbQuotedAsText; - CheckBox* pCkbDetectNumber; + VclPtr<CheckBox> pCkbQuotedAsText; + VclPtr<CheckBox> pCkbDetectNumber; - FixedText* pFtType; - ListBox* pLbType; + VclPtr<FixedText> pFtType; + VclPtr<ListBox> pLbType; - ScCsvTableBox* mpTableBox; + VclPtr<ScCsvTableBox> mpTableBox; OUString aCharSetUser; OUString aColumnUser; @@ -80,6 +80,7 @@ public: vcl::Window* pParent, const OUString& aDatName, SvStream* pInStream, ScImportAsciiCall eCall ); virtual ~ScImportAsciiDlg(); + virtual void dispose() SAL_OVERRIDE; void GetOptions( ScAsciiOptions& rOpt ); void SaveParameters(); diff --git a/sc/source/ui/inc/scuiautofmt.hxx b/sc/source/ui/inc/scuiautofmt.hxx index b0460bb2bbbe..10bfe1f98752 100644 --- a/sc/source/ui/inc/scuiautofmt.hxx +++ b/sc/source/ui/inc/scuiautofmt.hxx @@ -27,24 +27,26 @@ public: ScAutoFormat* pAutoFormat, const ScAutoFormatData* pSelFormatData, ScViewData *pViewData); + virtual ~ScAutoFormatDlg(); + virtual void dispose() SAL_OVERRIDE; sal_uInt16 GetIndex() const { return nIndex; } OUString GetCurrFormatName(); private: - ListBox* m_pLbFormat; - ScAutoFmtPreview* m_pWndPreview; - OKButton* m_pBtnOk; - CancelButton* m_pBtnCancel; - PushButton* m_pBtnAdd; - PushButton* m_pBtnRemove; - PushButton* m_pBtnRename; - CheckBox* m_pBtnNumFormat; - CheckBox* m_pBtnBorder; - CheckBox* m_pBtnFont; - CheckBox* m_pBtnPattern; - CheckBox* m_pBtnAlignment; - CheckBox* m_pBtnAdjust; + VclPtr<ListBox> m_pLbFormat; + VclPtr<ScAutoFmtPreview> m_pWndPreview; + VclPtr<OKButton> m_pBtnOk; + VclPtr<CancelButton> m_pBtnCancel; + VclPtr<PushButton> m_pBtnAdd; + VclPtr<PushButton> m_pBtnRemove; + VclPtr<PushButton> m_pBtnRename; + VclPtr<CheckBox> m_pBtnNumFormat; + VclPtr<CheckBox> m_pBtnBorder; + VclPtr<CheckBox> m_pBtnFont; + VclPtr<CheckBox> m_pBtnPattern; + VclPtr<CheckBox> m_pBtnAlignment; + VclPtr<CheckBox> m_pBtnAdjust; OUString aStrTitle; OUString aStrLabel; OUString aStrClose; diff --git a/sc/source/ui/inc/scuiimoptdlg.hxx b/sc/source/ui/inc/scuiimoptdlg.hxx index adb8f2032725..348d27878dae 100644 --- a/sc/source/ui/inc/scuiimoptdlg.hxx +++ b/sc/source/ui/inc/scuiimoptdlg.hxx @@ -37,22 +37,23 @@ public: bool bImport = true ); virtual ~ScImportOptionsDlg(); + virtual void dispose() SAL_OVERRIDE; void GetImportOptions( ScImportOptions& rOptions ) const; private: - VclFrame* m_pFieldFrame; - FixedText* m_pFtCharset; - SvxTextEncodingBox* m_pLbCharset; - FixedText* m_pFtFieldSep; - ComboBox* m_pEdFieldSep; - FixedText* m_pFtTextSep; - ComboBox* m_pEdTextSep; - CheckBox* m_pCbShown; - CheckBox* m_pCbFormulas; - CheckBox* m_pCbQuoteAll; - CheckBox* m_pCbFixed; - OKButton* m_pBtnOk; + VclPtr<VclFrame> m_pFieldFrame; + VclPtr<FixedText> m_pFtCharset; + VclPtr<SvxTextEncodingBox> m_pLbCharset; + VclPtr<FixedText> m_pFtFieldSep; + VclPtr<ComboBox> m_pEdFieldSep; + VclPtr<FixedText> m_pFtTextSep; + VclPtr<ComboBox> m_pEdTextSep; + VclPtr<CheckBox> m_pCbShown; + VclPtr<CheckBox> m_pCbFormulas; + VclPtr<CheckBox> m_pCbQuoteAll; + VclPtr<CheckBox> m_pCbFixed; + VclPtr<OKButton> m_pBtnOk; ScDelimiterTable* pFieldSepTab; ScDelimiterTable* pTextSepTab; diff --git a/sc/source/ui/inc/scuitphfedit.hxx b/sc/source/ui/inc/scuitphfedit.hxx index b2d133c2cdb8..a5f25ec50955 100644 --- a/sc/source/ui/inc/scuitphfedit.hxx +++ b/sc/source/ui/inc/scuitphfedit.hxx @@ -57,29 +57,30 @@ protected: sal_uInt16 nWhich, bool bHeader ); virtual ~ScHFEditPage(); + virtual void dispose() SAL_OVERRIDE; private: - ScEditWindow* m_pWndLeft; - ScEditWindow* m_pWndCenter; - ScEditWindow* m_pWndRight; - FixedText* m_pFtDefinedHF; - ListBox* m_pLbDefined; - FixedText* m_pFtCustomHF; - PushButton* m_pBtnText; - ScExtIButton* m_pBtnFile; - PushButton* m_pBtnTable; - PushButton* m_pBtnPage; - PushButton* m_pBtnLastPage; - PushButton* m_pBtnDate; - PushButton* m_pBtnTime; - - FixedText* m_pFtConfidential; - FixedText* m_pFtPage; - FixedText* m_pFtOfQuestion; - FixedText* m_pFtOf; - FixedText* m_pFtNone; - FixedText* m_pFtCreatedBy; - FixedText* m_pFtCustomized; + VclPtr<ScEditWindow> m_pWndLeft; + VclPtr<ScEditWindow> m_pWndCenter; + VclPtr<ScEditWindow> m_pWndRight; + VclPtr<FixedText> m_pFtDefinedHF; + VclPtr<ListBox> m_pLbDefined; + VclPtr<FixedText> m_pFtCustomHF; + VclPtr<PushButton> m_pBtnText; + VclPtr<ScExtIButton> m_pBtnFile; + VclPtr<PushButton> m_pBtnTable; + VclPtr<PushButton> m_pBtnPage; + VclPtr<PushButton> m_pBtnLastPage; + VclPtr<PushButton> m_pBtnDate; + VclPtr<PushButton> m_pBtnTime; + + VclPtr<FixedText> m_pFtConfidential; + VclPtr<FixedText> m_pFtPage; + VclPtr<FixedText> m_pFtOfQuestion; + VclPtr<FixedText> m_pFtOf; + VclPtr<FixedText> m_pFtNone; + VclPtr<FixedText> m_pFtCreatedBy; + VclPtr<FixedText> m_pFtCustomized; sal_uInt16 nWhich; OUString aCmdArr[6]; @@ -104,7 +105,7 @@ private: class ScRightHeaderEditPage : public ScHFEditPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); private: ScRightHeaderEditPage( vcl::Window* pParent, const SfxItemSet& rSet ); @@ -113,7 +114,7 @@ private: class ScLeftHeaderEditPage : public ScHFEditPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); private: ScLeftHeaderEditPage( vcl::Window* pParent, const SfxItemSet& rSet ); @@ -122,7 +123,7 @@ private: class ScRightFooterEditPage : public ScHFEditPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); private: ScRightFooterEditPage( vcl::Window* pParent, const SfxItemSet& rSet ); @@ -131,7 +132,7 @@ private: class ScLeftFooterEditPage : public ScHFEditPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); private: ScLeftFooterEditPage( vcl::Window* pParent, const SfxItemSet& rSet ); diff --git a/sc/source/ui/inc/searchresults.hxx b/sc/source/ui/inc/searchresults.hxx index 437d90a3adc8..22af42940f1c 100644 --- a/sc/source/ui/inc/searchresults.hxx +++ b/sc/source/ui/inc/searchresults.hxx @@ -21,7 +21,7 @@ namespace sc { class SearchResultsDlg : public ModelessDialog { - SvSimpleTable *mpList; + VclPtr<SvSimpleTable> mpList; SfxBindings* mpBindings; ScDocument* mpDoc; @@ -29,6 +29,7 @@ class SearchResultsDlg : public ModelessDialog public: SearchResultsDlg( SfxBindings* _pBindings, vcl::Window* pParent, sal_uInt16 nId ); virtual ~SearchResultsDlg(); + virtual void dispose() SAL_OVERRIDE; void FillResults( ScDocument* pDoc, const ScRangeList& rMatchedRanges ); diff --git a/sc/source/ui/inc/sharedocdlg.hxx b/sc/source/ui/inc/sharedocdlg.hxx index f8d746fd4cc9..41f53111b40a 100644 --- a/sc/source/ui/inc/sharedocdlg.hxx +++ b/sc/source/ui/inc/sharedocdlg.hxx @@ -33,9 +33,9 @@ class ScDocShell; class ScShareDocumentDlg : public ModalDialog { private: - CheckBox* m_pCbShare; - FixedText* m_pFtWarning; - SvSimpleTable* m_pLbUsers; + VclPtr<CheckBox> m_pCbShare; + VclPtr<FixedText> m_pFtWarning; + VclPtr<SvSimpleTable> m_pLbUsers; OUString m_aStrNoUserData; OUString m_aStrUnknownUser; @@ -49,6 +49,7 @@ private: public: ScShareDocumentDlg( vcl::Window* pParent, ScViewData* pViewData ); virtual ~ScShareDocumentDlg(); + virtual void dispose() SAL_OVERRIDE; bool IsShareDocumentChecked() const; void UpdateView(); diff --git a/sc/source/ui/inc/shtabdlg.hxx b/sc/source/ui/inc/shtabdlg.hxx index 6c55a64d51f7..d0109a2735d4 100644 --- a/sc/source/ui/inc/shtabdlg.hxx +++ b/sc/source/ui/inc/shtabdlg.hxx @@ -28,13 +28,15 @@ class ScShowTabDlg : public ModalDialog { private: - VclFrame* m_pFrame; - ListBox* m_pLb; + VclPtr<VclFrame> m_pFrame; + VclPtr<ListBox> m_pLb; DECL_LINK( DblClkHdl, void * ); public: ScShowTabDlg( vcl::Window* pParent ); + virtual ~ScShowTabDlg(); + virtual void dispose() SAL_OVERRIDE; /** Sets dialog title, fixed text for listbox and help IDs. */ void SetDescription( diff --git a/sc/source/ui/inc/simpref.hxx b/sc/source/ui/inc/simpref.hxx index a78a9e13ed5a..9a4d66c3a173 100644 --- a/sc/source/ui/inc/simpref.hxx +++ b/sc/source/ui/inc/simpref.hxx @@ -40,12 +40,12 @@ private: Link aAbortedHdl; Link aChangeHdl; - FixedText* m_pFtAssign; - formula::RefEdit* m_pEdAssign; - formula::RefButton* m_pRbAssign; + VclPtr<FixedText> m_pFtAssign; + VclPtr<formula::RefEdit> m_pEdAssign; + VclPtr<formula::RefButton> m_pRbAssign; - OKButton* m_pBtnOk; - CancelButton* m_pBtnCancel; + VclPtr<OKButton> m_pBtnOk; + VclPtr<CancelButton> m_pBtnCancel; ScRange theCurArea; bool bCloseFlag; @@ -66,6 +66,7 @@ protected: public: ScSimpleRefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent); virtual ~ScSimpleRefDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/sizedev.hxx b/sc/source/ui/inc/sizedev.hxx index 770279f0b2ca..95bfac3a44e0 100644 --- a/sc/source/ui/inc/sizedev.hxx +++ b/sc/source/ui/inc/sizedev.hxx @@ -27,17 +27,17 @@ class ScDocShell; class ScSizeDeviceProvider { - OutputDevice* pDevice; - bool bOwner; - double nPPTX; - double nPPTY; - MapMode aOldMapMode; + VclPtr<OutputDevice> pDevice; + bool bOwner; + double nPPTX; + double nPPTY; + MapMode aOldMapMode; public: ScSizeDeviceProvider( ScDocShell* pDocSh ); ~ScSizeDeviceProvider(); - OutputDevice* GetDevice() const { return pDevice; } + OutputDevice* GetDevice() const { return pDevice.get(); } double GetPPTX() const { return nPPTX; } double GetPPTY() const { return nPPTY; } bool IsPrinter() const { return !bOwner; } diff --git a/sc/source/ui/inc/solveroptions.hxx b/sc/source/ui/inc/solveroptions.hxx index eb03c6e61e5f..28e557e08b3f 100644 --- a/sc/source/ui/inc/solveroptions.hxx +++ b/sc/source/ui/inc/solveroptions.hxx @@ -35,9 +35,9 @@ namespace com { namespace sun { namespace star { class ScSolverOptionsDialog : public ModalDialog { - ListBox* m_pLbEngine; - SvxCheckListBox* m_pLbSettings; - PushButton* m_pBtnEdit; + VclPtr<ListBox> m_pLbEngine; + VclPtr<SvxCheckListBox> m_pLbSettings; + VclPtr<PushButton> m_pBtnEdit; SvLBoxButtonData* mpCheckButtonData; com::sun::star::uno::Sequence<OUString> maImplNames; @@ -61,6 +61,7 @@ public: const OUString& rEngine, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProperties ); virtual ~ScSolverOptionsDialog(); + virtual void dispose() SAL_OVERRIDE; // already updated in selection handler const OUString& GetEngine() const { return maEngine; } @@ -69,11 +70,13 @@ public: class ScSolverIntegerDialog : public ModalDialog { - VclFrame* m_pFrame; - NumericField* m_pNfValue; + VclPtr<VclFrame> m_pFrame; + VclPtr<NumericField> m_pNfValue; public: ScSolverIntegerDialog( vcl::Window * pParent ); + virtual ~ScSolverIntegerDialog(); + virtual void dispose() SAL_OVERRIDE; void SetOptionName( const OUString& rName ); void SetValue( sal_Int32 nValue ); @@ -82,11 +85,13 @@ public: class ScSolverValueDialog : public ModalDialog { - VclFrame* m_pFrame; - Edit* m_pEdValue; + VclPtr<VclFrame> m_pFrame; + VclPtr<Edit> m_pEdValue; public: ScSolverValueDialog( vcl::Window * pParent ); + virtual ~ScSolverValueDialog(); + virtual void dispose() SAL_OVERRIDE; void SetOptionName( const OUString& rName ); void SetValue( double fValue ); diff --git a/sc/source/ui/inc/solvrdlg.hxx b/sc/source/ui/inc/solvrdlg.hxx index 2799c58975a8..253067a20d95 100644 --- a/sc/source/ui/inc/solvrdlg.hxx +++ b/sc/source/ui/inc/solvrdlg.hxx @@ -42,6 +42,7 @@ public: ScDocument* pDocument, ScAddress aCursorPos ); virtual ~ScSolverDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual bool IsRefInputMode() const SAL_OVERRIDE; @@ -49,18 +50,18 @@ public: virtual bool Close() SAL_OVERRIDE; private: - FixedText* m_pFtFormulaCell; - formula::RefEdit* m_pEdFormulaCell; - formula::RefButton* m_pRBFormulaCell; + VclPtr<FixedText> m_pFtFormulaCell; + VclPtr<formula::RefEdit> m_pEdFormulaCell; + VclPtr<formula::RefButton> m_pRBFormulaCell; - Edit* m_pEdTargetVal; + VclPtr<Edit> m_pEdTargetVal; - FixedText* m_pFtVariableCell; - formula::RefEdit* m_pEdVariableCell; - formula::RefButton* m_pRBVariableCell; + VclPtr<FixedText> m_pFtVariableCell; + VclPtr<formula::RefEdit> m_pEdVariableCell; + VclPtr<formula::RefButton> m_pRBVariableCell; - OKButton* m_pBtnOk; - CancelButton* m_pBtnCancel; + VclPtr<OKButton> m_pBtnOk; + VclPtr<CancelButton> m_pBtnCancel; ScAddress theFormulaCell; ScAddress theVariableCell; @@ -68,7 +69,7 @@ private: ScDocument* pDoc; const SCTAB nCurTab; - formula::RefEdit* pEdActive; + VclPtr<formula::RefEdit> pEdActive; bool bDlgLostFocus; const OUString errMsgInvalidVar; const OUString errMsgInvalidForm; diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx index d627f02623bb..c514aaffd8e9 100644 --- a/sc/source/ui/inc/sortdlg.hxx +++ b/sc/source/ui/inc/sortdlg.hxx @@ -45,11 +45,13 @@ class ScSortWarningDlg : public ModalDialog { public: ScSortWarningDlg( vcl::Window* pParent, const OUString& rExtendText,const OUString& rCurrentText ); + virtual ~ScSortWarningDlg(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK( BtnHdl, PushButton* ); private: - FixedText* aFtText; - PushButton* aBtnExtSort; - PushButton* aBtnCurSort; + VclPtr<FixedText> aFtText; + VclPtr<PushButton> aBtnExtSort; + VclPtr<PushButton> aBtnCurSort; }; #endif // INCLUDED_SC_SOURCE_UI_INC_SORTDLG_HXX diff --git a/sc/source/ui/inc/sortkeydlg.hxx b/sc/source/ui/inc/sortkeydlg.hxx index 5c9c1fa833bc..a0a027c0f81d 100644 --- a/sc/source/ui/inc/sortkeydlg.hxx +++ b/sc/source/ui/inc/sortkeydlg.hxx @@ -25,11 +25,11 @@ struct ScSortKeyItem : public VclBuilderContainer { - VclFrame* m_pFrame; - FixedText* m_pFlSort; - ListBox* m_pLbSort; - RadioButton* m_pBtnUp; - RadioButton* m_pBtnDown; + VclPtr<VclFrame> m_pFrame; + VclPtr<FixedText> m_pFlSort; + VclPtr<ListBox> m_pLbSort; + VclPtr<RadioButton> m_pBtnUp; + VclPtr<RadioButton> m_pBtnDown; ScSortKeyItem(vcl::Window* pParent); @@ -44,7 +44,7 @@ typedef boost::ptr_vector<ScSortKeyItem> ScSortKeyItems; class ScSortKeyWindow { private: - VclBox* m_pBox; + VclPtr<VclBox> m_pBox; sal_Int32 nItemHeight; ScSortKeyItems& mrSortKeyItems; diff --git a/sc/source/ui/inc/strindlg.hxx b/sc/source/ui/inc/strindlg.hxx index 367d32d8811e..1863869203fb 100644 --- a/sc/source/ui/inc/strindlg.hxx +++ b/sc/source/ui/inc/strindlg.hxx @@ -32,15 +32,16 @@ public: const OUString& rEditTitle, const OUString& rDefault, const OString& sHelpId, const OString& sEditHelpId); - + virtual ~ScStringInputDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetInputString() const { return m_pEdInput->GetText(); } private: - FixedText* m_pFtEditTitle; - Edit* m_pEdInput; + VclPtr<FixedText> m_pFtEditTitle; + VclPtr<Edit> m_pEdInput; }; #endif // INCLUDED_SC_SOURCE_UI_INC_STRINDLG_HXX diff --git a/sc/source/ui/inc/subtdlg.hxx b/sc/source/ui/inc/subtdlg.hxx index 6496689d3a75..749e9d94dfcb 100644 --- a/sc/source/ui/inc/subtdlg.hxx +++ b/sc/source/ui/inc/subtdlg.hxx @@ -28,8 +28,10 @@ class ScSubTotalDlg : public SfxTabDialog { public: ScSubTotalDlg(vcl::Window* pParent, const SfxItemSet* pArgSet); + virtual ~ScSubTotalDlg(); + virtual void dispose() SAL_OVERRIDE; private: - PushButton* m_pBtnRemove; + VclPtr<PushButton> m_pBtnRemove; DECL_LINK( RemoveHdl, PushButton * ); }; diff --git a/sc/source/ui/inc/tabbgcolordlg.hxx b/sc/source/ui/inc/tabbgcolordlg.hxx index 40dcca180920..122f112c068b 100644 --- a/sc/source/ui/inc/tabbgcolordlg.hxx +++ b/sc/source/ui/inc/tabbgcolordlg.hxx @@ -33,6 +33,8 @@ public: const OUString& rTabBgColorNoColorText, const Color& rDefaultColor, const OString& nHelpId ); + virtual ~ScTabBgColorDlg(); + virtual void dispose() SAL_OVERRIDE; void GetSelectedColor( Color& rColor ) const; @@ -40,6 +42,9 @@ public: { public: ScTabBgColorValueSet(vcl::Window* pParent, WinBits nStyle); + virtual ~ScTabBgColorValueSet(); + virtual void dispose() SAL_OVERRIDE; + void SetDialog(ScTabBgColorDlg* pTabBgColorDlg) { m_pTabBgColorDlg = pTabBgColorDlg; @@ -47,12 +52,12 @@ public: virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; private: - ScTabBgColorDlg* m_pTabBgColorDlg; + VclPtr<ScTabBgColorDlg> m_pTabBgColorDlg; }; private: - ScTabBgColorValueSet* m_pTabBgColorSet; - OKButton* m_pBtnOk; + VclPtr<ScTabBgColorValueSet> m_pTabBgColorSet; + VclPtr<OKButton> m_pBtnOk; Color m_aTabBgColor; const OUString m_aTabBgColorNoColorText; diff --git a/sc/source/ui/inc/tabopdlg.hxx b/sc/source/ui/inc/tabopdlg.hxx index a1806c1153c9..33c247f7cfcd 100644 --- a/sc/source/ui/inc/tabopdlg.hxx +++ b/sc/source/ui/inc/tabopdlg.hxx @@ -44,6 +44,7 @@ public: ScDocument* pDocument, const ScRefAddress& rCursorPos ); virtual ~ScTabOpDlg(); + virtual void dispose() SAL_OVERRIDE; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE; virtual bool IsRefInputMode() const SAL_OVERRIDE { return true; } @@ -52,20 +53,20 @@ public: virtual bool Close() SAL_OVERRIDE; private: - FixedText* m_pFtFormulaRange; - formula::RefEdit* m_pEdFormulaRange; - formula::RefButton* m_pRBFormulaRange; + VclPtr<FixedText> m_pFtFormulaRange; + VclPtr<formula::RefEdit> m_pEdFormulaRange; + VclPtr<formula::RefButton> m_pRBFormulaRange; - FixedText* m_pFtRowCell; - formula::RefEdit* m_pEdRowCell; - formula::RefButton* m_pRBRowCell; + VclPtr<FixedText> m_pFtRowCell; + VclPtr<formula::RefEdit> m_pEdRowCell; + VclPtr<formula::RefButton> m_pRBRowCell; - FixedText* m_pFtColCell; - formula::RefEdit* m_pEdColCell; - formula::RefButton* m_pRBColCell; + VclPtr<FixedText> m_pFtColCell; + VclPtr<formula::RefEdit> m_pEdColCell; + VclPtr<formula::RefButton> m_pRBColCell; - OKButton* m_pBtnOk; - CancelButton* m_pBtnCancel; + VclPtr<OKButton> m_pBtnOk; + VclPtr<CancelButton> m_pBtnCancel; ScRefAddress theFormulaCell; ScRefAddress theFormulaEnd; @@ -74,7 +75,7 @@ private: ScDocument* pDoc; const SCTAB nCurTab; - formula::RefEdit* pEdActive; + VclPtr<formula::RefEdit> pEdActive; bool bDlgLostFocus; const OUString errMsgNoFormula; const OUString errMsgNoColRow; diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx index 69f12bd23592..c2f9c38d1e66 100644 --- a/sc/source/ui/inc/tabpages.hxx +++ b/sc/source/ui/inc/tabpages.hxx @@ -28,12 +28,15 @@ class ScTabPageProtection : public SfxTabPage { static const sal_uInt16 pProtectionRanges[]; public: - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rAttrSet ); static const sal_uInt16* GetRanges () { return pProtectionRanges; } virtual bool FillItemSet ( SfxItemSet* rCoreAttrs ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* ) SAL_OVERRIDE; + virtual ~ScTabPageProtection(); + virtual void dispose() SAL_OVERRIDE; + protected: using SfxTabPage::DeactivatePage; virtual sfxpg DeactivatePage ( SfxItemSet* pSet = NULL ) SAL_OVERRIDE; @@ -42,10 +45,10 @@ private: ScTabPageProtection( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ); private: - TriStateBox* m_pBtnHideCell; - TriStateBox* m_pBtnProtect; - TriStateBox* m_pBtnHideFormula; - TriStateBox* m_pBtnHidePrint; + VclPtr<TriStateBox> m_pBtnHideCell; + VclPtr<TriStateBox> m_pBtnProtect; + VclPtr<TriStateBox> m_pBtnHideFormula; + VclPtr<TriStateBox> m_pBtnHidePrint; // current status: bool bTriEnabled; // if before - DontCare bool bDontCare; // all in TriState diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index ddb45e281de8..bb06d01fe813 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -85,7 +85,7 @@ class ScTabView : boost::noncopyable private: enum BlockMode { None = 0, Normal = 1, Own = 2 }; - vcl::Window* pFrameWin; // First !!! + VclPtr<vcl::Window> pFrameWin; // First !!! ScViewData aViewData; // must be at the front ! ScViewSelectionEngine* pSelEngine; @@ -102,23 +102,23 @@ private: FuPoor* pDrawActual; FuPoor* pDrawOld; - ScGridWindow* pGridWin[4]; - ScColBar* pColBar[2]; - ScRowBar* pRowBar[2]; - ScOutlineWindow* pColOutline[2]; - ScOutlineWindow* pRowOutline[2]; - ScTabSplitter* pHSplitter; - ScTabSplitter* pVSplitter; - ScTabControl* pTabControl; - ScrollBar aVScrollTop; - ScrollBar aVScrollBottom; // initially visible - ScrollBar aHScrollLeft; // initially visible - ScrollBar aHScrollRight; - ScCornerButton aCornerButton; - ScCornerButton aTopButton; - ScrollBarBox aScrollBarBox; - - boost::scoped_ptr<ScHintWindow> mpInputHintWindow; // popup window for data validation + VclPtr<ScGridWindow> pGridWin[4]; + VclPtr<ScColBar> pColBar[2]; + VclPtr<ScRowBar> pRowBar[2]; + VclPtr<ScOutlineWindow> pColOutline[2]; + VclPtr<ScOutlineWindow> pRowOutline[2]; + VclPtr<ScTabSplitter> pHSplitter; + VclPtr<ScTabSplitter> pVSplitter; + VclPtr<ScTabControl> pTabControl; + VclPtr<ScrollBar> aVScrollTop; + VclPtr<ScrollBar> aVScrollBottom; // initially visible + VclPtr<ScrollBar> aHScrollLeft; // initially visible + VclPtr<ScrollBar> aHScrollRight; + VclPtr<ScCornerButton> aCornerButton; + VclPtr<ScCornerButton> aTopButton; + VclPtr<ScrollBarBox> aScrollBarBox; + + VclPtr<ScHintWindow> mpInputHintWindow; // popup window for data validation ScPageBreakData* pPageBreakData; std::vector<ScHighlightEntry> maHighlightRanges; @@ -127,7 +127,7 @@ private: SfxItemSet* pDrawBrushSet; // drawing object attributes for paint brush Timer aScrollTimer; - ScGridWindow* pTimerWindow; + VclPtr<ScGridWindow> pTimerWindow; MouseEvent aTimerMEvt; sal_uLong nTipVisible; diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 06476e3fe8d2..c06fdf2a44d9 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -348,7 +348,7 @@ public: SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false ) SAL_OVERRIDE; virtual bool HasPrintOptionsPage() const SAL_OVERRIDE; - virtual SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) SAL_OVERRIDE; + virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) SAL_OVERRIDE; void ConnectObject( SdrOle2Obj* pObj ); bool ActivateObject( SdrOle2Obj* pObj, long nVerb ); diff --git a/sc/source/ui/inc/tbinsert.hxx b/sc/source/ui/inc/tbinsert.hxx index d8880ad4716f..dda701868ab2 100644 --- a/sc/source/ui/inc/tbinsert.hxx +++ b/sc/source/ui/inc/tbinsert.hxx @@ -36,7 +36,7 @@ public: virtual ~ScTbxInsertCtrl(); virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx index d2c6cbccaaaf..0768db7dba2f 100644 --- a/sc/source/ui/inc/tbzoomsliderctrl.hxx +++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx @@ -34,7 +34,7 @@ public: virtual ~ScZoomSliderControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; class ScZoomSliderWnd: public vcl::Window @@ -54,6 +54,7 @@ public: ScZoomSliderWnd( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , sal_uInt16 nCurrentZoom ); virtual ~ScZoomSliderWnd(); + virtual void dispose() SAL_OVERRIDE; void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem ); protected: diff --git a/sc/source/ui/inc/textimportoptions.hxx b/sc/source/ui/inc/textimportoptions.hxx index b944ce19a8d3..d7c8a5dec970 100644 --- a/sc/source/ui/inc/textimportoptions.hxx +++ b/sc/source/ui/inc/textimportoptions.hxx @@ -31,7 +31,7 @@ class ScTextImportOptionsDlg : public ModalDialog public: ScTextImportOptionsDlg(vcl::Window* pParent); virtual ~ScTextImportOptionsDlg(); - + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; LanguageType getLanguageType() const; @@ -41,14 +41,14 @@ private: void init(); private: - OKButton* m_pBtnOk; + VclPtr<OKButton> m_pBtnOk; - RadioButton* m_pRbAutomatic; - RadioButton* m_pRbCustom; + VclPtr<RadioButton> m_pRbAutomatic; + VclPtr<RadioButton> m_pRbCustom; - SvxLanguageBox* m_pLbCustomLang; + VclPtr<SvxLanguageBox> m_pLbCustomLang; - CheckBox* m_pBtnConvertDate; + VclPtr<CheckBox> m_pBtnConvertDate; DECL_LINK(OKHdl, void *); diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx index 034e49f22e1c..25bd390fed20 100644 --- a/sc/source/ui/inc/tpcalc.hxx +++ b/sc/source/ui/inc/tpcalc.hxx @@ -32,7 +32,7 @@ class ScDocOptions; class ScTpCalcOptions : public SfxTabPage { public: - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rCoreSet ); virtual bool FillItemSet ( SfxItemSet* rCoreSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rCoreSet ) SAL_OVERRIDE; @@ -43,27 +43,28 @@ private: ScTpCalcOptions( vcl::Window* pParent, const SfxItemSet& rCoreSet ); virtual ~ScTpCalcOptions(); + virtual void dispose() SAL_OVERRIDE; private: - CheckBox* m_pBtnIterate; - FixedText* m_pFtSteps; - NumericField* m_pEdSteps; - FixedText* m_pFtEps; - ScDoubleField* m_pEdEps; + VclPtr<CheckBox> m_pBtnIterate; + VclPtr<FixedText> m_pFtSteps; + VclPtr<NumericField> m_pEdSteps; + VclPtr<FixedText> m_pFtEps; + VclPtr<ScDoubleField> m_pEdEps; - RadioButton* m_pBtnDateStd; - RadioButton* m_pBtnDateSc10; - RadioButton* m_pBtnDate1904; + VclPtr<RadioButton> m_pBtnDateStd; + VclPtr<RadioButton> m_pBtnDateSc10; + VclPtr<RadioButton> m_pBtnDate1904; - CheckBox* m_pBtnCase; - CheckBox* m_pBtnCalc; - CheckBox* m_pBtnMatch; - CheckBox* m_pBtnRegex; - CheckBox* m_pBtnLookUp; - CheckBox* m_pBtnGeneralPrec; + VclPtr<CheckBox> m_pBtnCase; + VclPtr<CheckBox> m_pBtnCalc; + VclPtr<CheckBox> m_pBtnMatch; + VclPtr<CheckBox> m_pBtnRegex; + VclPtr<CheckBox> m_pBtnLookUp; + VclPtr<CheckBox> m_pBtnGeneralPrec; - FixedText* m_pFtPrec; - NumericField* m_pEdPrec; + VclPtr<FixedText> m_pFtPrec; + VclPtr<NumericField> m_pEdPrec; ScDocOptions* pOldOptions; ScDocOptions* pLocalOptions; diff --git a/sc/source/ui/inc/tpcompatibility.hxx b/sc/source/ui/inc/tpcompatibility.hxx index 5ab6e547ee26..550bd9b0836c 100644 --- a/sc/source/ui/inc/tpcompatibility.hxx +++ b/sc/source/ui/inc/tpcompatibility.hxx @@ -19,18 +19,18 @@ class ScTpCompatOptions : public SfxTabPage public: using SfxTabPage::DeactivatePage; - static SfxTabPage* Create (vcl::Window* pParent, const SfxItemSet* rCoreAttrs); + static VclPtr<SfxTabPage> Create (vcl::Window* pParent, const SfxItemSet* rCoreAttrs); virtual bool FillItemSet(SfxItemSet* rCoreAttrs) SAL_OVERRIDE; virtual void Reset(const SfxItemSet* rCoreAttrs) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = NULL) SAL_OVERRIDE; + virtual ~ScTpCompatOptions(); + virtual void dispose() SAL_OVERRIDE; private: explicit ScTpCompatOptions(vcl::Window* pParent, const SfxItemSet& rCoreAttrs); - virtual ~ScTpCompatOptions(); - private: - ListBox* m_pLbKeyBindings; + VclPtr<ListBox> m_pLbKeyBindings; }; #endif diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx index 6580efd1e582..429cbabde87f 100644 --- a/sc/source/ui/inc/tpdefaults.hxx +++ b/sc/source/ui/inc/tpdefaults.hxx @@ -19,7 +19,7 @@ class ScTpDefaultsOptions : public SfxTabPage public: using SfxTabPage::DeactivatePage; - static SfxTabPage* Create (vcl::Window* pParent, const SfxItemSet* rCoreSet); + static VclPtr<SfxTabPage> Create (vcl::Window* pParent, const SfxItemSet* rCoreSet); virtual bool FillItemSet(SfxItemSet* rCoreSet) SAL_OVERRIDE; virtual void Reset(const SfxItemSet* rCoreSet) SAL_OVERRIDE; @@ -28,6 +28,7 @@ public: private: explicit ScTpDefaultsOptions(vcl::Window* pParent, const SfxItemSet& rCoreSet); virtual ~ScTpDefaultsOptions(); + virtual void dispose() SAL_OVERRIDE; void CheckNumSheets(); void CheckPrefix(Edit* pEdit); @@ -38,8 +39,8 @@ private: DECL_LINK( PrefixEditOnFocusHdl, Edit* ); private: - NumericField* m_pEdNSheets; - Edit* m_pEdSheetPrefix; + VclPtr<NumericField> m_pEdNSheets; + VclPtr<Edit> m_pEdSheetPrefix; // Stores old Sheet Prefix OUString maOldPrefixValue; diff --git a/sc/source/ui/inc/tpformula.hxx b/sc/source/ui/inc/tpformula.hxx index cf901f130d4e..7397d062d31d 100644 --- a/sc/source/ui/inc/tpformula.hxx +++ b/sc/source/ui/inc/tpformula.hxx @@ -33,7 +33,7 @@ class ScTpFormulaOptions : public SfxTabPage public: using SfxTabPage::DeactivatePage; - static SfxTabPage* Create (vcl::Window* pParent, const SfxItemSet* rCoreSet); + static VclPtr<SfxTabPage> Create (vcl::Window* pParent, const SfxItemSet* rCoreSet); virtual bool FillItemSet(SfxItemSet* rCoreSet) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rCoreSet ) SAL_OVERRIDE; @@ -42,7 +42,7 @@ public: private: explicit ScTpFormulaOptions(vcl::Window* pParent, const SfxItemSet& rCoreSet); virtual ~ScTpFormulaOptions(); - + virtual void dispose() SAL_OVERRIDE; void ResetSeparators(); void OnFocusSeparatorInput(Edit* pEdit); void UpdateCustomCalcRadioButtons(bool bDefault); @@ -56,20 +56,20 @@ private: DECL_LINK( SepEditOnFocusHdl, Edit* ); private: - ListBox* mpLbFormulaSyntax; - CheckBox* mpCbEnglishFuncName; + VclPtr<ListBox> mpLbFormulaSyntax; + VclPtr<CheckBox> mpCbEnglishFuncName; - RadioButton* mpBtnCustomCalcDefault; - RadioButton* mpBtnCustomCalcCustom; - PushButton* mpBtnCustomCalcDetails; + VclPtr<RadioButton> mpBtnCustomCalcDefault; + VclPtr<RadioButton> mpBtnCustomCalcCustom; + VclPtr<PushButton> mpBtnCustomCalcDetails; - Edit* mpEdSepFuncArg; - Edit* mpEdSepArrayCol; - Edit* mpEdSepArrayRow; - PushButton* mpBtnSepReset; + VclPtr<Edit> mpEdSepFuncArg; + VclPtr<Edit> mpEdSepArrayCol; + VclPtr<Edit> mpEdSepArrayRow; + VclPtr<PushButton> mpBtnSepReset; - ListBox* mpLbOOXMLRecalcOptions; - ListBox* mpLbODFRecalcOptions; + VclPtr<ListBox> mpLbOOXMLRecalcOptions; + VclPtr<ListBox> mpLbODFRecalcOptions; /** Stores old separator value of currently focused separator edit box. This value is used to revert undesired value change. */ diff --git a/sc/source/ui/inc/tphf.hxx b/sc/source/ui/inc/tphf.hxx index c16d69b535de..da972cbd44a9 100644 --- a/sc/source/ui/inc/tphf.hxx +++ b/sc/source/ui/inc/tphf.hxx @@ -28,12 +28,13 @@ class ScHFPage : public SvxHFPage { public: virtual ~ScHFPage(); + virtual void dispose() SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; virtual bool FillItemSet( SfxItemSet* rOutSet ) SAL_OVERRIDE; void SetPageStyle( const OUString& rName ) { aStrPageStyle = rName; } - void SetStyleDlg ( const ScStyleDlg* pDlg ) { pStyleDlg = pDlg; } + void SetStyleDlg ( ScStyleDlg* pDlg ) { pStyleDlg = pDlg; } protected: ScHFPage( vcl::Window* pParent, @@ -46,11 +47,11 @@ protected: virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE; private: - PushButton* m_pBtnEdit; - SfxItemSet aDataSet; - OUString aStrPageStyle; - sal_uInt16 nPageUsage; - const ScStyleDlg* pStyleDlg; + VclPtr<PushButton> m_pBtnEdit; + SfxItemSet aDataSet; + OUString aStrPageStyle; + sal_uInt16 nPageUsage; + VclPtr<ScStyleDlg> pStyleDlg; DECL_LINK(BtnHdl, void *); DECL_LINK( HFEditHdl, void* ); @@ -60,7 +61,7 @@ private: class ScHeaderPage : public ScHFPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges(); private: @@ -70,7 +71,7 @@ private: class ScFooterPage : public ScHFPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges(); private: diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx index f6c218162537..8a392d1a5b3a 100644 --- a/sc/source/ui/inc/tphfedit.hxx +++ b/sc/source/ui/inc/tphfedit.hxx @@ -55,6 +55,7 @@ class SC_DLLPUBLIC ScEditWindow : public Control public: ScEditWindow( vcl::Window* pParent, WinBits nBits , ScEditWindowLocation eLoc ); virtual ~ScEditWindow(); + virtual void dispose() SAL_OVERRIDE; using Control::SetFont; void SetFont( const ScPatternAttr& rPattern ); diff --git a/sc/source/ui/inc/tpprint.hxx b/sc/source/ui/inc/tpprint.hxx index f40137682c75..5b8370f13267 100644 --- a/sc/source/ui/inc/tpprint.hxx +++ b/sc/source/ui/inc/tpprint.hxx @@ -25,15 +25,15 @@ class ScTpPrintOptions : public SfxTabPage { - CheckBox* m_pSkipEmptyPagesCB; - CheckBox* m_pSelectedSheetsCB; - CheckBox* m_pForceBreaksCB; + VclPtr<CheckBox> m_pSkipEmptyPagesCB; + VclPtr<CheckBox> m_pSelectedSheetsCB; + VclPtr<CheckBox> m_pForceBreaksCB; ScTpPrintOptions( vcl::Window* pParent, const SfxItemSet& rCoreSet ); - virtual ~ScTpPrintOptions(); - public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); + virtual ~ScTpPrintOptions(); + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); virtual bool FillItemSet( SfxItemSet* rCoreSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rCoreSet ) SAL_OVERRIDE; using SfxTabPage::DeactivatePage; diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx index d4ad19165103..82ad52ddddff 100644 --- a/sc/source/ui/inc/tpsort.hxx +++ b/sc/source/ui/inc/tpsort.hxx @@ -50,8 +50,8 @@ public: ScTabPageSortFields( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTabPageSortFields(); - - static SfxTabPage* Create ( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; @@ -72,7 +72,7 @@ private: OUString aStrRow; const sal_uInt16 nWhichSort; - ScSortDlg* pDlg; + VclPtr<ScSortDlg> pDlg; ScViewData* pViewData; ScSortParam aSortData; std::vector<SCCOLROW> nFieldArr; @@ -109,10 +109,11 @@ public: ScTabPageSortOptions( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTabPageSortOptions(); + virtual void dispose() SAL_OVERRIDE; #undef SfxTabPage #define SfxTabPage ::SfxTabPage - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; @@ -125,24 +126,24 @@ protected: private: - CheckBox* m_pBtnCase; - CheckBox* m_pBtnHeader; - CheckBox* m_pBtnFormats; - CheckBox* m_pBtnNaturalSort; + VclPtr<CheckBox> m_pBtnCase; + VclPtr<CheckBox> m_pBtnHeader; + VclPtr<CheckBox> m_pBtnFormats; + VclPtr<CheckBox> m_pBtnNaturalSort; - CheckBox* m_pBtnCopyResult; - ListBox* m_pLbOutPos; - Edit* m_pEdOutPos; + VclPtr<CheckBox> m_pBtnCopyResult; + VclPtr<ListBox> m_pLbOutPos; + VclPtr<Edit> m_pEdOutPos; - CheckBox* m_pBtnSortUser; - ListBox* m_pLbSortUser; + VclPtr<CheckBox> m_pBtnSortUser; + VclPtr<ListBox> m_pLbSortUser; - SvxLanguageBox* m_pLbLanguage; - FixedText* m_pFtAlgorithm; - ListBox* m_pLbAlgorithm; + VclPtr<SvxLanguageBox> m_pLbLanguage; + VclPtr<FixedText> m_pFtAlgorithm; + VclPtr<ListBox> m_pLbAlgorithm; - RadioButton* m_pBtnTopDown; - RadioButton* m_pBtnLeftRight; + VclPtr<RadioButton> m_pBtnTopDown; + VclPtr<RadioButton> m_pBtnLeftRight; OUString aStrRowLabel; OUString aStrColLabel; @@ -153,7 +154,7 @@ private: ScSortParam aSortData; ScViewData* pViewData; ScDocument* pDoc; - ScSortDlg* pDlg; + VclPtr<ScSortDlg> pDlg; ScAddress theOutPos; CollatorResource* pColRes; diff --git a/sc/source/ui/inc/tpstat.hxx b/sc/source/ui/inc/tpstat.hxx index 96f141fdbdd8..a5cbdf7a925e 100644 --- a/sc/source/ui/inc/tpstat.hxx +++ b/sc/source/ui/inc/tpstat.hxx @@ -27,20 +27,20 @@ class ScDocStatPage: public SfxTabPage { public: - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); + virtual ~ScDocStatPage(); + virtual void dispose() SAL_OVERRIDE; private: ScDocStatPage( vcl::Window *pParent, const SfxItemSet& rSet ); - virtual ~ScDocStatPage(); - protected: virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rSet ) SAL_OVERRIDE; private: - FixedText* m_pFtTables; - FixedText* m_pFtCells; - FixedText* m_pFtPages; + VclPtr<FixedText> m_pFtTables; + VclPtr<FixedText> m_pFtCells; + VclPtr<FixedText> m_pFtPages; }; #endif diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx index ffff1e061ba3..ecc8e0305483 100644 --- a/sc/source/ui/inc/tpsubt.hxx +++ b/sc/source/ui/inc/tpsubt.hxx @@ -41,15 +41,16 @@ protected: public: virtual ~ScTpSubTotalGroup(); + virtual void dispose() SAL_OVERRIDE; bool DoReset ( sal_uInt16 nGroupNo, const SfxItemSet& rArgSet ); bool DoFillItemSet ( sal_uInt16 nGroupNo, SfxItemSet& rArgSet ); protected: - ListBox* mpLbGroup; - SvxCheckListBox* mpLbColumns; - ListBox* mpLbFunctions; + VclPtr<ListBox> mpLbGroup; + VclPtr<SvxCheckListBox> mpLbColumns; + VclPtr<ListBox> mpLbFunctions; const OUString aStrNone; const OUString aStrColumn; @@ -82,7 +83,7 @@ protected: public: virtual ~ScTpSubTotalGroup1(); - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; @@ -97,7 +98,7 @@ protected: public: virtual ~ScTpSubTotalGroup2(); - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; @@ -112,7 +113,7 @@ protected: public: virtual ~ScTpSubTotalGroup3(); - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; @@ -126,22 +127,22 @@ protected: public: virtual ~ScTpSubTotalOptions(); - - static SfxTabPage* Create ( vcl::Window* pParent, + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; private: - CheckBox* pBtnPagebreak; - CheckBox* pBtnCase; - CheckBox* pBtnSort; - FixedText* pFlSort; - RadioButton* pBtnAscending; - RadioButton* pBtnDescending; - CheckBox* pBtnFormats; - CheckBox* pBtnUserDef; - ListBox* pLbUserDef; + VclPtr<CheckBox> pBtnPagebreak; + VclPtr<CheckBox> pBtnCase; + VclPtr<CheckBox> pBtnSort; + VclPtr<FixedText> pFlSort; + VclPtr<RadioButton> pBtnAscending; + VclPtr<RadioButton> pBtnDescending; + VclPtr<CheckBox> pBtnFormats; + VclPtr<CheckBox> pBtnUserDef; + VclPtr<ListBox> pLbUserDef; ScViewData* pViewData; ScDocument* pDoc; diff --git a/sc/source/ui/inc/tptable.hxx b/sc/source/ui/inc/tptable.hxx index a1021b3b5911..e135c91ea4ef 100644 --- a/sc/source/ui/inc/tptable.hxx +++ b/sc/source/ui/inc/tptable.hxx @@ -29,7 +29,7 @@ class ScTablePage : public SfxTabPage { static const sal_uInt16 pPageTableRanges[]; public: - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rCoreSet ); static const sal_uInt16* GetRanges () { return pPageTableRanges; } virtual bool FillItemSet ( SfxItemSet* rCoreSet ) SAL_OVERRIDE; @@ -38,42 +38,42 @@ public: virtual sfxpg DeactivatePage ( SfxItemSet* pSet = NULL ) SAL_OVERRIDE; virtual void DataChanged ( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; + virtual ~ScTablePage(); + virtual void dispose() SAL_OVERRIDE; private: ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreSet ); - virtual ~ScTablePage(); - void ShowImage(); private: - RadioButton* m_pBtnTopDown; - RadioButton* m_pBtnLeftRight; - FixedImage* m_pBmpPageDir; - CheckBox* m_pBtnPageNo; - NumericField* m_pEdPageNo; + VclPtr<RadioButton> m_pBtnTopDown; + VclPtr<RadioButton> m_pBtnLeftRight; + VclPtr<FixedImage> m_pBmpPageDir; + VclPtr<CheckBox> m_pBtnPageNo; + VclPtr<NumericField> m_pEdPageNo; - CheckBox* m_pBtnHeaders; - CheckBox* m_pBtnGrid; - CheckBox* m_pBtnNotes; - CheckBox* m_pBtnObjects; - CheckBox* m_pBtnCharts; - CheckBox* m_pBtnDrawings; - CheckBox* m_pBtnFormulas; - CheckBox* m_pBtnNullVals; + VclPtr<CheckBox> m_pBtnHeaders; + VclPtr<CheckBox> m_pBtnGrid; + VclPtr<CheckBox> m_pBtnNotes; + VclPtr<CheckBox> m_pBtnObjects; + VclPtr<CheckBox> m_pBtnCharts; + VclPtr<CheckBox> m_pBtnDrawings; + VclPtr<CheckBox> m_pBtnFormulas; + VclPtr<CheckBox> m_pBtnNullVals; - ListBox* m_pLbScaleMode; - VclHBox* m_pBxScaleAll; - MetricField* m_pEdScaleAll; - VclGrid* m_pGrHeightWidth; - NumericField* m_pEdScalePageWidth; - NumericField* m_pEdScalePageHeight; - VclHBox* m_pBxScalePageNum; - NumericField* m_pEdScalePageNum; + VclPtr<ListBox> m_pLbScaleMode; + VclPtr<VclHBox> m_pBxScaleAll; + VclPtr<MetricField> m_pEdScaleAll; + VclPtr<VclGrid> m_pGrHeightWidth; + VclPtr<NumericField> m_pEdScalePageWidth; + VclPtr<NumericField> m_pEdScalePageHeight; + VclPtr<VclHBox> m_pBxScalePageNum; + VclPtr<NumericField> m_pEdScalePageNum; private: // Handler: DECL_LINK(PageDirHdl, void *); - DECL_LINK( PageNoHdl, CheckBox* ); + DECL_LINK( PageNoHdl, CheckBox* ); DECL_LINK(ScaleHdl, void *); }; diff --git a/sc/source/ui/inc/tpusrlst.hxx b/sc/source/ui/inc/tpusrlst.hxx index c3286a23ad4d..682fc0c3421f 100644 --- a/sc/source/ui/inc/tpusrlst.hxx +++ b/sc/source/ui/inc/tpusrlst.hxx @@ -33,7 +33,7 @@ class ScRangeUtil; class ScTpUserLists : public SfxTabPage { public: - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rAttrSet ); virtual bool FillItemSet ( SfxItemSet* rCoreAttrs ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rCoreAttrs ) SAL_OVERRIDE; @@ -44,24 +44,25 @@ private: ScTpUserLists( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTpUserLists(); + virtual void dispose() SAL_OVERRIDE; private: - FixedText* mpFtLists; - ListBox* mpLbLists; - FixedText* mpFtEntries; - VclMultiLineEdit* mpEdEntries; - FixedText* mpFtCopyFrom; - Edit* mpEdCopyFrom; + VclPtr<FixedText> mpFtLists; + VclPtr<ListBox> mpLbLists; + VclPtr<FixedText> mpFtEntries; + VclPtr<VclMultiLineEdit> mpEdEntries; + VclPtr<FixedText> mpFtCopyFrom; + VclPtr<Edit> mpEdCopyFrom; - PushButton* mpBtnNew; - PushButton* mpBtnDiscard; + VclPtr<PushButton> mpBtnNew; + VclPtr<PushButton> mpBtnDiscard; - PushButton* mpBtnAdd; - PushButton* mpBtnModify; + VclPtr<PushButton> mpBtnAdd; + VclPtr<PushButton> mpBtnModify; - PushButton* mpBtnRemove; + VclPtr<PushButton> mpBtnRemove; - PushButton* mpBtnCopy; + VclPtr<PushButton> mpBtnCopy; const OUString aStrQueryRemove; const OUString aStrCopyList; diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index 28778a16f783..f31c850a5eb7 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -31,31 +31,31 @@ class ScViewOptions; class ScTpContentOptions : public SfxTabPage { - ListBox* pGridLB; - FixedText* pColorFT; - ColorListBox* pColorLB; - CheckBox* pBreakCB; - CheckBox* pGuideLineCB; - - CheckBox* pFormulaCB; - CheckBox* pNilCB; - CheckBox* pAnnotCB; - CheckBox* pValueCB; - CheckBox* pAnchorCB; - CheckBox* pClipMarkCB; - CheckBox* pRangeFindCB; - - ListBox* pObjGrfLB; - ListBox* pDiagramLB; - ListBox* pDrawLB; - - CheckBox* pSyncZoomCB; - - CheckBox* pRowColHeaderCB; - CheckBox* pHScrollCB; - CheckBox* pVScrollCB; - CheckBox* pTblRegCB; - CheckBox* pOutlineCB; + VclPtr<ListBox> pGridLB; + VclPtr<FixedText> pColorFT; + VclPtr<ColorListBox> pColorLB; + VclPtr<CheckBox> pBreakCB; + VclPtr<CheckBox> pGuideLineCB; + + VclPtr<CheckBox> pFormulaCB; + VclPtr<CheckBox> pNilCB; + VclPtr<CheckBox> pAnnotCB; + VclPtr<CheckBox> pValueCB; + VclPtr<CheckBox> pAnchorCB; + VclPtr<CheckBox> pClipMarkCB; + VclPtr<CheckBox> pRangeFindCB; + + VclPtr<ListBox> pObjGrfLB; + VclPtr<ListBox> pDiagramLB; + VclPtr<ListBox> pDrawLB; + + VclPtr<CheckBox> pSyncZoomCB; + + VclPtr<CheckBox> pRowColHeaderCB; + VclPtr<CheckBox> pHScrollCB; + VclPtr<CheckBox> pVScrollCB; + VclPtr<CheckBox> pTblRegCB; + VclPtr<CheckBox> pOutlineCB; ScViewOptions* pLocalOptions; @@ -67,9 +67,10 @@ class ScTpContentOptions : public SfxTabPage ScTpContentOptions( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTpContentOptions(); + virtual void dispose() SAL_OVERRIDE; public: - static SfxTabPage* Create ( vcl::Window* pParent, + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rCoreSet ); virtual bool FillItemSet ( SfxItemSet* rCoreSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rCoreSet ) SAL_OVERRIDE; @@ -83,23 +84,23 @@ public: class ScDocument; class ScTpLayoutOptions : public SfxTabPage { - ListBox* m_pUnitLB; - MetricField* m_pTabMF; - - RadioButton* m_pAlwaysRB; - RadioButton* m_pRequestRB; - RadioButton* m_pNeverRB; - - CheckBox* m_pAlignCB; - ListBox* m_pAlignLB; - CheckBox* m_pEditModeCB; - CheckBox* m_pFormatCB; - CheckBox* m_pExpRefCB; - CheckBox* m_pSortRefUpdateCB; - CheckBox* m_pMarkHdrCB; - CheckBox* m_pTextFmtCB; - CheckBox* m_pReplWarnCB; - CheckBox* m_pLegacyCellSelectionCB; + VclPtr<ListBox> m_pUnitLB; + VclPtr<MetricField> m_pTabMF; + + VclPtr<RadioButton> m_pAlwaysRB; + VclPtr<RadioButton> m_pRequestRB; + VclPtr<RadioButton> m_pNeverRB; + + VclPtr<CheckBox> m_pAlignCB; + VclPtr<ListBox> m_pAlignLB; + VclPtr<CheckBox> m_pEditModeCB; + VclPtr<CheckBox> m_pFormatCB; + VclPtr<CheckBox> m_pExpRefCB; + VclPtr<CheckBox> m_pSortRefUpdateCB; + VclPtr<CheckBox> m_pMarkHdrCB; + VclPtr<CheckBox> m_pTextFmtCB; + VclPtr<CheckBox> m_pReplWarnCB; + VclPtr<CheckBox> m_pLegacyCellSelectionCB; SvxStringArray aUnitArr; @@ -114,10 +115,10 @@ class ScTpLayoutOptions : public SfxTabPage ScTpLayoutOptions( vcl::Window* pParent, const SfxItemSet& rArgSet ); - virtual ~ScTpLayoutOptions(); - public: - static SfxTabPage* Create ( vcl::Window* pParent, + virtual ~ScTpLayoutOptions(); + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rCoreSet ); virtual bool FillItemSet ( SfxItemSet* rCoreSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rCoreSet ) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index ebc6d92ffa37..0cf1d9370e1f 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -85,8 +85,9 @@ class ScTPValidationValue : public ScRefHandlerCaller, public SfxTabPage static const sal_uInt16 pValueRanges[]; public: explicit ScTPValidationValue( vcl::Window* pParent, const SfxItemSet& rArgSet ); - - static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rArgSet ); + virtual ~ScTPValidationValue(); + virtual void dispose() SAL_OVERRIDE; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rArgSet ); static const sal_uInt16* GetRanges() { return pValueRanges; } virtual bool FillItemSet( SfxItemSet* rArgSet ) SAL_OVERRIDE; @@ -104,19 +105,19 @@ private: DECL_LINK(SelectHdl, void *); DECL_LINK(CheckHdl, void *); - ListBox* m_pLbAllow; - CheckBox* m_pCbAllow; /// Allow blank cells. - CheckBox* m_pCbShow; /// Show selection list in cell. - CheckBox* m_pCbSort; /// Sort selection list in cell. - FixedText* m_pFtValue; - ListBox* m_pLbValue; - FixedText* m_pFtMin; - VclContainer* m_pMinGrid; - formula::RefEdit* m_pEdMin; - VclMultiLineEdit* m_pEdList; /// Entries for explicit list - FixedText* m_pFtMax; - formula::RefEdit* m_pEdMax; - FixedText* m_pFtHint; /// Hint text for cell range validity. + VclPtr<ListBox> m_pLbAllow; + VclPtr<CheckBox> m_pCbAllow; /// Allow blank cells. + VclPtr<CheckBox> m_pCbShow; /// Show selection list in cell. + VclPtr<CheckBox> m_pCbSort; /// Sort selection list in cell. + VclPtr<FixedText> m_pFtValue; + VclPtr<ListBox> m_pLbValue; + VclPtr<FixedText> m_pFtMin; + VclPtr<VclContainer> m_pMinGrid; + VclPtr<formula::RefEdit> m_pEdMin; + VclPtr<VclMultiLineEdit> m_pEdList; /// Entries for explicit list + VclPtr<FixedText> m_pFtMax; + VclPtr<formula::RefEdit> m_pEdMax; + VclPtr<FixedText> m_pFtHint; /// Hint text for cell range validity. OUString maStrMin; OUString maStrMax; @@ -128,11 +129,11 @@ private: DECL_LINK(EditSetFocusHdl, void *); DECL_LINK( KillFocusHdl, vcl::Window *); void OnClick( Button *pBtn ); - formula::RefEdit* m_pRefEdit; + VclPtr<formula::RefEdit> m_pRefEdit; public: class ScRefButtonEx : public ::formula::RefButton { - ScTPValidationValue* m_pPage; + VclPtr<ScTPValidationValue> m_pPage; virtual void Click() SAL_OVERRIDE; public: ScRefButtonEx(vcl::Window* pParent, WinBits nStyle) @@ -140,6 +141,8 @@ public: , m_pPage(NULL) { } + virtual ~ScRefButtonEx(); + virtual void dispose() SAL_OVERRIDE; void SetParentPage(ScTPValidationValue *pPage) { m_pPage = pPage; @@ -150,8 +153,8 @@ public: } }; private: - ScRefButtonEx* m_pBtnRef; - VclContainer* m_pRefGrid; + VclPtr<ScRefButtonEx> m_pBtnRef; + VclPtr<VclContainer> m_pRefGrid; friend class ScRefButtonEx; void SetReferenceHdl( const ScRange& , ScDocument* ); void SetActiveHdl(); @@ -175,7 +178,7 @@ class ScValidationDlg DECL_LINK( OkHdl, Button * ); ScTabViewShell *m_pTabVwSh; - VclHBox* m_pHBox; + VclPtr<VclHBox> m_pHBox; sal_uInt16 m_nValuePageId; bool m_bOwnRefHdlr:1; bool m_bRefInputting:1; @@ -185,10 +188,13 @@ class ScValidationDlg public: explicit ScValidationDlg( vcl::Window* pParent, const SfxItemSet* pArgSet, ScTabViewShell * pTabViewSh, SfxBindings *pB = NULL ); - virtual ~ScValidationDlg() + virtual ~ScValidationDlg() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { if( m_bOwnRefHdlr ) RemoveRefDlg( false ); + m_pHBox.clear(); + ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false>::dispose(); } static ScValidationDlg * Find1AliveObject( vcl::Window *pAncestor ) { @@ -276,9 +282,9 @@ public: class ScTPValidationHelp : public SfxTabPage { private: - TriStateBox* pTsbHelp; - Edit* pEdtTitle; - VclMultiLineEdit* pEdInputHelp; + VclPtr<TriStateBox> pTsbHelp; + VclPtr<Edit> pEdtTitle; + VclPtr<VclMultiLineEdit> pEdInputHelp; void Init(); @@ -288,8 +294,9 @@ private: public: ScTPValidationHelp( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTPValidationHelp(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; }; @@ -297,12 +304,12 @@ public: class ScTPValidationError : public SfxTabPage { private: - TriStateBox* m_pTsbShow; - ListBox* m_pLbAction; - PushButton* m_pBtnSearch; - Edit* m_pEdtTitle; - FixedText* m_pFtError; - VclMultiLineEdit* m_pEdError; + VclPtr<TriStateBox> m_pTsbShow; + VclPtr<ListBox> m_pLbAction; + VclPtr<PushButton> m_pBtnSearch; + VclPtr<Edit> m_pEdtTitle; + VclPtr<FixedText> m_pFtError; + VclPtr<VclMultiLineEdit> m_pEdError; void Init(); @@ -313,8 +320,9 @@ private: public: ScTPValidationError( vcl::Window* pParent, const SfxItemSet& rArgSet ); virtual ~ScTPValidationError(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); + static VclPtr<SfxTabPage> Create ( vcl::Window* pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) SAL_OVERRIDE; virtual void Reset ( const SfxItemSet* rArgSet ) SAL_OVERRIDE; }; diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 1c90a1e7a4b3..c768dbcfc393 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -335,7 +335,7 @@ public: DataFormPutData( SCROW nCurrentRow , SCROW nStartRow , SCCOL nStartCol , SCROW nEndRow , SCCOL nEndCol , - boost::ptr_vector<boost::nullable<Edit> >& aEdits, + std::vector<VclPtr<Edit> >& aEdits, sal_uInt16 aColLength ); void UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAttr = NULL ); // Internal helper functions diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx index efabb35b024f..1bc0c375c936 100644 --- a/sc/source/ui/inc/xmlsourcedlg.hxx +++ b/sc/source/ui/inc/xmlsourcedlg.hxx @@ -28,17 +28,17 @@ class ScOrcusXMLContext; class ScXMLSourceDlg : public ScAnyRefDlg { - PushButton* mpBtnSelectSource; - FixedText* mpFtSourceFile; + VclPtr<PushButton> mpBtnSelectSource; + VclPtr<FixedText> mpFtSourceFile; - VclContainer* mpMapGrid; + VclPtr<VclContainer> mpMapGrid; - SvTreeListBox* mpLbTree; - formula::RefEdit* mpRefEdit; - formula::RefButton* mpRefBtn; + VclPtr<SvTreeListBox> mpLbTree; + VclPtr<formula::RefEdit> mpRefEdit; + VclPtr<formula::RefButton> mpRefBtn; - PushButton* mpBtnOk; - CancelButton* mpBtnCancel; + VclPtr<PushButton> mpBtnOk; + VclPtr<CancelButton> mpBtnCancel; OUString maSrcPath; @@ -51,12 +51,14 @@ class ScXMLSourceDlg : public ScAnyRefDlg ScDocument* mpDoc; - formula::RefEdit* mpActiveEdit; + VclPtr<formula::RefEdit> mpActiveEdit; bool mbDlgLostFocus; public: ScXMLSourceDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScDocument* pDoc); + virtual ~ScXMLSourceDlg(); + virtual void dispose() SAL_OVERRIDE; virtual bool IsRefInputMode() const SAL_OVERRIDE; virtual void SetReference(const ScRange& rRange, ScDocument* pDoc) SAL_OVERRIDE; 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 ) ); diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index b784e93ddddb..0f80368c5377 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -93,6 +93,27 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* p m_pEdName->SetSelection( aCurSel ); } +ScNameDefDlg::~ScNameDefDlg() +{ + disposeOnce(); +} + +void ScNameDefDlg::dispose() +{ + m_pEdName.clear(); + m_pEdRange.clear(); + m_pRbRange.clear(); + m_pLbScope.clear(); + m_pBtnRowHeader.clear(); + m_pBtnColHeader.clear(); + m_pBtnPrintArea.clear(); + m_pBtnCriteria.clear(); + m_pBtnAdd.clear(); + m_pBtnCancel.clear(); + m_pFtInfo.clear(); + ScAnyRefDlg::dispose(); +} + void ScNameDefDlg::CancelPushed() { if (mbUndo) diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 6cc2afc689d9..090738cbe436 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -102,7 +102,26 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent ScNameDlg::~ScNameDlg() { - delete m_pRangeManagerTable; + disposeOnce(); +} + +void ScNameDlg::dispose() +{ + m_pRangeManagerTable.disposeAndClear(); + m_pEdName.clear(); + m_pEdAssign.clear(); + m_pRbAssign.clear(); + m_pLbScope.clear(); + m_pBtnPrintArea.clear(); + m_pBtnColHeader.clear(); + m_pBtnCriteria.clear(); + m_pBtnRowHeader.clear(); + m_pBtnAdd.clear(); + m_pBtnDelete.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + m_pFtInfo.clear(); + ScAnyRefDlg::dispose(); } void ScNameDlg::Init() @@ -117,7 +136,7 @@ void ScNameDlg::Init() SvSimpleTableContainer *pCtrl = get<SvSimpleTableContainer>("names"); pCtrl->set_height_request(pCtrl->GetTextHeight()*12); - m_pRangeManagerTable = new ScRangeManagerTable(*pCtrl, maRangeMap, maCursorPos); + m_pRangeManagerTable = VclPtr<ScRangeManagerTable>::Create(*pCtrl, maRangeMap, maCursorPos); m_pRangeManagerTable->setInitListener(this); m_pRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); m_pRangeManagerTable->SetDeselectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx index f534320e47ed..2df4743de41e 100644 --- a/sc/source/ui/namedlg/namemgrtable.cxx +++ b/sc/source/ui/namedlg/namemgrtable.cxx @@ -105,7 +105,13 @@ void ScRangeManagerTable::setColWidths() ScRangeManagerTable::~ScRangeManagerTable() { + disposeOnce(); +} + +void ScRangeManagerTable::dispose() +{ Clear(); + SvSimpleTable::dispose(); } void ScRangeManagerTable::setInitListener( InitListener* pListener ) diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx index 841781575ed4..5f0c238327ef 100644 --- a/sc/source/ui/namedlg/namepast.cxx +++ b/sc/source/ui/namedlg/namepast.cxx @@ -50,7 +50,7 @@ ScNamePasteDlg::ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool aControlSize = LogicToPixel(aControlSize, MAP_APPFONT); pContainer->set_width_request(aControlSize.Width()); pContainer->set_height_request(10 * GetTextHeight()); - mpTable = new ScRangeManagerTable(*pContainer, maRangeMap, aPos); + mpTable = VclPtr<ScRangeManagerTable>::Create(*pContainer, maRangeMap, aPos); m_pBtnPaste->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) ); m_pBtnPasteAll->SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl)); @@ -65,7 +65,16 @@ ScNamePasteDlg::ScNamePasteDlg( vcl::Window * pParent, ScDocShell* pShell, bool ScNamePasteDlg::~ScNamePasteDlg() { - delete mpTable; + disposeOnce(); +} + +void ScNamePasteDlg::dispose() +{ + mpTable.disposeAndClear(); + m_pBtnPasteAll.clear(); + m_pBtnPaste.clear(); + m_pBtnClose.clear(); + ModalDialog::dispose(); } IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton ) diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index ddbde5f5ab37..867d41cb43d5 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -142,6 +142,13 @@ ScContentTree::ScContentTree( vcl::Window* pParent, const ResId& rResId ) : ScContentTree::~ScContentTree() { + disposeOnce(); +} + +void ScContentTree::dispose() +{ + pParentWindow.clear(); + SvTreeListBox::dispose(); } // helper function for GetEntryAltText and GetEntryLongDescription diff --git a/sc/source/ui/navipi/navcitem.cxx b/sc/source/ui/navipi/navcitem.cxx index 5b64b02115f4..ef981c99aaea 100644 --- a/sc/source/ui/navipi/navcitem.cxx +++ b/sc/source/ui/navipi/navcitem.cxx @@ -88,7 +88,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat break; case SID_SELECT_SCENARIO: - rNavigatorDlg.aWndScenarios.NotifyState( pItem ); + rNavigatorDlg.aWndScenarios->NotifyState( pItem ); break; default: diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index d3c47ccf9728..49f516cd35d0 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -174,7 +174,7 @@ void ColumnEdit::EvalText() void ColumnEdit::ExecuteCol() { - SCROW nRow = rDlg.aEdRow.GetRow(); + SCROW nRow = rDlg.aEdRow->GetRow(); EvalText(); // setzt nCol @@ -285,7 +285,7 @@ void RowEdit::LoseFocus() void RowEdit::ExecuteRow() { - SCCOL nCol = rDlg.aEdCol.GetCol(); + SCCOL nCol = rDlg.aEdCol->GetCol(); SCROW nRow = (SCROW)GetValue(); if ( (nCol > 0) && (nRow > 0) ) @@ -309,7 +309,7 @@ void ScDocListBox::Select() ScNavigatorDlg::ReleaseFocus(); OUString aDocName = GetSelectEntry(); - rDlg.aLbEntries.SelectDoc( aDocName ); + rDlg.aLbEntries->SelectDoc( aDocName ); } // class CommandToolBox @@ -368,7 +368,7 @@ void CommandToolBox::Select( sal_uInt16 nSelId ) rDlg.EndOfDataArea(); break; case IID_CHANGEROOT: - rDlg.aLbEntries.ToggleRoot(); + rDlg.aLbEntries->ToggleRoot(); UpdateButtons(); break; } @@ -424,7 +424,7 @@ void CommandToolBox::UpdateButtons() else { EnableItem( IID_CHANGEROOT, true ); - bool bRootSet = rDlg.aLbEntries.GetRootType() != SC_CONTENT_ROOT; + bool bRootSet = rDlg.aLbEntries->GetRootType() != SC_CONTENT_ROOT; CheckItem( IID_CHANGEROOT, bRootSet ); } @@ -483,7 +483,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper( SfxChildWinInfo* /* pInfo */ ) : SfxChildWindowContext( nId ) { - pNavigator = new ScNavigatorDlg( pBind, this, pParent, true ); + pNavigator = VclPtr<ScNavigatorDlg>::Create( pBind, this, pParent, true ); SetWindow( pNavigator ); // handle configurations elsewhere, @@ -531,7 +531,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper( } if (nCmdId) { - pNavigator->aTbxCmd.CheckItem( nCmdId ); + pNavigator->aTbxCmd->CheckItem( nCmdId ); pNavigator->DoResize(); } @@ -555,14 +555,14 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl Window( pParent, ScResId(RID_SCDLG_NAVIGATOR) ), rBindings ( *pB ), // is used in CommandToolBox ctor aCmdImageList( ScResId( IL_CMD ) ), - aFtCol ( this, ScResId( FT_COL ) ), - aEdCol ( this, ScResId( ED_COL ) ), - aFtRow ( this, ScResId( FT_ROW ) ), - aEdRow ( this, ScResId( ED_ROW ) ), - aTbxCmd ( this, ScResId( TBX_CMD ) ), - aLbEntries ( this, ScResId( LB_ENTRIES ) ), - aWndScenarios( this,ScResId( STR_QHLP_SCEN_LISTBOX), ScResId(STR_QHLP_SCEN_COMMENT)), - aLbDocuments( this, ScResId( LB_DOCUMENTS ) ), + aFtCol ( VclPtr<FixedInfo>::Create( this, ScResId( FT_COL ) ) ), + aEdCol ( VclPtr<ColumnEdit>::Create( this, ScResId( ED_COL ) ) ), + aFtRow ( VclPtr<FixedInfo>::Create( this, ScResId( FT_ROW ) ) ), + aEdRow ( VclPtr<RowEdit>::Create( this, ScResId( ED_ROW ) ) ), + aTbxCmd ( VclPtr<CommandToolBox>::Create( this, ScResId( TBX_CMD ) ) ), + aLbEntries ( VclPtr<ScContentTree>::Create( this, ScResId( LB_ENTRIES ) ) ), + aWndScenarios( VclPtr<ScScenarioWindow>::Create( this,ScResId( STR_QHLP_SCEN_LISTBOX), ScResId(STR_QHLP_SCEN_COMMENT)) ), + aLbDocuments( VclPtr<ScDocListBox>::Create( this, ScResId( LB_DOCUMENTS ) ) ), aStrDragMode ( ScResId( STR_DRAGMODE ) ), aStrDisplay ( ScResId( STR_DISPLAY ) ), aStrActiveWin( ScResId( STR_ACTIVEWIN ) ), @@ -583,7 +583,7 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl nDropMode = rCfg.GetDragMode(); // eListMode is set from outside, Root further below - aLbDocuments.SetDropDownLineCount(9); + aLbDocuments->SetDropDownLineCount(9); OUString aOpen(" ("); aStrActive = aOpen; aStrActive += OUString( ScResId( STR_ACTIVE ) ); @@ -599,19 +599,19 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl const long nListboxYPos = ::std::max( - (aTbxCmd.GetPosPixel().Y() + aTbxCmd.GetSizePixel().Height()), - (aEdRow.GetPosPixel().Y() + aEdRow.GetSizePixel().Height()) ) + (aTbxCmd->GetPosPixel().Y() + aTbxCmd->GetSizePixel().Height()), + (aEdRow->GetPosPixel().Y() + aEdRow->GetSizePixel().Height()) ) + 4; - aLbEntries.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y); + aLbEntries->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y); - nBorderOffset = aLbEntries.GetPosPixel().X(); + nBorderOffset = aLbEntries->GetPosPixel().X(); - aInitSize.Width() = aTbxCmd.GetPosPixel().X() - + aTbxCmd.GetSizePixel().Width() + aInitSize.Width() = aTbxCmd->GetPosPixel().X() + + aTbxCmd->GetSizePixel().Width() + nBorderOffset; - aInitSize.Height() = aLbEntries.GetPosPixel().Y(); + aInitSize.Height() = aLbEntries->GetPosPixel().Y(); - nInitListHeight = aLbEntries.GetSizePixel().Height(); + nInitListHeight = aLbEntries->GetSizePixel().Height(); nListModeHeight = aInitSize.Height() + nInitListHeight; @@ -629,41 +629,41 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl StartListening( *(SfxGetpApp()) ); StartListening( rBindings ); - aLbDocuments.Hide(); // does not exist at NAV_LMODE_NONE + aLbDocuments->Hide(); // does not exist at NAV_LMODE_NONE - aLbEntries.InitWindowBits(true); + aLbEntries->InitWindowBits(true); - aLbEntries.SetSpaceBetweenEntries(0); - aLbEntries.SetSelectionMode( SINGLE_SELECTION ); - aLbEntries.SetDragDropMode( DragDropMode::CTRL_MOVE | - DragDropMode::CTRL_COPY | - DragDropMode::ENABLE_TOP ); + aLbEntries->SetSpaceBetweenEntries(0); + aLbEntries->SetSelectionMode( SINGLE_SELECTION ); + aLbEntries->SetDragDropMode( DragDropMode::CTRL_MOVE | + DragDropMode::CTRL_COPY | + DragDropMode::ENABLE_TOP ); // was a category chosen as root? sal_uInt16 nLastRoot = rCfg.GetRootType(); if ( nLastRoot ) - aLbEntries.SetRootType( nLastRoot ); + aLbEntries->SetRootType( nLastRoot ); - aLbEntries.Refresh(); + aLbEntries->Refresh(); GetDocNames(); - aTbxCmd.UpdateButtons(); + aTbxCmd->UpdateButtons(); UpdateColumn(); UpdateRow(); UpdateTable(); - aLbEntries.Hide(); - aWndScenarios.Hide(); - aWndScenarios.SetPosPixel( aLbEntries.GetPosPixel() ); + aLbEntries->Hide(); + aWndScenarios->Hide(); + aWndScenarios->SetPosPixel( aLbEntries->GetPosPixel() ); aContentIdle.SetIdleHdl( LINK( this, ScNavigatorDlg, TimeHdl ) ); aContentIdle.SetPriority( SchedulerPriority::LOWEST ); FreeResource(); - aLbEntries.SetAccessibleRelationLabeledBy(&aLbEntries); - aTbxCmd.SetAccessibleRelationLabeledBy(&aTbxCmd); - aLbDocuments.SetAccessibleName(aStrActiveWin); + aLbEntries->SetAccessibleRelationLabeledBy(aLbEntries.get()); + aTbxCmd->SetAccessibleRelationLabeledBy(aTbxCmd.get()); + aLbDocuments->SetAccessibleName(aStrActiveWin); if (pContextWin == NULL) { @@ -671,14 +671,19 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl // displayed in the sidebar and has the whole deck to fill. // Therefore hide the button that hides all controls below the // top two rows of buttons. - aTbxCmd.Select(IID_ZOOMOUT); - aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT)); + aTbxCmd->Select(IID_ZOOMOUT); + aTbxCmd->RemoveItem(aTbxCmd->GetItemPos(IID_ZOOMOUT)); } - aLbEntries.SetNavigatorDlgFlag(true); + aLbEntries->SetNavigatorDlgFlag(true); } ScNavigatorDlg::~ScNavigatorDlg() { + disposeOnce(); +} + +void ScNavigatorDlg::dispose() +{ aContentIdle.Stop(); sal_uInt16 i; @@ -690,6 +695,16 @@ ScNavigatorDlg::~ScNavigatorDlg() EndListening( *(SfxGetpApp()) ); EndListening( rBindings ); + + aFtCol.disposeAndClear(); + aEdCol.disposeAndClear(); + aFtRow.disposeAndClear(); + aEdRow.disposeAndClear(); + aTbxCmd.disposeAndClear(); + aLbEntries.disposeAndClear(); + aWndScenarios.disposeAndClear(); + aLbDocuments.disposeAndClear(); + vcl::Window::dispose(); } void ScNavigatorDlg::Resizing( Size& rNewSize ) // Size = Outputsize? @@ -721,13 +736,13 @@ void ScNavigatorDlg::Paint( const Rectangle& rRect ) Wallpaper aBack( aBgColor ); SetBackground( aBack ); - aFtCol.SetBackground( aBack ); - aFtRow.SetBackground( aBack ); + aFtCol->SetBackground( aBack ); + aFtRow->SetBackground( aBack ); } else { - aFtCol.SetBackground(Wallpaper()); - aFtRow.SetBackground(Wallpaper()); + aFtCol->SetBackground(Wallpaper()); + aFtRow->SetBackground(Wallpaper()); } Window::Paint( rRect ); @@ -774,28 +789,28 @@ void ScNavigatorDlg::DoResize() // even if the content is not visible, adapt the size, // so the width fit - Point aEntryPos = aLbEntries.GetPosPixel(); - Point aListPos = aLbDocuments.GetPosPixel(); + Point aEntryPos = aLbEntries->GetPosPixel(); + Point aListPos = aLbDocuments->GetPosPixel(); aNewSize.Width() -= 2*nBorderOffset; - Size aDocSize = aLbDocuments.GetSizePixel(); + Size aDocSize = aLbDocuments->GetSizePixel(); aDocSize.Width() = aNewSize.Width(); if(!bSmall) { - long nListHeight = aLbDocuments.GetSizePixel().Height(); + long nListHeight = aLbDocuments->GetSizePixel().Height(); aNewSize.Height() -= ( aEntryPos.Y() + nListHeight + 2*nBorderOffset ); if(aNewSize.Height()<0) aNewSize.Height()=0; aListPos.Y() = aEntryPos.Y() + aNewSize.Height() + nBorderOffset; - if(aListPos.Y() > aLbEntries.GetPosPixel().Y()) - aLbDocuments.SetPosPixel( aListPos ); + if(aListPos.Y() > aLbEntries->GetPosPixel().Y()) + aLbDocuments->SetPosPixel( aListPos ); } - aLbEntries.SetSizePixel( aNewSize ); - aWndScenarios.SetSizePixel( aNewSize ); - aLbDocuments.SetSizePixel( aDocSize ); + aLbEntries->SetSizePixel( aNewSize ); + aWndScenarios->SetSizePixel( aNewSize ); + aLbDocuments->SetSizePixel( aDocSize ); bool bListMode = (eListMode != NAV_LMODE_NONE); if (pContextWin != NULL) @@ -815,7 +830,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( nHintId == SC_HINT_DOCNAME_CHANGED ) { - aLbEntries.ActiveDocChanged(); + aLbEntries->ActiveDocChanged(); } else if ( NAV_LMODE_NONE == eListMode ) { @@ -826,25 +841,25 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) switch ( nHintId ) { case SC_HINT_TABLES_CHANGED: - aLbEntries.Refresh( SC_CONTENT_TABLE ); + aLbEntries->Refresh( SC_CONTENT_TABLE ); break; case SC_HINT_DBAREAS_CHANGED: - aLbEntries.Refresh( SC_CONTENT_DBAREA ); + aLbEntries->Refresh( SC_CONTENT_DBAREA ); break; case SC_HINT_AREAS_CHANGED: - aLbEntries.Refresh( SC_CONTENT_RANGENAME ); + aLbEntries->Refresh( SC_CONTENT_RANGENAME ); break; case SC_HINT_DRAW_CHANGED: - aLbEntries.Refresh( SC_CONTENT_GRAPHIC ); - aLbEntries.Refresh( SC_CONTENT_OLEOBJECT ); - aLbEntries.Refresh( SC_CONTENT_DRAWING ); + aLbEntries->Refresh( SC_CONTENT_GRAPHIC ); + aLbEntries->Refresh( SC_CONTENT_OLEOBJECT ); + aLbEntries->Refresh( SC_CONTENT_DRAWING ); break; case SC_HINT_AREALINKS_CHANGED: - aLbEntries.Refresh( SC_CONTENT_AREALINK ); + aLbEntries->Refresh( SC_CONTENT_AREALINK ); break; // SFX_HINT_DOCCHANGED not only at document change @@ -858,9 +873,9 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) aContentIdle.Start(); // Do not search notes immediately break; case FID_KILLEDITVIEW: - aLbEntries.ObjectFresh( SC_CONTENT_OLEOBJECT ); - aLbEntries.ObjectFresh( SC_CONTENT_DRAWING ); - aLbEntries.ObjectFresh( SC_CONTENT_GRAPHIC ); + aLbEntries->ObjectFresh( SC_CONTENT_OLEOBJECT ); + aLbEntries->ObjectFresh( SC_CONTENT_DRAWING ); + aLbEntries->ObjectFresh( SC_CONTENT_GRAPHIC ); break; default: break; @@ -872,7 +887,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId(); if ( nEventId == SFX_EVENT_ACTIVATEDOC ) { - aLbEntries.ActiveDocChanged(); + aLbEntries->ActiveDocChanged(); UpdateAll(); } } @@ -883,14 +898,14 @@ IMPL_LINK( ScNavigatorDlg, TimeHdl, Idle*, pIdle ) if ( pIdle != &aContentIdle ) return 0; - aLbEntries.Refresh( SC_CONTENT_NOTE ); + aLbEntries->Refresh( SC_CONTENT_NOTE ); return 0; } void ScNavigatorDlg::SetDropMode(sal_uInt16 nNew) { nDropMode = nNew; - aTbxCmd.UpdateButtons(); + aTbxCmd->UpdateButtons(); ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); rCfg.SetDragMode(nDropMode); @@ -1008,7 +1023,7 @@ void ScNavigatorDlg::UpdateColumn( const SCCOL* pCol ) else if ( GetViewData() ) nCurCol = pViewData->GetCurX() + 1; - aEdCol.SetCol( nCurCol ); + aEdCol->SetCol( nCurCol ); CheckDataArea(); } @@ -1019,7 +1034,7 @@ void ScNavigatorDlg::UpdateRow( const SCROW* pRow ) else if ( GetViewData() ) nCurRow = pViewData->GetCurY() + 1; - aEdRow.SetRow( nCurRow ); + aEdRow->SetRow( nCurRow ); CheckDataArea(); } @@ -1040,7 +1055,7 @@ void ScNavigatorDlg::UpdateAll() case NAV_LMODE_DOCS: case NAV_LMODE_DBAREAS: case NAV_LMODE_AREAS: - aLbEntries.Refresh(); + aLbEntries->Refresh(); break; case NAV_LMODE_NONE: @@ -1072,7 +1087,7 @@ void ScNavigatorDlg::SetListMode( NavListMode eMode, bool bSetSize ) case NAV_LMODE_AREAS: case NAV_LMODE_DBAREAS: case NAV_LMODE_DOCS: - aLbEntries.Refresh(); + aLbEntries->Refresh(); ShowList( true, bSetSize ); break; @@ -1081,7 +1096,7 @@ void ScNavigatorDlg::SetListMode( NavListMode eMode, bool bSetSize ) break; } - aTbxCmd.UpdateButtons(); + aTbxCmd->UpdateButtons(); if ( eMode != NAV_LMODE_NONE ) { @@ -1107,8 +1122,8 @@ void ScNavigatorDlg::ShowList( bool bShow, bool bSetSize ) if ( pFloat ) pFloat->SetMinOutputSizePixel( aMinSize ); aSize.Height() = nListModeHeight; - aLbEntries.Show(); - aLbDocuments.Show(); + aLbEntries->Show(); + aLbDocuments->Show(); } else { @@ -1118,10 +1133,10 @@ void ScNavigatorDlg::ShowList( bool bShow, bool bSetSize ) nListModeHeight = aSize.Height(); } aSize.Height() = aInitSize.Height(); - aLbEntries.Hide(); - aLbDocuments.Hide(); + aLbEntries->Hide(); + aLbDocuments->Hide(); } - aWndScenarios.Hide(); + aWndScenarios->Hide(); if ( pFloat ) { @@ -1156,8 +1171,8 @@ void ScNavigatorDlg::ShowScenarios( bool bShow, bool bSetSize ) rBindings.Invalidate( SID_SELECT_SCENARIO ); rBindings.Update( SID_SELECT_SCENARIO ); - aWndScenarios.Show(); - aLbDocuments.Show(); + aWndScenarios->Show(); + aLbDocuments->Show(); } else { @@ -1167,10 +1182,10 @@ void ScNavigatorDlg::ShowScenarios( bool bShow, bool bSetSize ) nListModeHeight = aSize.Height(); } aSize.Height() = aInitSize.Height(); - aWndScenarios.Hide(); - aLbDocuments.Hide(); + aWndScenarios->Hide(); + aLbDocuments->Hide(); } - aLbEntries.Hide(); + aLbEntries->Hide(); if ( pFloat ) { @@ -1190,8 +1205,8 @@ void ScNavigatorDlg::ShowScenarios( bool bShow, bool bSetSize ) void ScNavigatorDlg::GetDocNames( const OUString* pManualSel ) { - aLbDocuments.Clear(); - aLbDocuments.SetUpdateMode( false ); + aLbDocuments->Clear(); + aLbDocuments->SetUpdateMode( false ); ScDocShell* pCurrentSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); @@ -1207,7 +1222,7 @@ void ScNavigatorDlg::GetDocNames( const OUString* pManualSel ) aEntry += aStrActive; else aEntry += aStrNotActive; - aLbDocuments.InsertEntry( aEntry ); + aLbDocuments->InsertEntry( aEntry ); if ( pManualSel ? ( aName == *pManualSel ) : ( pSh == pCurrentSh ) ) @@ -1217,22 +1232,22 @@ void ScNavigatorDlg::GetDocNames( const OUString* pManualSel ) pSh = SfxObjectShell::GetNext( *pSh ); } - aLbDocuments.InsertEntry( aStrActiveWin ); + aLbDocuments->InsertEntry( aStrActiveWin ); - OUString aHidden = aLbEntries.GetHiddenTitle(); + OUString aHidden = aLbEntries->GetHiddenTitle(); if (!aHidden.isEmpty()) { OUString aEntry = aHidden; aEntry += aStrHidden; - aLbDocuments.InsertEntry( aEntry ); + aLbDocuments->InsertEntry( aEntry ); if ( pManualSel && aHidden == *pManualSel ) aSelEntry = aEntry; } - aLbDocuments.SetUpdateMode( true ); + aLbDocuments->SetUpdateMode( true ); - aLbDocuments.SelectEntry( aSelEntry ); + aLbDocuments->SelectEntry( aSelEntry ); } void ScNavigatorDlg::MarkDataArea() @@ -1268,7 +1283,7 @@ void ScNavigatorDlg::UnmarkDataArea() void ScNavigatorDlg::CheckDataArea() { - if ( aTbxCmd.IsItemChecked( IID_DATA ) && pMarkArea ) + if ( aTbxCmd->IsItemChecked( IID_DATA ) && pMarkArea ) { if ( nCurTab != pMarkArea->nTab || nCurCol < pMarkArea->nColStart+1 @@ -1276,8 +1291,8 @@ void ScNavigatorDlg::CheckDataArea() || nCurRow < pMarkArea->nRowStart+1 || nCurRow > pMarkArea->nRowEnd+1 ) { - aTbxCmd.SetItemState( IID_DATA, TriState(TRISTATE_TRUE) ); - aTbxCmd.Select( IID_DATA ); + aTbxCmd->SetItemState( IID_DATA, TriState(TRISTATE_TRUE) ); + aTbxCmd->Select( IID_DATA ); } } } @@ -1295,7 +1310,7 @@ void ScNavigatorDlg::StartOfDataArea() SCCOL nCol = aMarkRange.aStart.Col(); SCROW nRow = aMarkRange.aStart.Row(); - if ( (nCol+1 != aEdCol.GetCol()) || (nRow+1 != aEdRow.GetRow()) ) + if ( (nCol+1 != aEdCol->GetCol()) || (nRow+1 != aEdRow->GetRow()) ) SetCurrentCell( nCol, nRow ); } } @@ -1313,7 +1328,7 @@ void ScNavigatorDlg::EndOfDataArea() SCCOL nCol = aMarkRange.aEnd.Col(); SCROW nRow = aMarkRange.aEnd.Row(); - if ( (nCol+1 != aEdCol.GetCol()) || (nRow+1 != aEdRow.GetRow()) ) + if ( (nCol+1 != aEdCol->GetCol()) || (nRow+1 != aEdRow->GetRow()) ) SetCurrentCell( nCol, nRow ); } } diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx index 96b37d81602d..7791cfff9990 100644 --- a/sc/source/ui/navipi/scenwnd.cxx +++ b/sc/source/ui/navipi/scenwnd.cxx @@ -197,23 +197,23 @@ void ScScenarioListBox::DeleteScenario( bool bQueryBox ) ScScenarioWindow::ScScenarioWindow( vcl::Window* pParent, const OUString& aQH_List, const OUString& aQH_Comment) : Window ( pParent, WB_TABSTOP | WB_DIALOGCONTROL ), - aLbScenario ( *this ), - aEdComment ( this, WB_BORDER | WB_LEFT | WB_READONLY | WB_VSCROLL | WB_TABSTOP ) + aLbScenario ( VclPtr<ScScenarioListBox>::Create(*this) ), + aEdComment ( VclPtr<MultiLineEdit>::Create(this, WB_BORDER | WB_LEFT | WB_READONLY | WB_VSCROLL | WB_TABSTOP) ) { vcl::Font aFont( GetFont() ); aFont.SetTransparent( true ); aFont.SetWeight( WEIGHT_LIGHT ); - aEdComment.SetFont( aFont ); - aEdComment.SetMaxTextLen( 512 ); - aLbScenario.SetPosPixel( Point(0,0) ); - aLbScenario.SetHelpId(HID_SC_SCENWIN_TOP); - aEdComment.SetHelpId(HID_SC_SCENWIN_BOTTOM); - aLbScenario.Show(); - aEdComment.Show(); - - aLbScenario.SetQuickHelpText(aQH_List); - aEdComment.SetQuickHelpText(aQH_Comment); - aEdComment.SetBackground( Color( COL_LIGHTGRAY ) ); + aEdComment->SetFont( aFont ); + aEdComment->SetMaxTextLen( 512 ); + aLbScenario->SetPosPixel( Point(0,0) ); + aLbScenario->SetHelpId(HID_SC_SCENWIN_TOP); + aEdComment->SetHelpId(HID_SC_SCENWIN_BOTTOM); + aLbScenario->Show(); + aEdComment->Show(); + + aLbScenario->SetQuickHelpText(aQH_List); + aEdComment->SetQuickHelpText(aQH_Comment); + aEdComment->SetBackground( Color( COL_LIGHTGRAY ) ); SfxViewFrame* pViewFrm = SfxViewFrame::Current(); if (pViewFrm) @@ -226,6 +226,14 @@ ScScenarioWindow::ScScenarioWindow( vcl::Window* pParent, const OUString& aQH_Li ScScenarioWindow::~ScScenarioWindow() { + disposeOnce(); +} + +void ScScenarioWindow::dispose() +{ + aLbScenario.disposeAndClear(); + aEdComment.disposeAndClear(); + vcl::Window::dispose(); } void ScScenarioWindow::Paint( const Rectangle& rRect ) @@ -242,26 +250,26 @@ void ScScenarioWindow::NotifyState( const SfxPoolItem* pState ) { if( pState ) { - aLbScenario.Enable(); + aLbScenario->Enable(); if ( pState->ISA(SfxStringItem) ) { OUString aNewEntry( static_cast<const SfxStringItem*>(pState)->GetValue() ); if ( !aNewEntry.isEmpty() ) - aLbScenario.SelectEntry( aNewEntry ); + aLbScenario->SelectEntry( aNewEntry ); else - aLbScenario.SetNoSelection(); + aLbScenario->SetNoSelection(); } else if ( pState->ISA(SfxStringListItem) ) { - aLbScenario.UpdateEntries( static_cast<const SfxStringListItem*>(pState)->GetList() ); + aLbScenario->UpdateEntries( static_cast<const SfxStringListItem*>(pState)->GetList() ); } } else { - aLbScenario.Disable(); - aLbScenario.SetNoSelection(); + aLbScenario->Disable(); + aLbScenario->SetNoSelection(); } } @@ -273,10 +281,10 @@ void ScScenarioWindow::SetSizePixel( const Size& rNewSize ) Window::SetSizePixel( aSize ); aSize.Height() = nHeight; - aLbScenario.SetSizePixel( aSize ); + aLbScenario->SetSizePixel( aSize ); aSize.Height() -= 4; - aEdComment.SetPosSizePixel( Point( 0, nHeight+4 ), aSize ); + aEdComment->SetPosSizePixel( Point( 0, nHeight+4 ), aSize ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index af06513fa587..92d88f6471ff 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -109,7 +109,25 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi mpTestButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, TestClickHdl)); } -ScCalcOptionsDialog::~ScCalcOptionsDialog() {} +ScCalcOptionsDialog::~ScCalcOptionsDialog() +{ + disposeOnce(); +} + +void ScCalcOptionsDialog::dispose() +{ + mpUseOpenCL.clear(); + mpSpinButton.clear(); + mpEditField.clear(); + mpTestButton.clear(); + mpFtFrequency.clear(); + mpFtComputeUnits.clear(); + mpFtMemory.clear(); + mpOpenclInfoList.clear(); + mpBtnAutomaticSelectionTrue.clear(); + mpBtnAutomaticSelectionFalse.clear(); + ModalDialog::dispose(); +} void ScCalcOptionsDialog::OpenCLAutomaticSelectionChanged() { diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index 08fad6cf17c3..254a18c1e0a2 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -36,6 +36,7 @@ class ScCalcOptionsDialog : public ModalDialog public: ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfig& rConfig); virtual ~ScCalcOptionsDialog(); + virtual void dispose() SAL_OVERRIDE; DECL_LINK( BtnAutomaticSelectHdl, void* ); DECL_LINK( DeviceSelHdl, void* ); @@ -62,22 +63,22 @@ private: #endif private: - - CheckBox* mpEmptyAsZero; - ListBox* mpConversion; - ListBox* mpSyntax; - CheckBox* mpUseOpenCL; - NumericField* mpSpinButton; - VclMultiLineEdit* mpEditField; - PushButton* mpTestButton; - - FixedText* mpFtFrequency; - FixedText* mpFtComputeUnits; - FixedText* mpFtMemory; - - SvTreeListBox* mpOpenclInfoList; - RadioButton* mpBtnAutomaticSelectionTrue; - RadioButton* mpBtnAutomaticSelectionFalse; + VclPtr<CheckBox> mpEmptyAsZero; + VclPtr<ListBox> mpConversion; + VclPtr<ListBox> mpSyntax; + + VclPtr<CheckBox> mpUseOpenCL; + VclPtr<NumericField> mpSpinButton; + VclPtr<VclMultiLineEdit> mpEditField; + VclPtr<PushButton> mpTestButton; + + VclPtr<FixedText> mpFtFrequency; + VclPtr<FixedText> mpFtComputeUnits; + VclPtr<FixedText> mpFtMemory; + + VclPtr<SvTreeListBox> mpOpenclInfoList; + VclPtr<RadioButton> mpBtnAutomaticSelectionTrue; + VclPtr<RadioButton> mpBtnAutomaticSelectionFalse; OUString maSoftware; diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx index b19eac983ea9..f0deec661e62 100644 --- a/sc/source/ui/optdlg/opredlin.cxx +++ b/sc/source/ui/optdlg/opredlin.cxx @@ -57,11 +57,21 @@ ScRedlineOptionsTabPage::ScRedlineOptionsTabPage( vcl::Window* pParent, ScRedlineOptionsTabPage::~ScRedlineOptionsTabPage() { + disposeOnce(); } -SfxTabPage* ScRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +void ScRedlineOptionsTabPage::dispose() { - return new ScRedlineOptionsTabPage( pParent, *rSet ); + m_pContentColorLB.clear(); + m_pRemoveColorLB.clear(); + m_pInsertColorLB.clear(); + m_pMoveColorLB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> ScRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +{ + return VclPtr<ScRedlineOptionsTabPage>::Create( pParent, *rSet ); } bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 2bbb450b7482..74cbf8878709 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -66,8 +66,30 @@ ScTpCalcOptions::ScTpCalcOptions(vcl::Window* pParent, const SfxItemSet& rCoreAt ScTpCalcOptions::~ScTpCalcOptions() { + disposeOnce(); +} + +void ScTpCalcOptions::dispose() +{ delete pOldOptions; delete pLocalOptions; + m_pBtnIterate.clear(); + m_pFtSteps.clear(); + m_pEdSteps.clear(); + m_pFtEps.clear(); + m_pEdEps.clear(); + m_pBtnDateStd.clear(); + m_pBtnDateSc10.clear(); + m_pBtnDate1904.clear(); + m_pBtnCase.clear(); + m_pBtnCalc.clear(); + m_pBtnMatch.clear(); + m_pBtnRegex.clear(); + m_pBtnLookUp.clear(); + m_pBtnGeneralPrec.clear(); + m_pFtPrec.clear(); + m_pEdPrec.clear(); + SfxTabPage::dispose(); } void ScTpCalcOptions::Init() @@ -79,9 +101,9 @@ void ScTpCalcOptions::Init() m_pBtnDate1904->SetClickHdl( LINK( this, ScTpCalcOptions, RadioClickHdl ) ); } -SfxTabPage* ScTpCalcOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> ScTpCalcOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return ( new ScTpCalcOptions( pParent, *rAttrSet ) ); + return VclPtr<SfxTabPage>( new ScTpCalcOptions ( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); } void ScTpCalcOptions::Reset( const SfxItemSet* /* rCoreAttrs */ ) diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx index cceae3f5a8e0..ca828292c7db 100644 --- a/sc/source/ui/optdlg/tpcompatibility.cxx +++ b/sc/source/ui/optdlg/tpcompatibility.cxx @@ -23,11 +23,18 @@ ScTpCompatOptions::ScTpCompatOptions(vcl::Window *pParent, const SfxItemSet &rCo ScTpCompatOptions::~ScTpCompatOptions() { + disposeOnce(); } -SfxTabPage* ScTpCompatOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs) +void ScTpCompatOptions::dispose() { - return new ScTpCompatOptions(pParent, *rCoreAttrs); + m_pLbKeyBindings.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> ScTpCompatOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs) +{ + return VclPtr<SfxTabPage>(new ScTpCompatOptions(pParent, *rCoreAttrs), SAL_NO_ACQUIRE); } bool ScTpCompatOptions::FillItemSet(SfxItemSet *rCoreAttrs) diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx index d9123a424ccf..79b8475a5145 100644 --- a/sc/source/ui/optdlg/tpdefaults.cxx +++ b/sc/source/ui/optdlg/tpdefaults.cxx @@ -30,11 +30,19 @@ ScTpDefaultsOptions::ScTpDefaultsOptions(vcl::Window *pParent, const SfxItemSet ScTpDefaultsOptions::~ScTpDefaultsOptions() { + disposeOnce(); } -SfxTabPage* ScTpDefaultsOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs) +void ScTpDefaultsOptions::dispose() { - return new ScTpDefaultsOptions(pParent, *rCoreAttrs); + m_pEdNSheets.clear(); + m_pEdSheetPrefix.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> ScTpDefaultsOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs) +{ + return VclPtr<SfxTabPage>(new ScTpDefaultsOptions(pParent, *rCoreAttrs), SAL_NO_ACQUIRE); } bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet) diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index 63a807db14cc..1f6416fc7197 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -81,6 +81,23 @@ ScTpFormulaOptions::ScTpFormulaOptions(vcl::Window* pParent, const SfxItemSet& r ScTpFormulaOptions::~ScTpFormulaOptions() { + disposeOnce(); +} + +void ScTpFormulaOptions::dispose() +{ + mpLbFormulaSyntax.clear(); + mpCbEnglishFuncName.clear(); + mpBtnCustomCalcDefault.clear(); + mpBtnCustomCalcCustom.clear(); + mpBtnCustomCalcDetails.clear(); + mpEdSepFuncArg.clear(); + mpEdSepArrayCol.clear(); + mpEdSepArrayRow.clear(); + mpBtnSepReset.clear(); + mpLbOOXMLRecalcOptions.clear(); + mpLbODFRecalcOptions.clear(); + SfxTabPage::dispose(); } void ScTpFormulaOptions::ResetSeparators() @@ -122,10 +139,10 @@ void ScTpFormulaOptions::UpdateCustomCalcRadioButtons(bool bDefault) void ScTpFormulaOptions::LaunchCustomCalcSettings() { - ScCalcOptionsDialog aDlg(this, maCurrentConfig); - if (aDlg.Execute() == RET_OK) + ScopedVclPtrInstance< ScCalcOptionsDialog > aDlg(this, maCurrentConfig); + if (aDlg->Execute() == RET_OK) { - maCurrentConfig = aDlg.GetConfig(); + maCurrentConfig = aDlg->GetConfig(); } } @@ -220,9 +237,9 @@ IMPL_LINK( ScTpFormulaOptions, SepEditOnFocusHdl, Edit*, pEdit ) return 0; } -SfxTabPage* ScTpFormulaOptions::Create(vcl::Window* pParent, const SfxItemSet* rCoreSet) +VclPtr<SfxTabPage> ScTpFormulaOptions::Create(vcl::Window* pParent, const SfxItemSet* rCoreSet) { - return new ScTpFormulaOptions(pParent, *rCoreSet); + return VclPtr<SfxTabPage>(new ScTpFormulaOptions(pParent, *rCoreSet), SAL_NO_ACQUIRE); } bool ScTpFormulaOptions::FillItemSet(SfxItemSet* rCoreSet) diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx index c3f640cdfeb8..e38c830431d0 100644 --- a/sc/source/ui/optdlg/tpprint.cxx +++ b/sc/source/ui/optdlg/tpprint.cxx @@ -41,11 +41,20 @@ ScTpPrintOptions::ScTpPrintOptions( vcl::Window* pParent, ScTpPrintOptions::~ScTpPrintOptions() { + disposeOnce(); } -SfxTabPage* ScTpPrintOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +void ScTpPrintOptions::dispose() { - return new ScTpPrintOptions( pParent, *rAttrSet ); + m_pSkipEmptyPagesCB.clear(); + m_pSelectedSheetsCB.clear(); + m_pForceBreaksCB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> ScTpPrintOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>(new ScTpPrintOptions( pParent, *rAttrSet ), SAL_NO_ACQUIRE); } SfxTabPage::sfxpg ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP ) diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index cc97343c182b..fc96ec7aca05 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -84,8 +84,26 @@ ScTpUserLists::ScTpUserLists( vcl::Window* pParent, ScTpUserLists::~ScTpUserLists() { + disposeOnce(); +} + +void ScTpUserLists::dispose() +{ delete pUserLists; delete pRangeUtil; + mpFtLists.clear(); + mpLbLists.clear(); + mpFtEntries.clear(); + mpEdEntries.clear(); + mpFtCopyFrom.clear(); + mpEdCopyFrom.clear(); + mpBtnNew.clear(); + mpBtnDiscard.clear(); + mpBtnAdd.clear(); + mpBtnModify.clear(); + mpBtnRemove.clear(); + mpBtnCopy.clear(); + SfxTabPage::dispose(); } void ScTpUserLists::Init() @@ -135,9 +153,9 @@ void ScTpUserLists::Init() } -SfxTabPage* ScTpUserLists::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> ScTpUserLists::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return ( new ScTpUserLists( pParent, *rAttrSet ) ); + return VclPtr<SfxTabPage>( new ScTpUserLists( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); } void ScTpUserLists::Reset( const SfxItemSet* rCoreAttrs ) diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index a8a1532d2e17..251285e85f64 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -95,13 +95,40 @@ ScTpContentOptions::ScTpContentOptions( vcl::Window* pParent, ScTpContentOptions::~ScTpContentOptions() { + disposeOnce(); +} + +void ScTpContentOptions::dispose() +{ delete pLocalOptions; + pGridLB.clear(); + pColorFT.clear(); + pColorLB.clear(); + pBreakCB.clear(); + pGuideLineCB.clear(); + pFormulaCB.clear(); + pNilCB.clear(); + pAnnotCB.clear(); + pValueCB.clear(); + pAnchorCB.clear(); + pClipMarkCB.clear(); + pRangeFindCB.clear(); + pObjGrfLB.clear(); + pDiagramLB.clear(); + pDrawLB.clear(); + pSyncZoomCB.clear(); + pRowColHeaderCB.clear(); + pHScrollCB.clear(); + pVScrollCB.clear(); + pTblRegCB.clear(); + pOutlineCB.clear(); + SfxTabPage::dispose(); } -SfxTabPage* ScTpContentOptions::Create( vcl::Window* pParent, - const SfxItemSet* rCoreSet ) +VclPtr<SfxTabPage> ScTpContentOptions::Create( vcl::Window* pParent, + const SfxItemSet* rCoreSet ) { - return new ScTpContentOptions(pParent, *rCoreSet); + return VclPtr<SfxTabPage>( new ScTpContentOptions (pParent, *rCoreSet), SAL_NO_ACQUIRE ); } bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet ) @@ -406,12 +433,34 @@ ScTpLayoutOptions::ScTpLayoutOptions( vcl::Window* pParent, ScTpLayoutOptions::~ScTpLayoutOptions() { + disposeOnce(); } -SfxTabPage* ScTpLayoutOptions::Create( vcl::Window* pParent, - const SfxItemSet* rCoreSet ) +void ScTpLayoutOptions::dispose() +{ + m_pUnitLB.clear(); + m_pTabMF.clear(); + m_pAlwaysRB.clear(); + m_pRequestRB.clear(); + m_pNeverRB.clear(); + m_pAlignCB.clear(); + m_pAlignLB.clear(); + m_pEditModeCB.clear(); + m_pFormatCB.clear(); + m_pExpRefCB.clear(); + m_pSortRefUpdateCB.clear(); + m_pMarkHdrCB.clear(); + m_pTextFmtCB.clear(); + m_pReplWarnCB.clear(); + m_pLegacyCellSelectionCB.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> ScTpLayoutOptions::Create( vcl::Window* pParent, + const SfxItemSet* rCoreSet ) { - ScTpLayoutOptions* pNew = new ScTpLayoutOptions(pParent, *rCoreSet); + VclPtr<ScTpLayoutOptions> pNew( new ScTpLayoutOptions( pParent, *rCoreSet), SAL_NO_ACQUIRE ); ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current()); if(pDocSh!=NULL) diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index c95aa13cc69b..1985e09eb118 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -136,6 +136,11 @@ ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Win ScPrintAreasDlg::~ScPrintAreasDlg() { + disposeOnce(); +} + +void ScPrintAreasDlg::dispose() +{ // Extra-Data an ListBox-Entries abraeumen ListBox* aLb[3] = { pLbPrintArea, pLbRepeatRow, pLbRepeatCol }; @@ -145,6 +150,19 @@ ScPrintAreasDlg::~ScPrintAreasDlg() for ( sal_uInt16 j=0; j<nCount; j++ ) delete static_cast<OUString*>(aLb[i]->GetEntryData(j)); } + pLbPrintArea.clear(); + pEdPrintArea.clear(); + pRbPrintArea.clear(); + pLbRepeatRow.clear(); + pEdRepeatRow.clear(); + pRbRepeatRow.clear(); + pLbRepeatCol.clear(); + pEdRepeatCol.clear(); + pRbRepeatCol.clear(); + pBtnOk.clear(); + pBtnCancel.clear(); + pRefInputEdit.clear(); + ScAnyRefDlg::dispose(); } bool ScPrintAreasDlg::Close() diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx index dcac934968eb..f5c4fe85799b 100644 --- a/sc/source/ui/pagedlg/scuitphfedit.cxx +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -152,6 +152,32 @@ IMPL_LINK( ScHFEditPage, ObjectSelectHdl, ScEditWindow*, pEdit ) ScHFEditPage::~ScHFEditPage() { + disposeOnce(); +} + +void ScHFEditPage::dispose() +{ + m_pWndLeft.clear(); + m_pWndCenter.clear(); + m_pWndRight.clear(); + m_pFtDefinedHF.clear(); + m_pLbDefined.clear(); + m_pFtCustomHF.clear(); + m_pBtnText.clear(); + m_pBtnFile.clear(); + m_pBtnTable.clear(); + m_pBtnPage.clear(); + m_pBtnLastPage.clear(); + m_pBtnDate.clear(); + m_pBtnTime.clear(); + m_pFtConfidential.clear(); + m_pFtPage.clear(); + m_pFtOfQuestion.clear(); + m_pFtOf.clear(); + m_pFtNone.clear(); + m_pFtCreatedBy.clear(); + m_pFtCustomized.clear(); + SfxTabPage::dispose(); } void ScHFEditPage::SetNumType(SvxNumType eNumType) @@ -834,8 +860,8 @@ ScRightHeaderEditPage::ScRightHeaderEditPage( vcl::Window* pParent, const SfxIte true ) {} -SfxTabPage* ScRightHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return ( new ScRightHeaderEditPage( pParent, *rCoreSet ) ); }; +VclPtr<SfxTabPage> ScRightHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) + { return VclPtr<SfxTabPage>( new ScRightHeaderEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); } // class ScLeftHeaderEditPage @@ -846,8 +872,8 @@ ScLeftHeaderEditPage::ScLeftHeaderEditPage( vcl::Window* pParent, const SfxItemS true ) {} -SfxTabPage* ScLeftHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return ( new ScLeftHeaderEditPage( pParent, *rCoreSet ) ); }; +VclPtr<SfxTabPage> ScLeftHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) + { return VclPtr<SfxTabPage>( new ScLeftHeaderEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); }; // class ScRightFooterEditPage @@ -858,8 +884,8 @@ ScRightFooterEditPage::ScRightFooterEditPage( vcl::Window* pParent, const SfxIte false ) {} -SfxTabPage* ScRightFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return ( new ScRightFooterEditPage( pParent, *rCoreSet ) ); }; +VclPtr<SfxTabPage> ScRightFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) + { return VclPtr<SfxTabPage>( new ScRightFooterEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); }; // class ScLeftFooterEditPage @@ -870,7 +896,7 @@ ScLeftFooterEditPage::ScLeftFooterEditPage( vcl::Window* pParent, const SfxItemS false ) {} -SfxTabPage* ScLeftFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return ( new ScLeftFooterEditPage( pParent, *rCoreSet ) ); }; +VclPtr<SfxTabPage> ScLeftFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) + { return VclPtr<SfxTabPage>( new ScLeftFooterEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx index c09f0cd2be99..70a5efcdcfbb 100644 --- a/sc/source/ui/pagedlg/tphf.cxx +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -78,6 +78,14 @@ ScHFPage::ScHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSe ScHFPage::~ScHFPage() { + disposeOnce(); +} + +void ScHFPage::dispose() +{ + m_pBtnEdit.clear(); + pStyleDlg.clear(); + SvxHFPage::dispose(); } void ScHFPage::Reset( const SfxItemSet* rSet ) @@ -193,7 +201,7 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl) else { OUString aText; - boost::scoped_ptr<SfxSingleTabDialog> pDlg(new SfxSingleTabDialog(this, aDataSet)); + VclPtrInstance< SfxSingleTabDialog > pDlg(this, aDataSet); const int nSettingsId = 42; bool bRightPage = m_pCntSharedBox->IsChecked() || ( SVX_PAGE_LEFT != SvxPageUsage(nPageUsage) ); @@ -239,9 +247,9 @@ ScHeaderPage::ScHeaderPage( vcl::Window* pParent, const SfxItemSet& rSet ) { } -SfxTabPage* ScHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) +VclPtr<SfxTabPage> ScHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { - return ( new ScHeaderPage( pParent, *rCoreSet ) ); + return VclPtr<SfxTabPage>( new ScHeaderPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); } const sal_uInt16* ScHeaderPage::GetRanges() @@ -256,9 +264,9 @@ ScFooterPage::ScFooterPage( vcl::Window* pParent, const SfxItemSet& rSet ) { } -SfxTabPage* ScFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) +VclPtr<SfxTabPage> ScFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { - return ( new ScFooterPage( pParent, *rCoreSet ) ); + return VclPtr<SfxTabPage>( new ScFooterPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); } const sal_uInt16* ScFooterPage::GetRanges() diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index 8f0a1b4a578b..87eded513c08 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -118,6 +118,11 @@ void ScEditWindow::Resize() ScEditWindow::~ScEditWindow() { + disposeOnce(); +} + +void ScEditWindow::dispose() +{ // delete Accessible object before deleting EditEngine and EditView if (pAcc) { @@ -127,6 +132,7 @@ ScEditWindow::~ScEditWindow() } delete pEdEngine; delete pEdView; + Control::dispose(); } extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScEditWindow(vcl::Window *pParent, VclBuilder::stringmap &) diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx index 6de677e6cb52..910bc3f4423b 100644 --- a/sc/source/ui/pagedlg/tptable.cxx +++ b/sc/source/ui/pagedlg/tptable.cxx @@ -125,11 +125,38 @@ void ScTablePage::ShowImage() ScTablePage::~ScTablePage() { + disposeOnce(); } -SfxTabPage* ScTablePage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) +void ScTablePage::dispose() { - return ( new ScTablePage( pParent, *rCoreSet ) ); + m_pBtnTopDown.clear(); + m_pBtnLeftRight.clear(); + m_pBmpPageDir.clear(); + m_pBtnPageNo.clear(); + m_pEdPageNo.clear(); + m_pBtnHeaders.clear(); + m_pBtnGrid.clear(); + m_pBtnNotes.clear(); + m_pBtnObjects.clear(); + m_pBtnCharts.clear(); + m_pBtnDrawings.clear(); + m_pBtnFormulas.clear(); + m_pBtnNullVals.clear(); + m_pLbScaleMode.clear(); + m_pBxScaleAll.clear(); + m_pEdScaleAll.clear(); + m_pGrHeightWidth.clear(); + m_pEdScalePageWidth.clear(); + m_pEdScalePageHeight.clear(); + m_pBxScalePageNum.clear(); + m_pEdScalePageNum.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> ScTablePage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) +{ + return VclPtr<SfxTabPage>( new ScTablePage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); } void ScTablePage::Reset( const SfxItemSet* rCoreSet ) diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index e10b53830ffb..d1da58a3cd47 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -68,6 +68,28 @@ AlignmentPropertyPanel::AlignmentPropertyPanel( AlignmentPropertyPanel::~AlignmentPropertyPanel() { + disposeOnce(); +} + +void AlignmentPropertyPanel::dispose() +{ + mpFTLeftIndent.clear(); + mpMFLeftIndent.clear(); + mpCBXWrapText.clear(); + mpCBXMergeCell.clear(); + mpFtRotate.clear(); + mpCtrlDial.clear(); + mpMtrAngle.clear(); + mpCbStacked.clear(); + + maAlignHorControl.dispose(); + maLeftIndentControl.dispose(); + maMergeCellControl.dispose(); + maWrapTextControl.dispose(); + maAngleControl.dispose(); + maStackControl.dispose(); + + PanelLayout::dispose(); } void AlignmentPropertyPanel::Initialize() @@ -204,7 +226,7 @@ IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG) return 0; } -AlignmentPropertyPanel* AlignmentPropertyPanel::Create ( +VclPtr<vcl::Window> AlignmentPropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -216,10 +238,8 @@ AlignmentPropertyPanel* AlignmentPropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to AlignmentPropertyPanel::Create", NULL, 2); - return new AlignmentPropertyPanel( - pParent, - rxFrame, - pBindings); + return VclPtr<AlignmentPropertyPanel>::Create( + pParent, rxFrame, pBindings); } void AlignmentPropertyPanel::DataChanged( diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx index 050c79d48b63..dab38a72a3ef 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx @@ -39,7 +39,7 @@ class AlignmentPropertyPanel public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: - static AlignmentPropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -58,16 +58,24 @@ public: SfxBindings* GetBindings() { return mpBindings;} + // constructor/destuctor + AlignmentPropertyPanel( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~AlignmentPropertyPanel(); + virtual void dispose() SAL_OVERRIDE; + private: //ui controls - FixedText* mpFTLeftIndent; - MetricField* mpMFLeftIndent; - CheckBox* mpCBXWrapText; - CheckBox* mpCBXMergeCell; - FixedText* mpFtRotate; - svx::sidebar::SidebarDialControl* mpCtrlDial; - MetricBox* mpMtrAngle; - CheckBox* mpCbStacked; + VclPtr<FixedText> mpFTLeftIndent; + VclPtr<MetricField> mpMFLeftIndent; + VclPtr<CheckBox> mpCBXWrapText; + VclPtr<CheckBox> mpCBXMergeCell; + VclPtr<FixedText> mpFtRotate; + VclPtr<svx::sidebar::SidebarDialControl> mpCtrlDial; + VclPtr<MetricBox> mpMtrAngle; + VclPtr<CheckBox> mpCbStacked; ::sfx2::sidebar::ControllerItem maAlignHorControl; ::sfx2::sidebar::ControllerItem maLeftIndentControl; @@ -90,13 +98,6 @@ private: DECL_LINK( RotationHdl, void * ); DECL_LINK( ClickStackHdl, void * ); - // constructor/destuctor - AlignmentPropertyPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); - virtual ~AlignmentPropertyPanel(); - void Initialize(); void FormatDegrees(double& dTmp); }; diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index 38c0154d3785..b3012fab9141 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -142,6 +142,24 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel( CellAppearancePropertyPanel::~CellAppearancePropertyPanel() { + disposeOnce(); +} + +void CellAppearancePropertyPanel::dispose() +{ + mpTBCellBorder.clear(); + mpTBLineStyle.clear(); + mpTBLineColor.clear(); + mpCBXShowGrid.clear(); + + maLineStyleControl.dispose(); + maBorderOuterControl.dispose(); + maBorderInnerControl.dispose(); + maGridShowControl.dispose(); + maBorderTLBRControl.dispose(); + maBorderBLTRControl.dispose(); + + PanelLayout::dispose(); } void CellAppearancePropertyPanel::Initialize() @@ -225,7 +243,7 @@ IMPL_LINK(CellAppearancePropertyPanel, CBOXGridShowClkHdl, void*, EMPTYARG) return 0; } -CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create ( +VclPtr<vcl::Window> CellAppearancePropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -237,10 +255,8 @@ CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to CellAppearancePropertyPanel::Create", NULL, 2); - return new CellAppearancePropertyPanel( - pParent, - rxFrame, - pBindings); + return VclPtr<CellAppearancePropertyPanel>::Create( + pParent, rxFrame, pBindings); } void CellAppearancePropertyPanel::DataChanged( diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx index eb9e7dc45eb7..fc0395687e2a 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx @@ -50,7 +50,7 @@ private: friend class CellBorderStyleControl; public: - static CellAppearancePropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -69,14 +69,22 @@ public: SfxBindings* GetBindings() { return mpBindings;} + // constructor/destuctor + CellAppearancePropertyPanel( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~CellAppearancePropertyPanel(); + virtual void dispose() SAL_OVERRIDE; + private: //ui controls - ToolBox* mpTBCellBorder; - ToolBox* mpTBLineStyle; - ToolBox* mpTBLineColor; + VclPtr<ToolBox> mpTBCellBorder; + VclPtr<ToolBox> mpTBLineStyle; + VclPtr<ToolBox> mpTBLineColor; ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater; - CheckBox* mpCBXShowGrid; + VclPtr<CheckBox> mpCBXShowGrid; ::sfx2::sidebar::ControllerItem maLineStyleControl; ::sfx2::sidebar::ControllerItem maBorderOuterControl; @@ -145,13 +153,6 @@ private: svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent); void EndCellBorderStylePopupMode(); - // constructor/destuctor - CellAppearancePropertyPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); - virtual ~CellAppearancePropertyPanel(); - void Initialize(); void SetStyleIcon(); void UpdateControlState(); diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/sc/source/ui/sidebar/CellBorderStyleControl.cxx index ad6507dcda71..ff09bcf7b5b0 100644 --- a/sc/source/ui/sidebar/CellBorderStyleControl.cxx +++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx @@ -45,11 +45,11 @@ namespace sc { namespace sidebar { CellBorderStyleControl::CellBorderStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel) : svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE)), mrCellAppearancePropertyPanel(rPanel), - maTBBorder1(this, ScResId(TB_BORDER1)), - maTBBorder2(this, ScResId(TB_BORDER2)), - maTBBorder3(this, ScResId(TB_BORDER3)), - maFL1(this, ScResId(FL_1)), - maFL2(this, ScResId(FL_2)), + maTBBorder1(VclPtr<ToolBox>::Create(this, ScResId(TB_BORDER1))), + maTBBorder2(VclPtr<ToolBox>::Create(this, ScResId(TB_BORDER2))), + maTBBorder3(VclPtr<ToolBox>::Create(this, ScResId(TB_BORDER3))), + maFL1(VclPtr<FixedLine>::Create(this, ScResId(FL_1))), + maFL2(VclPtr<FixedLine>::Create(this, ScResId(FL_2))), mpImageList(0) { Initialize(); @@ -58,7 +58,18 @@ CellBorderStyleControl::CellBorderStyleControl(vcl::Window* pParent, CellAppeara CellBorderStyleControl::~CellBorderStyleControl() { + disposeOnce(); +} + +void CellBorderStyleControl::dispose() +{ delete[] mpImageList; + maTBBorder1.disposeAndClear(); + maTBBorder2.disposeAndClear(); + maTBBorder3.disposeAndClear(); + maFL1.disposeAndClear(); + maFL2.disposeAndClear(); + svx::sidebar::PopupControl::dispose(); } void CellBorderStyleControl::Initialize() @@ -81,60 +92,60 @@ void CellBorderStyleControl::Initialize() mpImageList[14] = Image(ScResId(IMG_BORDER15)); mpImageList[15] = Image(ScResId(IMG_BORDER16)); - maTBBorder1.SetItemImage(TBI_BORDER1_NONE, mpImageList[0]); - maTBBorder1.SetItemImage(TBI_BORDER1_ALL, mpImageList[1]); - maTBBorder1.SetItemImage(TBI_BORDER1_OUTER, mpImageList[2]); - maTBBorder1.SetItemImage(TBI_BORDER1_OUTERBOLD, mpImageList[3]); - maTBBorder1.SetBackground(Wallpaper()); - maTBBorder1.SetPaintTransparent(true); - Size aTbxSize( maTBBorder1.CalcWindowSizePixel() ); - maTBBorder1.SetOutputSizePixel( aTbxSize ); + maTBBorder1->SetItemImage(TBI_BORDER1_NONE, mpImageList[0]); + maTBBorder1->SetItemImage(TBI_BORDER1_ALL, mpImageList[1]); + maTBBorder1->SetItemImage(TBI_BORDER1_OUTER, mpImageList[2]); + maTBBorder1->SetItemImage(TBI_BORDER1_OUTERBOLD, mpImageList[3]); + maTBBorder1->SetBackground(Wallpaper()); + maTBBorder1->SetPaintTransparent(true); + Size aTbxSize( maTBBorder1->CalcWindowSizePixel() ); + maTBBorder1->SetOutputSizePixel( aTbxSize ); Link aLink = LINK(this, CellBorderStyleControl, TB1SelectHdl); - maTBBorder1.SetSelectHdl ( aLink ); + maTBBorder1->SetSelectHdl ( aLink ); - maTBBorder2.SetLineCount(2); - maTBBorder2.InsertItem(TBI_BORDER2_LEFT, mpImageList[4]); - maTBBorder2.InsertItem(TBI_BORDER2_RIGHT, mpImageList[5]); - maTBBorder2.InsertItem(TBI_BORDER2_TOP, mpImageList[6]); - maTBBorder2.InsertItem(TBI_BORDER2_BOT, mpImageList[7]); - maTBBorder2.InsertBreak(); - maTBBorder2.InsertItem(TBI_BORDER2_BLTR, mpImageList[8]); - maTBBorder2.InsertItem(TBI_BORDER2_TLBR, mpImageList[9]); - maTBBorder2.InsertItem(TBI_BORDER2_TOPBOT, mpImageList[10]); - maTBBorder2.InsertItem(TBI_BORDER2_LEFTRIGHT, mpImageList[11]); - maTBBorder2.SetBackground(Wallpaper()); - maTBBorder2.SetPaintTransparent(true); - aTbxSize = maTBBorder2.CalcWindowSizePixel() ; - maTBBorder2.SetOutputSizePixel( aTbxSize ); - maTBBorder2.SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); - maTBBorder2.SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); - maTBBorder2.SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); - maTBBorder2.SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); - maTBBorder2.SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); - maTBBorder2.SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); - maTBBorder2.SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); - maTBBorder2.SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); - maTBBorder2.SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); - maTBBorder2.SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); - maTBBorder2.SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); - maTBBorder2.SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); - maTBBorder2.SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); - maTBBorder2.SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); - maTBBorder2.SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); - maTBBorder2.SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); + maTBBorder2->SetLineCount(2); + maTBBorder2->InsertItem(TBI_BORDER2_LEFT, mpImageList[4]); + maTBBorder2->InsertItem(TBI_BORDER2_RIGHT, mpImageList[5]); + maTBBorder2->InsertItem(TBI_BORDER2_TOP, mpImageList[6]); + maTBBorder2->InsertItem(TBI_BORDER2_BOT, mpImageList[7]); + maTBBorder2->InsertBreak(); + maTBBorder2->InsertItem(TBI_BORDER2_BLTR, mpImageList[8]); + maTBBorder2->InsertItem(TBI_BORDER2_TLBR, mpImageList[9]); + maTBBorder2->InsertItem(TBI_BORDER2_TOPBOT, mpImageList[10]); + maTBBorder2->InsertItem(TBI_BORDER2_LEFTRIGHT, mpImageList[11]); + maTBBorder2->SetBackground(Wallpaper()); + maTBBorder2->SetPaintTransparent(true); + aTbxSize = maTBBorder2->CalcWindowSizePixel() ; + maTBBorder2->SetOutputSizePixel( aTbxSize ); + maTBBorder2->SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); + maTBBorder2->SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); + maTBBorder2->SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); + maTBBorder2->SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); + maTBBorder2->SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); + maTBBorder2->SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); + maTBBorder2->SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); + maTBBorder2->SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); + maTBBorder2->SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); + maTBBorder2->SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); + maTBBorder2->SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); + maTBBorder2->SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); + maTBBorder2->SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); + maTBBorder2->SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); + maTBBorder2->SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); + maTBBorder2->SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); aLink = LINK(this, CellBorderStyleControl, TB2SelectHdl); - maTBBorder2.SetSelectHdl ( aLink ); + maTBBorder2->SetSelectHdl ( aLink ); - maTBBorder3.SetItemImage(TBI_BORDER3_S1, mpImageList[12]); - maTBBorder3.SetItemImage(TBI_BORDER3_S2, mpImageList[13]); - maTBBorder3.SetItemImage(TBI_BORDER3_S3, mpImageList[14]); - maTBBorder3.SetItemImage(TBI_BORDER3_S4, mpImageList[15]); - maTBBorder3.SetBackground(Wallpaper()); - maTBBorder3.SetPaintTransparent(true); - aTbxSize = maTBBorder3.CalcWindowSizePixel() ; - maTBBorder3.SetOutputSizePixel( aTbxSize ); + maTBBorder3->SetItemImage(TBI_BORDER3_S1, mpImageList[12]); + maTBBorder3->SetItemImage(TBI_BORDER3_S2, mpImageList[13]); + maTBBorder3->SetItemImage(TBI_BORDER3_S3, mpImageList[14]); + maTBBorder3->SetItemImage(TBI_BORDER3_S4, mpImageList[15]); + maTBBorder3->SetBackground(Wallpaper()); + maTBBorder3->SetPaintTransparent(true); + aTbxSize = maTBBorder3->CalcWindowSizePixel() ; + maTBBorder3->SetOutputSizePixel( aTbxSize ); aLink = LINK(this, CellBorderStyleControl, TB3SelectHdl); - maTBBorder3.SetSelectHdl ( aLink ); + maTBBorder3->SetSelectHdl ( aLink ); } IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.hxx b/sc/source/ui/sidebar/CellBorderStyleControl.hxx index cf0db80ae3ef..706d10e7b11c 100644 --- a/sc/source/ui/sidebar/CellBorderStyleControl.hxx +++ b/sc/source/ui/sidebar/CellBorderStyleControl.hxx @@ -32,11 +32,11 @@ class CellBorderStyleControl : public svx::sidebar::PopupControl { private: CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; - ToolBox maTBBorder1; - ToolBox maTBBorder2; - ToolBox maTBBorder3; - FixedLine maFL1; - FixedLine maFL2; + VclPtr<ToolBox> maTBBorder1; + VclPtr<ToolBox> maTBBorder2; + VclPtr<ToolBox> maTBBorder3; + VclPtr<FixedLine> maFL1; + VclPtr<FixedLine> maFL2; Image* mpImageList; void Initialize(); @@ -48,6 +48,7 @@ private: public: CellBorderStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel); virtual ~CellBorderStyleControl(); + virtual void dispose() SAL_OVERRIDE; }; } } // end of namespace svx::sidebar diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx index ac4d3467327b..0528df76bc98 100644 --- a/sc/source/ui/sidebar/CellLineStyleControl.cxx +++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx @@ -36,27 +36,39 @@ namespace sc { namespace sidebar { CellLineStyleControl::CellLineStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel) : svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE)), mrCellAppearancePropertyPanel(rPanel), - maPushButtonMoreOptions(this, ScResId(PB_OPTIONS)), - maCellLineStyleValueSet(this, ScResId(VS_STYLE)), + maPushButtonMoreOptions(VclPtr<PushButton>::Create(this, ScResId(PB_OPTIONS))), + maCellLineStyleValueSet(VclPtr<sc::sidebar::CellLineStyleValueSet>::Create(this, ScResId(VS_STYLE))), mbVSfocus(true) { Initialize(); FreeResource(); } +CellLineStyleControl::~CellLineStyleControl() +{ + disposeOnce(); +} + +void CellLineStyleControl::dispose() +{ + maPushButtonMoreOptions.disposeAndClear(); + maCellLineStyleValueSet.disposeAndClear(); + svx::sidebar::PopupControl::dispose(); +} + void CellLineStyleControl::Initialize() { - //maPushButtonMoreOptions.SetIcoPosX(2); + //maPushButtonMoreOptions->SetIcoPosX(2); Link aLink = LINK(this, CellLineStyleControl, PBClickHdl); - maPushButtonMoreOptions.SetClickHdl(aLink); + maPushButtonMoreOptions->SetClickHdl(aLink); - maCellLineStyleValueSet.SetStyle(maCellLineStyleValueSet.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT); - maCellLineStyleValueSet.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); - maCellLineStyleValueSet.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + maCellLineStyleValueSet->SetStyle(maCellLineStyleValueSet->GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT); + maCellLineStyleValueSet->SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); + maCellLineStyleValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); for(sal_uInt16 i = 1 ; i <= 9 ; i++) { - maCellLineStyleValueSet.InsertItem(i); + maCellLineStyleValueSet->InsertItem(i); } maStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ) + "pt"; @@ -68,46 +80,46 @@ void CellLineStyleControl::Initialize() maStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ) + "pt"; maStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ) + "pt"; maStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ) + "pt"; - maCellLineStyleValueSet.SetUnit(&maStr[0]); + maCellLineStyleValueSet->SetUnit(&maStr[0]); for (sal_uInt16 i = 1; i <= CELL_LINE_STYLE_ENTRIES; ++i) { - maCellLineStyleValueSet.SetItemText(i, maStr[i-1]); + maCellLineStyleValueSet->SetItemText(i, maStr[i-1]); } SetAllNoSel(); aLink = LINK(this, CellLineStyleControl, VSSelectHdl); - maCellLineStyleValueSet.SetSelectHdl(aLink); - maCellLineStyleValueSet.StartSelection(); - maCellLineStyleValueSet.Show(); + maCellLineStyleValueSet->SetSelectHdl(aLink); + maCellLineStyleValueSet->StartSelection(); + maCellLineStyleValueSet->Show(); } void CellLineStyleControl::GetFocus() { if(!mbVSfocus) { - maPushButtonMoreOptions.GrabFocus(); + maPushButtonMoreOptions->GrabFocus(); } else { - maCellLineStyleValueSet.GrabFocus(); + maCellLineStyleValueSet->GrabFocus(); } } void CellLineStyleControl::SetAllNoSel() { - maCellLineStyleValueSet.SelectItem(0); - maCellLineStyleValueSet.SetNoSelection(); - maCellLineStyleValueSet.Format(); + maCellLineStyleValueSet->SelectItem(0); + maCellLineStyleValueSet->SetNoSelection(); + maCellLineStyleValueSet->Format(); Invalidate(); - maCellLineStyleValueSet.StartSelection(); + maCellLineStyleValueSet->StartSelection(); } IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl) { if(pControl == &maCellLineStyleValueSet) { - const sal_uInt16 iPos(maCellLineStyleValueSet.GetSelectItemId()); + const sal_uInt16 iPos(maCellLineStyleValueSet->GetSelectItemId()); SvxLineItem aLineItem(SID_FRAME_LINESTYLE); using namespace ::com::sun::star::table::BorderLineStyle; editeng::SvxBorderStyle nStyle = SOLID; @@ -178,7 +190,7 @@ IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl) IMPL_LINK(CellLineStyleControl, PBClickHdl, PushButton *, pPBtn) { - if(pPBtn == &maPushButtonMoreOptions) + if(pPBtn == maPushButtonMoreOptions.get()) { if(mrCellAppearancePropertyPanel.GetBindings()) { @@ -200,48 +212,48 @@ void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal if(out == DEF_LINE_WIDTH_0 && in == 0 && dis == 0) //1 { - maCellLineStyleValueSet.SetSelItem(1); + maCellLineStyleValueSet->SetSelItem(1); } else if(out == DEF_LINE_WIDTH_2 && in == 0 && dis == 0) //2 { - maCellLineStyleValueSet.SetSelItem(2); + maCellLineStyleValueSet->SetSelItem(2); } else if(out == DEF_LINE_WIDTH_3 && in == 0 && dis == 0) //3 { - maCellLineStyleValueSet.SetSelItem(3); + maCellLineStyleValueSet->SetSelItem(3); } else if(out == DEF_LINE_WIDTH_4 && in == 0 && dis == 0) //4 { - maCellLineStyleValueSet.SetSelItem(4); + maCellLineStyleValueSet->SetSelItem(4); } else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_1) //5 { - maCellLineStyleValueSet.SetSelItem(5); + maCellLineStyleValueSet->SetSelItem(5); } else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //6 { - maCellLineStyleValueSet.SetSelItem(6); + maCellLineStyleValueSet->SetSelItem(6); } else if(out == DEF_LINE_WIDTH_1 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_1) //7 { - maCellLineStyleValueSet.SetSelItem(7); + maCellLineStyleValueSet->SetSelItem(7); } else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //8 { - maCellLineStyleValueSet.SetSelItem(8); + maCellLineStyleValueSet->SetSelItem(8); } else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_2) //9 { - maCellLineStyleValueSet.SetSelItem(9); + maCellLineStyleValueSet->SetSelItem(9); } else { - maCellLineStyleValueSet.SetSelItem(0); + maCellLineStyleValueSet->SetSelItem(0); mbVSfocus = false; } - maCellLineStyleValueSet.Format(); - maCellLineStyleValueSet.StartSelection(); + maCellLineStyleValueSet->Format(); + maCellLineStyleValueSet->StartSelection(); } } } // end of namespace svx::sidebar diff --git a/sc/source/ui/sidebar/CellLineStyleControl.hxx b/sc/source/ui/sidebar/CellLineStyleControl.hxx index a00079ac8dbd..3b772db89fd9 100644 --- a/sc/source/ui/sidebar/CellLineStyleControl.hxx +++ b/sc/source/ui/sidebar/CellLineStyleControl.hxx @@ -31,8 +31,8 @@ class CellLineStyleControl : public svx::sidebar::PopupControl { private: CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; - PushButton maPushButtonMoreOptions; - CellLineStyleValueSet maCellLineStyleValueSet; + VclPtr<PushButton> maPushButtonMoreOptions; + VclPtr<CellLineStyleValueSet> maCellLineStyleValueSet; OUString maStr[CELL_LINE_STYLE_ENTRIES]; /// bitfield @@ -46,18 +46,20 @@ private: public: CellLineStyleControl(vcl::Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellLineStyleControl(); + virtual void dispose() SAL_OVERRIDE; void GetFocus() SAL_OVERRIDE; void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); ValueSet& GetValueSet() { - return maCellLineStyleValueSet; + return *maCellLineStyleValueSet.get(); } Control& GetPushButton() { - return maPushButtonMoreOptions; + return *maPushButtonMoreOptions.get(); } }; diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx index eae59d67fa17..800c8b3ddc69 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -34,7 +34,13 @@ CellLineStyleValueSet::CellLineStyleValueSet( vcl::Window* pParent, const ResId& CellLineStyleValueSet::~CellLineStyleValueSet() { - delete pVDev; + disposeOnce(); +} + +void CellLineStyleValueSet::dispose() +{ + pVDev.disposeAndClear(); + ValueSet::dispose(); } void CellLineStyleValueSet::SetUnit(const OUString* str) diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx index 969f346005d4..45cbb91fd509 100644 --- a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx @@ -29,12 +29,13 @@ namespace sc { namespace sidebar { class CellLineStyleValueSet : public ValueSet { private: - VirtualDevice* pVDev; + VclPtr<VirtualDevice> pVDev; sal_uInt16 nSelItem; OUString maStrUnit[CELL_LINE_STYLE_ENTRIES]; public: CellLineStyleValueSet( vcl::Window* pParent, const ResId& rResId); virtual ~CellLineStyleValueSet(); + virtual void dispose() SAL_OVERRIDE; void SetUnit(const OUString* str); void SetSelItem(sal_uInt16 nSel); diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index c37fc116b58b..3d59a6dfce51 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -70,6 +70,22 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel( NumberFormatPropertyPanel::~NumberFormatPropertyPanel() { + disposeOnce(); +} + +void NumberFormatPropertyPanel::dispose() +{ + mpLbCategory.clear(); + mpTBCategory.clear(); + mpEdDecimals.clear(); + mpEdLeadZeroes.clear(); + mpBtnNegRed.clear(); + mpBtnThousand.clear(); + + maNumFormatControl.dispose(); + maFormatControl.dispose(); + + PanelLayout::dispose(); } void NumberFormatPropertyPanel::Initialize() @@ -166,7 +182,7 @@ IMPL_LINK( NumberFormatPropertyPanel, NumFormatValueHdl, void*, EMPTYARG ) return 0L; } -NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create ( +VclPtr<vcl::Window> NumberFormatPropertyPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) @@ -178,10 +194,8 @@ NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create ( if (pBindings == NULL) throw lang::IllegalArgumentException("no SfxBindings given to NumberFormatPropertyPanel::Create", NULL, 2); - return new NumberFormatPropertyPanel( - pParent, - rxFrame, - pBindings); + return VclPtr<NumberFormatPropertyPanel>::Create( + pParent, rxFrame, pBindings); } void NumberFormatPropertyPanel::DataChanged( diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx index 5fe5df1aeb63..9a162beaf1b5 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx @@ -37,7 +37,7 @@ class NumberFormatPropertyPanel { public: public: - static NumberFormatPropertyPanel* Create( + static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); @@ -56,14 +56,21 @@ public: SfxBindings* GetBindings() { return mpBindings;} + // constructor/destuctor + NumberFormatPropertyPanel( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~NumberFormatPropertyPanel(); + virtual void dispose() SAL_OVERRIDE; private: //ui controls - ListBox* mpLbCategory; - ToolBox* mpTBCategory; - NumericField* mpEdDecimals; - NumericField* mpEdLeadZeroes; - CheckBox* mpBtnNegRed; - CheckBox* mpBtnThousand; + VclPtr<ListBox> mpLbCategory; + VclPtr<ToolBox> mpTBCategory; + VclPtr<NumericField> mpEdDecimals; + VclPtr<NumericField> mpEdLeadZeroes; + VclPtr<CheckBox> mpBtnNegRed; + VclPtr<CheckBox> mpBtnThousand; ::sfx2::sidebar::ControllerItem maNumFormatControl; ::sfx2::sidebar::ControllerItem maFormatControl; @@ -78,13 +85,6 @@ private: DECL_LINK(NumFormatSelectHdl, ListBox*); DECL_LINK(NumFormatValueHdl, void*); - // constructor/destuctor - NumberFormatPropertyPanel( - vcl::Window* pParent, - const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); - virtual ~NumberFormatPropertyPanel(); - void Initialize(); }; diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx index cb1c23852bdc..24cf2ede34df 100644 --- a/sc/source/ui/sidebar/ScPanelFactory.cxx +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -108,51 +108,31 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( "PanelFactory::createUIElement called without SfxBindings", NULL); + sal_Int32 nMinimumSize = -1; + VclPtr<vcl::Window> pPanel; if (rsResourceURL.endsWith("/AlignmentPropertyPanel")) - { - AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings ); - xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, - xFrame, - pPanel, - ui::LayoutSize(-1,-1,-1)); - } + pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings ); else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel")) - { - CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); - xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, - xFrame, - pPanel, - ui::LayoutSize(-1,-1,-1)); - } + pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); else if (rsResourceURL.endsWith("/NumberFormatPropertyPanel")) - { - NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); - xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, - xFrame, - pPanel, - ui::LayoutSize(-1,-1,-1)); - } + pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); else if (rsResourceURL.endsWith("/NavigatorPanel")) { - vcl::Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false); - xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, - xFrame, - pPanel, - ui::LayoutSize(0,-1,-1)); + pPanel = VclPtr<vcl::Window>(new ScNavigatorDlg(pBindings, NULL, pParentWindow, false), SAL_NO_ACQUIRE); + nMinimumSize = 0; } else if (rsResourceURL.endsWith("/FunctionsPanel")) { - vcl::Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)); + pPanel = VclPtr<vcl::Window>(new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)), SAL_NO_ACQUIRE);; + nMinimumSize = 0; + } + + if (pPanel) xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, pPanel, - ui::LayoutSize(0,-1,-1)); - } + ui::LayoutSize(nMinimumSize,-1,-1)); } catch (const uno::RuntimeException &) { diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index 23fa4ed4d7b3..a383eed17f2f 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -257,7 +257,7 @@ bool ScBlockUndo::AdjustHeight() { ScDocument& rDoc = pDocShell->GetDocument(); - VirtualDevice aVirtDev; + ScopedVclPtrInstance< VirtualDevice > pVirtDev; Fraction aZoomX( 1, 1 ); Fraction aZoomY = aZoomX; double nPPTX, nPPTY; @@ -277,7 +277,7 @@ bool ScBlockUndo::AdjustHeight() nPPTY = ScGlobal::nScreenPPTY; } - sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, &aVirtDev); + sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev); bool bRet = rDoc.SetOptimalHeight( aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab()); @@ -355,7 +355,7 @@ void ScMultiBlockUndo::AdjustHeight() { ScDocument& rDoc = pDocShell->GetDocument(); - VirtualDevice aVirtDev; + ScopedVclPtrInstance< VirtualDevice > pVirtDev; Fraction aZoomX( 1, 1 ); Fraction aZoomY = aZoomX; double nPPTX, nPPTY; @@ -375,7 +375,7 @@ void ScMultiBlockUndo::AdjustHeight() nPPTY = ScGlobal::nScreenPPTY; } - sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, &aVirtDev); + sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev); for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i) { const ScRange& r = *maBlockRanges[i]; diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 15e0a90533c6..fbf3d5a251a5 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1182,11 +1182,11 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const if (pViewShell) { - VirtualDevice aVirtDev; + ScopedVclPtrInstance< VirtualDevice > pVirtDev; ScViewData& rViewData = pViewShell->GetViewData(); sc::RowHeightContext aCxt( rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(), - &aVirtDev); + pVirtDev); if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab())) { diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index c403ab43d0d1..764d7170f624 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -841,7 +841,7 @@ void ScUndoAutoFormat::Redo() if (bSize) { - VirtualDevice aVirtDev; + ScopedVclPtrInstance< VirtualDevice > pVirtDev; Fraction aZoomX(1,1); Fraction aZoomY = aZoomX; double nPPTX,nPPTY; @@ -863,7 +863,7 @@ void ScUndoAutoFormat::Redo() bool bFormula = false; // remember - sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, &aVirtDev); + sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev); for (SCTAB nTab=nStartZ; nTab<=nEndZ; nTab++) { ScMarkData aDestMark; @@ -886,7 +886,7 @@ void ScUndoAutoFormat::Redo() if (!rDoc.ColHidden(nCol, nTab)) { sal_uInt16 nThisSize = STD_EXTRA_WIDTH + rDoc.GetOptimalColWidth( nCol, nTab, - &aVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, bFormula, + pVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, bFormula, &aDestMark ); rDoc.SetColWidth( nCol, nTab, nThisSize ); rDoc.ShowCol( nCol, nTab, true ); diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx index 41f733a1d6c1..6e9c5f61b902 100644 --- a/sc/source/ui/undo/undostyl.cxx +++ b/sc/source/ui/undo/undostyl.cxx @@ -106,12 +106,12 @@ static void lcl_DocStyleChanged( ScDocument* pDoc, SfxStyleSheetBase* pStyle, bo { //! move to document or docshell - VirtualDevice aVDev; - Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP ); + ScopedVclPtrInstance< VirtualDevice > pVDev; + Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MAP_TWIP ); double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - pDoc->StyleSheetChanged( pStyle, bRemoved, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + pDoc->StyleSheetChanged( pStyle, bRemoved, pVDev, nPPTX, nPPTY, aZoom, aZoom ); ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); if (pHdl) diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index c7f19d4f4b93..728d17c5f8fd 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -191,11 +191,11 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( { if (pPrinter->GetName() != sPrinterName) { - SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName ); + VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName ); if (pNewPrinter->IsKnown()) pDocShell->SetPrinter( pNewPrinter, SfxPrinterChangeFlags::PRINTER ); else - delete pNewPrinter; + pNewPrinter.disposeAndClear(); } } else diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 97cf5747f2c3..7bbce7a4b1cb 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -755,12 +755,12 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName ) if ( eFamily == SFX_STYLE_FAMILY_PARA ) { // wie ScViewFunc::RemoveStyleSheetInUse - VirtualDevice aVDev; - Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP ); + ScopedVclPtrInstance< VirtualDevice > pVDev; + Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MAP_TWIP ); double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT ); pDocShell->SetDocumentModified(); @@ -1096,12 +1096,12 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle ) { // Zeilenhoehen anpassen... - VirtualDevice aVDev; - Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP ); + ScopedVclPtrInstance< VirtualDevice > pVDev; + Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MAP_TWIP ); double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); if (!rDoc.IsImportingXML()) { @@ -1463,12 +1463,12 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault() { // row heights - VirtualDevice aVDev; - Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP ); + ScopedVclPtrInstance< VirtualDevice > pVDev; + Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MAP_TWIP ); double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); if (!rDoc.IsImportingXML()) { @@ -1845,12 +1845,12 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt { // Zeilenhoehen anpassen... - VirtualDevice aVDev; - Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP ); + ScopedVclPtrInstance< VirtualDevice > pVDev; + Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MAP_TWIP ); double nPPTX = aLogic.X() / 1000.0; double nPPTY = aLogic.Y() / 1000.0; Fraction aZoom(1,1); - rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom ); + rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); if (!rDoc.IsImportingXML()) { diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx index 0c8eaf4f5263..078060d87e25 100644 --- a/sc/source/ui/vba/vbaeventshelper.cxx +++ b/sc/source/ui/vba/vbaeventshelper.cxx @@ -162,14 +162,14 @@ private: DECL_LINK( processWindowResizeEvent, vcl::Window* ); private: - typedef ::std::map< vcl::Window*, uno::Reference< frame::XController > > WindowControllerMap; + typedef ::std::map< VclPtr<vcl::Window>, uno::Reference< frame::XController > > WindowControllerMap; ::osl::Mutex maMutex; ScVbaEventsHelper& mrVbaEvents; uno::Reference< frame::XModel > mxModel; ScDocShell* mpDocShell; WindowControllerMap maControllers; /// Maps VCL top windows to their controllers. - vcl::Window* mpActiveWindow; /// Currently activated window, to prevent multiple (de)activation. + VclPtr<vcl::Window> mpActiveWindow; /// Currently activated window, to prevent multiple (de)activation. bool mbWindowResized; /// True = window resize system event processed. bool mbBorderChanged; /// True = borders changed system event processed. bool mbDisposed; @@ -274,7 +274,7 @@ void SAL_CALL ScVbaEventListener::windowActivated( const lang::EventObject& rEve { uno::Reference< awt::XWindow > xWindow( rEvent.Source, uno::UNO_QUERY ); vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - OSL_TRACE( "ScVbaEventListener::windowActivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow ); + OSL_TRACE( "ScVbaEventListener::windowActivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow.get() ); // do not fire activation event multiple time for the same window if( pWindow && (pWindow != mpActiveWindow) ) { @@ -296,7 +296,7 @@ void SAL_CALL ScVbaEventListener::windowDeactivated( const lang::EventObject& rE { uno::Reference< awt::XWindow > xWindow( rEvent.Source, uno::UNO_QUERY ); vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - OSL_TRACE( "ScVbaEventListener::windowDeactivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow ); + OSL_TRACE( "ScVbaEventListener::windowDeactivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow.get() ); // do not fire the deactivation event, if the window is not active (prevent multiple deactivation) if( pWindow && (pWindow == mpActiveWindow) ) processWindowActivateEvent( pWindow, false ); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 2d7639f2e95a..1145e2bd5633 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1931,7 +1931,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const ScPatternAttr* pPattern = pDoc->GetPattern(aPos.Col(), aPos.Row(), aPos.Tab()); const std::vector<sal_uInt32>& rCondFormats = static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData(); bool bContainsCondFormat = !rCondFormats.empty(); - boost::scoped_ptr<ScCondFormatDlg> pCondFormatDlg; + VclPtr<ScCondFormatDlg> pCondFormatDlg; if(bContainsCondFormat) { bool bContainsExistingCondFormat = false; @@ -1950,7 +1950,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { // found a matching range, edit this conditional format nKey = pCondFormat->GetKey(); - pCondFormatDlg.reset( new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE ) ); + pCondFormatDlg.reset( VclPtr<ScCondFormatDlg>::Create( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE ) ); break; } } @@ -1960,9 +1960,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if(!pCondFormatDlg && bContainsExistingCondFormat) { - QueryBox aBox( pTabViewShell->GetDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ), + ScopedVclPtrInstance<QueryBox> aBox( pTabViewShell->GetDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ), ScGlobal::GetRscString(STR_EDIT_EXISTING_COND_FORMATS) ); - bool bEditExisting = aBox.Execute() == RET_YES; + bool bEditExisting = aBox->Execute() == RET_YES; if(bEditExisting) { // differentiate between ranges where one conditional format is defined @@ -1975,7 +1975,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) assert(pCondFormat); const ScRangeList& rCondFormatRange = pCondFormat->GetRange(); nKey = pCondFormat->GetKey(); - pCondFormatDlg.reset( new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE ) ); + pCondFormatDlg.reset( VclPtr<ScCondFormatDlg>::Create( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE ) ); } else { @@ -2023,7 +2023,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) assert(false); break; } - pCondFormatDlg.reset( new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), eType ) ); + pCondFormatDlg.reset( VclPtr<ScCondFormatDlg>::Create( pTabViewShell->GetDialogParent(), pDoc, nullptr, aRangeList, aRangeList.GetTopLeftCorner(), eType ) ); } sal_uInt16 nId = 1; @@ -2652,10 +2652,10 @@ void ScCellShell::ExecuteDataPilotDialog() { // confirm selection if it contains SubTotal cells - QueryBox aBox( pTabViewShell->GetDialogParent(), + ScopedVclPtrInstance<QueryBox> aBox( pTabViewShell->GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_DATAPILOT_SUBTOTAL) ); - if (aBox.Execute() == RET_NO) + if (aBox->Execute() == RET_NO) bOK = false; } if (bOK) @@ -2682,8 +2682,8 @@ void ScCellShell::ExecuteDataPilotDialog() if (nSrcErrorId) { // Error occurred during data creation. Launch an error and bail out. - InfoBox aBox(pTabViewShell->GetDialogParent(), ScGlobal::GetRscString(nSrcErrorId)); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox(pTabViewShell->GetDialogParent(), ScGlobal::GetRscString(nSrcErrorId)); + aBox->Execute(); return; } diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 974c9a1eddc6..2b427c3023ca 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -740,15 +740,15 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) break; case SID_DATA_STREAMS: { - sc::DataStreamDlg aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() ); + ScopedVclPtrInstance< sc::DataStreamDlg > aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() ); ScDocument *pDoc = GetViewData()->GetDocument(); sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager(); sc::DataStream* pStrm = rMgr.getDataStream(); if (pStrm) - aDialog.Init(*pStrm); + aDialog->Init(*pStrm); - if (aDialog.Execute() == RET_OK) - aDialog.StartStream(); + if (aDialog->Execute() == RET_OK) + aDialog->StartStream(); } break; case SID_DATA_STREAMS_PLAY: diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 295ed340f94e..77be8cf171a4 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -422,9 +422,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else if( ! rReq.IsAPI() ) { - MessageDialog aErrorBox(pTabViewShell->GetDialogParent(), + ScopedVclPtrInstance<MessageDialog> aErrorBox(pTabViewShell->GetDialogParent(), ScGlobal::GetRscString(STR_NOAREASELECTED)); - aErrorBox.Execute(); + aErrorBox->Execute(); } } else diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index b2099de5cb7b..83224c957fbb 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -383,9 +383,9 @@ void ScDBFunc::ToggleAutoFilter() } else { - MessageDialog aErrorBox(GetViewData().GetDialogParent(), + ScopedVclPtrInstance<MessageDialog> aErrorBox(GetViewData().GetDialogParent(), ScGlobal::GetRscString(STR_ERR_AUTOFILTER)); - aErrorBox.Execute(); + aErrorBox->Execute(); } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index a39603115070..94f629c2f696 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -205,7 +205,7 @@ bool ScGridWindow::VisibleRange::set(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO class ScFilterListBox : public ListBox { private: - ScGridWindow* pGridWin; + VclPtr<ScGridWindow> pGridWin; SCCOL nCol; SCROW nRow; bool bButtonDown; @@ -224,6 +224,7 @@ public: ScFilterListBox( vcl::Window* pParent, ScGridWindow* pGrid, SCCOL nNewCol, SCROW nNewRow, ScFilterBoxMode eNewMode ); virtual ~ScFilterListBox(); + virtual void dispose() SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual void Select() SAL_OVERRIDE; @@ -258,8 +259,15 @@ ScFilterListBox::ScFilterListBox( vcl::Window* pParent, ScGridWindow* pGrid, ScFilterListBox::~ScFilterListBox() { + disposeOnce(); +} + +void ScFilterListBox::dispose() +{ if (IsMouseCaptured()) ReleaseMouse(); + pGridWin.clear(); + ListBox::dispose(); } void ScFilterListBox::EndInit() @@ -337,6 +345,7 @@ class ScFilterFloatingWindow : public FloatingWindow public: ScFilterFloatingWindow( vcl::Window* pParent, WinBits nStyle = WB_STDFLOATWIN ); virtual ~ScFilterFloatingWindow(); + virtual void dispose() SAL_OVERRIDE; // required for System FloatingWindows that will not process KeyInput by themselves virtual vcl::Window* GetPreferredKeyInputWindow() SAL_OVERRIDE; }; @@ -347,7 +356,13 @@ ScFilterFloatingWindow::ScFilterFloatingWindow( vcl::Window* pParent, WinBits nS ScFilterFloatingWindow::~ScFilterFloatingWindow() { + disposeOnce(); +} + +void ScFilterFloatingWindow::dispose() +{ EndPopupMode(); + FloatingWindow::dispose(); } vcl::Window* ScFilterFloatingWindow::GetPreferredKeyInputWindow() @@ -522,6 +537,21 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos ScGridWindow::~ScGridWindow() { + disposeOnce(); +} + +void ScGridWindow::dispose() +{ + // #114409# + ImpDestroyOverlayObjects(); + + mpFilterBox.disposeAndClear(); + mpFilterFloat.disposeAndClear(); + mpNoteMarker.reset(); + mpAutoFilterPopup.disposeAndClear(); + mpDPFieldPopup.disposeAndClear(); + + vcl::Window::dispose(); } void ScGridWindow::ClickExtern() @@ -535,8 +565,8 @@ void ScGridWindow::ClickExtern() { break; } - mpFilterBox.reset(); - mpFilterFloat.reset(); + mpFilterBox.disposeAndClear(); + mpFilterFloat.disposeAndClear(); } while (false); @@ -612,7 +642,7 @@ struct AutoFilterData : public ScCheckListMenuWindow::ExtendedData class AutoFilterAction : public ScMenuFloatingWindow::Action { - ScGridWindow* mpWindow; + VclPtr<ScGridWindow> mpWindow; ScGridWindow::AutoFilterMode meMode; public: AutoFilterAction(ScGridWindow* p, ScGridWindow::AutoFilterMode eMode) : @@ -625,7 +655,7 @@ public: class AutoFilterPopupEndAction : public ScMenuFloatingWindow::Action { - ScGridWindow* mpWindow; + VclPtr<ScGridWindow> mpWindow; ScAddress maPos; public: AutoFilterPopupEndAction(ScGridWindow* p, const ScAddress& rPos) : @@ -673,7 +703,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) SCTAB nTab = pViewData->GetTabNo(); ScDocument* pDoc = pViewData->GetDocument(); - mpAutoFilterPopup.reset(new ScCheckListMenuWindow(this, pDoc)); + mpAutoFilterPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, pDoc)); mpAutoFilterPopup->setOKAction(new AutoFilterAction(this, Normal)); mpAutoFilterPopup->setPopupEndAction( new AutoFilterPopupEndAction(this, ScAddress(nCol, nRow, nTab))); @@ -933,8 +963,8 @@ void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW nRow ) void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) { - mpFilterBox.reset(); - mpFilterFloat.reset(); + mpFilterBox.disposeAndClear(); + mpFilterFloat.disposeAndClear(); SCCOL nCol = rScenRange.aEnd.Col(); // Zelle unterhalb des Buttons SCROW nRow = rScenRange.aStart.Row(); @@ -964,9 +994,9 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) // Die ListBox direkt unter der schwarzen Linie auf dem Zellgitter // (wenn die Linie verdeckt wird, sieht es komisch aus...) - mpFilterFloat.reset(new ScFilterFloatingWindow(this, WinBits(WB_BORDER))); + mpFilterFloat.reset(VclPtr<ScFilterFloatingWindow>::Create(this, WinBits(WB_BORDER))); mpFilterFloat->SetPopupModeEndHdl( LINK( this, ScGridWindow, PopupModeEndHdl ) ); - mpFilterBox.reset(new ScFilterListBox(mpFilterFloat.get(), this, nCol, nRow, SC_FILTERBOX_SCENARIO)); + mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, SC_FILTERBOX_SCENARIO)); if (bLayoutRTL) mpFilterBox->EnableMirroring(); @@ -1069,8 +1099,8 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelect ) { - mpFilterBox.reset(); - mpFilterFloat.reset(); + mpFilterBox.disposeAndClear(); + mpFilterFloat.disposeAndClear(); sal_uInt16 i; ScDocument* pDoc = pViewData->GetDocument(); @@ -1090,10 +1120,10 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec aPos.X() -= 1; aPos.Y() += nSizeY - 1; - mpFilterFloat.reset(new ScFilterFloatingWindow(this, WinBits(WB_BORDER))); + mpFilterFloat.reset(VclPtr<ScFilterFloatingWindow>::Create(this, WinBits(WB_BORDER))); mpFilterFloat->SetPopupModeEndHdl(LINK( this, ScGridWindow, PopupModeEndHdl)); ScFilterBoxMode eFilterMode = bDataSelect ? SC_FILTERBOX_DATASELECT : SC_FILTERBOX_FILTER; - mpFilterBox.reset(new ScFilterListBox(mpFilterFloat.get(), this, nCol, nRow, eFilterMode)); + mpFilterBox.reset(VclPtr<ScFilterListBox>::Create(mpFilterFloat.get(), this, nCol, nRow, eFilterMode)); // Fix for bug fdo#44925 if (AllSettings::GetLayoutRTL() != bLayoutRTL) mpFilterBox->EnableMirroring(); @@ -1305,8 +1335,8 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec if ( bEmpty ) { - mpFilterBox.reset(); - mpFilterFloat.reset(); + mpFilterBox.disposeAndClear(); + mpFilterFloat.disposeAndClear(); } else { diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 60b27acf04d9..04194904e382 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -395,7 +395,7 @@ public: mpGridWindow->UpdateDPFromFieldPopupMenu(); } private: - ScGridWindow* mpGridWindow; + VclPtr<ScGridWindow> mpGridWindow; }; class PopupSortAction : public ScMenuFloatingWindow::Action @@ -455,7 +455,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu( const ScDPLabelData& rLabelData = pDPData->maLabels; - mpDPFieldPopup.reset(new ScCheckListMenuWindow(this, pViewData->GetDocument())); + mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, pViewData->GetDocument())); mpDPFieldPopup->setName("DataPilot field member popup"); mpDPFieldPopup->setExtendedData(pDPData.release()); mpDPFieldPopup->setOKAction(new DPFieldPopupOKAction(this)); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 9a78d1067690..9c4f7c6fbd48 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -482,7 +482,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod aOutputData.SetMirrorWidth( nMirrorWidth ); // needed for RTL aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get()); - std::unique_ptr<VirtualDevice> xFmtVirtDev; + ScopedVclPtr< VirtualDevice > xFmtVirtDev; bool bLogicText = bTextWysiwyg; // call DrawStrings in logic MapMode? if ( bTextWysiwyg ) diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx index 4752e567f4de..5e5f46dfc892 100644 --- a/sc/source/ui/view/olinewin.cxx +++ b/sc/source/ui/view/olinewin.cxx @@ -71,10 +71,16 @@ ScOutlineWindow::ScOutlineWindow( vcl::Window* pParent, ScOutlineMode eMode, ScV ScOutlineWindow::~ScOutlineWindow() { + disposeOnce(); +} + +void ScOutlineWindow::dispose() +{ // remove the window from task pane list if( SystemWindow* pSysWin = GetSystemWindow() ) if( TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() ) pTaskPaneList->RemoveWindow( this ); + vcl::Window::dispose(); } void ScOutlineWindow::SetHeaderSize( long nNewSize ) diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 14e16b366e41..3267fb8a6296 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -143,8 +143,14 @@ ScPreview::ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell* ScPreview::~ScPreview() { + disposeOnce(); +} + +void ScPreview::dispose() +{ delete pDrawView; delete pLocationData; + vcl::Window::dispose(); } void ScPreview::UpdateDrawView() // nTab must be right diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 49500b78eaed..ef3ef07d8078 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -119,10 +119,10 @@ void ScPreviewShell::Construct( vcl::Window* pParent ) eZoom = SvxZoomType::WHOLEPAGE; - pCorner = new ScrollBarBox( pParent, WB_SIZEABLE ); + pCorner = VclPtr<ScrollBarBox>::Create( pParent, WB_SIZEABLE ); - pHorScroll = new ScrollBar(pParent, WB_HSCROLL ); - pVerScroll = new ScrollBar(pParent, WB_VSCROLL); + pHorScroll = VclPtr<ScrollBar>::Create(pParent, WB_HSCROLL ); + pVerScroll = VclPtr<ScrollBar>::Create(pParent, WB_VSCROLL); // SSA: --- RTL --- no mirroring for horizontal scrollbars pHorScroll->EnableRTL( false ); @@ -130,7 +130,7 @@ void ScPreviewShell::Construct( vcl::Window* pParent ) pHorScroll->SetEndScrollHdl( LINK( this, ScPreviewShell, ScrollHandler ) ); pVerScroll->SetEndScrollHdl( LINK( this, ScPreviewShell, ScrollHandler ) ); - pPreview = new ScPreview( pParent, pDocShell, this ); + pPreview = VclPtr<ScPreview>::Create( pParent, pDocShell, this ); SetPool( &SC_MOD()->GetPool() ); SetWindow( pPreview ); @@ -197,10 +197,10 @@ ScPreviewShell::~ScPreviewShell() EndListening(*pDocShell); SetWindow(0); - delete pPreview; - delete pHorScroll; - delete pVerScroll; - delete pCorner; + pPreview.disposeAndClear(); + pHorScroll.disposeAndClear(); + pVerScroll.disposeAndClear(); + pCorner.disposeAndClear(); // normal mode of operation is switching back to default view in the same frame, // so there's no need to activate any other window here anymore @@ -532,14 +532,15 @@ bool ScPreviewShell::HasPrintOptionsPage() const return true; } -SfxTabPage* ScPreviewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) +VclPtr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT ); + ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT ); if ( ScTpPrintOptionsCreate ) - return (*ScTpPrintOptionsCreate)( pParent, &rOptions); - return 0; + return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions), + SAL_NO_ACQUIRE); + return VclPtr<SfxTabPage>(); } void ScPreviewShell::Activate(bool bMDI) diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 55bfb1d6b5a9..ff34a7b7a79e 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -231,7 +231,7 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, SCTAB nTa nTotalY(0), pPageData ( pData ) { - pDev = pPrinter; + pDev = pPrinter.get(); aSrcOffset = pPrinter->PixelToLogic( pPrinter->GetPageOffsetPixel(), MAP_100TH_MM ); Construct( pOptions ); } diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index d6a1258d14f4..3b0e96224d29 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -187,42 +187,42 @@ void ScSimpleRefDlgWrapper::SetAutoReOpen(bool bFlag) void ScSimpleRefDlgWrapper::SetRefString(const OUString& rStr) { - if(pWindow!=NULL) + if(pWindow!=nullptr) { - static_cast<ScSimpleRefDlg*>(pWindow)->SetRefString(rStr); + static_cast<ScSimpleRefDlg*>(pWindow.get())->SetRefString(rStr); } } void ScSimpleRefDlgWrapper::SetCloseHdl( const Link& rLink ) { - if(pWindow!=NULL) + if(pWindow!=nullptr) { - static_cast<ScSimpleRefDlg*>(pWindow)->SetCloseHdl( rLink ); + static_cast<ScSimpleRefDlg*>(pWindow.get())->SetCloseHdl( rLink ); } } void ScSimpleRefDlgWrapper::SetUnoLinks( const Link& rDone, const Link& rAbort, const Link& rChange ) { - if(pWindow!=NULL) + if(pWindow!=nullptr) { - static_cast<ScSimpleRefDlg*>(pWindow)->SetUnoLinks( rDone, rAbort, rChange ); + static_cast<ScSimpleRefDlg*>(pWindow.get())->SetUnoLinks( rDone, rAbort, rChange ); } } void ScSimpleRefDlgWrapper::SetFlags( bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection ) { - if(pWindow!=NULL) + if(pWindow!=nullptr) { - static_cast<ScSimpleRefDlg*>(pWindow)->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection ); + static_cast<ScSimpleRefDlg*>(pWindow.get())->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection ); } } void ScSimpleRefDlgWrapper::StartRefInput() { - if(pWindow!=NULL) + if(pWindow!=nullptr) { - static_cast<ScSimpleRefDlg*>(pWindow)->StartRefInput(); + static_cast<ScSimpleRefDlg*>(pWindow.get())->StartRefInput(); } } @@ -237,12 +237,13 @@ ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( vcl::Window* pParentP, ScTabViewShell* pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); OSL_ENSURE( pViewShell, "missing view shell :-(" ); - pWindow = pViewShell ? - new ScAcceptChgDlg( pBindings, this, pParentP, &pViewShell->GetViewData() ) : - NULL; - if(pWindow!=NULL) + if (pViewShell) + pWindow = VclPtr<ScAcceptChgDlg>::Create( pBindings, this, pParentP, &pViewShell->GetViewData() ); + else + pWindow = NULL; + if(pWindow!=nullptr) { - static_cast<ScAcceptChgDlg*>(pWindow)->Initialize( pInfo ); + static_cast<ScAcceptChgDlg*>(pWindow.get())->Initialize( pInfo ); } if (pViewShell && !pWindow) pViewShell->GetViewFrame()->SetChildWindow( nId, false ); @@ -254,9 +255,9 @@ void ScAcceptChgDlgWrapper::ReInitDlg() PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); OSL_ENSURE( pViewShell, "missing view shell :-(" ); - if(pWindow!=NULL && pViewShell) + if(pWindow!=nullptr && pViewShell) { - static_cast<ScAcceptChgDlg*>(pWindow)->ReInit(&pViewShell->GetViewData()); + static_cast<ScAcceptChgDlg*>(pWindow.get())->ReInit(&pViewShell->GetViewData()); } } @@ -289,7 +290,7 @@ ScValidityRefChildWin::ScValidityRefChildWin( vcl::Window* pParent { SetWantsFocus( false ); ScTabViewShell* pViewShell = - NULL != ( pWindow = ScValidationDlg::Find1AliveObject( pParentP ) ) ? static_cast<ScValidationDlg*>(pWindow)->GetTabViewShell() : + nullptr != ( pWindow = ScValidationDlg::Find1AliveObject( pParentP ) ) ? static_cast<ScValidationDlg*>(pWindow.get())->GetTabViewShell() : lcl_GetTabViewShell( p ); if (!pViewShell) pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index ad7e6bc54b1e..3ea3d0dfeafd 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -305,10 +305,10 @@ bool ScSpellingEngine::ShowTableWrapDialog() { vcl::Window* pParent = GetDialogParent(); ScWaitCursorOff aWaitOff( pParent ); - MessBox aMsgBox( pParent, WinBits( WB_YES_NO | WB_DEF_YES ), + ScopedVclPtrInstance<MessBox> aMsgBox( pParent, WinBits( WB_YES_NO | WB_DEF_YES ), ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), ScGlobal::GetRscString( STR_SPELLING_BEGIN_TAB) ); - return aMsgBox.Execute() == RET_YES; + return aMsgBox->Execute() == RET_YES; } void ScSpellingEngine::ShowFinishDialog() diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 706856f4cfe0..57b71dd50d08 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -199,13 +199,13 @@ ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pHdrSelEng( NULL ), aHdrFunc( &aViewData ), pDrawView( NULL ), - aVScrollTop( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ), - aVScrollBottom( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ), - aHScrollLeft( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ), - aHScrollRight( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ), - aCornerButton( pFrameWin, &aViewData, false ), - aTopButton( pFrameWin, &aViewData, true ), - aScrollBarBox( pFrameWin, WB_SIZEABLE ), + aVScrollTop( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ) ), + aVScrollBottom( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_VSCROLL | WB_DRAG ) ) ), + aHScrollLeft( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ) ), + aHScrollRight( VclPtr<ScrollBar>::Create( pFrameWin, WinBits( WB_HSCROLL | WB_DRAG ) ) ), + aCornerButton( VclPtr<ScCornerButton>::Create( pFrameWin, &aViewData, false ) ), + aTopButton( VclPtr<ScCornerButton>::Create( pFrameWin, &aViewData, true ) ), + aScrollBarBox( VclPtr<ScrollBarBox>::Create( pFrameWin, WB_SIZEABLE ) ), mpInputHintWindow( NULL ), pPageBreakData( NULL ), pBrushDocument( NULL ), @@ -280,7 +280,7 @@ IMPL_LINK_NOARG(ScTabView, TimerHdl) // --- Resize --------------------------------------------------------------------- static void lcl_SetPosSize( vcl::Window& rWindow, const Point& rPos, const Size& rSize, - long nTotalWidth, bool bLayoutRTL ) + long nTotalWidth, bool bLayoutRTL ) { Point aNewPos = rPos; if ( bLayoutRTL ) @@ -394,7 +394,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } // window at the bottom right - lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), + lcl_SetPosSize( *aScrollBarBox.get(), Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), nTotalWidth, bLayoutRTL ); if (bHScroll) // Scrollbars horizontal @@ -458,39 +458,39 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) { Point aTabPoint(nPosX, nPosY + nSizeY); Size aTabSize(nTabSize, nBarY); - lcl_SetPosSize(*pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*pTabControl.get(), aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); pTabControl->SetSheetLayoutRTL(bLayoutRTL); Point aHScrollLeftPoint(nPosX + nTabSize, nPosY + nSizeY); Size aHScrollLeftSize(nSizeLt, nBarY); - lcl_SetPosSize(aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollLeft.get(), aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); Point aHSplitterPoint(nPosX + nTabSize + nSizeLt, nPosY + nSizeY); Size aHSplitterSize(nSizeSp, nBarY); - lcl_SetPosSize(*pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*pHSplitter.get(), aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); Point aHScrollRightPoint(nPosX + nTabSize + nSizeLt + nSizeSp, nPosY + nSizeY); Size aHScrollRightSize(nSizeRt, nBarY); - lcl_SetPosSize(aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollRight.get(), aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); } else { Point aTabPoint(nPosX, nPosY + nSizeY + nScrollBarSize); Size aTabSize(nSizeX, nTabWidth); - lcl_SetPosSize(*pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*pTabControl.get(), aTabPoint, aTabSize, nTotalWidth, bLayoutRTL); pTabControl->SetSheetLayoutRTL(bLayoutRTL); Point aHScrollLeftPoint(nPosX, nPosY + nSizeY); Size aHScrollLeftSize(nSizeLt, nScrollBarSize); - lcl_SetPosSize(aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollLeft.get(), aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL); Point aHSplitterPoint(nPosX + nSizeLt, nPosY + nSizeY); Size aHSplitterSize(nSizeSp, nScrollBarSize); - lcl_SetPosSize(*pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*pHSplitter.get(), aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL); Point aHScrollRightPoint(nPosX + nSizeLt + nSizeSp, nPosY + nSizeY); Size aHScrollRightSize(nSizeRt, nScrollBarSize); - lcl_SetPosSize(aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); + lcl_SetPosSize(*aHScrollRight.get(), aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL); } // SetDragRectPixel is done below } @@ -518,11 +518,11 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } nSizeDn = nSizeY - nSizeUp - nSizeSp; - lcl_SetPosSize( aVScrollTop, Point(nPosX + nSizeX, nPosY), + lcl_SetPosSize( *aVScrollTop.get(), Point(nPosX + nSizeX, nPosY), Size(nBarX, nSizeUp), nTotalWidth, bLayoutRTL ); lcl_SetPosSize( *pVSplitter, Point( nPosX + nSizeX, nPosY+nSizeUp ), Size( nBarX, nSizeSp ), nTotalWidth, bLayoutRTL ); - lcl_SetPosSize( aVScrollBottom, Point(nPosX + nSizeX, + lcl_SetPosSize( *aVScrollBottom.get(), Point(nPosX + nSizeX, nPosY + nSizeUp + nSizeSp), Size(nBarX, nSizeDn), nTotalWidth, bLayoutRTL ); @@ -540,25 +540,25 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) if (bTabControl && ! bHScroll ) { - nBarY = aHScrollLeft.GetSizePixel().Height(); - nBarX = aVScrollBottom.GetSizePixel().Width(); + nBarY = aHScrollLeft->GetSizePixel().Height(); + nBarX = aVScrollBottom->GetSizePixel().Width(); long nSize1 = nSizeX; long nTabSize = nSize1; if (nTabSize < 0) nTabSize = 0; - lcl_SetPosSize( *pTabControl, Point(nPosX, nPosY+nSizeY-nBarY), + lcl_SetPosSize( *pTabControl.get(), Point(nPosX, nPosY+nSizeY-nBarY), Size(nTabSize, nBarY), nTotalWidth, bLayoutRTL ); nSizeY -= nBarY; - lcl_SetPosSize( aScrollBarBox, Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), + lcl_SetPosSize( *aScrollBarBox.get(), Point( nPosX+nSizeX, nPosY+nSizeY ), Size( nBarX, nBarY ), nTotalWidth, bLayoutRTL ); if( bVScroll ) { - Size aVScrSize = aVScrollBottom.GetSizePixel(); + Size aVScrSize = aVScrollBottom->GetSizePixel(); aVScrSize.Height() -= nBarY; - aVScrollBottom.SetSizePixel( aVScrSize ); + aVScrollBottom->SetSizePixel( aVScrSize ); } } @@ -607,7 +607,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) { // Fixier-Splitter nicht mit Scrollbar/TabBar ueberlappen lassen if ( bHScroll ) - nSplitHeight -= aHScrollLeft.GetSizePixel().Height(); + nSplitHeight -= aHScrollLeft->GetSizePixel().Height(); else if ( bTabControl && pTabControl ) nSplitHeight -= pTabControl->GetSizePixel().Height(); } @@ -623,7 +623,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) { long nSplitWidth = rSize.Width(); if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX && bVScroll ) - nSplitWidth -= aVScrollBottom.GetSizePixel().Width(); + nSplitWidth -= aVScrollBottom->GetSizePixel().Width(); nSplitPosY = aViewData.GetVSplitPos(); lcl_SetPosSize( *pVSplitter, Point( nOutPosX, nSplitPosY ), Size( nSplitWidth, nSplitSizeY ), nTotalWidth, bLayoutRTL ); @@ -672,11 +672,11 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) } if (bHOutline && bVOutline) { - lcl_SetPosSize( aTopButton, Point(nOutPosX,nOutPosY), Size(nOutlineX,nOutlineY), nTotalWidth, bLayoutRTL ); - aTopButton.Show(); + lcl_SetPosSize( *aTopButton.get(), Point(nOutPosX,nOutPosY), Size(nOutlineX,nOutlineY), nTotalWidth, bLayoutRTL ); + aTopButton->Show(); } else - aTopButton.Hide(); + aTopButton->Hide(); if (bHeaders) // Spalten/Zeilen-Header { @@ -692,14 +692,14 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) lcl_SetPosSize( *pRowBar[SC_SPLIT_BOTTOM], Point(nPosX-nBarX,nSplitPosY), Size(nBarX,nBottomSize), nTotalWidth, bLayoutRTL ); - lcl_SetPosSize( aCornerButton, Point(nPosX-nBarX,nPosY-nBarY), Size(nBarX,nBarY), nTotalWidth, bLayoutRTL ); - aCornerButton.Show(); + lcl_SetPosSize( *aCornerButton.get(), Point(nPosX-nBarX,nPosY-nBarY), Size(nBarX,nBarY), nTotalWidth, bLayoutRTL ); + aCornerButton->Show(); pColBar[SC_SPLIT_LEFT]->Show(); pRowBar[SC_SPLIT_BOTTOM]->Show(); } else { - aCornerButton.Hide(); + aCornerButton->Hide(); pColBar[SC_SPLIT_LEFT]->Hide(); // immer da pRowBar[SC_SPLIT_BOTTOM]->Hide(); } @@ -822,8 +822,8 @@ void ScTabView::GetBorderSize( SvBorder& rBorder, const Size& /* rSize */ ) if (bScrollBars) // Scrollbars horizontal oder vertikal { - rBorder.Right() += aVScrollBottom.GetSizePixel().Width(); - rBorder.Bottom() += aHScrollLeft.GetSizePixel().Height(); + rBorder.Right() += aVScrollBottom->GetSizePixel().Width(); + rBorder.Bottom() += aHScrollLeft->GetSizePixel().Height(); } // Outline-Controls @@ -1015,8 +1015,8 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) { ScHSplitPos eHPos = WhichH(ePos); ScVSplitPos eVPos = WhichV(ePos); - ScrollBar* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? &aHScrollLeft : &aHScrollRight; - ScrollBar* pVScroll = ( eVPos == SC_SPLIT_TOP ) ? &aVScrollTop : &aVScrollBottom; + ScrollBar* pHScroll = ( eHPos == SC_SPLIT_LEFT ) ? aHScrollLeft.get() : aHScrollRight.get(); + ScrollBar* pVScroll = ( eVPos == SC_SPLIT_TOP ) ? aVScrollTop.get() : aVScrollBottom.get(); if ( pGridWin[ePos] ) bDone = pGridWin[ePos]->HandleScrollCommand( rCEvt, pHScroll, pVScroll ); } @@ -1035,13 +1035,13 @@ IMPL_LINK_NOARG(ScTabView, EndScrollHdl) IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) { - bool bHoriz = ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight ); + bool bHoriz = ( pScroll == aHScrollLeft.get() || pScroll == aHScrollRight.get() ); long nViewPos; if ( bHoriz ) - nViewPos = aViewData.GetPosX( (pScroll == &aHScrollLeft) ? + nViewPos = aViewData.GetPosX( (pScroll == aHScrollLeft.get()) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT ); else - nViewPos = aViewData.GetPosY( (pScroll == &aVScrollTop) ? + nViewPos = aViewData.GetPosY( (pScroll == aVScrollTop.get()) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM ); bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ); @@ -1078,9 +1078,9 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) // get scrollbar scroll position for help text (row number/column name) long nScrollMin = 0; // RangeMin simulieren - if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight ) + if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == aHScrollRight.get() ) nScrollMin = aViewData.GetFixPosX(); - if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom ) + if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == aVScrollBottom.get() ) nScrollMin = aViewData.GetFixPosY(); long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; @@ -1123,17 +1123,17 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) nDelta = 1; break; case SCROLL_PAGEUP: - if ( pScroll == &aHScrollLeft ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT ); - if ( pScroll == &aHScrollRight ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT ); - if ( pScroll == &aVScrollTop ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP ); - if ( pScroll == &aVScrollBottom ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM ); + if ( pScroll == aHScrollLeft.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT ); + if ( pScroll == aHScrollRight.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT ); + if ( pScroll == aVScrollTop.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP ); + if ( pScroll == aVScrollBottom.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM ); if (nDelta==0) nDelta=-1; break; case SCROLL_PAGEDOWN: - if ( pScroll == &aHScrollLeft ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); - if ( pScroll == &aHScrollRight ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); - if ( pScroll == &aVScrollTop ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP ); - if ( pScroll == &aVScrollBottom ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); + if ( pScroll == aHScrollLeft.get() ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); + if ( pScroll == aHScrollRight.get() ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); + if ( pScroll == aVScrollTop.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP ); + if ( pScroll == aVScrollBottom.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); if (nDelta==0) nDelta=1; break; case SCROLL_DRAG: @@ -1142,9 +1142,9 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) // Bereiche herumzittern long nScrollMin = 0; // RangeMin simulieren - if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == &aHScrollRight ) + if ( aViewData.GetHSplitMode()==SC_SPLIT_FIX && pScroll == aHScrollRight.get() ) nScrollMin = aViewData.GetFixPosX(); - if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom ) + if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == aVScrollBottom.get() ) nScrollMin = aViewData.GetFixPosY(); long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; @@ -1172,9 +1172,9 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) { bool bUpdate = ( eType != SCROLL_DRAG ); // bei Drag die Ranges nicht aendern if ( bHoriz ) - ScrollX( nDelta, (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate ); + ScrollX( nDelta, (pScroll == aHScrollLeft.get()) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate ); else - ScrollY( nDelta, (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate ); + ScrollY( nDelta, (pScroll == aVScrollTop.get()) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM, bUpdate ); } return 0; @@ -1433,7 +1433,7 @@ void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY RepeatResize(); // auf VCL gibt's Update ohne Ende (jedes Update gilt fuer alle Fenster) - //aCornerButton.Update(); // der bekommt sonst nie ein Update + //aCornerButton->Update(); // der bekommt sonst nie ein Update bInUpdateHeader = false; } @@ -1466,44 +1466,44 @@ void ScTabView::UpdateShow() if (bShowH && !pGridWin[SC_SPLIT_BOTTOMRIGHT]) { - pGridWin[SC_SPLIT_BOTTOMRIGHT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_BOTTOMRIGHT ); + pGridWin[SC_SPLIT_BOTTOMRIGHT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_BOTTOMRIGHT ); DoAddWin( pGridWin[SC_SPLIT_BOTTOMRIGHT] ); } if (bShowV && !pGridWin[SC_SPLIT_TOPLEFT]) { - pGridWin[SC_SPLIT_TOPLEFT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_TOPLEFT ); + pGridWin[SC_SPLIT_TOPLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_TOPLEFT ); DoAddWin( pGridWin[SC_SPLIT_TOPLEFT] ); } if (bShowH && bShowV && !pGridWin[SC_SPLIT_TOPRIGHT]) { - pGridWin[SC_SPLIT_TOPRIGHT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_TOPRIGHT ); + pGridWin[SC_SPLIT_TOPRIGHT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_TOPRIGHT ); DoAddWin( pGridWin[SC_SPLIT_TOPRIGHT] ); } if (bHOutline && !pColOutline[SC_SPLIT_LEFT]) - pColOutline[SC_SPLIT_LEFT] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMLEFT ); + pColOutline[SC_SPLIT_LEFT] = VclPtr<ScOutlineWindow>::Create( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMLEFT ); if (bShowH && bHOutline && !pColOutline[SC_SPLIT_RIGHT]) - pColOutline[SC_SPLIT_RIGHT] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMRIGHT ); + pColOutline[SC_SPLIT_RIGHT] = VclPtr<ScOutlineWindow>::Create( pFrameWin, SC_OUTLINE_HOR, &aViewData, SC_SPLIT_BOTTOMRIGHT ); if (bVOutline && !pRowOutline[SC_SPLIT_BOTTOM]) - pRowOutline[SC_SPLIT_BOTTOM] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_BOTTOMLEFT ); + pRowOutline[SC_SPLIT_BOTTOM] = VclPtr<ScOutlineWindow>::Create( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_BOTTOMLEFT ); if (bShowV && bVOutline && !pRowOutline[SC_SPLIT_TOP]) - pRowOutline[SC_SPLIT_TOP] = new ScOutlineWindow( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_TOPLEFT ); + pRowOutline[SC_SPLIT_TOP] = VclPtr<ScOutlineWindow>::Create( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_TOPLEFT ); if (bShowH && bHeader && !pColBar[SC_SPLIT_RIGHT]) - pColBar[SC_SPLIT_RIGHT] = new ScColBar( pFrameWin, &aViewData, SC_SPLIT_RIGHT, + pColBar[SC_SPLIT_RIGHT] = VclPtr<ScColBar>::Create( pFrameWin, &aViewData, SC_SPLIT_RIGHT, &aHdrFunc, pHdrSelEng ); if (bShowV && bHeader && !pRowBar[SC_SPLIT_TOP]) - pRowBar[SC_SPLIT_TOP] = new ScRowBar( pFrameWin, &aViewData, SC_SPLIT_TOP, + pRowBar[SC_SPLIT_TOP] = VclPtr<ScRowBar>::Create( pFrameWin, &aViewData, SC_SPLIT_TOP, &aHdrFunc, pHdrSelEng ); // Windows anzeigen - ShowHide( &aHScrollLeft, bHScrollMode ); - ShowHide( &aHScrollRight, bShowH && bHScrollMode ); - ShowHide( &aVScrollBottom, bVScrollMode ); - ShowHide( &aVScrollTop, bShowV && bVScrollMode ); - ShowHide( &aScrollBarBox, bVScrollMode || bHScrollMode ); + ShowHide( aHScrollLeft.get(), bHScrollMode ); + ShowHide( aHScrollRight.get(), bShowH && bHScrollMode ); + ShowHide( aVScrollBottom.get(), bVScrollMode ); + ShowHide( aVScrollTop.get(), bShowV && bVScrollMode ); + ShowHide( aScrollBarBox.get(), bVScrollMode || bHScrollMode ); ShowHide( pHSplitter, bHScrollMode || bShowH ); // immer angelegt ShowHide( pVSplitter, bVScrollMode || bShowV ); @@ -2221,27 +2221,27 @@ void ScTabView::StartDataSelect() void ScTabView::EnableRefInput(bool bFlag) { - aHScrollLeft.EnableInput(bFlag); - aHScrollRight.EnableInput(bFlag); - aVScrollBottom.EnableInput(bFlag); - aVScrollTop.EnableInput(bFlag); - aScrollBarBox.EnableInput(bFlag); + aHScrollLeft->EnableInput(bFlag); + aHScrollRight->EnableInput(bFlag); + aVScrollBottom->EnableInput(bFlag); + aVScrollTop->EnableInput(bFlag); + aScrollBarBox->EnableInput(bFlag); // ab hier dynamisch angelegte - if(pTabControl!=NULL) pTabControl->EnableInput(bFlag,true); + if(pTabControl!=nullptr) pTabControl->EnableInput(bFlag,true); - if(pGridWin[SC_SPLIT_BOTTOMLEFT]!=NULL) + if(pGridWin[SC_SPLIT_BOTTOMLEFT]!=nullptr) pGridWin[SC_SPLIT_BOTTOMLEFT]->EnableInput(bFlag,false); - if(pGridWin[SC_SPLIT_BOTTOMRIGHT]!=NULL) + if(pGridWin[SC_SPLIT_BOTTOMRIGHT]!=nullptr) pGridWin[SC_SPLIT_BOTTOMRIGHT]->EnableInput(bFlag,false); - if(pGridWin[SC_SPLIT_TOPLEFT]!=NULL) + if(pGridWin[SC_SPLIT_TOPLEFT]!=nullptr) pGridWin[SC_SPLIT_TOPLEFT]->EnableInput(bFlag,false); - if(pGridWin[SC_SPLIT_TOPRIGHT]!=NULL) + if(pGridWin[SC_SPLIT_TOPRIGHT]!=nullptr) pGridWin[SC_SPLIT_TOPRIGHT]->EnableInput(bFlag,false); - if(pColBar[SC_SPLIT_RIGHT]!=NULL) + if(pColBar[SC_SPLIT_RIGHT]!=nullptr) pColBar[SC_SPLIT_RIGHT]->EnableInput(bFlag,false); - if(pRowBar[SC_SPLIT_TOP]!=NULL) + if(pRowBar[SC_SPLIT_TOP]!=nullptr) pRowBar[SC_SPLIT_TOP]->EnableInput(bFlag,false); } diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 9e7d4d0b2809..6d355f70af20 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1423,8 +1423,8 @@ void ScTabView::ErrorMessage( sal_uInt16 nGlobStrId ) } } - InfoBox aBox( pParent, ScGlobal::GetRscString( nGlobStrId ) ); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox( pParent, ScGlobal::GetRscString( nGlobStrId ) ); + aBox->Execute(); if (bFocus) pParent->GrabFocus(); } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index b0db92dc355b..ecc9e2b81624 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -623,7 +623,7 @@ void ScTabView::TestHintWindow() aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() ) { // HintWindow anlegen, bestimmt seine Groesse selbst - mpInputHintWindow.reset(new ScHintWindow(pWin, aTitle, aMessage)); + mpInputHintWindow.reset(VclPtr<ScHintWindow>::Create(pWin, aTitle, aMessage)); Size aHintWndSize = mpInputHintWindow->GetSizePixel(); long nCellSizeX = 0; long nCellSizeY = 0; diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index fba9ede166a2..8d21f9cd66bc 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -382,41 +382,41 @@ void ScTabView::UpdateScrollBars() nVisXL = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, MAXCOL, 0 ); - SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL ); + SetScrollBar( *aHScrollLeft.get(), nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL ); nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, MAXROW, nStartY ); - SetScrollBar( aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL ); + SetScrollBar( *aVScrollBottom.get(), nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL ); if (bRight) { nVisXR = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, MAXCOL, nStartX ); - SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL ); + SetScrollBar( *aHScrollRight.get(), nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL ); } if (bTop) { nVisYT = aViewData.VisibleCellsY( SC_SPLIT_TOP ); long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, MAXROW, 0 ); - SetScrollBar( aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL ); + SetScrollBar( *aVScrollTop.get(), nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL ); } // Bereich testen - nDiff = lcl_UpdateBar( aHScrollLeft, nVisXL ); + nDiff = lcl_UpdateBar( *aHScrollLeft.get(), nVisXL ); if (nDiff) ScrollX( nDiff, SC_SPLIT_LEFT ); if (bRight) { - nDiff = lcl_UpdateBar( aHScrollRight, nVisXR ); + nDiff = lcl_UpdateBar( *aHScrollRight.get(), nVisXR ); if (nDiff) ScrollX( nDiff, SC_SPLIT_RIGHT ); } - nDiff = lcl_UpdateBar( aVScrollBottom, nVisYB ); + nDiff = lcl_UpdateBar( *aVScrollBottom.get(), nVisYB ); if (nDiff) ScrollY( nDiff, SC_SPLIT_BOTTOM ); if (bTop) { - nDiff = lcl_UpdateBar( aVScrollTop, nVisYT ); + nDiff = lcl_UpdateBar( *aVScrollTop.get(), nVisYT ); if (nDiff) ScrollY( nDiff, SC_SPLIT_TOP ); } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 033fae392d3c..07262e175ce4 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -74,7 +74,7 @@ void ScTabView::Init() for (i=0; i<4; i++) pGridWin[i] = NULL; - pGridWin[SC_SPLIT_BOTTOMLEFT] = new ScGridWindow( pFrameWin, &aViewData, SC_SPLIT_BOTTOMLEFT ); + pGridWin[SC_SPLIT_BOTTOMLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_BOTTOMLEFT ); pSelEngine = new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], this, SC_SPLIT_BOTTOMLEFT ); @@ -82,23 +82,23 @@ void ScTabView::Init() pHdrSelEng = new ScHeaderSelectionEngine( pFrameWin, &aHdrFunc ); - pColBar[SC_SPLIT_LEFT] = new ScColBar( pFrameWin, &aViewData, SC_SPLIT_LEFT, + pColBar[SC_SPLIT_LEFT] = VclPtr<ScColBar>::Create( pFrameWin, &aViewData, SC_SPLIT_LEFT, &aHdrFunc, pHdrSelEng ); pColBar[SC_SPLIT_RIGHT] = NULL; - pRowBar[SC_SPLIT_BOTTOM] = new ScRowBar( pFrameWin, &aViewData, SC_SPLIT_BOTTOM, + pRowBar[SC_SPLIT_BOTTOM] = VclPtr<ScRowBar>::Create( pFrameWin, &aViewData, SC_SPLIT_BOTTOM, &aHdrFunc, pHdrSelEng ); pRowBar[SC_SPLIT_TOP] = NULL; for (i=0; i<2; i++) pColOutline[i] = pRowOutline[i] = NULL; - pHSplitter = new ScTabSplitter( pFrameWin, WinBits( WB_HSCROLL ), &aViewData ); - pVSplitter = new ScTabSplitter( pFrameWin, WinBits( WB_VSCROLL ), &aViewData ); + pHSplitter = VclPtr<ScTabSplitter>::Create( pFrameWin, WinBits( WB_HSCROLL ), &aViewData ); + pVSplitter = VclPtr<ScTabSplitter>::Create( pFrameWin, WinBits( WB_VSCROLL ), &aViewData ); // SSA: override default keyboard step size to allow snap to row/column pHSplitter->SetKeyboardStepSize( 1 ); pVSplitter->SetKeyboardStepSize( 1 ); - pTabControl = new ScTabControl(pFrameWin, &aViewData); + pTabControl = VclPtr<ScTabControl>::Create(pFrameWin, &aViewData); if (mbInlineWithScrollbar) pTabControl->SetStyle(pTabControl->GetStyle() | WB_SIZEABLE); @@ -108,10 +108,10 @@ void ScTabView::Init() explicitly because the parent frame window is already RTL disabled. */ pTabControl->EnableRTL( AllSettings::GetLayoutRTL() ); - InitScrollBar( aHScrollLeft, MAXCOL+1 ); - InitScrollBar( aHScrollRight, MAXCOL+1 ); - InitScrollBar( aVScrollTop, MAXROW+1 ); - InitScrollBar( aVScrollBottom, MAXROW+1 ); + InitScrollBar( *aHScrollLeft.get(), MAXCOL+1 ); + InitScrollBar( *aHScrollRight.get(), MAXCOL+1 ); + InitScrollBar( *aVScrollTop.get(), MAXROW+1 ); + InitScrollBar( *aVScrollBottom.get(), MAXROW+1 ); /* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc. is now handled correctly at the respective places. */ @@ -176,24 +176,31 @@ ScTabView::~ScTabView() delete pSelEngine; // Delete this before the grid windows, since it's a child window of one of them. - mpInputHintWindow.reset(); + mpInputHintWindow.disposeAndClear(); for (i=0; i<4; i++) - delete pGridWin[i]; + pGridWin[i].disposeAndClear(); delete pHdrSelEng; for (i=0; i<2; i++) { - delete pColBar[i]; - delete pRowBar[i]; - delete pColOutline[i]; - delete pRowOutline[i]; + pColBar[i].disposeAndClear(); + pRowBar[i].disposeAndClear(); + pColOutline[i].disposeAndClear(); + pRowOutline[i].disposeAndClear(); } - delete pHSplitter; - delete pVSplitter; - - delete pTabControl; + aScrollBarBox.disposeAndClear(); + aCornerButton.disposeAndClear(); + aTopButton.disposeAndClear(); + aHScrollLeft.disposeAndClear(); + aHScrollRight.disposeAndClear(); + aVScrollTop.disposeAndClear(); + aVScrollBottom.disposeAndClear(); + + pHSplitter.disposeAndClear(); + pVSplitter.disposeAndClear(); + pTabControl.disposeAndClear(); } void ScTabView::MakeDrawView( TriState nForceDesignMode ) diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index e4f1b71d91ff..d4d3068818d1 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -975,7 +975,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { OUString aText(ScResId(SCSTR_PASSWORD)); - boost::scoped_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(GetDialogParent(), &aText)); + VclPtrInstance< SfxPasswordDialog > pDlg(GetDialogParent(), &aText); pDlg->SetText( ScResId(SCSTR_UNPROTECTDOC) ); pDlg->SetMinLen( 0 ); pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() ); @@ -997,7 +997,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { OUString aText(ScResId(SCSTR_PASSWORDOPT)); - boost::scoped_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(GetDialogParent(), &aText)); + VclPtrInstance< SfxPasswordDialog > pDlg(GetDialogParent(), &aText); pDlg->SetText( ScResId(SCSTR_PROTECTDOC) ); pDlg->SetMinLen( 0 ); pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() ); @@ -1043,7 +1043,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if (pProtect && pProtect->isProtectedWithPass()) { OUString aText( ScResId(SCSTR_PASSWORDOPT) ); - boost::scoped_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(GetDialogParent(), &aText)); + VclPtrInstance< SfxPasswordDialog > pDlg(GetDialogParent(), &aText); pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) ); pDlg->SetMinLen( 0 ); pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand() ); @@ -1069,7 +1069,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { // Protect a current sheet. - boost::scoped_ptr<ScTableProtectionDlg> pDlg(new ScTableProtectionDlg(GetDialogParent())); + VclPtrInstance< ScTableProtectionDlg > pDlg(GetDialogParent()); ScTableProtection* pProtect = pDoc->GetTabProtection(nTab); if (pProtect) diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 429314fd7a2e..71661bf301bb 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1063,14 +1063,15 @@ bool ScTabViewShell::HasPrintOptionsPage() const return true; } -SfxTabPage* ScTabViewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) +VclPtr<SfxTabPage> ScTabViewShell::CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT ); if ( ScTpPrintOptionsCreate ) - return (*ScTpPrintOptionsCreate)( pParent, &rOptions); - return 0; + return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions), + SAL_NO_ACQUIRE); + return VclPtr<SfxTabPage>(); } void ScTabViewShell::StopEditShell() diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 3108c34a9774..fbbfa248d74e 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -145,14 +145,14 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { if (!mbInSwitch) { - pResult = new ScNameDlg( pB, pCW, pParent, &GetViewData(), + pResult = VclPtr<ScNameDlg>::Create( pB, pCW, pParent, &GetViewData(), ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ) ); } else { - pResult = new ScNameDlg( pB, pCW, pParent, &GetViewData(), + pResult = VclPtr<ScNameDlg>::Create( pB, pCW, pParent, &GetViewData(), ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ), &maRangeMap); @@ -168,7 +168,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { std::map<OUString, ScRangeName*> aRangeMap; pDoc->GetRangeNameMap(aRangeMap); - pResult = new ScNameDefDlg( pB, pCW, pParent, &GetViewData(), aRangeMap, + pResult = VclPtr<ScNameDefDlg>::Create( pB, pCW, pParent, &GetViewData(), aRangeMap, ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ), true ); @@ -181,7 +181,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr->first, itr->second)); } - pResult = new ScNameDefDlg( pB, pCW, pParent, &GetViewData(), aRangeMap, + pResult = VclPtr<ScNameDefDlg>::Create( pB, pCW, pParent, &GetViewData(), aRangeMap, ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ), false ); @@ -191,7 +191,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( case SID_DEFINE_COLROWNAMERANGES: { - pResult = new ScColRowNameRangesDlg( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScColRowNameRangesDlg>::Create( pB, pCW, pParent, &GetViewData() ); } break; @@ -229,7 +229,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { aArgSet.Put( ScConsolidateItem( SCITEM_CONSOLIDATEDATA, pDlgData ) ); } - pResult = new ScConsolidateDlg( pB, pCW, pParent, aArgSet ); + pResult = VclPtr<ScConsolidateDlg>::Create( pB, pCW, pParent, aArgSet ); } break; @@ -241,7 +241,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) MarkDataArea( false ); - pResult = new ScDbNameDlg( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScDbNameDlg>::Create( pB, pCW, pParent, &GetViewData() ); } break; @@ -270,7 +270,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( // aktuelle Tabelle merken (wg. RefInput im Dialog) GetViewData().SetRefTabNo( GetViewData().GetTabNo() ); - pResult = new ScSpecialFilterDlg( pB, pCW, pParent, aArgSet ); + pResult = VclPtr<ScSpecialFilterDlg>::Create( pB, pCW, pParent, aArgSet ); } break; @@ -297,7 +297,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( // aktuelle Tabelle merken (wg. RefInput im Dialog) GetViewData().SetRefTabNo( GetViewData().GetTabNo() ); - pResult = new ScFilterDlg( pB, pCW, pParent, aArgSet ); + pResult = VclPtr<ScFilterDlg>::Create( pB, pCW, pParent, aArgSet ); } break; @@ -309,7 +309,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( rViewData.GetTabNo(), false, false, false ); - pResult = new ScTabOpDlg( pB, pCW, pParent, rViewData.GetDocument(), aCurPos ); + pResult = VclPtr<ScTabOpDlg>::Create( pB, pCW, pParent, rViewData.GetDocument(), aCurPos ); } break; @@ -319,79 +319,79 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( ScAddress aCurPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); - pResult = new ScSolverDlg( pB, pCW, pParent, rViewData.GetDocument(), aCurPos ); + pResult = VclPtr<ScSolverDlg>::Create( pB, pCW, pParent, rViewData.GetDocument(), aCurPos ); } break; case SID_RANDOM_NUMBER_GENERATOR_DIALOG: { - pResult = new ScRandomNumberGeneratorDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScRandomNumberGeneratorDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_SAMPLING_DIALOG: { - pResult = new ScSamplingDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScSamplingDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_DESCRIPTIVE_STATISTICS_DIALOG: { - pResult = new ScDescriptiveStatisticsDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScDescriptiveStatisticsDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_ANALYSIS_OF_VARIANCE_DIALOG: { - pResult = new ScAnalysisOfVarianceDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScAnalysisOfVarianceDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_CORRELATION_DIALOG: { - pResult = new ScCorrelationDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScCorrelationDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_COVARIANCE_DIALOG: { - pResult = new ScCovarianceDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScCovarianceDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_EXPONENTIAL_SMOOTHING_DIALOG: { - pResult = new ScExponentialSmoothingDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScExponentialSmoothingDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_MOVING_AVERAGE_DIALOG: { - pResult = new ScMovingAverageDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScMovingAverageDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_TTEST_DIALOG: { - pResult = new ScTTestDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScTTestDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_FTEST_DIALOG: { - pResult = new ScFTestDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScFTestDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_ZTEST_DIALOG: { - pResult = new ScZTestDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScZTestDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; case SID_CHI_SQUARE_TEST_DIALOG: { - pResult = new ScChiSquareTestDialog( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScChiSquareTestDialog>::Create( pB, pCW, pParent, &GetViewData() ); } break; @@ -399,7 +399,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { ScViewData& rViewData = GetViewData(); ScAddress aCurPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); - pResult = new ScOptSolverDlg( pB, pCW, pParent, rViewData.GetDocShell(), aCurPos ); + pResult = VclPtr<ScOptSolverDlg>::Create( pB, pCW, pParent, rViewData.GetDocShell(), aCurPos ); } break; @@ -413,14 +413,14 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( ScViewData& rViewData = GetViewData(); rViewData.SetRefTabNo( rViewData.GetTabNo() ); ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); - pResult = new ScPivotLayoutDialog(pB, pCW, pParent, &rViewData, pDialogDPObject, pObj == NULL); + pResult = VclPtr<ScPivotLayoutDialog>::Create(pB, pCW, pParent, &rViewData, pDialogDPObject, pObj == nullptr); } } break; case SID_OPENDLG_EDIT_PRINTAREA: { - pResult = new ScPrintAreasDlg( pB, pCW, pParent ); + pResult = VclPtr<ScPrintAreasDlg>::Create( pB, pCW, pParent ); } break; @@ -428,14 +428,14 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { // Dialog schaut selber, was in der Zelle steht - pResult = new ScFormulaDlg( pB, pCW, pParent, &GetViewData(),ScGlobal::GetStarCalcFunctionMgr() ); + pResult = VclPtr<ScFormulaDlg>::Create( pB, pCW, pParent, &GetViewData(),ScGlobal::GetStarCalcFunctionMgr() ); } break; case SID_MANAGE_XML_SOURCE: { #if ENABLE_ORCUS - pResult = new ScXMLSourceDlg(pB, pCW, pParent, pDoc); + pResult = VclPtr<ScXMLSourceDlg>::Create(pB, pCW, pParent, pDoc); #endif } break; @@ -444,7 +444,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { // Dialog schaut selber, was in der Zelle steht - pResult = new ScHighlightChgDlg( pB, pCW, pParent, &GetViewData() ); + pResult = VclPtr<ScHighlightChgDlg>::Create( pB, pCW, pParent, &GetViewData() ); } break; @@ -454,7 +454,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( ScViewData& rViewData = GetViewData(); rViewData.SetRefTabNo( rViewData.GetTabNo() ); - pResult = new ScSimpleRefDlg( pB, pCW, pParent ); + pResult = VclPtr<ScSimpleRefDlg>::Create( pB, pCW, pParent ); } break; diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index c5264dd1da70..17dbaa8d2831 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -263,7 +263,7 @@ bool ScTabViewShell::ExecuteRetypePassDlg(ScPasswordHash eDesiredHash) { ScDocument* pDoc = GetViewData().GetDocument(); - boost::scoped_ptr<ScRetypePassDlg> pDlg(new ScRetypePassDlg(GetDialogParent())); + VclPtrInstance< ScRetypePassDlg > pDlg(GetDialogParent()); pDlg->SetDataFromDocument(*pDoc); pDlg->SetDesiredHash(eDesiredHash); if (pDlg->Execute() != RET_OK) diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 7f303eaf9815..db445ce55c91 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1074,11 +1074,11 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bRecord, bool bC { if (!bApi) { - MessBox aBox( GetViewData().GetDialogParent(), + ScopedVclPtrInstance<MessBox> aBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO_CANCEL | WB_DEF_NO), ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), ScGlobal::GetRscString( STR_MERGE_NOTEMPTY ) ); - sal_uInt16 nRetVal = aBox.Execute(); + sal_uInt16 nRetVal = aBox->Execute(); if ( nRetVal == RET_YES ) rDoContents = true; @@ -1771,10 +1771,10 @@ void ScViewFunc::Solve( const ScSolveParam& rParam ) aMsgStr += ScGlobal::GetRscString( STR_MSSG_SOLVE_4 ); } - MessBox aBox( GetViewData().GetDialogParent(), + ScopedVclPtrInstance<MessBox> aBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_NO), ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), aMsgStr ); - sal_uInt16 nRetVal = aBox.Execute(); + sal_uInt16 nRetVal = aBox->Execute(); if ( RET_YES == nRetVal ) EnterValue( nDestCol, nDestRow, nDestTab, nSolveResult ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 992e480dd22e..f1dd83099799 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -832,8 +832,8 @@ bool checkDestRangeForOverwrite(const ScRangeList& rDestRanges, const ScDocument if (!bIsEmpty) { - ScReplaceWarnBox aBox(pParentWnd); - if (aBox.Execute() != RET_YES) + ScopedVclPtrInstance< ScReplaceWarnBox > aBox(pParentWnd); + if (aBox->Execute() != RET_YES) { // changing the configuration is within the ScReplaceWarnBox return false; @@ -1041,9 +1041,9 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, { ScWaitCursorOff aWaitOff( GetFrameWin() ); OUString aMessage = ScGlobal::GetRscString( STR_PASTE_BIGGER ); - QueryBox aBox( GetViewData().GetDialogParent(), + ScopedVclPtrInstance<QueryBox> aBox( GetViewData().GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_NO), aMessage ); - if ( aBox.Execute() != RET_YES ) + if ( aBox->Execute() != RET_YES ) { return false; } @@ -1910,7 +1910,7 @@ bool ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, b void ScViewFunc::DataFormPutData( SCROW nCurrentRow , SCROW nStartRow , SCCOL nStartCol , SCROW nEndRow , SCCOL nEndCol , - boost::ptr_vector<boost::nullable<Edit> >& aEdits, + std::vector<VclPtr<Edit> >& aEdits, sal_uInt16 aColLength ) { ScDocument* pDoc = GetViewData().GetDocument(); @@ -1952,9 +1952,9 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow , for(sal_uInt16 i = 0; i < aColLength; i++) { - if (!aEdits.is_null(i)) + if (aEdits[i] != nullptr) { - OUString aFieldName=aEdits[i].GetText(); + OUString aFieldName=aEdits[i]->GetText(); pDoc->SetString( nStartCol + i, nCurrentRow, nTab, aFieldName ); } } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 0317fa4d7201..0ccf18bd5b2b 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -99,8 +99,8 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, if (pActWin) { pEngine->SetPaperSize(Size(100000,100000)); - vcl::Window aWin( pActWin ); - EditView aEditView( pEngine.get(), &aWin ); + VclPtrInstance< vcl::Window > aWin( pActWin ); + EditView aEditView( pEngine.get(), aWin.get() ); aEditView.SetOutputArea(Rectangle(0,0,100000,100000)); // same method now for clipboard or drag&drop @@ -387,8 +387,8 @@ void ScViewFunc::DoThesaurus( bool bRecord ) LanguageType eLnge = ScViewUtil::GetEffLanguage( &rDoc, ScAddress( nCol, nRow, nTab ) ); OUString aErr = SvtLanguageTable::GetLanguageString(eLnge); aErr += ScGlobal::GetRscString( STR_SPELLING_NO_LANG ); - InfoBox aBox( GetViewData().GetDialogParent(), aErr ); - aBox.Execute(); + ScopedVclPtrInstance< InfoBox > aBox( GetViewData().GetDialogParent(), aErr ); + aBox->Execute(); } if (pThesaurusEngine->IsModified()) { diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 92ddab74a3b1..d2c9d38ab3a3 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1403,9 +1403,9 @@ void ScViewFunc::RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) ScDocShellModificator aModificator( *pDocSh ); - VirtualDevice aVirtDev; - aVirtDev.SetMapMode(MAP_PIXEL); - pDoc->StyleSheetChanged( pStyleSheet, true, &aVirtDev, + ScopedVclPtrInstance< VirtualDevice > pVirtDev; + pVirtDev->SetMapMode(MAP_PIXEL); + pDoc->StyleSheetChanged( pStyleSheet, true, pVirtDev, rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), @@ -1429,9 +1429,9 @@ void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) ScDocShellModificator aModificator( *pDocSh ); - VirtualDevice aVirtDev; - aVirtDev.SetMapMode(MAP_PIXEL); - pDoc->StyleSheetChanged( pStyleSheet, false, &aVirtDev, + ScopedVclPtrInstance< VirtualDevice > pVirtDev; + pVirtDev->SetMapMode(MAP_PIXEL); + pDoc->StyleSheetChanged( pStyleSheet, false, pVirtDev, rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index e789276d6a0b..0224565d322c 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -115,9 +115,28 @@ ScXMLSourceDlg::ScXMLSourceDlg( mpBtnSelectSource->GrabFocus(); // Initial focus is on the select source button. } +ScXMLSourceDlg::~ScXMLSourceDlg() +{ + disposeOnce(); +} + +void ScXMLSourceDlg::dispose() +{ + mpBtnSelectSource.clear(); + mpFtSourceFile.clear(); + mpMapGrid.clear(); + mpLbTree.clear(); + mpRefEdit.clear(); + mpRefBtn.clear(); + mpBtnOk.clear(); + mpBtnCancel.clear(); + mpActiveEdit.clear(); + ScAnyRefDlg::dispose(); +} + bool ScXMLSourceDlg::IsRefInputMode() const { - return mpActiveEdit != NULL && mpActiveEdit->IsEnabled(); + return mpActiveEdit != nullptr && mpActiveEdit->IsEnabled(); } void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc) |